Resolves: fdo#79227 labels are truncated

Change-Id: I9d5cd9491325aab6c844c889bf4db6baab2e75c8

--- extensions/source/bibliography/toolbar.cxx
+++ extensions/source/bibliography/toolbar.cxx
@@ -216,15 +216,13 @@
     aEdQuery.Show();

     OUString aStr=GetItemText(TBC_FT_SOURCE);
-    Rectangle aRect=GetItemRect(TBC_FT_SOURCE);
     aFtSource.SetText(aStr);
-    aFtSource.SetSizePixel(aRect.GetSize());
+    aFtSource.SetSizePixel(aFtSource.get_preferred_size());
     aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT ));

     aStr=GetItemText(TBC_FT_QUERY);
-    aRect=GetItemRect(TBC_FT_QUERY);
     aFtQuery.SetText(aStr);
-    aFtQuery.SetSizePixel(aRect.GetSize());
+    aFtQuery.SetSizePixel(aFtQuery.get_preferred_size());
     aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT ));

     SetItemWindow(TBC_FT_SOURCE,&aFtSource);


Update ex3_5b.cpp

Update ex3_5b.cpp

--- ch03/ex3_5b.cpp
+++ ch03/ex3_5b.cpp
@@ -9,17 +9,9 @@

 int main()
 {
-  string largeStr;
-  string str;
-  while (cin >> str)
-  {
-    if (largeStr.empty())
-      largeStr += str;
-    else
-      largeStr += " " + str;
-  }
+    string str;
+    for (string buff; cin >> buff; str += (str.empty() ? "" : " ") + buff);
+    cout << "The concatenated string is " << str << endl;

-  cout << "The concatenated string is " << largeStr << endl;
-
-  return 0;
+    return 0;
 }


Update ex6_27.cpp

Update ex6_27.cpp


Update ex9_50.cpp

Update ex9_50.cpp

--- ch09/ex9_50.cpp
+++ ch09/ex9_50.cpp
@@ -1,36 +1,36 @@
 //! @Yue Wang
 //!
 //! Exercise 9.50:
-//! Write a program to process a vector<string>s whose elements represent
-//! integral values.
+//! Write a program to process a vector<string> whose elements represent integral values.
 //! Produce the sum of all the elements in that vector.
-//! Change the program so that it sums of strings that represent floating-point
-//! values.
+//! Change the program so that it sums of strings that represent floating-point values.
 //!

 #include <iostream>
 #include <string>
 #include <vector>
+using namespace std;

-int sum_for_int(const std::vector<std::string> &v)
+int sum_for_int(const vector<string> &svec)
 {
-    int sum = 0;
-    for (auto const& s : v) sum += std::stoi(s);
+    int sum=0;
+    for(const auto &s : svec)
+        sum+=stoi(s);
     return sum;
+
 }

-float sum_for_float(const std::vector<std::string> &v)
+float sum_for_float(const vector<string> &svec)
 {
-    float sum = 0.0;
-    for (auto const& s : v) sum += std::stof(s);
+    float sum=0.0;
+    for(const auto &s:svec)
+        sum+=stof(s);
     return sum;
 }

 int main()
 {
-    std::vector<std::string> v = {"1", "2", "3", "4.5"};
-    std::cout << sum_for_int(v) << std::endl;
-    std::cout << sum_for_float(v) << std::endl;
-
-    return 0;
+    vector<string> svec{"1", "2", "3", "4.5"};
+    cout<<sum_for_int(svec)<<endl;
+    cout<<sum_for_float(svec)<<endl;
 }


Fix warnings in features/esf.hpp

Fix warnings in features/esf.hpp

> esf.hpp:77:9: warning: unused variable 'h_d1' [-Wunused-variable]

--- features/include/pcl/features/impl/esf.hpp
+++ features/include/pcl/features/impl/esf.hpp
@@ -74,7 +74,6 @@
   float h_a3_in[binsize] = {0};
   float h_a3_out[binsize] = {0};
   float h_a3_mix[binsize] = {0};
-  float h_d1[binsize] = {0};

   float h_d3_in[binsize] = {0};
   float h_d3_out[binsize] = {0};


ruby: Fix memory leak in AbstractController

Recent changes to memory access queuing allocate requests for packets sent to
memory controllers, but did not free the requests. Delete them to avoid leaks.

--- src/mem/ruby/slicc_interface/AbstractController.cc
+++ src/mem/ruby/slicc_interface/AbstractController.cc
@@ -328,6 +328,7 @@
     }

     getMemoryQueue()->enqueue(msg, clockEdge(), cyclesToTicks(Cycles(1)));
+    delete pkt->req;
     delete pkt;
 }


Add test for #580 (successful)

Add test for #580 (successful)

git-svn-id: 6c2b1bd10c324c49ea9d9e6e31006a80e70507cb@3839 5242fede-7e19-0410-aef8-94bd7d2200fb


do not run fw attitude controller when in rotary wing mode (VTOL)

--- src/modules/fw_att_control/fw_att_control_main.cpp
+++ src/modules/fw_att_control/fw_att_control_main.cpp
@@ -796,6 +796,11 @@
 				//warnx("_actuators_airframe.control[1] = -1.0f;");
 			}

+			/* if we are in rotary wing mode, do nothing */
+			if (_vehicle_status.is_rotary_wing) {
+				continue;
+			}
+
 			/* decide if in stabilized or full manual control */

 			if (_vcontrol_mode.flag_control_attitude_enabled) {


added comment why reseting at this point; created variable for horizontal velocity magnitude

--- src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -925,7 +925,10 @@
 		/* check for pos. hold */
 		if (fabsf(req_vel_sp(0)) < _params.hold_xy_dz && fabsf(req_vel_sp(1)) < _params.hold_xy_dz) {
 			if (!_pos_hold_engaged) {
-				if (_params.hold_max_xy < FLT_EPSILON || (sqrtf(_vel(0)*_vel(0) + _vel(1)*_vel(1)) < _params.hold_max_xy)) {
+
+				float vel_xy_mag = sqrtf(_vel(0)*_vel(0) + _vel(1)*_vel(1));
+				if (_params.hold_max_xy < FLT_EPSILON || vel_xy_mag < _params.hold_max_xy) {
+					/* reset position setpoint to have smooth transition from velocity control to position control */
 					_pos_hold_engaged = true;
 					_pos_sp(0) = _pos(0);
 					_pos_sp(1) = _pos(1);
@@ -955,6 +958,7 @@
 		if (fabsf(req_vel_sp(2)) < FLT_EPSILON) {
 			if (!_alt_hold_engaged) {
 				if (_params.hold_max_z < FLT_EPSILON || fabsf(_vel(2)) < _params.hold_max_z) {
+					/* reset position setpoint to have smooth transition from velocity control to position control */
 					_alt_hold_engaged = true;
 					_pos_sp(2) = _pos(2);


mc_pos_control: rebase fix

mc_pos_control: rebase fix

--- src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -411,6 +411,7 @@
 	_acceleration_hor_max(this, "ACC_HOR_MAX", true),
 	_deceleration_hor_max(this, "DEC_HOR_MAX", true),
 	_target_threshold_xy(this, "TARGET_THRE"),
+	_min_cruise_speed(this, "CRUISE_MIN", true),
 	_velocity_hor_manual(this, "VEL_MAN_MAX", true),
 	_takeoff_ramp_time(this, "TKO_RAMP_T", true),
 	_min_cruise_speed(this, "CRUISE_MIN", true),
@@ -759,6 +760,7 @@
 		    !PX4_ISFINITE(_pos_sp_triplet.current.alt)) {
 			_pos_sp_triplet.current.valid = false;
 		}
+
 	}

 	orb_check(_home_pos_sub, &updated);
@@ -1415,6 +1417,7 @@
 		}

+		/* sanity check */
 		if (PX4_ISFINITE(_curr_pos_sp(0)) &&
 		    PX4_ISFINITE(_curr_pos_sp(1)) &&
 		    PX4_ISFINITE(_curr_pos_sp(2))) {
@@ -1428,10 +1431,6 @@
 		if (diff.length() > FLT_EPSILON) {
 			triplet_updated = true;
 		}
-
-		/* we need to update _curr_pos_sp always since navigator applies slew rate on z */
-		_curr_pos_sp = curr_pos_sp;
-
 	}

 	if (_pos_sp_triplet.previous.valid) {
@@ -1452,7 +1451,6 @@
 	/* set previous setpoint to current position if no previous setpoint available */
 	if (!previous_setpoint_valid && triplet_updated) {
 		_prev_pos_sp = _pos;
-		previous_setpoint_valid = true; /* currrently not necessary to set to true since not used*/
 	}

 	if (_pos_sp_triplet.next.valid) {
@@ -1498,6 +1496,8 @@
 			bool stay_at_current_pos = (_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_LOITER
 						    || !next_setpoint_valid)
 						   && ((pos_sp_diff.length()) < SIGMA_NORM);
+
+

 			/* only follow line if previous to current has a minimum distance */
 			if ((vec_prev_to_current.length()  > _nav_rad.get()) && !stay_at_current_pos) {


INTEGRATION: CWS oj14 (1.15.22); FILE MERGED 2007/06/26 20:13:29 fs 1.15.22.1: #i78908# ~SdrObject inaccessible now, need to use SdrObject::Free instead

--- svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: EnhancedCustomShapeEngine.cxx,v $
  *
- *  $Revision: 1.16 $
- *
- *  last change: $Author: hr $ $Date: 2007-06-27 16:43:42 $
+ *  $Revision: 1.17 $
+ *
+ *  last change: $Author: rt $ $Date: 2007-07-06 07:32:24 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -289,7 +289,7 @@
     {
         SvxShape* pShape = SvxShape::getImplementation( xShape );
         if ( pShape )
-            pShape->SetTemporaryShape( sal_True );
+            pShape->TakeSdrObjectOwnership();
 /*
         ::com::sun::star::uno::Reference<
             ::com::sun::star::drawing::XShapes > xShapes( xShape, ::com::sun::star::uno::UNO_QUERY );
@@ -338,14 +338,17 @@
             {
                 SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
                 if ( pRenderedFontWork )
-                    delete pRenderedShape, pRenderedShape = pRenderedFontWork;
+                {
+                    SdrObject::Free( pRenderedShape );
+                    pRenderedShape = pRenderedFontWork;
+                }
             }
             SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
             if ( pRenderedShape3d )
             {
                 bFlipV = bFlipH = sal_False;
                 nRotateAngle = 0;
-                delete pRenderedShape;
+                SdrObject::Free( pRenderedShape );
                 pRenderedShape = pRenderedShape3d;
             }
             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
@@ -467,9 +470,9 @@
                         aPolyPolygon.append(aPP);
                     }
                 }
-                delete pNewObj;
-            }
-            delete pObj;
+                SdrObject::Free( pNewObj );
+            }
+            SdrObject::Free( pObj );
             SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPolygon, aPolyPolygonBezierCoords );
         }
     }


some fixes

some fixes

--- anyfunc.hpp
+++ anyfunc.hpp
@@ -481,7 +481,7 @@

   explicit operator bool() const noexcept
   {
-    return any_.has_value();
+    return f_;
   }

   template <typename R, typename ...A>


Fix to BasicBlockDecomposerTest.HasInlineAssembly expectations.

BUG=
R=rogerm@chromium.org

Review URL: https://codereview.appspot.com/13306049

git-svn-id: db59699583a60be9a535cd09cdc9132301867226@1766 15e8cca8-e42c-11de-a347-f34a4f72eb7d

--- syzygy/block_graph/basic_block_decomposer_unittest.cc
+++ syzygy/block_graph/basic_block_decomposer_unittest.cc
@@ -155,14 +155,21 @@
   return net_bb_size;
 }

+struct BasicBlockOffsetComparator {
+  bool operator()(const BasicBlock* bb0, const BasicBlock* bb1) {
+    DCHECK_NE(reinterpret_cast<const BasicBlock*>(NULL), bb0);
+    DCHECK_NE(reinterpret_cast<const BasicBlock*>(NULL), bb1);
+    return bb0->offset() < bb1->offset();
+  }
+};
+
 void ValidateHasInlineAssemblyBlock5677(const BasicBlockSubGraph& bbsg) {
   ASSERT_EQ(3u, bbsg.basic_blocks().size());

-  BasicBlockSubGraph::BBCollection::const_iterator bb_it =
-      bbsg.basic_blocks().begin();
-  const BasicBlock* bb0 = *bb_it;
-  const BasicBlock* bb1 = *(++bb_it);
-  const BasicBlock* bb2 = *(++bb_it);
+  // Get the basic blocks sorted by their original offsets.
+  std::vector<const BasicBlock*> bbs(bbsg.basic_blocks().begin(),
+                                     bbsg.basic_blocks().end());
+  std::sort(bbs.begin(), bbs.end(), BasicBlockOffsetComparator());

   // cachedHasSSE2
   // bb0:
@@ -172,9 +179,10 @@
   // 0044DA58  sub         esp,14h
   // 0044DA5B  test        byte ptr ds:[41EA07Ch],al
   // 0044DA61  jne         bb2
-  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bb0->type());
-  const BasicCodeBlock* bcb0 = BasicCodeBlock::Cast(bb0);
+  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bbs[0]->type());
+  const BasicCodeBlock* bcb0 = BasicCodeBlock::Cast(bbs[0]);
   ASSERT_NE(reinterpret_cast<const BasicCodeBlock*>(NULL), bcb0);
+  EXPECT_EQ(0, bcb0->offset());
   EXPECT_EQ(5u, bcb0->instructions().size());
   EXPECT_EQ(17u, bcb0->GetInstructionSize());
   EXPECT_EQ(2u, bcb0->successors().size());
@@ -206,9 +214,10 @@
   // 0044DAA3  mov         esp,ebp
   // 0044DAA5  pop         ebp
   // 0044DAA6  ret
-  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bb1->type());
-  const BasicCodeBlock* bcb1 = BasicCodeBlock::Cast(bb1);
+  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bbs[1]->type());
+  const BasicCodeBlock* bcb1 = BasicCodeBlock::Cast(bbs[1]);
   ASSERT_NE(reinterpret_cast<const BasicCodeBlock*>(NULL), bcb1);
+  EXPECT_EQ(19, bcb1->offset());
   EXPECT_EQ(26u, bcb1->instructions().size());
   EXPECT_EQ(68u, bcb1->GetInstructionSize());
   EXPECT_EQ(0u, bcb1->successors().size());
@@ -219,9 +228,10 @@
   // 0044DAAE  pop         ebp
   // 0044DAAF  ret
   // 0044DAB0
-  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bb2->type());
-  const BasicCodeBlock* bcb2 = BasicCodeBlock::Cast(bb2);
+  EXPECT_EQ(BasicBlock::BASIC_CODE_BLOCK, bbs[2]->type());
+  const BasicCodeBlock* bcb2 = BasicCodeBlock::Cast(bbs[2]);
   ASSERT_NE(reinterpret_cast<const BasicCodeBlock*>(NULL), bcb2);
+  EXPECT_EQ(87, bcb2->offset());
   EXPECT_EQ(4u, bcb2->instructions().size());
   EXPECT_EQ(9u, bcb2->GetInstructionSize());
   EXPECT_EQ(0u, bcb2->successors().size());


added boundary_hits to CFEM_DiffusionStamper tests

--- src/formulation/tests/cfem_diffusion_stamper_test.cc
+++ src/formulation/tests/cfem_diffusion_stamper_test.cc
@@ -41,15 +41,24 @@
   std::unique_ptr<NiceMock<formulation::scalar::CFEM_DiffusionMock<2>>> mock_diffusion_ptr;
   void SetUp() override;
   InitToken init_token_;
+
 };

 // TODO(Josh) Move this to a header where other stamper tests can use it
-void FillMatrixWithOnes(Matrix& to_fill, Unused, Unused, Unused) {
+void OnesFill(Matrix& to_fill) {
   for (unsigned int i = 0; i < to_fill.n_rows(); ++i) {
     for (unsigned int j = 0; j < to_fill.n_cols(); ++j) {
       to_fill(i,j) = 1;
     }
   }
+}
+
+void FillMatrixWithOnes(Matrix& to_fill, Unused, Unused, Unused) {
+  OnesFill(to_fill);
+}
+
+void FillMatrixWithOnesBoundary(Matrix& to_fill, Unused, Unused, Unused, Unused) {
+  OnesFill(to_fill);
 }

 void CFEMDiffusionStamperTest::SetUp() {
@@ -98,7 +107,8 @@
   dealii::FE_Q<2> fe_;
   dealii::IndexSet locally_relevant_dofs;
   dealii::IndexSet locally_owned_dofs_;
-  dealii::PETScWrappers::MPI::SparseMatrix system_matrix_, index_hits_;
+  dealii::PETScWrappers::MPI::SparseMatrix system_matrix_;
+  dealii::PETScWrappers::MPI::SparseMatrix index_hits_, boundary_hits_;
   std::vector<Cell> cells_;
   std::vector<int> material_ids_;
 };
@@ -182,6 +192,7 @@
   // Set up MPI matrices
   system_matrix_.reinit(locally_owned_dofs_, locally_owned_dofs_, dsp, MPI_COMM_WORLD);
   index_hits_.reinit(locally_owned_dofs_, locally_owned_dofs_, dsp, MPI_COMM_WORLD);
+  boundary_hits_.reinit(locally_owned_dofs_, locally_owned_dofs_, dsp, MPI_COMM_WORLD);

   std::vector<dealii::types::global_dof_index> local_dof_indices(fe_.dofs_per_cell);

@@ -190,9 +201,12 @@
     for (auto index_i : local_dof_indices) {
       for (auto index_j : local_dof_indices) {
         index_hits_.add(index_i, index_j, 1);
+        if (cell->at_boundary())
+          boundary_hits_.add(index_i, index_j, 1);
       }
     }
     index_hits_.compress(dealii::VectorOperation::add);
+    boundary_hits_.compress(dealii::VectorOperation::add);
   }
 }


radeon/llvm: Lower bitcast instructions to copies

--- src/gallium/drivers/radeon/R600LowerInstructions.cpp
+++ src/gallium/drivers/radeon/R600LowerInstructions.cpp
@@ -255,6 +255,16 @@
                   .addImm(0);
           break;
         }
+
+      case AMDIL::IL_ASINT_f32:
+      case AMDIL::IL_ASINT_i32:
+      case AMDIL::IL_ASFLOAT_f32:
+      case AMDIL::IL_ASFLOAT_i32:
+        BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::COPY))
+                .addOperand(MI.getOperand(0))
+                .addOperand(MI.getOperand(1));
+        break;
+
       case AMDIL::ILT:
         BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::SETGT_INT))
                 .addOperand(MI.getOperand(0))


[xla:cpu] Re-enable znver3-specific codegen

Fix has landed in LLVM
https://github.com/llvm/llvm-project/commit/7ae5d00afaf39fae78e411cb44f665e1dc52b356

PiperOrigin-RevId: 466656508

--- tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc
+++ tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc
@@ -79,14 +79,6 @@
   return result;
 }

-llvm::StringRef DetectHostCpuName() {
-  auto cpu = llvm::sys::getHostCPUName();
-  // TODO(b/238469947): Targeting znver3 triggers a very deep recursion in LLVM.
-  // Fall back to zen 2 until https://reviews.llvm.org/D129745 lands to avoid
-  // running out of stack.
-  return cpu == "znver3" ? "znver2" : cpu;
-}
-
 }  // namespace

 /*static*/ std::unique_ptr<llvm::TargetMachine>
@@ -99,7 +91,7 @@
           .setOptLevel(opt_level)
           .selectTarget(
               /*TargetTriple=*/llvm::Triple(), /*MArch=*/"",
-              /*MCPU=*/DetectHostCpuName(),
+              /*MCPU=*/llvm::sys::getHostCPUName(),
               /*MAttrs=*/DetectMachineAttributes()));
   CHECK(target_machine != nullptr);
   return target_machine;


Fix styling

Fix styling

--- tensorflow/compiler/xla/service/hlo_evaluator_test.cc
+++ tensorflow/compiler/xla/service/hlo_evaluator_test.cc
@@ -56,7 +56,8 @@
     evaluator_ = absl::make_unique<HloEvaluator>();
   }

-  StatusOr<Literal> Evaluate(absl::Span<const Literal* const> arg_literals = {}) {
+  StatusOr<Literal> Evaluate(
+      absl::Span<const Literal* const> arg_literals = {}) {
     if (use_bfloat16_) {
       // In BF16 mode, we convert all F32 type to BF16 and evaluate the module.
       auto type_converter = HloElementTypeConverter(F32, BF16);
@@ -1918,8 +1919,10 @@
   HloEvaluator evaluator;
   Literal param0_literal = LiteralUtil::CreateR1<float>({1, 2, 3, 4});
   Literal square_literal = LiteralUtil::CreateR1<float>({10, 20, 30, 40});
-  TF_ASSERT_OK_AND_ASSIGN(Literal result, evaluator.EvaluateWithSubstitutions(
-      add, {{param0, &param0_literal}, {square, &square_literal}}));
+  TF_ASSERT_OK_AND_ASSIGN(
+      Literal result,
+      evaluator.EvaluateWithSubstitutions(
+          add, {{param0, &param0_literal}, {square, &square_literal}}));
   EXPECT_TRUE(LiteralTestUtil::Equal(
       LiteralUtil::CreateR1<float>({11, 22, 33, 44}), result));
 }
@@ -2019,7 +2022,8 @@
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
   EXPECT_TRUE(LiteralTestUtil::Equal(
       LiteralUtil::CreateR3<int32>(
-          {{{1, 3}, {4, 6}, {7, 9}}, {{3, 2}, {6, 5}, {9, 8}}}), result));
+          {{{1, 3}, {4, 6}, {7, 9}}, {{3, 2}, {6, 5}, {9, 8}}}),
+      result));
 }

 TEST_P(HloEvaluatorTest, EvaluateGather_TensorFlowGatherNd) {
@@ -2044,9 +2048,8 @@
                                     {{-7, 7}, {-8, 8}, {-9, 9}}});
   Literal start_indices = LiteralUtil::CreateR2<int32>({{0, 0}, {1, 0}});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(
-      LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{-1, 1}, {-4, 4}}),
-                             result));
+  EXPECT_TRUE(LiteralTestUtil::Equal(
+      LiteralUtil::CreateR2<int32>({{-1, 1}, {-4, 4}}), result));
 }

 TEST_P(HloEvaluatorTest,
@@ -2072,9 +2075,8 @@
                                     {{-7, 7}, {-8, 8}, {-9, 9}}});
   Literal start_indices = LiteralUtil::CreateR2<int32>({{0, 0}, {1, 0}});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(
-      LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{-2, 2}, {-1, 1}}),
-                             result));
+  EXPECT_TRUE(LiteralTestUtil::Equal(
+      LiteralUtil::CreateR2<int32>({{-2, 2}, {-1, 1}}), result));
 }

 TEST_P(HloEvaluatorTest, EvaluateGather_DynamicSlice) {
@@ -2097,8 +2099,8 @@
       LiteralUtil::CreateR2<int32>({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
   Literal start_indices = LiteralUtil::CreateR1<int32>({1, 1});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{5}}),
-                                     result));
+  EXPECT_TRUE(
+      LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{5}}), result));
 }

 TEST_P(HloEvaluatorTest, EvaluateGather_BatchDynamicSlice) {
@@ -2121,9 +2123,8 @@
       LiteralUtil::CreateR2<int32>({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
   Literal start_indices = LiteralUtil::CreateR2<int32>({{2, 1}, {1, 1}});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(
-      LiteralTestUtil::Equal(LiteralUtil::CreateR3<int32>({{{8}}, {{5}}}),
-                             result));
+  EXPECT_TRUE(LiteralTestUtil::Equal(
+      LiteralUtil::CreateR3<int32>({{{8}}, {{5}}}), result));
 }

 TEST_P(HloEvaluatorTest, EvaluateGather_ZeroDimBounds) {
@@ -2145,8 +2146,8 @@
   Literal operand = LiteralUtil::CreateR2<int32>({{}, {}, {}});
   Literal start_indices = LiteralUtil::CreateR1<int32>({0, 2});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{}, {}}),
-                                     result));
+  EXPECT_TRUE(
+      LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{}, {}}), result));
 }

 TEST_P(HloEvaluatorTest, EvaluateGather_NoOutputWindowDims) {
@@ -2170,9 +2171,8 @@
   Literal start_indices =
       LiteralUtil::CreateR3<int32>({{{0}, {1}}, {{2}, {1}}});
   TF_ASSERT_OK_AND_ASSIGN(Literal result, Evaluate({&operand, &start_indices}));
-  EXPECT_TRUE(
-      LiteralTestUtil::Equal(LiteralUtil::CreateR2<int32>({{0, 1}, {2, 1}}),
-                             result));
+  EXPECT_TRUE(LiteralTestUtil::Equal(
+      LiteralUtil::CreateR2<int32>({{0, 1}, {2, 1}}), result));
 }

 TEST_P(HloEvaluatorTest, EvaluateScatter_TensorFlowScatterV1_Update) {


Branch TransformLandmarks operation to TransformLandmarksV2.

PiperOrigin-RevId: 310424827
Change-Id: I4e8771dfb8060438ed23ba97d7177633ad6aba76

--- tensorflow/lite/delegates/gpu/common/model_builder.cc
+++ tensorflow/lite/delegates/gpu/common/model_builder.cc
@@ -2405,6 +2405,40 @@
     RETURN_IF_ERROR(reader->AddInput(node, 1));  // bbox
     RETURN_IF_ERROR(reader->AddOutputs(node));
     std::string op_name = "transform_landmarks";
+    node->operation.type = op_name;
+    BHWC output_shape;
+    RETURN_IF_ERROR(
+        ParseCustomAttributes(op_name, tflite_node->custom_initial_data,
+                              tflite_node->custom_initial_data_size,
+                              &(node->operation.attributes), &output_shape));
+
+    auto output_value = graph->FindOutputs(node->id)[0];
+
+    output_value->tensor.shape = graph->FindInputs(node->id)[0]->tensor.shape;
+    return absl::OkStatus();
+  }
+
+ private:
+};
+
+class TransformLandmarksV2OperationParser : public TFLiteOperationParser {
+ public:
+  absl::Status IsSupported(const TfLiteContext* context,
+                           const TfLiteNode* tflite_node,
+                           const TfLiteRegistration* registration) final {
+    RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
+                                       /*runtime_inputs=*/2, /*outputs=*/1));
+    return absl::OkStatus();
+  }
+
+  absl::Status Parse(const TfLiteNode* tflite_node,
+                     const TfLiteRegistration* registration,
+                     GraphFloat32* graph, ObjectReader* reader) final {
+    Node* node = graph->NewNode();
+    RETURN_IF_ERROR(reader->AddInput(node, 0));  // data
+    RETURN_IF_ERROR(reader->AddInput(node, 1));  // bbox
+    RETURN_IF_ERROR(reader->AddOutputs(node));
+    std::string op_name = "transform_landmarks_v2";
     node->operation.type = op_name;
     BHWC output_shape;
     RETURN_IF_ERROR(
@@ -2672,6 +2706,9 @@
       if (custom_name == "TransformLandmarks") {
         return std::make_unique<TransformLandmarksOperationParser>();
       }
+      if (custom_name == "TransformLandmarksV2") {
+        return std::make_unique<TransformLandmarksV2OperationParser>();
+      }
       if (custom_name == "Landmarks2TransformMatrix") {
         return std::make_unique<Landmarks2TransformMatrixOperationParser>();
       }


Use alloca to keep g++ happy.  (clang++ liked it before the change.)

--- cpp/lib/src/MediaTypeUtil.cc
+++ cpp/lib/src/MediaTypeUtil.cc
@@ -29,6 +29,7 @@
 #include "MediaTypeUtil.h"
 #include <stdexcept>
 #include <cctype>
+#include <alloca.h>
 #include <magic.h>
 #include "File.h"
 #include "HttpHeader.h"
@@ -145,9 +146,9 @@

     if (StringUtil::StartsWith(media_type, "application/octet-stream")) {
 	File input(filename, "rb");
-	    char buf[LZ4_MAGIC.size()];
-	    if ((input.read(buf, sizeof(buf)) == sizeof(buf)) and std::strncmp(LZ4_MAGIC.c_str(), buf, LZ4_MAGIC.size()) == 0)
-		return "application/lz4";
+	char *buf = reinterpret_cast<char *>(::alloca(LZ4_MAGIC.size()));
+	if ((input.read(buf, sizeof(buf)) == sizeof(buf)) and std::strncmp(LZ4_MAGIC.c_str(), buf, LZ4_MAGIC.size()) == 0)
+	    return "application/lz4";
     }

     return media_type;


Fixed several bugs.

Fixed several bugs.

--- cpp/lib/src/SslConnection.cc
+++ cpp/lib/src/SslConnection.cc
@@ -233,7 +233,7 @@
                                      "DTLSv1_client_method from libssl.so!");
     }

-    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? stream_client_method() : DTLS_client_method());
+    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? stream_client_method() : datagram_client_method());
 }

@@ -260,7 +260,7 @@
                                      "DTLSv1_server_method from libssl.so!");
     }

-    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? SSLv23_server_method() : DTLS_server_method());
+    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? stream_server_method() : datagram_server_method());
 }

@@ -287,5 +287,5 @@
                                      "DTLSv1_method from libssl.so!");
     }

-    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? SSLv23_method() : DTLS_method());
-}
+    return ::SSL_CTX_new(method == ALL_STREAM_METHODS ? stream_method() : datagram_method());
+}


ENH (#1578): add hints about the usage of StatusBar, ProgressBar and WaitCursor to functionality template

--- CMake/QmitkFunctionalityTemplate/QmitkFunctionalityTemplate.cpp
+++ CMake/QmitkFunctionalityTemplate/QmitkFunctionalityTemplate.cpp
@@ -21,6 +21,9 @@
 #include "icon.xpm"
 #include "QmitkTreeNodeSelector.h"
 #include "QmitkStdMultiWidget.h"
+#include "mitkStatusBar.h"
+#include "mitkProgressBar.h"
+

 @FUNCTIONALITY_NAME@::@FUNCTIONALITY_NAME@(QObject *parent, const char *name, QmitkStdMultiWidget *mitkStdMultiWidget, mitk::DataTreeIteratorBase* it)
     : QmitkFunctionality(parent, name, it), m_MultiWidget(mitkStdMultiWidget), m_Controls(NULL)
@@ -28,8 +31,10 @@
   SetAvailability(true);
 }

+
 @FUNCTIONALITY_NAME@::~@FUNCTIONALITY_NAME@()
 {}
+

 QWidget * @FUNCTIONALITY_NAME@::CreateMainWidget(QWidget *parent)
 {
@@ -40,6 +45,7 @@
   return m_MultiWidget;
 }

+
 QWidget * @FUNCTIONALITY_NAME@::CreateControlWidget(QWidget *parent)
 {
   if (m_Controls == NULL)
@@ -48,6 +54,7 @@
   }
   return m_Controls;
 }
+

 void @FUNCTIONALITY_NAME@::CreateConnections()
 {
@@ -58,6 +65,7 @@
   }
 }

+
 QAction * @FUNCTIONALITY_NAME@::CreateAction(QActionGroup *parent)
 {
   QAction* action;
@@ -65,15 +73,18 @@
   return action;
 }

+
 void @FUNCTIONALITY_NAME@::TreeChanged()
 {
   m_Controls->m_TreeNodeSelector->SetDataTreeNodeIterator(this->GetDataTreeIterator());
 }

+
 void @FUNCTIONALITY_NAME@::Activated()
 {
   QmitkFunctionality::Activated();
 }
+

 void @FUNCTIONALITY_NAME@::ImageSelected(mitk::DataTreeIteratorClone imageIt)
 {
@@ -103,8 +114,19 @@
     }
   }
 }
+
+
 void @FUNCTIONALITY_NAME@::StartButtonClicked()
 {
   std::cout << "Start Button clicked!" << std::endl;
+  WaitCursorOn(); // always good to show the user that the application is processing and will not react to user input for a while
+  mitk::StatusBar::GetInstance()->DisplayText("@FUNCTIONALITY_NAME@ is doing something...", 4000);  // tell the user what you are doing
+  mitk::ProgressBar::GetInstance()->AddStepsToDo(2);  // use progress bar to show that the application is doing something
+
+  // Do something here, add progress while you do it:
+
+  mitk::ProgressBar::GetInstance()->Progress();
+  mitk::ProgressBar::GetInstance()->Progress(); // last step, we're finished!
+  mitk::StatusBar::GetInstance()->DisplayText("@FUNCTIONALITY_NAME@ has finished...", 2000);
+  WaitCursorOff();  // restore normal mouse cursor after you finished
 }
-


add debug output

add debug output

--- HLT/TPCLib/tracking-ca/AliHLTTPCCATrackletConstructor.cxx
+++ HLT/TPCLib/tracking-ca/AliHLTTPCCATrackletConstructor.cxx
@@ -28,6 +28,9 @@
 #include "AliHLTTPCCAHitArea.h"
 #include "AliHLTTPCCAHit.h"

+//#define DEBUG(...) __VA_ARGS__
+#define DEBUG(...)
+
 MEM_CLASS_PRE2() GPUdi() void AliHLTTPCCATrackletConstructor::InitTracklet( MEM_LG2(AliHLTTPCCATrackParam) &tParam )
 {
   //Initialize Tracklet Parameters using default values
@@ -84,6 +87,7 @@
   GPUglobalref() MEM_GLOBAL(AliHLTTPCCATracklet) &tracklet = tracker.Tracklets()[r.fItr];

   tracklet.SetNHits( r.fNHits );
+  DEBUG(printf("    DONE %d hits\n", r.fNHits);)

   if ( r.fNHits > 0 ) {
     tracklet.SetFirstRow( r.fFirstRow );
@@ -150,6 +154,7 @@
           r.fLastZ = z;
           tParam.SetZOffset( 0.f );
         }
+        DEBUG(printf("Tracklet %5d: FIT INIT  ROW %3d X %8.3f -", r.fItr, iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
       } else {

         float err2Y, err2Z;
@@ -187,10 +192,12 @@
           sinPhi = dy * ri;
           cosPhi = dx * ri;
         }
+        DEBUG(printf("%14s: FIT TRACK ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
         if ( !tParam.TransportToX( x, sinPhi, cosPhi, tracker.Param().ConstBz(), CALINK_INVAL ) ) {
           SETRowHit(iRow, CALINK_INVAL);
           break;
         }
+        DEBUG(printf("%15s hits %3d: FIT PROP  ROW %3d X %8.3f -", "", r.fNHits, iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
         tracker.GetErrors2( iRow, tracker.Param().GetContinuousTracking() ? 125. : tParam.GetZ(), sinPhi, cosPhi, tParam.GetDzDs(), err2Y, err2Z );

         if (r.fNHits >= 10)
@@ -217,6 +224,7 @@
           SETRowHit(iRow, CALINK_INVAL);
           break;
         }
+        DEBUG(printf("%14s: FIT FILT  ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
       }
       SETRowHit(iRow, oldIH);
       r.fNHitsEndRow = ++r.fNHits;
@@ -251,11 +259,13 @@

       float x = row.X();
       float err2Y, err2Z;
+      DEBUG(printf("%14s: SEA TRACK ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
       if ( !tParam.TransportToX( x, tParam.SinPhi(), tParam.GetCosPhi(), tracker.Param().ConstBz(), HLTCA_MAX_SIN_PHI_LOW ) ) {
         r.fGo = 0;
         SETRowHit(iRow, CALINK_INVAL);
         break;
       }
+      DEBUG(printf("%14s: SEA PROP  ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
       if ( row.NHits() < 1 ) {
         SETRowHit(iRow, CALINK_INVAL);
         break;
@@ -315,6 +325,8 @@
       float y = y0 + hh.x * stepY;
       float z = z0 + hh.y * stepZ;

+      DEBUG(printf("%14s: SEA Hit %5d, Res %f %f\n", "", best, tParam.Y() - y, tParam.Z() - z);)
+
       calink oldHit = (r.fStage == 2 && iRow >= r.fStartRow) ? GETRowHit(iRow) : CALINK_INVAL;
       if (oldHit != best && !tParam.Filter( y, z, err2Y, err2Z, HLTCA_MAX_SIN_PHI_LOW, oldHit != CALINK_INVAL))
       {
@@ -324,6 +336,7 @@
       SETRowHit(iRow, best);
       r.fNHits++;
       r.fNMissed = 0;
+      DEBUG(printf("%5s hits %3d: SEA FILT  ROW %3d X %8.3f -", "", r.fNHits, iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
       if ( r.fStage == 1 ) r.fLastRow = iRow;
       else r.fFirstRow = iRow;
     } while ( 0 );
@@ -374,10 +387,12 @@
 			r.fNMissed = 0;
 			if ((r.fGo = (tParam.TransportToX( tracker.Row( r.fEndRow ).X(), tracker.Param().ConstBz(), HLTCA_MAX_SIN_PHI) && tParam.Filter( r.fLastY, r.fLastZ, tParam.Err2Y() / 2, tParam.Err2Z() / 2., HLTCA_MAX_SIN_PHI_LOW, true))))
             {
+                DEBUG(printf("%14s: SEA BACK  ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
     			float err2Y, err2Z;
     			tracker.GetErrors2( r.fEndRow, tParam, err2Y, err2Z );
     			if (tParam.GetCov(0) < err2Y) tParam.SetCov(0, err2Y);
     			if (tParam.GetCov(2) < err2Z) tParam.SetCov(2, err2Z);
+                DEBUG(printf("%14s: SEA ADJUS ROW %3d X %8.3f -", "", iRow, tParam.X());for (int i = 0;i < 5;i++) printf(" %8.3f", tParam.Par()[i]); printf(" -"); for (int i = 0;i < 15;i++) printf(" %8.3f", tParam.Cov()[i]); printf("\n");)
             }
 			r.fNHits -= r.fNHitsEndRow;
 			r.fStage = 2;


simple_cpu.cc:
Add data to static memReq and make everything use it.
Add init of numLoads.

cpu/simple_cpu/simple_cpu.cc:
    Add data to static memReq and make everything use it.
    Add init of numLoads.

--- cpu/simple_cpu/simple_cpu.cc
+++ cpu/simple_cpu/simple_cpu.cc
@@ -192,8 +192,10 @@
     memReq = new MemReq();
     memReq->xc = xc;
     memReq->asid = 0;
+    memReq->data = new uint8_t[64];

     numInst = 0;
+    numLoad = 0;
     last_idle = 0;
     lastIcacheStall = 0;
     lastDcacheStall = 0;
@@ -406,7 +408,7 @@

     if (fault == No_Fault && dcacheInterface) {
         memReq->cmd = Write;
-        memReq->data = (uint8_t *)&data;
+        memcpy(memReq->data,(uint8_t *)&data,memReq->size);
         memReq->completionEvent = NULL;
         memReq->time = curTick;
         memReq->flags &= ~UNCACHEABLE;


[sfm] Fix the initial triangulation for the relative pose engine #1241

Thx @mitjap

--- src/openMVG/sfm/pipelines/relative_pose_engine.cpp
+++ src/openMVG/sfm/pipelines/relative_pose_engine.cpp
@@ -161,24 +161,21 @@
         tiny_scene.intrinsics.insert(*sfm_data_.GetIntrinsics().find(view_J->id_intrinsic));

         // Init poses
-        const Pose3 & Pose_I = tiny_scene.poses[view_I->id_pose] = {Mat3::Identity(), Vec3::Zero()};
-        const Pose3 & Pose_J = tiny_scene.poses[view_J->id_pose] = relativePose_info.relativePose;
+        const Pose3 & pose_I = tiny_scene.poses[view_I->id_pose] = {Mat3::Identity(), Vec3::Zero()};
+        const Pose3 & pose_J = tiny_scene.poses[view_J->id_pose] = relativePose_info.relativePose;

         // Init structure
-        const Mat34
-          P1 = cam_I->get_projective_equivalent(Pose_I),
-          P2 = cam_J->get_projective_equivalent(Pose_J);
         Landmarks & landmarks = tiny_scene.structure;
         for (Mat::Index k = 0; k < x1.cols(); ++k)
         {
-          const Vec2
-            x1_ = features_provider_->feats_per_view.at(I)[matches[k].i_].coords().cast<double>(),
-            x2_ = features_provider_->feats_per_view.at(J)[matches[k].j_].coords().cast<double>();
           Vec3 X;
-          TriangulateDLT(P1, x1_.homogeneous(), P2, x2_.homogeneous(), &X);
+          TriangulateDLT(pose_I.asMatrix(), (*cam_I)(x1.col(k)),
+                         pose_J.asMatrix(), (*cam_J)(x2.col(k)), &X);
           Observations obs;
-          obs[view_I->id_view] = Observation(x1_, matches[k].i_);
-          obs[view_J->id_view] = Observation(x2_, matches[k].j_);
+          const Vec2 obs_I = features_provider_->feats_per_view.at(I)[matches[k].i_].coords().cast<double>();
+          const Vec2 obs_J = features_provider_->feats_per_view.at(J)[matches[k].j_].coords().cast<double>();
+          obs[view_I->id_view] = {obs_I, matches[k].i_};
+          obs[view_J->id_view] = {obs_J, matches[k].j_};
           landmarks[k].obs = obs;
           landmarks[k].X = X;
         }


Fix setting region address

Fix setting region address

--- Haxe/Templates/Source/HaxeRuntime/Private/HaxeRuntime.cpp
+++ Haxe/Templates/Source/HaxeRuntime/Private/HaxeRuntime.cpp
@@ -20,7 +20,7 @@
 #if PLATFORM_WINDOWS || PLATFORM_WINRT || PLATFORM_XBOXONE //TODO: see if XBOXONE really behaves like Windows
   MEMORY_BASIC_INFORMATION info;
   VirtualQuery(&info, &info, sizeof(MEMORY_BASIC_INFORMATION));
-  return (void *)info.BaseAddress + info.RegionSize;
+  return (void *) (( (char *) info.BaseAddress) + info.RegionSize);
 #elif PLATFORM_MAC || PLATFORM_IOS
   return pthread_get_stackaddr_np(pthread_self());
 #elif PLATFORM_LINUX || PLATFORM_ANDROID


Remove some redundant locking of Isolate.

--- examples/v8js/v8binding.cc
+++ examples/v8js/v8binding.cc
@@ -94,7 +94,7 @@
     bool first = true;
     int errcount = 0;
     Isolate *isolate = args.GetIsolate();
-    LOCK_SCOPE(isolate);
+    HandleScope handle_scope(isolate);

     for (int i = 0; i < args.Length() && errcount == 0; i++) {
         if (first) {
@@ -122,7 +122,7 @@

 static void Now(const FunctionCallbackInfo<Value>& args) {
     Isolate *isolate = args.GetIsolate();
-    LOCK_SCOPE(isolate)
+    HandleScope handle_scope(isolate);
     int64_t n = now();
     args.GetReturnValue().Set(Number::New(isolate, n));
 }
@@ -132,7 +132,7 @@
     int64_t n = 0;
     {
     Isolate *isolate = args.GetIsolate();
-    LOCK_SCOPE(isolate)
+    HandleScope handle_scope(isolate);
     if (args.Length() > 0)
         n = args[0]->IntegerValue(
                     isolate->GetCurrentContext()).FromJust();
@@ -148,11 +148,10 @@

     {
     Isolate *isolate = args.GetIsolate();
+    HandleScope handle_scope(isolate);
     int argc = args.Length();
 	ThrowNotEnoughArgs(isolate, argc < 3);
     vm = static_cast<js_vm*>(isolate->GetData(0));
-
-    LOCK_SCOPE(isolate)
     fn = (Fncoro_t) ExternalPtrValue(args[0]);
     if (!fn)
         ThrowTypeError(isolate, "$go argument #1: coroutine expected");
@@ -174,8 +173,8 @@
 // callback(err, data)
 static int RunCoroCallback(js_vm *vm, js_coro *cr) {
     Isolate *isolate = vm->isolate;
+    LOCK_SCOPE(isolate)
     vm->ncoro--;
-    LOCK_SCOPE(isolate)
     TryCatch try_catch(isolate);

     Local<Context> context = Local<Context>::New(isolate, vm->context);
@@ -231,11 +230,11 @@

     {
     Isolate *isolate = args.GetIsolate();
+    HandleScope handle_scope(isolate);
     int argc = args.Length();
     ThrowNotEnoughArgs(isolate, argc < 3);
     vm = static_cast<js_vm*>(isolate->GetData(0));

-    LOCK_SCOPE(isolate)
     void *fn = ExternalPtrValue(args[0]);
     if (!fn)
         ThrowTypeError(isolate, "$send argument #1: coroutine expected");
@@ -255,7 +254,7 @@

 static void Close(const FunctionCallbackInfo<Value>& args) {
     Isolate *isolate = args.GetIsolate();
-    LOCK_SCOPE(isolate);
+    HandleScope handle_scope(isolate);
     js_vm *vm = static_cast<js_vm*>(isolate->GetData(0));
     mill_pipeclose(vm->inq);
 }
@@ -264,9 +263,9 @@
         const v8::FunctionCallbackInfo<v8::Value>& args) {

     Isolate *isolate = args.GetIsolate();
+    HandleScope handle_scope(isolate);
     js_vm *vm = static_cast<js_vm*>(isolate->GetData(0));

-    LOCK_SCOPE(isolate)
     Local<Object> obj = args.Holder();

     assert(obj->InternalFieldCount() == 2);
@@ -380,7 +379,7 @@
 static void GlobalGet(Local<Name> name,
         const PropertyCallbackInfo<Value>& info) {
     Isolate *isolate = info.GetIsolate();
-    LOCK_SCOPE(isolate);
+    HandleScope handle_scope(isolate);
     String::Utf8Value str(name);
     if (strcmp(*str, "$errno") == 0)
         info.GetReturnValue().Set(Integer::New(isolate, errno));
@@ -389,7 +388,7 @@
 static void GlobalSet(Local<Name> name, Local<Value> val,
         const PropertyCallbackInfo<void>& info) {
     Isolate *isolate = info.GetIsolate();
-    LOCK_SCOPE(isolate)
+    HandleScope handle_scope(isolate);
     String::Utf8Value str(name);
     if (strcmp(*str, "$errno") == 0)
         errno = val->ToInt32(
@@ -415,11 +414,10 @@
 static void CreateIsolate(js_vm *vm) {
     v8init();
     Isolate* isolate = Isolate::New(create_params);
-
+    LOCK_SCOPE(isolate)
     isolate->AddMicrotasksCompletedCallback(v8MicrotasksCompleted);
     isolate->EnqueueMicrotask(v8Microtask, vm);

-    LOCK_SCOPE(isolate)
     vm->isolate = isolate;
     vm->errstr = nullptr;

@@ -496,12 +494,18 @@
     // Close vm->outq; This causes the receiving coroutine (recv_coro)
     // to exit the loop and free vm->outq.
     //
+    Isolate *isolate = vm->isolate;
+
+    {
+    Locker locker(isolate);
+
     mill_pipeclose(vm->outq);
     mill_pipefree(vm->inq);

     if (vm->errstr)
         free(vm->errstr);
-    vm->isolate->Dispose();
+    }
+    isolate->Dispose();
     delete vm;
 }


Add assert if profiled destination point is invalid.

--- Components/MeshLodGenerator/src/OgreLodCollapseCostProfiler.cpp
+++ Components/MeshLodGenerator/src/OgreLodCollapseCostProfiler.cpp
@@ -79,10 +79,11 @@
 			LodData::Vertex v;
 			v.position = it->src;
 			LodData::UniqueVertexSet::iterator src = data->mUniqueVertexSet.find(&v);
-			assert(src != data->mUniqueVertexSet.end());
+			OgreAssert(src != data->mUniqueVertexSet.end(), "Invalid vertex position in Lod profile");
 			mHasProfile[LodData::getVectorIDFromPointer(data->mVertexList, *src)] = true;
 			v.position = it->dst;
 			LodData::UniqueVertexSet::iterator dst = data->mUniqueVertexSet.find(&v);
+			OgreAssert(dst != data->mUniqueVertexSet.end(), "Invalid vertex position in Lod profile");
 			ProfiledEdge e;
 			e.dst = *dst;
 			e.cost = it->cost;


[exotica_core] Scene: Fix mapping of base-link in floating-base in collision maps

--- exotica_core/src/scene.cpp
+++ exotica_core/src/scene.cpp
@@ -657,13 +657,13 @@
         obj_transform.translation() = ps_->getCurrentState().getGlobalLinkTransform(links[i]).translation();
         obj_transform.linear() = ps_->getCurrentState().getGlobalLinkTransform(links[i]).rotation();

-        int jointId = GetKinematicTree().IsControlledLink(links[i]->getName());
-        if (jointId != -1)
-        {
-            if (lastControlledJointId != jointId)
+        int joint_id = GetKinematicTree().IsControlledLink(links[i]->getName());
+        if (joint_id != -1)
+        {
+            if (lastControlledJointId != joint_id)
             {
-                lastControlledLinkName = links[i]->getName();
-                lastControlledJointId = jointId;
+                lastControlledLinkName = GetKinematicTree().GetControlledLinkNames()[joint_id];
+                lastControlledJointId = joint_id;
             }
         }


Get rid of per-client rapidxml document.

--- c_src/exml.cpp
+++ c_src/exml.cpp
@@ -1,3 +1,6 @@
+#define RAPIDXML_STATIC_POOL_SIZE (10 * 1024 * 1024)
+#define RAPIDXML_DYNAMIC_POOL_SIZE (2 * 1024 * 1024)
+
 #include "rapidxml.hpp"
 #include "rapidxml_print.hpp"
 #include <erl_nif.h>
@@ -66,34 +69,19 @@

 xml_document &get_static_doc() {
   static thread_local xml_document doc;
-  static thread_local bool initialized = false;
-
-  if (!initialized) {
-    initialized = true;
-    doc.impl.set_allocator(enif_alloc, enif_free);
-  } else {
-    doc.impl.clear();
-  }
-
+  doc.impl.clear();
   return doc;
 }

 } // namespace

 struct Parser {
-  xml_document &doc;
   ustring stream_tag;
   std::uint64_t max_child_size = 0;
   bool infinite_stream = false;

   static thread_local std::vector<unsigned char> buffer;
-
-  static std::vector<ERL_NIF_TERM> &get_static_term_buf() {
-    static thread_local std::vector<ERL_NIF_TERM> term_buffer;
-    return term_buffer;
-  }
-
-  Parser(xml_document &doc_) : doc(doc_) { get_static_term_buf().clear(); }
+  static thread_local std::vector<ERL_NIF_TERM> term_buffer;

   bool copy_buffer(ErlNifEnv *env, ERL_NIF_TERM buf) {
     buffer.clear();
@@ -117,20 +105,13 @@
   }

   void reset() {
-    doc.clear();
     stream_tag.clear();
     buffer.clear();
   }
 };

 thread_local std::vector<unsigned char> Parser::buffer;
-
-struct ParserWithDoc : public Parser {
-  xml_document local_doc;
-  ParserWithDoc() : Parser{local_doc} {
-    doc.impl.set_allocator(enif_alloc, enif_free);
-  }
-};
+thread_local std::vector<ERL_NIF_TERM> Parser::term_buffer;

 struct ParseCtx {
   ErlNifEnv *env;
@@ -205,7 +186,7 @@

 ERL_NIF_TERM get_children_tuple(ParseCtx &ctx,
                                 rapidxml::xml_node<unsigned char> *node) {
-  std::vector<ERL_NIF_TERM> &children = ctx.parser->get_static_term_buf();
+  std::vector<ERL_NIF_TERM> &children = Parser::term_buffer;
   std::size_t begin = children.size();

   rapidxml::xml_node<unsigned char> *first_data_node = nullptr;
@@ -263,7 +244,7 @@
 std::tuple<ERL_NIF_TERM, ERL_NIF_TERM>
 get_open_tag(ParseCtx &ctx, rapidxml::xml_node<unsigned char> *node) {
   ERL_NIF_TERM name_term = make_node_name_binary(ctx, node);
-  std::vector<ERL_NIF_TERM> &attrs = ctx.parser->get_static_term_buf();
+  std::vector<ERL_NIF_TERM> &attrs = Parser::term_buffer;
   std::size_t begin = attrs.size();

   for (rapidxml::xml_attribute<unsigned char> *attr = node->first_attribute();
@@ -422,30 +403,30 @@
 }

 bool has_stream_closing_tag(Parser *parser, std::size_t offset) {
-  if (parser->buffer.size() < offset + stream_closing_tag_size(parser))
-    return false;
-
-  if (parser->buffer[offset] != '<' || parser->buffer[offset + 1] != '/')
+  if (Parser::buffer.size() < offset + stream_closing_tag_size(parser))
+    return false;
+
+  if (Parser::buffer[offset] != '<' || Parser::buffer[offset + 1] != '/')
     return false;

   if (!std::equal(parser->stream_tag.begin(), parser->stream_tag.end(),
-                  parser->buffer.begin() + offset + 2))
+                  Parser::buffer.begin() + offset + 2))
     return false;

   // skip whitespace between tag name and closing '>'
   offset = offset + 2 + parser->stream_tag.size();
-  while (offset < parser->buffer.size() - 1 &&
-         std::isspace(parser->buffer[offset]))
+  while (offset < Parser::buffer.size() - 1 &&
+         std::isspace(Parser::buffer[offset]))
     ++offset;

-  return parser->buffer[offset] == '>';
+  return Parser::buffer[offset] == '>';
 }

 } // namespace

 extern "C" {
 static void delete_parser(ErlNifEnv *env, void *parser) {
-  static_cast<ParserWithDoc *>(parser)->~ParserWithDoc();
+  static_cast<Parser *>(parser)->~Parser();
 }

 static int load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info) {
@@ -461,6 +442,9 @@
   atom_xmlstreamend = enif_make_atom(global_env, "xmlstreamend");
   atom_pretty = enif_make_atom(global_env, "pretty");
   atom_true = enif_make_atom(global_env, "true");
+
+  get_static_doc().impl.set_allocator(enif_alloc, enif_free);
+
   return 0;
 }

@@ -470,8 +454,8 @@

 static ERL_NIF_TERM create(ErlNifEnv *env, int argc,
                            const ERL_NIF_TERM argv[]) {
-  void *mem = enif_alloc_resource(parser_type, sizeof(ParserWithDoc));
-  Parser *parser = new (mem) ParserWithDoc;
+  void *mem = enif_alloc_resource(parser_type, sizeof(Parser));
+  Parser *parser = new (mem) Parser;

   ErlNifUInt64 max_child_size;
   if (!enif_get_uint64(env, argv[0], &max_child_size))
@@ -498,67 +482,66 @@
   // Skip initial whitespace even if we don't manage to parse anything.
   // Also needed for has_stream_closing_tag to recognize the tag.
   std::size_t offset = 0;
-  while (offset < parser->buffer.size() - 1 &&
-         std::isspace(parser->buffer[offset]))
+  while (offset < Parser::buffer.size() - 1 &&
+         std::isspace(Parser::buffer[offset]))
     ++offset;

   ParseCtx ctx{env, parser};
   xml_document::ParseResult result;
   ERL_NIF_TERM element;

+  xml_document &doc = get_static_doc();
+  Parser::term_buffer.clear();
+
   auto parseStreamOpen = [&] {
-    result =
-        parser->doc.parse<parse_open_only()>(parser->buffer.data() + offset);
+    result = doc.parse<parse_open_only()>(Parser::buffer.data() + offset);
     if (!result.has_error) {
-      auto name_tag = node_name(parser->doc.impl.first_node());
+      auto name_tag = node_name(doc.impl.first_node());
       parser->stream_tag =
           ustring{std::get<0>(name_tag), std::get<1>(name_tag)};
-      element = make_stream_start_tuple(ctx, parser->doc.impl.first_node());
+      element = make_stream_start_tuple(ctx, doc.impl.first_node());
     }
   };

   auto hasStreamReopen = [&] {
-    xml_document &subdoc = get_static_doc();
     auto parseOpenRes =
-        subdoc.parse<parse_open_only()>(parser->buffer.data() + offset);
+        doc.parse<parse_open_only()>(Parser::buffer.data() + offset);
     if (parseOpenRes.has_error)
       return false;
-    auto tag_name = node_name(subdoc.impl.first_node());
+    auto tag_name = node_name(doc.impl.first_node());
     return ustring{std::get<0>(tag_name), std::get<1>(tag_name)} ==
            parser->stream_tag;
   };

   if (parser->infinite_stream) {
-    result = parser->doc.parse<parse_one()>(parser->buffer.data() + offset);
-    element = make_xmlel(ctx, parser->doc.impl.first_node());
+    result = doc.parse<parse_one()>(Parser::buffer.data() + offset);
+    element = make_xmlel(ctx, doc.impl.first_node());
   } else if (parser->stream_tag.empty()) {
     parseStreamOpen();
   } else if (has_stream_closing_tag(parser, offset)) {
-    parser->doc.clear();
+    doc.clear();
     // no data after closing tag
-    result.rest = &*parser->buffer.rbegin();
+    result.rest = &*Parser::buffer.rbegin();
     element = make_stream_end_tuple(ctx);
   } else {
-    xml_document &subdoc = get_static_doc();
-    result =
-        subdoc.parse<parse_one()>(parser->buffer.data() + offset, parser->doc);
+    result = doc.parse<parse_one()>(Parser::buffer.data() + offset);
     if (!result.has_error)
-      element = make_xmlel(ctx, subdoc.impl.first_node());
+      element = make_xmlel(ctx, doc.impl.first_node());
   }

   if (result.eof && hasStreamReopen()) {
-    parser->doc.clear();
+    doc.clear();
     parseStreamOpen();
   }

   if (result.eof) {
     if (parser->max_child_size &&
-        parser->buffer.size() - offset >= parser->max_child_size)
+        Parser::buffer.size() - offset >= parser->max_child_size)
       return enif_make_tuple2(
           env, enif_make_copy(env, atom_error),
           enif_make_string(env, "child element too big", ERL_NIF_LATIN1));

-    result.rest = parser->buffer.data() + offset;
+    result.rest = Parser::buffer.data() + offset;
     element = enif_make_copy(env, atom_undefined);
   } else if (result.has_error) {
     return enif_make_tuple2(
@@ -568,18 +551,21 @@

   return enif_make_tuple3(
       env, enif_make_copy(env, atom_ok), element,
-      enif_make_uint64(env, result.rest - parser->buffer.data()));
+      enif_make_uint64(env, result.rest - Parser::buffer.data()));
 }

 static ERL_NIF_TERM parse(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
-  Parser parser{get_static_doc()};
+  Parser parser;
   parser.copy_buffer(env, argv[0]);
+  Parser::term_buffer.clear();
+
+  auto &doc = get_static_doc();

   ParseCtx ctx{env, &parser};
-  auto result = parser.doc.parse<default_parse_flags()>(parser.buffer.data());
+  auto result = doc.parse<default_parse_flags()>(Parser::buffer.data());

   if (!result.has_error) {
-    ERL_NIF_TERM element = make_xmlel(ctx, parser.doc.impl.first_node());
+    ERL_NIF_TERM element = make_xmlel(ctx, doc.impl.first_node());
     return enif_make_tuple2(env, enif_make_copy(env, atom_ok), element);
   }


Format.

Format.

Signed-off-by: John Plevyak <21e8c5cc24c747cac934fcbef39d1b757b61996c@gmail.com>

--- test/extensions/filters/http/wasm/wasm_filter_test.cc
+++ test/extensions/filters/http/wasm/wasm_filter_test.cc
@@ -306,7 +306,7 @@
     EXPECT_EQ(Http::FilterDataStatus::Continue, filter().decodeData(data, true));
     EXPECT_EQ(Http::FilterDataStatus::Continue, filter().encodeData(data, true));
   } else {
-    // This status is not availble in the rust SDK.
+    // This status is not available in the rust SDK.
     // TODO: update all SDKs to the new revision of the spec and update the tests accordingly.
     EXPECT_EQ(Http::FilterDataStatus::StopIterationNoBuffer, filter().decodeData(data, true));
     EXPECT_EQ(Http::FilterDataStatus::StopIterationNoBuffer, filter().encodeData(data, true));
@@ -327,7 +327,7 @@
     EXPECT_EQ(Http::FilterDataStatus::Continue, filter().decodeData(data, true));
     EXPECT_EQ(Http::FilterDataStatus::Continue, filter().encodeData(data, true));
   } else {
-    // This status is not availble in the rust SDK.
+    // This status is not available in the rust SDK.
     // TODO: update all SDKs to the new revision of the spec and update the tests accordingly.
     EXPECT_EQ(Http::FilterDataStatus::StopIterationAndWatermark, filter().decodeData(data, true));
     EXPECT_EQ(Http::FilterDataStatus::StopIterationAndWatermark, filter().encodeData(data, true));


typo in last fix

typo in last fix

--- Library/Sources/Stroika/Foundation/Traversal/Iterable.inl
+++ Library/Sources/Stroika/Foundation/Traversal/Iterable.inl
@@ -635,7 +635,7 @@
     inline optional<T> Iterable<T>::First () const
     {
         auto i = begin ();
-        return i ? *i : nullopt;
+        return i ? *i : optional<T>{};
     }
     template <typename T>
     inline optional<T> Iterable<T>::First (const function<bool (ArgByValueType<T>)>& that) const


locale-cache

locale-cache

git-svn-id: cc913a7f7b4e3b8bac01cff72f0fc87362e4d502@560 8dd45c8f-be11-0410-86c3-e0da43b70fc1

--- tntnet/framework/common/httprequest.cpp
+++ tntnet/framework/common/httprequest.cpp
@@ -244,6 +244,9 @@
     {
       static const std::string LANG = "LANG";
       static const std::locale stdlocale("");
+      typedef std::map<std::string, std::locale> locale_map_type;
+      static locale_map_type locale_map;
+      static cxxtools::Mutex locale_monitor;

       locale_init = true;

@@ -258,7 +261,15 @@
         log_debug("LANG from query-parameter");
         try
         {
-          locale = std::locale(lang.c_str());
+          cxxtools::MutexLock lock(locale_monitor);
+          locale_map_type::const_iterator it = locale_map.find(lang);
+          if (it == locale_map.end())
+          {
+            locale = std::locale(lang.c_str());
+            locale_map.insert(locale_map_type::value_type(lang, locale));
+          }
+          else
+            locale = it->second;
         }
         catch (const std::exception& e)
         {


the diagnostic surface shader now exposes the shading mode in the UI.

--- src/appleseed/renderer/modeling/surfaceshader/diagnosticsurfaceshader.cpp
+++ src/appleseed/renderer/modeling/surfaceshader/diagnosticsurfaceshader.cpp
@@ -418,6 +418,26 @@
 DictionaryArray DiagnosticSurfaceShaderFactory::get_widget_definitions() const
 {
     DictionaryArray definitions;
+
+    Dictionary model_items;
+
+    for (int i = 0; i < DiagnosticSurfaceShader::ShadingModeCount; ++i)
+    {
+        const char* shading_mode_value = DiagnosticSurfaceShader::ShadingModeNames[i].m_key;
+        const char* shading_mode_name = DiagnosticSurfaceShader::ShadingModeNames[i].m_value;
+        model_items.insert(shading_mode_name, shading_mode_value);
+    }
+
+    definitions.push_back(
+        Dictionary()
+            .insert("name", "mode")
+            .insert("label", "Mode")
+            .insert("widget", "dropdown_list")
+            .insert("dropdown_items", model_items)
+            .insert("use", "required")
+            .insert("default", "coverage")
+            .insert("on_change", "rebuild_form"));
+
     return definitions;
 }


corrected std usage and headers in random generator

--- ctoolhu/random/generator.hpp
+++ ctoolhu/random/generator.hpp
@@ -11,6 +11,7 @@
 #ifdef _DEBUG_RAND
 #include <ctoolhu/event/events.h>
 #include <ctoolhu/event/firer.hpp>
+#include <string>
 #endif

 namespace Ctoolhu {
@@ -44,7 +45,7 @@
 			result_type operator()()
 			{
 				auto res = this->base_type::operator()();
-				Event::Fire(Event::Message{"random: " + to_string(res)});
+				Event::Fire(Event::Message{"random: " + std::to_string(res)});
 				return res;
 			}
 #endif


Qt: do not quit, let the core do it

Qt: do not quit, let the core do it

Should fix crash on quit wrt to Vout
Tested on XP, 7 and Linux.

--- modules/gui/qt4/qt4.cpp
+++ modules/gui/qt4/qt4.cpp
@@ -514,10 +514,7 @@
 #endif

     /* Last settings */
-    if( p_intf->p_sys->b_isDialogProvider )
-        app.setQuitOnLastWindowClosed( false );
-    else
-        app.setQuitOnLastWindowClosed( true );
+    app.setQuitOnLastWindowClosed( false );

     /* Retrieve last known path used in file browsing */
     p_intf->p_sys->filepath =


Assignment instead of initialization for CPU.

--- MS3/Sketches/CPU_Gridders/scatter_gridder_w_dependent.cpp
+++ MS3/Sketches/CPU_Gridders/scatter_gridder_w_dependent.cpp
@@ -32,8 +32,9 @@
 #ifdef __AVX__
       // We port Romein CPU code to doubles here (for MS2 we didn't)
       // vis0 covers XX and XY, vis1 -- YX and YY
-      __m256d vis0 = _mm256_load_pd((const double *) &vis[i].XX);
-      __m256d vis1 = _mm256_load_pd((const double *) &vis[i].YX);
+      __m256d vis0, vis1;
+      vis0 = _mm256_load_pd((const double *) &vis[i].XX);
+      vis1 = _mm256_load_pd((const double *) &vis[i].YX);
 #endif

       for (int su = 0; su <= max_supp_here; su++) {
@@ -51,7 +52,8 @@
         complexd supportPixel;
         #define __layeroff su * max_supp_here + sv
         if (is_half_gcf) {
-          int index = uvw[i].gcf_layer_index;
+          int index;
+          index = uvw[i].gcf_layer_index;
           // Negative index indicates that original w was mirrored
           // and we shall negate the index to obtain correct
           // offset *and* conjugate the result.
@@ -65,8 +67,9 @@
         }

 #ifdef __AVX__
-        __m256d weight_r = _mm256_set1_pd(supportPixel.real());
-        __m256d weight_i = _mm256_set1_pd(supportPixel.imag());
+        __m256d weight_r, weight_i;
+        weight_r = _mm256_set1_pd(supportPixel.real());
+        weight_i = _mm256_set1_pd(supportPixel.imag());

         /* _mm256_permute_pd(x, 5) swaps adjacent doubles pairs of x:
            d0, d1, d2, d3 goes to d1, d0, d3, d2


fix crash in http server when last service is manually removed

git-svn-id: 40192aece4a9e6664bc9a93aa558322db432a344@1244 15ae5fad-cc11-0410-8fac-bce609e504b0

--- cxxtools/src/http/mapper.cpp
+++ cxxtools/src/http/mapper.cpp
@@ -50,16 +50,16 @@
     WriteLock serviceLock(_serviceMutex);
     service.waitIdle();

-    ServicesType::iterator it = _services.begin();
-    while (it != _services.end())
+    ServicesType::size_type n = 0;
+    while (n < _services.size())
     {
-        if (it->second == &service)
+        if (_services[n].second == &service)
         {
-            _services.erase(it++);
+            _services.erase(_services.begin() + n);
         }
         else
         {
-            ++it;
+            ++n;
         }
     }
 }


fixed merge-conflicts

fixed merge-conflicts

--- Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp
+++ Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp
@@ -473,7 +473,7 @@
     return m_HotspotRadiusInMM;
   }

-  void ImageStatisticsCalculator::SetHistogramBinSize(unsigned int size)
+  void ImageStatisticsCalculator::SetHistogramBinSize( double size)
   {
     this->m_HistogramBinSize = size;
   }
@@ -1386,16 +1386,16 @@
     {
       diff = 1;
     }
-  }
-  unsigned int numberOfBins = 200; // default number of bins
-  if (m_UseDefaultBinSize)
-  {
-    m_HistogramBinSize = std::ceil( static_cast<double>((statisticsFilter->GetMaximum() - statisticsFilter->GetMinimum() + 1)/numberOfBins) );
-  }
-  else
-  {
-    numberOfBins = calcNumberOfBins(statisticsFilter->GetMinimum(), statisticsFilter->GetMaximum());
-  }
+  //}
+//     unsigned int numberOfBins = 200; // default number of bins
+//     if (m_UseDefaultBinSize)
+//     {
+//       m_HistogramBinSize = std::ceil( static_cast<double>((statisticsFilter->GetMaximum() - statisticsFilter->GetMinimum() + 1)/numberOfBins) );
+//     }
+//     else
+//     {
+//       numberOfBins = calcNumberOfBins(statisticsFilter->GetMinimum(), statisticsFilter->GetMaximum());
+//     }

     typename  LabelStatisticsFilterType::Pointer labelStatisticsFilter = LabelStatisticsFilterType::New();
     labelStatisticsFilter->SetInput( adaptedImage );


FIX (#2733): removed debug message

FIX (#2733): removed debug message

--- Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp
+++ Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp
@@ -412,7 +412,7 @@
     if (i>=fileNameLong.length()-24)
     {
       fileNameRevert= x+ fileNameRevert;
-      LOG_INFO <<" fileNameRevert: " << fileNameRevert.c_str();
+      //LOG_INFO <<" fileNameRevert: " << fileNameRevert.c_str();
     }
     else
     {


Fix presubmit error: remove whitespace

Fix presubmit error: remove whitespace

TBR=sgjesse
Review URL: http://codereview.chromium.org/504012

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@3466 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- test/cctest/test-debug.cc
+++ test/cctest/test-debug.cc
@@ -3169,7 +3169,7 @@
   }
   // Check that no DebugBreak events occured during the context creation.
   CHECK_EQ(0, break_point_hit_count);
-
+
   // Get rid of the debug event listener.
   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();


Add debugging output to RangeType test.
R=rossberg@chromium.org
BUG=

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

git-svn-id: f98b9d40cb02301bc76fa9e1b46ee668158567fd@22552 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- test/cctest/test-types.cc
+++ test/cctest/test-types.cc
@@ -605,7 +605,10 @@
       for (DoubleIterator j = T.doubles.begin(); j != T.doubles.end(); ++j) {
         double min = std::min(*i, *j);
         double max = std::max(*i, *j);
+        printf("RangeType: min, max = %f, %f\n", min, max);
         TypeHandle type = T.Range(min, max);
+        printf("RangeType: Min, Max = %f, %f\n",
+               type->AsRange()->Min(), type->AsRange()->Max());
         CHECK(min == type->AsRange()->Min());
         CHECK(max == type->AsRange()->Max());
       }


simplified code.

simplified code.

--- src/appleseed/renderer/kernel/lighting/pt/ptlightingengine.cpp
+++ src/appleseed/renderer/kernel/lighting/pt/ptlightingengine.cpp
@@ -388,8 +388,7 @@
         struct PathVisitorNextEventEstimation
           : public PathVisitorBase
         {
-            bool    m_is_indirect_lighting;
-            bool    m_ignore_emitted_light;
+            bool m_is_indirect_lighting;

             PathVisitorNextEventEstimation(
                 const Parameters&       params,
@@ -408,21 +407,14 @@
                     path_radiance,
                     path_aovs)
               , m_is_indirect_lighting(false)
-              , m_ignore_emitted_light(false)
             {
             }

             void visit_vertex(const PathVertex& vertex)
             {
+                // Any light contribution after a diffuse or glossy bounce is considered indirect.
                 if (BSDF::has_diffuse_or_glossy(vertex.m_prev_bsdf_mode))
-                {
-                    // Any light contribution after a diffuse or glossy bounce is considered indirect.
                     m_is_indirect_lighting = true;
-
-                    // When caustics are disabled, ignore emitted light after a diffuse or glossy bounce.
-                    if (!m_params.m_enable_caustics)
-                        m_ignore_emitted_light = true;
-                }

                 Spectrum vertex_radiance(0.0f);
                 SpectrumStack vertex_aovs(m_path_aovs.size(), 0.0f);
@@ -456,7 +448,7 @@
                 }

                 // Emitted light.
-                if (!m_ignore_emitted_light &&
+                if ((!m_is_indirect_lighting || m_params.m_enable_caustics) &&
                     vertex.m_edf &&
                     vertex.m_cos_on > 0.0 &&
                     (vertex.m_path_length > 2 || m_params.m_enable_dl) &&


Remove use of GenCoord in debug mode

Remove use of GenCoord in debug mode

--- dart/dynamics/EulerJoint.cpp
+++ dart/dynamics/EulerJoint.cpp
@@ -139,12 +139,12 @@
       J2 <<   0.0,      0.0, 1.0, 0.0, 0.0, 0.0;

 #ifndef NDEBUG
-      if (fabs(mCoordinate[1].getPos()) == DART_PI * 0.5)
+      if (fabs(mPositions[1]) == DART_PI * 0.5)
         std::cout << "Singular configuration in ZYX-euler joint ["
                   << mName << "]. ("
-                  << mCoordinate[0].getPos() << ", "
-                  << mCoordinate[1].getPos() << ", "
-                  << mCoordinate[2].getPos() << ")"
+                  << mPositions[0] << ", "
+                  << mPositions[1] << ", "
+                  << mPositions[2] << ")"
                   << std::endl;
 #endif

@@ -165,12 +165,12 @@
       J2 << 1.0,   0.0,   0.0, 0.0, 0.0, 0.0;

 #ifndef NDEBUG
-      if (fabs(mCoordinate[1].getPos()) == DART_PI * 0.5)
+      if (fabs(mPositions[1]) == DART_PI * 0.5)
         std::cout << "Singular configuration in ZYX-euler joint ["
                   << mName << "]. ("
-                  << mCoordinate[0].getPos() << ", "
-                  << mCoordinate[1].getPos() << ", "
-                  << mCoordinate[2].getPos() << ")"
+                  << mPositions[0] << ", "
+                  << mPositions[1] << ", "
+                  << mPositions[2] << ")"
                   << std::endl;
 #endif


[Add] Validate

[Add] Validate

--- cappuccino.hpp
+++ cappuccino.hpp
@@ -35,7 +35,7 @@
 	struct {

 		time_t time;
-   		struct tm *t_st;
+   	struct tm *t_st;

 		int port = 1204;
 		int sockfd = 0;
@@ -239,6 +239,10 @@
 				return "INVALID";
 			return paramset[key];
 		}
+
+		bool isCorrect(){
+			return correctRequest;
+		}
 	};

     class Response{
@@ -310,6 +314,10 @@
 		Log::debug(tops[0] +" "+ tops[1] +" "+ tops[2]);

 		auto request = shared_ptr<Request>(new Request(tops[0],tops[1],tops[2]));
+
+		if(!request.isCorrect()){
+			return Response( 401,"Bad Request", tops[2], "AA");
+		}

 		if(context.routes.find(tops[1]) != context.routes.end()){
 			return context.routes[tops[1]](move(request));


Use unsigned integer initialisation

Use unsigned integer initialisation

--- src/components/application_manager/test/policy_handler_test.cc
+++ src/components/application_manager/test/policy_handler_test.cc
@@ -673,8 +673,8 @@
 TEST_F(PolicyHandlerTest, OnActivateApp) {
   // Arrange
   EnablePolicyAndPolicyManagerMock();
-  const uint32_t connection_key = 1;
-  const uint32_t correlation_id = 2;
+  const uint32_t connection_key = 1u;
+  const uint32_t correlation_id = 2u;
   TestActivateApp(connection_key, correlation_id);
 }

@@ -1284,8 +1284,8 @@
   // Arrange

   EnablePolicyAndPolicyManagerMock();
-  const uint32_t connection_key = 1;
-  const uint32_t correlation_id = 2;
+  const uint32_t connection_key = 1u;
+  const uint32_t correlation_id = 2u;
   TestActivateApp(connection_key, correlation_id);

   const bool is_allowed = true;
@@ -1359,8 +1359,8 @@
   std::vector<std::string> device_macs;
   device_macs.push_back(kPolicyAppId_);
   EnablePolicyAndPolicyManagerMock();
-  const uint32_t connection_key = 1;
-  const uint32_t correlation_id = 2;
+  const uint32_t connection_key = 1u;
+  const uint32_t correlation_id = 2u;
   TestActivateApp(connection_key, correlation_id);

   // Device ID is not setted by us


Use a low iteration count for SCRAM

Use a low iteration count for SCRAM

The hashing is performed in the frontend threads so we don't
want to add an extra delay there. There is a pending task
to move the hashing to a backend thread, so let's just reduce
it while we're waiting for that to happen (MB-17617)

Change-Id: I8e6c422b90a862a6d53233f90a932916ead4b1a7
Reviewed-on: http://review.couchbase.org/59016
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- cbsasl/user.cc
+++ cbsasl/user.cc
@@ -25,7 +25,8 @@
 #include <platform/random.h>
 #include <stdexcept>

-std::atomic<int> IterationCount(4096);
+// Reduce the iteration count to 10 while we're waiting for MB-17617
+std::atomic<int> IterationCount(10);

 /**
  * Generate a salt and store it base64 encoded into the salt


Dialogues visibility fix

Dialogues visibility fix

--- Project/Dev_class11_handout/Motor2D/j1DialogueManager.cpp
+++ Project/Dev_class11_handout/Motor2D/j1DialogueManager.cpp
@@ -7,6 +7,7 @@
 #include "j1HUD.h"
 #include "j1Fonts.h"
 #include "j1Textures.h"
+#include "j1GameStartMenuBack.h"

 #include "GuiImage.h"
 #include "GuiLabel.h"
@@ -199,7 +200,7 @@
 		ResumeActiveDialogue();
 	//Test code end

-	if (!ActiveDialog->DialogueActive || ActiveDialog->DialoguePaused)
+	if (!ActiveDialog->DialogueActive || ActiveDialog->DialoguePaused || App->startmenuback->InGameMenuVisible())
 		return true;

 	//Blit Dark background


RenderStateCache memory usage

RenderStateCache memory usage

Reduce RenderStateCache cache sizes from 4k to 2k. Saves 64kb of memory.

Change-Id: I9e92bbdf095f1e66cf9b84ba81899a8af59d6d86
Reviewed-on: https://chromium-review.googlesource.com/453886
Reviewed-by: Jamie Madill <7e492b4f1c8458024932de3ba475cbf015424c30@chromium.org>
Commit-Queue: Jamie Madill <7e492b4f1c8458024932de3ba475cbf015424c30@chromium.org>

--- src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
+++ src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
@@ -36,10 +36,12 @@
 // MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState,
 // ID3D11Device::CreateDepthStencilState and ID3D11Device::CreateSamplerState claims the maximum
 // number of unique states of each type an application can create is 4096
-const unsigned int RenderStateCache::kMaxBlendStates = 4096;
-const unsigned int RenderStateCache::kMaxRasterizerStates = 4096;
-const unsigned int RenderStateCache::kMaxDepthStencilStates = 4096;
-const unsigned int RenderStateCache::kMaxSamplerStates = 4096;
+// TODO(ShahmeerEsmail): Revisit the cache sizes to make sure they are appropriate for most
+// scenarios.
+const unsigned int RenderStateCache::kMaxBlendStates        = 2048;
+const unsigned int RenderStateCache::kMaxRasterizerStates   = 2048;
+const unsigned int RenderStateCache::kMaxDepthStencilStates = 2048;
+const unsigned int RenderStateCache::kMaxSamplerStates      = 2048;

 RenderStateCache::RenderStateCache(Renderer11 *renderer)
     : mRenderer(renderer),


Removed: old assertion from Ecs::createEntity method

--- src/dreemchest/Ecs/Ecs.cpp
+++ src/dreemchest/Ecs/Ecs.cpp
@@ -146,8 +146,6 @@
 // ** Ecs::createEntity
 EntityPtr Ecs::createEntity( const EntityId& id )
 {
-	DC_BREAK_IF( isUsedId( id ) );
-
 	EntityPtr entity( DC_NEW Entity );
 	entity->setId( id );
 	//addEntity( entity );


name fixes

name fixes

git-svn-id: 647c2dfdf120d9af8205d960f30c8711574448cd@1216 6778bc44-b910-0410-a7a0-be141de4315d

--- src/libprojectM/Renderer/RenderItemMergeFunction.hpp
+++ src/libprojectM/Renderer/RenderItemMergeFunction.hpp
@@ -76,12 +76,12 @@

 class MasterRenderItemMerge : public RenderItemMerge<RenderItem> {
-s
+
 typedef std::map<TypeIdPair, RenderItemMergeFunction*> MergeFunctionMap;
 public:

-	MasterRenderItemDistance() {}
-	virtual ~MasterRenderItemDistance() {}
+	MasterRenderItemMerge() {}
+	virtual ~MasterRenderItemMerge() {}

 	inline void add(RenderItemMergeFunction * fun) {
 		_mergeFunctionMap[fun->typeIdPair()] = fun;


FMU: Fix sensor reset command, by Dmitry Prokhorov

--- src/drivers/px4fmu/fmu.cpp
+++ src/drivers/px4fmu/fmu.cpp
@@ -1469,6 +1469,10 @@
 	stm32_gpiowrite(GPIO_SPI_CS_BARO, 1);
 	stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);

+	stm32_configgpio(GPIO_SPI1_SCK);
+	stm32_configgpio(GPIO_SPI1_MISO);
+	stm32_configgpio(GPIO_SPI1_MOSI);
+
 	// // XXX bring up the EXTI pins again
 	// stm32_configgpio(GPIO_GYRO_DRDY);
 	// stm32_configgpio(GPIO_MAG_DRDY);


The --tree-only option to swift-demangle was not doing what it promised to do, instead refusing to print anything. Fix it

Swift SVN r20862

--- tools/swift-demangle/swift-demangle.cpp
+++ tools/swift-demangle/swift-demangle.cpp
@@ -50,7 +50,7 @@
     name = name.substr(1);
   swift::Demangle::NodePointer pointer =
       swift::demangle_wrappers::demangleSymbolAsNode(name);
-  if (ExpandMode) {
+  if (ExpandMode || TreeOnly) {
     llvm::outs() << "Demangling for " << name << '\n';
     swift::demangle_wrappers::NodeDumper(pointer).print(llvm::outs());
   }


aerofc: forbid gpio changes

aerofc: forbid gpio changes

We export an "empty" table, but there's no protection when doing
ioctl().

--- src/drivers/px4fmu/fmu.cpp
+++ src/drivers/px4fmu/fmu.cpp
@@ -2560,7 +2560,11 @@
 	case GPIO_SET_OUTPUT_HIGH:
 	case GPIO_SET_INPUT:
 	case GPIO_SET_ALT_1:
+#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
+		ret = -EINVAL;
+#else
 		gpio_set_function(arg, cmd);
+#endif
 		break;

 	case GPIO_SET_ALT_2:
@@ -2571,11 +2575,19 @@

 	case GPIO_SET:
 	case GPIO_CLEAR:
+#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
+		ret = -EINVAL;
+#else
 		gpio_write(arg, cmd);
+#endif
 		break;

 	case GPIO_GET:
+#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
+		ret = -EINVAL;
+#else
 		*(uint32_t *)arg = gpio_read();
+#endif
 		break;

 	default:


allow both 'output.var' and 'x' for specifying model name

--- src/cpp/session/modules/rmarkdown/NotebookAlternateEngines.cpp
+++ src/cpp/session/modules/rmarkdown/NotebookAlternateEngines.cpp
@@ -193,7 +193,7 @@
                               const FilePath& targetPath)
 {
    std::string message =
-         "engine.opts$x must be a character string providing a "
+         "engine.opts$output.var must be a character string providing a "
          "name for the returned `stanmodel` object";
    reportChunkExecutionError(docId, chunkId, nbCtxId, message, targetPath);
 }
@@ -241,7 +241,8 @@
    }
    RemoveOnExitScope removeOnExitScope(tempFile, ERROR_LOCATION);

-   // ensure existence of 'engine.opts' with 'x' parameter
+   // ensure existence of 'engine.opts' with 'output.var' parameter
+   // ('x' also allowed for backwards compatibility)
    if (!options.count("engine.opts"))
    {
       reportStanExecutionError(docId, chunkId, nbCtxId, targetPath);
@@ -276,9 +277,9 @@
    std::string modelName;
    for (std::size_t i = 0, n = r::sexp::length(engineOptsSEXP); i < n; ++i)
    {
-      // skip 'x' engine option (this is the variable we wish to assign to
+      // skip 'output.var' engine option (this is the variable we wish to assign to
       // after evaluating the stan model)
-      if (engineOptsNames[i] == "x")
+      if (engineOptsNames[i] == "output.var" || engineOptsNames[i] == "x")
       {
          modelName = r::sexp::asString(VECTOR_ELT(engineOptsSEXP, i));
          continue;


clang-check: rename the local FixItAction

Resolve the ambiguity in the FixItAction definition by renaming the type.  With
Xcode 9.2, you would fail to build this with:

  llvm/tools/clang/tools/clang-check/ClangCheck.cpp:183:48: error: reference to 'FixItAction' is ambiguous
      FrontendFactory = newFrontendActionFactory<FixItAction>();
                                                 ^

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

--- tools/clang-check/ClangCheck.cpp
+++ tools/clang-check/ClangCheck.cpp
@@ -122,7 +122,7 @@

 /// Subclasses \c clang::FixItAction so that we can install the custom
 /// \c FixItRewriter.
-class FixItAction : public clang::FixItAction {
+class ClangCheckFixItAction : public clang::FixItAction {
 public:
   bool BeginSourceFileAction(clang::CompilerInstance& CI) override {
     FixItOpts.reset(new FixItOptions);
@@ -180,7 +180,7 @@
   if (Analyze)
     FrontendFactory = newFrontendActionFactory<clang::ento::AnalysisAction>();
   else if (Fixit)
-    FrontendFactory = newFrontendActionFactory<FixItAction>();
+    FrontendFactory = newFrontendActionFactory<ClangCheckFixItAction>();
   else
     FrontendFactory = newFrontendActionFactory(&CheckFactory);


test suite: double the test in both unix and windows line styles

The following tests FAILED:
	655 - ryml-test-suite-DK3J-in_yaml (Child aborted)
	719 - ryml-test-suite-FP8R-in_yaml (Child aborted)
	867 - ryml-test-suite-K858-in_yaml (Child aborted)
	883 - ryml-test-suite-KSS4-in_yaml (Child aborted)
	1231 - ryml-test-suite-W4TN-in_yaml (Child aborted)
Errors while running CTest

--- test/suite.cpp
+++ test/suite.cpp
@@ -387,17 +387,34 @@
  * with/without reuse. */
 struct Subject
 {
-    Approach ro;
-    Approach ro_reuse;
-    Approach rw;
-    Approach rw_reuse;
+    Approach unix_ro;
+    Approach unix_ro_reuse;
+    Approach unix_rw;
+    Approach unix_rw_reuse;
+
+    Approach windows_ro;
+    Approach windows_ro_reuse;
+    Approach windows_rw;
+    Approach windows_rw_reuse;
+
+    std::string unix_src;
+    std::string windows_src;

     void init(c4::csubstr filename, c4::csubstr src, CasePart_e case_part, AllowedFailure af)
     {
-        ro      .init(filename, src, /*immutable*/true , /*reuse*/false, case_part, af);
-        ro_reuse.init(filename, src, /*immutable*/true , /*reuse*/true , case_part, af);
-        rw      .init(filename, src, /*immutable*/false, /*reuse*/false, case_part, af);
-        rw_reuse.init(filename, src, /*immutable*/false, /*reuse*/true , case_part, af);
+        src = replace_all("\r", "", src, &unix_src);
+
+        unix_ro      .init(filename, src, /*immutable*/true , /*reuse*/false, case_part, af);
+        unix_ro_reuse.init(filename, src, /*immutable*/true , /*reuse*/true , case_part, af);
+        unix_rw      .init(filename, src, /*immutable*/false, /*reuse*/false, case_part, af);
+        unix_rw_reuse.init(filename, src, /*immutable*/false, /*reuse*/true , case_part, af);
+
+        src = replace_all("\n", "\r\n", src, &windows_src);
+
+        windows_ro      .init(filename, src, /*immutable*/true , /*reuse*/false, case_part, af);
+        windows_ro_reuse.init(filename, src, /*immutable*/true , /*reuse*/true , case_part, af);
+        windows_rw      .init(filename, src, /*immutable*/false, /*reuse*/false, case_part, af);
+        windows_rw_reuse.init(filename, src, /*immutable*/false, /*reuse*/true , case_part, af);
     }
 };

@@ -425,7 +442,7 @@

     static c4::csubstr src(Subject const& s)
     {
-        return c4::to_csubstr(s.ro.levels[0].src);
+        return c4::to_csubstr(s.unix_ro.levels[0].src);
     }

     /** loads the several types of tests from an input test suite
@@ -639,17 +656,25 @@
 /**/

-#define DECLARE_TESTS(cls) \
-\
-DECLARE_TEST_CLASS(cls, ro)\
-DECLARE_TEST_CLASS(cls, rw)\
-DECLARE_TEST_CLASS(cls, ro_reuse)\
-DECLARE_TEST_CLASS(cls, rw_reuse)\
-\
-INSTANTIATE_TEST_SUITE_P(_, cls##_ro      , testing::Range<size_t>(0, NLEVELS));\
-INSTANTIATE_TEST_SUITE_P(_, cls##_rw      , testing::Range<size_t>(0, NLEVELS));\
-INSTANTIATE_TEST_SUITE_P(_, cls##_ro_reuse, testing::Range<size_t>(0, NLEVELS));\
-INSTANTIATE_TEST_SUITE_P(_, cls##_rw_reuse, testing::Range<size_t>(0, NLEVELS));
+#define DECLARE_TESTS(cls)                                              \
+                                                                        \
+DECLARE_TEST_CLASS(cls, unix_ro)                                        \
+DECLARE_TEST_CLASS(cls, unix_rw)                                        \
+DECLARE_TEST_CLASS(cls, unix_ro_reuse)                                  \
+DECLARE_TEST_CLASS(cls, unix_rw_reuse)                                  \
+DECLARE_TEST_CLASS(cls, windows_ro)                                     \
+DECLARE_TEST_CLASS(cls, windows_rw)                                     \
+DECLARE_TEST_CLASS(cls, windows_ro_reuse)                               \
+DECLARE_TEST_CLASS(cls, windows_rw_reuse)                               \
+                                                                        \
+INSTANTIATE_TEST_SUITE_P(_, cls##_unix_ro      , testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_unix_rw      , testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_unix_ro_reuse, testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_unix_rw_reuse, testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_windows_ro      , testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_windows_rw      , testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_windows_ro_reuse, testing::Range<size_t>(0, NLEVELS)); \
+INSTANTIATE_TEST_SUITE_P(_, cls##_windows_rw_reuse, testing::Range<size_t>(0, NLEVELS));

 DECLARE_TESTS(out_yaml)
@@ -657,6 +682,8 @@
 DECLARE_TESTS(in_json)
 DECLARE_TESTS(in_yaml)

+
+//-------------------------------------------
 //-------------------------------------------
 // this is needed to use the test case library
 Case const* get_case(csubstr /*name*/)


test suite: add context to allowed failures

--- test/suite.cpp
+++ test/suite.cpp
@@ -18,29 +18,43 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+typedef enum {
+    AFC_IN_YAML = 1 << 0,
+    AFC_IN_JSON = 1 << 1,
+    AFC_OUT_YAML = 1 << 2,
+    AFC_EVENTS = 1 << 3,
+    AFC_ALL = AFC_IN_YAML|AFC_IN_JSON|AFC_OUT_YAML|AFC_EVENTS,
+} CasePart_e;
+
 // don't forget to list these allowed failures in the repo's readme.md,
 // under the section "Known limitations"
-const std::map<c4::csubstr, c4::csubstr> g_allowed_failures = {
-    {"KK5P", "only string keys allowed (keys cannot be maps or seqs)"},
-};
-
-
 struct AllowedFailure
 {
     c4::csubstr test_code;
+    CasePart_e contexts;
     c4::csubstr reason;
     inline operator bool () const { return reason.len > 0; }
 };

+constexpr const AllowedFailure g_allowed_failures[] = {
+    {"35KP", AFC_IN_JSON, "malformed JSON"},
+    {"KK5P", AFC_ALL, "only string keys allowed (keys cannot be maps or seqs)"},
+};
+

 AllowedFailure failure_expected(c4::csubstr filename)
 {
     RYML_CHECK(filename.ends_with(".tml"));
     auto test_code = filename.basename();
     test_code = test_code.offs(0, 4);
-    auto it = g_allowed_failures.find(test_code);
-    if(it == g_allowed_failures.end()) return {};
-    return {test_code, it->second};
+    for(auto af : g_allowed_failures)
+    {
+        if(af.test_code == test_code)
+        {
+            return af;
+        }
+    }
+    return {};
 }

@@ -547,7 +561,7 @@
         if(allowed_to_fail)
         {
             c4::log("\n{}: this case is deliberately not implemented in rapidyaml: {}\n",
-                allowed_to_fail.test_code, allowed_to_fail.reason);
+                    allowed_to_fail.test_code, allowed_to_fail.reason);
             return 0;
         }
     }


Weird potential fix for AppVeyor

Weird potential fix for AppVeyor

--- fem/bilininteg_dgtrace.cpp
+++ fem/bilininteg_dgtrace.cpp
@@ -265,6 +265,7 @@

    MFEM_FORALL(f, NF,
    {
+      const int VDIM = 1;
       const int D1D = T_D1D ? T_D1D : d1d;
       const int Q1D = T_Q1D ? T_Q1D : q1d;
       // the following variables are evaluated at compile time


Avoid ParMETIS when we don't have enough elements per partition.

Note that our definition of "enough" here is a wild guess.

git-svn-id: e88a1e38e13faf406e05cc89eca8dd613216f6c4@5695 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- trunk/libmesh/src/partitioning/parmetis_partitioner.C
+++ trunk/libmesh/src/partitioning/parmetis_partitioner.C
@@ -47,6 +47,9 @@
 namespace libMesh
 {

+// Minimum elements on each processor required for us to choose
+// Parmetis over Metis.
+const unsigned int MIN_ELEM_PER_PROC = 4;

 // ------------------------------------------------------------
@@ -157,16 +160,19 @@
   // Initialize the data structures required by ParMETIS
   this->initialize (mesh, n_sbdmns);

-  // Make sure all processors have some active local elements.
+  // Make sure all processors have enough active local elements.
+  // Parmetis tends to crash when it's given only a couple elements
+  // per partition.
   {
-    bool all_have_active_elements = true;
+    bool all_have_enough_elements = true;
     for (unsigned int pid=0; pid<_n_active_elem_on_proc.size(); pid++)
-      if (!_n_active_elem_on_proc[pid]) all_have_active_elements = false;
+      if (_n_active_elem_on_proc[pid] < MIN_ELEM_PER_PROC)
+	all_have_enough_elements = false;

     // Parmetis will not work unless each processor has some
     // elements. Specifically, it will abort when passed a NULL
     // partition array on *any* of the processors.
-    if (!all_have_active_elements)
+    if (!all_have_enough_elements)
       {
 	// FIXME: revert to METIS, although this requires a serial mesh
         MeshSerializer serialize(mesh);


Added value compatibility test that fails.


Fix llvm-objdump's MachO mode to not depend on the value returned by RelocationRef::getInfo().

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

--- tools/llvm-objdump/MachODump.cpp
+++ tools/llvm-objdump/MachODump.cpp
@@ -385,7 +385,7 @@
     bool symbolTableWorked = false;

     // Parse relocations.
-    std::vector<std::pair<uint64_t, uint32_t> > Relocs;
+    std::vector<std::pair<uint64_t, SymbolRef> > Relocs;
     error_code ec;
     for (relocation_iterator RI = Sections[SectIdx].begin_relocations(),
          RE = Sections[SectIdx].end_relocations(); RI != RE; RI.increment(ec)) {
@@ -394,10 +394,10 @@
       Sections[SectIdx].getAddress(SectionAddress);
       RelocOffset -= SectionAddress;

-      uint64_t RelocInfo;
-      RI->getType(RelocInfo);
-
-      Relocs.push_back(std::make_pair(RelocOffset, RelocInfo));
+      SymbolRef RelocSym;
+      RI->getSymbol(RelocSym);
+
+      Relocs.push_back(std::make_pair(RelocOffset, RelocSym));
     }
     array_pod_sort(Relocs.begin(), Relocs.end());

@@ -594,8 +594,8 @@
                   Relocs[j].first < SectAddress + Inst.Address + Inst.Size) {
                 StringRef SymName;
                 uint64_t Addr;
-                UnsortedSymbols[Relocs[j].second].getName(SymName);
-                UnsortedSymbols[Relocs[j].second].getAddress(Addr);
+                Relocs[j].second.getAddress(Addr);
+                Relocs[j].second.getName(SymName);

                 outs() << "\t# " << SymName << ' ';
                 DumpAddress(Addr, Sections, MachOObj, outs());


ported signal handling to linux

ported signal handling to linux

--- test/include/unittest.hxx
+++ test/include/unittest.hxx
@@ -44,7 +44,7 @@
 #undef RGB
 #endif

-#elif defined(__unix)
+#elif defined(__unix) || defined(unix)

 #include <unistd.h>
 #include <signal.h>
@@ -193,13 +193,25 @@
     volatile int sigtype;
     int result;

+#if defined(linux) || defined(__linux)
+    signal(SIGFPE, &unit_test_signal_handler);
+    signal(SIGTRAP, &unit_test_signal_handler);
+    signal(SIGSEGV, &unit_test_signal_handler);
+    signal(SIGBUS, &unit_test_signal_handler);
+#else
     sigset(SIGFPE, &unit_test_signal_handler);
     sigset(SIGTRAP, &unit_test_signal_handler);
     sigset(SIGSEGV, &unit_test_signal_handler);
     sigset(SIGBUS, &unit_test_signal_handler);
+#endif
+
     if(timeout)
     {
+#if defined(linux) || defined(__linux)
+        signal(SIGALRM, &unit_test_signal_handler);
+#else
         sigset(SIGALRM, &unit_test_signal_handler);
+#endif
         alarm(timeout);
     }

@@ -234,15 +246,23 @@
                 result = os_exception;
         }
     }
+
     if(timeout)
     {
         alarm(0);
+#if defined(linux) || defined(__linux)
+#else
         sigrelse(SIGALRM);
-    }
+#endif
+    }
+
+#if defined(linux) || defined(__linux)
+#else
     sigrelse(SIGFPE);
     sigrelse(SIGTRAP);
     sigrelse(SIGSEGV);
     sigrelse(SIGBUS);
+#endif

     return result;
 }


harden lispsm code against div-by-zero

harden lispsm code against div-by-zero


[stable-merge] [swift-llvm-opt] Pass RelocModel as an Optional

--- tools/swift-llvm-opt/LLVMOpt.cpp
+++ tools/swift-llvm-opt/LLVMOpt.cpp
@@ -133,9 +133,9 @@
     return nullptr;
   }

-  return TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr,
-                                        FeaturesStr, Options, RelocModel,
-                                        CMModel, GetCodeGenOptLevel());
+  return TheTarget->createTargetMachine(
+      TheTriple.getTriple(), CPUStr, FeaturesStr, Options,
+      Optional<Reloc::Model>(RelocModel), CMModel, GetCodeGenOptLevel());
 }

 static void dumpOutput(llvm::Module &M, llvm::raw_ostream &os) {


Fixed bugs in E144 which made the optional boundary curve mandatory

--- src/entities/entity144.cpp
+++ src/entities/entity144.cpp
@@ -298,11 +298,13 @@
         return false;
     }

+    /* XXX -
     if( NULL == PTO )
     {
         ERRMSG << "\n + [BUG] unspecified outline entity\n";
         return false;
     }
+    */

     if( N1 < 0 || N1 >  1 )
     {
@@ -313,7 +315,11 @@
 	N2 = (int)PTI.size();

     iPTS = PTS->getDESequence();
-    iPTO = PTO->getDESequence();
+
+    if( PTO )
+        iPTO = PTO->getDESequence();
+    else
+        iPTO = 0;

     parameterData = index;

@@ -437,7 +443,7 @@
 bool IGES_ENTITY_144::isOrphaned( void )
 {
     if( (refs.empty() && depends != STAT_INDEPENDENT)
-        || ( NULL == PTS ) || ( NULL == PTO ) )
+        || ( NULL == PTS ) )
         return true;

     return false;


On second thought a thin frame actually seemed to be a good idea.

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

--- SourceCode/MaxObjects/jcom.textslider/jcom.textslider.cpp
+++ SourceCode/MaxObjects/jcom.textslider/jcom.textslider.cpp
@@ -134,6 +134,10 @@
 	CLASS_ATTR_RGBA(c,						"fgcolor",		0,	t_textslider,	attrFgColor);
 	CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c,	"fgcolor",		0,	"0.95 0.95 0.95 1.0");
 	CLASS_ATTR_STYLE(c,						"fgcolor",		0,	"rgba");
+
+	CLASS_ATTR_RGBA(c,						"bordercolor",	0,	t_textslider,	attrBorderColor);
+	CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c,	"bordercolor",	0,	"0.7 0.7 0.7 1.0");
+	CLASS_ATTR_STYLE(c,						"bordercolor",	0,	"rgba");

 	CLASS_ATTR_RGBA(c,						"textcolor",	0,	t_textslider,	attrTextColor);
 	CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c,	"textcolor",	0,	"0.0 0.0 0.0 1.0");
@@ -399,7 +403,7 @@

 	jbox_get_rect_for_view((t_object *)x, patcherview, &rect);

-	double	factor = rect.width;	// factor determines how much precision (vs. immediacy) you have when dragging the knob
+	double	factor = rect.width-2;	// factor determines how much precision (vs. immediacy) you have when dragging the knob
 	if(modifiers & eShiftKey)
 		factor = factor*50.;

@@ -432,7 +436,7 @@
 	// Mouse show up again at current slider value
 	jbox_get_rect_for_view((t_object *)x, patcherview, &rect);
 	jmouse_setposition_view(patcherview,
-							rect.x+((x->attrValue/(x->attrRange[1] - x->attrRange[0]))*rect.width),
+							rect.x+((x->attrValue/(x->attrRange[1] - x->attrRange[0]))*(rect.width-2)+1),
 							x->mousePositionY);
 }

@@ -453,7 +457,7 @@
 	textfield_set_wordwrap(textfield, 0);
 	textfield_set_useellipsis(textfield, 1);
 	textfield_set_textcolor(textfield, &x->attrTextColor);
-	textfield_set_textmargins(textfield, 2.0, 2.0, 2.0, 2.0);
+	textfield_set_textmargins(textfield, 10.0, 4.0, 2.0, 2.0);

 	return (void*)1;
 }
@@ -476,14 +480,23 @@
 	jbox_get_rect_for_view((t_object *)x, view, &rect);		// this is the box rectangle -- but we draw relative to 0 0, and thus only care about width & height
 	rect.x = 0;
 	rect.y = 0;
-	position = rect.width * value;
-
+	position = (rect.width-2) * value+1;
+
+	// Draw frame
+	c = x->attrBorderColor;
+	jgraphics_set_source_jrgba(g, &c);
+	jgraphics_rectangle_fill_fast(g, 0., 0., rect.width, rect.height);
+
+	// Draw active part of slider
 	c = x->attrFgColor;
 	jgraphics_set_source_jrgba(g, &c);
-	jgraphics_rectangle_fill_fast(g, 0, 0, position, rect.height);
-
+	jgraphics_rectangle_fill_fast(g, 1, 1, position, rect.height-2);
+
+	// Draw passive part of slider
 	c = x->attrBgColor;
 	jgraphics_set_source_jrgba(g, &c);
-	jgraphics_rectangle_fill_fast(g, position, 0, rect.width-position, rect.height);
-}
-
+	jgraphics_rectangle_fill_fast(g, position, 1, rect.width-position-1, rect.height-2);
+
+
+}
+


set notification on start/stop error

set notification on start/stop error

--- src/ethernet/ip_device.cpp
+++ src/ethernet/ip_device.cpp
@@ -197,15 +197,21 @@
                 {
                     try
                     {
+                        //TODO: move this after the rtsp call.
+                        //currently it is so as workaround to avoid re-try.
+                        remote_sensors[i]->is_enabled = enabled;
                         update_sensor_state(i, sw_sensor->get_active_streams(), true);
-                        remote_sensors[i]->is_enabled = enabled;
                     }
                     catch (const std::exception &e)
                     {
                         std::cerr << e.what() << '\n';
                         update_sensor_state(i, {}, true);
-                        throw std::runtime_error(e.what());
-
+                        rs2_software_notification notification;
+                        notification.description = e.what();
+                        notification.serialized_data = e.what();
+                        notification.severity = RS2_LOG_SEVERITY_WARN;
+                        //TODO: set values for type
+                        remote_sensors[i]->sw_sensor.get()->on_notification(notification);
                         continue;
                     }
                 }


updated

updated

--- Src/TestProjects/TestPlanGeneratorWithGazebo/Src/Main.cpp
+++ Src/TestProjects/TestPlanGeneratorWithGazebo/Src/Main.cpp
@@ -42,30 +42,36 @@
     vector<vector<WS_Coord>> avoidsArr;

     //Goto (1, 1, 2)
-    WS_Coord destination = WS_Coord(1, 1, 2);
+    vector<WS_Coord> destinations = { WS_Coord(1, 1, 2), WS_Coord(1, 40, 2), WS_Coord(43, 43, 2), WS_Coord(41, 1, 3)};
+
     WS_Coord currentLocation = GazeboToPlanner(WS_Coord(0, 0, 3));

-    GenerateMotionPlanFor(0, WSInfo, WSInfo->ConvertCoordToGridLocation(currentLocation), WSInfo->ConvertCoordToGridLocation(destination), WSInfo->GetObstaclesLocations(), avoidsArr, output_seq_of_locations, &output_size);
+    for(int locs = 0; locs < destinations.size(); locs++)
+    {
+        GenerateMotionPlanFor(0, WSInfo, WSInfo->ConvertCoordToGridLocation(currentLocation), WSInfo->ConvertCoordToGridLocation(destinations[locs]), WSInfo->GetObstaclesLocations(), avoidsArr, output_seq_of_locations, &output_size);

-    cout << "Trajectory Length = " << output_size << endl;
-    cout << "Trajectory: " << endl;
-    for (count = 0; count < output_size; count++)
-    {
-        cout << output_seq_of_locations[count] << endl;
+        cout << "Trajectory Length = " << output_size << endl;
+        cout << "Trajectory: " << endl;
+        for (count = 0; count < output_size; count++)
+        {
+            cout << output_seq_of_locations[count] << endl;
+        }
+
+        ConvertToGotos(output_seq_of_locations, output_size, gotos, &gotosSize);
+        cout << "Gotos: " << endl;
+        for (count = 0; count < gotosSize; count++)
+        {
+            cout << gotos[count] << endl;
+        }
+
+        for (count = 0; count < gotosSize; count++)
+        {
+            WS_Coord go = PlannerToGazebo(WSInfo->ConvertGridLocationToCoord(gotos[count]));
+            px4->GoTo(go.x,go.y,-go.z, 1);
+        }
+        currentLocation = destinations[locs];
     }

-    ConvertToGotos(output_seq_of_locations, output_size, gotos, &gotosSize);
-    cout << "Gotos: " << endl;
-    for (count = 0; count < gotosSize; count++)
-    {
-        cout << gotos[count] << endl;
-    }
-
-    for (count = 0; count < gotosSize; count++)
-    {
-        WS_Coord go = PlannerToGazebo(WSInfo->ConvertGridLocationToCoord(gotos[count]));
-        px4->GoTo(go.x,go.y,-go.z,0.5);
-    }

 	return 0;
 }


commented out HID stuff - program runs now

--- firmware/base2015/main.cpp
+++ firmware/base2015/main.cpp
@@ -14,7 +14,7 @@

 using namespace std;

-USBHID usbLink(64, 64, RJ_VENDOR_ID, RJ_PRODUCT_ID, RJ_RELEASE);
+// USBHID usbLink(64, 64, RJ_VENDOR_ID, RJ_PRODUCT_ID, RJ_RELEASE);

 shared_ptr<RtosTimer> rx_led_ticker;
 shared_ptr<RtosTimer> tx_led_ticker;
@@ -46,7 +46,8 @@
 void radioRxHandler(rtp::packet* pkt) {
     // TODO: copy data
     HID_REPORT data;
-    bool success = usbLink.sendNB(&data);
+    bool success = false;  // usbLink.sendNB(&data);
+
     if (!success) {
         LOG(WARN, "Failed to transfer received packet over usb");
     }
@@ -84,8 +85,10 @@
         Watchdog::Renew();

         HID_REPORT data;
-        usbLink.readNB(&data);
-        rtp::packet pkt;  // TODO: fill data
-        CommModule::Instance->send(pkt);
+        // usbLink.readNB(&data);
+        if (false) {
+            rtp::packet pkt;  // TODO: fill data
+            CommModule::Instance->send(pkt);
+        }
     }
 }