Updated MAPPING DA for RUN2

Updated MAPPING DA for RUN2

--- ZDC/DA/ZDCMAPPINGda.cxx
+++ ZDC/DA/ZDCMAPPINGda.cxx
@@ -13,7 +13,7 @@
 Run Type: PHYSICS
 DA Type: MON
 Number of events needed:
-Input Files:  none
+Input Files:  ZDCTDCHistoLimits.dat
 Output Files: ZDCChMapping.dat ZDCTDCCalib.dat ZDCTDCHisto.root
 Trigger Types Used: different trigger types are used

@@ -22,6 +22,7 @@
 #define MAPDATA_FILE  "ZDCChMapping.dat"
 #define TDCDATA_FILE  "ZDCTDCCalib.dat"
 #define TDCHISTO_FILE "ZDCTDCHisto.root"
+#define HISTLIM_FILE  "ZDCTDCHistoLimits.dat"

 #include <stdio.h>
 #include <stdlib.h>
@@ -64,8 +65,17 @@
                                         "Minuit",
                                         "TMinuitMinimizer(const char*)");

-  //TMinuitMinimizer m;
   TVirtualFitter::SetDefaultFitter("Minuit");
+
+  /* log start of process */
+  printf("\n ZDC MAPPING program started\n");
+  signal(SIGSEGV, SIG_DFL);
+
+  /* check that we got some arguments = list of files */
+  if(argc<2) {
+    printf("Wrong number of arguments\n");
+    return -1;
+  }

   char *monitor_table[] = { "ALL", "no", "PHY", "yes", "SOD", "all", NULL };
   int err = monitorDeclareTable(monitor_table);
@@ -74,11 +84,12 @@
     return -1;
   }

+  // *** initializations ***************************
   int status=0, nphys=0;
   int const kNModules = 9;
   int const kNChannels = 24;
   int const kNScChannels = 32;
-  int const kZDCTDCGeo = 4;
+//  int const kZDCTDCGeo = 4;

   int itdc=0, iprevtdc=-1, ihittdc=0;
   float tdcData[6], tdcL0=-999.;
@@ -110,28 +121,103 @@
   for(Int_t y=0; y<kNScChannels; y++){
     tdcMod[y]=tdcCh[y]=tdcSigCode[y]=tdcDet[y]=tdcSec[y]=-1;
   }
+
+  // Module type codes
+  enum ZDCModules{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5, KV1290=6, kV775N=7};
+
+  // Module type codes
+  enum ZDCGeoAddr{kFirstADCGeo=0, kLastADCGeo=3, kADDADCGeo=5,
+       kTDCFakeGeo=8, kZDCTDCGeo=4, kADDTDCGeo=6,
+       kScalerGeo=16, kPUGeo=29, kTrigScales=30, kTrigHistory=31};
+
+  // Signal codes for ZDC
+  // Same codes used in DAQ configuration file
+  // To be changed ONLY IF this file is changed!!!
+  // **** DO NOT CHANGE THE FOLLOWING LINES!!! ****
+  enum ZDCSignal{
+       kNotConnected=0, kVoid=1,
+       kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6,
+       kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11,
+       kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16,
+       kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21,
+       kZEM1=22, kZEM2=23,
+       kZDCAMon=24, kZDCCMon=25,
+       kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30,
+       kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35,
+       kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40,
+       kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45,
+       kZEM1oot=46, kZEM2oot=47,
+       kZDCAMonoot=48, kZDCCMonoot=49,
+       kL1MBI=50, kL1CNI=51, kL1SCI=52, kL1EMDI=53, kL0I=54,
+       kL1MBO=55, kL1CNO=56, kL1SCO=57, kL1EMDO=58,
+       kHMBCN=59, kHSCEMD=60,
+       kZNACD=61, kZNA1D=62, kZNA2D=63, kZNA3D=64, kZNA4D=65,
+       kZPACD=66, kZPA1D=67, kZPA2D=68, kZPA3D=69, kZPA4D=70,
+       kZNCCD=71, kZNC1D=72, kZNC2D=73, kZNC3D=74, kZNC4D=75,
+       kZPCCD=76, kZPC1D=77, kZPC2D=78, kZPC3D=79, kZPC4D=80,
+       kZEM1D=81, kZEM2D=82,
+       kZDCAMonD=83, kZDCCMonD=84,
+       kZNAD=85, kZPAD=86, kZNCD=87, kZPCD=88, kZEMD=89,
+       kZNA0D=90, kZPA0D=91, kZNC0D=92, kZPC0D=93, k1kHzD=94, kGate=95, kAD=96, kCD=97,
+       kAorCD=98, kAandCD=99, kZEMORD=100, kAorCorZEMORD=101, kAorCorZEMD=102, kAD0=103, kAD1=104, kAD2=105,
+	 kAD3=106, kAD4=107, kAD5=108, kAD6=109, kAD7=110, kAD8=111, kAD9=112, kAD10=113,
+	 kAD11=114, kAD12=115, kAD13=116, kAD14=117, kAD15=118, kAD0D=119, kAD1D=120, kAD2D=121,
+	 kAD3D=122, kAD4D=123, kAD5D=124, kAD6D=125, kAD7D=126, kAD8D=127, kAD9D=128, kAD10D=129,
+	 kAD11D=130, kAD12D=131, kAD13D=132, kAD14D=133, kAD15D=134, kL0=135};
+
+  // *** read histo limits from data file ***************************
+  float hlimit[2][6];
+  for(int k=0; k<6; k++){
+     for(int j=0; j<2; j++) hlimit[j][k]=0;
+  }
+  int read = 0;
+  read = daqDA_DB_getFile(HISTLIM_FILE, HISTLIM_FILE);
+  if(read){
+    printf("\t ERROR!!! ZDCTDCHistoLimits.dat file NOT FOUND in DAQ db!  0> Exiting....\n");
+    return -11;
+  }
+
+  FILE *fileHistLim = NULL;
+  fileHistLim = fopen(HISTLIM_FILE,"r");
+  if(fileHistLim==NULL) {
+    printf("\t ERROR!!! Can't open ZDCTDCHistoLimits.dat file!  0> Exiting....\n");
+    return -12;
+  }
+  float readValues[2][6];
+  for(int jj=0; jj<6; jj++){
+     for(int ii=0; ii<2; ii++){
+  	fscanf(fileHistLim,"%f",&readValues[ii][jj]);
+        hlimit[ii][jj] = readValues[ii][jj];
+     }
+     //printf(" ch. %d limits x histo: %f %f\n",jj,hlimit[0][jj],hlimit[1][jj]);
+  }
+  fclose(fileHistLim);
+  // *****************************************************************
+
+  // *** Creating a container for the histos ***************************
+  TObjArray *hList = new TObjArray(0);
+  hList->SetOwner(kTRUE);

   TH1F * hTDC[6]={0x0,0x0,0x0,0x0,0x0,0x0};
+  TString prefix = "TDC";
   for(int it=0; it<6; it++){
-    if(it==0) hTDC[it] = new TH1F("TDCZEM1","TDC ZEM1",200, -200., 200.);
-    else if(it==1) hTDC[it] = new TH1F("TDCZEM2","TDC ZEM2",200, -200., 200.);
-    else if(it==2) hTDC[it] = new TH1F("TDCZNC", "TDC ZNC", 200, -200., 200.);
-    else if(it==3) hTDC[it] = new TH1F("TDCZPC", "TDC ZPC", 200, -200., 200.);
-    else if(it==4) hTDC[it] = new TH1F("TDCZNA", "TDC ZNA", 200, -200., 200.);
-    else if(it==5) hTDC[it] = new TH1F("TDCZPA", "TDC ZPA", 200, -200., 200.);
-  }
-
-  /* log start of process */
-  printf("\n ZDC MAPPING program started\n");
-  signal(SIGSEGV, SIG_DFL);
-
-  /* check that we got some arguments = list of files */
-  if(argc<2) {
-    printf("Wrong number of arguments\n");
-    return -1;
-  }
-
-  FILE *mapFile4Shuttle;
+     TString det;
+     if(it==0) det ="ZEM1";
+     else if(it==1) det ="ZEM2";
+     else if(it==2) det ="ZNC";
+     else if(it==3) det ="ZPC";
+     else if(it==4) det ="ZNA";
+     else if(it==5) det ="ZPA";
+     TString hname = prefix+det;
+     float limit[2] = {0., 0.};
+     limit[0] = hlimit[0][it];
+     limit[1] = hlimit[1][it];
+     //
+     hTDC[it] = new TH1F(hname.Data(), hname.Data(), int(limit[1]-limit[0]), limit[0], limit[1]);
+     hList->Add(hTDC[it]);
+  }
+
+  FILE *mapFile4Shuttle=NULL;

   /* read the data files */
   for(int n=1;n<argc;n++){
@@ -185,16 +271,14 @@
       AliRawReader *reader = new AliRawReaderDate((void*)event);
       reader->Reset();
       reader->Select("ZDC");
-      // --- Reading event header
-      //UInt_t evtype = reader->GetType();
-      //printf("\t ZDCMAPPINGda -> run # %d\n",reader->GetRunNumber());
       //
       AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);

       /* use event - here, just write event id to result file */
       eventT=event->eventType;
-
+
+      /*  READ MAPPING FROM SOD EVENT*/
       if(eventT==START_OF_DATA){

 	rawStreamZDC->SetSODReading(kTRUE);
@@ -202,8 +286,11 @@
 	// --------------------------------------------------------
 	// --- Writing ascii data file for the Shuttle preprocessor
         mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
-	//if(rawStreamZDC->Next()){
-	  while((rawStreamZDC->Next())){
+        if(mapFile4Shuttle==NULL) {
+          printf("Failed to open mapFile4Shuttle file\n");
+          return -1;
+        }
+	while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
 	       iMod++;
 	       modGeo[iMod]  = rawStreamZDC->GetADCModule();
@@ -237,39 +324,33 @@
  	  }
 	  // Writing data on output FXS file
 	  for(Int_t is=0; is<2*kNChannels; is++){
-	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
-	       is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
-    	     //printf("  Mapping DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
-	       //is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+    	     //printf("  Mapping DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
 	  }
 	  for(Int_t is=0; is<kNScChannels; is++){
-	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
-	       is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
- 	     //if(scMod[is]!=-1) printf("  Mapping DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
-	       //is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+ 	     //if(scMod[is]!=-1) printf("  Mapping DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
 	  }
 	  for(Int_t is=0; is<kNScChannels; is++){
-	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\n",
-	       is,tdcMod[is],tdcCh[is],tdcSigCode[is]);
- 	     //if(tdcMod[is]!=-1) printf("  Mapping DA -> %d TDC: mod %d ch %d, code %d\n",
-	       //is,tdcMod[is],tdcCh[is],tdcSigCode[is]);
+	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\n",is,tdcMod[is],tdcCh[is],tdcSigCode[is]);
+ 	     if(tdcMod[is]!=-1) printf("  Mapping DA -> %d TDC: mod %d ch %d, code %d\n", is,tdcMod[is],tdcCh[is],tdcSigCode[is]);
 	  }
 	  for(Int_t is=0; is<kNModules; is++){
 	     fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
 	     modGeo[is],modType[is],modNCh[is]);
-	     //printf("  Mapping DA -> Module mapping: geo %d type %d #ch %d\n",
-	       //modGeo[is],modType[is],modNCh[is]);
+	     //printf("  Mapping DA -> Module mapping: geo %d type %d #ch %d\n",modGeo[is],modType[is],modNCh[is]);
 	  }

-	//} //if (rawstream)
         fclose(mapFile4Shuttle);
       }// SOD event
+      /*  READING PHYSICS EVENTS*/
       else if(eventT==PHYSICS_EVENT){

         for(int ij=0; ij<6; ij++) tdcData[ij]=-999.;
 	rawStreamZDC->SetSODReading(kTRUE);

-  	// ----- Setting ch. mapping -----
+  	// ----- Setting ch. mapping read from SOD -----
+	// ADC
 	for(int jk=0; jk<2*kNChannels; jk++){
 	  rawStreamZDC->SetMapADCMod(jk, adcMod[jk]);
 	  rawStreamZDC->SetMapADCCh(jk, adcCh[jk]);
@@ -277,6 +358,13 @@
 	  rawStreamZDC->SetMapDet(jk, det[jk]);
 	  rawStreamZDC->SetMapTow(jk, sec[jk]);
 	}
+	// TDC
+	for(int l=0; l<32; l++){
+	   rawStreamZDC->SetTDCModFromMap(l, tdcMod[l]);
+	   rawStreamZDC->SetTDCChFromMap(l, tdcCh[l]);
+	   rawStreamZDC->SetTDCSignFromMap(l, tdcSigCode[l]);
+//printf(" %d setting TDC ch. %d to signal %d\n",l, tdcCh[l], tdcSigCode[l]);
+	}

   	while(rawStreamZDC->Next()){
          if(rawStreamZDC->GetADCModule()!=kZDCTDCGeo) continue; //skipping ADCs, scalers and trigger cards
@@ -288,18 +376,30 @@
              else ihittdc=0;
              iprevtdc=itdc;
 	     //
-	     if(((itdc>=8 && itdc<=13) || itdc==15) && ihittdc==0){
-               if(itdc!=15){
-	         tdcData[itdc-8] = 0.025*rawStreamZDC->GetZDCTDCDatum();
+	     // NB -> THE TDC cabling has been varied in 12/2013
+	     // PLEASE CROSS-CHECK https://twiki.cern.ch/twiki/bin/view/ALICE/ZDCTDCCabl
+	     int firstintch = 16;
+	     int lastintch=23;
+	     int tdcmapch=-1;
+	     if((itdc>=firstintch && itdc<=lastintch) && ihittdc==0){
+//printf(" **** TDC ch. %d cabled signal: from raw data %d, from map %d\n",itdc,rawStreamZDC->GetCabledSignal(), rawStreamZDC->GetTDCSignFromMap(itdc));
+               int sigcode = rawStreamZDC->GetTDCSignFromMap(itdc);
+               if(itdc!=20 && itdc!=21){
+	         if(sigcode==kZEM1D) tdcmapch=0;
+	         else if(sigcode==kZEM2D) tdcmapch=1;
+		 else if(sigcode==kZNCD) tdcmapch=2;
+		 else if(sigcode==kZPCD) tdcmapch=3;
+		 else if(sigcode==kZNAD) tdcmapch=4;
+		 else if(sigcode==kZPAD) tdcmapch=5;
+	         if(tdcmapch>=0 && tdcmapch<6) tdcData[tdcmapch] = 0.025*rawStreamZDC->GetZDCTDCDatum();
 	         //
-	         //printf("   ev.%d **** TDC%d %1.0f ns  \n",nphys,itdc, tdcData[itdc-8]);
+//printf("   \t -> TDC %d goes in tdcData[%d]  \n",itdc,  tdcmapch);
 	       }
 	       //
-	       else if(itdc==15){
+	       else if(sigcode==kL0){
 	          tdcL0 = 0.025*rawStreamZDC->GetZDCTDCDatum();
 	          //
-		  //printf("   ev.%d ++++ TDCL0 %1.0f ns  \n",nphys,tdcL0);
-		  //
+//printf("   \t -> L0  goes in tdcData[%d]  \n",tdcmapch);
 		  for(int ic=0; ic<6; ic++){
 		    if(tdcData[ic]!=-999. && tdcL0!=-999.){
 		      hTDC[ic]->Fill(tdcData[ic]-tdcL0);
@@ -343,7 +443,7 @@
   Float_t mean[6]={0.,0.,0.,0.,0.,0.}, sigma[6]={0.,0.,0.,0.,0.,0.};
   TF1 *fitfun[6]={0x0,0x0,0x0,0x0,0x0,0x0};
   for(int k=0; k<6; k++){
-    if(hTDC[k]->GetEntries()!=0){
+    if(hTDC[k]->GetEntries()>0){
        binMax = hTDC[k]->GetMaximumBin();
        if(binMax<=1){
          printf("\n WARNING! Something wrong with det %d histo \n\n", k);


Fixed pr20314-2.c failure, added E, F, p constraint letters.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@114490 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -2496,7 +2496,10 @@
       return C_Memory;
     case 'i':    // Simple Integer or Relocatable Constant
     case 'n':    // Simple Integer
+    case 'E':    // Floating Point Constant
+    case 'F':    // Floating Point Constant
     case 's':    // Relocatable Constant
+    case 'p':    // Address.
     case 'X':    // Allow ANY value.
     case 'I':    // Target registers.
     case 'J':
@@ -2506,6 +2509,8 @@
     case 'N':
     case 'O':
     case 'P':
+    case '<':
+    case '>':
       return C_Other;
     }
   }
@@ -2664,6 +2669,7 @@
   /// ConstraintOperands - Information about all of the constraints.
   std::vector<AsmOperandInfo> ConstraintOperands;
   const InlineAsm *IA = cast<InlineAsm>(CS.getCalledValue());
+  unsigned maCount = 0; // Largest number of multiple alternative constraints.

   // Do a prepass over the constraints, canonicalizing them, and building up the
   // ConstraintOperands list.
@@ -2676,6 +2682,10 @@
   for (unsigned i = 0, e = ConstraintInfos.size(); i != e; ++i) {
     ConstraintOperands.push_back(AsmOperandInfo(ConstraintInfos[i]));
     AsmOperandInfo &OpInfo = ConstraintOperands.back();
+
+    // Update multiple alternative constraint count.
+    if (OpInfo.multipleAlternatives.size() > maCount)
+      maCount = OpInfo.multipleAlternatives.size();

     EVT OpVT = MVT::Other;

@@ -2711,7 +2721,6 @@

   // If we have multiple alternative constraints, select the best alternative.
   if (ConstraintInfos.size()) {
-    unsigned maCount = ConstraintInfos[0].multipleAlternatives.size();
     if (maCount) {
       unsigned bestMAIndex = 0;
       int bestWeight = -1;
@@ -2727,8 +2736,6 @@
           AsmOperandInfo& OpInfo = ConstraintOperands[cIndex];
           if (OpInfo.Type == InlineAsm::isClobber)
             continue;
-          assert((OpInfo.multipleAlternatives.size() == maCount)
-            && "Constraint has inconsistent multiple alternative count.");

           // If this is an output operand with a matching input operand, look up the
           // matching input. If their types mismatch, e.g. one is an integer, the
@@ -2827,12 +2834,16 @@
 /// and the current alternative constraint selected.
 int TargetLowering::getMultipleConstraintMatchWeight(
     AsmOperandInfo &info, int maIndex) const {
-  std::vector<std::string> &rCodes = info.multipleAlternatives[maIndex].Codes;
+  std::vector<std::string> *rCodes;
+  if (maIndex >= (int)info.multipleAlternatives.size())
+    rCodes = &info.Codes;
+  else
+    rCodes = &info.multipleAlternatives[maIndex].Codes;
   int BestWeight = -1;

   // Loop over the options, keeping track of the most general one.
-  for (unsigned i = 0, e = rCodes.size(); i != e; ++i) {
-    int weight = getSingleConstraintMatchWeight(info, rCodes[i].c_str());
+  for (unsigned i = 0, e = rCodes->size(); i != e; ++i) {
+    int weight = getSingleConstraintMatchWeight(info, (*rCodes)[i].c_str());
     if (weight > BestWeight)
       BestWeight = weight;
   }


ENH (#1571): extended the test for reading and writing floating point number.

--- Core/Code/Testing/mitkPointSetFileIOTest.cpp
+++ Core/Code/Testing/mitkPointSetFileIOTest.cpp
@@ -1,123 +1,140 @@
 /*=========================================================================

-Program:   Medical Imaging & Interaction Toolkit
-Language:  C++
-Date:      $Date$
-Version:   $Revision$
+ Program:   Medical Imaging & Interaction Toolkit
+ Language:  C++
+ Date:      $Date$
+ Version:   $Revision$

-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.  See the above copyright notices for more information.
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.  See the above copyright notices for more information.

-=========================================================================*/
+ =========================================================================*/

 #include "mitkPointSet.h"
 #include "mitkPointSetWriter.h"
 #include "mitkPointSetReader.h"
 #include "mitkTestingMacros.h"
+#include <vector>
 #include <itksys/SystemTools.hxx>
+#include <time.h>

 //unsigned int numberOfTestPointSets = 1;
 unsigned int numberOfTimeSeries = 5;
 // create one test PointSet
-class mitkPointSetFileIOTestClass { public:
+class mitkPointSetFileIOTestClass
+{
+public:

-static mitk::PointSet::Pointer CreateTestPointSet(unsigned int which)
-{
-  mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
-
-  for(unsigned int t= 0; t<numberOfTimeSeries; t++)
+  std::vector<mitk::PointSet::Pointer> m_SavedPointSet;
+
+  mitkPointSetFileIOTestClass()
   {
-    unsigned int position(0);
-    mitk::Point3D point;
-    mitk::FillVector3D(point, 1.0+t+which, 2.0+t+which, 3.0+t+which);
-    pointSet->SetPoint(position, point, t);

-    mitk::FillVector3D(point, 2.0+t+which, 3.0+t+which, 4.0+t+which);
-    ++position;
-    pointSet->SetPoint(position, point, t);
-
-    mitk::FillVector3D(point, 3.0+t+which, 4.0+t+which, 5.0+t+which);
-    ++position;
-    pointSet->SetPoint(position, point, t);
   }

-  return pointSet;
+  mitk::PointSet::Pointer CreateTestPointSet()
+  {
+    mitk::PointSet::Pointer pointSet = mitk::PointSet::New();

-}
+    for (unsigned int t = 0; t < numberOfTimeSeries; t++)
+    {
+      unsigned int position(0);
+      mitk::Point3D point;
+      mitk::FillVector3D(point, (rand()%1000) /1000.0 , (rand()%1000) /1000.0, (rand()%1000)/1000.0);
+      pointSet->SetPoint(position, point, t);

-static void PointSetCompare(mitk::PointSet::Pointer pointSet2, mitk::PointSet::Pointer pointSet1, bool& identical)
-{
-
-  MITK_TEST_CONDITION(pointSet1->GetSize() == pointSet2->GetSize(), "Testing if PointSet size is correct" );
+      mitk::FillVector3D(point, (rand()%1000) /1000.0 , (rand()%1000) /1000.0, (rand()%1000)/1000.0);
+      ++position;
+      pointSet->SetPoint(position, point, t);

-  for (unsigned int t=0; t<numberOfTimeSeries; t++)
-  {
-    for (unsigned int i = 0; i < (unsigned int)pointSet1->GetSize(t); ++i)
-    {
-      mitk::Point3D p1 = pointSet1->GetPoint(i);
-      mitk::Point3D p2 = pointSet2->GetPoint(i);
+      mitk::FillVector3D(point, (rand()%1000) /1000.0 , (rand()%1000) /1000.0, (rand()%1000)/1000.0);
+      ++position;
+      pointSet->SetPoint(position, point, t);
+    }
+    m_SavedPointSet.push_back(pointSet);

-      double difference = (   (p1[0] - p2[0])
-                            + (p1[1] - p2[1])
-                            + (p1[2] - p2[2])
-                          );
+    return pointSet;

-      MITK_TEST_CONDITION(difference <= 0.0001, "Testing if Points are at the same Position" );
-
-    }
   }

-}
+  void PointSetCompare(mitk::PointSet::Pointer pointSet2,
+      mitk::PointSet::Pointer pointSet1, bool& identical)
+  {

-static bool PointSetWrite(unsigned int numberOfPointSets)
-{
+    MITK_TEST_CONDITION(pointSet1->GetSize() == pointSet2->GetSize(), "Testing if PointSet size is correct" );
+
+    for (unsigned int t = 0; t < numberOfTimeSeries; t++)
+    {
+      for (unsigned int i = 0; i < (unsigned int) pointSet1->GetSize(t); ++i)
+      {
+        mitk::Point3D p1 = pointSet1->GetPoint(i);
+        mitk::Point3D p2 = pointSet2->GetPoint(i);
+
+          //test
+          std::cout << "r point: " << p2 << std::endl;
+          std::cout << "w point: " << p1 << std::endl;
+
+          //test end
+
+        MITK_TEST_CONDITION((p1[0] - p2[0]) <= 0.0001, "Testing if X coordinates of the Point are at the same Position" );
+        MITK_TEST_CONDITION((p1[1] - p2[1]) <= 0.0001, "Testing if Y coordinates of the Point are at the same Position" );
+        MITK_TEST_CONDITION((p1[2] - p2[2]) <= 0.0001, "Testing if Z coordinates of the Point are at the same Position" );
+
+      }
+    }
+
+  }
+
+  bool PointSetWrite(unsigned int numberOfPointSets)
+  {
     try
+    {
+      m_SavedPointSet.clear();
+      mitk::PointSetWriter::Pointer pointSetWriter =
+          mitk::PointSetWriter::New();
+
+      pointSetWriter->SetFileName("/home/wangxi/test_pointset_new.mps");
+      for (unsigned int i = 0; i < numberOfPointSets; i++)
       {
-        mitk::PointSetWriter::Pointer pointSetWriter = mitk::PointSetWriter::New();
+        pointSetWriter->SetInput(i, CreateTestPointSet());
+      }
+      pointSetWriter->Write();
+    } catch (std::exception& e)
+    {
+      return false;
+    }

-        pointSetWriter->SetFileName("test_pointset_new.mps");
-        for(unsigned int i=0; i<numberOfPointSets; i++)
-        {
-          pointSetWriter->SetInput(i, CreateTestPointSet(i));
-        }
-        pointSetWriter->Write();
-      }
-      catch ( std::exception& e )
-      {
-        return false;
-      }
+    return true;
+  }

-      return true;
-}
-
-static void PointSetLoadAndCompareTest(unsigned int numberOfPointSets)
-{
-  try
+  void PointSetLoadAndCompareTest(unsigned int numberOfPointSets)
+  {
+    try
     {
-      mitk::PointSetReader::Pointer pointSetReader = mitk::PointSetReader::New();
+      mitk::PointSetReader::Pointer pointSetReader =
+          mitk::PointSetReader::New();
       mitk::PointSet::Pointer pointSet;

-      pointSetReader->SetFileName("test_pointset_new.mps");
-      for(unsigned int i=0; i<numberOfPointSets; i++)
+      pointSetReader->SetFileName("/home/wangxi/test_pointset_new.mps");
+      for (unsigned int i = 0; i < numberOfPointSets; i++)
       {
         pointSetReader->Update();
         pointSet = pointSetReader->GetOutput(i);
         MITK_TEST_CONDITION(pointSet.IsNotNull(), "Testing if the loaded Data are NULL" );
-
+
         bool identical(true);
-        PointSetCompare(pointSet.GetPointer(), CreateTestPointSet(i).GetPointer(), identical);
+        PointSetCompare(pointSet.GetPointer(), m_SavedPointSet.at(i).GetPointer(),
+            identical);
       }
-    }
-    catch ( std::exception& e )
+    } catch (std::exception& e)
     {
     }
-}
-
+  }

 }; //mitkPointSetFileIOTestClass

@@ -125,14 +142,15 @@
 int mitkPointSetFileIOTest(int, char*[])
 {
   MITK_TEST_BEGIN("PointSet");
-  unsigned int numberOfPointSets(1);
+    unsigned int numberOfPointSets(100);

-  // write
-  MITK_TEST_CONDITION(mitkPointSetFileIOTestClass::PointSetWrite(numberOfPointSets), "Testing if the PointSetWriter writes Data" );
+    mitkPointSetFileIOTestClass* test = new mitkPointSetFileIOTestClass();

-  // load - compare
-  mitkPointSetFileIOTestClass::PointSetLoadAndCompareTest(numberOfPointSets);
+    // write
+    MITK_TEST_CONDITION(test->PointSetWrite(numberOfPointSets), "Testing if the PointSetWriter writes Data" );

+    // load - compare
+    test->PointSetLoadAndCompareTest(numberOfPointSets);

   MITK_TEST_END();
 }


adding chisquare output

adding chisquare output


Doubles up on register mirroring. Will do for now. More to come.


修改提示框字符高度计算

修改提示框字符高度计算


AArch64: Temporarily disable AArch64AddressTypePromotion

Temporarily disable AArch64AddressTypePromotion, which was effectively
re-enabled in r212073 and r212075, while I look into PR20188.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@212189 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/AArch64/AArch64TargetMachine.cpp
+++ lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -155,8 +155,6 @@
     addPass(createAArch64PromoteConstantPass());
   if (TM->getOptLevel() != CodeGenOpt::None)
     addPass(createGlobalMergePass(TM));
-  if (TM->getOptLevel() != CodeGenOpt::None)
-    addPass(createAArch64AddressTypePromotionPass());

   return false;
 }


Fix threading bug

Fix threading bug

--- src/core/vsthreadpool.cpp
+++ src/core/vsthreadpool.cpp
@@ -107,12 +107,11 @@
                     }

                     PVSFrameContext mainContextRef = std::move(*iter);
+                    tasks.erase(iter);
+                    allContexts.erase(frameContext->key);

                     if (frameContext->external)
                         returnFrame(frameContext, f);
-
-                    allContexts.erase(frameContext->key);
-                    tasks.erase(iter);

                     if (needsSort)
                         tasks.sort(taskCmp);
@@ -293,6 +292,7 @@
 }

 void VSThreadPool::queueTask(const PVSFrameContext &ctx) {
+    assert(ctx);
     tasks.push_front(ctx);
     wakeThread();
 }
@@ -318,6 +318,7 @@
     assert(context);
     std::lock_guard<std::mutex> l(taskLock);
     context->reqOrder = ++reqCounter;
+    assert(context);
     tasks.push_back(context); // external requests can't be combined so just add to queue
     wakeThread();
 }


add parentheses around '&&'

add parentheses around '&&'

--- src/core/vsthreadpool.cpp
+++ src/core/vsthreadpool.cpp
@@ -140,7 +140,7 @@

             VSActivationReason ar = arInitial;
             bool skipCall = false; // Used to avoid multiple error calls for the same frame request going into a filter
-            if (hasLeafContext && leafContext->hasError() || mainContext->hasError()) {
+            if ((hasLeafContext && leafContext->hasError()) || mainContext->hasError()) {
                 ar = arError;
                 skipCall = mainContext->setError(leafContext->getErrorMessage());
                 --mainContext->numFrameRequests;


Red Flash

Red Flash

--- hot_particle/executable/chockNgt/chockNgt.cpp
+++ hot_particle/executable/chockNgt/chockNgt.cpp
@@ -44,6 +44,8 @@
 static int *creditsTexData[1024*1024];

 float fCurTime = 0.0f;
+
+float last_red_flash = -10.0f;

 bool mod_key_ = false;
 // Used to avoid double-pressing the same key
@@ -538,6 +540,13 @@
 		}
 #endif

+        float alpha = 1.0f - fCurTime + last_red_flash;
+        GLuint tex_id;
+        textureManager.getTextureID("white.tga", &tex_id, error_string);
+        glBindTexture(GL_TEXTURE_2D, tex_id);
+        DrawQuadColor(-1.0f, 1.0f, -1.0f, 1.0f,
+                      1.0f, 0.0f, 0.0f, alpha);
+
 		// draw background
 		//DrawQuad(-0.3f, 0.8f, -0.2f, 0.7f, 0.4f, 1.0f, 1.0f);
 		//glEnable(GL_DEPTH_TEST);
@@ -833,6 +842,7 @@

             case VK_UP:
                 audio_.PlaySound("punch.wav", 4, false, -1, error_string);
+                last_red_flash = fCurTime;
                 break;
             case VK_DOWN:
                 audio_.PlaySound("01_Donner.wav", 0, false, -1, error_string);


work on timestamp for xalt_object

work on timestamp for xalt_object

--- compiled/direct2db.C
+++ compiled/direct2db.C
@@ -464,8 +464,25 @@
   param_i[3].length        = &len_module_name;

   // TIMESTAMP PARAM_I[4] timestamp
+  MYSQL_TIME my_datetime;
+  time_t clock;
+  (void ) time(&clock);
+  struct tm* curr_time    = localtime(&clock);
+  my_datetime.year        = curr_time->tm_year + 1900;
+  my_datetime.month       = curr_time->tm_mon  + 1;
+  my_datetime.day         = curr_time->tm_mday;
+  my_datetime.hour        = curr_time->tm_hour;
+  my_datetime.min         = curr_time->tm_min;
+  my_datetime.second      = curr_time->tm_sec;
+  my_datetime.second_part = 0;
+  param_i[4].buffer_type  = MYSQL_TYPE_DATETIME;
+  param_i[4].buffer       = &my_datetime;
+  param_i[4].is_null      = 0;

   // STRING PARAM_I[5] lib_type
+
+
+

   if (mysql_stmt_bind_param(stmt, param_s))
     {


Remove scaling factor for Kalman R matrix

--- projects/flimnap/main.cc
+++ projects/flimnap/main.cc
@@ -113,7 +113,7 @@
             typename S::observer_t& observer = bicycle.observer();
             observer.set_Q(parameters::defaultvalue::kalman::Q(observer.dt()));
             // Reduce steer measurement noise covariance
-            observer.set_R(parameters::defaultvalue::kalman::R/1000);
+            observer.set_R(parameters::defaultvalue::kalman::R);

             // prime the Kalman gain matrix
             bicycle.prime_observer();


As you wish linter

As you wish linter

--- atom/common/native_mate_converters/net_converter.cc
+++ atom/common/native_mate_converters/net_converter.cc
@@ -45,7 +45,7 @@
   return true;
 }

-}
+}  // namespace

 // static
 v8::Local<v8::Value> Converter<const net::AuthChallengeInfo*>::ToV8(


Check for nullptr and body index validity

--- SkeletonSmoother.cpp
+++ SkeletonSmoother.cpp
@@ -15,6 +15,10 @@

 void SkeletonSmoother::updateJointPositions(const unsigned int &bodyIndex, const float &delta, const PointF &screenSize, Joint *joints)
 {
+    if (joints == nullptr || bodyIndex >= BODY_COUNT) {
+        return;
+    }
+
     for (unsigned int jointIndex = 0; jointIndex < JointType_Count; jointIndex++) {
         const PointF jointRawPos = mapBodyPointToScreenPoint(joints[jointIndex].Position, screenSize.X, screenSize.Y);
         //Invert the Y-axis


follow naming convention (file-locks)

follow naming convention (file-locks)

--- src/cpp/core/FileLock.cpp
+++ src/cpp/core/FileLock.cpp
@@ -37,7 +37,7 @@

 namespace {

-const char * const kLocksConfPath = "/etc/rstudio/locks.conf";
+const char * const kLocksConfPath = "/etc/rstudio/file-locks";
 #define kDefaultRefreshRate     20.0
 #define kDefaultTimeoutInterval 30.0


Make sure you only handle branch delay slots specially when there actually was a branch.

--HG--
extra : convert_revision : ea6d33b1b9c2ba5c24225af4b10a9bd25558f1dd

--- src/cpu/o3/commit_impl.hh
+++ src/cpu/o3/commit_impl.hh
@@ -731,9 +731,14 @@
 #if ISA_HAS_DELAY_SLOT
             InstSeqNum bdelay_done_seq_num = squashed_inst;
             bool squash_bdelay_slot = fromIEW->squashDelaySlot[tid];
-
-            if (!squash_bdelay_slot)
+            bool branchMispredict = fromIEW->branchMispredict[tid];
+
+            // Squashing/not squashing the branch delay slot only makes
+            // sense when you're squashing from a branch, ie from a branch
+            // mispredict.
+            if (branchMispredict && !squash_bdelay_slot) {
                 bdelay_done_seq_num++;
+            }
 #endif

             if (fromIEW->includeSquashInst[tid] == true) {


修正部分实数被截断的问题

修正部分实数被截断的问题

--- src/debugger/observer.cpp
+++ src/debugger/observer.cpp
@@ -182,6 +182,10 @@
 		return true;
 	}

+    static std::string convertreal(lua_Number r) {
+        return bee::format("%.16g", r);
+    }
+
 	static bool push_setvalue(lua_State* L, int oldtype, set_value& setvalue)
 	{
 		if (setvalue.value == "nil") {
@@ -229,7 +233,7 @@
 		double dv = strtod(setvalue.value.c_str(), &end);
 		if (errno != ERANGE && *end == 0)
 		{
-			setvalue.value = bee::format("%f", dv);
+			setvalue.value = convertreal(dv);
 			setvalue.type = "number";
 			lua_pushnumber(L, dv);
 			return true;
@@ -429,7 +433,7 @@
 					return bee::format("[%d]", i);
 				}
 				else
-					return bee::format("%f", lua_tonumber(L, idx));
+					return convertreal(lua_tonumber(L, idx));
 			case LUA_TSTRING: {
 				size_t len = 0;
 				const char* buf = lua_tolstring(L, idx, &len);
@@ -471,7 +475,7 @@
 				if (lua_isinteger(L, idx)) {
 					return bee::format("%d", lua_tointeger(L, idx));
 				}
-				return bee::format("%f", lua_tonumber(L, idx));
+				return convertreal(lua_tonumber(L, idx));
 			case LUA_TSTRING: {
 				size_t len = 0;
 				const char* str = lua_tolstring(L, idx, &len);
@@ -599,7 +603,7 @@
 				if (lua_isinteger(L, idx)) {
 					return bee::format("%d", lua_tointeger(L, idx));
 				}
-				return bee::format("%f", lua_tonumber(L, idx));
+				return convertreal(lua_tonumber(L, idx));
 			case LUA_TSTRING: {
 				size_t len = 0;
 				const char* str = lua_tolstring(L, idx, &len);


Minor formating tweak.

Minor formating tweak.

git-svn-id: 03d7800a49d8905ef4fbcc296184319e19243493@1132305 13f79535-47bb-0310-9956-ffa450edef68

--- src/detector/detector.cpp
+++ src/detector/detector.cpp
@@ -418,7 +418,7 @@

 void ZooKeeperMasterDetector::process(ZooKeeper* zk, int type, int state,
-				      const string &path)
+				      const string& path)
 {
   if ((state == ZOO_CONNECTED_STATE) && (type == ZOO_SESSION_EVENT)) {
     // Check if this is a reconnect.


Remove more ambiguity.

Remove more ambiguity.

--- src/engine/utils/src/bytes/byte_serializer.cpp
+++ src/engine/utils/src/bytes/byte_serializer.cpp
@@ -40,7 +40,7 @@
 				}

 				// Not found, store it with bit 0 set to 0
-				const auto sz = str.size();
+				const uint64_t sz = uint64_t(str.size());
 				*this << (sz << 1);
 				*this << gsl::as_bytes(gsl::span<const char>(str.c_str(), sz));
 			}


Fixed issues

Fixed issues

--- include/cozmo/cozmo.hpp
+++ include/cozmo/cozmo.hpp
@@ -3,12 +3,18 @@

 #include "dart/dart.hpp"

+namespace libcozmo {
 using BodyNodePtr = dart::dynamics::BodyNodePtr;
 using SkeletonPtr = dart::dynamics::SkeletonPtr;
 using InverseKinematicsPtr = dart::dynamics::InverseKinematicsPtr;

 class Cozmo
 {
+public:
+  Cozmo(const std::string& mesh_dir);
+  void setForkliftPosition(double pos);
+  SkeletonPtr getCozmoSkeleton() { return cozmo; };
+
 private:
   SkeletonPtr cozmo;
   BodyNodePtr head;
@@ -26,11 +32,6 @@
 	              Eigen::Vector3d transformFromParent, Eigen::Vector3d transformFromChild);
   SkeletonPtr createCozmo(const std::string& mesh_dir);
   void createIKModule();
-
-public:
-  Cozmo(const std::string& mesh_dir);
-  void setPosition(double pos);
-  SkeletonPtr getCozmoSkeleton() { return cozmo; };
 };
-
+}
 #endif  // COZMO_COZMO_HPP_


Improve support for parallel_shuffle

Improve support for parallel_shuffle

Can now be used with vectors and matrices together

--- include/etl/globals.hpp
+++ include/etl/globals.hpp
@@ -974,65 +974,81 @@
 }

 /*!
- * \brief Shuffle all the elements of two vectors, using the same permutation
- *
- * Note: This function will be executed on GPU if EGBLAS is
- * configured and the par_shuffle operation is available.
- *
- * \param v1 The first vector to shuffle
- * \param v2 The second vector to shuffle
- */
-template<typename T1, typename T2, cpp_enable_iff(is_1d<T1>)>
+ * \brief Shuffle all the elements of two vectors or matrices, using the same permutation
+ *
+ * Note: This function will be executed on GPU if EGBLAS is
+ * configured and the par_shuffle_seed operation is available.
+ *
+ * \param v1 The first vector or matrix to shuffle
+ * \param v2 The second vector or matrix to shuffle
+ */
+template<typename T1, typename T2>
 void parallel_shuffle(T1& v1, T2& v2){
-    parallel_shuffle_flat(v1, v2);
-}
-
-/*!
- * \brief Shuffle all the elements of two vectors, using the same permutation
- *
- * Note: This function will be executed on GPU if EGBLAS is
- * configured and the par_shuffle operation is available.
- *
- * \param v1 The first vector to shuffle
- * \param v2 The second vector to shuffle
- */
-template<typename T1, typename T2, typename G, cpp_enable_iff(is_1d<T1>)>
+    static std::random_device rd;
+    static etl::random_engine g(rd());
+
+    parallel_shuffle(v1, v2, g);
+}
+
+template<typename T, cpp_enable_if(is_1d<T>)>
+void shuffle_swap(T& v1, size_t i, size_t new_i){
+    auto t = v1(i);
+    v1(i) = v1(new_i);
+    v1(new_i) = t;
+}
+
+template<typename T, cpp_disable_if(is_1d<T>)>
+void shuffle_swap(T& v1, size_t i, size_t new_i){
+    auto t = etl::force_temporary(v1(i));
+    v1(i) = v1(new_i);
+    v1(new_i) = t;
+}
+
+/*!
+ * \brief Shuffle all the elements of two vectors or matrices, using the same permutation
+ *
+ * Note: This function will be executed on GPU if EGBLAS is
+ * configured and the par_shuffle_seed operation is available.
+ *
+ * \param v1 The first vector or matrix to shuffle
+ * \param v2 The second vector or matrix to shuffle
+ */
+template<typename T1, typename T2, typename G>
 void parallel_shuffle(T1& v1, T2& v2, G&& g){
-    parallel_shuffle_flat(v1, v2, g);
-}
-
-/*!
- * \brief Shuffle all the elements of two matrices, using the same permutation.
- *
- * The elements will be shuffled according to the first dimension of
- * the matrix.
- *
- * Note: This function will be executed on GPU if EGBLAS is
- * configured and the par_shuffle operation is available.
- *
- * \param m1 The first matrix to shuffle
- * \param m2 The first matrix to shuffle
- */
-template<typename T1, typename T2, cpp_enable_iff(decay_traits<T1>::dimensions() > 1)>
-void parallel_shuffle(T1& m1, T2& m2){
-    parallel_shuffle_first(m1, m2);
-}
-
-/*!
- * \brief Shuffle all the elements of two matrices, using the same permutation.
- *
- * The elements will be shuffled according to the first dimension of
- * the matrix.
- *
- * Note: This function will be executed on GPU if EGBLAS is
- * configured and the par_shuffle operation is available.
- *
- * \param m1 The first matrix to shuffle
- * \param m2 The first matrix to shuffle
- */
-template<typename T1, typename T2, typename G, cpp_enable_iff(decay_traits<T1>::dimensions() > 1)>
-void parallel_shuffle(T1& m1, T2& m2, G&& g){
-    parallel_shuffle_first(m1, m2, g);
+    cpp_assert(etl::dim<0>(v1) == etl::dim<0>(v2), "Impossible to shuffle together matrices of different first dimension");
+
+    const auto n = etl::dim<0>(v1);
+
+    if(n < 2){
+        return;
+    }
+
+    if /*constexpr*/ (impl::egblas::has_par_shuffle_seed) {
+        std::uniform_int_distribution<size_t> seed_dist;
+
+        v1.ensure_gpu_up_to_date();
+        v2.ensure_gpu_up_to_date();
+
+        impl::egblas::par_shuffle_seed(n,
+            v1.gpu_memory(), sizeof(etl::value_t<T1>) * (etl::size(v1) / n),
+            v2.gpu_memory(), sizeof(etl::value_t<T2>) * (etl::size(v2) / n),
+            seed_dist(g));
+
+        v1.invalidate_cpu();
+        v2.invalidate_cpu();
+    } else {
+        using distribution_t = typename std::uniform_int_distribution<size_t>;
+        using param_t        = typename distribution_t::param_type;
+
+        distribution_t dist;
+
+        for (auto i = n - 1; i > 0; --i) {
+            auto new_i = dist(g, param_t(0, i));
+
+            shuffle_swap(v1, i, new_i);
+            shuffle_swap(v2, i, new_i);
+        }
+    }
 }

 /*!


added acknowledgements

added acknowledgements

--- include/expressions.hpp
+++ include/expressions.hpp
@@ -1,6 +1,11 @@
 /*
  * expressions.hpp
  * Author: Radu Cotescu (rdc1g10@soton.ac.uk)
+ *
+ * The implementation is based on an article written by Angelika Langer and
+ * published on her web site at the following address:
+ *
+ * http://www.angelikalanger.com/Articles/Cuj/ExpressionTemplates/ExpressionTemplates.htm
  *
  * Part 2: Expression Templates
  * Write C++ templates which allow you to use types to represent arithmetic


Added support for animation path manipulator to osgViewer path

git-svn-id: 23b6355f2bb369032457de4eb5f713ee134f73a8@5975 16af8721-9629-0410-8352-f15c8da7e697

--- applications/osgviewer/osgviewer.cpp
+++ applications/osgviewer/osgviewer.cpp
@@ -138,7 +138,7 @@
 #include <osgGA/DriveManipulator>
 #include <osgGA/KeySwitchMatrixManipulator>
 #include <osgGA/StateSetManipulator>
-
+#include <osgGA/AnimationPathManipulator>

 int main_osgViewer(osg::ArgumentParser& arguments)
 {
@@ -151,6 +151,19 @@
         keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
         keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
         keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
+
+        std::string pathfile;
+        osg::ref_ptr<osgGA::AnimationPathManipulator> apm = 0;
+        while (arguments.read("-p",pathfile))
+        {
+            osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
+            if (apm || !apm->valid())
+            {
+                unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
+                keyswitchManipulator->addMatrixManipulator( '4', "Path", apm );
+                keyswitchManipulator->selectMatrixManipulator(num);
+            }
+        }

         viewer.setCameraManipulator( keyswitchManipulator.get() );
     }


From Magnus Kessler, "Fix a small typo in present3D usage string"

--- applications/present3D/present3D.cpp
+++ applications/present3D/present3D.cpp
@@ -375,7 +375,7 @@
     arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time duration in seconds between layers/slides");
     arguments.getApplicationUsage()->addCommandLineOption("-s <float> <float> <float>","width, height, distance and of the screen away from the viewer");
     arguments.getApplicationUsage()->addCommandLineOption("--viewer","Start Present3D as the viewer version.");
-    arguments.getApplicationUsage()->addCommandLineOption("--authoring","Start Presen3D as the authoring version, license required.");
+    arguments.getApplicationUsage()->addCommandLineOption("--authoring","Start Present3D as the authoring version, license required.");
     arguments.getApplicationUsage()->addCommandLineOption("--master","Start Present3D as the master version, license required.");
     arguments.getApplicationUsage()->addCommandLineOption("--slave","Start Present3D as the slave version, license required.");
     arguments.getApplicationUsage()->addCommandLineOption("--publishing","Start Present3D as the publishing version, license required.");


Android: escape 4-byte UTF sequences as binary for JSON.

--- platform/shared/json.new/JSONIterator.cpp
+++ platform/shared/json.new/JSONIterator.cpp
@@ -462,8 +462,15 @@
 //return size of UTF char ( 2,3,4 ) or 0 for invalid char
 static inline int isValidUTF8Sequence( const char* p, int maxLen )
 {
-    if ( maxLen > 4 ) {
-        maxLen = 4;
+//JNI would crash on 4bytes UTF
+#ifdef OS_ANDROID
+    static const int cMaxUtfSize = 3;
+#else
+    static const int cMaxUtfSize = 4;
+#endif
+
+    if ( maxLen > cMaxUtfSize ) {
+        maxLen = cMaxUtfSize;
     }

     int expectedLen = 0;
@@ -471,9 +478,12 @@

     //determine sequence length from first char
     //11110xxx = 4, 1110xxxx = 3, 110xxxxx = 2, treat 1-byte UTF as invalid
+#ifndef OS_ANDROID
     if ( (c&0xF8)==0xF0 ) {
         expectedLen = 4;
-    } else if ( (c&0xF0)==0xE0) {
+    } else
+#endif //OS_ANDROID
+    if ( (c&0xF0)==0xE0) {
         expectedLen = 3;
     } else if ( (c&0xE0)==0xC0) {
         expectedLen = 2;
@@ -481,7 +491,9 @@

     //no breaks here is intentional. Check rest bytes in sequence for valid mask: 10xxxxxx.
     switch(expectedLen) {
+#ifndef OS_ANDROID
         case 4: if ((p[3]&0xC0)!=0x80) return 0;
+#endif
         case 3: if ((p[2]&0xC0)!=0x80) return 0;
         case 2: if ((p[1]&0xC0)!=0x80) return 0;
     }


Added missing IO factories

Added missing IO factories

--- applications/rtkmedian/rtkmedian.cxx
+++ applications/rtkmedian/rtkmedian.cxx
@@ -32,6 +32,7 @@
 int main(int argc, char * argv[])
 {
   GGO(rtkmedian, args_info);
+  rtk::RegisterIOFactories();

   typedef unsigned short OutputPixelType;
   const unsigned int     Dimension = 2;


Fix bug with maemo5 saving a contact with thumbnail twice.

Relates to QTMOBILITY-228

--- plugins/contacts/maemo5/qcontactabook.cpp
+++ plugins/contacts/maemo5/qcontactabook.cpp
@@ -1768,7 +1768,7 @@
                                                  image.hasAlphaChannel(), 8,
                                                  image.width(), image.height(),
                                                  image.bytesPerLine(), 0, 0);
-    osso_abook_contact_set_pixbuf((OssoABookContact*)aContact, pixbuf, book, 0);
+    osso_abook_contact_set_pixbuf((OssoABookContact*)aContact, pixbuf, 0, 0);
     g_object_unref(pixbuf);
 }

@@ -1792,7 +1792,7 @@
 //                                               image.hasAlphaChannel(), 8,
 //                                               image.width(), image.height(),
 //                                               image.bytesPerLine(), 0, 0);
-//  osso_abook_contact_set_pixbuf((OssoABookContact*)aContact, pixbuf, book, 0);
+//  osso_abook_contact_set_pixbuf((OssoABookContact*)aContact, pixbuf, 0, 0);
 //  g_object_unref(pixbuf);
 }


Correcting internal references

Correcting internal references

--- include/graph/STree.tcc
+++ include/graph/STree.tcc
@@ -32,30 +32,30 @@
 namespace graph
 {
     template<
-        typename Vertex = graph::Vertex<>,
-        typename Arc    = graph::Arc<Vertex>,
-        typename Cycle  = graph::Cycle<Arc>
+        typename Graph,
+        typename Cycle = graph::Cycle<typename Graph::arc_type>
     >class STree
     {
         public:
-            typedef Vertex                   vertex_type;
-            typedef Arc                      arc_type;
-            typedef typename Vertex::id_type vertex_id;
+            typedef typename Graph::arc_type    arc_type;
+            typedef typename Graph::arc_list    arc_list;
+            typedef typename Graph::vertex_id   vertex_id;
+            typedef typename Graph::vertex_type vertex_type;

         private:
+            Graph*                 base;
             std::vector<vertex_id> parnt;
             std::vector<int>       depth;
             vertex_id              radix;
             int                    max_depth;

         public:
-            STree(size_t num_vertices, vertex_id radix,
-                  std::initializer_list<Arc> arcs)
-                : parnt(num_vertices),
-                  depth(num_vertices,-1),
-                  radix{}, max_depth{-1}
+            STree(Graph& base, size_t num_vertices,
+                  vertex_id radix, arc_list arcs)
+                : base{&base}, parnt(num_vertices),
+                  depth(num_vertices,-1), radix{}, max_depth{-1}
             {
-                for(const Arc& arc : arcs)
+                for(const arc_type& arc : arcs)
                 {
                     if(depth[arc.beg] == -1
                     && depth[arc.end] != -1)
@@ -82,7 +82,7 @@
                 }
             }

-            Cycle fundamental_cycle(const Arc& inserted)
+            Cycle fundamental_cycle(const arc_type& inserted)
             {
                 Cycle cycle { inserted };
                 vertex_id l { inserted.beg };
@@ -96,9 +96,9 @@
                 // Intermediate arcs
                 // (when with different depths)
                 for(vertex_id lp = parnt[l]; depth[l] != depth; l = lp)
-                    cycle.push_back( Arc{lp,l} );
+                    cycle.push_back( arc_type{lp,l} );
                 for(vertex_id rp = parnt[r]; depth[r] != depth; r = rp)
-                    cycle.push_front( Arc{rp,r} );
+                    cycle.push_front( arc_type{rp,r} );

                 while(r != l)
                 {
@@ -106,8 +106,8 @@
                     // (when with the same depth)
                     vertex_id lp = parnt[l];
                     vertex_id rp = parnt[r];
-                    cycle.push_back ( Arc{lp,l} );
-                    cycle.push_front( Arc{rp,r} );
+                    cycle.push_back ( arc_type{lp,l} );
+                    cycle.push_front( arc_type{rp,r} );
                     r = rp; l = lp;
                 }


THRIFT-832. html: HTML generator shows unspecified struct fields as 'required'

This patch causes required/optional/default to reported appropriately.

git-svn-id: 8d8e29b1fb681c884914062b88f3633e3a187774@984868 13f79535-47bb-0310-9956-ffa450edef68

--- compiler/cpp/src/generate/t_html_generator.cc
+++ compiler/cpp/src/generate/t_html_generator.cc
@@ -534,7 +534,7 @@
   vector<t_field*> members = tstruct->get_members();
   vector<t_field*>::iterator mem_iter = members.begin();
   f_out_ << "
";
-  f_out_ << "
Field	Type	Description	Required	Default value
"
+  f_out_ << "
Field	Type	Description	Requiredness	Default value
"
 	 << endl;
   for ( ; mem_iter != members.end(); mem_iter++) {
     f_out_ << "
" << (*mem_iter)->get_name() << "	";
@@ -542,10 +542,12 @@
     f_out_ << "	";
     f_out_ << (*mem_iter)->get_doc();
     f_out_ << "	";
-    if ((*mem_iter)->get_req() != t_field::T_OPTIONAL) {
-      f_out_ << "yes";
+    if ((*mem_iter)->get_req() == t_field::T_OPTIONAL) {
+      f_out_ << "optional";
+    } else if ((*mem_iter)->get_req() == t_field::T_REQUIRED) {
+      f_out_ << "required";
     } else {
-      f_out_ << "no";
+      f_out_ << "default";
     }
     f_out_ << "	";
     t_const_value* default_val = (*mem_iter)->get_value();


Restructured audiobuffer test cases

Restructured audiobuffer test cases

--- libs/audiobuffer/audiobuffer-test/main.cpp
+++ libs/audiobuffer/audiobuffer-test/main.cpp
@@ -2,50 +2,51 @@
 #include "catch.hpp"
 #include "audiobuffer.h"

-TEST_CASE( "RingBuffer", "[AudioBuffer]" ) {
+TEST_CASE( "RingBuffer", "[AudioBuffer]" )
+{
+    AudioBuffer* buffer = new AudioBuffer();
     SECTION("Allocation") {
-        AudioBuffer buffer;
-        buffer.allocateRingbuffers(1024);
-        REQUIRE(buffer.numberOfChannels() == 0);
-        REQUIRE(buffer.ringBufferContainer.size() == 0);
-        REQUIRE(buffer.ringBufferSize == 1024);
+        buffer->allocateRingbuffers(1024);
+        REQUIRE(buffer->numberOfChannels() == 0);
+        REQUIRE(buffer->ringBufferContainer.size() == 0);
+        REQUIRE(buffer->ringBufferSize == 1024);
     }
     SECTION("Channels") {
-        AudioBuffer buffer;
         QList<unsigned int> channels({1,5});
-        buffer.allocateRingbuffers(1024, channels);
-        REQUIRE(buffer.numberOfChannels() == channels.size());
-        REQUIRE(buffer.ringBufferContainer.size() == channels.size());
+        buffer->allocateRingbuffers(1024, channels);
+        REQUIRE(buffer->numberOfChannels() == channels.size());
+        REQUIRE(buffer->ringBufferContainer.size() == channels.size());

-        REQUIRE(buffer.activeChannelId(1) == channels.at(1));
-        REQUIRE(buffer.activeChannelId(2) == 2);
+        REQUIRE(buffer->activeChannelId(1) == channels.at(1));
+        REQUIRE(buffer->activeChannelId(2) == 2);
     }
     SECTION("Rotation") {
-        AudioBuffer buffer;
         QList<unsigned int> channels({0});
-        buffer.allocateRingbuffers(10, channels);
+        buffer->allocateRingbuffers(10, channels);

         // Initialize buffer with values
-        for( unsigned int ch=0; ch<buffer.numberOfChannels(); ch++ ) {
-            QVector<double> *frames = &buffer.ringBufferContainer[ch];
-            for( unsigned int i=0; i<buffer.ringBufferSize; i++ ) {
+        for( unsigned int ch=0; ch<buffer->numberOfChannels(); ch++ ) {
+            QVector<double> *frames = &buffer->ringBufferContainer[ch];
+            for( unsigned int i=0; i<buffer->ringBufferSize; i++ ) {
                 (*frames)[i] = i;
             }
         }

         // Test buffer initialization
-        foreach (QVector<double> frames, buffer.ringBufferContainer) {
+        foreach (QVector<double> frames, buffer->ringBufferContainer) {
             //for( int i=0; i<frames.size(); i++ ) { std::cerr << frames.at(i) << ", "; }
             REQUIRE(frames.at(3) == 3);
         }

         // Rotate and test frames
         unsigned int delta = 5;
-        REQUIRE(buffer.rotateRingbuffers(delta) == true );
-        foreach (QVector<double> frames, buffer.ringBufferContainer) {
+        REQUIRE(buffer->rotateRingbuffers(delta) == true );
+        foreach (QVector<double> frames, buffer->ringBufferContainer) {
             //for( int i=0; i<frames.size(); i++ ) { std::cerr << frames.at(i) << ", "; }
             REQUIRE(frames.at(delta) == 0);
         }
-        REQUIRE(buffer.rotateRingbuffers(buffer.ringBufferSize+1) == false);
+        REQUIRE(buffer->rotateRingbuffers(buffer->ringBufferSize+1) == false);
     }
+
+    delete buffer;
 }


Update inpal_prime.hpp

Update inpal_prime.hpp

--- include/inpal_prime.hpp
+++ include/inpal_prime.hpp
@@ -1,10 +1,11 @@
 //
 //  inpal_prime.hpp
-//  inpalprime
+//  InversePalindrome
 //
-//  Created by bryan triana on 7/13/16.
+//  Created by Bryan Triana on 7/13/16.
 //  Copyright © 2016 Inverse Palindrome. All rights reserved.
 //
+

 #ifndef inpal_prime_hpp
 #define inpal_prime_hpp


ffmpeg: fix version check

ffmpeg: fix version check

--- libs/hwdrivers/src/CFFMPEG_InputStream.cpp
+++ libs/hwdrivers/src/CFFMPEG_InputStream.cpp
@@ -9,17 +9,17 @@

 #if defined(__GNUC__)  // Needed for ffmpeg headers. Only allowed here when not
 // using precomp. headers
-#define __STDC_CONSTANT_MACROS	// Needed for having "UINT64_C" and so
+#define __STDC_CONSTANT_MACROS  // Needed for having "UINT64_C" and so
 #endif

 #include <mrpt/config.h>

-#include "hwdrivers-precomp.h"	// Precompiled headers
+#include "hwdrivers-precomp.h"  // Precompiled headers

 #if MRPT_HAS_FFMPEG
 extern "C"
 {
-#define _MSC_STDINT_H_	// We already have pstdint.h in MRPT
+#define _MSC_STDINT_H_  // We already have pstdint.h in MRPT
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
 #include <libavutil/imgutils.h>
@@ -47,7 +47,7 @@
 {
 	AVFormatContext* pFormatCtx{nullptr};
 	int videoStream{0};
-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 	AVCodecParameters* pCodecPars{nullptr};
 #endif
 	AVCodec* pCodec{nullptr};
@@ -117,7 +117,7 @@
 	const std::string& url, bool grab_as_grayscale, bool verbose)
 {
 #if MRPT_HAS_FFMPEG
-	this->close();	// Close first
+	this->close();  // Close first

 	TFFMPEGContext* ctx = &m_impl->m_state;

@@ -153,7 +153,7 @@
 	ctx->videoStream = -1;
 	for (unsigned int i = 0; i < ctx->pFormatCtx->nb_streams; i++)
 	{
-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 		auto codecType = ctx->pFormatCtx->streams[i]->codecpar->codec_type;
 #else
 		auto codecType = ctx->pFormatCtx->streams[i]->codec->codec_type;
@@ -173,7 +173,7 @@
 	}

 	// Get a pointer to the codec context for the video stream
-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 	ctx->pCodecPars = ctx->pFormatCtx->streams[ctx->videoStream]->codecpar;
 	// Find the decoder for the video stream
 	ctx->pCodec = avcodec_find_decoder(ctx->pCodecPars->codec_id);
@@ -189,7 +189,7 @@
 		return false;
 	}

-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 	ctx->pCodecCtx = avcodec_alloc_context3(nullptr /*ctx->pCodec*/);
 	if (!ctx->pCodecCtx)
 	{
@@ -237,7 +237,7 @@
 	}

 	// Determine required buffer size and allocate buffer
-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 	const auto width = ctx->pCodecPars->width, height = ctx->pCodecPars->height;
 #else
 	const auto width = ctx->pCodecCtx->width, height = ctx->pCodecCtx->height;
@@ -331,7 +331,7 @@
 	int frameFinished;
 #endif

-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 	const auto width = ctx->pCodecPars->width, height = ctx->pCodecPars->height;
 #else
 	const auto width = ctx->pCodecCtx->width, height = ctx->pCodecCtx->height;
@@ -347,7 +347,7 @@
 		}

 		// Decode video frame
-#if LIBAVFORMAT_VERSION_MAJOR >= 58
+#if LIBAVFORMAT_VERSION_MAJOR >= 57
 		int ret = avcodec_send_packet(ctx->pCodecCtx, &packet);
 		if (ret < 0)
 		{


Add version checks for previous libav commit

--- libs/hwdrivers/src/CFFMPEG_InputStream.cpp
+++ libs/hwdrivers/src/CFFMPEG_InputStream.cpp
@@ -226,15 +226,23 @@
     }

     // Determine required buffer size and allocate buffer
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 6, 0)
+    size_t numBytes=avpicture_get_size(
+#else
     size_t numBytes = av_image_get_buffer_size(
+#endif
 		m_grab_as_grayscale ?    // BGR vs. RGB for OpenCV
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,00,0)
-			AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,
-#else
-			PIX_FMT_GRAY8 : PIX_FMT_BGR24,
+		AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,
+#else
+		PIX_FMT_GRAY8 : PIX_FMT_BGR24,
 #endif
 		ctx->pCodecCtx->width,
-		ctx->pCodecCtx->height, 1);
+		ctx->pCodecCtx->height
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 6, 0)
+		, 1
+#endif
+		);

     ctx->buffer.resize(numBytes);

@@ -264,9 +272,9 @@
 void CFFMPEG_InputStream::close()
 {
 #if MRPT_HAS_FFMPEG
-	if (!this->isOpen()) return;
-
-	TFFMPEGContext *ctx = MY_FFMPEG_STATE;
+    if (!this->isOpen()) return;
+
+    TFFMPEGContext *ctx = MY_FFMPEG_STATE;

     // Close the codec
     if (ctx->pCodecCtx)
@@ -308,11 +316,11 @@
 		ctx->pFrame = nullptr;
     }

-	if (ctx->img_convert_ctx)
-	{
-		sws_freeContext( ctx->img_convert_ctx );
-		ctx->img_convert_ctx = nullptr;
-	}
+    if (ctx->img_convert_ctx)
+    {
+        sws_freeContext( ctx->img_convert_ctx );
+        ctx->img_convert_ctx = nullptr;
+    }

 #endif
 }
@@ -323,9 +331,9 @@
 bool CFFMPEG_InputStream::retrieveFrame( mrpt::utils::CImage &out_img )
 {
 #if MRPT_HAS_FFMPEG
-	if (!this->isOpen()) return false;
-
-	TFFMPEGContext *ctx = MY_FFMPEG_STATE;
+    if (!this->isOpen()) return false;
+
+    TFFMPEGContext *ctx = MY_FFMPEG_STATE;

     AVPacket        packet;
     int             frameFinished;
@@ -341,14 +349,14 @@
 				ctx->pCodecCtx,
 				ctx->pFrame,
 				&frameFinished,
-                &packet);
+				&packet);
 #else
             avcodec_decode_video(
 				ctx->pCodecCtx,
 				ctx->pFrame,
 				&frameFinished,
-                packet.data,
-                packet.size);
+				packet.data,
+				packet.size);
 #endif
             // Did we get a video frame?
             if(frameFinished)
@@ -392,13 +400,21 @@
 					);

 				// Free the packet that was allocated by av_read_frame
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 16, 0)
+				av_free_packet(&packet);
+#else
 				av_packet_unref(&packet);
+#endif
 				return true;
             }
         }

         // Free the packet that was allocated by av_read_frame
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 16, 0)
+        av_free_packet(&packet);
+#else
         av_packet_unref(&packet);
+#endif
     }

 	return false; // Error reading/ EOF


Fixed some tabs

Fixed some tabs

git-svn-id: 03d7800a49d8905ef4fbcc296184319e19243493@1132211 13f79535-47bb-0310-9956-ffa450edef68

--- include/mesos_sched.hpp
+++ include/mesos_sched.hpp
@@ -85,8 +85,8 @@
   virtual int killTask(const TaskID& taskId) = 0;

   virtual int replyToOffer(const OfferID& offerId,
-			   const std::vector<TaskDescription>& tasks,
-			   const std::map<std::string, std::string>& params) = 0;
+                           const std::vector<TaskDescription>& tasks,
+                           const std::map<std::string, std::string>& params) = 0;

   virtual int replyToOffer(const OfferID& offerId,
                            const std::vector<TaskDescription>& tasks)
@@ -132,7 +132,7 @@
    */
   MesosSchedulerDriver(Scheduler* sched,
                        const std::map<std::string, std::string>& params,
-		       const FrameworkID& frameworkId = FrameworkID());
+                       const FrameworkID& frameworkId = FrameworkID());

 #ifndef SWIG
   /**
@@ -151,9 +151,9 @@
    *        redundant schedulers for the same framework
    */
   MesosSchedulerDriver(Scheduler* sched,
-		       int argc,
+                       int argc,
                        char** argv,
-		       const FrameworkID& frameworkId = FrameworkID());
+                       const FrameworkID& frameworkId = FrameworkID());
 #endif

   virtual ~MesosSchedulerDriver();
@@ -170,8 +170,8 @@
   virtual int killTask(const TaskID& taskId);

   virtual int replyToOffer(const OfferID& offerId,
-			   const std::vector<TaskDescription>& tasks,
-			   const std::map<std::string, std::string>& params);
+                           const std::vector<TaskDescription>& tasks,
+                           const std::map<std::string, std::string>& params);

   virtual int replyToOffer(const OfferID& offerId,
                            const std::vector<TaskDescription>& tasks)


Bugfix for flagging on a non-contiguous mesh

--- libmesh/src/mesh/mesh_refinement_flagging.C
+++ libmesh/src/mesh/mesh_refinement_flagging.C
@@ -279,7 +279,7 @@

   // Create an vector with active element errors and ids,
   // sorted by highest errors first
-  const unsigned int n_elem = _mesh.n_elem();
+  const unsigned int max_elem_id = _mesh.max_elem_id();
   std::vector<std::pair<float, unsigned int> > sorted_error;

   sorted_error.reserve (n_active_elem);
@@ -287,7 +287,7 @@
   // On a ParallelMesh, we need to communicate to know which remote ids
   // correspond to active elements.
   {
-    std::vector<bool> is_active(n_elem, false);
+    std::vector<bool> is_active(max_elem_id, false);

     MeshBase::element_iterator       elem_it  = _mesh.active_local_elements_begin();
     const MeshBase::element_iterator elem_end = _mesh.active_local_elements_end();
@@ -371,7 +371,7 @@
   // correspond to refinable elements
   unsigned int successful_refine_count = 0;
   {
-    std::vector<bool> is_refinable(n_elem, false);
+    std::vector<bool> is_refinable(max_elem_id, false);

     for (unsigned int i=0; i != sorted_error.size(); ++i)
       {


Fix #170

Fix #170

--- include/ocilib_impl.hpp
+++ include/ocilib_impl.hpp
@@ -3045,9 +3045,16 @@

     if (content.size() > 0)
     {
-        res = Check(OCI_LobWrite(*this, static_cast<AnyPointer>(const_cast<typename T::value_type *>(&content[0])), static_cast<unsigned int>(content.size())));
-    }
-
+        unsigned int charCount = 0;
+        unsigned int byteCount = static_cast<unsigned int>(content.size());
+        AnyPointer buffer = static_cast<AnyPointer>(const_cast<typename T::value_type *>(&content[0]));
+
+        if (Check(OCI_LobWrite2(*this, buffer, &charCount, &byteCount)))
+        {
+            res = U == OCI_BLOB ? byteCount : charCount;
+        }
+    }
+
     return res;
 }


Firebird: Use explicit integer sizes.

Firebird: Use explicit integer sizes.

Change-Id: I5cabe21a2d675773792f9c9d5130d8660718efe8

--- connectivity/source/drivers/firebird/Util.cxx
+++ connectivity/source/drivers/firebird/Util.cxx
@@ -201,10 +201,10 @@
             pVar->sqldata = (char *)malloc(sizeof(char)*pVar->sqllen + 2);
             break;
         case SQL_SHORT:
-            pVar->sqldata = (char *)malloc(sizeof(short));
+            pVar->sqldata = (char*) malloc(sizeof(sal_Int16));
             break;
         case SQL_LONG:
-            pVar->sqldata = (char *)malloc(sizeof(long));
+            pVar->sqldata = (char*) malloc(sizeof(sal_Int32));
             break;
         case SQL_FLOAT:
             pVar->sqldata = (char *)malloc(sizeof(float));


Minor tweaks to better match downstream

Minor tweaks to better match downstream

--- libraries/blockchain/balance_operations.cpp
+++ libraries/blockchain/balance_operations.cpp
@@ -142,11 +142,11 @@

        cur_record->last_update = eval_state._current_state->now();

-       auto asset_rec = eval_state._current_state->get_asset_record( cur_record->condition.asset_id );
+       const oasset_record asset_rec = eval_state._current_state->get_asset_record( cur_record->condition.asset_id );
+       FC_ASSERT( asset_rec.valid() );

        if( asset_rec->is_market_issued() ) FC_ASSERT( cur_record->condition.slate_id == 0 );

-       FC_ASSERT( asset_rec.valid() );
        if( asset_rec->is_restricted() )
        {
          for( const auto& owner : cur_record->owners() )
@@ -448,7 +448,6 @@
       eval_state._current_state->store_balance_record( *escrow_balance_record );
    } FC_CAPTURE_AND_RETHROW( (*this) ) }

-
    void update_balance_vote_operation::evaluate( transaction_evaluation_state& eval_state )
    { try {
       auto current_balance_record = eval_state._current_state->get_balance_record( this->balance_id );
@@ -557,10 +556,9 @@

    } FC_CAPTURE_AND_RETHROW( (*this) ) }

-
    void pay_fee_operation::evaluate( transaction_evaluation_state& eval_state )
-   {
+   { try {
       eval_state._max_fee[this->amount.asset_id] += this->amount.amount;
-   }
+   } FC_CAPTURE_AND_RETHROW( (*this) ) }

 } } // bts::blockchain


INTEGRATION: CWS dba24 (1.5.32); FILE MERGED 2005/02/09 08:07:47 oj 1.5.32.1: #i26950# remove the need for XNamed

--- connectivity/source/drivers/mysql/YTables.cxx
+++ connectivity/source/drivers/mysql/YTables.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: YTables.cxx,v $
  *
- *  $Revision: 1.5 $
- *
- *  last change: $Author: rt $ $Date: 2004-10-22 08:44:24 $
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: vg $ $Date: 2005-03-10 15:31:32 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -109,7 +109,7 @@
 #endif

 using namespace ::comphelper;
-
+using namespace connectivity;
 using namespace ::cppu;
 using namespace connectivity::mysql;
 using namespace ::com::sun::star::uno;
@@ -121,7 +121,7 @@
 using namespace dbtools;
 typedef connectivity::sdbcx::OCollection OCollection_TYPE;

-Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
+sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
 {
     ::rtl::OUString sCatalog,sSchema,sTable;
     ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
@@ -140,7 +140,7 @@
         aCatalog <<= sCatalog;
     Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);

-    Reference< XNamed > xRet = NULL;
+    sdbcx::ObjectType xRet = NULL;
     if ( xResult.is() )
     {
         Reference< XRow > xRow(xResult,UNO_QUERY);
@@ -199,13 +199,6 @@
 {
     return new OMySQLTable(this,static_cast<OMySQLCatalog&>(m_rParent).getConnection());
 }
-// -----------------------------------------------------------------------------
-Reference< XNamed > OTables::cloneObject(const Reference< XPropertySet >& _xDescriptor)
-{
-    Reference< XNamed > xName(_xDescriptor,UNO_QUERY);
-    OSL_ENSURE(xName.is(),"Must be a XName interface here !");
-    return xName.is() ? createObject(xName->getName()) : Reference< XNamed >();
-}
 // -------------------------------------------------------------------------
 // XAppend
 void OTables::appendObject( const Reference< XPropertySet >& descriptor )
@@ -288,4 +281,10 @@
         static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
 }
 // -----------------------------------------------------------------------------
-
+::rtl::OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
+{
+    OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
+    return ::dbtools::composeTableName(m_xMetaData,_xObject,sal_False,::dbtools::eInDataManipulation);
+}
+// -----------------------------------------------------------------------------
+


Warning fixed

Warning fixed

--- include/pool_buffer.hpp
+++ include/pool_buffer.hpp
@@ -12,6 +12,7 @@

 #include <atomic>
 #include <cassert>
+#include <cstddef>
 #include <algorithm>

 namespace lfds
@@ -27,10 +28,7 @@

     static this_type* recover(T* p)
     {
-        static constexpr int offset =
-                reinterpret_cast<char*>(&reinterpret_cast<this_type*>(0)->m_data)
-                        - reinterpret_cast<char*>(0);
-
+        static constexpr int offset = offsetof(this_type, m_data);
         return reinterpret_cast<this_type*>(reinterpret_cast<char*>(p) - offset);
     }
 };


Adjust window rank comment

Adjust window rank comment

--- include/rank_filter.hxx
+++ include/rank_filter.hxx
@@ -59,7 +59,7 @@
     // The position of the window.
     I_diff_t window_begin = 0;

-    // Find window offset corresponding to this rank.
+    // Window position corresponding to this rank.
     const I_diff_t rank_pos = static_cast<I_diff_t>(boost::math::round(rank * (2 * half_length)));
     typename multiset::iterator rank_point;


Src: fix a Clang warning

Src: fix a Clang warning

Fix a warning by removing a superfluous semicolon.

--- include/scope_guard.hpp
+++ include/scope_guard.hpp
@@ -33,7 +33,7 @@
 	{
 		typedef std::function<void(void)> FunT;

-		ScopeGuard(FunT f) : f_(f) {};
+		ScopeGuard(FunT f) : f_(f) {}
 		~ScopeGuard() { f_(); }

 		FunT f_;


These function members does not need to be virtual

Change-Id: I8ec3f297fbf9ff494d115d0400e890d568bdae7f


refactor(bspwm): Use defined socket path for ipc connections

--- include/utils/bspwm.hpp
+++ include/utils/bspwm.hpp
@@ -11,7 +11,7 @@

 namespace bspwm_util {
   struct payload;
-  using subscriber_t = unique_ptr<socket_util::unix_connection>;
+  using connection_t = unique_ptr<socket_util::unix_connection>;
   using payload_t = unique_ptr<payload>;

   /**
@@ -30,23 +30,22 @@
    * 3. Value of the macro BSPWM_SOCKET_PATH
    */
   string get_socket_path() {
-    string env_path{read_env("BSPWM_SOCKET")};
-    if (!env_path.empty())
+    string env_path;
+
+    if ((env_path = read_env("BSPWM_SOCKET")).empty() == false)
       return env_path;

     struct sockaddr_un sa;
-    char* tpl_path = nullptr;
     char* host = nullptr;
     int dsp = 0;
     int scr = 0;

-    if (xcb_parse_display(nullptr, &host, &dsp, &scr) != 0)
-      std::snprintf(tpl_path, sizeof(sa.sun_path), "/tmp/bspwm%s_%i_%i-socket", host, dsp, scr);
+    if (xcb_parse_display(nullptr, &host, &dsp, &scr) == 0)
+      return BSPWM_SOCKET_PATH;

-    if (tpl_path != nullptr)
-      return tpl_path;
+    snprintf(sa.sun_path, sizeof(sa.sun_path), "/tmp/bspwm%s_%i_%i-socket", host, dsp, scr);

-    return BSPWM_SOCKET_PATH;
+    return sa.sun_path;
   }

   /**
@@ -69,6 +68,19 @@
   }

   /**
+   * Create an ipc socket connection
+   *
+   * Example usage:
+   * @code cpp
+   *   auto ipc = bspwm_util::make_connection();
+   *   ipc->send(bspwm_util::make_payload("desktop -f eDP-1:^1"));
+   * @endcode
+   */
+  connection_t make_connection() {
+    return socket_util::make_unix_connection(get_socket_path());
+  }
+
+  /**
    * Create a connection and subscribe to events
    * on the bspwm socket
    *
@@ -83,8 +95,8 @@
    *   }
    * @endcode
    */
-  subscriber_t make_subscriber() {
-    auto conn = socket_util::make_unix_connection(BSPWM_SOCKET_PATH);
+  connection_t make_subscriber() {
+    auto conn = make_connection();
     auto payload = make_payload("subscribe report");
     if (conn->send(payload->data, payload->len, 0) == 0)
       throw system_error("Failed to initialize subscriber");


added TIFFNoLZWException

added TIFFNoLZWException

--- include/vigra/codec.hxx
+++ include/vigra/codec.hxx
@@ -94,6 +94,8 @@

         virtual void * currentScanlineOfBand( unsigned int ) = 0;
         virtual void nextScanline() = 0;
+
+        struct TIFFNoLZWException {};
     };

     // codec factory for registration at the codec manager


added support for import/export of images with arbitrary many bands

--- include/vigra/impex.hxx
+++ include/vigra/impex.hxx
@@ -44,6 +44,7 @@
 #include "vigra/inspectimage.hxx"
 #include "vigra/transformimage.hxx"
 #include "vigra/copyimage.hxx"
+#include "vigra/multi_array.hxx"

 // TODO
 // next refactoring: pluggable conversion algorithms
@@ -84,6 +85,9 @@
         const size_type width = dec->getWidth();
         const size_type height = dec->getHeight();
         const size_type num_bands = dec->getNumBands();
+
+        vigra_precondition(num_bands == a.size(ys),
+           "importImage(): number of bands (color channels) in file and destination image differ.");

         SrcValueType const * scanline;
         DstRowIterator xs;
@@ -367,7 +371,7 @@
         const size_type height = lr.y - ul.y;
         enc->setWidth(width);
         enc->setHeight(height);
-        const size_type num_bands = a(ul).size();
+        const size_type num_bands = a.size(ul);
         enc->setNumBands(num_bands);
         enc->finalizeSettings();

@@ -390,6 +394,36 @@
         }
     } // write_bands()

+    template< class MArray, class DstValueType >
+    void write_bands( Encoder * enc, MArray const & array, DstValueType)
+    {
+        typedef unsigned int size_type;
+
+        // complete decoder settings
+        const size_type width = array.shape(0);
+        const size_type height = array.shape(1);
+        enc->setWidth(width);
+        enc->setHeight(height);
+        const size_type num_bands = array.shape(2);
+        enc->setNumBands(num_bands);
+        enc->finalizeSettings();
+
+        DstValueType * scanline;
+
+        // iterate
+        for( size_type y = 0; y < height; ++y ) {
+            for( size_type b = 0; b < num_bands; ++b ) {
+                scanline = static_cast< DstValueType * >
+                    (enc->currentScanlineOfBand(b));
+                for( size_type x = 0; x < width; ++x) {
+                    *scanline = array(x, y, b);
+                    scanline += enc->getOffset();
+                }
+            }
+            enc->nextScanline();
+        }
+    } // write_bands()
+
     /*!
       \brief used for writing bands after the source data type has been figured out.

@@ -463,15 +497,16 @@
     };

     template < class SrcIterator, class SrcAccessor,
-               class DestIterator, class DestAccessor >
+               class MArray>
     void mapVectorImageToByteImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
-                                    DestIterator dul, DestAccessor dget )
+                                    MArray & array )
     {
         typedef typename SrcAccessor::value_type SrcValue;
         typedef typename SrcValue::value_type SrcComponent;
         typedef typename NumericTraits<SrcValue>::RealPromote PromoteValue;
         typedef typename PromoteValue::value_type PromoteComponent;
         typedef detail::VectorComponentSelector<SrcAccessor> Selector;
+        typedef typename MArray::value_type DestValue;

         vigra::FindMinMax<SrcComponent> minmax;
         for(int i=0; i<sget.size(sul); ++i)
@@ -479,13 +514,12 @@
             vigra::inspectImage( sul, slr, Selector(sget, i), minmax );
         }
         const PromoteComponent scale = 255.0 / (minmax.max - minmax.min);
-        PromoteValue offset;
         for(int i=0; i<sget.size(sul); ++i)
         {
-            offset[i] = -minmax.min;
-        }
-        vigra::transformImage( sul, slr, sget, dul, dget,
-                               linearIntensityTransform( scale, offset ) );
+            vigra::BasicImageView<DestValue> subImage = makeBasicImageView(array.bindOuter(i));
+            vigra::transformImage( sul, slr, Selector(sget, i), subImage.upperLeft(), subImage.accessor(),
+                                   linearIntensityTransform( scale, -minmax.min ) );
+        }
     }

     template < class SrcIterator, class SrcAccessor,
@@ -504,6 +538,7 @@
                                linearIntensityTransform( scale, offset ) );
     }

+    // export scalar images with conversion (if necessary)
     template < class SrcIterator, class SrcAccessor, class T >
     void exportImageWithConversion(SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                    Encoder * enc, const char * type, T zero, VigraTrueType /* is_scalar */ )
@@ -521,20 +556,32 @@
         }
     }

+    // export vector images with conversion (if necessary)
     template < class SrcIterator, class SrcAccessor, class T >
     void exportImageWithConversion(SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                    Encoder * enc, const char * type, T zero, VigraFalseType /* is_scalar */ )
     {
-        if ( isPixelTypeSupported( enc->getFileType(), type ) ) {
+        int bands = sget.size(sul);
+        vigra_precondition(isBandNumberSupported(enc->getFileType(), bands),
+           "exportImage(): file format does not support requested number of bands (color channels)");
+        if ( isPixelTypeSupported( enc->getFileType(), type ) )
+        {
             enc->setPixelType( type );
             write_bands( enc, sul, slr, sget, zero );
-        } else {
+        }
+        else
+        {
             // convert to unsigned char in the usual way
+            int w = slr.x - sul.x;
+            int h = slr.y - sul.y;
+
+            typedef vigra::MultiArray<3, unsigned char> MArray;
+            MArray array(MArray::difference_type(w, h, bands));
+
+            mapVectorImageToByteImage(sul, slr, sget, array);
+
             enc->setPixelType( "UINT8" );
-            vigra::BRGBImage image(slr-sul);
-            mapVectorImageToByteImage(sul, slr, sget, image.upperLeft(), image.accessor());
-            write_bands( enc, image.upperLeft(),
-                         image.lowerRight(), image.accessor(), (unsigned char)0 );
+            write_bands( enc, array, (unsigned char)0 );
         }
     }


Start trying to get all the sections

Start trying to get all the sections

--- link-grammar/dict-atomese/lookup-atomese.cc
+++ link-grammar/dict-atomese/lookup-atomese.cc
@@ -311,25 +311,32 @@

 // ===============================================================

-#define INNER_LOOP                                                \
-	/* The connection target is the first Atom in the connector */ \
-	const Handle& tgt = ctcr->getOutgoingAtom(0);                  \
-	                                                               \
-	/* The link is the connection of both of these. */             \
-	const Handle& lnk = local->asp->add_link(SET_LINK, germ, tgt); \
-	                                                               \
-	/* Assign an upper-case name to the link. */                   \
-	std::string slnk = get_linkname(local, lnk);                   \
-	                                                               \
-	Exp* e = make_connector_node(dict, dict->Exp_pool,             \
-	                 slnk.c_str(), cdir, false);                   \
-	if (nullptr == andex) {                                        \
-		andex = e;                                                  \
-		continue;                                                   \
-	}                                                              \
-	andex = make_and_node(dict->Exp_pool, e, andex);
-
-static Exp* make_exprs(Dictionary dict, const Handle& germ)
+#define INNER_LOOP                                                   \
+   std::string slnk;                                                 \
+                                                                     \
+   /* The connection target is the first Atom in the connector */    \
+   const Handle& tgt = ctcr->getOutgoingAtom(0);                     \
+                                                                     \
+   /* If it and the germ are both words, we have to fake a link */   \
+   if (iswrd and WORD_NODE == tgt->get_type()) {                     \
+                                                                     \
+      /* The link is the connection of both of these. */             \
+      const Handle& lnk = local->asp->add_link(SET_LINK, germ, tgt); \
+                                                                     \
+      /* Assign an upper-case name to the link. */                   \
+      slnk = get_linkname(local, lnk);                               \
+   } else {                                                          \
+      slnk = get_linkname(local, tgt);                               \
+   }                                                                 \
+   Exp* e = make_connector_node(dict, dict->Exp_pool,                \
+                    slnk.c_str(), cdir, false);                      \
+   if (nullptr == andex) {                                           \
+      andex = e;                                                     \
+      continue;                                                      \
+   }                                                                 \
+   andex = make_and_node(dict->Exp_pool, e, andex);
+
+static Exp* make_exprs(Dictionary dict, const Handle& germ, bool iswrd)
 {
 	Local* local = (Local*) (dict->as_server);
 	Exp* exp = nullptr;
@@ -393,7 +400,19 @@
 	Handle wrd = local->asp->get_node(WORD_NODE, s);
 	if (nullptr == wrd) return nullptr;

-	Exp* exp = make_exprs(dict, wrd);
+	// Get expressions, where the word itself is the germ.
+	Exp* exp = make_exprs(dict, wrd, true);
+
+	// Get expressions, where the word is in some class.
+	for (const Handle& memb : wrd->getIncomingSetByType(MEMBER_LINK))
+	{
+		const Handle& wcl = memb->getOutgoingAtom(1);
+		if (WORD_CLASS_NODE != wcl->get_type()) continue;
+
+		Exp* exp = make_exprs(dict, wcl, false);
+printf("duuude as_lookup_list class for >>%s<< had=%d\n", ssc,
+size_of_expression(exp));
+	}

 	dn = (Dict_node*) malloc(sizeof(Dict_node));
 	memset(dn, 0, sizeof(Dict_node));


fix typo in check for existing patch

fix typo in check for existing patch

--- contrib/cmake/build3rdParty/build3rdParty.cpp
+++ contrib/cmake/build3rdParty/build3rdParty.cpp
@@ -360,7 +360,7 @@
         if (colonpos != string::npos)
         {
             fs::path patch = s.substr(colonpos + 1);
-            auto existingPatch = patches.find(patch.u8string());
+            auto existingPatch = patches.find(portname);
             if (existingPatch != patches.end() && existingPatch->second != patch)
             {
                 cout << "Conflicting patch files: " << patch << " and " << existingPatch->second << " for " << portname << "\n";


INTEGRATION: CWS ooo19126 (1.1.132); FILE MERGED 2005/09/05 13:09:27 rt 1.1.132.1: #i54170# Change license header: remove SISSL

--- autodoc/inc/ary/idl/ik_singleton.hxx
+++ autodoc/inc/ary/idl/ik_singleton.hxx
@@ -1,61 +1,35 @@
 /*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
  *
  *  $RCSfile: ik_singleton.hxx,v $
  *
- *  $Revision: 1.1 $
+ *  $Revision: 1.2 $
  *
- *  last change: $Author: np $ $Date: 2002-11-01 17:12:04 $
+ *  last change: $Author: rt $ $Date: 2005-09-07 16:17:13 $
  *
- *  The Contents of this file are made available subject to the terms of
- *  either of the following licenses
- *
- *         - GNU Lesser General Public License Version 2.1
- *         - Sun Industry Standards Source License Version 1.1
- *
- *  Sun Microsystems Inc., October, 2000
- *
- *  GNU Lesser General Public License Version 2.1
- *  =============================================
- *  Copyright 2000 by Sun Microsystems, Inc.
- *  901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *  MA  02111-1307  USA
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
  *
  *
- *  Sun Industry Standards Source License Version 1.1
- *  =================================================
- *  The contents of this file are subject to the Sun Industry Standards
- *  Source License Version 1.1 (the "License"); You may not use this file
- *  except in compliance with the License. You may obtain a copy of the
- *  License at http://www.openoffice.org/license.html.
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
  *
- *  Software provided under this License is provided on an "AS IS" basis,
- *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- *  See the License for the specific provisions governing your rights and
- *  obligations concerning the Software.
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
  *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
  *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
  *
  ************************************************************************/


Update controller_manager.cpp

Update controller_manager.cpp

--- controller_manager/src/controller_manager.cpp
+++ controller_manager/src/controller_manager.cpp
@@ -76,8 +76,7 @@
 void ControllerManager::update(const ros::Time& time, const ros::Duration& period, bool reset_controllers)
 {
   used_by_realtime_ = current_controllers_list_;
-  auto &controllers = controllers_lists_[used_by_realtime_];
-
+
   // Restart all running controllers if motors are re-enabled
   if (reset_controllers){
     for (const auto& controller : controllers_lists_[used_by_realtime_]){
@@ -390,7 +389,7 @@
     }
     std::this_thread::sleep_for(std::chrono::microseconds(200));
   }
-  auto
+  std::vector<ControllerSpec>::iterator
     &from = controllers_lists_[current_controllers_list_],
     &to = controllers_lists_[free_controllers_list];
   to.clear();
@@ -522,7 +521,7 @@
   switch_start_list_.clear();
   switch_stop_list_.clear();

-  auto &controllers = controllers_lists_[current_controllers_list_];
+  const auto &controllers = controllers_lists_[current_controllers_list_];
   for (const auto& controller : controllers)
   {
     bool in_stop_list  = false;


FlightTaskManual: sticks not to be finite activation method not needed

--- src/lib/FlightTasks/tasks/FlightTaskManual.cpp
+++ src/lib/FlightTasks/tasks/FlightTaskManual.cpp
@@ -65,21 +65,6 @@
 	return ret;
 }

-bool FlightTaskManual::activate()
-{
-	bool ret = FlightTask::activate();
-
-	if (_sticks_data_required) {
-		// need valid stick inputs
-		ret = ret && PX4_ISFINITE(_sticks(0))
-		      && PX4_ISFINITE(_sticks(1))
-		      && PX4_ISFINITE(_sticks(2))
-		      && PX4_ISFINITE(_sticks(3));
-	}
-
-	return ret;
-}
-
 bool FlightTaskManual::_evaluateSticks()
 {
 	/* Sticks are rescaled linearly and exponentially to [-1,1] */
@@ -111,7 +96,13 @@
 			_applyGearSwitch(gear_switch);
 		}

-		return true;
+		// valid stick inputs are required
+		const bool valid_sticks =  PX4_ISFINITE(_sticks(0))
+					   && PX4_ISFINITE(_sticks(1))
+					   && PX4_ISFINITE(_sticks(2))
+					   && PX4_ISFINITE(_sticks(3));
+
+		return valid_sticks;

 	} else {
 		/* Timeout: set all sticks to zero */


Fix  typo - all bond lengths were 9 Å...

Fix  typo - all bond lengths were 9 Å...

Signed-off-by: Geoff Hutchison <9cf35bacc9f8512ca007341c9e919cf5dc03e0c7@gmail.com>

--- avogadro/qtplugins/editor/editor.cpp
+++ avogadro/qtplugins/editor/editor.cpp
@@ -221,7 +221,7 @@
   int labelWidth = -1 * distanceLabel.size();

   QString overlayText = tr("%1 %L2").arg(distanceLabel, labelWidth)
-                          .arg((tr("%L1 Å").arg(m_bondDistance, 9, 'f', 3), 9));
+                          .arg(tr("%L1 Å").arg(m_bondDistance, 9, 'f', 3), 9);

   TextProperties overlayTProp;
   overlayTProp.setFontFamily(TextProperties::Mono);


FlightTaskManual: remove #include px4_defines.h

--- src/lib/FlightTasks/tasks/FlightTaskManual.hpp
+++ src/lib/FlightTasks/tasks/FlightTaskManual.hpp
@@ -42,7 +42,6 @@

 #include "FlightTask.hpp"
 #include <uORB/topics/manual_control_setpoint.h>
-#include <platforms/px4_defines.h>

 class FlightTaskManual : public FlightTask
 {


Removed multi-threaded protection.

Removed multi-threaded protection.

--- src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -480,17 +480,6 @@
 #endif

     {
-
-		ID3D10Multithread* pMultithread;
-		HRESULT hr = ((mDevice)->QueryInterface(IID_PPV_ARGS(&pMultithread)));
-
-		if (SUCCEEDED(hr))
-		{
-			pMultithread->SetMultithreadProtected(TRUE);
-		}
-
-		SafeRelease(pMultithread);
-
         TRACE_EVENT0("gpu.angle", "Renderer11::initialize (ComQueries)");
         // Cast the DeviceContext to a DeviceContext1.
         // This could fail on Windows 7 without the Platform Update.


move matrix_flag check back to eval time

--- src/libprojectM/MilkdropPresetFactory/Expr.cpp
+++ src/libprojectM/MilkdropPresetFactory/Expr.cpp
@@ -104,7 +104,7 @@
 	Term term;
 public:
 	ParameterExpr( int _type, Term *_term ) : Expr(PARAMETER), term(*_term) {}
-	float eval(int mesh_i, int mesh_j );
+	float eval(int mesh_i, int mesh_j ) = 0;
 	std::ostream& to_string(std::ostream& out)
 	{
 		out << term.param->name;
@@ -116,56 +116,57 @@
 {
 public:
 	BoolParameterExpr( int _type, Term *_term ) : ParameterExpr(_type,_term) {}
-	float eval ( int mesh_i, int mesh_j ) { return ( float ) ( * ( ( bool* ) ( term.param->engine_val ) ) ); }
+	float eval ( int mesh_i, int mesh_j )
+	{
+		assert( term.param->type == P_TYPE_BOOL );
+		return ( float ) ( * ( ( bool* ) ( term.param->engine_val ) ) );
+	}
 };
 class IntParameterExpr : public ParameterExpr
 {
 public:
 	IntParameterExpr( int _type, Term *_term ) : ParameterExpr(_type,_term) {}
-	float eval ( int mesh_i, int mesh_j ) { return ( float ) ( * ( ( int* ) ( term.param->engine_val ) ) ); }
+	float eval ( int mesh_i, int mesh_j )
+	{
+		assert( term.param->type == P_TYPE_INT );
+		return ( float ) ( * ( ( int* ) ( term.param->engine_val ) ) );
+	}
 };
 class FloatParameterExpr : public ParameterExpr
 {
 public:
 	FloatParameterExpr( int _type, Term *_term ) : ParameterExpr(_type,_term) {}
-	float eval ( int mesh_i, int mesh_j ) { return ( * ( ( float* ) ( term.param->engine_val ) ) ); }
-};
-
-/* Evaluates a value expression */
-float ParameterExpr::eval ( int mesh_i, int mesh_j )
-{
-	switch ( term.param->type )
-	{
-		case P_TYPE_BOOL:
-			return ( float ) ( * ( ( bool* ) ( term.param->engine_val ) ) );
-		case P_TYPE_INT:
-			return ( float ) ( * ( ( int* ) ( term.param->engine_val ) ) );
-		case P_TYPE_DOUBLE:
-			if ( term.param->matrix_flag | ( term.param->flags & P_FLAG_ALWAYS_MATRIX ) )
+	float eval ( int mesh_i, int mesh_j );
+};
+/* TODO optimize FloatParameterExpr::eval() further.
+//  - flag "never matrix" parameters
+//  - always pass in 2d matrix. instead of using  (i, -1) for 1d matrix, we could just use (0, i) and avoid check
+//  - instead of using matrix_flag to give "copy on write" behavior, maybe pre-copy from engine_val to matrix[]
+*/
+float FloatParameterExpr::eval ( int mesh_i, int mesh_j )
+{
+	assert( term.param->type == P_TYPE_DOUBLE );
+	if ( term.param->matrix_flag | ( term.param->flags & P_FLAG_ALWAYS_MATRIX ) )
+	{
+		/* Sanity check the matrix is there... */
+		assert ( term.param->matrix != NULL );
+
+		/// @slow boolean check could be expensive in this critical (and common) step of evaluation
+		if ( mesh_i >= 0 )
+		{
+			if ( mesh_j >= 0 )
 			{
-
-				/* Sanity check the matrix is there... */
-				assert ( term.param->matrix != NULL );
-
-				/// @slow boolean check could be expensive in this critical (and common) step of evaluation
-				if ( mesh_i >= 0 )
-				{
-					if ( mesh_j >= 0 )
-					{
-						return ( ( ( float** ) term.param->matrix ) [mesh_i][mesh_j] );
-					}
-					else
-					{
-						return ( ( ( float* ) term.param->matrix ) [mesh_i] );
-					}
-				}
-				//assert(mesh_i >=0);
+				return ( ( ( float** ) term.param->matrix ) [mesh_i][mesh_j] );
 			}
-			//std::cout << term.param->name << ": " << (*((float*)term.param->engine_val)) << std::endl;
-			return * ( ( float* ) ( term.param->engine_val ) );
-		default:
-			return EVAL_ERROR;
-	}
+			else
+			{
+				return ( ( ( float* ) term.param->matrix ) [mesh_i] );
+			}
+		}
+		//assert(mesh_i >=0);
+	}
+	//std::cout << term.param->name << ": " << (*((float*)term.param->engine_val)) << std::endl;
+	return * ( ( float* ) ( term.param->engine_val ) );
 }

@@ -375,9 +376,6 @@
 		case P_TYPE_INT:
 			return new IntParameterExpr( PARAM_TERM_T, &term );
 		case P_TYPE_DOUBLE:
-			// TODO are these flags constant??? can I check them now?
-			if ( param->matrix_flag | ( param->flags & P_FLAG_ALWAYS_MATRIX ) )
-				return new ParameterExpr( PARAM_TERM_T, &term );
 			return new FloatParameterExpr( PARAM_TERM_T, &term );
 	}
 	return NULL;


[mechanics proposed] Add a couple of collision configuration options for contact points.

--- mechanics/src/proposed/BulletBroadphase.cpp
+++ mechanics/src/proposed/BulletBroadphase.cpp
@@ -148,6 +148,10 @@
   impl.reset(new BulletBroadphase_impl());
   impl->_collisionConfiguration.reset(
     new btDefaultCollisionConfiguration());
+
+  impl->_collisionConfiguration->setConvexConvexMultipointIterations();
+  impl->_collisionConfiguration->setPlaneConvexMultipointIterations();
+
   impl->_dispatcher.reset(
     new btCollisionDispatcher(&*impl->_collisionConfiguration));


PS llvm: move creating arguments to buildFunction

The formal arguments are created only once.

Signed-off-by: Marek Chalupa <2ec68d8033ee11c75b31c3efa204dbc26c692ff1@fi.muni.cz>

--- src/llvm/analysis/PointsTo/PointerSubgraph.cpp
+++ src/llvm/analysis/PointsTo/PointerSubgraph.cpp
@@ -628,7 +628,7 @@
         PSNode *a = tryGetOperand(&*A);
         assert(a == nullptr || a == UNKNOWN_MEMORY);
 #endif
-        getOperand(&*A);
+        buildNode(&*A);
     }

     // add record to built graphs here, so that subsequent call of this function


fix code formatting

fix code formatting

--- CppImport/src/visitors/ExpressionVisitor.cpp
+++ CppImport/src/visitors/ExpressionVisitor.cpp
@@ -307,9 +307,7 @@
 		ooExprStack_.push(methodCallExpr);
 	}
 	else
-	{
 		TraverseStmt(newExpr->getInitializer());
-	}

 	if (!ooExprStack_.empty())
 		ooNewExpr->setNewType(ooExprStack_.pop());


porting to MacOS

porting to MacOS

--- spserver/spioutils.cpp
+++ spserver/spioutils.cpp
@@ -14,7 +14,8 @@

 void SP_IOUtils :: inetNtoa( in_addr * addr, char * ip, int size )
 {
-#if defined (linux) || defined (__sgi) || defined (__hpux) || defined (__FreeBSD__)
+#if defined (linux) || defined (__sgi) || defined (__hpux) \
+		|| defined (__FreeBSD__) || defined (__APPLE__)
 	const unsigned char *p = ( const unsigned char *) addr;
 	snprintf( ip, size, "%i.%i.%i.%i", p[0], p[1], p[2], p[3] );
 #else


[sample_encode] Add missing checks in command line parser

--- samples/sample_encode/src/sample_encode.cpp
+++ samples/sample_encode/src/sample_encode.cpp
@@ -511,6 +511,7 @@
         }
         else if (0 == msdk_strcmp(strInput[i], MSDK_STRING("-idr_interval")))
         {
+            VAL_CHECK(i + 1 >= nArgNum, i, strInput[i]);
             if (MFX_ERR_NONE != msdk_opt_read(strInput[++i], pParams->nIdrInterval))
             {
                 PrintHelp(strInput[0], MSDK_STRING("IdrInterval is invalid"));
@@ -1210,6 +1211,7 @@
         }
         else if (0 == msdk_strcmp(strInput[i], MSDK_STRING("-p")))
         {
+            VAL_CHECK(i + 1 >= nArgNum, i, strInput[i]);
             pParams->pluginParams = ParsePluginGuid(strInput[++i]);
             if (AreGuidsEqual(pParams->pluginParams.pluginGuid, MSDK_PLUGINGUID_NULL))
             {
@@ -1233,6 +1235,7 @@
         }
         else if (0 == msdk_strcmp(strInput[i], MSDK_STRING("-path")))
         {
+            VAL_CHECK(i + 1 >= nArgNum, i, strInput[i]);
             i++;
             pParams->pluginParams = ParsePluginPath(strInput[i]);
         }


Fix an unused variable warning.

Fix an unused variable warning.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@367643 91177308-0d34-0410-b5e6-96231b3b80d8

--- COFF/SymbolTable.cpp
+++ COFF/SymbolTable.cpp
@@ -326,7 +326,7 @@
     auto *undef = dyn_cast<Undefined>(sym);
     if (!undef)
       continue;
-    if (Defined *d = undef->getWeakAlias())
+    if (undef->getWeakAlias())
       continue;
     StringRef name = undef->getName();
     if (name.startswith("__imp_")) {


COFF: Do not call std::async with std::launch::async if multithreading is disabled.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@248193 91177308-0d34-0410-b5e6-96231b3b80d8

--- COFF/SymbolTable.cpp
+++ COFF/SymbolTable.cpp
@@ -24,15 +24,21 @@
 namespace coff {

 void SymbolTable::addFile(std::unique_ptr<InputFile> FileP) {
+#if LLVM_ENABLE_THREADS
+  std::launch Policy = std::launch::async;
+#else
+  std::launch Policy = std::launch::deferred;
+#endif
+
   InputFile *File = FileP.get();
   Files.push_back(std::move(FileP));
   if (auto *F = dyn_cast<ArchiveFile>(File)) {
     ArchiveQueue.push_back(
-        std::async(std::launch::async, [=]() { F->parse(); return F; }));
+        std::async(Policy, [=]() { F->parse(); return F; }));
     return;
   }
   ObjectQueue.push_back(
-      std::async(std::launch::async, [=]() { File->parse(); return File; }));
+      std::async(Policy, [=]() { File->parse(); return File; }));
   if (auto *F = dyn_cast<ObjectFile>(File)) {
     ObjectFiles.push_back(F);
   } else if (auto *F = dyn_cast<BitcodeFile>(File)) {