mysql.cc:   SQL_SELECT_LIMIT=0 protection

mysql.cc:
  SQL_SELECT_LIMIT=0 protection

client/mysql.cc:
  SQL_SELECT_LIMIT=0 protection

--- client/mysql.cc
+++ client/mysql.cc
@@ -2842,6 +2842,10 @@
   if (connected)
   {
     tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
+    /*
+      Don't remove "limit 1",
+      it is protection againts SQL_SELECT_LIMIT=0
+    */
     if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") &&
 	(result=mysql_use_result(&mysql)))
     {
@@ -2886,7 +2890,11 @@
   if ((id= mysql_insert_id(&mysql)))
     tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));

-  if (!mysql_query(&mysql,"select @@character_set_client, @@character_set_connection, @@character_set_server, @@character_set_database") &&
+  /*
+    Don't remove "limit 1",
+    it is protection againts SQL_SELECT_LIMIT=0
+  */
+  if (!mysql_query(&mysql,"select @@character_set_client, @@character_set_connection, @@character_set_server, @@character_set_database limit 1") &&
       (result=mysql_use_result(&mysql)))
   {
     MYSQL_ROW cur=mysql_fetch_row(result);


test

test

git-svn-id: f5d636078e73450abf2183305c5e43efec2a5605@809 1f5c12ca-751b-0410-a591-d2e778427230

--- irstlm/src/quantize-lm.cpp
+++ irstlm/src/quantize-lm.cpp
@@ -385,4 +385,3 @@
 }

-


Minor refactoring: add operator< to Point

--- closest_pair.cc
+++ closest_pair.cc
@@ -20,6 +20,13 @@

     bool operator==(const Point& other) const {
         return this->x == other.x && this->y == other.y;
+    }
+
+    bool operator<(const Point& other) const {
+        if (this->x == other.x) {
+            return this->y < other.y;
+        }
+        return this->x < other.x;
     }
 };

@@ -149,7 +156,7 @@
                                 RandomAccessIterator py_begin,
                                 RandomAccessIterator py_end) {
     if ((px_end - px_begin < 4) || (py_end - py_begin < 4)) {
-        std::set<Point, sort_by_x_value> points(px_begin, px_end);
+        std::set<Point> points(px_begin, px_end);
         std::copy(py_begin, py_end, std::inserter(points, points.begin()));
         return find_closest_pair_bruteforce(points.begin(), points.end());
     }


mrstats: removed duplicate ignorezero, kept the one in stats.cpp

--- cmd/mrstats.cpp
+++ cmd/mrstats.cpp
@@ -45,8 +45,7 @@
   + Stats::Options

   + OptionGroup ("Additional options for mrstats")
-  + Option ("allvolumes", "generate statistics across all image volumes, rather than one set of statistics per image volume")
-  + Option ("ignorezero", "ignore zero-valued input voxels.");
+  + Option ("allvolumes", "generate statistics across all image volumes, rather than one set of statistics per image volume");

 }

@@ -128,7 +127,7 @@

   vector<std::string> fields;
   opt = get_options ("output");
-  for (size_t n = 0; n < opt.size(); ++n)
+  for (size_t n = 0; n < opt.size(); ++n)
     fields.push_back (opt[n][0]);

   if (App::log_level && fields.empty())


Byte fields are signed.

Byte fields are signed.

--- streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp
+++ streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp
@@ -456,7 +456,7 @@
         packer.AddShort(std::numeric_limits<int16_t>::min());
         break;
     case RES_BYTE:
-        packer.AddByte(0); // byte fields are unsigned so we have no 'notdefined' value.
+        packer.AddByte(std::numeric_limits<int8_t>::min());
         break;
     case RES_FLOAT:
         packer.AddFloat(std::numeric_limits<float>::quiet_NaN());


Fix issue #1645, svn_client_ctx_t needs constructor for javahl
This applies r8053 to javahl

* SVNClient.cpp
   (SVNClient::getContext) use svn_client_create_context() instead of
   allocating directly

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@848131 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/bindings/java/javahl/native/SVNClient.cpp
+++ subversion/bindings/java/javahl/native/SVNClient.cpp
@@ -1013,7 +1013,14 @@
 {
 	apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
     svn_auth_baton_t *ab;
-	svn_client_ctx_t *ctx = (svn_client_ctx_t *) apr_pcalloc (JNIUtil::getRequestPool()->pool(), sizeof (*ctx));
+	//svn_client_ctx_t *ctx = (svn_client_ctx_t *) apr_pcalloc (JNIUtil::getRequestPool()->pool(), sizeof (*ctx));
+	svn_client_ctx_t *ctx;
+	svn_error_t *err = NULL;
+    if (( err = svn_client_create_context(&ctx, pool)))
+    {
+		JNIUtil::handleSVNError(err);
+        return NULL;
+    }

     apr_array_header_t *providers
       = apr_array_make (pool, 10, sizeof (svn_auth_provider_object_t *));
@@ -1078,8 +1085,7 @@
 	ctx->log_msg_baton = getCommitMessageBaton(message);
 	ctx->cancel_func = NULL;
 	ctx->cancel_baton = NULL;
-	svn_error_t *err = NULL;
-    if (( err = svn_config_get_config (&(ctx->config), NULL, JNIUtil::getRequestPool()->pool())))
+    if (( err = svn_config_get_config (&(ctx->config), NULL, pool)))
     {
 		JNIUtil::handleSVNError(err);
         return NULL;


comment out of data

comment out of data

Change-Id: Id509b4ffa7f891de2435c462df01e9b75167777b


Also reverting ccedcb

Also reverting ccedcb

--- tensorflow/core/distributed_runtime/tensor_coding.cc
+++ tensorflow/core/distributed_runtime/tensor_coding.cc
@@ -81,7 +81,7 @@
 Status TensorResponse::ParseFrom(Source* source) {
   if (!on_host_) {
     protobuf::io::CodedInputStream input(source->contents());
-    input.SetTotalBytesLimit(INT_MAX);  // Unlimited
+    input.SetTotalBytesLimit(INT_MAX, INT_MAX);  // Unlimited

     // Pre-parse into local storage, then delegate to device.
     if (!meta_.ParseFromCodedStream(&input) || !input.ConsumedEntireMessage()) {
@@ -217,7 +217,7 @@

 bool TensorResponse::ParseFast(Source* source) {
   protobuf::io::CodedInputStream input(source->contents());
-  input.SetTotalBytesLimit(INT_MAX);  // Unlimited
+  input.SetTotalBytesLimit(INT_MAX, INT_MAX);  // Unlimited
   while (true) {
     auto p = input.ReadTagWithCutoff(127);
     int tag = GetTagFieldNumber(p.first);


Move inverse scale calculation out of the loop for per-layer tensors.

PiperOrigin-RevId: 273306027

--- tensorflow/lite/tools/optimize/quantization_utils.cc
+++ tensorflow/lite/tools/optimize/quantization_utils.cc
@@ -136,8 +136,10 @@
 TfLiteStatus SymmetricQuantizeFloatsToInt16(ModelT* model, TensorT* tensor,
                                             float input_scale,
                                             float weight_scale) {
-  // Compute scales.
-  float scaling_factor = input_scale * weight_scale;
+  // Compute scale and inverse of scale.
+  const float scaling_factor = input_scale * weight_scale;
+  const float scaling_factor_inv =
+      (scaling_factor == 0) ? 0 : 1.0 / scaling_factor;

   BufferT* buffer = model->buffers[tensor->buffer].get();
   float* float_data = reinterpret_cast<float*>(buffer->data.data());
@@ -148,7 +150,6 @@
   const int32_t kScale = std::numeric_limits<int16_t>::max();

   for (size_t i = 0; i < num_elements; i++) {
-    float scaling_factor_inv = (scaling_factor == 0) ? 0 : 1.0 / scaling_factor;
     const int32_t quantized_value =
         static_cast<int32_t>(TfLiteRound(float_data[i] * scaling_factor_inv));
     final_buffer[i] = std::min(kScale, std::max(-kScale, quantized_value));
@@ -321,8 +322,10 @@
 TfLiteStatus SymmetricPerLayerBiasQuantize(ModelT* model, TensorT* tensor,
                                            float input_scale,
                                            float weight_scale) {
-  // Compute scales.
-  float scaling_factor = input_scale * weight_scale;
+  // Compute scale and inverse of scale.
+  const float scaling_factor = input_scale * weight_scale;
+  const float scaling_factor_inv =
+      (scaling_factor == 0) ? 0 : 1.0 / scaling_factor;

   BufferT* buffer = model->buffers[tensor->buffer].get();
   float* float_data = reinterpret_cast<float*>(buffer->data.data());
@@ -333,7 +336,6 @@
   const int32_t kScale = std::numeric_limits<int32_t>::max();

   for (size_t i = 0; i < num_elements; i++) {
-    float scaling_factor_inv = (scaling_factor == 0) ? 0 : 1.0 / scaling_factor;
     const int32_t quantized_value = tflite::SafeCast<int32_t>(
         TfLiteRound(float_data[i] * scaling_factor_inv));
     final_buffer[i] = std::min(kScale, std::max(-kScale, quantized_value));


cleanups

cleanups

--- Library/Sources/Stroika/Foundation/IO/FileSystem/FileSystem.cpp
+++ Library/Sources/Stroika/Foundation/IO/FileSystem/FileSystem.cpp
@@ -410,6 +410,7 @@
     ThrowIfZeroGetLastError (::GetCurrentDirectory (NEltsOf (buf), buf));
     return String::FromSDKString (buf);
 #else
+    AssertNotReached ();
 #endif
 }

@@ -420,5 +421,6 @@
 #elif   qPlatform_Windows
     ::SetCurrentDirectory(newDir.AsSDKString ().c_str ());
 #else
-#endif
-}
+    AssertNotReached ();
+#endif
+}


PERF: Improve MatrixOffset Jacobian computation performance

Use Array2D constructor from vnl_matrix to perform efficient copy of
the bulk matrix transform via std::copy.

Change-Id: Ib4d253de1a592693ed253a3e7e95ddbe21df76c4

--- Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx
+++ Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx
@@ -683,13 +683,7 @@
                                        JacobianType & jac) const
 {
   jac.SetSize( MatrixType::RowDimensions, MatrixType::ColumnDimensions );
-  for( unsigned int i = 0; i < MatrixType::RowDimensions; i++ )
-    {
-    for( unsigned int j = 0; j < MatrixType::ColumnDimensions; j++ )
-      {
-      jac[i][j] = this->GetMatrix()[i][j];
-      }
-    }
+  jac = this->GetMatrix().GetVnlMatrix();
 }

@@ -701,13 +695,7 @@
                                        JacobianType & jac) const
 {
   jac.SetSize( MatrixType::ColumnDimensions, MatrixType::RowDimensions );
-  for( unsigned int i = 0; i < MatrixType::ColumnDimensions; i++ )
-    {
-    for( unsigned int j = 0; j < MatrixType::RowDimensions; j++ )
-      {
-      jac[i][j] = this->GetInverseMatrix()[i][j];
-      }
-    }
+  jac = this->GetMatrix().GetVnlMatrix();
 }


ENH: improve SamplingRateCalculatorList implementation

--- Modules/Learning/Sampling/src/otbSamplingRateCalculatorList.cxx
+++ Modules/Learning/Sampling/src/otbSamplingRateCalculatorList.cxx
@@ -130,29 +130,28 @@
 SamplingRateCalculatorList
 ::SetNbOfSamplesAllClasses(std::vector<unsigned long> &nb, PartitionType t)
 {
-  if (nb.size() == 0)
+  if (nb.empty())
     {
     itkGenericExceptionMacro("No number of samples given");
     }
   this->UpdateGlobalCounts();
   ClassCountMapType::const_iterator it;
-  MapRateType::const_iterator curIt;
   ClassCountMapType needed;
   switch (t)
     {
     case PROPORTIONAL:
       {
-      unsigned long curTotal;
       for (unsigned int i=0 ; i<this->Size() ; i++)
         {
         needed.clear();
         for (it = m_GlobalCountMap.begin(); it != m_GlobalCountMap.end() ; ++it)
           {
-          curIt = this->GetNthElement(i)->GetRatesByClass().find(it->first);
-          if (curIt != this->GetNthElement(i)->GetRatesByClass().end() &&
+          const MapRateType& rates = this->GetNthElement(i)->GetRatesByClass();
+          MapRateType::const_iterator curIt = rates.find(it->first);
+          if (curIt != rates.end() &&
               it->second > 0UL)
             {
-            curTotal = (curIt->second).Tot;
+            unsigned long curTotal = (curIt->second).Tot;
             needed[it->first] = static_cast<unsigned long>(vcl_floor(
               static_cast<double>(nb[0]) *
               static_cast<double>(curTotal) /
@@ -199,12 +198,11 @@
 SamplingRateCalculatorList
 ::SetNbOfSamplesByClass(const std::vector<ClassCountMapType> &required, PartitionType t)
 {
-  if (required.size() == 0)
+  if (required.empty())
     {
     itkGenericExceptionMacro("No number of samples given");
     }
   this->UpdateGlobalCounts();
-  MapRateType::const_iterator curIt;
   ClassCountMapType::const_iterator it;
   ClassCountMapType::const_iterator inputIt;
   ClassCountMapType needed;
@@ -212,19 +210,19 @@
     {
     case PROPORTIONAL:
       {
-      unsigned long curTotal;
       for (unsigned int i=0 ; i<this->Size() ; i++)
         {
         needed.clear();
         for (it = m_GlobalCountMap.begin(); it != m_GlobalCountMap.end() ; ++it)
           {
-          curIt = this->GetNthElement(i)->GetRatesByClass().find(it->first);
+          const MapRateType &rates = this->GetNthElement(i)->GetRatesByClass();
+          MapRateType::const_iterator curIt = rates.find(it->first);
           inputIt = required[0].find(it->first);
-          if (curIt != this->GetNthElement(i)->GetRatesByClass().end() &&
+          if (curIt != rates.end() &&
               inputIt != required[0].end() &&
               it->second > 0UL)
             {
-            curTotal = (curIt->second).Tot;
+            unsigned long curTotal = (curIt->second).Tot;
             needed[it->first] = static_cast<unsigned long>(vcl_floor(
               static_cast<double>(inputIt->second) *
               static_cast<double>(curTotal) /
@@ -241,21 +239,20 @@
       }
     case EQUAL:
       {
-      unsigned long curTotal;
-      unsigned long curNeeded;
       for (unsigned int i=0 ; i<this->Size() ; i++)
         {
         needed.clear();
         for (it = m_GlobalCountMap.begin(); it != m_GlobalCountMap.end() ; ++it)
           {
-          curIt = this->GetNthElement(i)->GetRatesByClass().find(it->first);
+          const MapRateType &rates = this->GetNthElement(i)->GetRatesByClass();
+          MapRateType::const_iterator curIt = rates.find(it->first);
           inputIt = required[0].find(it->first);
-          if (curIt != this->GetNthElement(i)->GetRatesByClass().end() &&
+          if (curIt != rates.end() &&
               inputIt != required[0].end() &&
               it->second > 0UL)
             {
-            curTotal = (curIt->second).Tot;
-            curNeeded = static_cast<unsigned long>(vcl_floor(
+            unsigned long curTotal = (curIt->second).Tot;
+            unsigned long curNeeded = static_cast<unsigned long>(vcl_floor(
               static_cast<double>(inputIt->second) /
               static_cast<double>(this->Size())));
             needed[it->first] = std::min(curTotal,curNeeded);
@@ -298,14 +295,7 @@
     MapRateType::const_iterator it = rates.begin();
     for (; it != rates.end() ; ++it)
       {
-      if (m_GlobalCountMap.count(it->first))
-        {
-        m_GlobalCountMap[it->first] += it->second.Tot;
-        }
-      else
-        {
-        m_GlobalCountMap[it->first] = it->second.Tot;
-        }
+      m_GlobalCountMap[it->first] += it->second.Tot;
       }
     }
 }


Cherrypick ac38465: Handle bionic in safe_strerror_posix as well as glibc.

> Android's bionic C library is intending to adopt the same semantics as
> glibc for strerror_r: define the version that returns char* if the
> source is compiled with _GNU_SOURCE instead of the POSIX version which
> returns int. Add __BIONIC__ to the condition for
> USE_HISTORICAL_STRERRO_R so that Chromium will still work.
>
> BUG=
>
> Review URL: https://codereview.chromium.org/491893002
>
> Cr-Commit-Position: refs/heads/master@{#291050}
> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291050 0039d316-1c4b-4281-b951-d872f2087c98

Bug: 17384482
Change-Id: Ie80073df1327c8e415d83c1c9321cc3ca1beaf01
(cherry picked from commit 522d1de658a211abb2878b6d7a96c08b838e0639)

Bug: 17644570

--- base/safe_strerror_posix.cc
+++ base/safe_strerror_posix.cc
@@ -9,7 +9,8 @@
 #include <stdio.h>
 #include <string.h>

-#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL))
+#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(__BIONIC__) || \
+                                  defined(OS_NACL))

 #if USE_HISTORICAL_STRERRO_R && defined(__GNUC__)
 // GCC will complain about the unused second wrap function unless we tell it


Added missing tests.

Added missing tests.

Signed-off-by: Ralf Floca <fec4a647ab34f54e20bea9a9e3e1c74f13aefc78@dkfz-heidelberg.de>

--- Modules/QtWidgets/test/QmitkAbstractNodeSelectionWidgetTest.cpp
+++ Modules/QtWidgets/test/QmitkAbstractNodeSelectionWidgetTest.cpp
@@ -14,6 +14,7 @@
 #include <QApplication>
 #include <mitkNodePredicateFunction.h>
 #include <mitkStandaloneDataStorage.h>
+#include "QmitkModelViewSelectionConnector.h"

 #include <mitkTestFixture.h>
 #include <mitkTestingMacros.h>
@@ -22,8 +23,9 @@
 {
 public:
   explicit TestWidget(QWidget* parent = nullptr) : QmitkAbstractNodeSelectionWidget(parent), m_UpdateInfo(0), m_OnNodePredicateChanged(0), m_OnDataStorageChanged(0),
-    m_OnInternalSelectionChanged(0), m_OnNodeAddedToStorage(0), m_OnNodeRemovedFromStorage(0), m_ReviseSelectionChanged(0), m_AllowEmissionOfSelection(0), m_Allow(true)
-  {
+    m_OnInternalSelectionChanged(0), m_OnNodeAddedToStorage(0), m_OnNodeRemovedFromStorage(0), m_ReviseSelectionChanged(0), m_AllowEmissionOfSelection(0), m_Allow(true), m_NewSelectionEmited(0)
+  {
+    connect(this, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &TestWidget::NewSelectionEmited);
   };

   int m_UpdateInfo;
@@ -77,12 +79,15 @@

     return false;
   };
+
+  int m_NewSelectionEmited;
+  QmitkAbstractNodeSelectionWidget::NodeList m_LastNewEmision;
+  void NewSelectionEmited(NodeList selection)
+  {
+    m_NewSelectionEmited++;
+    m_LastNewEmision = selection;
+  };
 };
-
-bool SelectionsAreEqual(const QmitkAbstractNodeSelectionWidget::NodeList& list1, const QmitkAbstractNodeSelectionWidget::NodeList& list2)
-{
-  return list1 == list2;
-}

 class QmitkAbstractNodeSelectionWidgetTestSuite : public mitk::TestFixture
 {
@@ -90,10 +95,15 @@
   MITK_TEST(InstantiationTest);
   MITK_TEST(SetDataStorageTest);
   MITK_TEST(DataStorageEventTest);
+  MITK_TEST(NodePredicateTest);
+  MITK_TEST(SelectOnlyVisibleNodesTest);
+  MITK_TEST(OtherSetterAnsGetterTest);
+  MITK_TEST(AllowEmissionOfSelectionTest);
   CPPUNIT_TEST_SUITE_END();

   mitk::DataStorage::Pointer m_DataStorage;
   mitk::DataNode::Pointer m_Node1;
+  mitk::DataNode::Pointer m_Node1_2;
   mitk::DataNode::Pointer m_Node2;
   mitk::DataNode::Pointer m_Node3;

@@ -104,23 +114,37 @@
   {
     m_DataStorage = mitk::StandaloneDataStorage::New();
     m_Node1 = mitk::DataNode::New();
-    m_Node1->SetName("node1");
+    m_Node1->SetName("node1_1");

     m_Node2 = mitk::DataNode::New();
     m_Node2->SetName("node2");

     m_Node3 = mitk::DataNode::New();
     m_Node3->SetName("node3");
+
+    m_Node1_2 = mitk::DataNode::New();
+    m_Node1_2->SetName("node1_2");

     m_DataStorage->Add(m_Node1);
     m_DataStorage->Add(m_Node2);
     m_DataStorage->Add(m_Node3);
+    m_DataStorage->Add(m_Node1_2);

     int argc = 0;
     char** argv = nullptr;
     m_TestApp = new QApplication(argc, argv);
   }

+  mitk::NodePredicateBase::Pointer GeneratTestPredicate(const std::string& name)
+  {
+    auto check = [name](const mitk::DataNode * node)
+    {
+      return node->GetName().find(name,0) == 0;
+    };
+    auto predicate = mitk::NodePredicateFunction::New(check);
+    return predicate.GetPointer();
+  }
+
   void tearDown() override
   {
     delete m_TestApp;
@@ -147,6 +171,7 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(0, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(0, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);

     widget.SetDataStorage(m_DataStorage);
     CPPUNIT_ASSERT_EQUAL(1, widget.m_UpdateInfo);
@@ -157,6 +182,7 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(1, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(1, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);

     widget.SetCurrentSelection({ m_Node1 });
     CPPUNIT_ASSERT_EQUAL(2, widget.m_UpdateInfo);
@@ -167,6 +193,9 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1 }, widget.GetSelectedNodes()));

     widget.SetDataStorage(m_DataStorage);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_UpdateInfo);
@@ -177,7 +206,8 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_AllowEmissionOfSelection);
-    CPPUNIT_ASSERT(SelectionsAreEqual({ m_Node1 }, widget.GetSelectedNodes()));
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1 }, widget.GetSelectedNodes()));

     widget.SetDataStorage(nullptr);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
@@ -188,7 +218,9 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_AllowEmissionOfSelection);
-    CPPUNIT_ASSERT(SelectionsAreEqual({}, widget.GetSelectedNodes()));
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));
   }

   void DataStorageEventTest()
@@ -207,6 +239,7 @@
     CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(1, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(1, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);

     widget.SetCurrentSelection({ newNode });
     m_DataStorage->Remove(m_Node1);
@@ -218,7 +251,9 @@
     CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(2, widget.m_AllowEmissionOfSelection);
-    CPPUNIT_ASSERT(SelectionsAreEqual({ newNode }, widget.GetSelectedNodes()));
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ newNode }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ newNode }, widget.GetSelectedNodes()));

     m_DataStorage->Remove(newNode);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
@@ -229,7 +264,9 @@
     CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(3, widget.m_AllowEmissionOfSelection);
-    CPPUNIT_ASSERT(SelectionsAreEqual({}, widget.GetSelectedNodes()));
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));

     widget.SetCurrentSelection({ m_Node2 });
     m_DataStorage = nullptr;
@@ -241,7 +278,222 @@
     CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodeRemovedFromStorage);
     CPPUNIT_ASSERT_EQUAL(5, widget.m_ReviseSelectionChanged);
     CPPUNIT_ASSERT_EQUAL(5, widget.m_AllowEmissionOfSelection);
-    CPPUNIT_ASSERT(SelectionsAreEqual({}, widget.GetSelectedNodes()));
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));
+  }
+
+  void NodePredicateTest()
+  {
+    TestWidget widget;
+
+    CPPUNIT_ASSERT(nullptr == widget.GetNodePredicate());
+    auto testPred = GeneratTestPredicate("node2");
+    widget.SetNodePredicate(testPred);
+    CPPUNIT_ASSERT(testPred == widget.GetNodePredicate());
+
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);
+
+    widget.SetDataStorage(m_DataStorage);
+
+    widget.SetCurrentSelection({ m_Node3 });
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));
+
+    widget.SetCurrentSelection({ m_Node2 });
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node2 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node2 }, widget.GetSelectedNodes()));
+
+    //change predicate while nodes are selected
+    widget.SetNodePredicate(GeneratTestPredicate("node1"));
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));
+
+    //change selection to mixed one (valid nodes and invalid ones)
+    widget.SetCurrentSelection({ m_Node1, m_Node2, m_Node1_2 });
+    CPPUNIT_ASSERT_EQUAL(6, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(6, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(6, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(6, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node1_2 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node1_2 }, widget.GetSelectedNodes()));
+  }
+
+  void SelectOnlyVisibleNodesTest()
+  {
+    TestWidget widget;
+
+    CPPUNIT_ASSERT_EQUAL(true, widget.GetSelectOnlyVisibleNodes());
+
+    CPPUNIT_ASSERT(nullptr == widget.GetNodePredicate());
+    auto testPred = GeneratTestPredicate("node2");
+    widget.SetNodePredicate(testPred);
+    widget.SetDataStorage(m_DataStorage);
+    widget.SetCurrentSelection({ m_Node3 });
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({}, widget.GetSelectedNodes()));
+
+    widget.SetSelectOnlyVisibleNodes(false);
+    CPPUNIT_ASSERT_EQUAL(false, widget.GetSelectOnlyVisibleNodes());
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node3 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node3 }, widget.GetSelectedNodes()));
+
+    //change selection to mixed one (valid nodes and invalid ones)
+    widget.SetCurrentSelection({ m_Node1, m_Node2, m_Node1_2 });
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(4, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node2, m_Node1_2 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node2, m_Node1_2 }, widget.GetSelectedNodes()));
+
+    //change predicate while nodes are selected
+    widget.SetNodePredicate(GeneratTestPredicate("node1"));
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(6, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node2, m_Node1_2 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node2, m_Node1_2 }, widget.GetSelectedNodes()));
+
+    widget.SetSelectOnlyVisibleNodes(true);
+    CPPUNIT_ASSERT_EQUAL(true, widget.GetSelectOnlyVisibleNodes());
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(5, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(7, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node1_2 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1, m_Node1_2 }, widget.GetSelectedNodes()));
+  }
+
+  void OtherSetterAnsGetterTest()
+  {
+    TestWidget widget;
+
+    CPPUNIT_ASSERT("Error. Select data." == widget.GetInvalidInfo());
+    CPPUNIT_ASSERT("Empty. Make a selection." == widget.GetEmptyInfo());
+    CPPUNIT_ASSERT("Select a data node" == widget.GetPopUpTitel());
+    CPPUNIT_ASSERT("" == widget.GetPopUpHint());
+    CPPUNIT_ASSERT(false == widget.GetSelectionIsOptional());
+
+    widget.SetInvalidInfo("SetInvalidInfo");
+    widget.SetEmptyInfo("SetEmptyInfo");
+    widget.SetPopUpTitel("SetPopUpTitel");
+    widget.SetPopUpHint("SetPopUpHint");
+    widget.SetSelectionIsOptional(true);
+
+    CPPUNIT_ASSERT("SetInvalidInfo" == widget.GetInvalidInfo());
+    CPPUNIT_ASSERT("SetEmptyInfo" == widget.GetEmptyInfo());
+    CPPUNIT_ASSERT("SetPopUpTitel" == widget.GetPopUpTitel());
+    CPPUNIT_ASSERT("SetPopUpHint" == widget.GetPopUpHint());
+    CPPUNIT_ASSERT(true == widget.GetSelectionIsOptional());
+  }
+
+  void AllowEmissionOfSelectionTest()
+  {
+    TestWidget widget;
+
+    widget.SetDataStorage(m_DataStorage);
+    widget.SetCurrentSelection({ m_Node3 });
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(2, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node3 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node3 }, widget.GetSelectedNodes()));
+
+    widget.m_Allow = false;
+
+    widget.SetCurrentSelection({ m_Node1 });
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_UpdateInfo);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodePredicateChanged);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_OnDataStorageChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_OnInternalSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeAddedToStorage);
+    CPPUNIT_ASSERT_EQUAL(0, widget.m_OnNodeRemovedFromStorage);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_ReviseSelectionChanged);
+    CPPUNIT_ASSERT_EQUAL(3, widget.m_AllowEmissionOfSelection);
+    CPPUNIT_ASSERT_EQUAL(1, widget.m_NewSelectionEmited);
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node3 }, widget.m_LastNewEmision));
+    CPPUNIT_ASSERT(EqualNodeSelections({ m_Node1 }, widget.GetSelectedNodes()));
   }

 };


shared_memory: improve error messages on failure.

Be careful to leave errno untouched if the file open fails, so that
the latter logging statements that print errno will print the right
message.  Also format the logging text such that the perror-like
output (appending text like ": Permission denied") makes more sense.

Previously we'd end up printing text like
   Try [...] to fix.: Permission denied

BUG=57305
TEST=shared_memory_unittest should still pass

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@60986 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- base/shared_memory_posix.cc
+++ base/shared_memory_posix.cc
@@ -161,7 +161,8 @@
     // Deleting the file prevents anyone else from mapping it in
     // (making it private), and prevents the need for cleanup (once
     // the last fd is closed, it is truly freed).
-    file_util::Delete(path, false);
+    if (fp)
+      file_util::Delete(path, false);
   } else {
     if (!FilePathForMemoryName(name, &path))
       return false;
@@ -189,9 +190,15 @@
   if (fp == NULL) {
     if (posix_flags & O_CREAT) {
 #if !defined(OS_MACOSX)
-      PLOG(FATAL) << "Creating shared memory in " << path.value() << " failed. "
-                  << "This is frequently caused by incorrect permissions on "
-                  << "/dev/shm.  Try 'sudo chmod 777 /dev/shm' to fix.";
+      PLOG(ERROR) << "Creating shared memory in " << path.value() << " failed";
+      FilePath dir = path.DirName();
+      if (access(dir.value().c_str(), W_OK | X_OK) < 0) {
+        PLOG(ERROR) << "Unable to access(W_OK|X_OK) " << dir.value();
+        if (dir.value() == "/dev/shm") {
+          LOG(FATAL) << "This is frequently caused by incorrect permissions on "
+                     << "/dev/shm.  Try 'sudo chmod 777 /dev/shm' to fix.";
+        }
+      }
 #else
       PLOG(ERROR) << "Creating shared memory in " << path.value() << " failed";
 #endif


mark PlayerTest.*Benchmarks as secular

mark PlayerTest.*Benchmarks as secular

--- journal/player_test.cpp
+++ journal/player_test.cpp
@@ -80,7 +80,7 @@
   EXPECT_EQ(2, count);
 }

-TEST_F(PlayerTest, DISABLED_Benchmarks) {
+TEST_F(PlayerTest, DISABLED_SECULAR_Benchmarks) {
   benchmark::RunSpecifiedBenchmarks();
 }


compile

compile

--- src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
+++ src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
@@ -34,6 +34,7 @@
 #include <coreplugin/ifile.h>

 #include <QtCore/QFileInfo>
+#include <QtCore/QDir>
 #include <QtGui/QPushButton>
 #include <QtGui/QTreeWidget>
 #include <QtGui/QHeaderView>


Fix allocating potential far too much memory in the debugger.

Beware of negative sizes.

--- src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
+++ src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
@@ -709,8 +709,9 @@
     if (truncated)
         size = maxLength;
     const QChar doubleQuote = QLatin1Char('"');
-    QString value(doubleQuote);
-    if (size) {
+    QString value;
+    if (size > 0) {
+        value += doubleQuote;
         // Should this ever be a remote debugger, need to check byte order.
         unsigned short *buf =  new unsigned short[size + 1];
         unsigned long bytesRead;
@@ -724,8 +725,13 @@
         delete [] buf;
         if (truncated)
             value += QLatin1String("...");
-    }
-    value += doubleQuote;
+        value += doubleQuote;
+    } else if (size == 0) {
+        value = QString(doubleQuote) + doubleQuote;
+    } else {
+        value = "Invalid QString";
+    }
+
     wd->setValue(value);
     wd->setHasChildren(false);
     return 0;


Remove debugging output.

Remove debugging output.

--- src/plugins/qt4projectmanager/qtversionmanager.cpp
+++ src/plugins/qt4projectmanager/qtversionmanager.cpp
@@ -749,7 +749,6 @@
             after = true;
         } else if(part.contains('=')) {
             if (regExp.exactMatch(part)) {
-                qDebug()<<regExp.cap(1)<<"|"<<regExp.cap(2)<<"|"<<regExp.cap(3);
                 QMakeAssignment qa;
                 qa.variable = regExp.cap(1);
                 qa.op = regExp.cap(2);


implement TEST(JsonRendererTest, render_clustered_snippets)

--- src/plugins/websearch/tests/test-json-renderer.cpp
+++ src/plugins/websearch/tests/test-json-renderer.cpp
@@ -96,6 +96,36 @@
   ASSERT_EQ(std::string::npos, json_str.find(s3._url));
 }

+TEST(JsonRendererTest, render_clustered_snippets) {
+  websearch::_wconfig = new websearch_configuration("not a real filename");
+  query_context context;
+  cluster clusters[2];
+
+  std::string json_str;
+
+  std::vector<search_snippet*> snippets;
+  const std::string query_clean;
+  hash_map<const char*, const char*, hash<const char*>, eqstr> parameters;
+
+  search_snippet s1;
+  s1.set_url("URL1");
+  context.add_to_unordered_cache(&s1);
+  clusters[0].add_point(s1._id, NULL);
+  clusters[0]._label = "CLUSTER1";
+
+  search_snippet s2;
+  s2.set_url("URL2");
+  context.add_to_unordered_cache(&s2);
+  clusters[1].add_point(s2._id, NULL);
+  clusters[1]._label = "CLUSTER2";
+
+  ASSERT_EQ(SP_ERR_OK, json_renderer::render_clustered_snippets(query_clean, clusters, 2, &context, json_str, &parameters));
+  ASSERT_NE(std::string::npos, json_str.find(clusters[0]._label));
+  ASSERT_NE(std::string::npos, json_str.find(s1._url));
+  ASSERT_NE(std::string::npos, json_str.find(clusters[1]._label));
+  ASSERT_NE(std::string::npos, json_str.find(s2._url));
+}
+
 int main(int argc, char **argv)
 {
   ::testing::InitGoogleTest(&argc, argv);


Rt-click finds pixel coordinates using display size and buffer size instead of hard-coded values. #30

--- src/psmoveconfigtool/AppStage_ColorCalibration.cpp
+++ src/psmoveconfigtool/AppStage_ColorCalibration.cpp
@@ -403,10 +403,10 @@
         if (ImGui::IsMouseClicked(1) )
         {
             ImVec2 mousePos = ImGui::GetMousePos();
-            int img_x = mousePos.x * 640 / 800;
-            int img_y = mousePos.y * 480 / 600;
+            ImVec2 dispSize = ImGui::GetIO().DisplaySize;
+            int img_x = mousePos.x * m_video_buffer_state->hsvBuffer->cols / dispSize.x;
+            int img_y = mousePos.y * m_video_buffer_state->hsvBuffer->rows / dispSize.y;
             cv::Vec< unsigned char, 3 > hsv_pixel = m_video_buffer_state->hsvBuffer->at<cv::Vec< unsigned char, 3 >>(cv::Point(img_x, img_y));
-//            std::cout << "Clicked at " << img_x << ", " << img_y << "; HSV: " << hsv_pixel << std::endl;

             TrackerColorPreset preset = getColorPreset();
             preset.hue_center = hsv_pixel[0];


switch to SVM with prob estimates, which doesn't work

something is definitely messed up with the libsvm integration...

--- test/tests.cpp
+++ test/tests.cpp
@@ -114,7 +114,7 @@
     svm_params.eps = 1e-3;
     svm_params.nr_weight = 0;
     svm_params.shrinking = 0;
-    svm_params.probability = 0;
+    svm_params.probability = 1;

     // train a model
     const SDM<double> &model =


update bench

update bench

--- bench/spdlog-null-async.cpp
+++ bench/spdlog-null-async.cpp
@@ -63,17 +63,17 @@
         cout << "*******************************************************************************\n";

         size_t total_rate = 0;
-
+		spdlog::init_thread_pool(tp_queue_size, tp_threads);
         for (int i = 0; i < iters; ++i)
-        {
-            spdlog::init_thread_pool(tp_queue_size, tp_threads);
-            // auto as = spdlog::daily_logger_st("as", "logs/daily_async");
-            auto as = spdlog::create_async_logger<null_sink_st>("async(null-sink)");
+        {
+            auto as = spdlog::create_async_logger<null_sink_mt>("async(null-sink)");
             total_rate += bench_as(howmany, as, client_threads);
             spdlog::drop("async(null-sink)");
+			spdlog::details::registry::instance().get_thread_pool()->wait_empty ();
         }
         std::cout << endl;
         std::cout << "Avg rate: " << format(total_rate / iters) << "/sec" << std::endl;
+
     }
     catch (std::exception &ex)
     {


Fixed usage message in async null bench

Fixed usage message in async null bench

--- bench/spdlog-null-async.cpp
+++ bench/spdlog-null-async.cpp
@@ -39,7 +39,7 @@
     {
         if (argc < 2)
         {
-            cout << "Usage: " << argv[0] << " <howmany> [q_size] [client_threads] [tp_threads]" << endl;
+            cout << "Usage: " << argv[0] << " <howmany> [client_threads] [q_size] [tp_threads]" << endl;
             return (1);
         }


Rename rag affinity features

Rename rag affinity features

--- src/python/lib/graph/rag/accumulate_affinities.cxx
+++ src/python/lib/graph/rag/accumulate_affinities.cxx
@@ -64,7 +64,7 @@
         );
         */

-        ragModule.def("featuresFromLocalAffinities",
+        ragModule.def("accumulateAffinityStandartFeatures",
         [](
             const RAG & rag,
             const xt::pytensor<float, DIM+1> & affinities,
@@ -84,7 +84,7 @@
         }, py::arg("rag"),
            py::arg("affinities"),
            py::arg("offsets"),
-           py::arg("min")=0., py::arg("max")=0.,
+           py::arg("min")=0., py::arg("max")=1.,
            py::arg("numberOfThreads")=-1
         );
     }


Defer canceling UA inactivity timeout for chunked bodies too (#8084)

--- proxy/http/HttpSM.cc
+++ proxy/http/HttpSM.cc
@@ -2034,7 +2034,8 @@
     server_txn->set_inactivity_timeout(get_server_inactivity_timeout());

     // For requests that contain a body, we can cancel the ua inactivity timeout.
-    if (ua_txn && t_state.hdr_info.request_content_length > 0) {
+    if (ua_txn && ua_txn->has_request_body(t_state.hdr_info.request_content_length,
+                                           t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING)) {
       ua_txn->cancel_inactivity_timeout();
     }
   }
@@ -3682,9 +3683,8 @@
     // Now that we have communicated the post body, turn off the inactivity timeout
     // until the server starts sending data back
     if (ua_txn) {
-      if (t_state.hdr_info.request_content_length > 0) {
-        ua_txn->cancel_inactivity_timeout();
-      }
+      ua_txn->cancel_inactivity_timeout();
+
       // Initiate another read to catch aborts
       ua_entry->vc_handler = &HttpSM::state_watch_for_client_abort;
       ua_entry->read_vio   = p->vc->do_io_read(this, INT64_MAX, ua_txn->get_remote_reader()->mbuf);
@@ -7551,14 +7551,14 @@
       // Now that we have gotten the user agent request, we can cancel
       // the inactivity timeout associated with it.  Note, however, that
       // we must not cancel the inactivity timeout if the message
-      // contains a body (as indicated by the non-zero request_content_length
-      // field).  This indicates that a POST operation is taking place and
+      // contains a body. This indicates that a POST operation is taking place and
       // that the client is still sending data to the origin server.  The
       // origin server cannot reply until the entire request is received.  In
       // light of this dependency, TS must ensure that the client finishes
       // sending its request and for this reason, the inactivity timeout
       // cannot be cancelled.
-      if (ua_txn && t_state.hdr_info.request_content_length <= 0) {
+      if (ua_txn && !ua_txn->has_request_body(t_state.hdr_info.request_content_length,
+                                              t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING)) {
         ua_txn->cancel_inactivity_timeout();
       } else if (!ua_txn) {
         terminate_sm = true;
@@ -7595,14 +7595,14 @@
       // Now that we have gotten the user agent request, we can cancel
       // the inactivity timeout associated with it.  Note, however, that
       // we must not cancel the inactivity timeout if the message
-      // contains a body (as indicated by the non-zero request_content_length
-      // field).  This indicates that a POST operation is taking place and
+      // contains a body. This indicates that a POST operation is taking place and
       // that the client is still sending data to the origin server.  The
       // origin server cannot reply until the entire request is received.  In
       // light of this dependency, TS must ensure that the client finishes
       // sending its request and for this reason, the inactivity timeout
       // cannot be cancelled.
-      if (ua_txn && t_state.hdr_info.request_content_length <= 0) {
+      if (ua_txn && !ua_txn->has_request_body(t_state.hdr_info.request_content_length,
+                                              t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING)) {
         ua_txn->cancel_inactivity_timeout();
       } else if (!ua_txn) {
         terminate_sm = true;


Fixed failing `write` tests.

Fixed failing `write` tests.

Tests were failing due to af_free_device() call which is only necessary when
calling unlock().

--- test/write.cpp
+++ test/write.cpp
@@ -60,7 +60,6 @@
     ASSERT_ARRAYS_EQ(B_copy, A);
     ASSERT_ARRAYS_EQ(A_copy, B);

-    af_free_device(b_dev);
     freeHost(a_host);
 }


Update: cleanup

Update: cleanup


ICTJ:ICT-599 Removed calls to subscription_change in C++ consumers because this notification is not used by suppliers

git-svn-id: 4f15cd35116e72df6ba252f213c0d8a6c7d4ad11@232828 523d945c-050c-4681-91ec-863ad3bb968a

--- LGPL/CommonSoftware/acsnc/ws/src/acsncConsumerImpl.cpp
+++ LGPL/CommonSoftware/acsnc/ws/src/acsncConsumerImpl.cpp
@@ -592,6 +592,11 @@
 //-----------------------------------------------------------------------------
 void Consumer::addSubscription(const char* type_name)
 {
+/*
+ * Due to ICT-599 this code have been commented. Suppliers don't need to get notified
+ * This method is used to communicate to the suppliers the subscription changes but in fact
+ * ACS suppliers do not do anything with subscription changes (Look at acsncSupplier::subscription_change).
+ *
 	ACS_TRACE("Consumer::addSubscription");

 	CosNotification::EventTypeSeq added(1);
@@ -654,10 +659,16 @@
 		aspEx.log(LM_DEBUG);
 		throw aspEx;
 	}
+*/
 }//addSubscription
 //-----------------------------------------------------------------------------
 void Consumer::removeSubscription(const char* type_name)
 {
+/*
+ * Due to ICT-599 this code have been commented. Suppliers don't need to get notified
+ * This method is used to communicate to the suppliers the subscription changes but in fact
+ * ACS suppliers do not do anything with subscription changes (Look at acsncSupplier::subscription_change).
+ *
     ACS_TRACE("Consumer::removeSubscription");

@@ -707,6 +718,7 @@
     	aspEx.log(LM_DEBUG);
     	throw aspEx;
     }
+*/
 }//removeSubscription
 //-----------------------------------------------------------------------------
 int Consumer::addFilter(const char* type_name,


[DF][NFC] Remove compiler warning, better comment

--- tree/dataframe/test/dataframe_cache.cxx
+++ tree/dataframe/test/dataframe_cache.cxx
@@ -252,15 +252,15 @@
    auto m = cached.Max<ULong64_t>("col0");
    EXPECT_EQ(3UL, *m);

-   // second part
+   // Now stress a bit more the regexps
    ROOT::RDataFrame df(1);
    ROOT::RDF::RNode n(df);
    std::string base("col_");
    std::vector<std::string> defColNames; defColNames.reserve(128);
-   auto addCol = [base, &defColNames](ROOT::RDF::RNode &n, int i) {
+   auto addCol = [base, &defColNames](ROOT::RDF::RNode &node, int i) {
       auto colName = base+std::to_string(i);
       defColNames.emplace_back(colName);
-      return ROOT::RDF::RNode(n.Define(colName, [](){return 0;}));
+      return ROOT::RDF::RNode(node.Define(colName, [](){return 0;}));
    };
    for (auto i : ROOT::TSeqI(128)) {
       n = addCol(n, i);


added include frd.h where needed

added include frd.h where needed

git-svn-id: e171abefef93db0a74257c7d87d5b6400fe00c1f@1668 f22100f3-aa73-48fe-a4fb-fd497bb32605

--- trunk/extension/src/report/textfile.cpp
+++ trunk/extension/src/report/textfile.cpp
@@ -11,6 +11,7 @@

 #include <wx/extension/report/textfile.h>
 #include <wx/extension/app.h>
+#include <wx/extension/frd.h>
 #include <wx/extension/report/defs.h>
 #include <wx/extension/report/listview.h>
 #include <wx/extension/report/frame.h>


refine code

refine code

--- trunk/src/protocol/rs_protocol_rtmp.cpp
+++ trunk/src/protocol/rs_protocol_rtmp.cpp
@@ -26,6 +26,7 @@
 #include "rs_protocol_rtmp.h"

 using namespace std;
+#define CHUNK_MESSAGE_TIMESTAMP_MAX 16777215

 c0c1::c0c1()
 {
@@ -153,7 +154,7 @@
     timestamp = RsBufferLittleEndian::convert_3bytes_into_uint32(buf);
     buf.clear();

-    if (timestamp > 16777215) {
+    if (timestamp > CHUNK_MESSAGE_TIMESTAMP_MAX) {
         has_extended_timestamp = true;
     }


[ubsan] Follow-up for r216263: fix the expected line number.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@216266 91177308-0d34-0410-b5e6-96231b3b80d8

--- test/ubsan/TestCases/TypeCheck/Function/function.cpp
+++ test/ubsan/TestCases/TypeCheck/Function/function.cpp
@@ -14,7 +14,7 @@

 int main(void) {
   // CHECK: runtime error: call to function f() through pointer to incorrect function type 'void (*)(int)'
-  // CHECK-NEXT: function.cpp:8: note: f() defined here
+  // CHECK-NEXT: function.cpp:11: note: f() defined here
   // NOSYM: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
   // NOSYM-NEXT: ({{.*}}+0x{{.*}}): note: (unknown) defined here
   reinterpret_cast<void (*)(int)>(reinterpret_cast<uintptr_t>(f))(42);


Strip double quotes from configuration files. This allows us to use spaces on the property values.

--- opencog/util/Config.cc
+++ opencog/util/Config.cc
@@ -39,10 +39,10 @@

 // returns a string with leading/trailing characters of a set stripped
 static char const* blank_chars = " \t\f\v\n\r";
-static string strip(string const& str)
+static string strip(string const& str, char const *strip_chars = blank_chars)
 {
-    string::size_type const first = str.find_first_not_of(blank_chars);
-    return (first == string::npos) ? string() : str.substr(first, str.find_last_not_of(blank_chars) - first + 1);
+    string::size_type const first = str.find_first_not_of(strip_chars);
+    return (first == string::npos) ? string() : str.substr(first, str.find_last_not_of(strip_chars) - first + 1);
 }

 Config::~Config()
@@ -97,6 +97,7 @@
             // strip them
             name  = strip(name);
             value = strip(value);
+            value = strip(value, "\"");
             // finally, store the entries
             table[name] = value;
         } else if (line.find_first_not_of(blank_chars) != string::npos) {


Fix XCB window dimensions setter

Fix XCB window dimensions setter

Make sure that dimension setter catched appropriate property notify event.

Components: Framework

VK-GL-CTS issue: 134

Change-Id: I4630175dffea57a54375fe6900df7dd3aa5823d4

--- framework/platform/X11/tcuX11Xcb.cpp
+++ framework/platform/X11/tcuX11Xcb.cpp
@@ -150,8 +150,12 @@
 		{
 			if (XCB_PROPERTY_NOTIFY == (event->response_type & ~0x80))
 			{
-				deFree(event);
-				break;
+				const xcb_property_notify_event_t* pnEvent = (xcb_property_notify_event_t*)event;
+				if (pnEvent->atom == XCB_ATOM_RESOLUTION)
+				{
+					deFree(event);
+					break;
+				}
 			}
 			deFree(event);
 		}


tests: fixed building maybe

tests: fixed building maybe

--- tests/Test.cpp
+++ tests/Test.cpp
@@ -120,7 +120,6 @@
         // Set output files
         switch (backend) {
             case compiler::Backend::C:
-            case compiler::Backend::CPP:
             case compiler::Backend::CPAR:
                 compiler.setOutput("out.c");
                 compiler.setHeaderOutput("test.h");
@@ -154,8 +153,7 @@
 // Run separate function for each supported target language
 // Only currently relevant languages available
 bool Test::executeChecker(std::string args, std::string expectedOutput) {
-    if (backend == compiler::Backend::CPP
-        || backend == compiler::Backend::CPAR
+    if (backend == compiler::Backend::CPAR
         || backend == compiler::Backend::C) {
         return executeCPP(args, expectedOutput);
     } else if (backend == compiler::Backend::LLVM) {
@@ -175,7 +173,7 @@
     int status;

     // Compile program using system c compiler
-    if (backend == compiler::Backend::CPP || backend == compiler::Backend::C) {    // Sequential compiler
+    if (backend == compiler::Backend::C) {    // Sequential compiler
         status = system("cc out.c -o prog");
     } else if (backend == compiler::Backend::CPAR) {    // Parallel compiler
         status = system("cc out.c context.c print.c queue.c runtime.c task.c -o prog -lpthread");


indent line

indent line

--- include/fmicpp/fmi2/xml/ModelVariables.hpp
+++ include/fmicpp/fmi2/xml/ModelVariables.hpp
@@ -34,7 +34,7 @@

 namespace fmicpp::fmi2::xml {

-struct ModelVariables : public std::vector<std::unique_ptr<ScalarVariable>> {
+    struct ModelVariables : public std::vector<std::unique_ptr<ScalarVariable>> {

         void load(const ptree &node);


Improve Jacobian

Improve Jacobian

r5602

--- framework/src/bcs/ConvectiveFluxBC.C
+++ framework/src/bcs/ConvectiveFluxBC.C
@@ -32,7 +32,7 @@
     _rate(getParam<Real>("rate")),
     _duration(getParam<Real>("duration"))
 {}
-
+

 Real
 ConvectiveFluxBC::computeQpResidual()
@@ -43,10 +43,10 @@
     value = _initial + (_final-_initial) * std::sin((0.5/_duration) * libMesh::pi * _t);
   else
     value = _final;
-
+
   return -(_test[_i][_qp]*_rate*(value - _u[_qp]));
 }
-
+
 Real
 ConvectiveFluxBC::computeQpJacobian()
 {


* WinApi test.

* WinApi test.

--- tests/call.cpp
+++ tests/call.cpp
@@ -272,6 +272,35 @@
     reinterpret_cast<DWORD_PTR>(&TestCallDoubleRet)),
     hadesmem::CallConv::kDefault);
   BOOST_CHECK_EQUAL(CallRetDouble.first, 9.876);
+
+#if defined(_M_AMD64)
+  auto const CallConvWinapi = hadesmem::CallConv::kDefault;
+#elif defined(_M_IX86)
+  auto const CallConvWinapi = hadesmem::CallConv::kStdCall;
+#else
+#error "[HadesMem] Unsupported architecture."
+#endif
+
+  HMODULE const kernel32_mod = GetModuleHandle(L"kernel32.dll");
+  BOOST_REQUIRE(kernel32_mod != 0);
+
+#if defined(HADESMEM_MSVC)
+#pragma warning(push)
+#pragma warning(disable: 6387)
+#endif // #if defined(HADESMEM_MSVC)
+
+  FARPROC const get_proc_address = GetProcAddress(kernel32_mod,
+    "GetProcAddress");
+  BOOST_REQUIRE(get_proc_address != 0);
+
+#if defined(HADESMEM_MSVC)
+#pragma warning(pop)
+#endif // #if defined(HADESMEM_MSVC)
+
+  auto const CallWin =
+    hadesmem::Call<FARPROC (*)(HMODULE, LPCSTR)>(process, get_proc_address,
+    CallConvWinapi, kernel32_mod, "GetProcAddress");
+  BOOST_CHECK_EQUAL(CallWin.first, get_proc_address);

   hadesmem::MultiCall multi_call(&process);
   multi_call.Add<void (*)(DWORD last_error)>(process, reinterpret_cast<PVOID>(


add Gaussian integral with var sigma

add Gaussian integral with var sigma

--- test/unit/math/rev/arr/functor/integrate_1d_test.cpp
+++ test/unit/math/rev/arr/functor/integrate_1d_test.cpp
@@ -1,124 +1,136 @@
-#include <stan/math.hpp>
-#include <stan/math/mix/mat.hpp>
 #include <gtest/gtest.h>
-#include <test/unit/util.hpp>
-#include <test/unit/math/rev/mat/fun/util.hpp>
 #include <iostream>
 #include <limits>
 #include <sstream>
+#include <stan/math.hpp>
+#include <stan/math/mix/mat.hpp>
+#include <test/unit/math/rev/mat/fun/util.hpp>
+#include <test/unit/util.hpp>
 #include <vector>

 std::ostringstream msgs;

 struct f1 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(x) + theta[0];
   }
 };

 struct f2 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(theta[0] * cos(2 * 3.141593 * x)) + theta[0];
   }
 };

 struct f3 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
-    return exp(x) + pow(theta[0], x_r[0]) + 2 * pow(theta[1], x_r[1])
-           + 2 * theta[2];
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
+    return exp(x) + pow(theta[0], x_r[0]) + 2 * pow(theta[1], x_r[1]) +
+           2 * theta[2];
   }
 };

 struct f4 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(-x) / sqrt(x);
   }
 };

 struct f5 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(-theta[0] * x) / sqrt(theta[1] * x);
   }
 };

 struct f6 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return sqrt(x / (1 - theta[0] * x * x));
   }
 };

 struct f7 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(-theta[0] * x);
   }
 };

 struct f8 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(theta[0] * x);
   }
 };

 struct f9 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return exp(-pow(x - x_r[0], x_i[0]) / pow(x_r[1], x_i[0]));
   }
 };

 struct f10 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
     return 1 / (1 + pow(x, x_i[0]) / x_r[0]);
   }
 };

 struct f11 {
   template <typename T1, typename T2>
-  inline typename stan::return_type<T1, T2>::type operator()(
-      const T1& x, const T1& xc, const std::vector<T2>& theta,
-      const std::vector<double>& x_r, const std::vector<int>& x_i,
-      std::ostream& msgs) const {
-    return pow(x, theta[0] - 1.0)
-           * pow((x > 0.5) ? xc : (1 - x), theta[1] - 1.0);
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
+    return pow(x, theta[0] - 1.0) *
+           pow((x > 0.5) ? xc : (1 - x), theta[1] - 1.0);
+  }
+};
+
+struct f12 {
+  template <typename T1, typename T2>
+  inline typename stan::return_type<T1, T2>::type
+  operator()(const T1 &x, const T1 &xc, const std::vector<T2> &theta,
+             const std::vector<double> &x_r, const std::vector<int> &x_i,
+             std::ostream &msgs) const {
+    T2 sigma = theta[0];
+    return exp(-0.5 * stan::math::square(x / sigma)) /
+           (sigma * sqrt(2.0 * stan::math::pi()));
   }
 };

@@ -152,10 +164,10 @@
  * @param grad correct value of gradients
  */
 template <typename F>
-void test_derivatives(const F& f, double a, double b,
+void test_derivatives(const F &f, double a, double b,
                       std::vector<double> thetas,
-                      const std::vector<double>& x_r,
-                      const std::vector<int>& x_i, double val,
+                      const std::vector<double> &x_r,
+                      const std::vector<int> &x_i, double val,
                       std::vector<double> grad) {
   using stan::math::var;

@@ -191,8 +203,8 @@
   test_derivatives(f2{}, 1.0, 1.0, {0.5}, {}, {}, 0.0, {0.0});
   // Zero crossing integral + test x_r
   test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, {2.5, 3.0}, {},
-                   2.350402387287579 + 2.0 * pow(0.5, 2.5)
-                       + 4.0 * pow(1.75, 3.0) + 4.0 * 3.9,
+                   2.350402387287579 + 2.0 * pow(0.5, 2.5) +
+                       4.0 * pow(1.75, 3.0) + 4.0 * 3.9,
                    {5 * pow(0.5, 1.5), 12 * 1.75 * 1.75, 4.0});
   // Tricky integral from Boost docs + limit at infinity + no gradients
   test_derivatives(f4{}, 0.0, std::numeric_limits<double>::infinity(), {}, {},
@@ -230,4 +242,8 @@
                    {-0.004852607709750566, -0.01040816326530613});
   test_derivatives(f11{}, 0.0, 1.0, {3.0, 5.0}, {}, {}, 0.00952380952380952,
                    {-0.01040816326530613, -0.004852607709750566});
+
+  test_derivatives(f12{}, -std::numeric_limits<double>::infinity(),
+                   std::numeric_limits<double>::infinity(), {1}, {}, {}, 1.0,
+                   {0});
 }


Silence some useless MSVC warnings

Silence some useless MSVC warnings

--- include/tao/pegtl/internal/duseltronik.hpp
+++ include/tao/pegtl/internal/duseltronik.hpp
@@ -9,6 +9,11 @@
 #include "../rewind_mode.hpp"

 #include "dusel_mode.hpp"
+
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4702 )
+#endif

 namespace TAO_PEGTL_NAMESPACE::internal
 {
@@ -175,4 +180,8 @@

 }  // namespace TAO_PEGTL_NAMESPACE::internal

+#ifdef _MSC_VER
+#pragma warning( pop )
 #endif
+
+#endif


MSVC doesn't support variables arrays on the stack

--- testing/adios2/performance/metadata/PerfMetaData.cpp
+++ testing/adios2/performance/metadata/PerfMetaData.cpp
@@ -265,8 +265,9 @@
     adios2::Engine writer = io.Open("MetaDataTest", adios2::Mode::Write);
     std::chrono::time_point<std::chrono::high_resolution_clock> start, finish;
     std::vector<float> myFloats = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-    adios2::Variable<float> Floats[NumVars];
-    adios2::Variable<float> FloatArrays[NumArrays];
+    adios2::Variable<float> *Floats = new adios2::Variable<float>[NumVars];
+    adios2::Variable<float> *FloatArrays =
+        new adios2::Variable<float>[NumArrays];
     if (mpiRank == 0)
     {
         // attributes and globals on rank 0


tests: Simplify macro names

tests: Simplify macro names

--- tests/impl.cpp
+++ tests/impl.cpp
@@ -20,14 +20,13 @@
  */

 /* catenate */
-#define SSE2NEON_TEST_IMPL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
-
-#define SSE2NEON_TEST_IMPL_IIF(c) \
-    SSE2NEON_TEST_IMPL_PRIMITIVE_CAT(SSE2NEON_TEST_IMPL_IIF_, c)
+#define PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
+
+#define IIF(c) PRIMITIVE_CAT(IIF_, c)
 /* run the 2nd parameter */
-#define SSE2NEON_TEST_IMPL_IIF_0(t, ...) __VA_ARGS__
+#define IIF_0(t, ...) __VA_ARGS__
 /* run the 1st parameter */
-#define SSE2NEON_TEST_IMPL_IIF_1(t, ...) t
+#define IIF_1(t, ...) t

 // This program a set of unit tests to ensure that each SSE call provide the
 // output we expect.  If this fires an assert, then something didn't match up.
@@ -9383,25 +9382,24 @@

 #define DEF_ENUM_MM_CMPESTRX_VARIANT(c, ...) c,

-#define EVAL_MM_CMPESTRX_TEST_CASE(c, type, data_type, im, IM)                 \
-    do {                                                                       \
-        data_type *a = test_mm_##im##_##type##_data[c].a,                      \
-                  *b = test_mm_##im##_##type##_data[c].b;                      \
-        int la = test_mm_##im##_##type##_data[c].la,                           \
-            lb = test_mm_##im##_##type##_data[c].lb;                           \
-        const int imm8 = IMM_##c;                                              \
-        SSE2NEON_TEST_IMPL_IIF(IM)                                             \
-        (int expect = test_mm_##im##_##type##_data[c].expect,                  \
-         data_type *expect = test_mm_##im##_##type##_data[c].expect);          \
-        __m128i ma, mb;                                                        \
-        memcpy(&ma, a, sizeof(ma));                                            \
-        memcpy(&mb, b, sizeof(mb));                                            \
-        SSE2NEON_TEST_IMPL_IIF(IM)                                             \
-        (int res = _mm_cmpestri(ma, la, mb, lb, imm8),                         \
-         __m128i res = _mm_cmpestrm(ma, la, mb, lb, imm8));                    \
-        if (SSE2NEON_TEST_IMPL_IIF(IM)(res != expect,                          \
-                                       memcmp(expect, &res, sizeof(__m128i)))) \
-            return TEST_FAIL;                                                  \
+#define EVAL_MM_CMPESTRX_TEST_CASE(c, type, data_type, im, IM)             \
+    do {                                                                   \
+        data_type *a = test_mm_##im##_##type##_data[c].a,                  \
+                  *b = test_mm_##im##_##type##_data[c].b;                  \
+        int la = test_mm_##im##_##type##_data[c].la,                       \
+            lb = test_mm_##im##_##type##_data[c].lb;                       \
+        const int imm8 = IMM_##c;                                          \
+        IIF(IM)                                                            \
+        (int expect = test_mm_##im##_##type##_data[c].expect,              \
+         data_type *expect = test_mm_##im##_##type##_data[c].expect);      \
+        __m128i ma, mb;                                                    \
+        memcpy(&ma, a, sizeof(ma));                                        \
+        memcpy(&mb, b, sizeof(mb));                                        \
+        IIF(IM)                                                            \
+        (int res = _mm_cmpestri(ma, la, mb, lb, imm8),                     \
+         __m128i res = _mm_cmpestrm(ma, la, mb, lb, imm8));                \
+        if (IIF(IM)(res != expect, memcmp(expect, &res, sizeof(__m128i)))) \
+            return TEST_FAIL;                                              \
     } while (0);

 result_t test_mm_cmpestri(const SSE2NEONTestImpl &impl, uint32_t iter)


Improve constness

Improve constness

--- core/rint/src/TTabCom.cxx
+++ core/rint/src/TTabCom.cxx
@@ -2501,7 +2501,7 @@

          // Check if it's a method
          TMethod *mptr = 0; // pclass->GetMethodAny(memberName.Data());
-         TList  *mlist = pclass->GetListOfAllPublicMethods();
+         const TList  *mlist = pclass->GetListOfAllPublicMethods();
          next = mlist;
          while ((mptr = (TMethod *) next())) {
             if (strcmp(memberName.Data(),mptr->GetName())==0) break;


Only get name for connect packets

Only get name for connect packets

Otherwise use stored name

--- client/game.cpp
+++ client/game.cpp
@@ -618,14 +618,13 @@
 			}
 			else
 			{
-				string name;
-				packet >> name;
-				// TODO keep track of other players
-
 				switch (event)
 				{
 					case 0: // joining
 					{
+						string name;
+						packet >> name;
+
 						sf::Int16 ack_n = ack_num;

 						if (!players.count(id))
@@ -649,12 +648,12 @@

 						if (players.count(id))
 						{
+							messages.add(players.at(id).get_name() + " left the game", Message::Severity::LOW);
 							players.erase(id);
-							messages.add(name + " left the game", Message::Severity::LOW);
 							++ack_num;
 						}
 						else
-							cerr << "Disconnect for unknown player: " << name << " (" << id << ")\n";
+							cerr << "Disconnect for unknown player: " << id << endl;

 						// acknowledge
 						sf::Packet ack;
@@ -667,10 +666,10 @@
 						if (players.count(id))
 						{
 							players.at(id).ready = true;
-							messages.add(name + " is ready to play", Message::Severity::LOW);
+							messages.add(players.at(id).get_name() + " is ready to play", Message::Severity::LOW);
 						}
 						else
-							cerr << "Ready for unknown player: " << name << " (" << id << ")\n";
+							cerr << "Ready for unknown player: " << id << endl;
 						break;
 					}
 					case 3: // not ready
@@ -678,10 +677,10 @@
 						if (players.count(id))
 						{
 							players.at(id).ready = false;
-							messages.add(name + " is not ready", Message::Severity::LOW);
+							messages.add(players.at(id).get_name() + " is not ready", Message::Severity::LOW);
 						}
 						else
-							cerr << "Unready for unknown player: " << name << " (" << id << ")\n";
+							cerr << "Unready for unknown player: " << id << endl;
 						break;
 					}
 					default:
@@ -796,7 +795,7 @@
 					// TODO this doesn't work
 					messages.add(players.at(peeler_id).get_name() + ": PEEL!", Message::Severity::HIGH);

-				if (remaining < players.size())
+				if (remaining < (int)players.size())
 					messages.add("Final peel!", Message::Severity::HIGH);
 				else
 				{


revert changes to larger tree

revert changes to larger tree

--- PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSubJetFraction.cxx
+++ PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSubJetFraction.cxx
@@ -368,7 +368,7 @@

   //create a tree used for the MC data and making a 4D response matrix
   fTreeResponseMatrixAxis = new TTree("fTreeJetShape", "fTreeJetShape");
- /* if (fFullTree){
+  if (fFullTree){
     const Int_t nVar = 18;
     fShapesVar = new Double_t [nVar]; //shapes used for tagging
     TString *fShapesVarNames = new TString [nVar];
@@ -395,9 +395,9 @@
       cout<<"looping over variables"<<endl;
       fTreeResponseMatrixAxis->Branch(fShapesVarNames[ivar].Data(), &fShapesVar[ivar], Form("%s/D", fShapesVarNames[ivar].Data()));
     }
-  }*/
+  }

-  // if (!fFullTree){
+  if (!fFullTree){
     const Int_t nVar = 12;
     fShapesVar = new Double_t [nVar]; //shapes used for tagging
     TString *fShapesVarNames = new TString [nVar];
@@ -418,7 +418,7 @@
       cout<<"looping over variables"<<endl;
       fTreeResponseMatrixAxis->Branch(fShapesVarNames[ivar].Data(), &fShapesVar[ivar], Form("%s/D", fShapesVarNames[ivar].Data()));
     }
-    //}
+  }

   if (fJetShapeType==AliAnalysisTaskSubJetFraction::kData || fJetShapeType==AliAnalysisTaskSubJetFraction::kSim || fJetShapeType==AliAnalysisTaskSubJetFraction::kGenOnTheFly){
@@ -745,12 +745,12 @@
 	  fShapesVar[6]=fjNSubJettiness(Jet1,0,3,0,1,0);
 	  fShapesVar[8]=fjNSubJettiness(Jet1,0,2,0,1,1);
 	  fShapesVar[10]=Jet1->GetNumberOfTracks();
-	  /*	  if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[12]=fjNSubJettiness(Jet1,0,2,0,1,2);
 	    Reclusterer1 = Recluster(Jet1, 0, fSubJetRadius, fSubJetMinPt, fSubJetAlgorithm, "SubJetFinder_1");
 	    fShapesVar[14]=SubJetFraction(Jet1, Reclusterer1, 1, 0, kTRUE, kFALSE);
 	    fShapesVar[16]=SubJetFraction(Jet1, Reclusterer1, 2, 0, kTRUE, kFALSE);
-	    }*/
+	  }
 	  if (JetsMatched){ //even needed? Not now but might be if you want to fill trees when jets aren't matched too
 	    fShapesVar[1]=Jet4->Pt();
 	    fShapesVar[3]=fjNSubJettiness(Jet4,3,1,0,1,0);
@@ -758,12 +758,12 @@
 	    fShapesVar[7]=fjNSubJettiness(Jet4,3,3,0,1,0);
 	    fShapesVar[9]=fjNSubJettiness(Jet4,3,2,0,1,1);
 	    fShapesVar[11]=Jet4->GetNumberOfTracks();
-	    /*  if (fFullTree){
+	    if (fFullTree){
 	      fShapesVar[13]=fjNSubJettiness(Jet4,3,2,0,1,2);
 	      Reclusterer4=Recluster(Jet4, 3, fSubJetRadius, 0, fSubJetAlgorithm, "SubJetFinder_4");
 	      fShapesVar[15]=SubJetFraction(Jet4, Reclusterer4, 1, 0, kTRUE, kFALSE);
 	      fShapesVar[17]=SubJetFraction(Jet4, Reclusterer4, 2, 0, kTRUE, kFALSE);
-	      } */
+	    }
 	  }
 	  else{
 	    fShapesVar[1]=-2;
@@ -772,11 +772,11 @@
 	    fShapesVar[7]=-2;
 	    fShapesVar[9]=-2;
 	    fShapesVar[11]=-2;
-	    /*  if (fFullTree){
+	    if (fFullTree){
 	      fShapesVar[13]=-2;
 	      fShapesVar[15]=-2;
 	      fShapesVar[17]=-2;
-	      }*/
+	    }
 	  }
 	  fTreeResponseMatrixAxis->Fill();
 	  JetsMatched=kFALSE;
@@ -871,11 +871,11 @@
 	  fShapesVar[8]=fjNSubJettiness(Jet1,0,2,0,1,1);
 	  fShapesVar[10]=Jet1->GetNumberOfTracks();
 	  Reclusterer1 = Recluster(Jet1, 0, fSubJetRadius, fSubJetMinPt, fSubJetAlgorithm, "SubJetFinder_1");
-	  /*  if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[12]=fjNSubJettiness(Jet1,0,2,0,1,2);
 	    fShapesVar[14]=SubJetFraction(Jet1, Reclusterer1, 1, 0, kTRUE, kFALSE);
 	    fShapesVar[16]=SubJetFraction(Jet1, Reclusterer1, 2, 0, kTRUE, kFALSE);
-	    }*/
+	  }
 	  if (JetsMatched){ //even needed? Not now but might be if you want to fill trees when jets aren't matched too
 	    fShapesVar[1]=Jet2->Pt();
 	    fShapesVar[3]=fjNSubJettiness(Jet2,1,1,0,1,0);
@@ -884,11 +884,11 @@
 	    fShapesVar[9]=fjNSubJettiness(Jet2,1,2,0,1,1);
 	    fShapesVar[11]=Jet2->GetNumberOfTracks();
 	    Reclusterer2 = Recluster(Jet2, 1, fSubJetRadius, 0, fSubJetAlgorithm, "SubJetFinder_2");
-	    /* if (fFullTree){
+	    if (fFullTree){
 	      fShapesVar[13]=fjNSubJettiness(Jet2,1,2,0,1,2);
 	      fShapesVar[15]=SubJetFraction(Jet2, Reclusterer2, 1, 0, kTRUE, kFALSE);
 	      fShapesVar[17]=SubJetFraction(Jet2, Reclusterer2, 2, 0, kTRUE, kFALSE);
-	      } */
+	    }
 	  }
 	  else{
 	    fShapesVar[1]=-2;
@@ -897,11 +897,11 @@
 	    fShapesVar[7]=-2;
 	    fShapesVar[9]=-2;
 	    fShapesVar[11]=-2;
-	    /*  if (fFullTree){
+	    if (fFullTree){
 	      fShapesVar[13]=-2;
 	      fShapesVar[15]=-2;
 	      fShapesVar[17]=-2;
-	      }*/
+	    }
 	  }
 	  fTreeResponseMatrixAxis->Fill();

@@ -988,22 +988,22 @@
 	  fShapesVar[8]=fjNSubJettiness(Jet1,0,2,0,1,1);
 	  fShapesVar[10]=Jet1->GetNumberOfTracks();
 	  AliEmcalJetFinder *Reclusterer1 = Recluster(Jet1, 0, fSubJetRadius, fSubJetMinPt, fSubJetAlgorithm, "SubJetFinder");
-	  /* if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[12]=fjNSubJettiness(Jet1,0,2,0,1,2);
 	    fShapesVar[14]=SubJetFraction(Jet1, Reclusterer1, 1, 0, kTRUE, kFALSE);
 	    fShapesVar[16]=SubJetFraction(Jet1, Reclusterer1, 2, 0, kTRUE, kFALSE);
-	    }*/
+	  }
 	  fShapesVar[1]=-2;
 	  fShapesVar[3]=-2;
 	  fShapesVar[5]=-2;
 	  fShapesVar[7]=-2;
 	  fShapesVar[9]=-2;
 	  fShapesVar[11]=-2;
-	  /* if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[13]=-2;
 	    fShapesVar[15]=-2;
 	    fShapesVar[17]=-2;
-	    }*/
+	  }
 	  fTreeResponseMatrixAxis->Fill();
 	  fhSubJetCounter->Fill(Reclusterer1->GetNumberOfJets());
 	  for (Int_t i= 0; i<Reclusterer1->GetNumberOfJets(); i++){
@@ -1126,22 +1126,22 @@
 	  fShapesVar[8]=fjNSubJettiness(Jet1,0,2,0,1,1);
 	  fShapesVar[10]=Jet1->GetNumberOfTracks();
 	  AliEmcalJetFinder *Reclusterer1 = Recluster(Jet1, 0, fSubJetRadius, fSubJetMinPt, fSubJetAlgorithm, "SubJetFinder");
-	  /* if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[12]=fjNSubJettiness(Jet1,0,2,0,1,2);
 	    fShapesVar[14]=SubJetFraction(Jet1, Reclusterer1, 1, 0, kTRUE, kFALSE);
 	    fShapesVar[16]=SubJetFraction(Jet1, Reclusterer1, 2, 0, kTRUE, kFALSE);
-	    }*/
+	  }
 	  fShapesVar[1]=-2;
 	  fShapesVar[3]=-2;
 	  fShapesVar[5]=-2;
 	  fShapesVar[7]=-2;
 	  fShapesVar[9]=-2;
 	  fShapesVar[11]=-2;
-	  /* if (fFullTree){
+	  if (fFullTree){
 	    fShapesVar[13]=-2;
 	    fShapesVar[15]=-2;
 	    fShapesVar[17]=-2;
-	    }*/
+	  }
 	  fTreeResponseMatrixAxis->Fill();

 	  fhSubJetCounter->Fill(Reclusterer1->GetNumberOfJets());


typo fix

typo fix

--- code/gaining.cc
+++ code/gaining.cc
@@ -568,8 +568,8 @@
 	  gm->doSay("the dead and can help you in your quest.");
 	  gm->doSay("You may of course wait until a time that you feel more confident in your");
           gm->doSay("powers as a practitioner, however it is to your advantage to seek a more");
-          gm->doSay("higher power with the aid of Gondolfo.");
-	  gm->doSay("It is believed that Gondolfo lives in a small hut in Brazzed-Dum.");
+          gm->doSay("higher power with the aid of Gandolfo.");
+	  gm->doSay("It is believed that Gandolfo lives in a small hut in Brazzed-Dum.");
 	  gm->doSay("I wish I knew more to help you.");
 	}
 	setQuestBit(TOG_TOTEM_MASK_ELIGABLE);


(unstable) [fixed] Fixed an instance of players looting while dead - Mantis 3652

git-svn-id: e4cf3396f21da4a5d638eecf7e3b4dd52b27f938@6389 c3d1530f-68f5-4bd0-87dc-8ef779617e40

--- MMOCoreORB/src/server/zone/managers/player/PlayerManagerImplementation.cpp
+++ MMOCoreORB/src/server/zone/managers/player/PlayerManagerImplementation.cpp
@@ -2615,7 +2615,7 @@
 void PlayerManagerImplementation::lootAll(CreatureObject* player, CreatureObject* ai) {
 	Locker locker(ai, player);

-	if (!ai->isDead())
+	if (!ai->isDead() || player->isDead())
 		return;

 	if (ai->getDistanceTo(player) > 6) {


updated to new openni methods

updated to new openni methods

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@2447 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- io/src/openni_camera/openni_device_oni.cpp
+++ io/src/openni_camera/openni_device_oni.cpp
@@ -54,9 +54,19 @@
   , ir_stream_running_ (false)
 {
   XnStatus status;
+#if (XN_MINOR_VERSION >= 3)
+  status = context_.OpenFileRecording(file_name.c_str(), player_);
+  if (status != XN_STATUS_OK)
+    THROW_OPENNI_EXCEPTION("Could not open ONI file. Reason: %s", xnGetStatusString(status));
+#else
   status = context_.OpenFileRecording(file_name.c_str());
   if (status != XN_STATUS_OK)
     THROW_OPENNI_EXCEPTION("Could not open ONI file. Reason: %s", xnGetStatusString(status));
+
+  status = context.FindExistingNode(XN_NODE_TYPE_PLAYER, player_);
+  if (status != XN_STATUS_OK)
+    THROW_OPENNI_EXCEPTION("Failed to find player node: %s\n", xnGetStatusString(status));
+#endif

   status = context.FindExistingNode(XN_NODE_TYPE_DEPTH, depth_generator_);
   if (status != XN_STATUS_OK)
@@ -78,10 +88,6 @@
   if (status == XN_STATUS_OK)
     ir_generator_.RegisterToNewDataAvailable ((xn::StateChangedHandler)NewONIIRDataAvailable, this, ir_callback_handle_);

-  status = context.FindExistingNode(XN_NODE_TYPE_PLAYER, player_);
-  if (status != XN_STATUS_OK)
-    THROW_OPENNI_EXCEPTION("Failed to find player node: %s\n", xnGetStatusString(status));
-
   device_node_info_ = player_.GetInfo();

   Init ();


Core: remove test printing.

Core: remove test printing.

--- core/src/bbdo/acceptor.cc
+++ core/src/bbdo/acceptor.cc
@@ -401,8 +401,6 @@
       misc::shared_ptr<multiplexing::subscriber> sbcr(
         new multiplexing::subscriber(_name));
       sbcr->set_filters(_filter);
-      logging::error(logging::high)
-        << "TEST: setting multiplexing filter for " <<_filter.size();
       in = sbcr;
       my_bbdo = misc::shared_ptr<bbdo::stream>(
                         new bbdo::stream(false, true));


Future -> Futur

Future -> Futur

--- code/graphe.cpp
+++ code/graphe.cpp
@@ -149,7 +149,7 @@
 	cout << " - Longitude: " << leNoeud.longitude << endl;
 	cout << " - Nom: " << leNoeud.nom << endl;
 	for(int i = 0; i < 4; ++i) {
-		cout << " -> Future[" << i << "]: " << leNoeud.futur[i] << endl;
+		cout << " -> Futur[" << i << "]: " << leNoeud.futur[i] << endl;
 	}
 	cout << " - Nombre d'arcs: " << leNoeud.nbArcs << endl;
 	for(map<uint32_t, float>::iterator it = leNoeud.liens.begin(); it != leNoeud.liens.end(); ++it) {


BackBufferMaker - LoadShader 변경으로 인한 코드 수정 #68

--- SOCEngine/SOCEngine/Rendering/RenderManager/BackBufferMaker.cpp
+++ SOCEngine/SOCEngine/Rendering/RenderManager/BackBufferMaker.cpp
@@ -31,7 +31,7 @@
 	Manager::ShaderManager* shaderMgr = resourceManager->GetShaderManager();

 	Factory::EngineFactory shaderLoader(shaderMgr);
-	shaderLoader.LoadShader("BackBufferMaker", "VS", "PS", nullptr, nullptr, &_vertexShader, &_pixelShader);
+	shaderLoader.LoadShader("BackBufferMaker", "VS", "PS", nullptr, &_vertexShader, &_pixelShader);
 	ASSERT_COND_MSG(_vertexShader && _pixelShader, "Error, Cant load BackBufferMaker shader files");

 	const Size<uint>& winSize = GlobalDeviceDirectorGetScreenSize;
@@ -134,7 +134,6 @@
 		meshCreateArgs.index.byteWidth	= 0; //not use

 		meshCreateArgs.isDynamic		= false;
-		meshCreateArgs.bufferFlag		= (uint)Mesh::MeshFilter::BufferElement::UV;

 		_meshFilter = new MeshFilter;
 		_meshFilter->CreateBuffer(meshCreateArgs);


Bug #14448: delimiter in 'prompt'

Bug #14448: delimiter in 'prompt'

"I want to have the current delimiter in the prompt so that I can know at
a glance which is set."

Add a 'l' format specifier that represents the current statement delimiter.

--- client/mysql.cc
+++ client/mysql.cc
@@ -3724,6 +3724,9 @@
       case 't':
 	processed_prompt.append('\t');
 	break;
+      case 'l':
+	processed_prompt.append(delimiter_str);
+	break;
       default:
 	processed_prompt.append(c);
       }


Changed kampmidid and iampmidid to polymorphic ampmidid.i and ampmidid.k.

--- Opcodes/ampmidid.cpp
+++ Opcodes/ampmidid.cpp
@@ -114,7 +114,7 @@
   PUBLIC int csoundModuleInit(CSOUND *csound)
   {
       int status = csound->AppendOpcode(csound,
-                                        (char*)"kampmidid",
+                                        (char*)"ampmidid.k",
                                         sizeof(KAMPMIDID),
                                         3,
                                         (char*)"k",
@@ -122,9 +122,8 @@
                                         (int(*)(CSOUND*,void*)) KAMPMIDID::init_,
                                         (int(*)(CSOUND*,void*)) KAMPMIDID::kontrol_,
                                         (int (*)(CSOUND*,void*)) 0);
-
       status |= csound->AppendOpcode(csound,
-                                     (char*)"iampmidid",
+                                     (char*)"ampmidid.i",
                                      sizeof(IAMPMIDID),
                                      1,
                                      (char*)"i",
@@ -132,6 +131,15 @@
                                      (int (*)(CSOUND*,void*)) IAMPMIDID::init_,
                                      (int (*)(CSOUND*,void*)) 0,
                                      (int (*)(CSOUND*,void*)) 0);
+      status |= csound->AppendOpcode(csound,
+                                        (char*)"ampmidid",
+                                        0xffff,
+                                        0,
+                                        0,
+                                        0,
+                                        0,
+                                        0,
+                                        0);
       return status;
   }


Cset exclude: tsmith@ramayana.hindu.god|ChangeSet|20071127191535|13686

This change isn't correct, and the correct one will be pulled in from another
repository.

--- client/mysql.cc
+++ client/mysql.cc
@@ -2155,8 +2155,7 @@
 {
   char		buff[200], time_buff[32], *pos;
   MYSQL_RES	*result;
-  ulong		timer;
-  ulong         warnings= 0;
+  ulong		timer, warnings;
   uint		error= 0;
   int           err= 0;


Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE
             IN A SQL STATEMENT

While processing each lines entered at the prompt,
mysql client appends a '\n' to all the lines except
for delimiter commands. However the same logic must
not apply if 'delimiter' is part of a string or a
comment, for which a '\n' should be added.

Fixed by adding appropriate checks.

Added a test case.

--- client/mysql.cc
+++ client/mysql.cc
@@ -2283,17 +2283,19 @@
   {
     uint length=(uint) (out-line);

-    if (!truncated &&
-        (length < 9 ||
-         my_strnncoll (charset_info,
-                       (uchar *)line, 9, (const uchar *) "delimiter", 9)))
+    if (!truncated && (length < 9 ||
+                       my_strnncoll (charset_info, (uchar *)line, 9,
+                                     (const uchar *) "delimiter", 9) ||
+                       (*in_string || *ml_comment)))
     {
       /*
         Don't add a new line in case there's a DELIMITER command to be
         added to the glob buffer (e.g. on processing a line like
         "<command>;DELIMITER <non-eof>") : similar to how a new line is
         not added in the case when the DELIMITER is the first command
-        entered with an empty glob buffer.
+        entered with an empty glob buffer. However, if the delimiter is
+        part of a string or a comment, the new line should be added. (e.g.
+        SELECT '\ndelimiter\n';\n)
       */
       *out++='\n';
       length++;


A fix (Bug #5432: Is this a leak in mysql console client?)

--- client/mysql.cc
+++ client/mysql.cc
@@ -2220,7 +2220,9 @@
     under our feet, for example if DROP DATABASE or RENAME DATABASE
     (latter one not yet available by the time the comment was written)
   */
-  current_db= 0; // Let's reset current_db, assume it's gone
+  /*  Let's reset current_db, assume it's gone */
+  my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+  current_db= 0;
   /*
     We don't care about in case of an error below because current_db
     was just set to 0.
@@ -2229,10 +2231,8 @@
       (res= mysql_use_result(&mysql)))
   {
     row= mysql_fetch_row(res);
-    if (row[0] &&
-        (!current_db || cmp_database(current_db, row[0])))
-    {
-      my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+    if (row[0])
+    {
       current_db= my_strdup(row[0], MYF(MY_WME));
     }
     (void) mysql_fetch_row(res);               // Read eof


fix the performance for preserving normals and edge smoothing

--- OutputGeometryPart.C
+++ OutputGeometryPart.C
@@ -1601,6 +1601,8 @@
                 vertexLockedNormal = &lockedNormal;
             }

+	    MIntArray edgeIds;
+	    MIntArray edgeSmoothing;
             size_t polygonVertexOffset = 0;
             for(MItMeshPolygon itMeshPolygon(meshDataObj);
                     !itMeshPolygon.isDone(); itMeshPolygon.next())
@@ -1629,14 +1631,15 @@
                                     || (*vertexLockedNormal)[polygonVertexIndex2]))
                       )
                     {
-                        CHECK_MSTATUS(meshFn.setEdgeSmoothing(
-                                    edges[i],
-                                    !intArray[polygonVertexIndex1]
-                                    ));
+			edgeIds.append(edges[i]);
+			edgeSmoothing.append( !intArray[polygonVertexIndex1]);
                     }
                 }
                 polygonVertexOffset += numVertices;
             }
+	    if(edgeIds.length() > 0) {
+	        CHECK_MSTATUS(meshFn.setEdgeSmoothings( edgeIds, edgeSmoothing));
+	    }
             assert(polygonVertexOffset == intArray.size());
         }
     }
@@ -1943,6 +1946,8 @@
             const MString alphaAttributeName
                 = Util::getAttrLayerName("Alpha", layerIndex);

+	    //fprintf(stderr, "layerIx %d color name %s alpha name %s\n",
+	    //	  layerIndex, cdAttributeName.asChar(), alphaAttributeName.asChar());
             HAPI_AttributeOwner colorOwner;
             if(!HAPI_FAIL(hapiGetAnyAttribute(
                             myNodeId, myPartId,
@@ -2201,6 +2206,7 @@
         MDataHandle &instanceHandle
         )
 {
+  // fprintf(stderr, "compute instancer\n");
     data.setClean(hasInstancerPlug);
     data.setClean(instancerPlug);

@@ -2236,6 +2242,7 @@
         const int &instanceCount = myPartInfo.instanceCount;

         std::vector<HAPI_Transform> transforms(instanceCount);
+
         CHECK_HAPI(HAPI_GetInstancerPartTransforms(
                     Util::theHAPISession.get(),
                     myNodeId, myPartId,
@@ -2244,6 +2251,36 @@
                     0, instanceCount
                     ));
         markAttributeUsed("P");
+
+#if 0
+	double *mat_array = new double[instanceCount * 16];
+	//std::vector<HAPI_Matrix> matrices(instanceCount);
+
+	 CHECK_HAPI(HAPI_GetInstancerPartMatrices(
+	 Util::theHAPISession.get(),
+	 myNodeId, myPartId,
+	 HAPI_SRT,
+	 //instanceCount ? &matrices.front() : NULL,
+	 instanceCount ? mat_array : NULL,
+	0, instanceCount
+	 ));
+	 fprintf(stderr, "instance count was%d\n", instanceCount);
+
+	 for(int ins = 0; ins<instanceCount; ins++) {
+	   fprintf(stderr, "instance: %d\n", (int) ins);
+		   fprintf(stderr,"%.10g, %.10g, %.10g, %.10g\n", mat_array[16*ins],
+			   mat_array[16*ins + 1],mat_array[16*ins + 2],mat_array[16*ins + 3]);
+		   fprintf(stderr,"%.10g, %.10g, %.10g, %.10g\n", mat_array[16*ins +4],
+			   mat_array[16*ins + 5],mat_array[16*ins + 6],mat_array[16*ins + 7]);
+		   fprintf(stderr,"%.10g, %.10g, %.10g, %.10g\n", mat_array[16*ins+8],
+			   mat_array[16*ins + 9],mat_array[16*ins + 10],mat_array[16*ins + 11]);
+		   fprintf(stderr,"%.10g, %.10g, %.10g, %.10g\n", mat_array[16*ins+13],
+			   mat_array[16*ins + 13],mat_array[16*ins + 14],mat_array[16*ins + 15]);
+		   fprintf(stderr,"%.10g, %.10g, %.10g, %.10g\n", matrices[ins].mat_array[0],
+			   matrices[ins].mat_array[1], matrices[ins].mat_array[2],
+			   matrices[ins].mat_array[3]);
+	 }
+#endif

         MVectorArray positions = instancerArrayDataFn.vectorArray("position");
         MVectorArray rotations = instancerArrayDataFn.vectorArray("rotation");


Fixed key mapping bug

Fixed key mapping bug

--- Dev/Cpp/Viewer/3rdParty/imgui_platform/imgui_impl_dx9.cpp
+++ Dev/Cpp/Viewer/3rdParty/imgui_platform/imgui_impl_dx9.cpp
@@ -199,29 +199,6 @@
     io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors;   // We can honor GetMouseCursor() values (optional)
     io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos;    // We can honor io.WantSetMousePos requests (optional, rarely used)

-    // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
-    io.KeyMap[ImGuiKey_Tab] = VK_TAB;
-    io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
-    io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
-    io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
-    io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
-    io.KeyMap[ImGuiKey_PageUp] = VK_PRIOR;
-    io.KeyMap[ImGuiKey_PageDown] = VK_NEXT;
-    io.KeyMap[ImGuiKey_Home] = VK_HOME;
-    io.KeyMap[ImGuiKey_End] = VK_END;
-    io.KeyMap[ImGuiKey_Insert] = VK_INSERT;
-    io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
-    io.KeyMap[ImGuiKey_Backspace] = VK_BACK;
-    io.KeyMap[ImGuiKey_Space] = VK_SPACE;
-    io.KeyMap[ImGuiKey_Enter] = VK_RETURN;
-    io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;
-    io.KeyMap[ImGuiKey_A] = 'A';
-    io.KeyMap[ImGuiKey_C] = 'C';
-    io.KeyMap[ImGuiKey_V] = 'V';
-    io.KeyMap[ImGuiKey_X] = 'X';
-    io.KeyMap[ImGuiKey_Y] = 'Y';
-    io.KeyMap[ImGuiKey_Z] = 'Z';
-
     io.ImeWindowHandle = g_hWnd;

     return true;


More informative line length exception messages.

--- libsgp4/Tle.cpp
+++ libsgp4/Tle.cpp
@@ -70,12 +70,15 @@
 {
     if (!IsValidLineLength(line_one_))
     {
-        throw TleException("Invalid length for line one");
+        std::string err = "Invalid length for line one:\n" + line_one_ + "\n";
+        throw TleException(err.c_str());
     }

     if (!IsValidLineLength(line_two_))
     {
-        throw TleException("Invalid length for line two");
+        std::string err = "Invalid length for line two:\n" + line_two_ + "\n";
+
+        throw TleException(err.c_str());
     }

     if (line_one_[0] != '1')


Removing useless mysql_field_seek

Removing useless mysql_field_seek

--- client/mysql.cc
+++ client/mysql.cc
@@ -2228,7 +2228,7 @@

   /* Bail out when no warnings */
   my_ulonglong num_rows = mysql_num_rows(result);
-  if( num_rows == 0 )
+  if (num_rows == 0)
   {
     mysql_free_result(result);
     return;
@@ -2237,7 +2237,6 @@
   /* Print the warnings */
   while ((cur= mysql_fetch_row(result)))
   {
-    mysql_field_seek(result, 0);
     tee_fprintf(PAGER, "%s (Code %s): %s\n", cur[0], cur[1], cur[2]);
   }
   mysql_free_result(result);


Update init.cpp

Update init.cpp

--- tests/init.cpp
+++ tests/init.cpp
@@ -73,7 +73,7 @@
 		system("pause");
 	}

-	for (size_t i = 0; i < 100; i++) {
+	for (size_t i = 0; i < 1000; i++) {
 		size_t person1_i = rand() % n_persons;
 		size_t person2_i = person1_i + rand() % (n_persons - person1_i);
 		person person1 = readPerson(output_file_name, person1_i);


Prevent compiler error for fog of war actors in non-editor builds.


Update init.cpp

Update init.cpp

--- tests/init.cpp
+++ tests/init.cpp
@@ -1,6 +1,5 @@
-#include <stack.hpp>
+#include "stack.hpp"
 #include <catch.hpp>
-#include <thread>
 #include <iostream>
 using namespace std;

@@ -14,21 +13,27 @@
   stack<int> s;
   s.push(1);
   REQUIRE(s.count()==1);
+  REQUIRE(s.top()==1);
 }

 SCENARIO("pop", "[pop]"){
   stack<int> s;
-  s.push(1);
-  REQUIRE(s.top()==1);
+  s.push(1); s.pop();
   REQUIRE(s.count()==0);
 }

-SCENARIO("prisv", "[prisv]"){
+SCENARIO("cop", "[cop]"){
   stack<int> s;
   s.push(1);
-  stack<int> s2;
-  s2=s;
+  stack<int> s2=s;
   REQUIRE(s.count()==1);
+  REQUIRE(s.top()==1);
+}
+
+SCENARIO("top", "[top]"){
+  stack<int> s;
+  s.push(1);
+  REQUIRE(s.top()==1);
 }

 SCENARIO("empty", "[empty]"){
@@ -37,16 +42,5 @@
   REQUIRE(!s1.empty());
   REQUIRE(s2.empty());
 }
-SCENARIO("Stack: top and pop threads", "threads") {
-	stack<size_t> st;
-	st.push(0);
-	std::thread t1(&stack<size_t>::push, &st, 1);
-	t1.join();
-	REQUIRE(st.count() == 2);
-	REQUIRE(st.top() == 1);
-	REQUIRE(st.empty() == false);
-	std::thread t2(&stack<size_t>::pop, &st);
-	t2.join();
-	REQUIRE(st.count() == 0);
-	REQUIRE(st.empty());
-}
+
+