modified CanReadFile to match ImageReader2 return values

--- IO/vtkXMLReader.cxx
+++ IO/vtkXMLReader.cxx
@@ -31,7 +31,7 @@

 #include <sys/stat.h>

-vtkCxxRevisionMacro(vtkXMLReader, "1.6");
+vtkCxxRevisionMacro(vtkXMLReader, "1.7");

 //----------------------------------------------------------------------------
 vtkXMLReader::vtkXMLReader()
@@ -382,7 +382,10 @@
   // First make sure the file exists.  This prevents an empty file
   // from being created on older compilers.
   struct stat fs;
-  if(stat(name, &fs) != 0) { return 0; }
+  if(stat(name, &fs) != 0)
+    {
+    return 0;
+    }

   // Test if the file with the given name is a VTKFile with the given
   // type.
@@ -399,12 +402,12 @@
         {
         if(this->CanReadFileVersionString(version))
           {
-          result = 1;
+          result = 3;
           }
         }
       else
         {
-        result = 1;
+        result = 3;
         }
       }
     }


Geodude collision fixed

Geodude collision fixed

--- Motor2D/Geodude.cpp
+++ Motor2D/Geodude.cpp
@@ -431,6 +431,7 @@
 			hp--;
 		}

+		if (c1 == collision_feet && c2->type == COLLIDER_PLAYER && c1->callback->state != HIT)
 		{
 			state == ATTACKING;
 			animation.anim[state].ResetAnimations();


Implemented new method to create pokecombats

--- Motor2D/j1Scene.cpp
+++ Motor2D/j1Scene.cpp
@@ -168,30 +168,30 @@
 			{
 				useTP = true;
 				switch_map = 3;
-			}
+			}*/

 			if (App->input->GetKey(SDL_SCANCODE_4) == KEY_DOWN)
-			{
-				useTP = true;
-				switch_map = 4;
-			}
-
-			if (App->input->GetKey(SDL_SCANCODE_5) == KEY_DOWN)
-			{
-				useTP = true;
-				switch_map = 5;
-			}
-
-			if (App->input->GetKey(SDL_SCANCODE_7) == KEY_DOWN)
 			{
 				useTP = true;
 				switch_map = 7;
-			}*/
+			}
+
+			if (App->input->GetKey(SDL_SCANCODE_5) == KEY_DOWN)
+			{
+				useTP = true;
+				switch_map = 19;
+			}
+
+			if (App->input->GetKey(SDL_SCANCODE_7) == KEY_DOWN)
+			{
+				useTP = true;
+				switch_map = 20;
+			}

 			if (App->input->GetKey(SDL_SCANCODE_9) == KEY_DOWN)
 			{
 				useTP = true;
-				switch_map = 9;
+				switch_map = 21;
 			}
 			// --------------------------------------------------------

@@ -615,9 +615,10 @@

 			if (poketrainer != nullptr)
 			{
-				PokemonCombat* poke = poketrainer->GetPokemon();
+				poketrainer = nullptr;
+				/*PokemonCombat* poke = poketrainer->GetPokemon();
 				delete poke;
-				poke = nullptr;
+				poke = nullptr;*/
 			}

 			if (switch_map < FIRST_LEVEL_COMBAT) //id 17 is the first combat map
@@ -702,12 +703,6 @@
 			//map
 			std::string name_map = temp.attribute("file").as_string("");
 			App->map->Load(name_map.c_str(), n);
-
-			/*//Trainers
-			if (temp.child("trainer"))
-			{
-				poketrainer = App->entity_elements->CreateTrainer(temp.child("trainer"), 1);
-			}*/

 			//items
 			pugi::xml_node temp_item = temp.child("items").child("item");
@@ -822,15 +817,26 @@
 	{
 		if (temp.attribute("n").as_int(0) == n)
 		{
-			//Pokemon Link
-
-
 			//trainer
 			poketrainer = App->combatmanager->CreateTrainer(temp.child("trainer"), 1);

+			//Pokemon Link
+			if (App->scene->poke_hud->GetPokeOrder(0) == "pk_bar_blaziken")
+			{
+				App->combatmanager->PrepareToCombat(player->pokedex.begin()._Ptr->_Myval);
+			}
+			else if (App->scene->poke_hud->GetPokeOrder(0) == "pk_bar_sceptile")
+			{
+				App->combatmanager->PrepareToCombat(player->pokedex.begin()._Ptr->_Next->_Myval);
+			}
+			else
+			{
+				App->combatmanager->PrepareToCombat(player->pokedex.begin()._Ptr->_Next->_Next->_Myval);
+			}
+
 			if (pokecombat == nullptr)
 			{
-				pokecombat = App->gui->CreatePokemonCombatHud(player->pokedex.begin()._Ptr->_Myval, poketrainer->GetPokemon()); //TODO ELliot no need GetPokemon()
+				pokecombat = App->gui->CreatePokemonCombatHud(App->combatmanager->pokemon_active_link, poketrainer->GetPokemon()); //TODO ELliot no need GetPokemon()
 				pokecombat->Move(true, win_marge);
 			}
 			else
@@ -842,11 +848,6 @@
 			//map
 			std::string name_map = temp.attribute("file").as_string("");
 			App->map->Load(name_map.c_str(), n);
-			//Edit
-			App->map->EditCost(18, 17, 0);
-			App->map->EditCost(19, 17, 0);
-			App->map->EditCost(18, 18, 0);
-			App->map->EditCost(19, 18, 0);

 			//Load UI (?)
 			stop_rearch = true;


AddressSpaceInfoManager: use cast instead of dyn_cast where appropriate; use more accurate return types in get*-functions

--- ClampPointers.cpp
+++ ClampPointers.cpp
@@ -909,19 +909,36 @@
       }
       GetElementPtrInst* getConstantLimitsField(IRBuilder<> &blockBuilder, Value* paa) const {
         LLVMContext& c = M.getContext();
-        return dyn_cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 0)));
+        return cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 0)));
       }
       GetElementPtrInst* getGlobalLimitsField(IRBuilder<> &blockBuilder, Value* paa) const {
         LLVMContext& c = M.getContext();
-        return dyn_cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 1)));
+        return cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 1)));
       }
       GetElementPtrInst* getLocalLimitsField(IRBuilder<> &blockBuilder, Value* paa) const {
         LLVMContext& c = M.getContext();
-        return dyn_cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 2)));
+        return cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 2)));
       }
       GetElementPtrInst* getPrivateAllocationsField(IRBuilder<> &blockBuilder, Value* paa) const {
         LLVMContext& c = M.getContext();
-        return dyn_cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 3)));
+        return cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 3)));
+      }
+      GetElementPtrInst* getPrivateAllocationsField(IRBuilder<> &blockBuilder, Value* paa, int n) const {
+        LLVMContext& c = M.getContext();
+        return cast<GetElementPtrInst>(blockBuilder.CreateGEP(paa, genIntVector<Value*>(c, 0, 3, n)));
+      }
+      ConstantExpr* getConstantAllocationsField(IRBuilder<> &blockBuilder, int n) {
+        LLVMContext& c = M.getContext();
+        GlobalVariable* root = getConstantAllocations();
+        Value* v = blockBuilder.CreateGEP(root, genIntVector<Value*>(c, 0, n));
+        DUMP(*v);
+        DUMP(v->getValueID());
+        return cast<ConstantExpr>(v);
+      }
+      ConstantExpr* getLocalAllocationsField(IRBuilder<> &blockBuilder, int n) {
+        LLVMContext& c = M.getContext();
+        GlobalVariable* root = getLocalAllocations();
+        return cast<ConstantExpr>(blockBuilder.CreateGEP(root, genIntVector<Value*>(c, 0, n)));
       }
       Value* generateProgramAllocationCode(IRBuilder<> &blockBuilder) {
         fixed = true;


connect(), don't bind(), duh

connect(), don't bind(), duh

--- src/zippylog/device/store_writer_sender.cpp
+++ src/zippylog/device/store_writer_sender.cpp
@@ -42,12 +42,12 @@

     if (this->envelope_pull_endpoint.length()) {
         this->envelope_pull_sock = new ::zmq::socket_t(*this->ctx, ZMQ_PUSH);
-        this->envelope_pull_sock->bind(this->envelope_pull_endpoint.c_str());
+        this->envelope_pull_sock->connect(this->envelope_pull_endpoint.c_str());
     }

     if (this->envelope_rep_endpoint.length()) {
         this->envelope_rep_sock = new ::zmq::socket_t(*this->ctx, ZMQ_REQ);
-        this->envelope_rep_sock->bind(this->envelope_rep_endpoint.c_str());
+        this->envelope_rep_sock->connect(this->envelope_rep_endpoint.c_str());
     }
 }


Removed some old code and wrote dummy API for AreaLimitManager

--- ClampPointers.cpp
+++ ClampPointers.cpp
@@ -746,7 +746,8 @@
              it != initData.end();
              ++it, ++idx) {
           if (GlobalVariable* global = dyn_cast<GlobalVariable>(*it)) {
-            global->eraseFromParent();
+            // TODO: make sure this is freed after pass terminates
+            // global->removeFromParent();
           }
         }
       }
@@ -837,22 +838,23 @@
       }

     };
-
+
     typedef std::set< AreaLimit* > AreaLimitSet;
     typedef std::map< unsigned, AreaLimitSet > AreaLimitSetByAddressSpaceMap;
     typedef std::map< Value*, AreaLimit* > AreaLimitByValueMap;
-
-    // contains all requred information to be able to allocate area for an
-    // address space structure and to fix references of values to struct fields
-    class AddressSpaceInfo {
+
+    // handles creating limits according to information found from address space info manager and dependency analyser
+    class AreaLimitManager {
+    public:
+
+      AreaLimitSet& getAreaLimits(Value* ptrOperand) {
+        return dummy;
+      }
+
+    private:
+      AreaLimitSet dummy;
     };
-
-    class GlobalScopeAddressSpace : public AddressSpaceInfo {
-    };
-
-    class FunctionScopeAddressSpace : public AddressSpaceInfo {
-    };
-
+
     // handles creating and bookkeeping address space info objects operations that require creating types must
     // be called after all information has been inserted. This is enforced by setting a 'fixed' flag upon such
     // operations, and if the flag is set, the object cannot be mutated.
@@ -1015,7 +1017,8 @@
                 assert(0);
               }
             }
-            global->eraseFromParent();
+            // TODO: make sure pbject is freed after pass terminates
+            global->removeFromParent();
           } else {
             assert(0);
           }
@@ -1272,15 +1275,11 @@

     class LimitAnalyser {
     private:
-      std::map< Value*, AreaLimitSet> limitsOfValue;
       InstrSet needChecks;
       // TODO: fix this map to be able to contain also location
       std::map< Value*, Value* > dependencies;

     public:
-      AreaLimitSet& getAreaLimitSet(Value *val) {
-        return limitsOfValue[val];
-      }

       InstrSet& needCheck() {
         return needChecks;
@@ -1309,13 +1308,6 @@
         return dependencies[value];
       }

-      AreaLimitSet& getLimits(Value *value) {
-        // TODO: after adding all information about address space, class can first
-        //       check if we can check against single limits of address space or to
-        //       use dependency data and find out which values limits to respect
-        return limitsOfValue[value];
-      }
-
       // TODO: ADD METHOD TO PRINT ALL ANALYSIS DATA

     };
@@ -1368,6 +1360,7 @@
       // of the new kernels.
       AddressSpaceInfoManager addressSpaceInfoManager(M);
       LimitAnalyser limitAnalyser;
+      AreaLimitManager areaLimitManager;

       DEBUG( dbgs() << "\n --------------- COLLECT INFORMATION OF STATIC MEMORY ALLOCATIONS --------------\n" );
       scanStaticMemory( M, addressSpaceInfoManager );
@@ -1479,14 +1472,6 @@
         createMainEntryPoint(M, functionManager.getReplacedFunctions(), addressSpaceInitializers, safeExceptions);
       }

-      /** TODO: THIS SHOULD HAVE BEEN ALREADY DONE IN ANALYZE PHASE FOR THE ORIGINAL PROGRAM OR INTERNALLY IN LIMIT ANALYSER
-      // Traces limits for all instructions and values in the module and adds them to `valueLimits`. After this we should be able
-      // to get min and max addresses for all instructions / globals that we are interested in. [findLimits(FunctionMap &replacedFunctions,
-      // ValueSet &checkOperands, AreaLimitByValueMap &valLimits, AreaLimitSetByAddressSpaceMap &asLimits)](#findLimits).
-      // Limit finding is not performed for manually written safe builtin functions.
-      DEBUG( dbgs() << "\n --------------- FIND LIMITS OF EVERY REQUIRED OPERAND --------------\n" );
-      findLimits(replacedFunctions, resolveLimitsOperands, valueLimits, addressSpaceLimits, safeBuiltinFunctions);
-      */

       // fix all old alloca and globals uses to point new variables (required to be able to get limits correctly for call replacement ?)
       DEBUG( dbgs() << "\n --------------- FIX REFRENCES OF OLD ALLOCAS AND GLOBALS TO POINT ADDRESS SPACE STRUCT FIELDS --------------\n" );
@@ -1516,7 +1501,7 @@
           fast_assert(false, "Can add check only for load or store");
         }
         // TODO: enable this soon....
-        // createLimitCheck(ptrOperand, limitAnalyser.getAreaLimitSet(ptrOperand), *inst);
+        createLimitCheck(ptrOperand, areaLimitManager.getAreaLimits(ptrOperand), *inst);
       }

       // Goes through all builtin WebCL calls and if they are unsafe (has pointer arguments), converts instruction to call safe
@@ -1528,11 +1513,9 @@

       // Helps to print out resulted LLVM IR code if pass fails before writing results
       // on pass output validation
-      /*
       dbgs() << "\n --------------- FINAL OUTPUT --------------\n";
       M.print(dbgs(), NULL);
       dbgs() << "\n --------------- FINAL OUTPUT END --------------\n";
-      */
       return true;
     }

@@ -2152,154 +2135,7 @@
         infoManager.addAddressSpace(addressSpace, globalScopeAdressSpaces.count(addressSpace) > 0, values, structInitData);
       }
     }
-        /*
-        // if global address space struct, create global variable
-        if (globalScopeAdressSpaces.count(addressSpace)) {
-
-
-          GlobalVariable *aSpaceStruct = new GlobalVariable
-            (M, addressSpaceStructType, false, GlobalValue::InternalLinkage, addressSpaceDataInitializer,
-             structName.str(), NULL, GlobalVariable::NotThreadLocal, addressSpace);
-          asStructs[addressSpace] = aSpaceStruct;
-        } else {
-          // TODO: not global so just add this to map, which tells that we need to allocate this in kernel initialization code
-          // TODO: how to store mapping, which field refers to which value? index, Value map?
-        }
-
-
-        bool dereferenceSpaceStruct;
-        GlobalVariable *aSpaceStruct;
-        PrivateAddressSpaceInitializer* init = 0;
-
-        if (addressSpace == privateAddressSpaceNumber) {
-          // using global address space intead of private as the
-          // existing 'private' address space values are put in the
-          // global address space
-          PointerType* aSpacePointer = llvm::PointerType::get(addressSpaceStructType, addressSpace);
-          dereferenceSpaceStruct = true;
-          // should this use localAddressSpaceNumber? but that cannot be put into a global
-          aSpaceStruct = new GlobalVariable
-            (M, aSpacePointer, false, GlobalValue::InternalLinkage, Constant::getNullValue(aSpacePointer),
-             structName.str(), NULL, GlobalVariable::NotThreadLocal, addressSpace);
-          GlobalValue* aSpaceEndStruct = new GlobalVariable
-            (M, aSpacePointer, false, GlobalValue::InternalLinkage, Constant::getNullValue(aSpacePointer),
-             structName.str() + "End", NULL, GlobalVariable::NotThreadLocal, addressSpace);
-          addressSpaceEndPtrs[aSpaceStruct] = aSpaceEndStruct;
-          asInits[addressSpace] = (init = new PrivateAddressSpaceInitializer(aSpaceStruct, aSpaceEndStruct, structElementData));
-        } else {
-          dereferenceSpaceStruct = false;
-          aSpaceStruct = new GlobalVariable
-            (M, addressSpaceStructType, false, GlobalValue::InternalLinkage, addressSpaceDataInitializer,
-             structName.str(), NULL, GlobalVariable::NotThreadLocal, addressSpace);
-        }
-
-        asStructs[addressSpace] = aSpaceStruct;
-
-        // keep track of first load instructions for the private memory structure, so we get to do only one
-        // per function
-        std::map<Function*, LoadInst*> privateMemoryLoads;
-
-        ValueIndexMap valueReplacements;
-
-        for (size_t valIndex = 0; valIndex < values.size(); valIndex++) {
-          Value* origVal = values[valIndex];
-
-          // TODO: when this might happen?
-          if (!origVal) continue;
-
-          // should we also do the
-          structVal = ConstantExpr::getInBoundsGetElementPtr
-            (dyn_cast<Constant>(aSpaceStruct), genIntVector<Constant*>( c, 0, valIndex));
-          structVal->setName(origVal->getName());
-
-          // get field of struct
-          Value *structVal;
-          if (dereferenceSpaceStruct) {
-            FunctionSet parentFuncs;
-
-            for ( Value::use_iterator useIt = origVal->use_begin();
-                  useIt != origVal->use_end();
-                  ++useIt ) {
-              Value* value = *useIt;
-              fast_assert(!isa<ConstantExpr>(value), "Constant expressions based on consolidated values not supported");
-              if (isa<Instruction>(value)) {
-                assert(isa<Instruction>(value));
-                Instruction* instruction = cast<Instruction>(value);
-                parentFuncs.insert(instruction->getParent()->getParent());
-              }
-            }
-            fast_assert(parentFuncs.size() <= 1, "Users of a single local variable should be within at most one function");
-
-            if (parentFuncs.size() == 1) {
-              Function* parentFunction = *parentFuncs.begin();
-              if ( !privateMemoryLoads.count(parentFunction) ) {
-                LoadInst* load = new LoadInst( aSpaceStruct, "privateMemory",
-                                               parentFunction->getEntryBlock().getFirstNonPHI() );
-                privateMemoryLoads[parentFunction] = load;
-                safeExceptions.insert(load);
-              }
-              LoadInst* load = privateMemoryLoads[parentFunction];
-              Instruction* v = llvm::GetElementPtrInst::CreateInBounds( load, genIntVector<Value*>( c, 0, valIndex ),
-                                                                        origVal->getName() );
-              v->insertAfter(load);
-              safeExceptions.insert(v);
-              structVal = v;
-            } else {
-              structVal = 0;
-            }
-            valueReplacements[origVal] = valIndex;
-          } else {
-            structVal = ConstantExpr::getInBoundsGetElementPtr
-              (dyn_cast<Constant>(aSpaceStruct), genIntVector<Constant*>( c, 0, valIndex));
-            structVal->setName(origVal->getName());
-          }
-
-          // Currently LLVM IR does not support GEP in alias. If support is added, uncommenting this will greatly improve readability of produced code
-          // for alias: GlobalAlias *fieldAlias = new GlobalAlias(structVal->getType(), GlobalValue::InternalLinkage, "", structVal, &M);
-
-          if (structVal) {
-            DEBUG( dbgs() << "Orig val type: "; origVal->getType()->print(dbgs()); dbgs() << "\n";
-                   dbgs() << " new val type: "; structVal->getType()->print(dbgs()); dbgs() << "\n"; );
-            DEBUG( dbgs() << "Orig val: "; origVal->print(dbgs()); dbgs() << "\n";
-                   dbgs() << " new val: "; structVal->print(dbgs()); dbgs() << "\n"; );
-            origVal->replaceAllUsesWith(structVal);
-
-            // use alias everywhere
-            // for alias: origVal->replaceAllUsesWith(fieldAlias);
-
-            // set name according to original value type and remove original
-            if ( AllocaInst* alloca = dyn_cast<AllocaInst>(origVal) ) {
-              // for alias: fieldAlias->setName(alloca->getParent()->getParent()->getName() + "." + origVal->getName());
-              structVal->setName(alloca->getParent()->getParent()->getName() + "." + origVal->getName());
-              alloca->eraseFromParent();
-            } else if ( GlobalVariable* global = dyn_cast<GlobalVariable>(origVal) ) {
-
- // for alias: fieldAlias->setName(aSpaceStruct->getName() + "." + origVal->getName());
-              structVal->setName(aSpaceStruct->getName() + "." + origVal->getName());
-              global->eraseFromParent();
-            }
-          } else {
-            if (Instruction* ins = dyn_cast<Instruction>(origVal)) {
-              fast_assert(ins->getNumUses() == 0, "An instruction was to be erased but it was still used?");
-              ins->eraseFromParent();
-            } else if (GlobalVariable* global = dyn_cast<GlobalVariable>(origVal)) {
-              fast_assert(global->getNumUses() == 0, "A global was to be erased but it was still used?");
-              global->eraseFromParent();
-            } else {
-              assert(false);
-            }
-          }
-
-          //DEBUG( dbgs() << "Alias: "; fieldAlias->print(dbgs()); dbgs() << "\n"; );
-        }
-        if (init) {
-          init->setValueReplacements(valueReplacements);
-        }
-      }
-    }
-         */
-
-
+
     /**
      * Checks if given function declaration is one of webcl builtins
      *


added more to tellall

added more to tellall

--- Child/Code/tLNode/tLNode.cpp
+++ Child/Code/tLNode/tLNode.cpp
@@ -4,7 +4,7 @@
 **
 **  Functions for derived class tLNode and its member classes
 **
-**  $Id: tLNode.cpp,v 1.58 1998-07-25 01:16:04 nmgaspar Exp $
+**  $Id: tLNode.cpp,v 1.59 1998-07-27 17:09:07 nmgaspar Exp $
 \**************************************************************************/

 #include <assert.h>
@@ -1133,6 +1133,7 @@
 void tLNode::TellAll()
 {
    tLNode * nbr;
+   int i;

    cout << " NODE " << id << ":\n";
    cout << "  x=" << x << " y=" << y << " z=" << z;
@@ -1150,6 +1151,9 @@
               << flowedge->getVEdgLen() << endl;
          cout << "  qs: " << qs << "  qsin: " << qsin << "  slp: "
               << getSlope() << "  reg: " << reg.thickness << endl;
+         for(i=0; i<=numg; i++)
+             cout<<"qsi "<<i<<" "<<qsm[i]<<endl;
+         cout<<endl;
          cout << "  dzdt: " << dzdt << "  drdt: " << drdt << endl;
       }
       else cout << "  Flowedg is undefined\n";


removing call to client->start_delegate_loop as it's no longer available from client interface, but it's automatically called at client start.

--- ClientWrapper.cpp
+++ ClientWrapper.cpp
@@ -105,7 +105,6 @@

       _client->set_daemon_mode(true);
       _client->start();
-      _client->start_delegate_loop();
       if( !_actual_httpd_endpoint )
       {
         main_thread->async( [&](){ Q_EMIT error( tr("Unable to start HTTP server...")); });


fix missing from_eigen_triangular_type() call

--- stan/math/prim/mat/fun/mdivide_left_tri.hpp
+++ stan/math/prim/mat/fun/mdivide_left_tri.hpp
@@ -78,7 +78,7 @@
  * @throws std::domain_error if A is not square or the rows of b don't
  * match the size of A.
  */
-template <int TriView, int R1, int C1, int R2, int C2>
+template <Eigen::UpLoType TriView, int R1, int C1, int R2, int C2>
 inline Eigen::Matrix<double, R1, C2> mdivide_left_tri(
     const Eigen::Matrix<double, R1, C1> &A,
     const Eigen::Matrix<double, R2, C2> &b) {
@@ -87,8 +87,7 @@
 #ifdef STAN_OPENCL
   if (A.rows()
       >= opencl_context.tuning_opts().tri_inverse_size_worth_transfer) {
-    matrix_cl<double> A_cl(A, TriView == Eigen::Lower ? PartialViewCL::Lower
-                                                      : PartialViewCL::Upper);
+    matrix_cl<double> A_cl(A, from_eigen_triangular_type(TriView);
     matrix_cl<double> b_cl(b);
     matrix_cl<double> A_inv_cl = tri_inverse(A_cl);
     matrix_cl<double> C_cl = A_inv_cl * b_cl;


use SmartsWrite namespace

use SmartsWrite namespace

--- Code/GraphMol/molopstest.cpp
+++ Code/GraphMol/molopstest.cpp
@@ -600,21 +600,21 @@
   MolOps::sanitizeMol(*((RWMol *)m));
   TEST_ASSERT(m);
   TEST_ASSERT(m->getNumAtoms()==2);
-  sma = GetAtomSmarts(static_cast<const QueryAtom *>(m->getAtomWithIdx(0)));
+  sma = SmartsWrite::GetAtomSmarts(static_cast<const QueryAtom *>(m->getAtomWithIdx(0)));
   TEST_ASSERT(sma=="C");

   delete m2;
   //BOOST_LOG(rdInfoLog) << "16" << std::endl;
   m2 = MolOps::addHs(*m);
   TEST_ASSERT(m2->getNumAtoms()==8);
-  sma = GetAtomSmarts(static_cast<const QueryAtom *>(m2->getAtomWithIdx(0)));
+  sma = SmartsWrite::GetAtomSmarts(static_cast<const QueryAtom *>(m2->getAtomWithIdx(0)));
   TEST_ASSERT(sma=="C");

   delete m;
   //BOOST_LOG(rdInfoLog) << "17" << std::endl;
   m = MolOps::mergeQueryHs(*m2);
   TEST_ASSERT(m->getNumAtoms()==2);
-  sma = GetAtomSmarts(static_cast<const QueryAtom *>(m->getAtomWithIdx(0)));
+  sma = SmartsWrite::GetAtomSmarts(static_cast<const QueryAtom *>(m->getAtomWithIdx(0)));
   TEST_ASSERT(sma=="[C&!H0]");


added one-level self signed cert test

added one-level self signed cert test

--- coast/modules/SSL/Test/SSLListenerPoolTest.cpp
+++ coast/modules/SSL/Test/SSLListenerPoolTest.cpp
@@ -47,6 +47,7 @@
 	config.Append("TCP5017");
 	config.Append("TCP5018");
 	config.Append("TCP5019");
+	config.Append("TCP5020");

 	TestCallBackFactory *tcbf = new TestCallBackFactory;
 	ListenerPool lpToTest(tcbf);
@@ -68,6 +69,7 @@
 			t_assert(result.Contains("5011_timeout_2000"));
 			t_assert(result.Contains("5016_timeout_1000"));
 			t_assert(result.Contains("5017_timeout_1000"));
+			t_assert(result.Contains("5020_timeout_0"));
 		}
 	}
 	Anything failures = tcbf->GetFailures();


improved label verification in finishRoutine() & corrected copy pasted debug messages

--- code/TweeZcodeCompiler/main/AssemblyParser.cpp
+++ code/TweeZcodeCompiler/main/AssemblyParser.cpp
@@ -197,15 +197,25 @@
     bool labelFound;
     for (auto jump = registeredJumpsAtLines.begin(); jump != registeredJumpsAtLines.end(); ++jump) {
         labelFound = false;
+        string jumpFirst = jump->first;
+
         for (auto label = registeredLabels.begin(); label != registeredLabels.end(); ++label) {
-            if (label->compare(jump->first) == 0) {
+            if (label->compare(jumpFirst) == 0) {
                 labelFound = true;
                 break;
             }
+            //set labelFound true when label is x but jump->first is ~x for jump not equals
+            string jumpSubString = jumpFirst.substr(1, jumpFirst.size()-1);
+            bool beginsWithTilde = (jumpFirst.at(0) == '~' );
+            bool restIsSame = (label->compare( jumpSubString) == 0 ) ;
+            if ( beginsWithTilde && restIsSame ) {
+                labelFound = true;
+                break;
+            }
         }

         if (!labelFound) {
-            InvalidLabelException e(jump->first);
+            InvalidLabelException e(jumpFirst);
             e.lineNumber = jump->second;
             throw e;
         }
@@ -515,19 +525,19 @@
         LOG_DEBUG << ":::::: new add ";
         routineGenerator.add(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::SUB_COMMAND) == 0) {
-        LOG_DEBUG << ":::::: new add ";
+        LOG_DEBUG << ":::::: new sub ";
         routineGenerator.sub(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::MUL_COMMAND) == 0) {
-        LOG_DEBUG << ":::::: new add ";
+        LOG_DEBUG << ":::::: new mul ";
         routineGenerator.mul(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::DIV_COMMAND) == 0) {
-        LOG_DEBUG << ":::::: new add ";
+        LOG_DEBUG << ":::::: new div ";
         routineGenerator.div(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::AND_COMMAND) == 0) {
-        LOG_DEBUG << ":::::: new add ";
+        LOG_DEBUG << ":::::: new and ";
         routineGenerator.doAND(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::OR_COMMAND) == 0) {
-        LOG_DEBUG << ":::::: new add ";
+        LOG_DEBUG << ":::::: new or ";
         routineGenerator.doOR(parseArguments(command));
     } else if (commandPart.compare(AssemblyParser::RET_TRUE_COMMAND) == 0) {
         LOG_DEBUG << ":::::: new rtrue";


Added GetContacts function.

Added GetContacts function.

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@1292 5b2332b8-efa3-11de-8684-7d64432d61a3

--- CommunicationModule/User.cpp
+++ CommunicationModule/User.cpp
@@ -35,4 +35,11 @@
 		emit ContactListChangend();
 	}

+	ContactVector User::GetContacts()
+	{
+		ContactVector contacts;
+		contacts.assign(contacts_.begin(), contacts_.end());
+		return contacts;
+	}
+
 } // end of TpQt4Communication:


Added an explicit cast.

Added an explicit cast.

--- Components/6845/CRTC6845.hpp
+++ Components/6845/CRTC6845.hpp
@@ -74,7 +74,7 @@
 							line_is_visible_ = true;
 							line_counter_ = 0;
 							is_in_adjustment_period_ = false;
-							line_address_ = (registers_[12] << 8) | registers_[13];
+							line_address_ = (uint16_t)((registers_[12] << 8) | registers_[13]);
 							bus_state_.refresh_address = line_address_;
 						}
 					} else {


bayes: dropped some redundant types

bayes: dropped some redundant types

--- 7.cpp
+++ 7.cpp
@@ -16,15 +16,6 @@
 #define NUM_FIELDS 16

 using Entry = std::array<double, NUM_FIELDS>;
-using IntPair = std::pair<int, int>;
-
-struct CompareSecond: std::binary_function<IntPair, IntPair, bool>
-{
-    bool operator()(const IntPair& a, const IntPair& b)
-    {
-        return a.second < b.second;
-    }
-};

 int main(int argc, char** argv)
 {


Doesn't queue up messages if no client is connected

--- Control/SerialController.cpp
+++ Control/SerialController.cpp
@@ -33,7 +33,7 @@
     PackSensorData(sensorData);
     stringstream ss;
     ss << sensorData;
-    if(controllerPipe) {
+    if(controllerPipe && controllerPipe->transport->WriteReady()) {
       controllerPipe->SendMessage(ss.str());
     }
   }
@@ -119,6 +119,12 @@
 {
   READ_CONTROLLER_SETTING(servAddr)
   READ_CONTROLLER_SETTING(writeRate)
+  if(name=="connected") {
+    if(controllerPipe)
+      str = "1";
+    else
+      str = "0";
+  }
   return false;
 }


Fix warning when building with clang on Windows

Change-Id: If9928d8ca3b12a260b97d522abfa7e3b5ff47831
Reviewed-on: https://chromium-review.googlesource.com/446418
Reviewed-by: Scott Graham <e134406e1863f3b48b0795831afac5c0595efb36@chromium.org>

--- handler/handler_main.cc
+++ handler/handler_main.cc
@@ -362,6 +362,7 @@
   // to exit, which isn’t necessary or desirable.
   SetConsoleCtrlHandler(ConsoleHandler, true);
   static TerminateHandler* terminate_handler = new TerminateHandler();
+  ALLOW_UNUSED_LOCAL(terminate_handler);
 }

 #endif  // OS_MACOSX


add debug printfs

add debug printfs

--- surface.hpp
+++ surface.hpp
@@ -61,10 +61,8 @@

     void render() {
         if (width == 0 || rendered) {
-            printf("skip");
             return;
         }
-        printf("(%i %i)\n", width, height);
         buffer = std::vector<std::vector<Color> >(width, std::vector<Color>(height));
         for (int x = 0; x < width; ++x) {
             for (int y = 0; y < height; ++y) {
@@ -77,7 +75,6 @@
     }

     void draw() {
-        printf("draw");
         for (int x = 0; x < width; ++x) {
             for (int y = 0; y < height; ++y) {
                 draw_pixel(x, y, buffer[x][y]);
@@ -135,7 +132,6 @@
                     break;
                 case ButtonPress:
                 case KeyPress:
-                    printf("ok");
                     switch (report.xkey.keycode) {
                         case 113:
                             angle += 0.6;


Replaced a naked floating point equality check with a fuzzy check. This was causing problems in the optimized, DEBUG_MODE code.

--- Cantera/src/equil/vcs_solve_TP.cpp
+++ Cantera/src/equil/vcs_solve_TP.cpp
@@ -948,7 +948,8 @@
 	 *         This should keep the amount of material constant.
 	 */
 #ifdef DEBUG_MODE
-	if (ds[kspec] != dx) {
+	if (fabs(ds[kspec] -dx) > 1.0E-14*(fabs(ds[kspec]) + fabs(dx) + 1.0E-32)) {
+	  plogf(" ds[kspec] = %20.16g dx = %20.16g , kspec = %d\n", ds[kspec], dx, kspec);
 	  plogf("we have a problem!\n");
 	  exit(-1);
 	}


forward SIG_HUP from supervisor

forward SIG_HUP from supervisor

--- lib/ApplicationFeatures/SupervisorFeature.cpp
+++ lib/ApplicationFeatures/SupervisorFeature.cpp
@@ -43,6 +43,14 @@
     LOG_TOPIC(ERR, Logger::STARTUP) << "commanding client [" << CLIENT_PID << "] to shut down failed: [" << errno << "] " << strerror(errno);
   }
   DONE = true;
+}
+
+static void HUPHandler(int) {
+  LOG_TOPIC(INFO, Logger::STARTUP) << "received SIGHUP for supervisor; commanding client [" << CLIENT_PID << "] to logrotate.";
+  int rc = kill(CLIENT_PID, SIGHUP);
+  if (rc < 0) {
+    LOG_TOPIC(ERR, Logger::STARTUP) << "commanding client [" << CLIENT_PID << "] to logrotate failed: [" << errno << "] " << strerror(errno);
+  }
 }

 SupervisorFeature::SupervisorFeature(
@@ -130,6 +138,7 @@
     if (0 < _clientPid) {
       signal(SIGINT, StopHandler);
       signal(SIGTERM, StopHandler);
+      signal(SIGHUP, HUPHandler);

       LOG_TOPIC(INFO, Logger::STARTUP) << "supervisor has forked a child process with pid " << _clientPid;


INTEGRATION: CWS pchfix02 (1.7.276); FILE MERGED 2006/09/01 17:42:51 kaib 1.7.276.1: #i68856# Added header markers and pch files

--- svtools/source/config/workingsetoptions.cxx
+++ svtools/source/config/workingsetoptions.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: workingsetoptions.cxx,v $
  *
- *  $Revision: 1.7 $
- *
- *  last change: $Author: rt $ $Date: 2005-11-11 08:55:42 $
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: obo $ $Date: 2006-09-17 14:31:20 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,8 +32,10 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
 #ifndef GCC
-#pragma hdrstop
 #endif

 //_________________________________________________________________________________________________________________


修正CListTextElementUI::SetText可能存在的内存泄露bug

--- DuiLib/UIList.cpp
+++ DuiLib/UIList.cpp
@@ -1700,7 +1700,7 @@
     CStdString* pText;
     for( int it = 0; it < m_aTexts.GetSize(); it++ ) {
         pText = static_cast<CStdString*>(m_aTexts[it]);
-        delete pText;
+        if( pText ) delete pText;
     }
     m_aTexts.Empty();
 }
@@ -1733,10 +1733,10 @@
     if( m_pOwner == NULL ) return;
     TListInfoUI* pInfo = m_pOwner->GetListInfo();
     if( iIndex < 0 || iIndex >= pInfo->nColumns ) return;
-    if( m_aTexts.GetSize() != pInfo->nColumns ) m_aTexts.Resize(pInfo->nColumns);
+    while( m_aTexts.GetSize() < pInfo->nColumns ) { m_aTexts.Add(NULL); }

     CStdString* pText = static_cast<CStdString*>(m_aTexts[iIndex]);
-    if( pText && *pText == pstrText ) return;
+    if( (pText == NULL && pstrText == NULL) || (pText && *pText == pstrText) ) return;

     if( pText ) delete pText;
     m_aTexts.SetAt(iIndex, new CStdString(pstrText));


THRIFT-827. ocaml: OCaml generator to take default values into account

A patch to the OCaml generator which uses default values defined in the .thrift file to initialize the members of the generated class.

Patch: Lev Walkin

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

--- compiler/cpp/src/generate/t_ocaml_generator.cc
+++ compiler/cpp/src/generate/t_ocaml_generator.cc
@@ -65,6 +65,9 @@
   void generate_service  (t_service*  tservice);

   std::string render_const_value(t_type* type, t_const_value* value);
+  bool struct_member_persistent(t_field *tmember);
+  bool struct_member_omitable(t_field *tmember);
+  bool struct_member_default_cheaply_comparable(t_field *tmember);

   /**
    * Struct generation code
@@ -72,6 +75,7 @@

   void generate_ocaml_struct(t_struct* tstruct, bool is_exception);
   void generate_ocaml_struct_definition(std::ofstream& out, t_struct* tstruct, bool is_xception=false);
+  void generate_ocaml_struct_member(std::ofstream& out, string tname, t_field* tmember);
   void generate_ocaml_struct_sig(std::ofstream& out, t_struct* tstruct, bool is_exception);
   void generate_ocaml_struct_reader(std::ofstream& out, t_struct* tstruct);
   void generate_ocaml_struct_writer(std::ofstream& out, t_struct* tstruct);
@@ -390,6 +394,8 @@
     case t_base_type::TYPE_DOUBLE:
       if (value->get_type() == t_const_value::CV_INTEGER) {
         out << value->get_integer();
+      } else if(value->get_double() == 0.0) {
+        out << "0.0";   // OCaml can't bear '0' in place of double.
       } else {
         out << value->get_double();
       }
@@ -537,14 +543,9 @@

   indent_up();

-  string x = tmp("_x");
   if (members.size() > 0) {
     for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      string mname = decapitalize((*m_iter)->get_name());
-      indent(out) << "val mutable _" << mname << " : " << render_ocaml_type((*m_iter)->get_type()) << " option = None" << endl;
-      indent(out) << "method get_" << mname << " = _" << mname << endl;
-      indent(out) << "method grab_" << mname << " = match _"<<mname<<" with None->raise (Field_empty \""<<tname<<"."<<mname<<"\") | Some " << x <<" -> " << x << endl;
-      indent(out) << "method set_" << mname << " " << x << " = _" << mname << " <- Some " << x << endl;
+      generate_ocaml_struct_member(out, tname, (*m_iter));
     }
   }
   generate_ocaml_struct_writer(out, tstruct);
@@ -556,6 +557,94 @@
   }

   generate_ocaml_struct_reader(out, tstruct);
+}
+
+/**
+ * Generates a structure member for a thrift data type.
+ *
+ * @param tname Name of the parent structure for the member
+ * @param tmember Member definition
+ */
+void t_ocaml_generator::generate_ocaml_struct_member(ofstream& out,
+                                                     string tname,
+                                                     t_field* tmember) {
+  string x = tmp("_x");
+  string mname = decapitalize(tmember->get_name());
+
+  indent(out) << "val mutable _" << mname << " : " << render_ocaml_type(tmember->get_type());
+  t_const_value *val = tmember->get_value();
+  if(val) {
+    if(struct_member_persistent(tmember))
+        out << " = " << render_const_value(tmember->get_type(), tmember->get_value()) << endl;
+    else
+        out << " option = Some " << render_const_value(tmember->get_type(), tmember->get_value()) << endl;
+  } else {
+    // assert(!struct_member_persistent(tmember))
+    out << " option = None" << endl;
+  }
+
+  if(struct_member_persistent(tmember)) {
+        indent(out) << "method get_" << mname << " = Some _" << mname << endl;
+        indent(out) << "method grab_" << mname << " = _" << mname << endl;
+        indent(out) << "method set_" << mname << " " << x << " = _" << mname << " <- " << x << endl;
+  } else {
+        indent(out) << "method get_" << mname << " = _" << mname << endl;
+        indent(out) << "method grab_" << mname << " = match _"<<mname<<" with None->raise (Field_empty \""<<tname<<"."<<mname<<"\") | Some " << x <<" -> " << x << endl;
+        indent(out) << "method set_" << mname << " " << x << " = _" << mname << " <- Some " << x << endl;
+  }
+}
+
+/**
+ * Check whether a member of the structure can not have undefined value
+ *
+ * @param tmember Member definition
+ */
+bool t_ocaml_generator::struct_member_persistent(t_field *tmember) {
+  t_const_value *val = tmember->get_value();
+  return (val ? true : false);
+}
+
+/**
+ * Check whether a member of the structure can be skipped during encoding
+ *
+ * @param tmember Member definition
+ */
+bool t_ocaml_generator::struct_member_omitable(t_field *tmember) {
+  return (tmember->get_req() != t_field::T_REQUIRED);
+}
+
+/**
+ * Figure out whether a member of the structure has
+ * a cheaply comparable default value.
+ *
+ * @param tmember Member definition
+ */
+bool t_ocaml_generator::struct_member_default_cheaply_comparable(t_field *tmember) {
+  t_type* type = get_true_type(tmember->get_type());
+  t_const_value *val = tmember->get_value();
+  if(!val) {
+    return false;
+  } else if(type->is_base_type()) {
+    // Base types are generally cheaply compared for structural equivalence.
+    switch(((t_base_type*)type)->get_base()) {
+    case t_base_type::TYPE_DOUBLE:
+        if(val->get_double() == 0.0)
+                return true;
+        else
+                return false;
+    default:
+        return true;
+    }
+  } else if(type->is_list()) {
+    // Empty lists are cheaply compared for structural equivalence.
+    // Is empty list?
+    if(val->get_list().size() == 0)
+        return true;
+    else
+        return false;
+  } else {
+    return false;
+  }
 }

 /**
@@ -682,17 +771,55 @@
     "oprot#writeStructBegin \""<<name<<"\";" << endl;

   for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
+    t_field *tmember = (*f_iter);
+    string mname = "_"+decapitalize(tmember->get_name());
+    string _v;
+
+    if(struct_member_persistent(tmember)) {
+
+      if(struct_member_omitable(tmember)
+        && struct_member_default_cheaply_comparable(tmember)) {
+        _v = "_v";
+        // Avoid redundant encoding of members having default values.
+        indent(out) << "(match " << mname << " with "
+            << render_const_value(tmember->get_type(), tmember->get_value())
+            << " -> () | " << _v << " -> " << endl;
+      } else {
+        _v = mname;
+        indent(out) << "(" << endl;
+      }
+
+    } else {
+
+      indent(out) << "(match " << mname << " with ";
+
+      if(struct_member_omitable(tmember)) {
+        out << "None -> ()";
+
+        if(struct_member_default_cheaply_comparable(tmember)) {
+          // Avoid redundant encoding of members having default values.
+          out << " | Some "
+              << render_const_value(tmember->get_type(), tmember->get_value())
+              << " -> ()";
+        }
+        out << " | Some _v -> " << endl;
+      } else {
+        out << endl;
+        indent(out) << "| None -> raise (Field_empty \""
+                    << type_name(tstruct) << "." << mname << "\")" << endl;
+        indent(out) << "| Some _v -> " << endl;
+      }
+
+      _v = "_v";
+    }
+    indent_up();
     // Write field header
-    string mname = "_"+decapitalize((*f_iter)->get_name());
-    indent(out) <<
-      "(match " << mname << " with None -> () | Some _v -> " << endl;
-    indent_up();
-    indent(out) << "oprot#writeFieldBegin(\""<< (*f_iter)->get_name()<<"\","
-                <<type_to_enum((*f_iter)->get_type())<<","
-                <<(*f_iter)->get_key()<<");" << endl;
+    indent(out) << "oprot#writeFieldBegin(\""<< tmember->get_name()<<"\","
+                << type_to_enum(tmember->get_type()) << ","
+                << tmember->get_key()<<");" << endl;

     // Write field contents
-    generate_serialize_field(out, *f_iter, "_v");
+    generate_serialize_field(out, tmember, _v);

     // Write field closer
     indent(out) << "oprot#writeFieldEnd" << endl;


Print the correct index in the "match failed at index" message.

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

--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2680,7 +2680,7 @@
       NodeStack.append(LastScope.NodeStack.begin(), LastScope.NodeStack.end());
       N = NodeStack.back();

-      DEBUG(errs() << "  Match failed at index " << MatcherIndex
+      DEBUG(errs() << "  Match failed at index " << (MatcherIndex-1)
                    << " continuing at " << LastScope.FailIndex << "\n");

       if (LastScope.NumMatchedMemRefs != MatchedMemRefs.size())


[analyzer] fix bug in malloc checker where the tracked symbol would not properly be removed from the state.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@136418 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -578,24 +578,31 @@
   RegionStateTy RS = state->get<RegionState>();
   RegionStateTy::Factory &F = state->get_context<RegionState>();

+  bool generateReport = false;
+
   for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
     if (SymReaper.isDead(I->first)) {
-      if (I->second.isAllocated()) {
-        if (ExplodedNode *N = C.generateNode()) {
-          if (!BT_Leak)
-            BT_Leak.reset(new BuiltinBug("Memory leak",
-                    "Allocated memory never released. Potential memory leak."));
-          // FIXME: where it is allocated.
-          BugReport *R = new BugReport(*BT_Leak, BT_Leak->getDescription(), N);
-          C.EmitReport(R);
-        }
-      }
+      if (I->second.isAllocated())
+        generateReport = true;

       // Remove the dead symbol from the map.
       RS = F.remove(RS, I->first);
-    }
-  }
-  C.generateNode(state->set<RegionState>(RS));
+
+    }
+  }
+
+  ExplodedNode *N = C.generateNode(state->set<RegionState>(RS));
+
+  // FIXME: This does not handle when we have multiple leaks at a single
+  // place.
+  if (N && generateReport) {
+    if (!BT_Leak)
+      BT_Leak.reset(new BuiltinBug("Memory leak",
+              "Allocated memory never released. Potential memory leak."));
+    // FIXME: where it is allocated.
+    BugReport *R = new BugReport(*BT_Leak, BT_Leak->getDescription(), N);
+    C.EmitReport(R);
+  }
 }

 void MallocChecker::checkEndPath(EndOfFunctionNodeBuilder &B,


[analyzer] Reuse some code in simplifySVal().

No functional change intended.

Differential Revision: https://reviews.llvm.org/D49826

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@338422 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1236,11 +1236,21 @@
       return Sym == Val.getAsSymbol();
     }

+    SVal cache(SymbolRef Sym, SVal V) {
+      Cached[Sym] = V;
+      return V;
+    }
+
+    SVal skip(SymbolRef Sym) {
+      return cache(Sym, SVB.makeSymbolVal(Sym));
+    }
+
   public:
     Simplifier(ProgramStateRef State)
         : State(State), SVB(State->getStateManager().getSValBuilder()) {}

     SVal VisitSymbolData(const SymbolData *S) {
+      // No cache here.
       if (const llvm::APSInt *I =
               SVB.getKnownValue(State, SVB.makeSymbolVal(S)))
         return Loc::isLocType(S->getType()) ? (SVal)SVB.makeIntLocVal(*I)
@@ -1257,11 +1267,9 @@
         return I->second;

       SVal LHS = Visit(S->getLHS());
-      if (isUnchanged(S->getLHS(), LHS)) {
-        SVal V = SVB.makeSymbolVal(S);
-        Cached[S] = V;
-        return V;
-      }
+      if (isUnchanged(S->getLHS(), LHS))
+        return skip(S);
+
       SVal RHS;
       // By looking at the APSInt in the right-hand side of S, we cannot
       // figure out if it should be treated as a Loc or as a NonLoc.
@@ -1281,9 +1289,8 @@
         RHS = SVB.makeIntVal(S->getRHS());
       }

-      SVal V = SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType());
-      Cached[S] = V;
-      return V;
+      return cache(
+          S, SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType()));
     }

     SVal VisitSymSymExpr(const SymSymExpr *S) {
@@ -1296,22 +1303,16 @@
       // and we don't know how to combine a LocAsInteger
       // with a concrete value.
       if (Loc::isLocType(S->getLHS()->getType()) !=
-          Loc::isLocType(S->getRHS()->getType())) {
-        SVal V = SVB.makeSymbolVal(S);
-        Cached[S] = V;
-        return V;
-      }
+          Loc::isLocType(S->getRHS()->getType()))
+        return skip(S);

       SVal LHS = Visit(S->getLHS());
       SVal RHS = Visit(S->getRHS());
-      if (isUnchanged(S->getLHS(), LHS) && isUnchanged(S->getRHS(), RHS)) {
-        SVal V = SVB.makeSymbolVal(S);
-        Cached[S] = V;
-        return V;
-      }
-      SVal V = SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType());
-      Cached[S] = V;
-      return V;
+      if (isUnchanged(S->getLHS(), LHS) && isUnchanged(S->getRHS(), RHS))
+        return skip(S);
+
+      return cache(
+          S, SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType()));
     }

     SVal VisitSymExpr(SymbolRef S) { return nonloc::SymbolVal(S); }


ARM asm backend initialize isThumbMode based on target triple.

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

--- lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -42,7 +42,7 @@
 public:
   ARMAsmBackend(const Target &T, const StringRef TT)
     : MCAsmBackend(), STI(ARM_MC::createARMMCSubtargetInfo(TT, "", "")),
-      isThumbMode(false) {}
+      isThumbMode(TT.startswith("thumb")) {}

   ~ARMAsmBackend() {
     delete STI;


added include paths options

added include paths options

--- helen-compiler/main.cpp
+++ helen-compiler/main.cpp
@@ -14,6 +14,8 @@
 using namespace Helen;
 using namespace std;

+vector<string> includePaths;
+
 int yyparse(AST*& ast);
 extern FILE* yyin;

@@ -25,6 +27,7 @@
     ("help,h", "display this help")
     ("version,v", "display version")
     ("input-file", po::value<string>(), "input file")
+    ("include-path,I", po::value<vector<string> >(), "path to include files")
     ;
     po::positional_options_description p;
     p.add("input-file", -1);
@@ -35,6 +38,10 @@
         cout << desc << "\n";
         return 1;
     }
+    if(vm.count("include-path"))
+        includePaths = vm["include-path"].as<vector<string> >();
+    includePaths.push_back(".");
+    //TODO: add stdlib dirs to include paths
     AST::module = llvm::make_unique<Module>("__helenmodule__", getGlobalContext());
     AST::fpm = llvm::make_unique<legacy::FunctionPassManager>(AST::module.get());
     AST::dataLayout = llvm::make_unique<DataLayout>(AST::module.get());


*** empty log message ***

*** empty log message ***

--- Child/Code/tRunTimer/tRunTimer.cpp
+++ Child/Code/tRunTimer/tRunTimer.cpp
@@ -13,7 +13,7 @@
 **  - add functions to set output interval and time status notification
 **    interval
 **
-**  $Id: tRunTimer.cpp,v 1.11 2000-06-05 22:13:27 daniel Exp $
+**  $Id: tRunTimer.cpp,v 1.12 2000-06-05 22:18:17 daniel Exp $
 \***************************************************************************/

 #include <iostream.h>
@@ -205,7 +205,7 @@
 {
         if( currentTime >= nextTSOutputTime )
 	{
-	    	nextTSOutputTime += TSoutputInterval;
+	    	nextTSOutputTime += TSOutputInterval;
 		return 1;
 	}
 	else return 0;


Clean up redundant #ifdefs

Clean up redundant #ifdefs

--- demo/OpenGLRenderer.cpp
+++ demo/OpenGLRenderer.cpp
@@ -61,11 +61,7 @@

 class Shader {
-#ifdef RENDERER_OPENGL
-
-    GLuint program;
-
-#endif  // RENDERER_OPENGL
+	GLuint program;

 	Shader() = delete;
 	Shader(const Shader &) = delete;
@@ -84,11 +80,7 @@

 class Framebuffer {
-	// TODO: need a proper Render object to control the others
 	friend class Renderer;
-	friend class SMAADemo;
-
-#ifdef RENDERER_OPENGL

 	GLuint fbo;
 	GLuint colorTex;
@@ -96,7 +88,6 @@

 	unsigned int width, height;

-#endif  // RENDERER_OPENGL

 	Framebuffer() = delete;
 	Framebuffer(const Framebuffer &) = delete;


Revert changeset 405 (localtime_r is not available on all platforms)

git-svn-id: 8ac86a82847f5b1e237432db69b314a71dec6f22@406 5693b1fc-3b75-4070-9b6b-3ce3692a40d5

--- E_Libs/StdLib.cpp
+++ E_Libs/StdLib.cpp
@@ -212,18 +212,17 @@
 		like http://de3.php.net/manual/de/function.getdate.php	*/
 	ES_FUNCTION_DECLARE(globals,"getDate",0,1,{
 		time_t t=(parameter.count()==0)?time(nullptr):static_cast<time_t>(parameter[0]->toInt());
-		tm d;
-		localtime_r(&t, &d);
+		tm *d=localtime (& t );
 		Map * m=Map::create();
-		m->setValue(String::create("seconds"),Number::create(d.tm_sec));
-		m->setValue(String::create("minutes"),Number::create(d.tm_min));
-		m->setValue(String::create("hours"),Number::create(d.tm_hour));
-		m->setValue(String::create("mday"),Number::create(d.tm_mday));
-		m->setValue(String::create("mon"),Number::create(d.tm_mon+1));
-		m->setValue(String::create("year"),Number::create(d.tm_year+1900));
-		m->setValue(String::create("wday"),Number::create(d.tm_wday));
-		m->setValue(String::create("yday"),Number::create(d.tm_yday));
-		m->setValue(String::create("isdst"),Number::create(d.tm_isdst));
+		m->setValue(String::create("seconds"),Number::create(d->tm_sec));
+		m->setValue(String::create("minutes"),Number::create(d->tm_min));
+		m->setValue(String::create("hours"),Number::create(d->tm_hour));
+		m->setValue(String::create("mday"),Number::create(d->tm_mday));
+		m->setValue(String::create("mon"),Number::create(d->tm_mon+1));
+		m->setValue(String::create("year"),Number::create(d->tm_year+1900));
+		m->setValue(String::create("wday"),Number::create(d->tm_wday));
+		m->setValue(String::create("yday"),Number::create(d->tm_yday));
+		m->setValue(String::create("isdst"),Number::create(d->tm_isdst));
 		return m;
 	})


INTEGRATION: CWS warnings01 (1.5.30); FILE MERGED 2005/12/22 11:44:47 fs 1.5.30.2: #i57457# warning-free code 2005/11/16 12:59:05 fs 1.5.30.1: #i57457# warning free code

--- connectivity/source/drivers/flat/Eservices.cxx
+++ connectivity/source/drivers/flat/Eservices.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: Eservices.cxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.6 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-08 06:02:07 $
+ *  last change: $Author: hr $ $Date: 2006-06-20 01:29:04 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -127,7 +127,7 @@

 extern "C" void SAL_CALL component_getImplementationEnvironment(
                 const sal_Char  **ppEnvTypeName,
-                uno_Environment **ppEnv
+                uno_Environment ** /*ppEnv*/
             )
 {
     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
@@ -135,7 +135,7 @@

 //---------------------------------------------------------------------------------------
 extern "C" sal_Bool SAL_CALL component_writeInfo(
-                void* pServiceManager,
+                void* /*pServiceManager*/,
                 void* pRegistryKey
             )
 {
@@ -162,7 +162,7 @@
 extern "C" void* SAL_CALL component_getFactory(
                     const sal_Char* pImplementationName,
                     void* pServiceManager,
-                    void* pRegistryKey)
+                    void* /*pRegistryKey*/)
 {
     void* pRet = 0;
     if (pServiceManager)


INTEGRATION: CWS hsqldb3 (1.7.10); FILE MERGED 2005/03/21 09:44:47 fs 1.7.10.2: #i44127# fallback to system locale, if necessary fallback to comparing the language parts of locales only, if necessary 2005/03/18 16:42:39 fs 1.7.10.1: #i44127# initialize a newly created DB with OOo's system collation

--- connectivity/source/drivers/hsqldb/HDriver.cxx
+++ connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: HDriver.cxx,v $
  *
- *  $Revision: 1.8 $
- *
- *  last change: $Author: vg $ $Date: 2005-03-23 09:40:32 $
+ *  $Revision: 1.9 $
+ *
+ *  last change: $Author: vg $ $Date: 2005-03-23 14:55:02 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -96,12 +96,20 @@
 #ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
 #include <com/sun/star/frame/XDesktop.hpp>
 #endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
 #ifndef CONNECTIVITY_HSQLDB_TERMINATELISTENER_HXX
 #include "HTerminateListener.hxx"
 #endif
-
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
 #ifndef _OSL_FILE_H_
 #include <osl/file.h>
+#endif
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
 #endif
 //........................................................................
 namespace connectivity
@@ -227,6 +235,8 @@
                         ,*this
                         ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000"))
                         ,1000,Any());
+
+                bool bIsNewDatabase = !xStorage->hasElements();

                 Sequence< PropertyValue > aConvertedProperties(8);
                 sal_Int32 nPos = 0;
@@ -267,6 +277,11 @@
                     StorageContainer::revokeStorage(sKey,NULL);
                     throw e;
                 }
+
+                // if the storage is completely empty, then we just created a new HSQLDB
+                // In this case, do some initializations.
+                if ( bIsNewDatabase && xOrig.is() )
+                    onConnectedNewDatabase( xOrig );

                 if ( xOrig.is() )
                 {
@@ -547,6 +562,232 @@
     {
     }
     //------------------------------------------------------------------
+    namespace
+    {
+        //..............................................................
+        const sal_Char* lcl_getCollationForLocale( const ::rtl::OUString& _rLocaleString, bool _bAcceptCountryMismatch = false )
+        {
+            static const sal_Char* pTranslations[] =
+            {
+                "af-ZA", "Afrikaans",
+                "am-ET", "Amharic",
+                "ar", "Arabic",
+                "as-IN", "Assamese",
+                "az-AZ", "Azerbaijani_Latin",
+                "az-cyrillic", "Azerbaijani_Cyrillic",
+                "be-BY", "Belarusian",
+                "bg-BG", "Bulgarian",
+                "bn-IN", "Bengali",
+                "bo-CN", "Tibetan",
+                "bs-BA", "Bosnian",
+                "ca-ES", "Catalan",
+                "cs-CZ", "Czech",
+                "cy-GB", "Welsh",
+                "da-DK", "Danish",
+                "de-DE", "German",
+                "el-GR", "Greek",
+                "en-US", "Latin1_General",
+                "es-ES", "Spanish",
+                "et-EE", "Estonian",
+                "eu", "Basque",
+                "fi-FI", "Finnish",
+                "fr-FR", "French",
+                "gn-PY", "Guarani",
+                "gu-IN", "Gujarati",
+                "ha-NG", "Hausa",
+                "he-IL", "Hebrew",
+                "hi-IN", "Hindi",
+                "hr-HR", "Croatian",
+                "hu-HU", "Hungarian",
+                "hy-AM", "Armenian",
+                "id-ID", "Indonesian",
+                "ig-NG", "Igbo",
+                "is-IS", "Icelandic",
+                "it-IT", "Italian",
+                "iu-CA", "Inuktitut",
+                "ja-JP", "Japanese",
+                "ka-GE", "Georgian",
+                "kk-KZ", "Kazakh",
+                "km-KH", "Khmer",
+                "kn-IN", "Kannada",
+                "ko-KR", "Korean",
+                "kok-IN", "Konkani",
+                "ks", "Kashmiri",
+                "ky-KG", "Kirghiz",
+                "lo-LA", "Lao",
+                "lt-LT", "Lithuanian",
+                "lv-LV", "Latvian",
+                "mi-NZ", "Maori",
+                "mk-MK", "Macedonian",
+                "ml-IN", "Malayalam",
+                "mn-MN", "Mongolian",
+                "mni-IN", "Manipuri",
+                "mr-IN", "Marathi",
+                "ms-MY", "Malay",
+                "mt-MT", "Maltese",
+                "my-MM", "Burmese",
+                "nb-NO", "Danish_Norwegian",
+                "ne-NP", "Nepali",
+                "nl-NL", "Dutch",
+                "nn-NO", "Norwegian",
+                "or-IN", "Oriya",
+                "pa-IN", "Punjabi",
+                "pl-PL", "Polish",
+                "ps-AF", "Pashto",
+                "pt-PT", "Portuguese",
+                "ro-RO", "Romanian",
+                "ru-RU", "Russian",
+                "sa-IN", "Sanskrit",
+                "sd-IN", "Sindhi",
+                "sk-SK", "Slovak",
+                "sl-SI", "Slovenian",
+                "so-SO", "Somali",
+                "sq-AL", "Albanian",
+                "sr-YU", "Serbian_Cyrillic",
+                "sv-SE", "Swedish",
+                "sw-KE", "Swahili",
+                "ta-IN", "Tamil",
+                "te-IN", "Telugu",
+                "tg-TJ", "Tajik",
+                "th-TH", "Thai",
+                "tk-TM", "Turkmen",
+                "tn-BW", "Tswana",
+                "tr-TR", "Turkish",
+                "tt-RU", "Tatar",
+                "uk-UA", "Ukrainian",
+                "ur-PK", "Urdu",
+                "uz-UZ", "Uzbek_Latin",
+                "ven-ZA", "Venda",
+                "vi-VN", "Vietnamese",
+                "yo-NG", "Yoruba",
+                "zh-CN", "Chinese",
+                "zu-ZA", "Zulu",
+                NULL, NULL
+            };
+
+            ::rtl::OUString sLocaleString( _rLocaleString );
+            sal_Char nCompareTermination = 0;
+
+            if ( _bAcceptCountryMismatch )
+            {
+                // strip the country part from the compare string
+                sal_Int32 nCountrySep = sLocaleString.indexOf( '-' );
+                if ( nCountrySep > -1 )
+                    sLocaleString = sLocaleString.copy( 0, nCountrySep );
+
+                // the entries in the translation table are compared until the
+                // - character only, not until the terminating 0
+                nCompareTermination = '-';
+            }
+
+            const sal_Char** pLookup = pTranslations;
+            for ( ; *pLookup; ++pLookup )
+            {
+                sal_Int32 nCompareUntil = 0;
+                while ( (*pLookup)[ nCompareUntil ] != nCompareTermination )
+                    ++nCompareUntil;
+
+                if ( sLocaleString.equalsAsciiL( *pLookup, nCompareUntil ) )
+                    return *( pLookup + 1 );
+            }
+
+            if ( !_bAcceptCountryMismatch )
+                // second round, this time without matching the country
+                return lcl_getCollationForLocale( _rLocaleString, true );
+
+            OSL_ENSURE( false, "lcl_getCollationForLocale: unknown locale string, falling back to Latin1_General!" );
+            return "Latin1_General";
+        }
+
+        //..............................................................
+        ::rtl::OUString lcl_getSystemLocale( const Reference< XMultiServiceFactory >& _rxORB )
+        {
+            ::rtl::OUString sLocaleString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
+            try
+            {
+                //.........................................................
+                Reference< XMultiServiceFactory > xConfigProvider(
+                    _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ),
+                    UNO_QUERY
+                );
+                OSL_ENSURE( xConfigProvider.is(), "lcl_getSystemLocale: could not create the config provider!" );
+
+                if ( !xConfigProvider.is() )
+                    return sLocaleString;
+
+                //.........................................................
+                // arguments for creating the config access
+                Sequence< Any > aArguments(2);
+                // the path to the node to open
+                ::rtl::OUString sNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Setup/L10N" );
+                aArguments[0] <<= PropertyValue( ::rtl::OUString::createFromAscii( "nodepath"), 0,
+                    makeAny( sNodePath ), PropertyState_DIRECT_VALUE
+                );
+                // the depth: -1 means unlimited
+                aArguments[1] <<= PropertyValue(
+                    ::rtl::OUString::createFromAscii( "depth"), 0,
+                    makeAny( (sal_Int32)-1 ), PropertyState_DIRECT_VALUE
+                );
+
+                //.........................................................
+                // create the access
+                Reference< XPropertySet > xNode(
+                    xConfigProvider->createInstanceWithArguments(
+                        ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
+                        aArguments ),
+                    UNO_QUERY );
+                OSL_ENSURE( xNode.is(), "lcl_getSystemLocale: invalid access returned (should throw an exception instead)!" );
+
+                //.........................................................
+                // ask for the system locale setting
+                if ( xNode.is() )
+                    xNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooSetupSystemLocale" ) ) ) >>= sLocaleString;
+            }
+            catch( const Exception& )
+            {
+                OSL_ENSURE( sal_False, "lcl_getSystemLocale: caught an exception!" );
+            }
+            if ( !sLocaleString.getLength() )
+            {
+                rtl_Locale* pProcessLocale = NULL;
+                osl_getProcessLocale( &pProcessLocale );
+
+                ::rtl::OUStringBuffer aProcLocale;
+                aProcLocale.append( pProcessLocale->Language->buffer, pProcessLocale->Language->length );
+                if ( pProcessLocale->Country->length )
+                {
+                    aProcLocale.appendAscii( "-" );
+                    aProcLocale.append( pProcessLocale->Country->buffer, pProcessLocale->Country->length );
+                }
+                sLocaleString = aProcLocale.makeStringAndClear();
+            }
+            return sLocaleString;
+        }
+    }
+    //------------------------------------------------------------------
+    void ODriverDelegator::onConnectedNewDatabase( const Reference< XConnection >& _rxConnection )
+    {
+        try
+        {
+            Reference< XStatement > xStatement = _rxConnection->createStatement();
+            OSL_ENSURE( xStatement.is(), "ODriverDelegator::onConnectedNewDatabase: could not create a statement!" );
+            if ( xStatement.is() )
+            {
+                ::rtl::OUStringBuffer aStatement;
+                aStatement.appendAscii( "SET DATABASE COLLATION \"" );
+                aStatement.appendAscii( lcl_getCollationForLocale( lcl_getSystemLocale( m_xFactory ) ) );
+                aStatement.appendAscii( "\"" );
+
+                xStatement->execute( aStatement.makeStringAndClear() );
+            }
+        }
+        catch( const Exception& e )
+        {
+            OSL_ENSURE( sal_False, "ODriverDelegator::onConnectedNewDatabase: caught an exception!" );
+        }
+    }
+
+    //------------------------------------------------------------------
     //------------------------------------------------------------------
 //........................................................................
 }   // namespace connectivity


Use a normal vector for the chorus sample buffer

--- Alc/effects/chorus.cpp
+++ Alc/effects/chorus.cpp
@@ -31,6 +31,7 @@
 #include "alError.h"
 #include "alu.h"
 #include "filters/defs.h"
+#include "vector.h"

 static_assert(AL_CHORUS_WAVEFORM_SINUSOID == AL_FLANGER_WAVEFORM_SINUSOID, "Chorus/Flanger waveform value mismatch");
@@ -42,8 +43,7 @@
 };

 struct ALchorusState final : public ALeffectState {
-    ALfloat *mSampleBuffer{nullptr};
-    ALsizei mBufferLength{0};
+    al::vector<ALfloat,16> mSampleBuffer;
     ALsizei mOffset{0};

     ALsizei mLfoOffset{0};
@@ -82,9 +82,6 @@

 static ALvoid ALchorusState_Destruct(ALchorusState *state)
 {
-    al_free(state->mSampleBuffer);
-    state->mSampleBuffer = NULL;
-
     ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
     state->~ALchorusState();
 }
@@ -92,22 +89,18 @@
 static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Device)
 {
     const ALfloat max_delay = maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY);
-    ALsizei maxlen;
+    size_t maxlen;

     maxlen = NextPowerOf2(float2int(max_delay*2.0f*Device->Frequency) + 1u);
     if(maxlen <= 0) return AL_FALSE;

-    if(maxlen != state->mBufferLength)
-    {
-        void *temp = al_calloc(16, maxlen * sizeof(ALfloat));
-        if(!temp) return AL_FALSE;
-
-        al_free(state->mSampleBuffer);
-        state->mSampleBuffer = static_cast<float*>(temp);
-        state->mBufferLength = maxlen;
-    }
-
-    std::fill_n(state->mSampleBuffer, state->mBufferLength, 0.0f);
+    if(maxlen != state->mSampleBuffer.size())
+    {
+        state->mSampleBuffer.resize(maxlen);
+        state->mSampleBuffer.shrink_to_fit();
+    }
+
+    std::fill(state->mSampleBuffer.begin(), state->mSampleBuffer.end(), 0.0f);
     for(auto &e : state->mGains)
     {
         std::fill(std::begin(e.Current), std::end(e.Current), 0.0f);
@@ -214,10 +207,10 @@

 static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesIn)[BUFFERSIZE], ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
 {
-    const ALsizei bufmask = state->mBufferLength-1;
+    const ALsizei bufmask = state->mSampleBuffer.size()-1;
     const ALfloat feedback = state->mFeedback;
     const ALsizei avgdelay = (state->mDelay + (FRACTIONONE>>1)) >> FRACTIONBITS;
-    ALfloat *RESTRICT delaybuf = state->mSampleBuffer;
+    ALfloat *RESTRICT delaybuf = state->mSampleBuffer.data();
     ALsizei offset = state->mOffset;
     ALsizei i, c;
     ALsizei base;


Fix http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17062&hilit=unzoom When an UnZoom was performed on the Y-Axis any plot but an histogram, the label axis size was reset.

--- hist/hist/src/TAxis.cxx
+++ hist/hist/src/TAxis.cxx
@@ -1098,8 +1098,8 @@
          hobj1->SetMinimum(fXmin);
          hobj1->SetMaximum(fXmax);
       } else {
-         hobj1->SetMinimum();
-         hobj1->SetMaximum();
+         hobj1->SetMinimum(fXmin);
+         hobj1->SetMaximum(fXmax);
          hobj1->ResetBit(TH1::kIsZoomed);
       }
    }


silly bug in outputting an array to a string

--- template_spec/vectors.cpp
+++ template_spec/vectors.cpp
@@ -75,7 +75,7 @@
     oss << "[ ";
     if (size > 0)
       oss << static_cast<std::string>((*(std::static_pointer_cast<array>(m_data)))[0]);
-    for (int i=0; i < size; i++)
+    for (int i=1; i < size; i++)
     {
       oss << ", " << static_cast<std::string>((*(std::static_pointer_cast<array>(m_data)))[i]);
     }


lib/core/object/io/parser: read unsigned byte from stream to avoid sign extension.¹

1: Hello and thank you!! Unsigned value (p.c, p.nc) was getting those
extended bits. Probably because I'm blind to C-ey conversion crap,
but this makes more sense anyways.

--- lib/core/src/quanta/core/object/io/parser.ipp
+++ lib/core/src/quanta/core/object/io/parser.ipp
@@ -335,7 +335,7 @@
 		goto l_return;
 	}

-	{char c = '\0';
+	{u8 c = '\0';
 	do {} while (io::read_value(p.stream, c) && c == '\r');
 	p.c = c;
 	IOStatus const& status = io::status(p.stream);
@@ -359,7 +359,7 @@
 	if (p.nc != PC_PEEK_EMPTY) {
 		return p.nc;
 	}
-	char c = '\0';
+	u8 c = '\0';
 	do {} while (io::read_value(p.stream, c) && c == '\r');
 	p.nc = c;
 	IOStatus const& status = io::status(p.stream);


VR: merge all after processAssume

VR: merge all after processAssume

--- lib/llvm/ValueRelations/RelationsAnalyzer.cpp
+++ lib/llvm/ValueRelations/RelationsAnalyzer.cpp
@@ -1029,7 +1029,6 @@
         processInstruction(newGraph, inst);

     } else if (op->isAssume()) {
-        newGraph.merge(source->relations, Relations().pt());
         bool shouldMerge;
         if (op->isAssumeBool())
             shouldMerge = processAssumeBool(source->relations, newGraph,
@@ -1037,9 +1036,10 @@
         else // isAssumeEqual
             shouldMerge = processAssumeEqual(source->relations, newGraph,
                                              static_cast<VRAssumeEqual *>(op));
-        if (shouldMerge)
-            newGraph.merge(source->relations, comparative);
-
+        if (shouldMerge) {
+            bool result = newGraph.merge(source->relations);
+            assert(result);
+        }
     } else { // else op is noop
         newGraph.merge(source->relations, allRelations);
     }


This patch from Philippe enables TChains to load (via Add) trees that are stored in directory
of the same name as themselves.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@2648 27541ba8-7e3a-0410-8455-c3a389f83636

--- base/src/TDirectory.cxx
+++ base/src/TDirectory.cxx
@@ -1,4 +1,4 @@
-// @(#)root/base:$Name:  $:$Id: TDirectory.cxx,v 1.12 2001/05/31 08:47:43 brun Exp $
+// @(#)root/base:$Name:  $:$Id: TDirectory.cxx,v 1.13 2001/06/02 10:01:50 brun Exp $
 // Author: Rene Brun   28/11/94

 /*************************************************************************
@@ -734,14 +734,20 @@
 //                        ========================
    TObject *idcur = fList->FindObject(namobj);
    if (idcur) {
-      if (cycle == 9999) {
+      if (idcur==gDirectory && strlen(namobj)!=0) {
+         // The object has the same name has the directory and
+         // that's what we picked-up!  We just need to ignore
+         // it ...
+         idcur = 0;
+      } else if (cycle == 9999) {
          cursav->cd();
          return idcur;
-      }
-      if (idcur->InheritsFrom(TCollection::Class()))
-         idcur->Delete();  // delete also list elements
-      delete idcur;
-      idcur = 0;
+      } else {
+         if (idcur->InheritsFrom(TCollection::Class()))
+            idcur->Delete();  // delete also list elements
+         delete idcur;
+         idcur = 0;
+      }
    }

 //*-*---------------------Case of Key---------------------


added option "m" to Print() to allow millisecond precision in the
real time reporting. By Maarten.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@5399 27541ba8-7e3a-0410-8455-c3a389f83636

--- base/src/TStopwatch.cxx
+++ base/src/TStopwatch.cxx
@@ -1,4 +1,4 @@
-// @(#)root/base:$Name:  $:$Id: TStopwatch.cxx,v 1.4 2000/12/13 15:13:46 brun Exp $
+// @(#)root/base:$Name:  $:$Id: TStopwatch.cxx,v 1.5 2002/06/13 13:42:55 rdm Exp $
 // Author: Fons Rademakers   11/10/95

 /*************************************************************************
@@ -142,7 +142,7 @@
    // stopwatch was still running stop it first.

    if (fState == kUndefined)
-      Error("RealTime", "stopwatch not started");
+      Error("CpuTime", "stopwatch not started");

    if (fState == kRunning)
       Stop();
@@ -238,23 +238,36 @@
 }

 //______________________________________________________________________________
-void TStopwatch::Print(Option_t *) const
+void TStopwatch::Print(Option_t *opt) const
 {
    // Print the real and cpu time passed between the start and stop events.
    // and the number of times (slices) this TStopwatch was called
-   // (if this number > 1)
-
-   Double_t  realt = ((TStopwatch*)this)->RealTime();
+   // (if this number > 1). If opt="m" printout realtime in milli second
+   // precision.
+
+   Double_t  realt = const_cast<TStopwatch*>(this)->RealTime();
+   Double_t  cput  = const_cast<TStopwatch*>(this)->CpuTime();

    Int_t  hours = Int_t(realt / 3600);
    realt -= hours * 3600;
    Int_t  min   = Int_t(realt / 60);
    realt -= min * 60;
    Int_t  sec   = Int_t(realt);
-   Int_t counter = Counter();
-   if (counter <= 1 )
-      Printf("Real time %d:%d:%d, CP time %.3f", hours, min, sec, ((TStopwatch*)this)->CpuTime());
-   else
-      Printf("Real time %d:%d:%d, CP time %.3f, %d slices", hours, min, sec, ((TStopwatch*)this)->CpuTime(),counter);
-}
-
+
+   realt = TMath::Max(realt, 0.);
+   cput  = TMath::Max(cput, 0.);
+
+   if (opt && *opt == 'm') {
+      if (Counter() > 1) {
+         Printf("Real time %d:%02d:%06.3f, CP time %.3f, %d slices", hours, min, realt, cput, Counter());
+      } else {
+         Printf("Real time %d:%02d:%06.3f, CP time %.3f", hours, min, realt, cput);
+      }
+   } else {
+      if (Counter() > 1) {
+         Printf("Real time %d:%02d:%02d, CP time %.3f, %d slices", hours, min, sec, cput, Counter());
+      } else {
+         Printf("Real time %d:%02d:%02d, CP time %.3f", hours, min, sec, cput);
+      }
+   }
+}


Add a new test

Add a new test

--- test/IntegrationTests.cpp
+++ test/IntegrationTests.cpp
@@ -685,6 +685,12 @@
     BOOST_REQUIRE_EQUAL(stats.counter("loop_unrolled"), 1);
 }

+BOOST_AUTO_TEST_CASE( loop_unswitching ){
+    auto& stats = compute_stats_mtac("loop_unswitching.eddi");
+
+    BOOST_REQUIRE_EQUAL(stats.counter("loop_unswitched"), 1);
+}
+
 BOOST_AUTO_TEST_CASE( global_cse ){
     auto& stats = compute_stats_mtac("common_subexpr_elim.eddi");


Write CsvStatus file, even if verbose == 0

--- lib/smurff-cpp/SmurffCpp/Sessions/Session.cpp
+++ lib/smurff-cpp/SmurffCpp/Sessions/Session.cpp
@@ -184,7 +184,7 @@
 void Session::save(int iteration) const
 {
    //do not save if 'never save' mode is selected
-   if (!m_config.getSaveFreq())
+   if (!m_config.getSaveFreq() && !m_config.getCsvStatus().size())
       return;

    std::int32_t isample = iteration - m_config.getBurnin() + 1;


Trivial commit.

Trivial commit.

--- libtbag/archive/Zip.cpp
+++ libtbag/archive/Zip.cpp
@@ -138,10 +138,10 @@
         return ResultCode::GO_TO_FIRST_FILE_ERROR;
     }

-    std::size_t const MAX_PATH    = 256;
-    std::size_t const MAX_COMMENT = 256;
+    std::size_t const MAX_PATH_LENGTH = 256;
+    std::size_t const MAX_COMMENT     = 256;

-    char filename[MAX_PATH] = {0,};
+    char filename[MAX_PATH_LENGTH] = {0,};
     char  comment[MAX_COMMENT] = {0,};

     std::size_t const INPUT_BUFFER = 2048;
@@ -150,7 +150,7 @@
     unz_file_info info;

     do {
-        unzGetCurrentFileInfo(uf, &info, filename, MAX_PATH, nullptr, 0, comment, MAX_COMMENT);
+        unzGetCurrentFileInfo(uf, &info, filename, MAX_PATH_LENGTH, nullptr, 0, comment, MAX_COMMENT);

          //std::cout << "NAME("        << filename
          //          << ") COMP_SIZE(" << info.compressed_size


Print how long it took to save

Print how long it took to save

--- lib/smurff-cpp/SmurffCpp/Sessions/Session.cpp
+++ lib/smurff-cpp/SmurffCpp/Sessions/Session.cpp
@@ -279,11 +279,18 @@
    {
       std::cout << "-- Saving model, predictions,... into '" << stepFile->getStepFileName() << "'." << std::endl;
    }
+   double start = tick();

    BaseSession::save(stepFile);

    //flush last item in a root file
    m_rootFile->flushLast();
+
+   double stop = tick();
+   if (m_config.getVerbose())
+   {
+      std::cout << "-- Done saving model. Took " << stop - start << " seconds." << std::endl;
+   }
 }

 bool Session::restore(int& iteration)


[libvroomjs] Added callback to dispose of managed references

--- libvroomjs/jsengine.cpp
+++ libvroomjs/jsengine.cpp
@@ -53,6 +53,14 @@
     return ref->Invoke(args);
 }

+static void managed_destroy(Persistent<Value> object, void* parameter)
+{
+    Persistent<Object> self = Persistent<Object>::Cast(object);
+    Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+    delete (ManagedRef*)wrap->Value();
+    object.Dispose();
+}
+
 JsEngine* JsEngine::New()
 {
     JsEngine* engine = new JsEngine();
@@ -365,11 +373,11 @@
         }
     }
     else if (value->IsFunction()) {
-
+        // TODO: how do we represent this on the CLR side? Delegate?
     }
     else if (value->IsObject()) {
         Handle<Object> obj = Handle<Object>::Cast(value);
-        if (obj->InternalFieldCount() == 1)
+        if (obj->InternalFieldCount() ==     1)
             v = ManagedFromV8(obj);
         else
             v = WrappedFromV8(obj);
@@ -406,8 +414,9 @@

     if (v.type == JSVALUE_TYPE_MANAGED || v.type == JSVALUE_TYPE_MANAGED_ERROR) {
         ManagedRef* ref = new ManagedRef(this, v.length);
-        Local<Object> obj = (*(managed_template_))->NewInstance();
+        Persistent<Object> obj = Persistent<Object>::New((*(managed_template_))->NewInstance());
         obj->SetInternalField(0, External::New(ref));
+        obj.MakeWeak(NULL, managed_destroy);
         return obj;
     }


Fix bug in math comparison

Fix bug in math comparison

--- headerlib/hdr/math.hpp
+++ headerlib/hdr/math.hpp
@@ -46,7 +46,7 @@
 struct Div<Bool<a>, Bool<b>>;

 template<typename _Tp, _Tp a, _Tp b>
-struct Compare<Value<a>, Value<b>> { using type = Value<(a < b)>; };
+struct Compare<Value<a>, Value<b>> { using type = ::hdr::std::FromStdBool<(a < b)>; };

 /// Boolean manipulators
 using not_     = Lambda<_0, False, True>;


fix for wrong number of outlets when typing [jcom.in~ 0]

git-svn-id: c70bd4441ad5e0563430019b01ef925cf1c0ee30@4126 464221e2-0a0f-0410-983b-f8d57d210c17

--- SourceCode/MaxObjects/jcom.in/jcom.in.cpp
+++ SourceCode/MaxObjects/jcom.in/jcom.in.cpp
@@ -117,7 +117,7 @@

 		if(attrstart > 0){
 			int argument = atom_getlong(argv);
-			x->numInputs = TTClip(argument, 1, MAX_NUM_CHANNELS);
+			x->numInputs = TTClip(argument, 0, MAX_NUM_CHANNELS);
 		}
 		else
 			x->outlet[0] = x->algout;  // no arguments send any input out the first outlet


[JAX] Include JAX operator type in MHLO locations.

PiperOrigin-RevId: 416031506
Change-Id: Ic63de20066e3875584686c896cdbf7dcc303dd2c

--- tensorflow/compiler/xla/pjrt/mlir_to_hlo.cc
+++ tensorflow/compiler/xla/pjrt/mlir_to_hlo.cc
@@ -57,8 +57,12 @@
   }

   HloProto proto;
+  mlir::MlirToHloConversionOptions options;
+  // We don't want the conversion to muck with our operator names.
+  options.legalize_node_names = false;
   TF_RETURN_IF_ERROR(
-      ConvertMlirHloToHlo(module, &proto, use_tuple_args, return_tuple));
+      ConvertMlirHloToHlo(module, &proto, use_tuple_args, return_tuple,
+                          /*shape_representation_fn=*/nullptr, options));

   xla_computation = XlaComputation(std::move(*proto.mutable_hlo_module()));
   return Status::OK();


Allow importing multiple space separated files at once
(cherry picked from commit 08981bfa6584306cf823491e6b6c0aaa6d0fcc1b)

Signed-off-by: Patrick Horn <322104af3445af534ee90747bcec0c770a7d7ab8@gmail.com>

--- liboh/plugins/ogre/OgreSystemMouseHandler.cpp
+++ liboh/plugins/ogre/OgreSystemMouseHandler.cpp
@@ -658,13 +658,21 @@
         std::cout << "input path name for import: " << std::endl;
         std::string filename;
         // a bit of a cludge right now, type name into console.
+        std::vector<std::string> files;
         fflush(stdin);
         while (!feof(stdin)) {
             int c = fgetc(stdin);
             if (c == '\r') {
                 c = fgetc(stdin);
             }
+            if (c==' ') {
+                files.push_back(filename);
+                filename="";
+                std::cout << '\n';
+                continue;
+            }
             if (c=='\n') {
+                files.push_back(filename);
                 break;
             }
             if (c=='\033' || c <= 0) {
@@ -675,8 +683,6 @@
             filename += (unsigned char)c;
         }
         std::cout << '\n';
-        std::vector<std::string> files;
-        files.push_back(filename);
         mParent->mInputManager->filesDropped(files);
     }


minor change per Penporn's code review suggestion

--- tensorflow/core/kernels/mkl/mkl_conv_ops.cc
+++ tensorflow/core/kernels/mkl/mkl_conv_ops.cc
@@ -581,7 +581,7 @@
                               : TFDataFormatToMklDnn3DDataFormat(data_format_);

       auto mkl_fmt_tag = MklTensorFormatToMklDnnDataFormat(tf_fmt);
-      // NOTE: 'mkl_fmt_tag` will be `format_tag::undef` for ReLU
+      // NOTE: `mkl_fmt_tag` will be `format_tag::undef` for ReLU
       OP_REQUIRES(context, mkl_fmt_tag != memory::format_tag::undef,
                   errors::InvalidArgument("Invalid data format"));

@@ -873,8 +873,7 @@
       if (!native_format && add_mkl_shape == *output_mkl_shape &&
           ForwardMklTensorInToOutWithMklShape(context, kInputIndex_Add,
                                               kOutputIndex_Dst, output_tensor,
-                                              add_mkl_shape, false) &&
-          !native_format) {
+                                              add_mkl_shape, false)) {
         return;
       } else {
         AllocateOutputSetMklShape(context, kOutputIndex_Dst, output_tensor,
@@ -1127,7 +1126,7 @@
     const Tensor& cached_filter_md =
         *cached_filter_md_ptensor_.AccessTensor(context);

-    // Check if the memory descriptor of the cached weights is same as
+    // Check if the memory descriptor of the cached weights is the same as
     // filter_md. If so, we can use the cached weights; otherwise
     // return nullptr.
     if (filter_md == *static_cast<memory::desc*>(cached_filter_md.data())) {
@@ -1701,17 +1700,18 @@
       // if summand_type is also DT_QUINT8 as the scale_output,
       // the scaling factor of 255.0f cancels each other and thus is avoided.
       // If it is not then  it is DT_INT8 and is scaled appropriately.
-      if (summand_type == DT_QUINT8)
+      if (summand_type == DT_QUINT8) {
         params.post_op_params.push_back({"sum",
                                          mkldnn::algorithm::undef,
                                          {scale_summand / scale_output},
                                          ""});
-      else
+      } else {
         params.post_op_params.push_back(
             {"sum",
              mkldnn::algorithm::undef,
              {255.0f * scale_summand / (scale_output * 127.0f)},
              ""});
+      }
     } else {
       params.post_op_params.push_back(
           {"sum", mkldnn::algorithm::undef, {1.0}, ""});


Fix compile on mac: format string mismatch error.

See http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg/builds/9542/steps/compile%20%28with%20patch%29/logs/stdio

TBR=jun_fang@foxitsoftware.com,

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

--- samples/pdfium_test.cc
+++ samples/pdfium_test.cc
@@ -359,8 +359,8 @@
   FPDF_CloseDocument(doc);
   FPDFAvail_Destroy(pdf_avail);

-  printf("Loaded, parsed and rendered %d pages.\n", rendered_pages);
-  printf("Skipped %d bad pages.\n", bad_pages);
+  printf("Loaded, parsed and rendered %zu pages.\n", rendered_pages);
+  printf("Skipped %zu bad pages.\n", bad_pages);
 }

 int main(int argc, const char* argv[]) {


Fix FPE issue in external Eigen source code issue with `tf.raw_ops.SparseMatMul`.

PiperOrigin-RevId: 370992919
Change-Id: Icfb276fef5fb40928b27c3e44608d2aca72c9fd7

--- tensorflow/core/kernels/sparse_matmul_op.cc
+++ tensorflow/core/kernels/sparse_matmul_op.cc
@@ -1039,6 +1039,10 @@
     if (transpose_b) {
       // TODO(agarwal): avoid transposing the matrix here and directly handle
       // transpose in CreateDenseSlices.
+      OP_REQUIRES(ctx, right->dim_size(0) != 0,
+                  errors::InvalidArgument("b has an entry 0 in it's shape."));
+      OP_REQUIRES(ctx, right->dim_size(1) != 0,
+                  errors::InvalidArgument("b has an entry 0 in it's shape."));
       right_tr.reset(
           new Tensor(right->dtype(),
                      TensorShape({right->dim_size(1), right->dim_size(0)})));


- Updated ExportFolderProperties to support PT_LONG, PT_BOOLEAN, PT_BINARY - Changed it to output I8 in base 10 when it's not a FID

--- MAPIFolders/ExportFolderPropertiesOperation.cpp
+++ MAPIFolders/ExportFolderPropertiesOperation.cpp
@@ -100,8 +100,40 @@
 			}
 			else
 			{
-				*exportFile << std::hex << thisProp.Value.li.QuadPart;
+				*exportFile << thisProp.Value.li.QuadPart;
 			}
+		}
+		else if (PROP_TYPE(thisProp.ulPropTag) == PT_LONG)
+		{
+			*exportFile << thisProp.Value.l;
+		}
+		else if (PROP_TYPE(thisProp.ulPropTag) == PT_BOOLEAN)
+		{
+			if (thisProp.Value.b)
+			{
+				*exportFile << "True";
+			}
+			else
+			{
+				*exportFile << "False";
+			}
+		}
+		else if (PROP_TYPE(thisProp.ulPropTag) == PT_BINARY)
+		{
+			for (ULONG i = 0; i < thisProp.Value.bin.cb; i++)
+			{
+				BYTE oneByte = thisProp.Value.bin.lpb[i];
+				if (oneByte < 0x10)
+				{
+					*exportFile << _T("0");
+				}
+
+				*exportFile << std::hex << oneByte;
+			}
+		}
+		else
+		{
+			*exportFile << _T("MAPIFolders cannot export this property type");
 		}

 		if (y + 1 < cCount)


INTEGRATION: CWS ia64port01_DEV300 (1.3.8); FILE MERGED 2008/02/18 10:40:37 cmc 1.3.8.1: #i84999# follow sb's suggested pattern, stage 1, gcc3_linux_*

--- bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx
+++ bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx
@@ -4,11 +4,11 @@
  *
  *  $RCSfile: cpp2uno.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.4 $
  *
  *  Wrote by Fuxin Zhang. fxzhang@ict.ac.cn.
  *
- *  last change: $Author: ihi $ $Date: 2007-11-22 16:47:04 $
+ *  last change: $Author: obo $ $Date: 2008-02-27 09:54:38 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -726,37 +726,38 @@
   sysmips(FLUSH_CACHE,0,0,0);
 }

-
-
-void ** bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
+struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
+
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
 {
-  return reinterpret_cast< void ** >(block) + 2;
+    return static_cast< Slot * >(block) + 2;
 }

 sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
     sal_Int32 slotCount)
 {
-    return (slotCount + 2) * sizeof (void *) + slotCount * codeSnippetSize;
+    return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
 }

-void ** bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block) {
-    void ** slots = mapBlockToVtable(block);
-     slots[-2] = 0; //null
-     slots[-1] = 0; //destructor
-    return slots;
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::initializeBlock(
+    void * block, sal_Int32 slotCount)
+{
+    Slot * slots = mapBlockToVtable(block);
+    slots[-2].fn = 0; //null
+    slots[-1].fn = 0; //destructor
+    return slots + slotCount;
 }

 unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
-    void ** slots, unsigned char * code,
+    Slot ** slots, unsigned char * code,
     typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
-    sal_Int32
-#ifdef BRDEBUG
-       functionCount
-#endif
-    , sal_Int32 vtableOffset)
+    sal_Int32 functionCount, sal_Int32 vtableOffset)
 {
-
+   (*slots) -= functionCount;
+    Slot * s = *slots;
 #ifdef BRDEBUG
    fprintf(stderr, "in addLocalFunctions functionOffset is %d\n",functionOffset);
    fprintf(stderr, "in addLocalFunctions vtableOffset is %d\n",vtableOffset);
@@ -771,7 +772,7 @@
     switch (member->eTypeClass) {
       case typelib_TypeClass_INTERFACE_ATTRIBUTE:
         // Getter:
-        *slots++ = code;
+        (s++)->fn = code;
         code = codeSnippet(
             code, functionOffset++, vtableOffset,
             bridges::cpp_uno::shared::isSimpleType(
@@ -784,13 +785,13 @@
             typelib_InterfaceAttributeTypeDescription * >(
               member)->bReadOnly)
         {
-          *slots++ = code;
+          (s++)->fn = code;
           code = codeSnippet(code, functionOffset++, vtableOffset, true);
         }
         break;

       case typelib_TypeClass_INTERFACE_METHOD:
-        *slots++ = code;
+        (s++)->fn = code;
         code = codeSnippet(
             code, functionOffset++, vtableOffset,
             bridges::cpp_uno::shared::isSimpleType(


Update MATHS.C

Update MATHS.C

Correct mSqrt
Correct phd_sqrt_asm
Correct phd_atan_asm


Adding rol1, ror1 as fast 1-bit rotate

Adding rol1, ror1 as fast 1-bit rotate

--- nthash.hpp
+++ nthash.hpp
@@ -164,6 +164,11 @@
     return (v);
 }*/

+// rotate "v" to the left 1 position
+inline uint64_t rol1(const uint64_t v) {
+    return (v << 1) | (v >> 63);
+}
+
 // rotate "v" to the left by "s" positions
 inline uint64_t rol(const uint64_t v, int s) {
     if ((s &= 63) == 0)
@@ -171,6 +176,11 @@
     return (v << s) | (v >> (64 - s));
 }

+// rotate "v" to the right by 1 position
+inline uint64_t ror1(const uint64_t v) {
+    return (v >> 1) | (v << 63);
+}
+
 // rotate "v" to the right by "s" positions
 inline uint64_t ror(const uint64_t v, int s) {
     if ((s &= 63) == 0)
@@ -201,7 +211,7 @@

 // ntHash for sliding k-mers, using rotate ops
 inline uint64_t NT64(const uint64_t fhVal, const unsigned char charOut, const unsigned char charIn, const unsigned k) {
-    return(rol(fhVal, 1) ^ rol(seedTab[charOut], k) ^ seedTab[charIn]);
+    return(rol1(fhVal) ^ rol(seedTab[charOut], k) ^ seedTab[charIn]);
 }

 // ntHash with seeding option, using rotate ops
@@ -231,8 +241,8 @@

 // canonical ntHash for sliding k-mers, using rotate ops
 inline uint64_t NTC64(const unsigned char charOut, const unsigned char charIn, const unsigned k, uint64_t& fhVal, uint64_t& rhVal) {
-    fhVal = rol(fhVal, 1) ^ rol(seedTab[charOut], k) ^ seedTab[charIn];
-    rhVal = ror(rhVal, 1) ^ ror(seedTab[charOut&cpOff], 1) ^ rol(seedTab[charIn&cpOff], k-1);
+    fhVal = rol1(fhVal) ^ rol(seedTab[charOut], k) ^ seedTab[charIn];
+    rhVal = ror1(rhVal) ^ ror1(seedTab[charOut&cpOff]) ^ rol(seedTab[charIn&cpOff], k-1);
     return (rhVal<fhVal)? rhVal : fhVal;
 }

@@ -258,7 +268,7 @@

 // ntHash for sliding k-mers
 inline uint64_t NTP64(const uint64_t fhVal, const unsigned char charOut, const unsigned char charIn, const unsigned k) {
-    return(rol(fhVal, 1) ^ msTab[charOut][k%64] ^ msTab[charIn][0]);
+    return(rol1(fhVal) ^ msTab[charOut][k%64] ^ msTab[charIn][0]);
 }

 // ntBase with seeding option
@@ -293,8 +303,8 @@

 // canonical ntHash for sliding k-mers
 inline uint64_t NTPC64(const unsigned char charOut, const unsigned char charIn, const unsigned k, uint64_t& fhVal, uint64_t& rhVal) {
-    fhVal = rol(fhVal, 1) ^ msTab[charOut][k%64] ^ msTab[charIn][0];
-    rhVal = ror(rhVal, 1) ^ msTab[charOut&cpOff][63] ^ msTab[charIn&cpOff][(k-1)%64];
+    fhVal = rol1(fhVal) ^ msTab[charOut][k%64] ^ msTab[charIn][0];
+    rhVal = ror1(rhVal) ^ msTab[charOut&cpOff][63] ^ msTab[charIn&cpOff][(k-1)%64];
     return (rhVal<fhVal)? rhVal : fhVal;
 }

@@ -329,7 +339,7 @@
 // multihash ntHash for sliding k-mers
 inline void NTM64(const unsigned char charOut, const unsigned char charIn, const unsigned k, const unsigned m, uint64_t *hVal) {
     uint64_t bVal=0, tVal=0;
-    bVal = rol(hVal[0], 1) ^ msTab[charOut][k%64] ^ msTab[charIn][0];
+    bVal = rol1(hVal[0]) ^ msTab[charOut][k%64] ^ msTab[charIn][0];
     hVal[0] = bVal;
     for(unsigned i=1; i<m; i++) {
         tVal = bVal * (i ^ k * multiSeed);


add todo remark.

add todo remark.

--- src/ds5/ds5-device.cpp
+++ src/ds5/ds5-device.cpp
@@ -652,6 +652,7 @@

     double ds5_device::get_device_time_ms()
     {
+        // TODO: Refactor the following query with an extension.
         if (dynamic_cast<const platform::playback_backend*>(&(get_context()->get_backend())) != nullptr)
         {
             throw not_implemented_exception("device time not supported for backend.");


UPDATE Cleanup and initializing some new variables

--- SSPSolution/AIDLL/AIHandler.cpp
+++ SSPSolution/AIDLL/AIHandler.cpp
@@ -178,9 +178,11 @@
 	newComponent->m_position = DirectX::XMVECTOR();

 	newComponent->m_triggered = false;
+	newComponent->m_pattern = 0;
 	newComponent->m_time = 0;
 	newComponent->m_speed = 0;
 	newComponent->m_direction = 0;
+	newComponent->m_nextWaypoint = 0;
 	newComponent->m_currentWaypoint = 0;
 	newComponent->m_nrOfWaypoint = 0;

@@ -214,13 +216,6 @@

 int AIHandler::GetNextWaypoint(int compID, int pattern)
 {
-	/*const int ARR_LEN = 10;
-
-	int arr[ARR_LEN] = { 0,1,2,3,4,5,6,7,8,9 };
-
-	for (int i = 0; i < ARR_LEN * 2; ++i)
-	cout << arr[i % ARR_LEN] << " ";*/
-
 	int next = this->m_AIComponents.at(compID)->m_currentWaypoint;
 	int current = this->m_AIComponents.at(compID)->m_nextWaypoint;

@@ -230,7 +225,7 @@
 	}
 	else
 	{
-		//if (this->m_AIComponents.at(compID)->m_nrOfWaypoint)
+
 	}

 	if (next == current)
@@ -241,8 +236,6 @@
 	this->m_AIComponents.at(compID)->m_currentWaypoint;
 	this->m_AIComponents.at(compID)->m_direction;

-	//this->m_AIComponents.at(compID)->m_waypoints[i];
-
 	return 0;
 }