Delete Scanner.cpp

Delete Scanner.cpp

--- Scanner.cpp
+++ Scanner.cpp
@@ -1,72 +0,0 @@
-#include "scanner.h"
-
-/*void Scanner::setInput(string in) {buffer = in;}
-
-int Scanner::nextToken() {
-    if (skipLeadingWhiteSpace() >= buffer.length())
-      return EOS;
-    else if (isdigit(currentChar())) {
-      _tokenValue = extractNumber();
-      return NUMBER;
-    }  else if (islower(currentChar())) {
-      string s = extractAtom();
-      processToken<ATOM>(s);
-      return ATOM;
-    } else if (isSpecialCh(currentChar())) {
-      string s = extractAtomSC();
-      processToken<ATOMSC>(s);
-      return ATOMSC;
-    } else if (isupper(currentChar()) || currentChar() == '_') {
-      string s = extractVar();
-      processToken<VAR>(s);
-      return VAR;
-    } else {
-      _tokenValue = NONE;
-      return extractChar();
-    }
-}
-
-
-int Scanner::tokenValue() const {return _tokenValue;}
-
-
-int Scanner::skipLeadingWhiteSpace() {
-  for (; (buffer[pos] == ' ' || buffer[pos] == '\t') && pos<buffer.length(); ++pos);
-  return position();
-}
-
-int Scanner::position() const {return pos;}
-
-char Scanner::currentChar() {
-  return buffer[pos];
-}
-
-// extractX: extract X and set position right after X
-int Scanner::extractNumber() {
-  int posBegin = position();
-  for (;isdigit(buffer[pos]); ++pos);
-  //std::cout << pos << std::endl;
-  return stoi(buffer.substr(posBegin, pos-posBegin));
-}
-
-string Scanner::extractAtom() {
-  int posBegin = position();
-  for (;isalnum(buffer[pos]); ++pos);
-  return buffer.substr(posBegin, pos-posBegin);
-}
-
-string Scanner::extractAtomSC() {
-  int posBegin = position();
-  for (;isSpecialCh(buffer[pos]); ++pos);
-  return buffer.substr(posBegin, pos-posBegin);
-}
-
-string Scanner::extractVar() {
-  int posBegin = position();
-  for (;isalnum(buffer[pos]) || buffer[pos] == '_'; ++pos);
-  return buffer.substr(posBegin, pos-posBegin);
-}
-
-char Scanner::extractChar() {
-  return buffer[pos++];
-}


Fixed Species shape inconsistency

Fixed Species shape inconsistency

--- Species.cpp
+++ Species.cpp
@@ -33,7 +33,6 @@

 // Don't allow species with impossible shape (z<1 or collision with self)
 bool Species::generateDna(){
-//cout<<"generate"<<endl;
   clearDna();

   DNA* d = new DNA(NULL);
@@ -53,12 +52,13 @@

     for (int j=0; j<i-1; ++j){
       int prevX = pos[j][0], prevY = pos[j][1], prevZ = pos[j][2];
-      if (prevX == x+1 && prevY == y   && prevZ == z)   takenDirs.push_back(0);
-      if (prevX == x-1 && prevY == y   && prevZ == z)   takenDirs.push_back(1);
-      if (prevX == x   && prevY == y+1 && prevZ == z)   takenDirs.push_back(2);
-      if (prevX == x   && prevY == y-1 && prevZ == z)   takenDirs.push_back(3);
-      if (prevX == x   && prevY == y   && prevZ == z+1) takenDirs.push_back(4);
-      if (prevX == x   && prevY == y   && prevZ == z-1) {
+
+      if      (prevX == x+1 && prevY == y   && prevZ == z)   takenDirs.push_back(0);
+      else if (prevX == x-1 && prevY == y   && prevZ == z)   takenDirs.push_back(1);
+      else if (prevX == x   && prevY == y+1 && prevZ == z)   takenDirs.push_back(2);
+      else if (prevX == x   && prevY == y-1 && prevZ == z)   takenDirs.push_back(3);
+      else if (prevX == x   && prevY == y   && prevZ == z+1) takenDirs.push_back(4);
+      else if (prevX == x   && prevY == y   && prevZ == z-1) {
         takenDirs.push_back(5);
         canGoDown = false;
       }
@@ -75,21 +75,16 @@

     if (takenDirs.size() >6) {
       cout << "ERROR: more than 6 taken dirs!" <<endl;
-      for (unsigned int p=0;p<takenDirs.size();p++) cout<<takenDirs[p]<<" "<<endl;
-      cout<<"relative creature position so far:"<<endl;
-      for (int e=0; e<i; ++e){
-        cout<<"\t" << pos[e][0] << ", " << pos[e][1] << ", " << pos[e][2] <<endl;
-      }
+      exit(8);
     }

     int direction = randInt(6 - takenDirs.size());
+    sort(takenDirs.begin(), takenDirs.end(), std::less<int>());
     for (unsigned int k=0; k<takenDirs.size(); ++k){
       if (takenDirs[k] <= direction){
         ++direction;
       }
     }
-
-//cout << "new direction="<< direction << endl;

     DNA* d = new DNA(NULL);
     d->growthDirection = direction;
@@ -105,7 +100,6 @@
     else if (direction == 3) pos[i][1] = y-1;
     else if (direction == 4) pos[i][2] = z+1;
     else if (direction == 5) pos[i][2] = z-1;
-//    cout<<"pos="<<pos[i][0]<<", "<<pos[i][1]<<", "<<pos[i][2]<<endl;
   }

   return true;


Add quotation marks to include and lib path in case the directory have spaces

--- MainWindow.cpp
+++ MainWindow.cpp
@@ -116,7 +116,7 @@
         QString contents = QString(priFile.readAll());
         //Insert OF path
         QString ofPathWithoutSuffix = m_OFPath;
-        contents.replace("#OF_PATH#", ofPathWithoutSuffix.remove(ofPathWithoutSuffix.length() - 1, 1));
+        contents.replace("#OF_PATH#", "\"" + ofPathWithoutSuffix.remove(ofPathWithoutSuffix.length() - 1, 1) + "\"");
         insertAddons(contents);

         //Write the changed pri file to the new path
@@ -171,19 +171,19 @@

             if (dirIt.fileInfo().isDir()) {
                 if (includePaths.contains(dirIt.fileInfo().absoluteDir().absolutePath()) == false) {
-                    priContent += "INCLUDEPATH += " + dirIt.filePath() + "\n";
+                    priContent += "INCLUDEPATH += \"" + dirIt.filePath() + "\"\n";
                 }
                 continue;
             }

             if (dirIt.fileInfo().suffix() == "cpp") {
-                priContent += "SOURCES += " + dirIt.filePath() + "\n";
+                priContent += "SOURCES += \"" + dirIt.filePath() + "\"\n";
             }
             else if (dirIt.fileInfo().suffix() == "h") {
-                priContent += "HEADERS += " + dirIt.filePath() + "\n";
+                priContent += "HEADERS += \"" + dirIt.filePath() + "\"\n";
             }
             else if (dirIt.fileInfo().suffix() == "lib") {
-                priContent += "LIBS += " + dirIt.filePath() + "\n";
+                priContent += "LIBS += \"" + dirIt.filePath() + "\"\n";
             }
         }
     }


better wording

better wording

--- MainWindow.cpp
+++ MainWindow.cpp
@@ -581,7 +581,7 @@

         connect(mapper, SIGNAL(mapped(QString)), SLOT(loadMovie(QString)));
     } else {
-        QLabel * oops = new QLabel("De WTSmovie map bevat geen Quick Time filmpjes (bestanden met een naam die eindigt met'.mov' uitgang).\n"
+        QLabel * oops = new QLabel("De WTSmovie map bevat geen Quick Time filmpjes (bestanden met een naam met '.mov' uitgang).\n"
                                    "Plaats een aantal van zulke bestanden in de map en start de tool opnieuw.");
         layout->addWidget(oops,0,0);
         layout->setAlignment(oops, Qt::AlignHCenter);


*** empty log message ***

*** empty log message ***

--- MllrTrainer.cc
+++ MllrTrainer.cc
@@ -144,6 +144,8 @@

     for (i = 0; i < m_dim; i++)
       detA *= A(i, i);
+
+    fprintf(stderr, "calculate_transform: Adet = %.4f\n", detA);

     scale(cofactors, detA);

@@ -181,18 +183,19 @@
   {
     b1[i] = (*bias)[i];
     b2[i] = trans(i, 0);
+    fprintf(stderr, "%.2f\n", b1[i]);
     for (j = 0; j < m_dim; j++)
     {
       A1(i, j) = (*matrix)[i*m_dim + j];
       A2(i, j) = trans(i, j + 1);
     }
   }
-
-  // calculate A x + b =  A2 (A1 x + b1) + b2
-  d_vector b(m_dim);
-  mult(A2, A1, A);
-  mult(A2, b1, b);
-  add(b2, b);
+
+//   // calculate A x + b =  A2 (A1 x + b1) + b2
+//   d_vector b(m_dim);
+//   mult(A2, A1, A);
+//   mult(A2, b1, b);
+//   add(b2, b);

   // Set the transformation
   std::vector<float> new_bias;
@@ -201,10 +204,10 @@
   new_matrix.resize(m_dim*m_dim, 0);
   for (i = 0; i < m_dim; i++)
   {
-    new_bias[i] = b[i];
+    new_bias[i] = b2[i];
     for (j = 0; j < m_dim; j++)
     {
-      new_matrix[i*m_dim+j] = A(i, j);
+      new_matrix[i*m_dim+j] = A2(i, j);
     }
   }


fetch correct buffer width when buffer is NULL

--- SRC/GRAPHICS.C
+++ SRC/GRAPHICS.C
@@ -21,8 +21,11 @@
 /* ***** */
 void gfx_drawPixel(int x, int y, const unsigned char color, gfx_drawBuffer *buffer)
 {
+    int bufferW = buffer ? buffer->width : SCREEN_WIDTH;
+    int bufferH = buffer ? buffer->height : SCREEN_HEIGHT;
+
     // naive "clipping"
-    if(x >= buffer->width || x < 0 || y >= buffer->height || y < 0) return;
+    if(x >= bufferW || x < 0 || y >= bufferH || y < 0) return;

     if(!buffer)
         VGA[(y << 8) + (y << 6) + x] = color;
@@ -33,8 +36,11 @@
 /* ***** */
 void gfx_drawPixelDepth(int x, int y, float invZ, const unsigned char color, gfx_drawBuffer *buffer)
 {
+    int bufferW = buffer ? buffer->width : SCREEN_WIDTH;
+    int bufferH = buffer ? buffer->height : SCREEN_HEIGHT;
+
     // naive "clipping"
-    if(x >= buffer->width || x < 0 || y >= buffer->height || y < 0) return;
+    if(x >= bufferW || x < 0 || y >= bufferH || y < 0) return;

     // no depth info for VGA array, so ignore invZ
     if(!buffer)


add routine for NodePacketMemberType::getParsed() to print itself as Generics or SerializerName

--- SyntaxTree.cpp
+++ SyntaxTree.cpp
@@ -471,6 +471,68 @@
             }
             break;

+            case CsParseAs::GenericType1:
+            {
+                parsed << *(generic1->getParsed(CsParseAs::Default));
+            }
+            break;
+
+            case CsParseAs::GenericType2:
+            {
+                parsed << *(generic2->getParsed(CsParseAs::Default));
+            }
+            break;
+
+            case CsParseAs::GenericType3:
+            {
+                parsed << *(generic3->getParsed(CsParseAs::Default));
+            }
+            break;
+
+            case CsParseAs::GenericTypeSerializer1:
+            {
+                parsed << *(generic1->getParsed(CsParseAs::SerializerName));
+            }
+            break;
+
+            case CsParseAs::GenericTypeSerializer2:
+            {
+                parsed << *(generic2->getParsed(CsParseAs::SerializerName));
+            }
+            break;
+
+            case CsParseAs::GenericTypeSerializer3:
+            {
+                parsed << *(generic3->getParsed(CsParseAs::SerializerName));
+            }
+            break;
+
+            case CsParseAs::SerializerName:
+            {
+                switch (typeType)
+                {
+                    case Parser::token::PRIMITIVE_DATA_TYPE:
+                    {
+                        string* serializerName = lookupSerializerName(value);
+                        parsed << *serializerName;
+                    }
+                    break;
+
+                    case Parser::token::REFERENCE_DATA_TYPE:
+                    {
+                        parsed << TCS_PACKET_CUSTOM_SERIALIZER_NAME;
+                    }
+                    break;
+
+                    default:
+                    {
+                        throw(runtime_error("Serializer not supported for nested generic type"));
+                    }
+                    break;
+                }
+            }
+            break;
+
             case CsParseAs::Initialization:
             {
                 switch (typeType)


Minor cleanup - prefer automatic allocation to new/delete.

git-svn-id: 6fc9ba494899942902f7488ac93c4c58960a7ec4@1408 1f79f812-37fb-46fe-a122-30589dd2bf55

--- TVTreeCtrl.cpp
+++ TVTreeCtrl.cpp
@@ -914,7 +914,6 @@
   // After we have dragged successfully from our Tree to another Tree
   ((DboxMain *)m_parent)->Delete();
   ((DboxMain *)m_parent)->RefreshList();
-  return;
 }

 bool CTVTreeCtrl::CollectData(BYTE * &out_buffer, long &outLen)
@@ -967,18 +966,17 @@

   CDDObList in_oblist;

-  CSMemFile *pinDDmemfile;
-  pinDDmemfile = new CSMemFile;
-  pinDDmemfile->Attach((BYTE *)clear_buffer, clearLen);
-
-  CArchive ar_in (pinDDmemfile, CArchive::load);
+  CSMemFile inDDmemfile;
+
+  inDDmemfile.Attach((BYTE *)clear_buffer, clearLen);
+
+  CArchive ar_in (&inDDmemfile, CArchive::load);
   in_oblist.Serialize(ar_in);
   ar_in.Close();

-  pinDDmemfile->Detach();
+  inDDmemfile.Detach();
   trashMemory(clear_buffer, clearLen);
   free(clear_buffer);
-  delete pinDDmemfile;

   if (!in_oblist.IsEmpty()) {
     ((DboxMain *)m_parent)->AddEntries(in_oblist, DropGroup);
@@ -994,50 +992,41 @@
 void CTVTreeCtrl::DecryptReceivedData(BYTE * &in_buffer, const long &inLen,
                                       unsigned char * &out_buffer, long &outLen)
 {
-  CSMemFile *pinMemFile;
+  CSMemFile inMemFile;
   CMyString passwd;

   out_buffer = NULL;
   outLen = 0;

-  // Create a memory file
-  pinMemFile = new CSMemFile;
-
   // Point to data
-  pinMemFile->Attach((BYTE *)in_buffer, inLen, 0);
+  inMemFile.Attach((BYTE *)in_buffer, inLen, 0);

   // Generate password from their classname and the CLIPFORMAT
   passwd.Format(_T("%s%04x"), m_sending_classname, gbl_tcddCPFID);

   // Decrypt it
-  DecryptMemory(out_buffer, outLen, passwd, pinMemFile);
-
-  pinMemFile->Detach();
-  delete pinMemFile;
+  DecryptMemory(out_buffer, outLen, passwd, &inMemFile);
+
+  inMemFile.Detach();
 }

 void CTVTreeCtrl::EncryptSendingData(unsigned char * &in_buffer, const long &inLen,
                                      BYTE * &out_buffer, long &outLen)
 {
-  CSMemFile *poutMemFile;
+  CSMemFile outMemFile;
   CMyString passwd;
-
-  // Create a memory file
-  poutMemFile = new CSMemFile;

   // Generate password from our classname and the CLIPFORMAT
   passwd.Format(_T("%s%04x"), gbl_classname, gbl_tcddCPFID);

   // Encrypt it
-  EncryptMemory(in_buffer, inLen, passwd, poutMemFile);
-
-  outLen = (long)poutMemFile->GetLength();
+  EncryptMemory(in_buffer, inLen, passwd, &outMemFile);
+
+  outLen = (long)outMemFile.GetLength();
   if (outLen > 0) {
     // Create buffer for clipboard
-    out_buffer = (BYTE *)poutMemFile->Detach();
-  }
-
-  delete poutMemFile;
+    out_buffer = (BYTE *)outMemFile.Detach();
+  }
 }

 void
@@ -1061,9 +1050,7 @@
 void
 CTVTreeCtrl::GetEntryData(CDDObList &out_oblist, CItemData *ci)
 {
-  CDDObject *pDDObject;
-
-  pDDObject = new CDDObject;
+  CDDObject *pDDObject = new CDDObject;

   uuid_array_t uuid_array;
   ci->GetUUID(uuid_array);


Slightly modify sample

Slightly modify sample

--- Test/Entry.cpp
+++ Test/Entry.cpp
@@ -38,34 +38,43 @@
    camComponent->SetFov(60.0f);
    camTransform->SetPosition(Vector3(0.0f, 0.0f, -5.0f));

-   Entity* upperLight = world->CreateEntity(TEXT("Upper Light"));
-   LightComponent* upperLightComponent = upperLight->AddComponent<LightComponent>();
-   Transform* upperLightTransform = upperLight->GetTransform();
-   upperLightComponent->SetLightType(ELightType::Point);
-   upperLightComponent->SetRadiance(Vector3(100.0f, 100.0f, 100.0f));
-   upperLightTransform->SetPosition(Vector3(0.0f, 10.0f, 0.0f));
-
-   Entity* leftLight = world->CreateEntity(TEXT("Left Light"));
-   LightComponent* leftLightComponent = leftLight->AddComponent<LightComponent>();
-   Transform* leftLightTransform = leftLight->GetTransform();
-   leftLightComponent->SetLightType(ELightType::Point);
-   leftLightComponent->SetRadiance(Vector3(0.0f, 50.0f, 0.0f));
-   leftLightTransform->SetPosition(Vector3(-15.0f, 0.0f, 0.0f));
-
-   Entity* rightLight = world->CreateEntity(TEXT("Right Light"));
-   LightComponent* rightLightComponent = rightLight->AddComponent<LightComponent>();
-   Transform* rightLightTransform = rightLight->GetTransform();
-   rightLightComponent->SetLightType(ELightType::Point);
-   rightLightComponent->SetRadiance(Vector3(0.0f, 0.0f, 50.0f));
-   rightLightTransform->SetPosition(Vector3(15.0f, 0.0f, 0.0f));
+   Entity* mainLight = world->CreateEntity(TEXT("Upper Light"));
+   LightComponent* mainLightComponent = mainLight->AddComponent<LightComponent>();
+   Transform* mainLightTransform = mainLight->GetTransform();
+   mainLightComponent->SetLightType(ELightType::Point);
+   mainLightComponent->SetRadiance(Vector3(200.0f, 200.0f, 200.0f));
+   mainLightTransform->SetPosition(Vector3(0.0f, 0.0f, -5.0f));

    Model* damagedHelmetModel = resMng->Load<Model>(TEXT("Contents/Models/DamagedHelmet/DamagedHelmet.gltf"));
    Entity* damagedHelmet = Model::Instantiate(damagedHelmetModel, world, TEXT("DamagedHelmet"));
    Entity* damagedHelmetMesh = damagedHelmet->GetChildren()[0];
    RotateComponent* damagedHelmetRotation = damagedHelmet->AddComponent<RotateComponent>();
-   MeshRenderComponent* renderComponent = damagedHelmetMesh->GetComponent<MeshRenderComponent>();
-   Material* damagedHelmetMaterial = renderComponent->GetMaterial();
+   MeshRenderComponent* helmetRenderComponent = damagedHelmetMesh->GetComponent<MeshRenderComponent>();
+   Material* damagedHelmetMaterial = helmetRenderComponent->GetMaterial();
    damagedHelmetMaterial->Save();
+
+   Model* lanternModel = resMng->Load<Model>(TEXT("Contents/Models/Lantern/Lantern.gltf"));
+   Entity* lantern = Model::Instantiate(lanternModel, world, TEXT("Lantern"));
+   Entity* lanternMesh = lantern->GetChildren()[0];
+   RotateComponent* lanternRotateComponent = lantern->AddComponent<RotateComponent>();
+   MeshRenderComponent* lanternRenderComponent = lanternMesh->GetComponent<MeshRenderComponent>();
+   Material* lanternMaterial = lanternRenderComponent->GetMaterial();
+   lanternMaterial->Save();
+
+   Transform* lanternTransform = lantern->GetTransform();
+   lanternTransform->SetScale(Vector3(0.1f, 0.1f, 0.1f));
+   lanternTransform->SetPosition(Vector3(-2.5f, -0.9f, 0.0f));
+
+   Model* metalRoughSpheresModel = resMng->Load<Model>(TEXT("Contents/Models/MetalRoughSpheres/MetalRoughSpheres.gltf"));
+   Entity* spheresEntity = Model::Instantiate(metalRoughSpheresModel, world, TEXT("Spheres"));
+   Entity* spheresMesh = spheresEntity->GetChildren()[0];
+   MeshRenderComponent* spheresRenderComponent = spheresMesh->GetComponent<MeshRenderComponent>();
+   Material* spheresMaterial = spheresRenderComponent->GetMaterial();
+   spheresMaterial->Save();
+
+   Transform* spheresTransform = spheresEntity->GetTransform();
+   //spheresTransform->SetScale(Vector3(0.1f, 0.1f, 0.1f));
+   spheresTransform->SetPosition(Vector3(0.0f, 0.0f, 4.0f));

    int execute = engine->Execute( );
    //world->Save();


Modularise nonce, mix hash and seed hash.

--- TestHelper.cpp
+++ TestHelper.cpp
@@ -81,7 +81,7 @@
 	bool completed = false;
 	f.onSolutionFound([&](ProofOfWork::Solution sol)
 	{
-		ProofOfWork::assignResult(sol, _bi);
+		_bi.proof = sol;
 		return completed = true;
 	});
 	f.setWork(_bi);


hoops, it should do metadata lookup if it didn't find an album

--- WebFetcher.cpp
+++ WebFetcher.cpp
@@ -81,11 +81,12 @@
 				if (album->mbid == "") {
 					/* hmm, didn't find the album? */
 					delete album;
-					continue;
-				}
-				albums[album->mbid] = album;
-				/* compare the other files in group with this album */
-				compareFilesWithAlbum(&scores, &group->second, album);
+				} else {
+					albums[album->mbid] = album;
+					/* compare the other files in group with this album */
+					compareFilesWithAlbum(&scores, &group->second, album);
+					continue;
+				}
 			}
 			/* meta lookup */
 			vector<Metatrack> *tracks = locutus->webservice->searchMetadata(makeWSQuery(group->first, mf));


Rewrite llvm_assign_zero and llvm_zero_derivs in terms of llvm_memset, much simpler.  (Thanks for the suggestion, ckulla.)

--- src/liboslexec/llvm_instance.cpp
+++ src/liboslexec/llvm_instance.cpp
@@ -648,32 +648,13 @@
 void
 RuntimeOptimizer::llvm_assign_zero (const Symbol &sym)
 {
-    ASSERT (! sym.typespec().is_closure());
-    TypeSpec elemtype = sym.typespec().elementtype();
-    if (elemtype.is_int()) {
-        int arraylen = sym.typespec().simpletype().numelements();
-        llvm::Value *arrayindex = NULL;
-        llvm::Value *zero = llvm_constant ((int)0);
-        for (int a = 0;  a < arraylen;  ++a) {
-            if (sym.typespec().is_array())
-                arrayindex = llvm_constant(a);
-            llvm_store_value (zero, sym, 0, arrayindex, 0);
-        }
-    } else {
-        // Must be float-based
-        ASSERT (elemtype.is_floatbased());
-        int arraylen = sym.typespec().simpletype().numelements();
-        llvm::Value *arrayindex = NULL;
-        int num_components = sym.typespec().simpletype().aggregate;
-        llvm::Value *zero = llvm_constant (0.0f);
-        for (int a = 0;  a < arraylen;  ++a) {
-            if (sym.typespec().is_array())
-                arrayindex = llvm_constant(a);
-            for (int i = 0;  i < num_components;  ++i)
-                llvm_store_value (zero, sym, 0, arrayindex, i);
-        }
-        llvm_zero_derivs (sym);
-    }
+    // Just memset the whole thing to zero, let LLVM sort it out.
+    // This even works for closures.
+    int len = sym.typespec().is_closure() ? sizeof(void *) : sym.derivsize();
+    // N.B. derivsize() includes derivs, if there are any
+    size_t align = sym.typespec().is_closure() ? sizeof(void*) :
+                         sym.typespec().simpletype().basesize();
+    llvm_memset (llvm_void_ptr(sym), 0, len, (int)align);
 }

@@ -681,21 +662,14 @@
 void
 RuntimeOptimizer::llvm_zero_derivs (const Symbol &sym)
 {
-    ASSERT (! sym.typespec().is_closure());
+    // Just memset the derivs to zero, let LLVM sort it out.
     TypeSpec elemtype = sym.typespec().elementtype();
     if (sym.has_derivs() && elemtype.is_floatbased()) {
-        int arraylen = sym.typespec().simpletype().numelements();
-        llvm::Value *arrayindex = NULL;
-        int num_components = sym.typespec().simpletype().aggregate;
-        llvm::Value *zero = llvm_constant (0.0f);
-        for (int a = 0;  a < arraylen;  ++a) {
-            if (sym.typespec().is_array())
-                arrayindex = llvm_constant(a);
-            for (int i = 0;  i < num_components;  ++i)
-                llvm_store_value (zero, sym, 1, arrayindex, i);  // clear dx
-            for (int i = 0;  i < num_components;  ++i)
-                llvm_store_value (zero, sym, 2, arrayindex, i);  // clear dy
-        }
+        int len = sym.typespec().is_closure() ? sizeof(void *) : sym.size();
+        size_t align = sym.typespec().is_closure() ? sizeof(void*) :
+                             sym.typespec().simpletype().basesize();
+        llvm_memset (llvm_void_ptr(sym,1), /* point to start of x deriv */
+                     0, 2*len /* size of both derivs */, (int)align);
     }
 }


GBE: Handle empty basicblock in Instruction selection

I meet a corner case which leads to empty bb.

Lable $12
add %3, %2, 1

and what's more %3 is not used anymore later, so we will not select
instruction for this line of code. Then only Label instruction left
in the bb, which leads to wrong endifLabel used. The fix simply
generate endif instruction if needed at first in matchBasicBlock().

Signed-off-by: Ruiling Song <286a174c1339c6eff91abc41c3a1012c95030c95@intel.com>
Reviewed-by: Zhigang Gong <e04a7b9b70b1e4c6318cf117dcd1a9056e14b97a@linux.intel.com>

--- backend/src/backend/gen_insn_selection.cpp
+++ backend/src/backend/gen_insn_selection.cpp
@@ -402,7 +402,7 @@
     /*! Build a DAG for the basic block (return number of instructions) */
     uint32_t buildBasicBlockDAG(const ir::BasicBlock &bb);
     /*! Perform the selection on the basic block */
-    void matchBasicBlock(uint32_t insnNum);
+    void matchBasicBlock(const ir::BasicBlock &bb, uint32_t insnNum);
     /*! A root instruction needs to be generated */
     bool isRoot(const ir::Instruction &insn) const;

@@ -1530,10 +1530,16 @@
     return insnNum;
   }

-  void Selection::Opaque::matchBasicBlock(uint32_t insnNum)
+  void Selection::Opaque::matchBasicBlock(const ir::BasicBlock &bb, uint32_t insnNum)
   {
     // Bottom up code generation
     bool needEndif = this->block->hasBranch == false && !this->block->hasBarrier;
+
+    if(needEndif) {
+      const ir::BasicBlock *next = bb.getNextBlock();
+      this->ENDIF(GenRegister::immd(0), next->getLabelIndex());
+    }
+
     for (int32_t insnID = insnNum-1; insnID >= 0; --insnID) {
       // Process all possible patterns for this instruction
       SelectionDAG &dag = *insnDAG[insnID];
@@ -1570,13 +1576,6 @@
           this->block->isLargeBlock = true;
         }

-        if (needEndif) {
-          const ir::BasicBlock *curr = insn.getParent();
-          const ir::BasicBlock *next = curr->getNextBlock();
-          this->ENDIF(GenRegister::immd(0), next->getLabelIndex());
-          needEndif = false;
-        }
-
         // Output the code in the current basic block
         this->endBackwardGeneration();
       }
@@ -1593,7 +1592,7 @@
       this->dagPool.rewind();
       this->appendBlock(bb);
       const uint32_t insnNum = this->buildBasicBlockDAG(bb);
-      this->matchBasicBlock(insnNum);
+      this->matchBasicBlock(bb, insnNum);
     });
    }


Add bulletproof null check to previous check-in

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@9016 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- WebCore/khtml/khtmlview.cpp
+++ WebCore/khtml/khtmlview.cpp
@@ -603,7 +603,7 @@
     ScrollBarMode hMode = d->hmode;
     ScrollBarMode vMode = d->vmode;

-    RenderObject* rootRenderer = document->documentElement()->renderer();
+    RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0;
     if (document->isHTMLDocument()) {
         NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
         if (body && body->renderer()) {
@@ -618,7 +618,7 @@
             }
         }
     }
-    else
+    else if (rootRenderer)
         applyOverflowToViewport(rootRenderer, hMode, vMode); // XML/XHTML UAs use the root element.

 #ifdef INSTRUMENT_LAYOUT_SCHEDULING


Windows build fix.

Windows build fix.

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@37943 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- WebKit/win/WebInspector.cpp
+++ WebKit/win/WebInspector.cpp
@@ -224,10 +224,10 @@

 HRESULT STDMETHODCALLTYPE WebInspector::isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled)
 {
-    if (!isProfiling)
+    if (!isProfilingEnabled)
         return E_POINTER;

-    *isProfiling = FALSE;
+    *isProfilingEnabled = FALSE;

     if (!m_webView)
         return S_OK;


Have sync initialization kick off TemplateURLService's lazy load.

We now force the lazy load in SearchEngineDTC much like we do with Autofill to prevent Sync from waiting on a TURL-related action.

BUG=116426
TEST=Verify 116426

Review URL: http://codereview.chromium.org/9615019

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@125436 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/sync/glue/search_engine_data_type_controller.cc
+++ chrome/browser/sync/glue/search_engine_data_type_controller.cc
@@ -45,10 +45,14 @@

 // We want to start the TemplateURLService before we begin associating.
 bool SearchEngineDataTypeController::StartModels() {
-  // If the TemplateURLService is loaded, continue with association.
+  // If the TemplateURLService is loaded, continue with association. We force
+  // a load here to prevent the rest of Sync from waiting on
+  // TemplateURLService's lazy load.
   TemplateURLService* turl_service =
       TemplateURLServiceFactory::GetForProfile(profile_);
-  if (turl_service && turl_service->loaded()) {
+  DCHECK(turl_service);
+  turl_service->Load();
+  if (turl_service->loaded()) {
     return true;  // Continue to Associate().
   }


Fixed build of fullscreen_controller_unittest.cc.

GCC 4.6.3 on Linux failed with:
fullscreen_controller_unittest.cc: In member function ‘void FullscreenControllerUnitTest::VerifyWindowState()’:
fullscreen_controller_unittest.cc:444:7: error: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Werror=conversion-null]

TBR=scheib@chromium.org

Review URL: https://codereview.chromium.org/11078011

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@160634 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/ui/fullscreen/fullscreen_controller_unittest.cc
+++ chrome/browser/ui/fullscreen/fullscreen_controller_unittest.cc
@@ -441,24 +441,24 @@
     case STATE_NORMAL:
       EXPECT_EQ(FullscreenControllerTestWindow::NORMAL,
                 window_->state()) << GetAndClearDebugLog();
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForBrowser());
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForTabOrPending());
-      EXPECT_EQ(false, fullscreen_controller_->IsInMetroSnapMode());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForBrowser());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForTabOrPending());
+      EXPECT_FALSE(fullscreen_controller_->IsInMetroSnapMode());
       break;
     case STATE_BROWSER_FULLSCREEN_NO_CHROME:
       EXPECT_EQ(FullscreenControllerTestWindow::FULLSCREEN,
                 window_->state()) << GetAndClearDebugLog();
-      EXPECT_EQ(true, fullscreen_controller_->IsFullscreenForBrowser());
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForTabOrPending());
-      EXPECT_EQ(false, fullscreen_controller_->IsInMetroSnapMode());
+      EXPECT_TRUE(fullscreen_controller_->IsFullscreenForBrowser());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForTabOrPending());
+      EXPECT_FALSE(fullscreen_controller_->IsInMetroSnapMode());
       break;
 #if defined(OS_WIN)
     case STATE_METRO_SNAP:
       EXPECT_EQ(FullscreenControllerTestWindow::METRO_SNAP,
                 window_->state()) << GetAndClearDebugLog();
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForBrowser());
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForTabOrPending());
-      EXPECT_EQ(true, fullscreen_controller_->IsInMetroSnapMode());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForBrowser());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForTabOrPending());
+      EXPECT_TRUE(fullscreen_controller_->IsInMetroSnapMode());
       break;
 #endif
     case STATE_TO_NORMAL:
@@ -466,14 +466,14 @@
                 window_->state()) << GetAndClearDebugLog();
       // No expectation for IsFullscreenForBrowser.
       // No expectation for IsFullscreenForTabOrPending.
-      EXPECT_EQ(false, fullscreen_controller_->IsInMetroSnapMode());
+      EXPECT_FALSE(fullscreen_controller_->IsInMetroSnapMode());
       break;
     case STATE_TO_BROWSER_FULLSCREEN_NO_CHROME:
       EXPECT_EQ(FullscreenControllerTestWindow::TO_FULLSCREEN,
                 window_->state()) << GetAndClearDebugLog();
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForBrowser());
-      EXPECT_EQ(false, fullscreen_controller_->IsFullscreenForTabOrPending());
-      EXPECT_EQ(false, fullscreen_controller_->IsInMetroSnapMode());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForBrowser());
+      EXPECT_FALSE(fullscreen_controller_->IsFullscreenForTabOrPending());
+      EXPECT_FALSE(fullscreen_controller_->IsInMetroSnapMode());
       break;
     default:
       NOTREACHED() << GetAndClearDebugLog();


Fix DCHECK for bw color mode.
It fails on corp goobuntu if print to 000...00-default printer.

Review URL: https://codereview.chromium.org/53803002

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@232087 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -1248,12 +1248,14 @@
     return;
   }

-  printing::ColorModel bw_model = cups_printer_color_models_->bw_model;
-  if (color == printing::GRAY && bw_model != printing::UNKNOWN_COLOR_MODEL) {
-    settings->SetInteger(printing::kSettingColor, bw_model);
-    return;
-  }
-  DCHECK_EQ(printing::COLOR, color);
+  if (color == printing::GRAY) {
+    if (cups_printer_color_models_->bw_model != printing::UNKNOWN_COLOR_MODEL) {
+      settings->SetInteger(printing::kSettingColor,
+                           cups_printer_color_models_->bw_model);
+    }
+    return;
+  }
+
   printing::ColorModel color_model = cups_printer_color_models_->color_model;
   if (color_model != printing::UNKNOWN_COLOR_MODEL)
     settings->SetInteger(printing::kSettingColor, color_model);


softbody fix #445

softbody fix #445


Change assertions to fix debug android compilation: {input,output}PixelBuffer => {input,output}Image

most likely a copy and paste error

--- ogles_gpgpu/platform/android/memtransfer_android.cpp
+++ ogles_gpgpu/platform/android/memtransfer_android.cpp
@@ -300,7 +300,7 @@
 }

 void MemTransferAndroid::toGPU(const unsigned char *buf) {
-    assert(preparedInput && inputPixelBuffer && inputTexId > 0 && buf);
+    assert(preparedInput && inputImage && inputTexId > 0 && buf);

     // bind the input texture
     glBindTexture(GL_TEXTURE_2D, inputTexId);
@@ -322,7 +322,7 @@
 }

 void MemTransferAndroid::fromGPU(unsigned char *buf) {
-    assert(preparedOutput && outputPixelBuffer && outputTexId > 0 && buf);
+    assert(preparedOutput && outputImage && outputTexId > 0 && buf);

     // bind the output texture
     glBindTexture(GL_TEXTURE_2D, outputTexId);


[S]서버 문제 수정

[S]서버 문제 수정

--- SkimaServer/SkimaServer/GameManager.cpp
+++ SkimaServer/SkimaServer/GameManager.cpp
@@ -253,7 +253,7 @@

     for (auto& game : m_GameList)
     {
-		if (game.second != NULL || game.second->IsEnd())
+		if (game.second->IsEnd())
 		{
 			continue;
 		}


set empty display function for glut window

With freeglut 3.0 moveit aborts over here, printing
> ERROR: No display callback registered for window 1

According to https://sourceforge.net/p/freeglut/bugs/229/
and https://www.opengl.org/resources/libraries/glut/spec3/node46.html
a callback *must* be registered for each window.

With this patch moveit starts up as expected.

--- moveit_ros/perception/mesh_filter/src/gl_renderer.cpp
+++ moveit_ros/perception/mesh_filter/src/gl_renderer.cpp
@@ -360,6 +360,10 @@
 boost::mutex mesh_filter::GLRenderer::context_lock_;
 bool mesh_filter::GLRenderer::glutInitialized_ = false;

+namespace {
+  void nullDisplayFunction(){};
+}
+
 void mesh_filter::GLRenderer::createGLContext ()
 {
   boost::mutex::scoped_lock _(context_lock_);
@@ -386,6 +390,7 @@
     glutInitWindowPosition (glutGet(GLUT_SCREEN_WIDTH) + 30000, 0);
     glutInitWindowSize(1, 1);
     GLuint window_id = glutCreateWindow( "mesh_filter" );
+    glutDisplayFunc(nullDisplayFunction);

     GLenum err = glewInit();
     if (GLEW_OK != err)


Check the HTTP status code (Pull Request #141)

--- astreamer/http_stream.cpp
+++ astreamer/http_stream.cpp
@@ -395,6 +395,8 @@
     HS_TRACE("A regular HTTP stream\n");

     CFHTTPMessageRef response = (CFHTTPMessageRef)CFReadStreamCopyProperty(m_readStream, kCFStreamPropertyHTTPResponseHeader);
+    CFIndex statusCode = 0;
+
     if (response) {
         /*
          * If the server responded with the icy-metaint header, the response
@@ -411,6 +413,10 @@

         HS_TRACE("icy-metaint: %zu\n", m_icyMetaDataInterval);

+        statusCode = CFHTTPMessageGetResponseStatusCode(response);
+
+        HS_TRACE("HTTP response code %zu", statusCode);
+
         CFStringRef icyNameString = CFHTTPMessageCopyHeaderFieldValue(response, CFSTR("icy-name"));
         if (icyNameString) {
             if (m_icyName) {
@@ -446,8 +452,20 @@
         CFRelease(response);
     }

-    if (m_delegate) {
+    if (m_delegate && statusCode == 200) {
         m_delegate->streamIsReadyRead();
+    } else {
+        if (m_delegate) {
+            CFStringRef statusCodeString = CFStringCreateWithFormat(NULL,
+                                                                    NULL,
+                                                                    CFSTR("HTTP response code %d"),
+                                                                    (unsigned int)statusCode);
+            m_delegate->streamErrorOccurred(statusCodeString);
+
+            if (statusCodeString) {
+                CFRelease(statusCodeString);
+            }
+        }
     }
 }


Enable ID3 tag parsing by default.

Enable ID3 tag parsing by default.

--- astreamer/http_stream.cpp
+++ astreamer/http_stream.cpp
@@ -11,7 +11,7 @@
 /*
  * Uncomment the following line to enable the experimental ID3 tag support
  */
-//#define INCLUDE_ID3TAG_SUPPORT 1
+#define INCLUDE_ID3TAG_SUPPORT 1

 namespace astreamer {


x Debug feature was not compiling anymore

git-svn-id: 294f12855175db510999321cff72188496f07bec@5076 45c5ae6f-87cc-4fd0-92ee-e4f023fd80da

--- Source/MediaInfo/MediaInfo_Internal.cpp
+++ Source/MediaInfo/MediaInfo_Internal.cpp
@@ -84,17 +84,17 @@
             Debug+=__T("\r\n"); \
             if (!Debug_Config.Opened_Get()) \
             { \
-                if (File_Names.empty()) \
+                if (Config.File_Names.empty()) \
                     Debug_Config.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Config.txt")); \
                 else \
                 { \
                     Ztring File_Temp; \
-                    if (File_Names[0].rfind(__T('\\'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('\\'))+1, string::npos); \
-                    else if (File_Names[0].rfind(__T('/'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('/'))+1, string::npos); \
+                    if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \
+                    else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \
                     else \
-                        File_Temp=File_Names[0]; \
+                        File_Temp=Config.File_Names[0]; \
                     Debug_Config.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Config.txt")); \
                 } \
             } \
@@ -145,31 +145,31 @@
         { \
             if (!Debug_Buffer_Stream.Opened_Get()) \
             { \
-                if (File_Names.empty()) \
+                if (Config.File_Names.empty()) \
                     Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Stream.0000000000000000")); \
                 else \
                 { \
                     Ztring File_Temp; \
-                    if (File_Names[0].rfind(__T('\\'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('\\'))+1, string::npos); \
-                    else if (File_Names[0].rfind(__T('/'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('/'))+1, string::npos); \
+                    if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \
+                    else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \
                     else \
-                        File_Temp=File_Names[0]; \
+                        File_Temp=Config.File_Names[0]; \
                     Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Buffer.Stream.0000000000000000")); \
                 } \
                 Debug_Buffer_Stream_Order=0; \
-                if (File_Names.empty()) \
+                if (Config.File_Names.empty()) \
                     Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Sizes.0000000000000000")); \
                 else \
                 { \
                     Ztring File_Temp; \
-                    if (File_Names[0].rfind(__T('\\'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('\\'))+1, string::npos); \
-                    else if (File_Names[0].rfind(__T('/'))!=string::npos) \
-                        File_Temp=File_Names[0].substr(File_Names[0].rfind(__T('/'))+1, string::npos); \
+                    if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \
+                    else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \
+                        File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \
                     else \
-                        File_Temp=File_Names[0]; \
+                        File_Temp=Config.File_Names[0]; \
                     Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Buffer.Sizes.0000000000000000")); \
                 } \
                 Debug_Buffer_Sizes_Count=0; \


git-svn-id: svn://svn.code.sf.net/p/mediainfo/code/MediaInfoLib/trunk@768 45c5ae6f-87cc-4fd0-92ee-e4f023fd80da

--- Source/MediaInfo/Multiple/File_Riff.cpp
+++ Source/MediaInfo/Multiple/File_Riff.cpp
@@ -182,7 +182,6 @@
                     }
                 #endif
                 #if defined(MEDIAINFO_AC3_YES)
-                    size_t A=Temp->second.Compression;
                     if (Temp->second.Compression==0x2000)
                     {
                         Fill(Stream_Audio, StreamPos_Last, Audio_Delay, ((float)((File_Ac3*)Temp->second.Parser)->Delay)*1000/Temp->second.Rate, 0, true);


Remove the IFM_TOKEN and IFM_FDDI usage from pc-networkmanager - removed from FreeBSD.

--- src/backend/NetDevice.cpp
+++ src/backend/NetDevice.cpp
@@ -169,11 +169,6 @@
    QString status;

    switch (IFM_TYPE(ifm.ifm_active)){
-      case IFM_FDDI:
-      case IFM_TOKEN:
-         if (ifm.ifm_status & IFM_ACTIVE) status = "inserted";
-         else status = "no ring";
-         break;
       case IFM_IEEE80211:
          if (ifm.ifm_status & IFM_ACTIVE) status = "associated";
          else status = "no carrier";


Add --json option to vespa-gen-testdocs.

--- searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp
+++ searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp
@@ -40,6 +40,22 @@
     return baseDir + "/" + file;
 }

+std::vector<string>
+splitArg(const string &arg)
+{
+    std::vector<string> argv;
+    string::size_type pos = 0;
+    for (;;) {
+        auto found = arg.find(',', pos);
+        if (found == string::npos) {
+            break;
+        }
+        argv.emplace_back(arg.substr(pos, found - pos));
+        pos = found + 1;
+    }
+    argv.emplace_back(arg.substr(pos, string::npos));
+    return argv;
+}

 void
 shafile(const string &baseDir,
@@ -148,15 +164,12 @@

 public:
     FieldGenerator(const string &name);
-
-    virtual
-    ~FieldGenerator();
-
-    virtual void
-    setup();
-
-    virtual void
-    generate(vespalib::asciistream &doc, uint32_t id) = 0;
+    virtual ~FieldGenerator();
+    virtual void setup();
+    virtual void generateXML(vespalib::asciistream &doc, uint32_t id);
+    virtual void generateJSON(vespalib::asciistream &doc, uint32_t id);
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id);
+    virtual bool isString() const { return true; }
 };

@@ -170,12 +183,103 @@
 {
 }

-
 void
 FieldGenerator::setup()
 {
 }

+void
+FieldGenerator::generateXML(vespalib::asciistream &doc, uint32_t id)
+{
+    doc << "  <" << _name << ">";
+    generateValue(doc, id);
+    doc << "</" << _name << ">\n";
+}
+
+void
+FieldGenerator::generateJSON(vespalib::asciistream &doc, uint32_t id)
+{
+    doc << "\"" << _name << "\": ";
+    bool needQuote = isString();
+    if (needQuote) {
+        doc << "\"";
+    }
+    generateValue(doc, id);
+    if (needQuote) {
+        doc << "\"";
+    }
+}
+
+void
+FieldGenerator::generateValue(vespalib::asciistream &, uint32_t)
+{
+}
+
+class ConstTextFieldGenerator : public FieldGenerator
+{
+    string _value;
+public:
+    ConstTextFieldGenerator(std::vector<string> argv);
+    virtual ~ConstTextFieldGenerator() override;
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
+};
+
+ConstTextFieldGenerator::ConstTextFieldGenerator(std::vector<string> argv)
+    : FieldGenerator(argv[0]),
+      _value()
+{
+    if (argv.size() > 1) {
+        _value = argv[1];
+    }
+}
+
+ConstTextFieldGenerator::~ConstTextFieldGenerator() = default;
+
+void
+ConstTextFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t)
+{
+    doc << _value;
+}
+
+class PrefixTextFieldGenerator : public FieldGenerator
+{
+    string _prefix;
+    uint32_t _mod;
+    uint32_t _div;
+public:
+    PrefixTextFieldGenerator(std::vector<string> argv);
+    virtual ~PrefixTextFieldGenerator() override;
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
+};
+
+PrefixTextFieldGenerator::PrefixTextFieldGenerator(std::vector<string> argv)
+    : FieldGenerator(argv[0]),
+      _prefix(),
+      _mod(std::numeric_limits<uint32_t>::max()),
+      _div(1u)
+{
+    if (argv.size() > 1) {
+        _prefix = argv[1];
+        if (argv.size() > 2) {
+            if (!argv[2].empty()) {
+                _mod = atol(argv[2].c_str());
+            }
+            if (argv.size() > 3) {
+                if (!argv[3].empty()) {
+                    _div = atol(argv[3].c_str());
+                }
+            }
+        }
+    }
+}
+
+PrefixTextFieldGenerator::~PrefixTextFieldGenerator() = default;
+
+void
+PrefixTextFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t id)
+{
+    doc << _prefix << ((id / _div) % _mod);
+}

 class RandTextFieldGenerator : public FieldGenerator
 {
@@ -191,15 +295,9 @@
                            uint32_t numWords,
                            uint32_t minFill,
                            uint32_t maxFill);
-
-    virtual
-    ~RandTextFieldGenerator();
-
-    virtual void
-    setup() override;
-
-    virtual void
-    generate(vespalib::asciistream &doc, uint32_t id) override;
+    virtual ~RandTextFieldGenerator();
+    virtual void setup() override;
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
 };

@@ -235,10 +333,8 @@

 void
-RandTextFieldGenerator::generate(vespalib::asciistream &doc, uint32_t id)
-{
-    (void) id;
-    doc << "  <" << _name << ">";
+RandTextFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t)
+{
     uint32_t gLen = _minFill + _rnd.lrand48() % (_randFill + 1);
     bool first = true;
     for (uint32_t i = 0; i < gLen; ++i) {
@@ -250,9 +346,7 @@
         assert(s.size() > 0);
         doc << s;
     }
-    doc << "</" << _name << ">\n";
-}
-
+}

 class ModTextFieldGenerator : public FieldGenerator
 {
@@ -263,12 +357,8 @@
     ModTextFieldGenerator(const string &name,
                           search::Rand48 &rnd,
                           const std::vector<uint32_t> &mods);
-
-    virtual
-    ~ModTextFieldGenerator();
-
-    virtual void
-    generate(vespalib::asciistream &doc, uint32_t id) override;
+    virtual ~ModTextFieldGenerator();
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
 };

@@ -288,10 +378,9 @@

 void
-ModTextFieldGenerator::generate(vespalib::asciistream &doc, uint32_t id)
+ModTextFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t id)
 {
     typedef std::vector<uint32_t>::const_iterator MI;
-    doc << "  <" << _name << ">";
     bool first = true;
     for (MI mi(_mods.begin()), me(_mods.end()); mi != me; ++mi) {
         uint32_t m = *mi;
@@ -300,7 +389,6 @@
         first = false;
         doc << "w" << m << "w" << (id % m);
     }
-    doc << "</" << _name << ">\n";
 }

@@ -308,12 +396,8 @@
 {
 public:
     IdTextFieldGenerator(const string &name);
-
-    virtual
-    ~IdTextFieldGenerator();
-
-    virtual void
-    generate(vespalib::asciistream &doc, uint32_t id) override;
+    virtual ~IdTextFieldGenerator();
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
 };

@@ -329,11 +413,9 @@

 void
-IdTextFieldGenerator::generate(vespalib::asciistream &doc, uint32_t id)
-{
-    doc << "  <" << _name << ">";
+IdTextFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t id)
+{
     doc << id;
-    doc << "</" << _name << ">\n";
 }

@@ -348,12 +430,9 @@
                           search::Rand48 &rnd,
                           uint32_t low,
                           uint32_t count);
-
-    virtual
-    ~RandIntFieldGenerator();
-
-    virtual void
-    generate(vespalib::asciistream &doc, uint32_t id) override;
+    virtual ~RandIntFieldGenerator();
+    virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override;
+    virtual bool isString() const override { return false; }
 };

@@ -376,13 +455,10 @@

 void
-RandIntFieldGenerator::generate(vespalib::asciistream &doc, uint32_t id)
-{
-    (void) id;
-    doc << "  <" << _name << ">";
+RandIntFieldGenerator::generateValue(vespalib::asciistream &doc, uint32_t)
+{
     uint32_t r = _low + _rnd.lrand48() % _count;
     doc << r;
-    doc << "</" << _name << ">\n";
 }

 class DocumentGenerator
@@ -399,17 +475,13 @@
     DocumentGenerator(const string &docType,
                       const string &idPrefix,
                       const FieldVec &fields);
-
     ~DocumentGenerator();
-
-    void
-    generate(uint32_t id);
-
-    void
-    generate(uint32_t docMin, uint32_t docCount,
-             const string &baseDir,
-             const string &feedFileName,
-             bool headers);
+    void generateXML(uint32_t id);
+    void generateJSON(uint32_t id);
+    void generate(uint32_t docMin, uint32_t docIdLimit,
+                  const string &baseDir,
+                  const string &feedFileName,
+                  bool headers, bool json);
 };

@@ -440,40 +512,68 @@

 void
-DocumentGenerator::generate(uint32_t id)
+DocumentGenerator::generateXML(uint32_t id)
 {
     _doc.clear();
-    _doc << "<document documenttype=\"" << _docType << "\" documentid= \"" <<
+    _doc << "<document documenttype=\"" << _docType << "\" documentid=\"" <<
         _idPrefix << id << "\">\n";
-    typedef FieldVec::const_iterator FI;
-    for (FI i(_fields.begin()), ie(_fields.end()); i != ie; ++i) {
-        (*i)->generate(_doc, id);
+    for (const auto &field : _fields) {
+        field->generateXML(_doc, id);
     }
     _doc << "</document>\n";
 }

-
-void
-DocumentGenerator::generate(uint32_t docMin, uint32_t docCount,
+void
+DocumentGenerator::generateJSON(uint32_t id)
+{
+    _doc.clear();
+    _doc << "  { \"put\": \"" << _idPrefix << id << "\",\n    \"fields\": {";
+    bool first = true;
+    for (const auto &field : _fields) {
+        if (!first) {
+            _doc << ",";
+        }
+        first = false;
+        _doc << "\n      ";
+        field->generateJSON(_doc, id);
+    }
+    _doc << "\n    }\n  }";
+}
+
+void
+DocumentGenerator::generate(uint32_t docMin, uint32_t docIdLimit,
                             const string &baseDir,
                             const string &feedFileName,
-                            bool headers)
+                            bool headers, bool json)
 {
     string fullName(prependBaseDir(baseDir, feedFileName));
     FastOS_File::Delete(fullName.c_str());
     Fast_BufferedFile f(new FastOS_File);
     f.WriteOpen(fullName.c_str());
-    if (headers) {
-        f.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
-        f.WriteString("<vespafeed>\n");
-    }
-    uint32_t docLim = docMin + docCount;
-    for (uint32_t id = docMin; id < docLim; ++id) {
-        generate(id);
-        f.WriteBuf(_doc.c_str(), _doc.size());
-    }
-    if (headers) {
-        f.WriteString("</vespafeed>\n");
+    if (json) {
+        bool first = true;
+        f.WriteString("[\n");
+        for (uint32_t id = docMin; id < docIdLimit; ++id) {
+            if (!first) {
+                f.WriteString(",\n");
+            }
+            first = false;
+            generateJSON(id);
+            f.WriteBuf(_doc.c_str(), _doc.size());
+        }
+        f.WriteString("\n]\n");
+    } else {
+        if (headers) {
+            f.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
+            f.WriteString("<vespafeed>\n");
+        }
+        for (uint32_t id = docMin; id < docIdLimit; ++id) {
+            generateXML(id);
+            f.WriteBuf(_doc.c_str(), _doc.size());
+        }
+        if (headers) {
+            f.WriteString("</vespafeed>\n");
+        }
     }
     f.Flush();
     f.Close();
@@ -522,6 +622,7 @@
     search::Rand48 _rnd;
     string _outFile;
     bool _headers;
+    bool _json;

 public:
     GenTestDocsApp(FastOS_Application &app)
@@ -537,7 +638,8 @@
           _mods(),
           _rnd(),
           _outFile(),
-          _headers(false)
+          _headers(false),
+          _json(false)
     {
         _mods.push_back(2);
         _mods.push_back(3);
@@ -572,6 +674,8 @@
     cerr <<
         "vespa-gen-testdocs gentestdocs\n"
         " [--basedir basedir]\n"
+        " [--consttextfield name]\n"
+        " [--prefixtextfield name]\n"
         " [--randtextfield name]\n"
         " [--modtextfield name]\n"
         " [--idtextfield name]\n"
@@ -581,6 +685,7 @@
         " [--numwords numWords]\n"
         " [--doctype docType]\n"
         " [--headers]\n"
+        " [--json]\n"
         " outFile\n";
 }

@@ -592,6 +697,8 @@
     int longopt_index = 0;
     static struct option longopts[] = {
         { "basedir", 1, NULL, 0 },
+        { "consttextfield", 1, NULL, 0 },
+        { "prefixtextfield", 1, NULL, 0 },
         { "randtextfield", 1, NULL, 0 },
         { "modtextfield", 1, NULL, 0 },
         { "idtextfield", 1, NULL, 0 },
@@ -601,10 +708,13 @@
         { "numwords", 1, NULL, 0 },
         { "doctype", 1, NULL, 0 },
         { "headers", 0, NULL, 0 },
+        { "json", 0, NULL, 0 },
         { NULL, 0, NULL, 0 }
     };
     enum longopts_enum {
         LONGOPT_BASEDIR,
+        LONGOPT_CONSTTEXTFIELD,
+        LONGOPT_PREFIXTEXTFIELD,
         LONGOPT_RANDTEXTFIELD,
         LONGOPT_MODTEXTFIELD,
         LONGOPT_IDTEXTFIELD,
@@ -613,7 +723,8 @@
         LONGOPT_MINDOCID,
         LONGOPT_NUMWORDS,
         LONGOPT_DOCTYPE,
-        LONGOPT_HEADERS
+        LONGOPT_HEADERS,
+        LONGOPT_JSON
     };
     int optIndex = 2;
     while ((c = _app.GetOptLong("v",
@@ -628,6 +739,12 @@
             case LONGOPT_BASEDIR:
                 _baseDir = optArgument;
                 break;
+            case LONGOPT_CONSTTEXTFIELD:
+                _fields.emplace_back(std::make_shared<ConstTextFieldGenerator>(splitArg(optArgument)));
+                break;
+            case LONGOPT_PREFIXTEXTFIELD:
+                _fields.emplace_back(std::make_shared<PrefixTextFieldGenerator>(splitArg(optArgument)));
+                break;
             case LONGOPT_RANDTEXTFIELD:
                 g.reset(new RandTextFieldGenerator(optArgument,
                                                    _rnd,
@@ -653,7 +770,6 @@
                                                   100000));
                 _fields.push_back(g);
                 break;
-                break;
             case LONGOPT_DOCIDLIMIT:
                 _docIdLimit = atoi(optArgument);
                 break;
@@ -668,6 +784,9 @@
                 break;
             case LONGOPT_HEADERS:
                 _headers = true;
+                break;
+            case LONGOPT_JSON:
+                _json = true;
                 break;
             default:
                 if (optArgument != NULL) {
@@ -708,7 +827,7 @@
                          idPrefix,
                          _fields);
     LOG(info, "generating %s", _outFile.c_str());
-    dg.generate(_minDocId, _docIdLimit, _baseDir, _outFile, _headers);
+    dg.generate(_minDocId, _docIdLimit, _baseDir, _outFile, _headers, _json);
     LOG(info, "done");
     return 0;
 }


cosmetic

cosmetic

--- Library/Sources/Stroika/Foundation/IO/FileAccessException.inl
+++ Library/Sources/Stroika/Foundation/IO/FileAccessException.inl
@@ -15,14 +15,8 @@
     using Characters::String;

     /**
-     * This exception is thrown when a given file is opened, or creation attempted, etc. It is a failure due to
-     * file (or directory) access permissions. It nearly always is the result of an operation (attempted and failed)
-     * on a given file (which is usually given in the object). It also is the result of a perticular operation/access
-     * failure (like read, write, or list).
-     *
      *  // @todo - this should subclass from Execution::Exception<filesystem::filesystem_error> - but needs some work...
      */
-
     class [[deprecated ("use IO::FileSystem::Exception instead (with make_error_code (errc::permission_denied) )- Since Stroika v2.1d18")]] FileAccessException : public Execution::SystemErrorException<>
     {
     private:


P4 to Git Change 1354481 by johtaylo@johtaylo-jtincrementor-increment on 2016/12/17 03:00:05

	 SWDEV-2 - Change OpenCL version number from 2306 to 2307.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#2053 edit

--- runtime/utils/versions.hpp
+++ runtime/utils/versions.hpp
@@ -12,7 +12,7 @@
 #endif // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-# define AMD_PLATFORM_BUILD_NUMBER 2306
+# define AMD_PLATFORM_BUILD_NUMBER 2307
 #endif // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


P4 to Git Change 1065141 by johtaylo@johtaylo-JTBUILDER03-increment on 2014/08/12 03:00:11

	EPR #010002 - Change OpenCL version number from 1608 to 1609.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#1355 edit

--- runtime/utils/versions.hpp
+++ runtime/utils/versions.hpp
@@ -12,7 +12,7 @@
 #endif // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-# define AMD_PLATFORM_BUILD_NUMBER 1608
+# define AMD_PLATFORM_BUILD_NUMBER 1609
 #endif // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


P4 to Git Change 1510302 by johtaylo@johtaylo-jtincrementor2-increment on 2018/01/31 03:00:05

	 SWDEV-2 - Change OpenCL version number from 2582 to 2583.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#2330 edit

--- runtime/utils/versions.hpp
+++ runtime/utils/versions.hpp
@@ -12,7 +12,7 @@
 #endif  // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-#define AMD_PLATFORM_BUILD_NUMBER 2582
+#define AMD_PLATFORM_BUILD_NUMBER 2583
 #endif  // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


P4 to Git Change 1365827 by johtaylo@johtaylo-jtincrementor-increment on 2017/01/25 03:00:09

	 SWDEV-2 - Change OpenCL version number from 2345 to 2346.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#2092 edit

--- runtime/utils/versions.hpp
+++ runtime/utils/versions.hpp
@@ -12,7 +12,7 @@
 #endif // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-# define AMD_PLATFORM_BUILD_NUMBER 2345
+# define AMD_PLATFORM_BUILD_NUMBER 2346
 #endif // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


P4 to Git Change 1334447 by johtaylo@johtaylo-jtincrementor-increment on 2016/11/01 03:00:04

	 SWDEV-2 - Change OpenCL version number from 2261 to 2262.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#2008 edit

--- runtime/utils/versions.hpp
+++ runtime/utils/versions.hpp
@@ -12,7 +12,7 @@
 #endif // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-# define AMD_PLATFORM_BUILD_NUMBER 2261
+# define AMD_PLATFORM_BUILD_NUMBER 2262
 #endif // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


added more tests for CRC32

added more tests for CRC32

--- UnitTests/Basics/hashes-test.cpp
+++ UnitTests/Basics/hashes-test.cpp
@@ -230,21 +230,25 @@
   buffer = "";
   BOOST_CHECK_EQUAL((uint64_t) 0ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 0ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 0ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = " ";
   BOOST_CHECK_EQUAL((uint64_t) 3916222277ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 3916222277ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 3916222277ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "  ";
   BOOST_CHECK_EQUAL((uint64_t) 4013102741ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 4013102741ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 4013102741ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "a";
   BOOST_CHECK_EQUAL((uint64_t) 3904355907ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 3904355907ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 3904355907ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "A";
@@ -315,11 +319,13 @@
   buffer = "the quick brown fox jumped over the lazy dog";
   BOOST_CHECK_EQUAL((uint64_t) 3783847129ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 3783847129ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 3783847129ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "The Quick Brown Fox Jumped Over The Lazy Dog";
   BOOST_CHECK_EQUAL((uint64_t) 3804975563ULL, TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 3804975563ULL, TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 3804975563ULL, TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));
 }

 ////////////////////////////////////////////////////////////////////////////////
@@ -332,51 +338,61 @@
   buffer = "ジャパン は、イギリスのニュー・ウェーヴバンド。デヴィッド・ ... を構築していった。 日本では初来日でいきなり武道館での公演を行うなど、爆発的な人気を誇ったが、英国ではなかなか人気が出ず、初期は典型的な「ビッグ・イン・ジャパン」状態であった。日本最大級のポータルサイト。検索、オークション、ニュース、メール、コミュニティ、ショッピング、など80以上のサービスを展開。あなたの生活をより豊かにする「ライフ・エンジン」を目指していきます。デヴィッド・シルヴィアンとその弟スティーヴ・ジャンセン、デヴィッドの親友であったミック・カーンを中心に結成。ミック・カーンの兄の結婚式にバンドとして最初のお披露目をした。当初はミック・カーンをリードボーカルとして練習していたが、本番直前になって怖じ気づいたミックがデヴィッド・シルヴィアンに無理矢理頼み込んでボーカルを代わってもらい、以降デヴィッドがリードボーカルとなった。その後高校の同級であったリチャード・バルビエリを誘い、更にオーディションでロブ・ディーンを迎え入れ、デビュー当初のバンドの形態となった。デビュー当初はアイドルとして宣伝されたグループだったが、英国の音楽シーンではほとんど人気が無かった。初期のサウンドは主に黒人音楽やグラムロックをポスト・パンク的に再解釈したものであったが、作品を重ねるごとに耽美的な作風、退廃的な歌詞やシンセサイザーの利用など独自のスタイルを構築していった。日本では初来日でいきなり武道館での公演を行うなど、爆発的な人気を誇ったが、英国ではなかなか人気が出ず、初期は典型的な「ビッグ・イン・ジャパン」状態であった。";
   BOOST_CHECK_EQUAL((uint64_t) 4162027650ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 4162027650ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 4162027650ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "코리아닷컴 메일알리미 서비스 중단안내 [안내] 개인정보취급방침 변경 안내 회사소개 | 광고안내 | 제휴안내 | 개인정보취급방침 | 청소년보호정책 | 스팸방지정책 | 사이버고객센터 | 약관안내 | 이메일 무단수집거부 | 서비스 전체보기";
   BOOST_CHECK_EQUAL((uint64_t) 2360481044ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 2360481044ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 2360481044ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "中华网以中国的市场为核心，致力为当地用户提供流动增值服务、网上娱乐及互联网服务。本公司亦推出网上游戏，及透过其门户网站提供包罗万有的网上产品及服务。";
   BOOST_CHECK_EQUAL((uint64_t) 644060807ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 644060807ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 644060807ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "כפי שסופיה קופולה היטיבה לבטא בסרטה אבודים בטוקיו, בתי מלון יוקרתיים בערים גדולות אמנם מציעים אינספור פינוקים, אבל הם גם עלולים לגרום לנו להרגיש בודדים ואומללים מאי פעם. לעומת זאת, B&B, בתים פרטיים שבהם אפשר לישון ולאכול ארוחת בוקר, הם דרך נהדרת להכיר עיר אירופאית כמו מקומיים ולפגוש אנשים מרתקים מרחבי העולם. לטובת מי שנוסע לממלכה בחודשים הקרובים, הגרדיאן הבריטי קיבץ את עשרת ה-B&B המומלצים ביותר בלונדון. כל שנותר הוא לבחור, ולהזמין מראש";
   BOOST_CHECK_EQUAL((uint64_t) 1177579087ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 1177579087ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 1177579087ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "بان يأسف لمقتل لاجئين سوريين بتركيا المرزوقي يندد بعنف الأمن التونسي تنديد بقتل الجيش السوري مصورا تلفزيونيا 14 قتيلا وعشرات الجرحى بانفجار بالصومال";
   BOOST_CHECK_EQUAL((uint64_t) 1650013020ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 1650013020ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 1650013020ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "Голкипер мадридского «Реала» Икер Касильяс призвал своих партнеров сосредоточить все мысли на предстоящем дерби с «Атлетико»";
   BOOST_CHECK_EQUAL((uint64_t) 1084564896ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 1084564896ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 1084564896ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "   ";
   BOOST_CHECK_EQUAL((uint64_t) 2342474570ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 2342474570ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 2342474570ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "अ आ इ ई उ ऊ ऋ ॠ ऌ ॡ ए ऐ ओ औ क ख ग घ ङ च छ ज झ ञ ट ठ ड ढ ण त थ द ध न प फ ब भ म य र ल व श ष स ह";
   BOOST_CHECK_EQUAL((uint64_t) 2714476779ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 2714476779ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 2714476779ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "tɜt kɐː mɔj ŋɨɜj siŋ za ɗew ɗɨɜk tɨɰ zɔ vɐː ɓiŋ ɗɐŋ vej ɲɜn fɜm vɐː kɨɜn. mɔj kɔn ŋɨɜj ɗeu ɗɨɜk tɐːw huɜ ɓɐːn cɔ li ci vɐː lɨɜŋ tɜm vɐː kɜn fɐːj ɗoj sɨ vɜj ɲɐw cɔŋ tiŋ ɓɐŋ hɨw.";
   BOOST_CHECK_EQUAL((uint64_t) 3194095589ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 3194095589ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 3194095589ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));

   buffer = "äöüßÄÖÜ€µ";
   BOOST_CHECK_EQUAL((uint64_t) 2590070434ULL,   TRI_Crc32HashString(buffer.c_str()));
   BOOST_CHECK_EQUAL((uint64_t) 2590070434ULL,   TRI_Crc32HashPointer(buffer.c_str(), strlen(buffer.c_str())));
+  BOOST_CHECK_EQUAL((uint64_t) 2590070434ULL,   TRI_FinalCrc32(TRI_BlockCrc32(TRI_InitialCrc32(), buffer.c_str(), strlen(buffer.c_str()))));
 }

 ////////////////////////////////////////////////////////////////////////////////


[ci skip] Fix CombatTask - moved check attackable count

--- Sources/Tasks/BasicTasks/CombatTask.cpp
+++ Sources/Tasks/BasicTasks/CombatTask.cpp
@@ -53,14 +53,6 @@
         return MetaData::COMBAT_SRC_IDX_OUT_OF_RANGE;
     }

-    // Source Minion Verification for Attacked Vector
-    if (source->attackableCount == 0)
-    {
-        return MetaData::COMBAT_ALREADY_ATTACKED;
-    }
-
-    source->attackableCount--;
-
     // Destination Verification
     // dst == 0 : hero
     // 1 < dst <= field.size : minion
@@ -84,6 +76,14 @@
     {
         return MetaData::COMBAT_TARGET_STEALTH;
     }
+
+    // Source Minion Verification for Attacked Vector
+    if (source->attackableCount == 0)
+    {
+        return MetaData::COMBAT_ALREADY_ATTACKED;
+    }
+
+    source->attackableCount--;

     BYTE sourceAttack = static_cast<BYTE>(source->attack);
     BYTE targetAttack = (dst > 0) ? static_cast<BYTE>(target->attack) : 0;


uncommented call to comboInterpreter.run() in ProcedureInterpreter.run() method, since there is no separate Task/Agent for running comboInterpreter separetely anymore

--- opencog/embodiment/Control/Procedure/ProcedureInterpreter.cc
+++ opencog/embodiment/Control/Procedure/ProcedureInterpreter.cc
@@ -11,8 +11,11 @@
     using namespace boost;

     void ProcedureInterpreter::run(MessagingSystem::NetworkElement *ne) {
-        // For now, comboInterpreter is a separate IdleTask. Otherwise, the next line should be uncommented.
-        //comboInterpreter->run(ne);
+
+        // If a separate Agent is used for comboInterpreter, just comment the
+        // next line :
+        comboInterpreter->run(ne);
+
         Set toBeRemoved;
         // Runs each pending RunningBuildInProcedure and checks status of any procedure.
         for (Map::iterator it = _map.begin(); it != _map.end(); it++) {


INTEGRATION: CWS warnings01 (1.6.132); FILE MERGED 2005/11/07 19:43:54 pl 1.6.132.3: RESYNC: (1.7-1.8); FILE MERGED 2005/09/23 01:28:05 sb 1.6.132.2: RESYNC: (1.6-1.7); FILE MERGED 2005/08/30 17:03:17 sb 1.6.132.1: #i53898# Made code warning-free.

--- sal/rtl/source/cmdargs.cxx
+++ sal/rtl/source/cmdargs.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: cmdargs.cxx,v $
  *
- *  $Revision: 1.8 $
+ *  $Revision: 1.9 $
  *
- *  last change: $Author: hr $ $Date: 2005-10-27 17:27:14 $
+ *  last change: $Author: hr $ $Date: 2006-06-20 04:29:39 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -37,15 +37,17 @@
 #include <rtl/process.h>
 #include <rtl/ustring.hxx>

+namespace {
+
 rtl_uString ** g_ppCommandArgs = 0;
 sal_uInt32     g_nCommandArgCount = 0;

-struct rtl_CmdArgs_ArgHolder
+struct ArgHolder
 {
-    ~rtl_CmdArgs_ArgHolder();
+    ~ArgHolder();
 };

-rtl_CmdArgs_ArgHolder::~rtl_CmdArgs_ArgHolder()
+ArgHolder::~ArgHolder()
 {
     while (g_nCommandArgCount > 0)
         rtl_uString_release (g_ppCommandArgs[--g_nCommandArgCount]);
@@ -54,10 +56,13 @@
     g_ppCommandArgs = 0;
 }

-static void impl_rtl_initCommandArgs()
+// The destructor of this static ArgHolder is "activated" by the assignments to
+// g_ppCommandArgs and g_nCommandArgCount in init():
+ArgHolder argHolder;
+
+void init()
 {
     osl::MutexGuard guard( osl::Mutex::getGlobalMutex() );
-    static rtl_CmdArgs_ArgHolder MyHolder;
     if (!g_ppCommandArgs)
     {
         sal_Int32 i, n = osl_getCommandArgCount();
@@ -87,12 +92,12 @@
     }
 }

+}
+
 oslProcessError SAL_CALL rtl_getAppCommandArg (
     sal_uInt32 nArg, rtl_uString **ppCommandArg)
 {
-    if (!g_ppCommandArgs)
-        impl_rtl_initCommandArgs();
-
+    init();
     oslProcessError result = osl_Process_E_NotFound;
     if( nArg < g_nCommandArgCount )
     {
@@ -104,7 +109,6 @@

 sal_uInt32 SAL_CALL rtl_getAppCommandArgCount (void)
 {
-    if (!g_ppCommandArgs)
-        impl_rtl_initCommandArgs();
+    init();
     return g_nCommandArgCount;
 }


[BUG] -split, -tag and BED6 output was not implemented.

--- src/bamToBed/bamToBed.cpp
+++ src/bamToBed/bamToBed.cpp
@@ -479,13 +479,26 @@
         unsigned int i;
         for (i = 0; i < bedBlocks.size(); ++i) {
             BED curr = bedBlocks[i];
-            printf("%s\t%d\t%d\t\%s\t%d\t%s\n",
-                   chrom.c_str(),
-                   curr.start,
-                   curr.end,
-                   name.c_str(),
-                   bam.MapQuality,
-                   strand.c_str());
+
+            if (bamTag == "") {
+                printf("%s\t%d\t%d\t\%s\t%d\t%s\n",
+                       chrom.c_str(),
+                       curr.start,
+                       curr.end,
+                       name.c_str(),
+                       bam.MapQuality,
+                       strand.c_str());
+            }
+            else {
+                cout << chrom << "\t"
+                     << bam.Position << "\t"
+                     << curr.start << "\t"
+                     << curr.end << "\t"
+                     << name << "\t"
+                     << PrintTag(bam, bamTag) << "\t"
+                     << strand
+                     << endl;
+            }
         }
     }
 }


Fix concurrency annotation in BgpMembershipManager::RegisterRibIn

Change-Id: I6dbecb036c86227771e8a9672879c27f37d82084
Partial-Bug: 1672512

--- src/bgp/bgp_membership.cc
+++ src/bgp/bgp_membership.cc
@@ -123,7 +123,8 @@
 // Synchronously register the IPeer to the BgpTable for RIBIN.
 //
 void BgpMembershipManager::RegisterRibIn(IPeer *peer, BgpTable *table) {
-    CHECK_CONCURRENCY("bgp::Config", "bgp::StateMachine", "xmpp::StateMachine");
+    CHECK_CONCURRENCY("bgp::Config", "bgp::ConfigHelper",
+        "bgp::StateMachine", "xmpp::StateMachine");

     tbb::spin_rw_mutex::scoped_lock write_lock(rw_mutex_, true);
     PeerRibState *prs = LocatePeerRibState(peer, table);


Fixed bug in plotting

Fixed bug in plotting

--- PWGCF/FEMTOSCOPY/FemtoDream/AliAnalysisTaskThreeBodyFemto.cxx
+++ PWGCF/FEMTOSCOPY/FemtoDream/AliAnalysisTaskThreeBodyFemto.cxx
@@ -469,7 +469,7 @@
     for (int i = 0; i < 4; ++i) {
       fMixedEventTripletArrayResolution[i] = new TH2F(histTitlesMixedResolution[i],histTitlesMixedResolution[i], 1000, 0, 1, 1000, 0, 1);
       fMixedEventTripletArrayResolutionAll[i] = new TH2F(histTitlesMixedResolution[i],histTitlesMixedResolution[i], 1000, 0, 1, 1000, 0, 1);
-      fMixedEventTripletResolution->Add(fMixedEventTripletArray[i]);
+      fMixedEventTripletResolution->Add(fMixedEventTripletArrayResolution[i]);
       fMixedEventTripletResolutionAll->Add(fMixedEventTripletArrayResolutionAll[i]);
      }

@@ -489,7 +489,7 @@
     for (int i = 0; i < 4; ++i) {
       fSameEventTripletArrayResolution[i] = new TH2F(histTitlesSameResolution[i],histTitlesSameResolution[i], 1000, 0, 1, 1000, 0, 1);
       fSameEventTripletArrayResolutionAll[i] = new TH2F(histTitlesSameResolution[i],histTitlesSameResolution[i], 1000, 0, 1, 1000, 0, 1);
-      fSameEventTripletResolution->Add(fSameEventTripletArray[i]);
+      fSameEventTripletResolution->Add(fSameEventTripletArrayResolution[i]);
       fSameEventTripletResolutionAll->Add(fSameEventTripletArrayResolutionAll[i]);
      }


PostgreSQL: used simple query for ping

PostgreSQL: used simple query for ping

--- extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
+++ extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
@@ -54,7 +54,7 @@
 	{

 		nontransaction n(*(db.get()));
-		n.exec("select version();");
+		n.exec("select 1;");
 		return true;
 	}
 	catch( const std::exception& e )


Remove fixed FIXME.

Remove fixed FIXME.

--- spirv_glsl.cpp
+++ spirv_glsl.cpp
@@ -1467,11 +1467,6 @@
 	string op;

 	// TODO: Find a clean way to reuse emit_instruction.
-	//
-	// FIXME: This doesn't take into account the possibility
-	// of type mismatches like emit_instruction does yet, but
-	// for spec op purposes, this seems extremely unlikely to
-	// hit in practice.
 	switch (cop.opcode)
 	{
 	case OpSConvert:


Formatting

Formatting

+ Undid Visual Studio's auto indentation.

--- source/ContainerPrinter/ContainerPrinter/ContainerPrinter.hpp
+++ source/ContainerPrinter/ContainerPrinter/ContainerPrinter.hpp
@@ -40,11 +40,11 @@
       struct is_printable_as_container<
          Type,
          void_t<
-         decltype(std::declval<Type&>().begin()),
-         decltype(std::declval<Type&>().end()),
-         decltype(std::declval<Type&>().empty()),
-         typename Type::value_type,
-         typename Type::iterator
+            decltype(std::declval<Type&>().begin()),
+            decltype(std::declval<Type&>().end()),
+            decltype(std::declval<Type&>().empty()),
+            typename Type::value_type,
+            typename Type::iterator
          >
       > : public std::true_type
       {
@@ -108,9 +108,9 @@
       >
       struct is_printable_as_container<
          std::basic_string<
-         CharacterType,
-         CharacterTraitsType,
-         AllocatorType
+            CharacterType,
+            CharacterTraitsType,
+            AllocatorType
          >
       > : public std::false_type
       {
@@ -272,7 +272,7 @@
    */
    template<
       typename TupleType,
-      std::size_t N
+      std::size_t Index
    >
    struct tuple_printer
    {
@@ -286,11 +286,11 @@
          const TupleType& container,
          const DelimiterValues& delimiters)
       {
-         tuple_printer<TupleType, N - 1>::print(stream, container, delimiters);
+         tuple_printer<TupleType, Index - 1>::print(stream, container, delimiters);

          stream
             << delimiters.separator
-            << std::get<N - 1>(container);
+            << std::get<Index - 1>(container);
       }
    };


Change suggested my Marc Mutz. Reserve capacity for mTimeOfSeenMsgsVector before it's populated.

svn path=/trunk/kdepim/; revision=403279

--- kmail/kmacctexppop.cpp
+++ kmail/kmacctexppop.cpp
@@ -170,6 +170,7 @@
       mUidsOfSeenMsgsDict.insert( *it, (const int *)idx );
     }
     mTimeOfSeenMsgsVector.clear();
+    mTimeOfSeenMsgsVector.reserve( timeOfSeenMsgs.size() );
     for ( QValueList<int>::ConstIterator it = timeOfSeenMsgs.begin();
           it != timeOfSeenMsgs.end(); ++it) {
       mTimeOfSeenMsgsVector.append( *it );


Fix bug 131119 (Sending attachments with umlauts in the filename breaks rfc2231)
rfc2231-encoded parameter values must not be enclosed in double quotes.
BUG: 131119

svn path=/branches/KDE/3.5/kdepim/; revision=564676

--- kmail/kmcomposewin.cpp
+++ kmail/kmcomposewin.cpp
@@ -2602,7 +2602,7 @@
   msgPart->setTypeStr( mimeType.left( slash ).latin1() );
   msgPart->setSubtypeStr( mimeType.mid( slash + 1 ).latin1() );
   msgPart->setContentDisposition(QCString("attachment;\n\tfilename")
-    + ((RFC2231encoded) ? "*" : "") +  "=\"" + encName + "\"");
+    + ( RFC2231encoded ? "*=" + encName : "=\"" + encName + '"' );

   mMapAtmLoadData.remove(it);


Fix refreshing problem in folder view (Bug#11688, Bug#9366)

diff -u kmail/kmfoldertree.cpp kmail.new/kmfoldertree.cpp
--- kmail/kmfoldertree.cpp      Fri Sep 22 10:33:52 2000
+++ kmail.new/kmfoldertree.cpp  Mon Sep 25 12:06:10 2000
@@ -331,9 +331,7 @@
 {
   KMFolderDir* fdir;
   QString str;
-  bool upd = isUpdatesEnabled();

-  setUpdatesEnabled(FALSE);
   writeConfig();

   QListViewItemIterator it( this );
@@ -361,9 +359,6 @@
              this,SLOT(refresh(KMFolder*)));
     ++jt;
   }
-
-  setUpdatesEnabled(upd);
-  if (upd) repaint();
   refresh(0);
 }

svn path=/trunk/kdenetwork/kmail/; revision=65360


Forwardport fix for bug 53821: KMail ignores some of its geometry settings when started on logon

And re-remove some code that had already been removed from HEAD a long time ago (long before 3_1 existed).

svn path=/trunk/kdepim/; revision=204229

--- kmail/kmmainwidget.cpp
+++ kmail/kmmainwidget.cpp
@@ -306,18 +306,6 @@
         mPanner2Sep[0] = config->readNumEntry( "FolderPaneWidth", folderpanewidth );
         mPanner2Sep[1] = config->readNumEntry( "HeaderPaneWidth", width()-folderpanewidth );
         break;
-    }
-
-    // workaround to support the old buggy way of saving the dimensions of the panes
-    if (mPanner1Sep[0] == 0) {
-      defaultSize = QSize(300,130);
-      siz = config->readSizeEntry("Panners", &defaultSize);
-      if (siz.isEmpty())
-        siz = QSize(100,100); // why not defaultSize?
-      mPanner2Sep[0] = siz.width();
-      mPanner1Sep[0] = siz.height();
-      mPanner2Sep[1] = height() - siz.width();
-      mPanner1Sep[1] = width() - siz.height();
     }

     if (!mStartupDone ||
@@ -682,7 +670,7 @@
         mPanner2->moveToLast( mMimePartTree );
         mPanner1->setSizes( mPanner1Sep );
         mPanner2->setSizes( mPanner2Sep );
-        mPanner3->setSizes( mPanner2Sep );
+        mPanner3->setSizes( mPanner3Sep );
         mPanner2->setResizeMode( mMimePartTree, QSplitter::KeepSize );
         mPanner3->setResizeMode( mHeaders, QSplitter::KeepSize );
         break;
@@ -696,7 +684,7 @@
         mPanner1->moveToLast( mMsgView );
         mPanner1->setSizes( mPanner1Sep );
         mPanner2->setSizes( mPanner2Sep );
-        mPanner3->setSizes( mPanner2Sep );
+        mPanner3->setSizes( mPanner3Sep );
         mPanner1->setResizeMode( mPanner2, QSplitter::KeepSize );
         mPanner2->setResizeMode( mFolderTree, QSplitter::KeepSize );
         mPanner3->setResizeMode( mMimePartTree, QSplitter::KeepSize );


Update main_fpga.cpp

Update main_fpga.cpp

Conditional statements on globalWorkSize removed

--- knn_fpga/main_fpga.cpp
+++ knn_fpga/main_fpga.cpp
@@ -111,7 +111,7 @@

   if (!quiet) {
-    printf("Number of records: %d\n",numRecords);
+    printf("Number of points in reference data set: %d\n",numRecords);
     printf("latitude: %f\n",lat);
     printf("longitude: %f\n",lng);
     printf("Finding the %d closest neighbors.\n",resultsCount);
@@ -195,7 +195,6 @@
   size_t local1[1];
   local1[0] = WORK_GROUP_SIZE;
   globalWorkSize1[0] = numRecords;//Total number of work items to execute a kernel
-  if (numRecords % 64) globalWorkSize1[0] += 64 - (numRecords % 64);

   clEnqueueNDRangeKernel(command_queue, kernel1, 1, NULL,
     (size_t*)&globalWorkSize1, (size_t*)&local1, 0, NULL, NULL);
@@ -210,7 +209,6 @@
   size_t local2[1];
   local2[0] = WORK_GROUP_SIZE;
   globalWorkSize2[0] = numRecords;//Total number of work items to execute a kernel
-  if (numRecords % 64) globalWorkSize2[0] += 64 - (numRecords % 64);

   clEnqueueNDRangeKernel(command_queue, kernel2, 1, NULL,
     (size_t*)&globalWorkSize2, (size_t*)&local2, 0, NULL, NULL);


synchronise with old cold

synchronise with old cold

--- contrib/other-builds/moses2/legacy/ProbingPT/line_splitter.cpp
+++ contrib/other-builds/moses2/legacy/ProbingPT/line_splitter.cpp
@@ -57,21 +57,26 @@
   const char delim2[] = "-";
   std::vector<unsigned char> output;

+  //Case with no word alignments.
+  if (textin.size() == 0) {
+	return output;
+  }
+
   //Split on space
   util::TokenIter<util::MultiCharacter> it(textin, util::MultiCharacter(delim));

   //For each int
   while (it) {
-    //Split on dash (-)
-    util::TokenIter<util::MultiCharacter> itInner(*it, util::MultiCharacter(delim2));
+	//Split on dash (-)
+	util::TokenIter<util::MultiCharacter> itInner(*it, util::MultiCharacter(delim2));

-    //Insert the two entries in the vector. User will read entry 0 and 1 to get the first,
-    //2 and 3 for second etc. Use unsigned char instead of int to save space, as
-    //word allignments are all very small numbers that fit in a single byte
-    output.push_back((unsigned char)(atoi(itInner->data())));
-    itInner++;
-    output.push_back((unsigned char)(atoi(itInner->data())));
-    it++;
+	//Insert the two entries in the vector. User will read entry 0 and 1 to get the first,
+	//2 and 3 for second etc. Use unsigned char instead of int to save space, as
+	//word allignments are all very small numbers that fit in a single byte
+	output.push_back((unsigned char)(atoi(itInner->data())));
+	itInner++;
+	output.push_back((unsigned char)(atoi(itInner->data())));
+	it++;
   }

   return output;


Bug #21072  Duplicate key error in NDB references wrong key: Re-wrote string usage to avoid valgrind warnings

--- sql/handler.cc
+++ sql/handler.cc
@@ -1106,8 +1106,7 @@
       if (key_nr == MAX_KEY)
       {
 	/* Key is unknown */
-	str.length(0);
-	str.append("");
+	str.copy("", 0, system_charset_info);
 	key_nr= -1;
       }
       else


Fixed wrong packed length for packet > 16M.

sql/net_pkg.cc:
  Fixed wrong packed length for packet > 16M.
  (Not used in 3.23)

--- sql/net_pkg.cc
+++ sql/net_pkg.cc
@@ -206,7 +206,7 @@
   }
   *packet++=254;
   int8store(packet,length);
-  return (char*) packet+9;
+  return (char*) packet+8;
 }

 char *


opt_sum.cc:
  Slightly improved the fix for bug #5406.

sql/opt_sum.cc:
  Slightly improved the fix for bug #5406.

--- sql/opt_sum.cc
+++ sql/opt_sum.cc
@@ -191,9 +191,8 @@
 					   range_fl & NEAR_MIN ?
 					   HA_READ_AFTER_KEY :
 					   HA_READ_KEY_OR_NEXT);
-	  if ((!error || error == HA_ERR_KEY_NOT_FOUND) &&
-               reckey_in_range(0, &ref, item_field->field,
-			       conds, range_fl, prefix_len))
+	  if (!error && reckey_in_range(0, &ref, item_field->field,
+			                conds, range_fl, prefix_len))
 	    error= HA_ERR_KEY_NOT_FOUND;
           if (table->key_read)
           {
@@ -264,9 +263,8 @@
 					   range_fl & NEAR_MAX ?
 					   HA_READ_BEFORE_KEY :
 					   HA_READ_PREFIX_LAST_OR_PREV);
-	  if ((!error || error == HA_ERR_KEY_NOT_FOUND) &&
-               reckey_in_range(1, &ref, item_field->field,
-			       conds, range_fl, prefix_len))
+	  if (!error && reckey_in_range(1, &ref, item_field->field,
+			                conds, range_fl, prefix_len))
 	    error= HA_ERR_KEY_NOT_FOUND;
           if (table->key_read)
           {


BUG#20141 "User-defined variables are not replicated properly for
          SF/Triggers in SBR mode."
BUG#14914 "SP: Uses of session variables in routines are not always replicated"
BUG#25167 "Dupl. usage of user-variables in trigger/function is not replicated
          correctly"

This patch corrects a minor error in the previous patch for BUG#20141. This patch
corrects an errant code change to sp_head.cc. The comments for the first patch follow:

User-defined variables used inside of stored functions/triggers in
statements which did not update tables directly were not replicated.
We also had problems with replication of user-defined variables which
were used in triggers (or stored functions called from table-updating
statements) more than once.

This patch addresses the first issue by enabling logging of all
references to user-defined variables in triggers/stored functions
and not only references from table-updating statements.

The second issue stemmed from the fact that for user-defined
variables used from triggers or stored functions called from
table-updating statements we were writing binlog events for each
reference instead of only one event for the first reference.
This problem is already solved for stored functions called from
non-updating statements with help of "event unioning" mechanism.
So the patch simply extends this mechanism to the case affected.
It also fixes small problem in this mechanism which caused wrong
logging of references to user-variables in cases when non-updating
statement called several stored functions which used the same
variable and some of these function calls were omitted from binlog
as they were not updating any tables.

--- sql/sp_head.cc
+++ sql/sp_head.cc
@@ -1497,7 +1497,7 @@
       each invocation.
     */
     VOID(pthread_mutex_lock(&LOCK_thread_count));
-    q= ::query_id;
+    q= global_query_id;
     VOID(pthread_mutex_unlock(&LOCK_thread_count));
     mysql_bin_log.start_union_events(thd, q + 1);
     binlog_save_options= thd->options;


Address of member variables can never be null.

Change-Id: I0644b623454450ad762030f1048c65502efbb7da

--- platform-abstractions/tizen/image-loaders/loader-png.cpp
+++ platform-abstractions/tizen/image-loaders/loader-png.cpp
@@ -327,7 +327,6 @@
   : png(_png),
     info(_info)
   {
-    DALI_ASSERT_DEBUG(&_png != 0 && &_info != 0);
   }

   ~AutoPngWrite()


Bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS".

Using too long table aliases in stored routines might
have caused server crashes.

Code in sp_head::merge_table_list() which is responsible
for collecting information about tables used in stored
routine was not aware of the fact that table alias might
have arbitrary length. I.e. it assumed that table alias
can't be longer than NAME_LEN bytes and allocated buffer
for a key identifying table accordingly.

This patch fixes the issue by ensuring that we use
dynamically allocated buffer for table key when table
alias is too long. By default stack based buffer is used
in which NAME_LEN bytes are reserved for table alias.

--- sql/sp_head.cc
+++ sql/sp_head.cc
@@ -3839,8 +3839,6 @@
     Multi-set key:
       db_name\0table_name\0alias\0 - for normal tables
       db_name\0table_name\0        - for temporary tables
-    Note that in both cases we don't take last '\0' into account when
-    we count length of key.
   */
   LEX_STRING qname;
   uint db_length, table_name_length;
@@ -3897,19 +3895,26 @@
   for (; table ; table= table->next_global)
     if (!table->derived && !table->schema_table)
     {
-      char tname[(NAME_LEN + 1) * 3];           // db\0table\0alias\0
-      uint tlen, alen;
-
-      tlen= table->db_length;
-      memcpy(tname, table->db, tlen);
-      tname[tlen++]= '\0';
-      memcpy(tname+tlen, table->table_name, table->table_name_length);
-      tlen+= table->table_name_length;
-      tname[tlen++]= '\0';
-      alen= strlen(table->alias);
-      memcpy(tname+tlen, table->alias, alen);
-      tlen+= alen;
-      tname[tlen]= '\0';
+      /*
+        Structure of key for the multi-set is "db\0table\0alias\0".
+        Since "alias" part can have arbitrary length we use String
+        object to construct the key. By default String will use
+        buffer allocated on stack with NAME_LEN bytes reserved for
+        alias, since in most cases it is going to be smaller than
+        NAME_LEN bytes.
+      */
+      char tname_buff[(NAME_LEN + 1) * 3];
+      String tname(tname_buff, sizeof(tname_buff), &my_charset_bin);
+      uint temp_table_key_length;
+
+      tname.length(0);
+      tname.append(table->db, table->db_length);
+      tname.append('\0');
+      tname.append(table->table_name, table->table_name_length);
+      tname.append('\0');
+      temp_table_key_length= tname.length();
+      tname.append(table->alias);
+      tname.append('\0');

       /*
         Upgrade the lock type because this table list will be used
@@ -3924,9 +3929,10 @@
         (and therefore should not be prelocked). Otherwise we will erroneously
         treat table with same name but with different alias as non-temporary.
       */
-      if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) ||
-          ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname,
-                                        tlen - alen - 1)) &&
+      if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
+                                        tname.length())) ||
+          ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
+                                         temp_table_key_length)) &&
            tab->temp))
       {
         if (tab->lock_type < table->lock_type)
@@ -3945,11 +3951,11 @@
 	    lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
         {
 	  tab->temp= TRUE;
-          tab->qname.length= tlen - alen - 1;
+          tab->qname.length= temp_table_key_length;
         }
         else
-          tab->qname.length= tlen;
-        tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);
+          tab->qname.length= tname.length();
+        tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length);
         if (!tab->qname.str)
           return FALSE;
         tab->table_name_length= table->table_name_length;
@@ -4018,7 +4024,7 @@
     if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *
                                         stab->lock_count)) ||
         !(key_buff= (char*)thd->memdup(stab->qname.str,
-                                       stab->qname.length + 1)))
+                                       stab->qname.length)))
       DBUG_RETURN(FALSE);

     for (uint j= 0; j < stab->lock_count; j++)