Include ranges in GRSimpleVals diagnostics.

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

--- lib/Analysis/GRSimpleVals.cpp
+++ lib/Analysis/GRSimpleVals.cpp
@@ -51,7 +51,9 @@
 unsigned ErrorDiag, ITERATOR I) {

   Stmt* S = GetStmt(GetLocation(I));
-  Diag.Report(PD, FullSourceLoc(S->getLocStart(), SrcMgr), ErrorDiag);
+  SourceRange R = S->getSourceRange();
+  Diag.Report(PD, FullSourceLoc(S->getLocStart(), SrcMgr), ErrorDiag,
+              NULL, 0, &R, 1);
 }


fix harmless typo in InputsChannel::handle_modifiers

InputsChannel::handle_modifiers converts _modifiers which is a
bitflag of SPICE_KEYBOARD_MODIFIER_FLAGS_* to a Platform::*_MODIFIER
bitflag, which is what Platform::set_keyboard_lock_modifiers expects.
However, it's called with _modifiers, and the bitflag that this
function computes is never used. Pass the computed bitflag to
::set_keyboard_lock_modifiers since _modifiers format is meaningless
for ::set_keyboard_lock_modifiers.
This bug was harmless because the two different set of modifier
flags actually use the same values, so _modifiers and modifiers could
be used interchangeably. However it's more future-proof to use the
right format here.

--- client/inputs_channel.cpp
+++ client/inputs_channel.cpp
@@ -402,7 +402,7 @@
         modifiers |= Platform::CAPS_LOCK_MODIFIER;
     }

-    Platform::set_keyboard_lock_modifiers(_modifiers);
+    Platform::set_keyboard_lock_modifiers(modifiers);
 }

 void InputsChannel::on_focus_in()


ARM64: fix epilog label

ARM64: fix epilog label

--- lib/Backend/arm64/LowerMD.cpp
+++ lib/Backend/arm64/LowerMD.cpp
@@ -6682,9 +6682,16 @@
         return this->m_func->m_epilogLabel;
     }

+    IR::Instr *exitInstr = this->m_func->m_exitInstr;
+    IR::Instr *prevInstr = exitInstr->GetPrevRealInstrOrLabel();
+    if (prevInstr->IsLabelInstr())
+    {
+        this->m_func->m_epilogLabel = prevInstr->AsLabelInstr();
+        return prevInstr->AsLabelInstr();
+    }
     IR::LabelInstr *labelInstr = IR::LabelInstr::New(Js::OpCode::Label, this->m_func);
+    exitInstr->InsertBefore(labelInstr);
     this->m_func->m_epilogLabel = labelInstr;
-    this->m_func->m_exitInstr->InsertBefore(labelInstr);
     return labelInstr;
 }


ARM64: fix epilog with large stacks

ARM64: fix epilog with large stacks

--- lib/Backend/arm64/LowerMD.cpp
+++ lib/Backend/arm64/LowerMD.cpp
@@ -1374,8 +1374,8 @@
     // Recover FP and LR
     if (layout.HasCalls())
     {
-        // SUB fp, sp, #offs
-        ULONG fpOffset = layout.FpLrOffset();
+        // SUB sp, fp, #offs
+        ULONG fpOffset = layout.FpLrOffset() - stackAllocation2;
         IR::Instr * instrSub = IR::Instr::New(Js::OpCode::SUB, spOpnd, fpOpnd, IR::IntConstOpnd::New(fpOffset, TyMachReg, this->m_func), this->m_func);
         exitInstr->InsertBefore(instrSub);
         Legalize(instrSub);


-Wshadow

-Wshadow

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

--- html/src/TDocOutput.cxx
+++ html/src/TDocOutput.cxx
@@ -490,9 +490,9 @@
             }
             gInterpreter->Reset();
             gInterpreter->ResetGlobals();
-            TIter iTimer(gSystem->GetListOfTimers());
+            TIter iTimerRemove(gSystem->GetListOfTimers());
             TTimer* timer = 0;
-            while ((timer = (TTimer*) iTimer()))
+            while ((timer = (TTimer*) iTimerRemove()))
                if (timersBefore.find(timer) == timersBefore.end())
                   gSystem->RemoveTimer(timer);
          }


WaE unused parameter

WaE unused parameter

--- basic/source/uno/dlgcont.cxx
+++ basic/source/uno/dlgcont.cxx
@@ -486,7 +486,7 @@
 }

 sal_Bool SAL_CALL
-SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& /*Library*/ ) throw (uno::RuntimeException)
 {
     return sal_False; // dialog library has no executable code
 }


Fix for http://buildstatus/Issues/Issues.aspx?iid=797159

[tfs-changeset: 1601059]

--- src/vm/readytoruninfo.cpp
+++ src/vm/readytoruninfo.cpp
@@ -95,8 +95,8 @@
     if (m_availableTypesHashtable.IsNull())
         return FALSE;

-    LPCUTF8 pszName;
-    LPCUTF8 pszNameSpace;
+    LPCUTF8 pszName = NULL;
+    LPCUTF8 pszNameSpace = NULL;

     //
     // Compute the hashcode of the type (hashcode based on type name and namespace name)


[bhfuse]Rename old Qt-name to reflect boost-filesystem.

--- clients/bhfuse/fuse++.cpp
+++ clients/bhfuse/fuse++.cpp
@@ -95,16 +95,17 @@
 	/************************************************************************************
 	* FUSE_lowlevel_ops struct, pointing to the C++-class-wrappers.
 	***********************************************************************************/
-	static fuse_lowlevel_ops qfs_ops;
-	bzero(&qfs_ops, sizeof(qfs_ops));
-	qfs_ops.lookup =  _op_lookup;
-	qfs_ops.forget =  _op_forget;
-	qfs_ops.getattr = _op_getattr;
-	qfs_ops.open =    _op_open;
-	qfs_ops.read =    _op_read;
-	qfs_ops.release = _op_release;
+	static fuse_lowlevel_ops bfs_ops;
+	bzero(&bfs_ops, sizeof(bfs_ops));
+	bfs_ops.init =    _op_init;
+	bfs_ops.lookup =  _op_lookup;
+	bfs_ops.forget =  _op_forget;
+	bfs_ops.getattr = _op_getattr;
+	bfs_ops.open =    _op_open;
+	bfs_ops.read =    _op_read;
+	bfs_ops.release = _op_release;

-	_fuse_session = fuse_lowlevel_new(&f_args, &qfs_ops, sizeof(qfs_ops), this);
+	_fuse_session = fuse_lowlevel_new(&f_args, &bfs_ops, sizeof(bfs_ops), this);
 	// scope(failure)fuse_session_destroy(s);

 	fuse_session_add_chan(_fuse_session, _fuse_chan);


Fixing sub w/ SET_CARRY.

Fixing sub w/ SET_CARRY.

--- src/alloy/backend/x64/lowering/lowering_sequences.cc
+++ src/alloy/backend/x64/lowering/lowering_sequences.cc
@@ -1809,9 +1809,25 @@
 table->AddSequence(OPCODE_SUB, [](X64Emitter& e, Instr*& i) {
   if (IsIntType(i->dest->type)) {
     IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
-      e.sub(dest_src, src);
+      if (i.flags & ARITHMETIC_SET_CARRY) {
+        auto Nax = LIKE_REG(e.rax, src);
+        e.mov(Nax, src);
+        e.not(Nax);
+        e.stc();
+        e.adc(dest_src, Nax);
+      } else {
+        e.sub(dest_src, src);
+      }
     }, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
-      e.sub(dest_src, src);
+      if (i.flags & ARITHMETIC_SET_CARRY) {
+        auto Nax = LIKE_REG(e.rax, dest_src);
+        e.mov(Nax, src);
+        e.not(Nax);
+        e.stc();
+        e.adc(dest_src, Nax);
+      } else {
+        e.sub(dest_src, src);
+      }
     });
   } else if (IsFloatType(i->dest->type)) {
     XmmBinaryOp(e, i, i->flags, [](X64Emitter& e, Instr& i, const Xmm& dest_src, const Xmm& src) {


Removed bad delete in read handler

Removed bad delete in read handler

--- proto_server/core/client/proto_tcp_text_client.cpp
+++ proto_server/core/client/proto_tcp_text_client.cpp
@@ -85,7 +85,7 @@
             if (!error)
             {
                 std::istream is(&read_stream_buffer_);
-                delete [] buffer_;
+                memset(buffer_, 0, buffer_size_);
                 is.get(buffer_, buffer_size_, '\0');

                 // handle a ps_read here


Fixed blue waterfall workaround bugs

Fixed blue waterfall workaround bugs

Bugs fixed:
1) Workaround was not running on DD1.03
2) Workaround was cuing off of number of ranks not rank pairs

Change-Id: Ic736aa5621361a965705a8ebf329415a2e817466
Original-Change-Id: I704435ce217827a593d39c7c7ea536946bd86e0c
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38369
Tested-by: Jenkins Server <8e3f934e4c44875bc48d33da3ea13d93ba9a233f@us.ibm.com>
Tested-by: Hostboot CI <52521565bd8ea18a2b112942dce4f4220a97c2c8@us.ibm.com>
Reviewed-by: JACOB L. HARVEY <3228c361e36065d481020c968085ab1d20e47d22@us.ibm.com>
Reviewed-by: Brian R. Silver <af0eed78d989d9597decc8b92fa6db01ef8b58e0@us.ibm.com>
Reviewed-by: Matt K. Light <19ba8ed73a0b3c376c81fced381f1ac0f483b7c2@us.ibm.com>
Reviewed-by: Louis Stermole <a2bef96d502debd02962600aef4d81d949c35039@us.ibm.com>
Reviewed-by: Daniel M. Crowell <912029ca9254ac7b5854e56910561d682e1fa2d0@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <65293609e29ccd0ac899f5f3f03aea95be1b215f@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <ab93eca12e43608f33daa16a67357cd7b7e867ab@us.ibm.com>

--- src/import/chips/p9/procedures/hwp/memory/lib/workarounds/dp16_workarounds.C
+++ src/import/chips/p9/procedures/hwp/memory/lib/workarounds/dp16_workarounds.C
@@ -351,11 +351,11 @@
     };

     // Gets the number of primary ranks to loop through
-    std::vector<uint64_t> l_primary_ranks;
-    FAPI_TRY(mss::rank::primary_ranks(i_target, l_primary_ranks));
+    std::vector<uint64_t> l_rank_pairs;
+    FAPI_TRY(mss::rank::get_rank_pairs(i_target, l_rank_pairs));

     // Loops through all configured rank pairs
-    for(uint64_t l_rp = 0; l_rp < l_primary_ranks.size(); ++l_rp)
+    for(const auto& l_rp : l_rank_pairs)
     {
         // Loops through all DP16s
         for(const auto& l_reg : l_dp16_registers[l_rp])


Register onPoseAvailable for ad_T_sos instead of calling TangoService_getPoseAtTime

--- tango_ros_common/tango_ros_native/src/tango_ros_node.cpp
+++ tango_ros_common/tango_ros_native/src/tango_ros_node.cpp
@@ -494,12 +494,13 @@
 TangoErrorType TangoRosNode::TangoConnect() {
   const char* function_name = "TangoRosNode::TangoConnect()";

-  TangoCoordinateFramePair pair;
-  pair.base = TANGO_COORDINATE_FRAME_START_OF_SERVICE;
-  pair.target = TANGO_COORDINATE_FRAME_DEVICE;
-
+  TangoCoordinateFramePair pairs[2] = {
+         {TANGO_COORDINATE_FRAME_START_OF_SERVICE,
+          TANGO_COORDINATE_FRAME_DEVICE},
+         {TANGO_COORDINATE_FRAME_AREA_DESCRIPTION,
+          TANGO_COORDINATE_FRAME_START_OF_SERVICE}};
   TangoErrorType result;
-  result = TangoService_connectOnPoseAvailable(1, &pair, onPoseAvailableRouter);
+  result = TangoService_connectOnPoseAvailable(2, pairs, onPoseAvailableRouter);
   if (result != TANGO_SUCCESS) {
     LOG(ERROR) << function_name
         << ", TangoService_connectOnPoseAvailable error: " << result;
@@ -577,10 +578,11 @@
     UpdateAndPublishTangoStatus(TangoStatus::NO_FIRST_VALID_POSE);
     return success;
   }
+  area_description_T_start_of_service_.child_frame_id = "";
+  tango_data_available_ = true;
   // Create publishing threads.
   StartPublishing();
   UpdateAndPublishTangoStatus(TangoStatus::SERVICE_CONNECTED);
-  tango_data_available_ = true;
   return success;
 }

@@ -670,17 +672,16 @@
           device_pose_thread_.data_available_mutex.try_lock()) {
         tango_ros_conversions_helper::toTransformStamped(
             *pose, time_offset_, &start_of_service_T_device_);
-        if (tango_data_available_) {
-          TangoCoordinateFramePair pair;
-          pair.base = TANGO_COORDINATE_FRAME_AREA_DESCRIPTION;
-          pair.target = TANGO_COORDINATE_FRAME_START_OF_SERVICE;
-          TangoPoseData area_description_T_start_of_service;
-          TangoService_getPoseAtTime(0.0, pair, &area_description_T_start_of_service);
-          if (area_description_T_start_of_service.status_code == TANGO_POSE_VALID) {
-            tango_ros_conversions_helper::toTransformStamped(area_description_T_start_of_service,
-                               time_offset_, &area_description_T_start_of_service_);
-          }
-        }
+        device_pose_thread_.data_available_mutex.unlock();
+        device_pose_thread_.data_available.notify_all();
+      }
+    }
+    if (pose->frame.base == TANGO_COORDINATE_FRAME_AREA_DESCRIPTION &&
+        pose->frame.target == TANGO_COORDINATE_FRAME_START_OF_SERVICE) {
+      if (pose->status_code == TANGO_POSE_VALID &&
+          device_pose_thread_.data_available_mutex.try_lock()) {
+        tango_ros_conversions_helper::toTransformStamped(
+            *pose, time_offset_, &area_description_T_start_of_service_);
         device_pose_thread_.data_available_mutex.unlock();
         device_pose_thread_.data_available.notify_all();
       }
@@ -1183,16 +1184,15 @@
                            tango_ros_messages::SaveMap::Response &res) {
   TangoErrorType result;
   TangoUUID map_uuid;
-  tango_data_available_ = false;
   result = TangoService_saveAreaDescription(&map_uuid);
   if (result != TANGO_SUCCESS) {
     LOG(ERROR) << "Error while saving area description, error: " << result;
     res.message =  "Could not save the map. Did you turn on create_new_map? "
         "Did you allow the app to use area learning?";
     res.success = false;
-    tango_data_available_ = true;
     return true;
   }
+  tango_data_available_ = false;
   TangoAreaDescriptionMetadata metadata;
   result = TangoService_getAreaDescriptionMetadata(map_uuid, &metadata);
   if (result != TANGO_SUCCESS) {


Register FakeResourceUpdateOp for the right op

Before this CL the PartiallyDeclusterPassTest.DontDuplicateResourceVarOps test
was buggy, in that it wasn't testing what it was supposed to test.

PiperOrigin-RevId: 213501558

--- tensorflow/compiler/jit/partially_decluster_pass_test.cc
+++ tensorflow/compiler/jit/partially_decluster_pass_test.cc
@@ -60,9 +60,9 @@
   void Compute(OpKernelContext* ctx) override { CHECK(false); }
 };

-class FakeResourceVarUpdateOp : public OpKernel {
+class FakeResourceUpdateOp : public OpKernel {
  public:
-  explicit FakeResourceVarUpdateOp(OpKernelConstruction* context)
+  explicit FakeResourceUpdateOp(OpKernelConstruction* context)
       : OpKernel(context) {}

   void Compute(OpKernelContext* ctx) override { CHECK(false); }
@@ -74,10 +74,9 @@
                             .HostMemory("host_out"),
                         FakeBinaryOp);

-REGISTER_KERNEL_BUILDER(Name("FakeResourceVarUpdate")
-                            .Device(DEVICE_CPU)
-                            .HostMemory("something_else"),
-                        FakeResourceVarUpdateOp);
+REGISTER_KERNEL_BUILDER(
+    Name("FakeResourceUpdate").Device(DEVICE_CPU).HostMemory("something_else"),
+    FakeResourceUpdateOp);

 Status PartiallyDecluster(std::unique_ptr<Graph>* graph) {
   FixupSourceAndSinkEdges(graph->get());


Fix leak of Tensors when ExecuteTrtEngine() fails.

You have to explicitly delete the Tensor contained in TensorValue.

PiperOrigin-RevId: 323589787
Change-Id: I8408a7a502f410c1d591f231daa696fde63e2364

--- tensorflow/compiler/tf2tensorrt/kernels/trt_engine_op.cc
+++ tensorflow/compiler/tf2tensorrt/kernels/trt_engine_op.cc
@@ -643,8 +643,10 @@
     }
     // Release any outputs that are allocated, ExecuteNativeSegment will
     // re-allocate them and fail if they are currently allocated.
+    // The Tensor pointer in the returned TensorValue must be explicitly
+    // deleted.
     for (int i = 0; i < ctx->num_outputs(); i++) {
-      ctx->release_output(i);
+      delete ctx->release_output(i).tensor;
     }
     ExecuteNativeSegment(ctx, helper);
     return;


#tf-data-service Simplify a unit test.

#tf-data-service Simplify a unit test.

PiperOrigin-RevId: 444686396

--- tensorflow/core/data/service/multi_trainer_cache_test.cc
+++ tensorflow/core/data/service/multi_trainer_cache_test.cc
@@ -291,10 +291,7 @@
           }
         })));
   }
-
-  for (auto& thread : reader_threads) {
-    thread.reset();
-  }
+  reader_threads.clear();

   // Verifies all trainers can read `num_elements_to_read` elements.
   EXPECT_EQ(results.size(), num_trainers);
@@ -330,10 +327,8 @@
           }
         })));
   }
-
-  for (auto& thread : reader_threads) {
-    thread.reset();
-  }
+  reader_threads.clear();
+
   // Verifies the readers have read all elements because they have the same
   // trainer ID.
   EXPECT_THAT(results, UnorderedElementsAreArray(GetRange(1000)));
@@ -369,9 +364,7 @@

   Env::Default()->SleepForMicroseconds(1000000);
   cache.Cancel(errors::Cancelled("Cancelled"));
-  for (auto& thread : reader_threads) {
-    thread.reset();
-  }
+  reader_threads.clear();

   mutex_lock l(mu);
   EXPECT_THAT(status, StatusIs(error::CANCELLED));


Revert "[ExpressionParser] swiftc change: OwnershipAttr -> ReferenceOwnershipAttr."

This reverts commit fc679497b4d2d99b557e60f926b5bd64a324e615.

--- source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp
+++ source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp
@@ -1383,8 +1383,8 @@

       if (var_type->getAs<swift::WeakStorageType>()) {
         redirected_var_decl->getAttrs().add(
-            new (ast_context) swift::ReferenceOwnershipAttr(
-                swift::SourceRange(), swift::ReferenceOwnership::Weak));
+            new (ast_context) swift::OwnershipAttr(swift::SourceRange(),
+                                                   swift::Ownership::Weak));
       }

       if (is_self) {


Fix PythonString::GetString for >=python-3.7

The return value of PyUnicode_AsUTF8AndSize is now "const char *".

Thanks to Brett Neumeier for testing the patch out on python 3.7.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@337908 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit b032b915ad7eea93e06d571f1a3ca712cd203b9e)

--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -399,14 +399,16 @@
     return llvm::StringRef();

   Py_ssize_t size;
+  const char *data;
+
+#if PY_MAJOR_VERSION >= 3
+  data = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
+#else
   char *c;
-
-#if PY_MAJOR_VERSION >= 3
-  c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
-#else
   PyString_AsStringAndSize(m_py_obj, &c, &size);
-#endif
-  return llvm::StringRef(c, size);
+  data = c;
+#endif
+  return llvm::StringRef(data, size);
 }

 size_t PythonString::GetSize() const {


Use the location derivatives rather than the source field element.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@4995 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/computed_field/computed_field_component_operations.cpp
+++ source/computed_field/computed_field_component_operations.cpp
@@ -132,7 +132,7 @@
 			if (field->source_fields[0]->derivatives_valid
 				&& field->source_fields[1]->derivatives_valid)
 			{
-				number_of_xi = get_FE_element_dimension(field->source_fields[0]->element);
+				number_of_xi = location->get_number_of_derivatives();
 				derivative = field->derivatives;
 				for (i = 0 ; i < field->number_of_components ; i++)
 				{
@@ -510,7 +510,7 @@
 			if (field->source_fields[0]->derivatives_valid
 				&& field->source_fields[1]->derivatives_valid)
 			{
-				number_of_xi = get_FE_element_dimension(field->source_fields[0]->element);
+				number_of_xi = location->get_number_of_derivatives();
 				derivative = field->derivatives;
 				for (i = 0 ; i < field->number_of_components ; i++)
 				{
@@ -882,7 +882,7 @@
 			if (field->source_fields[0]->derivatives_valid
 				&& field->source_fields[1]->derivatives_valid)
 			{
-				number_of_xi = get_FE_element_dimension(field->source_fields[0]->element);
+				number_of_xi = location->get_number_of_derivatives();
 				derivative = field->derivatives;
 				for (i = 0 ; i < field->number_of_components ; i++)
 				{
@@ -1256,7 +1256,7 @@
 			if (field->source_fields[0]->derivatives_valid &&
 				 field->source_fields[1]->derivatives_valid)
 			{
-				element_dimension=get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension=location->get_number_of_derivatives();
 				temp=field->derivatives;
 				temp1=field->source_fields[0]->derivatives;
 				temp2=field->source_fields[1]->derivatives;
@@ -1656,7 +1656,7 @@
 			}
 			if (field->source_fields[0]->derivatives_valid)
 			{
-				element_dimension=get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension=location->get_number_of_derivatives();
 				temp=field->derivatives;
 				temp2=field->source_fields[0]->derivatives;
 				for (i=0;i<field->number_of_components;i++)
@@ -2223,7 +2223,7 @@
 				temp=field->derivatives;
 				temp2=field->source_fields[0]->derivatives;
 				field->derivatives_valid = 1;
-				element_dimension=get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension = location->get_number_of_derivatives();
 			}
 			for (i=0;i<field->number_of_components;i++)
 			{
@@ -2723,7 +2723,7 @@
 				temp=field->derivatives;
 				temp2=field->source_fields[0]->derivatives;
 				field->derivatives_valid = 1;
-				element_dimension=get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension=location->get_number_of_derivatives();
 			}
 			for (i=0;i<field->number_of_components;i++)
 			{
@@ -3229,7 +3229,7 @@
 			}
 			if (field->source_fields[0]->derivatives_valid)
 			{
-				element_dimension=get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension=location->get_number_of_derivatives();
 				temp=field->derivatives;
 				temp2=field->source_fields[0]->derivatives;
 				for (i=0;i<field->number_of_components;i++)
@@ -3776,7 +3776,7 @@
 			field->values[0] = sum;
 			if (field->source_fields[0]->derivatives_valid)
 			{
-				element_dimension = get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension = location->get_number_of_derivatives();
 				for (j = 0; j < element_dimension; j++)
 				{
 					temp = field->source_fields[0]->derivatives + j;
@@ -4214,7 +4214,7 @@
 			}
 			if (field->source_fields[0]->derivatives_valid)
 			{
-				element_dimension = get_FE_element_dimension(field->source_fields[0]->element);
+				element_dimension = location->get_number_of_derivatives();
 				temp = field->derivatives;
 				temp2 = field->source_fields[0]->derivatives;
 				for (i = 0; i < field->number_of_components; i++)


Ignore mappings for null Functions (rather than asserting).

--- lib/Clang/MappedLLVMValue.cpp
+++ lib/Clang/MappedLLVMValue.cpp
@@ -36,11 +36,18 @@

   if (TypeStr.equals("instruction")) {
     assert(ValueMap->getNumOperands() == 3);
+
+    auto FuncVal = ValueMap->getOperand(1u);
+    if (!FuncVal)
+      return nullptr;
+
     auto Func = llvm::dyn_cast<llvm::Function>(ValueMap->getOperand(1u));
     auto Idx = llvm::dyn_cast<llvm::ConstantInt>(ValueMap->getOperand(2u));
-    assert(Func && Idx);
+    assert(Idx);
+
     auto FuncIndex = ModIndex.getFunctionIndex(Func);
     assert(FuncIndex);
+
     auto IdxValue = static_cast<uint32_t>(Idx->getZExtValue());
     return FuncIndex->getInstruction(IdxValue);
   }


Don't try to CodeGen using directives, from Anders Johnsen

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

--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -1653,6 +1653,7 @@
     break;
     // No code generation needed.
   case Decl::Using:
+  case Decl::UsingDirective:
   case Decl::ClassTemplate:
   case Decl::FunctionTemplate:
     break;


IRgen/ARM: Fix a think-o in conversion-to-null for member function pointers, we
were computing the conversion as (ptr != 0 && non-virtual), when it should be
(ptr != 0 || is-virtual).
 - Test to follow in LLVM test-suite.

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

--- lib/CodeGen/ItaniumCXXABI.cpp
+++ lib/CodeGen/ItaniumCXXABI.cpp
@@ -652,20 +652,21 @@
     return Builder.CreateICmpNE(MemPtr, NegativeOne, "memptr.tobool");
   }

-  // In Itanium, a member function pointer is null if 'ptr' is null.
+  // In Itanium, a member function pointer is not null if 'ptr' is not null.
   llvm::Value *Ptr = Builder.CreateExtractValue(MemPtr, 0, "memptr.ptr");

   llvm::Constant *Zero = llvm::ConstantInt::get(Ptr->getType(), 0);
   llvm::Value *Result = Builder.CreateICmpNE(Ptr, Zero, "memptr.tobool");

-  // In ARM, it's that, plus the low bit of 'adj' must be zero.
+  // On ARM, a member function pointer is also non-null if the low bit of 'adj'
+  // (the virtual bit) is set.
   if (IsARM) {
     llvm::Constant *One = llvm::ConstantInt::get(Ptr->getType(), 1);
     llvm::Value *Adj = Builder.CreateExtractValue(MemPtr, 1, "memptr.adj");
     llvm::Value *VirtualBit = Builder.CreateAnd(Adj, One, "memptr.virtualbit");
-    llvm::Value *IsNotVirtual = Builder.CreateICmpEQ(VirtualBit, Zero,
-                                                     "memptr.notvirtual");
-    Result = Builder.CreateAnd(Result, IsNotVirtual);
+    llvm::Value *IsVirtual = Builder.CreateICmpNE(VirtualBit, Zero,
+                                                  "memptr.isvirtual");
+    Result = Builder.CreateOr(Result, IsVirtual);
   }

   return Result;


[LiveVariables] Improve isLiveOut runtime performances. NFC.

On large goto table based interpreters, where phi nodes can have (very) large
fan-ins, isLiveOut exhibited poor performances: about 40% of the full
codegen time was spent in PHIElim, sorting MachineBasicBlock addresses.

This patch improve the performances for such cases, and does not show
compile time regressions on the LNT, at bootstrap (llvm+clang+lldb) or
any other benchmarks we have in-house.

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

--- lib/CodeGen/LiveVariables.cpp
+++ lib/CodeGen/LiveVariables.cpp
@@ -738,45 +738,22 @@
 bool LiveVariables::isLiveOut(unsigned Reg, const MachineBasicBlock &MBB) {
   LiveVariables::VarInfo &VI = getVarInfo(Reg);

+  SmallPtrSet<const MachineBasicBlock *, 8> Kills;
+  for (unsigned i = 0, e = VI.Kills.size(); i != e; ++i)
+    Kills.insert(VI.Kills[i]->getParent());
+
   // Loop over all of the successors of the basic block, checking to see if
   // the value is either live in the block, or if it is killed in the block.
-  SmallVector<MachineBasicBlock*, 8> OpSuccBlocks;
-  for (MachineBasicBlock::const_succ_iterator SI = MBB.succ_begin(),
-         E = MBB.succ_end(); SI != E; ++SI) {
-    MachineBasicBlock *SuccMBB = *SI;
-
+  for (const MachineBasicBlock *SuccMBB : MBB.successors()) {
     // Is it alive in this successor?
     unsigned SuccIdx = SuccMBB->getNumber();
     if (VI.AliveBlocks.test(SuccIdx))
       return true;
-    OpSuccBlocks.push_back(SuccMBB);
-  }
-
-  // Check to see if this value is live because there is a use in a successor
-  // that kills it.
-  switch (OpSuccBlocks.size()) {
-  case 1: {
-    MachineBasicBlock *SuccMBB = OpSuccBlocks[0];
-    for (unsigned i = 0, e = VI.Kills.size(); i != e; ++i)
-      if (VI.Kills[i]->getParent() == SuccMBB)
-        return true;
-    break;
-  }
-  case 2: {
-    MachineBasicBlock *SuccMBB1 = OpSuccBlocks[0], *SuccMBB2 = OpSuccBlocks[1];
-    for (unsigned i = 0, e = VI.Kills.size(); i != e; ++i)
-      if (VI.Kills[i]->getParent() == SuccMBB1 ||
-          VI.Kills[i]->getParent() == SuccMBB2)
-        return true;
-    break;
-  }
-  default:
-    std::sort(OpSuccBlocks.begin(), OpSuccBlocks.end());
-    for (unsigned i = 0, e = VI.Kills.size(); i != e; ++i)
-      if (std::binary_search(OpSuccBlocks.begin(), OpSuccBlocks.end(),
-                             VI.Kills[i]->getParent()))
-        return true;
-  }
+    // Or is it live because there is a use in a successor that kills it?
+    if (Kills.count(SuccMBB))
+      return true;
+  }
+
   return false;
 }


Fix bug in cling's diagnostic engine, if CUDA mode is enable

- solves the bug, that error messages of the device compiler was
not prefixed with "cling-ptx"

--- lib/Interpreter/CIFactory.cpp
+++ lib/Interpreter/CIFactory.cpp
@@ -1355,7 +1355,9 @@
     // e.g. in CUDA mode
     std::string ExeName = "";
     if (COpts.CUDAHost)
-      ExeName = COpts.CUDADevice ? "cling-ptx" : "cling";
+      ExeName = "cling";
+    if (COpts.CUDADevice)
+      ExeName = "cling-ptx";
     llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
         SetupDiagnostics(DiagOpts, ExeName);
     if (!Diags) {


[WASM] Remove an assertion that can never fire.

uint* is by definition always >=0.

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

--- lib/Object/WasmObjectFile.cpp
+++ lib/Object/WasmObjectFile.cpp
@@ -100,7 +100,7 @@

 static uint8_t readVaruint7(const uint8_t *&Ptr) {
   uint64_t result = readULEB128(Ptr);
-  assert(result <= VARUINT7_MAX && result >= 0);
+  assert(result <= VARUINT7_MAX);
   return result;
 }

@@ -112,7 +112,7 @@

 static uint32_t readVaruint32(const uint8_t *&Ptr) {
   uint64_t result = readULEB128(Ptr);
-  assert(result <= UINT32_MAX && result >= 0);
+  assert(result <= UINT32_MAX);
   return result;
 }


Fix function naming (NFC)

Fix function naming (NFC)

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

--- lib/ProfileData/InstrProf.cpp
+++ lib/ProfileData/InstrProf.cpp
@@ -131,7 +131,7 @@
   return createPGOFuncNameVar(*F.getParent(), F.getLinkage(), FuncName);
 }

-uint64_t StringToHash(uint32_t ValueKind, uint64_t Value) {
+uint64_t stringToHash(uint32_t ValueKind, uint64_t Value) {
   switch (ValueKind) {
   case IPVK_IndirectCallTarget:
     return IndexedInstrProf::ComputeHash(IndexedInstrProf::HashType,
@@ -164,7 +164,7 @@
   for (uint32_t S = 0; S < NumValueSites; S++) {
     uint32_t ND = Record.getNumValueDataForSite(ValueKind, S);
     SiteCountArray[S] = ND;
-    Record.getValueForSite(DstVD, ValueKind, S, StringToHash);
+    Record.getValueForSite(DstVD, ValueKind, S, stringToHash);
     DstVD += ND;
   }
 }


SILGen: Remove GenericMemberRef to metatype hack.
Doug fixed the AST representation of type variable metatypes in r3532, so we don't need to check for bugged-out GenericMemberRef-to-metatype nodes anymore.

Swift SVN r3570

--- lib/SIL/SILGen/SILGenExpr.cpp
+++ lib/SIL/SILGen/SILGenExpr.cpp
@@ -559,16 +559,6 @@

 ManagedValue SILGenFunction::visitGenericMemberRefExpr(GenericMemberRefExpr *E)
 {
-  // FIXME: Kludge to handle type variable references, which currently manifest
-  // as GenericMemberRefExprs off the generic type. According to John this might
-  // be an AST problem.
-  if (E->getType()->is<MetaTypeType>() &&
-      E->getBase()->getType()->is<MetaTypeType>()) {
-    visit(E->getBase());
-    return ManagedValue(B.createMetatype(E,
-                                         getLoweredLoadableType(E->getType())));
-  }
-
   return emitAnyMemberRefExpr(*this, E, E->getSubstitutions());
 }


[Effects handling] Stop storing an ApplyClassifier as an instance.

--- lib/Sema/TypeCheckEffects.cpp
+++ lib/Sema/TypeCheckEffects.cpp
@@ -1226,8 +1226,7 @@

   ASTContext &Ctx;

-  ApplyClassifier Classifier;
-
+  DeclContext *RethrowsDC = nullptr;
   Context CurContext;

   class ContextFlags {
@@ -1296,7 +1295,7 @@
   public:
     ContextScope(CheckEffectsCoverage &self, Optional<Context> newContext)
       : Self(self), OldContext(self.CurContext),
-        OldRethrowsDC(self.Classifier.RethrowsDC),
+        OldRethrowsDC(self.RethrowsDC),
         OldFlags(self.Flags),
         OldMaxThrowingKind(self.MaxThrowingKind) {
       if (newContext) self.CurContext = *newContext;
@@ -1306,7 +1305,7 @@
     ContextScope &operator=(const ContextScope &) = delete;

     void enterSubFunction() {
-      Self.Classifier.RethrowsDC = nullptr;
+      Self.RethrowsDC = nullptr;
     }

     void enterTry() {
@@ -1372,7 +1371,7 @@

     ~ContextScope() {
       Self.CurContext = OldContext;
-      Self.Classifier.RethrowsDC = OldRethrowsDC;
+      Self.RethrowsDC = OldRethrowsDC;
       Self.Flags = OldFlags;
       Self.MaxThrowingKind = OldMaxThrowingKind;
     }
@@ -1384,7 +1383,7 @@
       MaxThrowingKind(ThrowingKind::None) {

     if (auto rethrowsDC = initialContext.getRethrowsDC()) {
-      Classifier.RethrowsDC = rethrowsDC;
+      RethrowsDC = rethrowsDC;
     }
   }

@@ -1494,7 +1493,9 @@
   ShouldRecurse_t checkApply(ApplyExpr *E) {
     // An apply expression is a potential throw site if the function throws.
     // But if the expression didn't type-check, suppress diagnostics.
-    auto classification = Classifier.classifyApply(E);
+    ApplyClassifier classifier;
+    classifier.RethrowsDC = RethrowsDC;
+    auto classification = classifier.classifyApply(E);

     checkThrowAsyncSite(E, /*requiresTry*/ true, classification);


Fix the interface type of the implicit-declared constructors.

Swift SVN r9689

--- lib/Sema/TypeCheckGeneric.cpp
+++ lib/Sema/TypeCheckGeneric.cpp
@@ -734,6 +734,9 @@
     }
     patterns = storedPatterns;
   }
+
+  bool isImplicitConstructor = isa<ConstructorDecl>(func) &&
+                               func->isImplicit();
   for (unsigned i = 0, e = patterns.size(); i != e; ++i) {
     Type argTy;
     Type initArgTy;
@@ -749,6 +752,14 @@
       }
     } else {
       argTy = patterns[e - i - 1]->getType();
+
+      // For the implicit constructor, our argument type will be in
+      // terms of archetypes rather than dependent types. Replace the
+      // archetypes with their corresponding dependent types.
+      if (isImplicitConstructor) {
+        argTy = getInterfaceTypeFromInternalType(func, argTy);
+      }
+
       if (initFuncTy)
         initArgTy = argTy;
     }


lock only in case of non-nullptr

lock only in case of non-nullptr

--- lib/Statistics/statistics.cpp
+++ lib/Statistics/statistics.cpp
@@ -89,11 +89,11 @@
 ////////////////////////////////////////////////////////////////////////////////

 void TRI_ReleaseRequestStatistics (TRI_request_statistics_t* statistics) {
-  MUTEX_LOCKER(RequestListLock);
-
   if (statistics == nullptr) {
     return;
   }
+
+  MUTEX_LOCKER(RequestListLock);

   if (! statistics->_ignore) {
     TRI_TotalRequestsStatistics.incCounter();


Simplify the code and fix a typo.

Simplify the code and fix a typo.

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

--- lib/Support/FileUtilities.cpp
+++ lib/Support/FileUtilities.cpp
@@ -21,13 +21,10 @@
 using namespace llvm;

 static bool isSignedChar(char C) {
-  if (C == '+' || C == '-')
-    return true;
-  else
-    return false;
-}
-
-static bool isExpoentChar(char C) {
+  return (C == '+' || C == '-');
+}
+
+static bool isExponentChar(char C) {
   switch (C) {
   case 'D':  // Strange exponential notation.
   case 'd':  // Strange exponential notation.
@@ -42,7 +39,7 @@
   case '0': case '1': case '2': case '3': case '4':
   case '5': case '6': case '7': case '8': case '9':
   case '.': return true;
-  default: return isSignedChar(C) || isExpoentChar(C);
+  default: return isSignedChar(C) || isExponentChar(C);
   }
 }

@@ -53,7 +50,7 @@
   // Otherwise, return to the start of the number.
   while (Pos > FirstChar && isNumberChar(Pos[-1])) {
     --Pos;
-    if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExpoentChar(Pos[-1]))
+    if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExponentChar(Pos[-1]))
       break;
   }
   return Pos;


Set debug loc for new load instruction.

Set debug loc for new load instruction.

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

--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -1576,6 +1576,9 @@
     if (MDNode *Tag = LI->getMetadata(LLVMContext::MD_tbaa))
       NewLoad->setMetadata(LLVMContext::MD_tbaa, Tag);

+    // Transfer DebugLoc.
+    NewLoad->setDebugLoc(LI->getDebugLoc());
+
     // Add the newly created load.
     ValuesPerBlock.push_back(AvailableValueInBlock::get(UnavailablePred,
                                                         NewLoad));


Symbian: Somebody missed spot with the error reference to pointer change. (cherry picked from commit caba1a6b9b4afccdf622ce2f73a56fccc6674174)

--- plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp
+++ plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp
@@ -120,7 +120,7 @@

 #ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE
     if (m_reservedSlots.contains(contactId))
-        simStore()->remove(contactId, error);
+        simStore()->remove(contactId, &error);
     else
         error = QContactManager::DoesNotExistError;
 #else


Attempt to fix build failure with GCC 5.4.

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

--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -384,8 +384,8 @@
     skip();
 }

-static std::tuple<ELFKind, uint16_t> parseBfdName(StringRef S) {
-  return StringSwitch<std::tuple<ELFKind, uint16_t>>(S)
+static std::pair<ELFKind, uint16_t> parseBfdName(StringRef S) {
+  return StringSwitch<std::pair<ELFKind, uint16_t>>(S)
       .Case("elf32-i386", {ELF32LEKind, EM_386})
       .Case("elf32-iamcu", {ELF32LEKind, EM_IAMCU})
       .Case("elf32-littlearm", {ELF32LEKind, EM_ARM})


make rendering bench shell easy to run

make rendering bench shell easy to run

--- benchmark/test_rendering.cpp
+++ benchmark/test_rendering.cpp
@@ -5,6 +5,7 @@
 #include <mapnik/graphics.hpp>
 #include <mapnik/agg_renderer.hpp>
 #include <mapnik/datasource_cache.hpp>
+#include <mapnik/font_engine_freetype.hpp>
 #include <stdexcept>

 class test : public benchmark::test_case
@@ -36,17 +37,22 @@
             if (!extent_.from_string(*ext))
                 throw std::runtime_error("could not parse `extent` string" + *ext);
         }
+        /*
         else
         {
             throw std::runtime_error("please provide a --extent=<minx,miny,maxx,maxy> arg");
-        }
+        }*/

       }
     bool validate() const
     {
         mapnik::Map m(width_,height_);
         mapnik::load_map(m,xml_,true);
-        m.zoom_to_box(extent_);
+        if (extent_.valid()) {
+            m.zoom_to_box(extent_);
+        } else {
+            m.zoom_all();
+        }
         mapnik::image_32 im(m.width(),m.height());
         mapnik::agg_renderer<mapnik::image_32> ren(m,im);
         ren.apply();
@@ -57,7 +63,11 @@
     {
         mapnik::Map m(width_,height_);
         mapnik::load_map(m,xml_);
-        m.zoom_to_box(extent_);
+        if (extent_.valid()) {
+            m.zoom_to_box(extent_);
+        } else {
+            m.zoom_all();
+        }
         for (unsigned i=0;i<iterations_;++i)
         {
             mapnik::image_32 im(m.width(),m.height());
@@ -80,6 +90,7 @@
             std::clog << "please provide a name for this test\n";
             return -1;
         }
+        mapnik::freetype_engine::register_fonts("./fonts/",true);
         mapnik::datasource_cache::instance().register_datasources("./plugins/input/");
         {
             test test_runner(params);


get input from a file

get input from a file

--- bfjit.cpp
+++ bfjit.cpp
@@ -1,19 +1,25 @@
 #include <cstdio>
-#include <asmjit/asmjit.h>
 #include <vector>
 #include <stack>
+#include <fstream>
+#include <asmjit/asmjit.h>
 using namespace asmjit;
 using namespace asmjit::x86;

 int main(int argc, char *argv[]) {
-	std::vector<char> cells(1024); // construct 256 cells
+	std::ifstream fs;
+	std::vector<char> cells(1024); // construct 1024 cells
 	std::stack<std::pair<Label, Label>> block_labels;
 	JitRuntime runtime;
 	X86Compiler c(&runtime);
-
 	cells.assign(1024, 0);

-	const char code[] = "+++[->,.<]"; //"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
+	if(argc < 2) {
+		printf("USAGE: %s FILE", argv[0]);
+		return 1;
+	}
+
+	fs.open(argv[1]);

 	c.addFunc(kFuncConvHost, FuncBuilder1<void, char*>());

@@ -28,10 +34,8 @@
 	X86GpVar _getchar(c, kVarTypeIntPtr, "_getchar");
 	c.mov(_getchar, intptr_t(&getchar));

-	//Label lbl(c);
-	//Label lbl2(c);
-
-	for(char ch : code) {
+	char ch;
+	while(fs >> ch) {
 		switch(ch) {
 			case '+':
 				c.inc(byte_ptr(cells_ptr));


Prevent saving keybinds without a key as that leads to a crash (fixes #1758)

--- apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp
+++ apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp
@@ -311,6 +311,14 @@
     _keybindingWidgets.key->addItems(keyList);
     _keybindingWidgets.key->setCurrentIndex(-1);
     _keybindingWidgets.key->setEnabled(false);
+    connect(
+        _keybindingWidgets.key, QOverload<int>::of(&QComboBox::currentIndexChanged),
+        [this](int newIndex) {
+            _keybindingWidgets.saveButtons->button(QDialogButtonBox::Save)->setEnabled(
+                newIndex > 0
+            );
+        }
+    );
     layout->addWidget(_keybindingWidgets.key, 11, 2);

     layout->addWidget(new QLabel("Action chooser"), 12, 1);
@@ -632,7 +640,9 @@
         std::string key = ghoul::to_string(keybinding->key.key);
         _keybindingWidgets.key->setCurrentText(QString::fromStdString(key));
         _keybindingWidgets.key->setEnabled(true);
-        _keybindingWidgets.action->setCurrentText(QString::fromStdString(keybinding->action));
+        _keybindingWidgets.action->setCurrentText(
+            QString::fromStdString(keybinding->action)
+        );
         _keybindingWidgets.action->setEnabled(true);
         _keybindingWidgets.actionText->setText(
             QString::fromStdString(keybinding->action)
@@ -640,7 +650,13 @@
         _keybindingWidgets.actionText->setEnabled(true);
         _keybindingWidgets.addButton->setEnabled(false);
         _keybindingWidgets.removeButton->setEnabled(true);
+
         _keybindingWidgets.saveButtons->setEnabled(true);
+        // Only enable the save buttons if a key is selected, otherwise we would get an
+        // exception as the None key cannot be bound
+        _keybindingWidgets.saveButtons->button(QDialogButtonBox::Save)->setEnabled(
+            _keybindingWidgets.key->currentIndex() > 0
+        );
     }
     else {
         // No keybinding selected
@@ -656,7 +672,7 @@

 void ActionDialog::keybindingSaved() {
     Profile::Keybinding* keybinding = selectedKeybinding();
-    ghoul_assert(keybinding, "There must be a selected action at this point");
+    ghoul_assert(keybinding, "There must be a selected keybinding at this point");

     KeyModifier km = KeyModifier::None;
     if (_keybindingWidgets.shiftModifier->isChecked()) {


Doxygen

Doxygen

--- core/meta/src/TMethodArg.cxx
+++ core/meta/src/TMethodArg.cxx
@@ -17,17 +17,15 @@
 #include "TMethodCall.h"
 #include "TDataMember.h"

-//////////////////////////////////////////////////////////////////////////
-//                                                                      //
-//  Each ROOT method (see TMethod) has a linked list of its arguments.  //
-//  This class describes one single method argument.                    //
-//  The method argument info is obtained via the CINT api.              //
-//  See class TCling.                                                    //
-//                                                                      //
-//  The method argument information is used a.o. in the TContextMenu    //
-//  and THtml classes.                                                  //
-//                                                                      //
-//////////////////////////////////////////////////////////////////////////
+/** \class TMethodArg
+Each ROOT method (see TMethod) has a linked list of its arguments.
+This class describes one single method argument.
+The method argument info is obtained via the CINT api.
+See class TCling.
+
+The method argument information is used a.o. in the TContextMenu
+and THtml classes.
+*/

 ClassImp(TMethodArg)

@@ -80,11 +78,10 @@
 }

 ////////////////////////////////////////////////////////////////////////////////
-/// Get the normalized name of the return type.  A normalized name is fully
+/// Get the normalized name of the return type. A normalized name is fully
 /// qualified and has all typedef desugared except for the 'special' typedef
 /// which include Double32_t, Float16_t, [U]Long64_t and std::string.  It
 /// also has std:: removed [This is subject to change].
-///

 std::string TMethodArg::GetTypeNormalizedName() const
 {
@@ -114,6 +111,7 @@
 /// MethodArg (i.e. it is used as initial values in argument-asking dialogs
 /// popped up from context-meny),you can get this value from one of data
 /// members of the class.
+///
 /// The only restriction is, that this DataMember object must have its
 /// Getter/Setter methods set-up correctly - for details look at TDataMember.
 /// To learn how to specify the data member to which the argument should


qtmobility: fix QtLocation includes

qtmobility: fix QtLocation includes

the include dirs of QtLocation already include the final QtLocation subdir

--- src/plugins/positionprovider/qtmobility/QtMobilityPositionProviderPlugin.cpp
+++ src/plugins/positionprovider/qtmobility/QtMobilityPositionProviderPlugin.cpp
@@ -11,9 +11,9 @@

 #include "QtMobilityPositionProviderPlugin.h"

-#include <QtLocation/QGeoPositionInfoSource>
-#include <QtLocation/QGeoPositionInfo>
-#include <QtLocation/QGeoCoordinate>
+#include <QGeoPositionInfoSource>
+#include <QGeoPositionInfo>
+#include <QGeoCoordinate>

 QTM_USE_NAMESPACE


changes

changes

--- binder.cc
+++ binder.cc
@@ -79,9 +79,9 @@
   }else{

     bool sameLoc = false;
-    list<service_info *> *hostList = proc_loc_dict.find[key];
-
-    for (list<service_info *>::iterator it = hostList->begin(); it != hostList->end(); it++) {
+    list<server_info *> *hostList = proc_loc_dict.find[key];
+
+    for (list<server_info *>::iterator it = hostList->begin(); it != hostList->end(); it++) {
       if(it == new_msg_loc){
         //The same procedure signature already exists on the same location
         //TODO: Move to end of round robin or something


Expose InputEventMIDI to scripts

Expose InputEventMIDI to scripts

--- core/register_core_types.cpp
+++ core/register_core_types.cpp
@@ -142,6 +142,7 @@
 	ClassDB::register_virtual_class<InputEventGesture>();
 	ClassDB::register_class<InputEventMagnifyGesture>();
 	ClassDB::register_class<InputEventPanGesture>();
+	ClassDB::register_class<InputEventMIDI>();

 	ClassDB::register_class<FuncRef>();
 	ClassDB::register_virtual_class<StreamPeer>();


Enable -tf-tpu-reorder-partitioned-replicated-inputs pass in bridge pipeline.

PiperOrigin-RevId: 353229940
Change-Id: I6305e920296d4c3fd69c2808b10e22d4e0db0936

--- tensorflow/compiler/mlir/tensorflow/transforms/bridge.cc
+++ tensorflow/compiler/mlir/tensorflow/transforms/bridge.cc
@@ -85,6 +85,7 @@
   // Run shape inference so that tf_executor/tf_device ops created later will
   // likely to inherit more concrete types.
   pm.addPass(TF::CreateTFShapeInferencePass());
+  pm.addNestedPass<FuncOp>(CreateTPUReorderReplicateAndPartitionedInputsPass());
   // Encode this in its own scope so that func_pm is not mistakenly used
   // later on.
   {


Fix use of ISliceLayer

Fix use of ISliceLayer

--- tensorflow/compiler/tf2tensorrt/convert/convert_nodes.cc
+++ tensorflow/compiler/tf2tensorrt/convert/convert_nodes.cc
@@ -2355,7 +2355,7 @@
   if (params->validation_only) return Status::OK();

   nvinfer1::ISliceLayer* layer = params->converter->network()->addSlice(
-      input.tensor(), begin_dims, size_dims, stride_dims);
+      *input.tensor(), begin_dims, size_dims, stride_dims);
   params->outputs->push_back(TRT_TensorOrWeights(layer->getOutput(0)));
   return Status::OK();
 #else


Improve error checks

Improve error checks

--- tensorflow/compiler/tf2tensorrt/kernels/trt_engine_op.cc
+++ tensorflow/compiler/tf2tensorrt/kernels/trt_engine_op.cc
@@ -405,8 +405,13 @@

   if (use_implicit_batch_) {
     const int batch_size = shapes[0].dim_size(0);
+    if (batch_size < 1) {
+      return errors::InvalidArgument(
+          "Incorrect batch dimension, for ", name(),
+          ": ", TensorShapeUtils::ShapeListString(shapes));
+    }
     for (const TensorShape& shape : shapes) {
-      if (shape.dims() < 1 || batch_size != shape.dim_size(0)) {
+      if (batch_size != shape.dim_size(0)) {
         return errors::InvalidArgument(
             "Input shapes are inconsistent on the batch dimension, for ", name(),
             ": ", TensorShapeUtils::ShapeListString(shapes));


Remove the threshold on tile_size_x for column reduction from IsReductionFromOrToContiguousDimensions, so that it returns true regardless tile_size_x.

--- tensorflow/compiler/xla/service/gpu/ir_emission_utils.cc
+++ tensorflow/compiler/xla/service/gpu/ir_emission_utils.cc
@@ -220,9 +220,9 @@
   }

   // For column reduction, the tile block is tize_size_y x tile_size_x, and we
-  // are reducing along tile_size_y. Both tile_size_x and tile_size_y need to be
+  // are reducing along tile_size_y. tile_size_y needs to be
   // large enough to make the tiling implementation efficient.
-  return dims_in_elem[2] >= kWarpSize && dims_in_elem[1] >= kWarpSize;
+  return dims_in_elem[1] >= kWarpSize;
 }

 std::pair<bool, DimensionVector> GetReductionKindAndContiguousComponents(


Fix a typo in virtual_scheduler_test.

Fix a typo in virtual_scheduler_test.

PiperOrigin-RevId: 318099215
Change-Id: I698608791dd922c888533e899c6ffaa4288d501f

--- tensorflow/core/grappler/costs/virtual_scheduler_test.cc
+++ tensorflow/core/grappler/costs/virtual_scheduler_test.cc
@@ -2988,7 +2988,7 @@
   // Run the scheduler. The current VirtualScheduler, w/o annotation, triggers
   // both outputs of Switch; then Merge (as long as one input is ready, it's z
   // is ready, if we just use num_inputs_ready counter, the final Add becomes
-  // ready. possible to skipt scheduling z. (Need to use CompositeNodeManager
+  // ready. possible to skip scheduling z. (Need to use CompositeNodeManager
   // to test this case).
   auto ops_executed = RunScheduler("");


Fixed typo.

Fixed typo.

--- drake/systems/plants/RigidBodyTreeURDF.cpp
+++ drake/systems/plants/RigidBodyTreeURDF.cpp
@@ -539,7 +539,7 @@
   // If this point in the code is reached, that means no joint named
   // joint_name was found in the URDF. Therefore throw an exception.
   throw std::runtime_error(
-      "GetActuarEffortLimit: ERROR: Unable to find joint \"" + joint_name +
+      "GetActuatorEffortLimit: ERROR: Unable to find joint \"" + joint_name +
       "\".");
 }


Refactored variables named "model" to "tree" when they are of type RigidBodyTree.

--- drake/systems/plants/RigidBodyTreeURDF.cpp
+++ drake/systems/plants/RigidBodyTreeURDF.cpp
@@ -34,10 +34,10 @@

 // todo: rectify this with FindBodyIndex in the class (which makes more
 // assumptions)
-int findLinkIndex(RigidBodyTree* model, string link_name) {
+int findLinkIndex(RigidBodyTree* tree, string link_name) {
   int index = -1;
-  for (unsigned int i = 0; i < model->bodies.size(); i++) {
-    if (link_name.compare(model->bodies[i]->name_) == 0) {
+  for (unsigned int i = 0; i < tree->bodies.size(); i++) {
+    if (link_name.compare(tree->bodies[i]->name_) == 0) {
       index = i;
       break;
     }
@@ -51,7 +51,7 @@
 //
 // TODO(liang.fok): Generalize this method to support a model_id.
 //                  See: https://github.com/RobotLocomotion/drake/issues/2583
-int FindBodyIndexByJointName(RigidBodyTree* model, string joint_name) {
+int FindBodyIndexByJointName(RigidBodyTree* tree, string joint_name) {
   // Instantiates a local variable that stores the index of the rigid body whose
   // joint is the one we're searching for. It is initialized to an invalid index
   // so the failure mode of not finding any matching joint can be identified.
@@ -61,9 +61,9 @@

   // Searches through all of the bodies in the rigid body tree looking for the
   // joint with the specified name.
-  for (unsigned int i = 0; i < model->bodies.size(); i++) {
-    if (model->bodies[i]->hasParent() &&
-        joint_name.compare(model->bodies[i]->getJoint().getName()) == 0) {
+  for (unsigned int i = 0; i < tree->bodies.size(); i++) {
+    if (tree->bodies[i]->hasParent() &&
+        joint_name.compare(tree->bodies[i]->getJoint().getName()) == 0) {
       if (index == -1) {
         index = i;
       } else {
@@ -86,7 +86,7 @@
   return index;
 }

-void parseInertial(RigidBody* body, XMLElement* node, RigidBodyTree* model) {
+void parseInertial(RigidBody* body, XMLElement* node) {
   Isometry3d T = Isometry3d::Identity();

   XMLElement* origin = node->FirstChildElement("origin");
@@ -331,7 +331,7 @@
 //
 // A warning is printed to std::cerr if a material is not set for the rigid
 // body's visualization.
-void parseVisual(RigidBody* body, XMLElement* node, RigidBodyTree* model,
+void parseVisual(RigidBody* body, XMLElement* node, RigidBodyTree* tree,
                  MaterialMap* materials, const PackageMap& package_map,
                  const string& root_dir) {
   // Ensures there is a geometry child element. Since this is a required
@@ -454,7 +454,7 @@
   if (element.hasGeometry()) body->addVisualElement(element);
 }

-void parseCollision(RigidBody* body, XMLElement* node, RigidBodyTree* model,
+void parseCollision(RigidBody* body, XMLElement* node, RigidBodyTree* tree,
                     const PackageMap& package_map, const string& root_dir) {
   Isometry3d T_element_to_link = Isometry3d::Identity();
   XMLElement* origin = node->FirstChildElement("origin");
@@ -481,11 +481,11 @@
                         body->name_ + ".");

   if (element.hasGeometry()) {
-    model->addCollisionElement(element, *body, group_name);
-  }
-}
-
-bool parseLink(RigidBodyTree* model, std::string robot_name, XMLElement* node,
+    tree->addCollisionElement(element, *body, group_name);
+  }
+}
+
+bool parseLink(RigidBodyTree* tree, std::string robot_name, XMLElement* node,
                MaterialMap* materials, const PackageMap& package_map,
                const string& root_dir, int* index) {
   const char* attr = node->Attribute("drake_ignore");
@@ -503,20 +503,20 @@
   if (body->name_ == std::string(RigidBodyTree::kWorldLinkName)) return false;

   XMLElement* inertial_node = node->FirstChildElement("inertial");
-  if (inertial_node) parseInertial(body, inertial_node, model);
+  if (inertial_node) parseInertial(body, inertial_node);

   for (XMLElement* visual_node = node->FirstChildElement("visual"); visual_node;
        visual_node = visual_node->NextSiblingElement("visual")) {
-    parseVisual(body, visual_node, model, materials, package_map, root_dir);
+    parseVisual(body, visual_node, tree, materials, package_map, root_dir);
   }

   for (XMLElement* collision_node = node->FirstChildElement("collision");
        collision_node;
        collision_node = collision_node->NextSiblingElement("collision")) {
-    parseCollision(body, collision_node, model, package_map, root_dir);
-  }
-
-  model->add_rigid_body(std::move(owned_body));
+    parseCollision(body, collision_node, tree, package_map, root_dir);
+  }
+
+  tree->add_rigid_body(std::move(owned_body));
   *index = body->body_index;
   return true;
 }
@@ -598,7 +598,7 @@
   child_link_name = std::string(attr);
 }

-void parseJoint(RigidBodyTree* model, XMLElement* node) {
+void parseJoint(RigidBodyTree* tree, XMLElement* node) {
   const char* attr = node->Attribute("drake_ignore");
   if (attr && (std::strcmp(attr, "true") == 0)) return;

@@ -611,12 +611,12 @@
   // separately.
   if (parent_name == std::string(RigidBodyTree::kWorldLinkName)) return;

-  int parent_index = findLinkIndex(model, parent_name);
+  int parent_index = findLinkIndex(tree, parent_name);
   if (parent_index < 0)
     throw runtime_error("ERROR: could not find parent link named " +
                         parent_name);

-  int child_index = findLinkIndex(model, child_name);
+  int child_index = findLinkIndex(tree, child_name);
   if (child_index < 0)
     throw runtime_error("ERROR: could not find child link named " + child_name);

@@ -661,8 +661,8 @@
   }

   unique_ptr<DrakeJoint> joint_unique_ptr(joint);
-  model->bodies[child_index]->setJoint(move(joint_unique_ptr));
-  model->bodies[child_index]->parent = model->bodies[parent_index].get();
+  tree->bodies[child_index]->setJoint(move(joint_unique_ptr));
+  tree->bodies[child_index]->parent = tree->bodies[parent_index].get();
 }

 // Searches through the URDF document looking for the effort limits of a
@@ -730,7 +730,7 @@
       "\".");
 }

-void parseTransmission(RigidBodyTree* model, XMLElement* transmission_node) {
+void parseTransmission(RigidBodyTree* tree, XMLElement* transmission_node) {
   // Determines the transmission type.
   const char* attr = nullptr;
   XMLElement* type_node = transmission_node->FirstChildElement("type");
@@ -780,9 +780,9 @@

   // Checks if the actuator is attached to a fixed joint. If so, abort this
   // method call.
-  int body_index = FindBodyIndexByJointName(model, joint_name);
-
-  if (model->bodies[body_index]->getJoint().getNumPositions() == 0) {
+  int body_index = FindBodyIndexByJointName(tree, joint_name);
+
+  if (tree->bodies[body_index]->getJoint().getNumPositions() == 0) {
     cerr << "RigidBodyTreeURDF.cpp: parseTransmission: WARNING: Skipping "
             "transmission since it's attached to a fixed joint \""
          << joint_name << "\"." << endl;
@@ -810,12 +810,12 @@
   }

   // Creates the actuator and adds it to the rigid body tree.
-  model->actuators.push_back(RigidBodyActuator(actuator_name,
-                                               model->bodies[body_index].get(),
+  tree->actuators.push_back(RigidBodyActuator(actuator_name,
+                                               tree->bodies[body_index].get(),
                                                gain, effort_min, effort_max));
 }

-void parseLoop(RigidBodyTree* model, XMLElement* node) {
+void parseLoop(RigidBodyTree* tree, XMLElement* node) {
   Vector3d axis;
   axis << 1.0, 0.0, 0.0;

@@ -826,31 +826,31 @@
   XMLElement* link_node = node->FirstChildElement("link1");
   std::shared_ptr<RigidBodyFrame> frameA =
       drake::systems::MakeRigidBodyFrameFromURDFNode(
-          *model, link_node, link_node, name + "FrameA");
+          *tree, link_node, link_node, name + "FrameA");

   link_node = node->FirstChildElement("link2");
   std::shared_ptr<RigidBodyFrame> frameB =
       drake::systems::MakeRigidBodyFrameFromURDFNode(
-          *model, link_node, link_node, name + "FrameB");
+          *tree, link_node, link_node, name + "FrameB");

   XMLElement* axis_node = node->FirstChildElement("axis");
   if (axis_node && !parseVectorAttribute(axis_node, "xyz", axis))
     throw runtime_error("ERROR parsing loop joint axis");

-  model->addFrame(frameA);
-  model->addFrame(frameB);
+  tree->addFrame(frameA);
+  tree->addFrame(frameB);
   RigidBodyLoop l(frameA, frameB, axis);
-  model->loops.push_back(l);
-}
-
-void parseFrame(RigidBodyTree* model, XMLElement* node) {
+  tree->loops.push_back(l);
+}
+
+void parseFrame(RigidBodyTree* tree, XMLElement* node) {
   const char* frame_name = node->Attribute("name");
   if (!frame_name) throw runtime_error("ERROR parsing Drake frame name");

   std::shared_ptr<RigidBodyFrame> frame =
-      drake::systems::MakeRigidBodyFrameFromURDFNode(*model, node, node,
+      drake::systems::MakeRigidBodyFrameFromURDFNode(*tree, node, node,
                                                      frame_name);
-  model->addFrame(frame);
+  tree->addFrame(frame);
 }

 /**
@@ -931,7 +931,7 @@
   }
 }

-void parseRobot(RigidBodyTree* model, XMLElement* node,
+void parseRobot(RigidBodyTree* tree, XMLElement* node,
                 const PackageMap& package_map, const string& root_dir,
                 const DrakeJoint::FloatingBaseType floating_base_type,
                 std::shared_ptr<RigidBodyFrame> weld_to_frame = nullptr) {
@@ -963,7 +963,7 @@
   for (XMLElement* link_node = node->FirstChildElement("link"); link_node;
        link_node = link_node->NextSiblingElement("link")) {
     int index;
-    if (parseLink(model, robotname, link_node, &materials, package_map,
+    if (parseLink(tree, robotname, link_node, &materials, package_map,
                   root_dir, &index)) {
       link_indices.push_back(index);
     } else {
@@ -1008,32 +1008,32 @@
   // Parses the model's joint elements.
   for (XMLElement* joint_node = node->FirstChildElement("joint"); joint_node;
        joint_node = joint_node->NextSiblingElement("joint"))
-    parseJoint(model, joint_node);
+    parseJoint(tree, joint_node);

   // Parses the model's transmission elements.
   for (XMLElement* transmission_node = node->FirstChildElement("transmission");
        transmission_node;
        transmission_node =
            transmission_node->NextSiblingElement("transmission"))
-    parseTransmission(model, transmission_node);
+    parseTransmission(tree, transmission_node);

   // Parses the model's loop joint elements.
   for (XMLElement* loop_node = node->FirstChildElement("loop_joint"); loop_node;
        loop_node = loop_node->NextSiblingElement("loop_joint"))
-    parseLoop(model, loop_node);
+    parseLoop(tree, loop_node);

   // Parses the model's Drake frame elements.
   for (XMLElement* frame_node = node->FirstChildElement("frame"); frame_node;
        frame_node = frame_node->NextSiblingElement("frame"))
-    parseFrame(model, frame_node);
+    parseFrame(tree, frame_node);

   // Adds the floating joint(s) that connect the newly added robot model to the
   // rest of the rigid body tree.
-  model->AddFloatingJoint(actual_floating_base_type, link_indices,
+  tree->AddFloatingJoint(actual_floating_base_type, link_indices,
                           weld_to_frame);
 }

-void parseURDF(RigidBodyTree* model, XMLDocument* xml_doc,
+void parseURDF(RigidBodyTree* tree, XMLDocument* xml_doc,
                PackageMap& package_map, const string& root_dir,
                const DrakeJoint::FloatingBaseType floating_base_type,
                std::shared_ptr<RigidBodyFrame> weld_to_frame = nullptr) {
@@ -1043,10 +1043,10 @@
     throw std::runtime_error("ERROR: This urdf does not contain a robot tag");
   }

-  parseRobot(model, node, package_map, root_dir, floating_base_type,
+  parseRobot(tree, node, package_map, root_dir, floating_base_type,
              weld_to_frame);

-  model->compile();
+  tree->compile();
 }

 }  // namespace
@@ -1055,10 +1055,10 @@
 namespace systems {

 std::shared_ptr<RigidBodyFrame> MakeRigidBodyFrameFromURDFNode(
-    const RigidBodyTree& model, const tinyxml2::XMLElement* link,
+    const RigidBodyTree& tree, const tinyxml2::XMLElement* link,
     const tinyxml2::XMLElement* pose, const std::string& name) {
   std::string body_name = link->Attribute("link");
-  RigidBody* body = model.FindBody(body_name);
+  RigidBody* body = tree.FindBody(body_name);
   if (body == nullptr) {
     throw runtime_error("ERROR: Couldn't find body \"" + body_name +
                         "\" referenced in frame \"" + name + "\".");


Fixed issue with buffers being wrongly cleared, closes #25484

--- drivers/gles2/rasterizer_storage_gles2.cpp
+++ drivers/gles2/rasterizer_storage_gles2.cpp
@@ -1028,6 +1028,11 @@
 		for (int i = 0; i < 6; i++) {
 			glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], sky->radiance, lod);

+			GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+			if (status != GL_FRAMEBUFFER_COMPLETE) {
+				break; //may be too small
+			}
+
 			glViewport(0, 0, size, size);

 			bind_quad_array();
@@ -2209,6 +2214,8 @@
 			glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, surface->index_id);
 			glBufferData(GL_ELEMENT_ARRAY_BUFFER, index_array_size, ir.ptr(), GL_STATIC_DRAW);
 			glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+		} else {
+			surface->index_id = 0;
 		}

 		// TODO generate wireframes


Adding more bounds overlap tests.

Adding more bounds overlap tests.

--- examples/common/bounds.cpp
+++ examples/common/bounds.cpp
@@ -1762,8 +1762,7 @@

 bool overlap(const Plane& _plane, const Vec3& _pos)
 {
-	BX_UNUSED(_plane, _pos);
-	return false;
+	return isNearZero(distance(_plane, _pos) );
 }

 bool overlap(const Plane& _plane, const Sphere& _sphere)
@@ -1935,8 +1934,44 @@

 bool overlap(const Triangle& _triangleA, const Triangle& _triangleB)
 {
-	BX_UNUSED(_triangleA, _triangleB);
-	return false;
+	const Vec3 baA = sub(_triangleA.v1, _triangleA.v0);
+	const Vec3 cbA = sub(_triangleA.v2, _triangleA.v1);
+	const Vec3 acA = sub(_triangleA.v0, _triangleA.v2);
+
+	const Vec3 baB = sub(_triangleB.v1, _triangleB.v0);
+	const Vec3 cbB = sub(_triangleB.v2, _triangleB.v1);
+	const Vec3 acB = sub(_triangleB.v0, _triangleB.v2);
+
+	const Vec3 axes[] =
+	{
+		cross(baA, cbA),
+		cross(baB, cbB),
+
+		cross(baB, baA),
+		cross(baB, cbA),
+		cross(baB, acA),
+
+		cross(cbB, baA),
+		cross(cbB, cbA),
+		cross(cbB, acA),
+
+		cross(acB, baA),
+		cross(acB, cbA),
+		cross(acB, acA),
+	};
+
+	for (uint32_t ii = 0; ii < BX_COUNTOF(axes); ++ii)
+	{
+		const Interval ia = projectToAxis(axes[ii], _triangleA);
+		const Interval ib = projectToAxis(axes[ii], _triangleB);
+
+		if (!overlap(ia, ib) )
+		{
+			return false;
+		}
+	}
+
+	return true;
 }

 bool overlap(const Triangle& _triangle, const Cylinder& _cylinder)


Removed the defensive wsSafeYield() call to wait till the app safely minimizes, since
that call never seems to return on Linux Mint 12 with MGSE enabled

git-svn-id: 7e36d3665aeca4d4e1f6df8911a80efc6ef565e7@4909 1f79f812-37fb-46fe-a122-30589dd2bf55

--- pwsafe/pwsafe/src/ui/wxWidgets/passwordsafeframe.cpp
+++ pwsafe/pwsafe/src/ui/wxWidgets/passwordsafeframe.cpp
@@ -2306,9 +2306,6 @@
 #ifndef __WXMAC__
   if (!IsIconized()) {
     Iconize();
-    while (!IsIconized()) {
-      wxSafeYield();
-    }
   }
 #endif


removed outdated code from examples/echo

--- examples/echo/testecho.cpp
+++ examples/echo/testecho.cpp
@@ -1,3 +1,23 @@
+/* Copyright (c) 2014 Quanta Research Cambridge, Inc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */

 #include <stdio.h>
 #include <stdlib.h>
@@ -10,55 +30,16 @@
 #include "GeneratedTypes.h"
 #include "SwallowProxy.h"

-#define LOOP_COUNT 1//000
-#define SEPARATE_EVENT_THREAD
-//#define USE_MUTEX_SYNC
-
 EchoRequestProxy *echoRequestProxy = 0;

-#ifndef SEPARATE_EVENT_THREAD
-typedef int SEM_TYPE;
-#define SEMPOST(A) (*(A))++
-#define SEMWAIT pthread_worker
-#elif defined(USE_MUTEX_SYNC)
-typedef pthread_mutex_t SEM_TYPE;
-#define SEMINIT(A) pthread_mutex_lock(A);
-#define SEMWAIT(A) pthread_mutex_lock(A);
-#define SEMPOST(A) pthread_mutex_unlock(A);
-#else // use semaphores
-typedef sem_t SEM_TYPE;
-#define SEMINIT(A) sem_init(A, 0, 0);
-#define SEMWAIT(A) sem_wait(A);
-#define SEMPOST(A) sem_post(A)
-#endif
-
-#ifdef SEPARATE_EVENT_THREAD
-#define PREPAREWAIT(A)
-#define CHECKSEM(A) 1
-#else // use inline sync
-#define PREPAREWAIT(A) (A) = 0
-#define CHECKSEM(A) (!(A))
-#endif
-
-#if 0
-#define START_TIMER(A) portalTimerStart(A)
-#define CATCH_TIMER(A) portalTimerCatch(A)
-#define LAP_TIMER(A) portalTimerLap(A)
-#else
-/* using timers make it difficult to compare AXI bus traces */
-#define START_TIMER(A) {}
-#define CATCH_TIMER(A) {}
-#define LAP_TIMER(A) (0)
-#endif
-
-static SEM_TYPE sem_heard2;
+static sem_t sem_heard2;

 PortalPoller *poller = 0;

 static void *pthread_worker(void *p)
 {
     void *rc = NULL;
-    while (CHECKSEM(sem_heard2) && !rc && !poller->stopping) {
+    while (!rc && !poller->stopping) {
         rc = poller->portalExec_poll(poller->portalExec_timeout);
         if ((long) rc >= 0)
             rc = poller->portalExec_event();
@@ -67,11 +48,9 @@
 }
 static void init_thread()
 {
-#ifdef SEPARATE_EVENT_THREAD
     pthread_t threaddata;
-    SEMINIT(&sem_heard2);
+    sem_init(&sem_heard2, 0, 0);
     pthread_create(&threaddata, NULL, &pthread_worker, (void*)poller);
-#endif
 }

 class EchoIndication : public EchoIndicationWrapper
@@ -82,10 +61,8 @@
 	echoRequestProxy->say2(v, 2*v);
     }
     virtual void heard2(uint32_t a, uint32_t b) {
-        CATCH_TIMER(20);
-        SEMPOST(&sem_heard2);
+        sem_post(&sem_heard2);
         //fprintf(stderr, "heard an echo2: %ld %ld\n", a, b);
-        //CATCH_TIMER(25);
     }
     EchoIndication(unsigned int id, PortalPoller *poller) : EchoIndicationWrapper(id, poller) {}
 };
@@ -93,22 +70,14 @@
 static void call_say(int v)
 {
     printf("[%s:%d] %d\n", __FUNCTION__, __LINE__, v);
-    START_TIMER(0);
-    PREPAREWAIT(sem_heard2);
     echoRequestProxy->say(v);
-    SEMWAIT(&sem_heard2);
-    printf("call_say: elapsed %llu\n", (unsigned long long)LAP_TIMER(0));
+    sem_wait(&sem_heard2);
 }

 static void call_say2(int v, int v2)
 {
-    START_TIMER(0);
-    PREPAREWAIT(sem_heard2);
-    CATCH_TIMER(0);
     echoRequestProxy->say2(v, v2);
-    CATCH_TIMER(19);
-    SEMWAIT(&sem_heard2);
-    CATCH_TIMER(30);
+    sem_wait(&sem_heard2);
 }

 int main(int argc, const char **argv)
@@ -123,46 +92,15 @@
     init_thread();
     portalExec_start();

-#if 0
-    printf("Timer tests\n");
-    portalTimerInit();
-    for (int i = 0; i < 1000; i++) {
-      START_TIMER(0);
-      CATCH_TIMER(1);
-      CATCH_TIMER(2);
-      CATCH_TIMER(3);
-      CATCH_TIMER(4);
-      CATCH_TIMER(5);
-      CATCH_TIMER(6);
-      CATCH_TIMER(7);
-      CATCH_TIMER(8);
-    }
-    portalTimerPrint(1000);
-#endif
-
     int v = 42;
     fprintf(stderr, "Saying %d\n", v);
     call_say(v);
     call_say(v*5);
     call_say(v*17);
     call_say(v*93);
-    printf("[%s:%d] run %d loops\n\n", __FUNCTION__, __LINE__, LOOP_COUNT);
     portalTimerInit();
-    START_TIMER(1);
-    for (int i = 0; i < LOOP_COUNT; i++)
-        call_say2(v, v*3);
-uint64_t elapsed = LAP_TIMER(1);
-    printf("TEST TYPE: "
-#ifndef SEPARATE_EVENT_THREAD
-       "INLINE"
-#elif defined(USE_MUTEX_SYNC)
-       "MUTEX"
-#else
-       "SEM"
-#endif
-       "\n");
-    portalTimerPrint(LOOP_COUNT);
-    printf("call_say: elapsed %g average %g\n", (double) elapsed, (double) elapsed/ (double) LOOP_COUNT);
+    call_say2(v, v*3);
+    printf("TEST TYPE: SEM\n");
     echoRequestProxy->setLeds(9);
     poller->portalExec_end();
     portalExec_end();


Lock moved to callback.

Lock moved to callback.

--- map/routing_session.cpp
+++ map/routing_session.cpp
@@ -45,13 +45,14 @@

 void RoutingSession::DoReadyCallback::operator() (Route & route, IRouter::ResultCode e)
 {
+  threads::MutexGuard guard(m_routeSessionMutexInner);
+  UNUSED_VALUE(guard);
+
   if (e == IRouter::NoError)
     m_rs.AssignRoute(route);
   else
     m_rs.m_state = RouteNotReady;

-  threads::MutexGuard guard(m_routeSessionMutexInner);
-  UNUSED_VALUE(guard);
   m_callback(m_rs.m_route, e);
 }

@@ -171,9 +172,6 @@

 void RoutingSession::AssignRoute(Route & route)
 {
-  threads::MutexGuard guard(m_routeSessionMutex);
-  UNUSED_VALUE(guard);
-
   ASSERT(route.IsValid(), ());
   m_state = RouteNotStarted;
   m_route.Swap(route);


Fix in RenderAttachment destructor

Fix in RenderAttachment destructor

Change-Id: I2bb8be038314b07cd410a3ab28739b35cb843926

--- dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp
+++ dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp
@@ -81,11 +81,16 @@

 RendererAttachment::~RendererAttachment()
 {
-  mMaterial->RemoveConnectionObserver(*this);
-  mGeometry->RemoveConnectionObserver(*this);
-
-  mMaterial=NULL;
-  mGeometry=NULL;
+  if (mMaterial)
+  {
+    mMaterial->RemoveConnectionObserver(*this);
+    mMaterial=NULL;
+  }
+  if (mGeometry)
+  {
+    mGeometry->RemoveConnectionObserver(*this);
+    mGeometry=NULL;
+  }
 }

 void RendererAttachment::Initialize2( BufferIndex updateBufferIndex )


minor refactoring.

minor refactoring.

--- io/glc_3dxmltoworld.cpp
+++ io/glc_3dxmltoworld.cpp
@@ -934,7 +934,7 @@
 				verticeStream >> buff;
 				verticeValues.append(buff.toFloat());
 			}
-			pMesh->addVertices(verticeValues.toVector());
+			pMesh->addVertice(verticeValues.toVector());

 		}

@@ -1661,7 +1661,7 @@
 				verticeStream >> buff;
 				verticeValues.append(buff.toFloat());
 			}
-			pMesh->addVertices(verticeValues.toVector());
+			pMesh->addVertice(verticeValues.toVector());

 		}


Lock continuation before calling event handler.

--- iocore/hostdb/HostDB.cc
+++ iocore/hostdb/HostDB.cc
@@ -1592,7 +1592,10 @@
   EThread *t = e ? e->ethread : this_ethread();

   MUTEX_TRY_LOCK(lock, action.mutex, t);
-  if (!lock.is_locked()) {
+  // Go ahead and grab the continuation mutex or just grab the action mutex again of there is no continuation mutex
+  MUTEX_TRY_LOCK(lock2, (action.continuation && action.continuation->mutex) ? action.continuation->mutex : action.mutex, t);
+  // Don't continue unless we have both mutexes
+  if (!lock.is_locked() || !lock2.is_locked()) {
     mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
     return EVENT_CONT;
   }


Add several protections when calling the function AxisChoice

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

--- graf3d/g3d/src/TAxis3D.cxx
+++ graf3d/g3d/src/TAxis3D.cxx
@@ -558,6 +558,7 @@
    // Get number of divisions.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetNdivisions();
 }

@@ -568,6 +569,7 @@
    // Get axis color.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetAxisColor();
 }

@@ -578,6 +580,7 @@
    // Get label color.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetLabelColor();
 }

@@ -588,6 +591,7 @@
    // Get label font.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetLabelFont();
 }

@@ -598,6 +602,7 @@
    // Get label offset.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetLabelOffset();
 }

@@ -608,6 +613,7 @@
    // Get label size.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetLabelSize();
 }

@@ -618,6 +624,7 @@
    // Get tick mark length.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return 0;
    return fAxis[ax].GetTickLength();
 }

@@ -628,8 +635,8 @@
    // Get title offset.

    Int_t ax = AxisChoice(axis);
-   fAxis[ax].GetTitleOffset();
-   return 0;
+   if (ax < 0) return 0;
+   return fAxis[ax].GetTitleOffset();
 }

@@ -665,6 +672,7 @@
    // Set axis range.

    Int_t ax = AxisChoice(axis);
+   if (ax < 0) return;
    TAxis *theAxis = &fAxis[ax];
    Int_t bin1 = theAxis->FindBin(xmin);
    Int_t bin2 = theAxis->FindBin(xmax);


subcategories now show for wikihelp for pages which have them, otherwise we show articles for leaf categories

--- code/code/cmd/cmd_help.cc
+++ code/code/cmd/cmd_help.cc
@@ -485,20 +485,30 @@
   int cArticles = 0, cCategories = 0;
   sstring subCategories;
   sstring childArticles;
+  bool isRoot = title == sstring(helpCategory[type]);

   // All categories are articles too, so there is a chance we have a categ.
   // We should query all pages which may be part of this category
   if (title.length() > 0 && convertTo<int>(db["page_namespace"]) > 0)
   {
+    // limit 201 means listing articles with listArticles will only show the first 201 articles
+    const int articleMax = 201;
     int categWidth = 0;
     int childWidth = 0;
-    int pageNs = listArticles ? 0 : convertTo<int>(db["page_namespace"]);
-    // limit 201 means listing articles with listArticles will only show the first 201 articles
-    const int articleMax = 201;
-
+    sstring pageNs = "";
+
+    // if listArticles then only query namespace == 0
+    // else if !isRoot then we should query all
+    // else query just for categories
+    if (listArticles)
+      pageNs = "AND page_namespace = " + db["page_namespace"];
+    else if (isRoot)
+      pageNs = "AND page_namespace != 0";
+
+    // do the query for subarticles/categories
     db.query("SELECT cl_sortkey, page_namespace FROM mw_page, mw_categorylinks WHERE cl_from = page_id AND \
-                cl_to = '%s' AND page_title != '%s' AND page_namespace = %i ORDER BY cl_sortkey LIMIT %i;",
-                title.c_str(), title.c_str(), pageNs, articleMax);
+                cl_to = '%s' AND page_title != '%s' %s ORDER BY cl_sortkey LIMIT %i;",
+                title.c_str(), title.c_str(), pageNs.c_str(), articleMax);
     while (db.fetchRow())
     {
       int page_namespace = convertTo<int>(db["page_namespace"]);
@@ -548,7 +558,7 @@
   if (cCategories > 0)
     article += format("\n\r%sThere are %i subcategories under the category '%s':%s\n\r\%s\n\r") % ch->desc->orangeBold() %
                     cCategories % title % ch->desc->norm() % subCategories;
-  if (listArticles && cArticles > 0)
+  if (cArticles > 0 && (listArticles || (!isRoot && !cCategories)))
     article += format("\n\r%sThere are %i articles under the category '%s':%s\n\r\%s\n\r") % ch->desc->orangeBold() %
                     cArticles % title % ch->desc->norm() % childArticles;


Handled duplicated semaphore objects in a hacky way.

--- renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp
+++ renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp
@@ -33,7 +33,7 @@
 	{ \
 		if(m_ImageInfo.find(GetResID(obj)) != m_ImageInfo.end()) m_ImageInfo.erase(GetResID(obj)); \
 		type unwrappedObj = Unwrap(obj); \
-		GetResourceManager()->ReleaseWrappedResource(obj, true); \
+		if(GetResourceManager()->HasWrapper(ToTypedHandle(unwrappedObj))) GetResourceManager()->ReleaseWrappedResource(obj, true); \
 		return ObjDisp(device)->func(Unwrap(device), unwrappedObj); \
 	}

@@ -310,8 +310,18 @@
 		}
 		else
 		{
-			ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), sem);
-			GetResourceManager()->AddLiveResource(id, sem);
+			if(GetResourceManager()->HasWrapper(ToTypedHandle(sem)))
+			{
+				// VKTODOMED need to handle duplicate objects better than this, perhaps
+				ResourceId live = GetResourceManager()->GetNonDispWrapper(sem)->id;
+				RDCDEBUG("Doing hack for duplicate objects that replay expects to be distinct - %llu -> %llu", id, live);
+				GetResourceManager()->ReplaceResource(id, GetResourceManager()->GetOriginalID(live));
+			}
+			else
+			{
+				ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), sem);
+				GetResourceManager()->AddLiveResource(id, sem);
+			}
 		}
 	}

@@ -327,27 +337,34 @@

 	if(ret == VK_SUCCESS)
 	{
-		ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pSemaphore);
-
-		if(m_State >= WRITING)
-		{
-			Chunk *chunk = NULL;
-
-			{
-				CACHE_THREAD_SERIALISER();
-
-				SCOPED_SERIALISE_CONTEXT(CREATE_SEMAPHORE);
-				Serialise_vkCreateSemaphore(localSerialiser, device, pCreateInfo, pSemaphore);
-
-				chunk = scope.Get();
-			}
-
-			VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pSemaphore);
-			record->AddChunk(chunk);
-		}
-		else
-		{
-			GetResourceManager()->AddLiveResource(id, *pSemaphore);
+		if(GetResourceManager()->HasWrapper(ToTypedHandle(*pSemaphore)))
+		{
+			*pSemaphore = (VkSemaphore)(uint64_t)GetResourceManager()->GetWrapper(ToTypedHandle(*pSemaphore));
+		}
+		else
+		{
+			ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pSemaphore);
+
+			if(m_State >= WRITING)
+			{
+				Chunk *chunk = NULL;
+
+				{
+					CACHE_THREAD_SERIALISER();
+
+					SCOPED_SERIALISE_CONTEXT(CREATE_SEMAPHORE);
+					Serialise_vkCreateSemaphore(localSerialiser, device, pCreateInfo, pSemaphore);
+
+					chunk = scope.Get();
+				}
+
+				VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pSemaphore);
+				record->AddChunk(chunk);
+			}
+			else
+			{
+				GetResourceManager()->AddLiveResource(id, *pSemaphore);
+			}
 		}
 	}


Minor warning fix

Minor warning fix

--- samples/browser/src/Win32CEGuiRendererSelector.cpp
+++ samples/browser/src/Win32CEGuiRendererSelector.cpp
@@ -107,8 +107,8 @@
         header->style           = DS_MODALFRAME|WS_CAPTION|WS_VISIBLE;
         header->dwExtendedStyle = 0;
         header->cdit            = 6;
-        header->x               = static_cast<short>(0x8000);
-        header->y               = static_cast<short>(0x8000);
+        header->x               = 20;
+        header->y               = 20;
         header->cx              = 150;
         header->cy              = 75;


move loop variables into least scope pos

Change-Id: I8e69e92bbfee2bf20918d041ecc6b7a3f7729fbd

--- scripting/source/stringresource/stringresource.cxx
+++ scripting/source/stringresource/stringresource.cxx
@@ -2238,8 +2238,7 @@

         // Create sorted array of pointers to the id strings
         const ::rtl::OUString** pIdPtrs = new const ::rtl::OUString*[nTabSize];
-        sal_Int32 i;
-        for( i = 0 ; i < nTabSize ; i++ )
+        for(sal_Int32 i = 0 ; i < nTabSize ; i++ )
             pIdPtrs[i] = NULL;
         for( it_index = rIndexMap.begin(); it_index != rIndexMap.end(); ++it_index )
         {
@@ -2248,7 +2247,7 @@
         }

         // Write lines in correct order
-        for( i = 0 ; i < nTabSize ; i++ )
+        for(sal_Int32 i = 0 ; i < nTabSize ; i++ )
         {
             const ::rtl::OUString* pStr = pIdPtrs[i];
             if( pStr != NULL )


[search] Ignore ranking for ProcessorTest_ExactMatchTest.

--- search/search_integration_tests/processor_test.cpp
+++ search/search_integration_tests/processor_test.cpp
@@ -1900,15 +1900,19 @@

   {
     auto request = MakeRequest("cafe лермонтово ");
-    auto const & results = request->Results();
+    auto results = request->Results();

     Rules rules{ExactMatch(wonderlandId, cafe), ExactMatch(wonderlandId, lermontov)};
     TEST(ResultsMatch(results, rules), ());

     TEST_EQUAL(2, results.size(), ("Unexpected number of retrieved cafes."));
-    TEST(ResultsMatch({results[0]}, {ExactMatch(wonderlandId, lermontov)}), ());
-    TEST(!results[0].GetRankingInfo().m_exactMatch, ());
-    TEST(results[1].GetRankingInfo().m_exactMatch, ());
+    if (!ResultsMatch({results[0]}, {ExactMatch(wonderlandId, cafe)}))
+      swap(results[0], results[1]);
+
+    TEST(ResultsMatch({results[0]}, {ExactMatch(wonderlandId, cafe)}), ());
+    TEST(ResultsMatch({results[1]}, {ExactMatch(wonderlandId, lermontov)}), ());
+    TEST(results[0].GetRankingInfo().m_exactMatch, ());
+    TEST(!results[1].GetRankingInfo().m_exactMatch, ());
   }

   {


Made it possible to specify memory on GPU

--- cnn/cuda.cc
+++ cnn/cuda.cc
@@ -33,11 +33,21 @@
   int requested_gpus = -1;
   vector<int> gpu_mask(MAX_GPUS,0);
   int argi = 1;
+  int num_mb = 512;
   bool ngpus_requested = false;
   bool ids_requested = false;
   for( ;argi < argc; ++argi) {
     string arg = argv[argi];
-    if (arg == "--cnn_gpus" || arg == "--cnn-gpus") {
+    if (arg == "--cnn-mem" || arg == "--cnn_mem") {
+      if ((argi + 1) > argc) {
+        cerr << "[cnn] --cnn-mem expects an argument (the memory, in megabytes, to reserve)\n";
+        abort();
+      } else {
+        string a2 = argv[argi+1];
+        istringstream c(a2); c >> num_mb;
+        RemoveArgs(argc, argv, argi, 2);
+      }
+    } else if (arg == "--cnn_gpus" || arg == "--cnn-gpus") {
       if ((argi + 1) > argc) {
         cerr << "[cnn] --cnn-gpus expects an argument (number of GPUs to use)\n";
         abort();
@@ -140,8 +150,7 @@
   cerr << "[cnn] Device(s) selected:";
   for (int i = 0; i < requested_gpus; ++i) {
     cerr << ' ' << gpus[i];
-    int mb = 512;
-    Device* d = new Device_GPU(mb, gpus[i]);
+    Device* d = new Device_GPU(num_mb, gpus[i]);
     gpudevices.push_back(d);
   }
   cerr << endl;


Add atom output, usefull for debugging

Add atom output, usefull for debugging

--- include/Atom.hpp
+++ include/Atom.hpp
@@ -10,6 +10,7 @@
 #ifndef HARP_ATOM_HPP
 #define HARP_ATOM_HPP

+#include <iostream>
 #include <string>
 #include <vector>
 #include <map>
@@ -80,6 +81,11 @@
     AtomType _type;
 };

+inline std::ostream& operator<<(std::ostream& out, const Atom& atom){
+    out << "Atom \"" << atom.name() << "\"";
+    return out;
+}
+
 //! All the elements in the periodic table
 const std::vector<std::string> ALL_ELEMENTS = std::vector<std::string>{
 "H" ,                                                                                "He",


Changed/Vendore show only useable items. (gms can see all items)

--- src/world/ItemHandler.cpp
+++ src/world/ItemHandler.cpp
@@ -1470,10 +1470,18 @@
         {
             if ((curItem = ItemPrototypeStorage.LookupEntry(itr->itemid)) != 0)
             {
-                if (curItem->AllowableClass && !(_player->getClassMask() & curItem->AllowableClass) && !_player->GetSession()->HasGMPermissions()) // cebernic: GM looking up for everything.
-                    continue;
-                if (curItem->AllowableRace && !(_player->getRaceMask() & curItem->AllowableRace) && !_player->GetSession()->HasGMPermissions())
-                    continue;
+                if (!_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM)) // looking up everything for active gms
+                {
+                    if (curItem->AllowableClass && !(_player->getClassMask() & curItem->AllowableClass))
+                        continue;
+
+                    if (curItem->AllowableRace && !(_player->getRaceMask() & curItem->AllowableRace))
+                        continue;
+
+                    int8 Slot = _player->GetItemInterface()->GetItemSlotByType(curItem->InventoryType);
+                    if (_player->GetItemInterface()->CanEquipItemInSlot(INVENTORY_SLOT_NOT_SET, Slot, curItem, true, true))
+                        continue;
+                }

                 int32 av_am = (itr->max_amount > 0) ? itr->available_amount : -1;
                 data << (counter + 1);


Added code to make PersonClass use the North Still AnimLayer if the appropriate on isn't available.

--- src/world/personclass.cpp
+++ src/world/personclass.cpp
@@ -41,9 +41,13 @@
 	}
 }

-AnimLayer PersonClass::anim(models::SpriteDirection facing, models::SpriteMotion motion) {
-	if ((uint) facing < m_animations.size() && (uint) motion < m_animations[(uint) facing].size()) {
-		return m_animations[(uint) facing][(uint) motion];
+AnimLayer PersonClass::anim(SpriteDirection facing, SpriteMotion motion) {
+	for (int i = 0; i < 2; i++) {
+		if ((uint) facing < m_animations.size() && (uint) motion < m_animations[(uint) facing].size()) {
+			return m_animations[(uint) facing][(uint) motion];
+		}
+		facing = (SpriteDirection) 0;
+		motion = (SpriteMotion) 0;
 	}
 	return AnimLayer();
 }


Make VideoWriter framerate optional (as stated in reference)

--- src/wrapper/misc_wrap.cpp
+++ src/wrapper/misc_wrap.cpp
@@ -136,6 +136,7 @@
         .def(init<CanvasPtr, const std::string&, int, int, int, bool>())
         .def(init<CanvasPtr, const std::string&, int, int, int>())
         .def(init<CanvasPtr, const std::string&, int>())
+        .def(init<CanvasPtr, const std::string&>())
         .def("stop", &VideoWriter::stop)
         .def("pause", &VideoWriter::pause)
         .def("play", &VideoWriter::play)


ASACORE-500: Fix the Endian swap issue for iOS

Change-Id: Ifd6629e9d352e838f61b97838848ba3c3b014859
Signed-off-by: Phil Nguyen <65bd0baa5058631294b996a81855326962572849@qce.qualcomm.com>

--- alljoyn_core/src/Message_Parse.cc
+++ alljoyn_core/src/Message_Parse.cc
@@ -122,7 +122,8 @@
                 uint16_t* p = (uint16_t*)arg->v_scalarArray.v_uint16;
                 uint16_t* n = (uint16_t*)bufPos;
                 for (size_t i = 0; i < arg->v_scalarArray.numElements; i++) {
-                    *p++ = EndianSwap16(*n++);
+                    *p++ = EndianSwap16(*n);
+                    n++;
                 }
                 arg->flags = MsgArg::OwnsData;
             } else {
@@ -179,7 +180,8 @@
                 uint32_t* p = (uint32_t*)arg->v_scalarArray.v_uint32;
                 uint32_t* n = (uint32_t*)bufPos;
                 for (size_t i = 0; i < arg->v_scalarArray.numElements; i++) {
-                    *p++ = EndianSwap32(*n++);
+                    *p++ = EndianSwap32(*n);
+                    n++;
                 }
                 arg->flags = MsgArg::OwnsData;
             } else {
@@ -204,7 +206,8 @@
                 uint64_t* p = (uint64_t*)arg->v_scalarArray.v_uint64;
                 uint64_t* n = (uint64_t*)bufPos;
                 for (size_t i = 0; i < arg->v_scalarArray.numElements; i++) {
-                    *p++ = EndianSwap64(*n++);
+                    *p++ = EndianSwap64(*n);
+                    n++;
                 }
                 arg->flags = MsgArg::OwnsData;
             } else {


modules/error_page.cpp: Include order

modules/error_page.cpp: Include order

--- modules/error_page.cpp
+++ modules/error_page.cpp
@@ -34,9 +34,9 @@
 #include <ironbeepp/module_delegate.hpp>
 #include <ironbeepp/transaction.hpp>

+#include <ironbee/path.h>
 #include <ironbee/rule_engine.h>
 #include <ironbee/string.h>
-#include <ironbee/path.h>

 #include <boost/bind.hpp>
 #include <boost/function.hpp>


fix potential one frame delay bug in scheduling

--- allocore/src/io/al_WindowGLUT.cpp
+++ allocore/src/io/al_WindowGLUT.cpp
@@ -483,19 +483,26 @@
 						al_sec timeNow = win->mFrameTime;
 						double FPS = win->fps();

-						// Compute pre-render frame number
+						// Pre-render frame number
 						double framePre = timeNow * FPS;

-						// Get post-render frame number
-						double framePost = al_time() * FPS;
+						// Next expected frame number
+						double frameNext = (unsigned long long)(framePre + 1.5);
+						// Next expected frame time
+						double timeNext = frameNext / FPS;
+
+						// Post-render frame time
+						double timePost = al_time();

 						// Did rendering take less time than frame interval?
-						// This check is necessary for non-quantized reduction of frame rate.
-						if((framePost - framePre) < 1.){
-							double waitFrames = framePost - (unsigned long long)(framePost+0.5);
-							waitFrames = 1.-waitFrames;
-							waitMsec = unsigned(waitFrames/FPS*1000. + 0.5);
-							//printf("num=%llu, frac=%g, %u, (dt=%g)\n", (unsigned long long)frameNum, waitFrames, wait_msec, impl->mSPFActual);
+						// If so, compute wait time...
+						if(timePost < timeNext){
+							double wait = timeNext - timePost;
+							waitMsec = unsigned(wait * 1000. + 0.5);
+							//printf("num=%llu, wait=%5.3f frames, %2u ms, dt=%5.3f, fps=%5.2f (avg=%5.2f)\n", (unsigned long long)(timePost*FPS), wait*FPS, waitMsec, win->mDeltaTime, win->fpsActual(), win->fpsAvg());
+						}
+						else{
+							//printf("dropped frame!\n");
 						}
 					}


New format

New format

--- codeforces/574D_blocks.cc
+++ codeforces/574D_blocks.cc
@@ -3,42 +3,38 @@
 #include <bits/stdc++.h>
 using namespace std;

-///////////////////////////////////////////////////////////////////////////////
-// Unit tests base Class
-///////////////////////////////////////////////////////////////////////////////
-
-
-class Unittest { public:
+// Cppunit - C++ Unit testing TDD framework (github.com/cppunit/cppunit)
+class Cppunit { public:
     #define CHECK(a,b)  check<long long>(a, b, #a, #b, __FILE__, __LINE__, __FUNCTION__);
-    #define CHECKT(a)   check<int>(a, 1, #a, "true", __FILE__, __LINE__, __FUNCTION__);
+    #define CHECKT(a)   check<bool>(a, true, #a, "true", __FILE__, __LINE__, __FUNCTION__);
     #define CHECKS(a,b) check<cs>(a, b, #a, #b, __FILE__, __LINE__, __FUNCTION__);
-    typedef const string& cs;
-    int checks, fails; ostringstream serr; istringstream *in;
-    Unittest() { checks = fails = 0;}
-    void test_cin(cs s){ in = new istringstream(s); cin.rdbuf(in->rdbuf()); }
+    typedef const std::string& cs;
+    int checks, fails; std::ostringstream serr; std::istringstream *in;
+    Cppunit() { checks = fails = 0;}
+    void test_cin(cs s){ in = new std::istringstream(s); std::cin.rdbuf(in->rdbuf()); }
     void fail_hdr(cs stra, cs strb, cs file, int line, cs func) {
-        serr << "==================================================" << endl;
-        serr << "FAIL: " << func << endl;
-        serr << "--------------------------------------------------" << endl;
-        serr << "File \"" << file << "\", line " << line << " in " << func << endl;
-        serr << "  Checking " << stra << " == " << strb << endl;
+        serr << "==================================================" << std::endl;
+        serr << "FAIL: " << func << std::endl;
+        serr << "--------------------------------------------------" << std::endl;
+        serr << "File \"" << file << "\", line " << line << " in " << func << std::endl;
+        serr << "  Checking " << stra << " == " << strb << std::endl;
     }
     template <typename T> void check(T a, T b, cs stra, cs strb, cs file, int line, cs func) {
-        checks++; if (a == b) { cout << "."; return; }
-        fails++; cout << "F"; fail_hdr(stra, strb, file, line, func);
-        serr << "  Error: \"" << a << "\" ! = \"" << b << "\"" << endl << endl;
+        checks++; if (a == b) { std::cout << "."; return; }
+        fails++; std::cout << "F"; fail_hdr(stra, strb, file, line, func);
+        serr << "  Error: \"" << a << "\" ! = \"" << b << "\"" << std::endl << std::endl;
     }
     virtual void single_test() {}
     virtual void test_list() { single_test(); }
     double dclock() { return double(clock()) / CLOCKS_PER_SEC; }
     status() {
-        cout << endl; if (fails) cout << serr.str();
-        cout << "--------------------------------------------------" << endl;
-        cout << "Ran " << checks << " checks in " << dclock() << "s" << endl << endl;
-        if (fails) cout << "FAILED (failures=" << fails << ")"; else cout << "OK" << endl;
+        std::cout << std::endl; if (fails) std::cout << serr.str();
+        std::cout << "--------------------------------------------------" << std::endl;
+        std::cout << "Ran " << checks << " checks in " << dclock() << "s" << std::endl << std::endl;
+        if (fails) std::cout << "FAILED (failures=" << fails << ")"; else std::cout << "OK" << std::endl;
         return fails > 0;
     }
-    run() { streambuf* ocin = cin.rdbuf(); test_list(); cin.rdbuf(ocin); return status(); }
+    run() { std::streambuf* ocin = std::cin.rdbuf(); test_list(); std::cin.rdbuf(ocin); return status(); }
 };

 ///////////////////////////////////////////////////////////////////////////////
@@ -67,9 +63,12 @@

     string calculate(){

-        for(int i=0; i<n; i++) left.push_back(min(i == 0 ? 1 : left[i-1]+1, nums[i]));
-        for(int i=0; i<n; i++) right.push_back(min(i == 0 ? 1 : right[i-1]+1, nums[n-i-1]));
-        for(int i=0; i<n; i++) mmax = max(mmax, min(left[n-i-1], right[i]));
+        for(int i=0; i<n; i++)
+            left.push_back(min(i == 0 ? 1 : left[i-1]+1, nums[i]));
+        for(int i=0; i<n; i++)
+            right.push_back(min(i == 0 ? 1 : right[i-1]+1, nums[n-i-1]));
+        for(int i=0; i<n; i++)
+            mmax = max(mmax, min(left[n-i-1], right[i]));

         // Converting result to string
         ostringstream resstr;
@@ -79,11 +78,11 @@
 };

 ///////////////////////////////////////////////////////////////////////////////
-// Local Unit tests
+// Unit tests
 ///////////////////////////////////////////////////////////////////////////////

-class LocalUnittest: public Unittest {
+class MyCppunit: public Cppunit {

     Blocks* d;

@@ -136,20 +135,15 @@
     }
 };

-///////////////////////////////////////////////////////////////////////////////
-// Main Execution
-///////////////////////////////////////////////////////////////////////////////
-

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

     // Faster cin and cout
     ios_base::sync_with_stdio(0);cin.tie(0);

-    if (argc > 1 && !strcmp(argv[1], "-ut")) {
-        LocalUnittest lut;
-        return lut.run();
-    }
+    if (argc > 1 && !strcmp(argv[1], "-ut"))
+        return (new MyCppunit)->run();
+
     cout << (new Blocks)->calculate() << endl;
     return 0;
 }


IMPORTANT: initialize weights to 1/sqrt(n_inputs);

--- modules/ml/src/cnn.cpp
+++ modules/ml/src/cnn.cpp
@@ -969,7 +969,8 @@
     CV_CALL(cvCopy( weights, layer->weights ));
   } else {
     CvRNG rng = cvRNG( 0xFFFFFFFF );
-    cvRandArr( &rng, layer->weights, CV_RAND_UNI, cvRealScalar(-1), cvRealScalar(1) );
+    cvRandArr( &rng, layer->weights, CV_RAND_UNI,
+               cvScalar(-1.f/sqrt(n_inputs)), cvScalar(1.f/sqrt(n_inputs)) );
     // initialize bias to zero
     for (int ii=0;ii<n_outputs;ii++){ CV_MAT_ELEM(*layer->weights,float,ii,n_inputs)=0; }
   }


Fix cache error during SVM train

Fix cache error during SVM train

--- modules/ml/src/svm.cpp
+++ modules/ml/src/svm.cpp
@@ -538,6 +538,8 @@
                 {
                     kr.idx = cache_size;
                     cache_size++;
+                    if (!lru_last)
+                        lru_last = i1+1;
                 }
                 else
                 {
@@ -546,6 +548,8 @@
                     last.idx = -1;
                     lru_cache[last.prev].next = 0;
                     lru_last = last.prev;
+                    last.prev = 0;
+                    last.next = 0;
                 }
                 kernel->calc( sample_count, var_count, samples.ptr<float>(),
                               samples.ptr<float>(i1), lru_cache_data.ptr<Qfloat>(kr.idx) );
@@ -561,6 +565,8 @@
                 else
                     lru_first = kr.next;
             }
+            if (lru_first)
+                lru_cache[lru_first].prev = i1+1;
             kr.next = lru_first;
             kr.prev = 0;
             lru_first = i1+1;


fix a problem reported by SUn's CC5.

fix a problem reported by SUn's CC5.

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

--- star/src/TTableSorter.cxx
+++ star/src/TTableSorter.cxx
@@ -1,6 +1,6 @@
-// @(#)root/star:$Name:  $:$Id: TTableSorter.cxx,v 1.1.1.1 2000/05/16 17:00:49 rdm Exp $
+// @(#)root/star:$Name:  $:$Id: TTableSorter.cxx,v 1.2 2000/12/11 09:35:06 brun Exp $
 // Author: Valery Fine   26/01/99  (E-mail: fine@bnl.gov)
-// $Id: TTableSorter.cxx,v 1.1.1.1 2000/05/16 17:00:49 rdm Exp $
+// $Id: TTableSorter.cxx,v 1.2 2000/12/11 09:35:06 brun Exp $

 #include <stdlib.h>
 #include "TTableSorter.h"
@@ -493,7 +493,7 @@
   Int_t index = -1;
   if (fSearchMethod) {
     void **p = (void **)bsearch( value,  // Object to search for
-                   fSortIndex,          // Pointer to base of search data
+                   (void*)fSortIndex,    // Pointer to base of search data
                    fNumberOfRows,       // Number of elements
                    sizeof(void *),       // Width of elements
                    CALLQSORT(fSearchMethod));
@@ -746,7 +746,7 @@
     };

    if (compare)
-           qsort(fSortIndex,  //Start of target array
+           qsort((void*)fSortIndex,  //Start of target array
                 fNumberOfRows,       //Array size in elements
                 sizeof(void *),       //Element size in bytes
                 CALLQSORT(compare));