[examples.elliptic.cg] update

[examples.elliptic.cg] update

--- examples/elliptic/continuousgalerkin.cc
+++ examples/elliptic/continuousgalerkin.cc
@@ -59,32 +59,26 @@
     std::ofstream file;
     file.open(filename);
     file << "[stuff.grid.provider.cube]" << std::endl;
-    file << "level = 4" << std::endl;
+    file << "numElements = 4" << std::endl;
     file << "filename = " << id << ".grid" << std::endl;
     file << "[diffusion]" << std::endl;
     file << "order = 0"  << std::endl;
     file << "variable = x" << std::endl;
-    file << "expression.0 = 1.0"  << std::endl;
-    file << "expression.1 = 1.0"  << std::endl;
-    file << "expression.2 = 1.0"  << std::endl;
+    file << "expression = [1.0; 1.0; 1.0]" << std::endl;
     file << "[force]" << std::endl;
     file << "order = 0"  << std::endl;
     file << "variable = x" << std::endl;
-    file << "expression.0 = 1.0"  << std::endl;
-    file << "expression.1 = 1.0"  << std::endl;
-    file << "expression.2 = 1.0"  << std::endl;
+    file << "expression = [1.0; 1.0; 1.0]" << std::endl;
     file << "[dirichlet]" << std::endl;
     file << "order = 0"  << std::endl;
     file << "variable = x" << std::endl;
-    file << "expression.0 = 0.0"  << std::endl;
-    file << "expression.1 = 0.0"  << std::endl;
-    file << "expression.2 = 0.0"  << std::endl;
+    file << "expression = [0.0; 0.0; 0.0]" << std::endl;
     file << "[solver]" << std::endl;
     file << "maxIter = 5000"  << std::endl;
     file << "precision = 1e-12"  << std::endl;
     file << "[visualization]" << std::endl;
-    file << "filename = " << id << ".solution"  << std::endl;
-    file << "name = solution"  << std::endl;
+    file << "filename = " << id << ".solution" << std::endl;
+    file << "name = solution" << std::endl;
     file.close();
   } // only write param file if there is none
 } // void ensureParamFile()
@@ -111,7 +105,7 @@

     // grid
     std::cout << "setting up grid:" << std::endl;
-    typedef Dune::Stuff::Grid::Provider::UnitCube<> GridProviderType;
+    typedef Dune::Stuff::Grid::Provider::Cube<> GridProviderType;
     paramTree.assertSub(GridProviderType::id(), id);
     const GridProviderType gridProvider(paramTree.sub(GridProviderType::id()));
     typedef GridProviderType::GridType GridType;


Edit docstring of ParameterizedOpconverterTest

--- tensorflow/compiler/tf2tensorrt/convert/convert_nodes_test.cc
+++ tensorflow/compiler/tf2tensorrt/convert/convert_nodes_test.cc
@@ -1664,10 +1664,12 @@
   return os;
 }

-// Parameterized version of OpConverterTest. Parameters are:
-// 1. TrtTestMode (implicit batch / explicit batch / dynamic shape)
-// 2. DataType of the input TF tensors
-// 3. TrtPrecisionMode argument for the Converter (FP32, FP16, INT8)
+// Parameterized version of OpConverterTest. This class will be instantiated
+// to test all the TrtTestModes but only in FP32 precision. This means that we
+// will use the following combinations of test parameters:
+// 1. TrtTestMode: implicit batch, explicit batch, dynamic shape modes
+// 2. DataType of the input TF tensors: DT_FLOAT
+// 3. TrtPrecisionMode argument for the Converter: FP32
 class ParameterizedOpConverterTest
     : public OpConverterTest,
       public ::testing::WithParamInterface<


Fix `Experimental clang-format Check`

Fix `Experimental clang-format Check`

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

--- tensorflow/core/kernels/sparse_dense_binary_op_shared.cc
+++ tensorflow/core/kernels/sparse_dense_binary_op_shared.cc
@@ -88,7 +88,8 @@
     const auto rhs_dims = BCast::FromShape(dense_t->shape());
     BCast b(lhs_dims, rhs_dims, false);  // false for keeping the same num dims.

-    // True iff (size(lhs) >= size(rhs)) and all dims in lhs is smaller or equal to dims in rhs (from right to left).
+    // True iff (size(lhs) >= size(rhs)) and all dims in lhs is smaller or equal
+    // to dims in rhs (from right to left).
     auto VecGreaterEq = [](ArraySlice<int64> lhs, ArraySlice<int64> rhs) {
       if (lhs.size() < rhs.size()) return false;
       for (size_t i = 0; i < rhs.size(); ++i) {


Minor refactoring: unify lazy function compilation for in loop and no in loop variants.

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

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

--- src/handles.cc
+++ src/handles.cc
@@ -834,14 +834,16 @@
 }

-bool CompileLazy(Handle<JSFunction> function,
-                 ClearExceptionFlag flag) {
+static bool CompileLazyFunction(Handle<JSFunction> function,
+                                ClearExceptionFlag flag,
+                                InLoopFlag in_loop_flag) {
   bool result = true;
   if (function->shared()->is_compiled()) {
     function->ReplaceCode(function->shared()->code());
     function->shared()->set_code_age(0);
   } else {
     CompilationInfo info(function);
+    if (in_loop_flag == IN_LOOP) info.MarkAsInLoop();
     result = CompileLazyHelper(&info, flag);
     ASSERT(!result || function->is_compiled());
   }
@@ -852,22 +854,15 @@
 }

+bool CompileLazy(Handle<JSFunction> function,
+                 ClearExceptionFlag flag) {
+  return CompileLazyFunction(function, flag, NOT_IN_LOOP);
+}
+
+
 bool CompileLazyInLoop(Handle<JSFunction> function,
                        ClearExceptionFlag flag) {
-  bool result = true;
-  if (function->shared()->is_compiled()) {
-    function->ReplaceCode(function->shared()->code());
-    function->shared()->set_code_age(0);
-  } else {
-    CompilationInfo info(function);
-    info.MarkAsInLoop();
-    result = CompileLazyHelper(&info, flag);
-    ASSERT(!result || function->is_compiled());
-  }
-  if (result && function->is_compiled()) {
-    PROFILE(FunctionCreateEvent(*function));
-  }
-  return result;
+  return CompileLazyFunction(function, flag, IN_LOOP);
 }


Fix coordinate system

Fix coordinate system

--- src/kinect_tomato_searcher/src/kinect_tomato_searcher_node.cpp
+++ src/kinect_tomato_searcher/src/kinect_tomato_searcher_node.cpp
@@ -186,7 +186,7 @@
         if (512 < depth && depth <  close_depth) {
           tomato_point.x = depth; // for ros coordinate system
           tomato_point.y = x - maskedDepth.cols / 2; // for ros coordinate system
-          tomato_point.z = -y + maskedDepth.rows / 2; // for ros coordinate system
+          tomato_point.z = -(y - maskedDepth.rows / 2); // for ros coordinate system
           close_depth = depth;
         }
       }
@@ -260,7 +260,7 @@

     if (stObj.searchTomato(depth_ptr->image, pub_msg)) {
       pub_msg.y = pub_msg.x * tan(angle_x_per_piccell_ * pub_msg.y) / 1000.0; // convert to m
-      pub_msg.z = pub_msg.x * tan(angle_y_per_piccell_ * (height_ + pub_msg.z)) / 1000.0; // convert to m
+      pub_msg.z = pub_msg.x * tan(angle_y_per_piccell_ * pub_msg.z) / 1000.0; // convert to m
       pub_msg.x = pub_msg.x / 1000.0; // convert to m
       geometry_msgs::PointStamped stamped_msg; // FIXME: rename to pub_msg
       stamped_msg.header.stamp = ros::Time::now();


add kwallet5 support

add kwallet5 support

--- keychain_unix.cpp
+++ keychain_unix.cpp
@@ -115,6 +115,22 @@
     return backend;
 }

+static void kwalletReadPasswordScheduledStartImpl(const char * service, const char * path, ReadPasswordJobPrivate * priv) {
+    if ( QDBusConnection::sessionBus().isConnected() )
+    {
+        priv->iface = new org::kde::KWallet( QLatin1String(service), QLatin1String(path), QDBusConnection::sessionBus(), priv );
+        const QDBusPendingReply<QString> reply = priv->iface->networkWallet();
+        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, priv );
+        priv->connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), priv, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
+    }
+    else
+    {
+    // D-Bus is not reachable so none can tell us something about KWalletd
+        QDBusError err( QDBusError::NoServer, priv->tr("D-Bus is not running") );
+        priv->fallbackOnError( err );
+    }
+}
+
 void ReadPasswordJobPrivate::scheduledStart() {
     switch ( getKeyringBackend() ) {
     case Backend_GnomeKeyring:
@@ -125,21 +141,10 @@
         break;

     case Backend_Kwallet4:
-        if ( QDBusConnection::sessionBus().isConnected() )
-        {
-            iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this );
-            const QDBusPendingReply<QString> reply = iface->networkWallet();
-            QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this );
-            connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
-        }
-        else
-        {
-        // D-Bus is not reachable so none can tell us something about KWalletd
-            QDBusError err( QDBusError::NoServer, tr("D-Bus is not running") );
-            fallbackOnError( err );
-        }
+        kwalletReadPasswordScheduledStartImpl("org.kde.kwalletd", "/modules/kwalletd", this);
         break;
     case Backend_Kwallet5:
+        kwalletReadPasswordScheduledStartImpl("org.kde.kwalletd5", "/modules/kwalletd5", this);
         break;
     }
 }
@@ -333,6 +338,22 @@
     q->emitFinished();
 }

+static void kwalletWritePasswordScheduledStart( const char * service, const char * path, WritePasswordJobPrivate * priv ) {
+    if ( QDBusConnection::sessionBus().isConnected() )
+    {
+        priv->iface = new org::kde::KWallet( QLatin1String(service), QLatin1String(path), QDBusConnection::sessionBus(), priv );
+        const QDBusPendingReply<QString> reply = priv->iface->networkWallet();
+        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, priv );
+        priv->connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), priv, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
+    }
+    else
+    {
+        // D-Bus is not reachable so none can tell us something about KWalletd
+        QDBusError err( QDBusError::NoServer, priv->tr("D-Bus is not running") );
+        priv->fallbackOnError( err );
+    }
+}
+
 void WritePasswordJobPrivate::scheduledStart() {
     switch ( getKeyringBackend() ) {
     case Backend_GnomeKeyring:
@@ -353,21 +374,10 @@
         break;

     case Backend_Kwallet4:
-        if ( QDBusConnection::sessionBus().isConnected() )
-        {
-            iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this );
-            const QDBusPendingReply<QString> reply = iface->networkWallet();
-            QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this );
-            connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
-        }
-        else
-        {
-            // D-Bus is not reachable so none can tell us something about KWalletd
-            QDBusError err( QDBusError::NoServer, tr("D-Bus is not running") );
-            fallbackOnError( err );
-        }
+        kwalletWritePasswordScheduledStart("org.kde.kwalletd", "/modules/kwalletd", this);
         break;
     case Backend_Kwallet5:
+        kwalletWritePasswordScheduledStart("org.kde.kwalletd5", "/modules/kwalletd5", this);
         break;
     }
 }


Fix SLIDERCOL_LONGTEXT like in commit 2848880a144e0aa184 of jb

Signed-off-by: Rémi Duraffort <e682be5b764b21f7d0478e93569e40366c9e0d43@videolan.org>

--- modules/gui/qt4/qt4.cpp
+++ modules/gui/qt4/qt4.cpp
@@ -114,7 +114,7 @@
 #define SLIDERCOL_TEXT N_( "Define the colours of the volume slider " )
 #define SLIDERCOL_LONGTEXT N_( "Define the colours of the volume slider\n " \
                        "By specifying the 12 numbers separated by a ';'\n " \
-            "Default is '255;255;255;20;226;20;255;176;15,235;30;20'\n " \
+            "Default is '255;255;255;20;226;20;255;176;15;235;30;20'\n " \
             "An alternative can be '30;30;50;40;40;100;50;50;160;150;150;255' ")

 #define VIEWDETAIL_TEXT N_( "Show the opening dialog view in detail mode" )


Fix shutdown bug

Fix shutdown bug

--- YakServer/src/TableOpenHelper.cpp
+++ YakServer/src/TableOpenHelper.cpp
@@ -423,15 +423,13 @@
         //Create a temporary socket
         void* tempSocket = zmq_socket_new_connect(context, ZMQ_REQ, tableOpenEndpoint);
         if(unlikely(tempSocket == nullptr)) {
-            logger.error("Can't send STOP msg to table open server, because connection attempt failed: "
-                         + std::string(zmq_strerror(errno)));
+            logOperationError("trying to connect to table open server", logger);
             return;
         }
         //Send a stop server msg (signals the table open thread to stop)
         if(sendTableOperationRequest(tempSocket, TableOperationRequestType::StopServer) == -1) {
             logMessageSendError("table server stop message", logger);
         }
-        sendConstFrame("\x00", 1, tempSocket, logger, "Table open server STOP msg");
         //Receive the reply, ignore the data (--> thread has received msg and is terminating)
         receiveAndIgnoreFrame(tempSocket, logger, "Table open server STOP msg reply");
         //Wait for the thread to finish


lib: consider +/-inf in eq and gt

lib: consider +/-inf in eq and gt

--- lib/posit.cpp
+++ lib/posit.cpp
@@ -181,13 +181,13 @@

 bool Posit::eq(Posit& p)
 {
-    return mBits == p.mBits && !isInf();
+    return mBits == p.mBits;
 }

 bool Posit::gt(Posit& p)
 {
     if (isInf() || p.isInf()) {
-        // TODO throw exception
+        return false;
     }

     // use sign bit of the base type to perform comparison


Improve the sort implementation for the CPU backend.

We can use the same trick as on the other backends to cast the floating types
to integer types and then comparing these. This is faster.
Also use stable_sort instead of sort to simplify the custom comparators.

PiperOrigin-RevId: 222217591

--- tensorflow/compiler/xla/service/cpu/runtime_key_value_sort.cc
+++ tensorflow/compiler/xla/service/cpu/runtime_key_value_sort.cc
@@ -17,6 +17,7 @@
 #include <algorithm>
 #include <cmath>
 #include <cstring>
+#include <limits>
 #include <memory>
 #include <string>
 #include <utility>
@@ -41,61 +42,58 @@
   std::sort(row_to_sort, row_to_sort + num_elements);
 }

-// For floating point numbers, we want a total order comparator. -NaN and NaN
-// should appear at the beginning and end of the ordering, and -0.0 should
-// appear before 0.0. Also we want to have a stable sort, so if the keys are the
-// same, we compare the index values.
-template <typename KeyType>
-bool LessThan(KeyType lhs, int64 lhs_index, KeyType rhs, int64 rhs_index) {
-  bool lhs_is_negative = std::signbit(lhs);
-  bool rhs_is_negative = std::signbit(rhs);
-  // If the signs are different, we can just compare the signs.
-  if (lhs_is_negative != rhs_is_negative) {
-    return lhs_is_negative && !rhs_is_negative;
+// We would like a total order of floating point numbers so that the
+// sort has a predictable behavior in the presence of NaNs. Rather
+// than using floating point comparison, we use the following trick:
+// If f is a float, and
+// x = bit_cast<int32>(f);
+// y = x < 0 ? 0x7FFFFFFF - x : x;
+// then y is ordered as an int32 such that finite values have the
+// obvious order, -0 is ordered before 0, and -NaN and NaN appear at
+// the beginning and end of the ordering.
+template <typename CastType, typename KeyType>
+CastType Convert(KeyType value) {
+  CastType casted_value;
+  memcpy(&casted_value, &value, sizeof(CastType));
+  if (casted_value < 0) {
+    return std::numeric_limits<CastType>::max() - casted_value;
   }
-  bool lhs_nan = std::isnan(lhs);
-  bool rhs_nan = std::isnan(rhs);
-  // Exactly one number is nan?
-  if (lhs_nan != rhs_nan) {
-    if (lhs_nan) {
-      return lhs_is_negative;
-    }
-    return !rhs_is_negative;
-  }
-  if (lhs != rhs) {
-    return lhs < rhs;
-  }
-  return lhs_index < rhs_index;
+  return casted_value;
+}
+
+template <typename CastType, typename KeyType>
+bool LessThan(KeyType lhs, KeyType rhs) {
+  return Convert<CastType>(lhs) < Convert<CastType>(rhs);
 }

 template <>
 void KeyValueSort(std::pair<double, int64>* row_to_sort, int64 num_elements) {
-  std::sort(row_to_sort, row_to_sort + num_elements,
-            [](const std::pair<double, int64>& lhs,
-               const std::pair<double, int64>& rhs) -> bool {
-              return LessThan(lhs.first, lhs.second, rhs.first, rhs.second);
-            });
+  std::stable_sort(row_to_sort, row_to_sort + num_elements,
+                   [](const std::pair<double, int64>& lhs,
+                      const std::pair<double, int64>& rhs) -> bool {
+                     return LessThan<int64>(lhs.first, rhs.first);
+                   });
 }

 template <>
 void KeyValueSort(std::pair<float, int64>* row_to_sort, int64 num_elements) {
-  std::sort(row_to_sort, row_to_sort + num_elements,
-            [](const std::pair<float, int64>& lhs,
-               const std::pair<float, int64>& rhs) -> bool {
-              return LessThan(lhs.first, lhs.second, rhs.first, rhs.second);
-            });
+  std::stable_sort(row_to_sort, row_to_sort + num_elements,
+                   [](const std::pair<float, int64>& lhs,
+                      const std::pair<float, int64>& rhs) -> bool {
+                     return LessThan<int32>(lhs.first, rhs.first);
+                   });
 }

 template <>
 void KeyValueSort(std::pair<Eigen::half, int64>* row_to_sort,
                   int64 num_elements) {
-  std::sort(row_to_sort, row_to_sort + num_elements,
-            [](const std::pair<Eigen::half, int64>& lhs,
-               const std::pair<Eigen::half, int64>& rhs) -> bool {
-              return LessThan(
-                  Eigen::half_impl::half_to_float(lhs.first), lhs.second,
-                  Eigen::half_impl::half_to_float(rhs.first), rhs.second);
-            });
+  std::stable_sort(row_to_sort, row_to_sort + num_elements,
+                   [](const std::pair<Eigen::half, int64>& lhs,
+                      const std::pair<Eigen::half, int64>& rhs) -> bool {
+                     return LessThan<int32>(
+                         Eigen::half_impl::half_to_float(lhs.first),
+                         Eigen::half_impl::half_to_float(rhs.first));
+                   });
 }

 template <typename KeyType>


Added a TODO to phatbooks_database_connection.cpp.

git-svn-id: 0231d2b9506727b8389b50bfeac72ec1f38c13c1@870 ac3cbfda-f6ac-4daa-b570-d46c5f00fc98

--- phatbooks_database_connection/phatbooks_database_connection.cpp
+++ phatbooks_database_connection/phatbooks_database_connection.cpp
@@ -121,6 +121,10 @@
 	return statement.step();
 }

+// TODO This is clunky. The account type names should be stored in
+// memory from the outset, as part of the application code, and not
+// stored in the database at all. They should be dealt with in the
+// same way as IntervalType.
 bimap<Account::AccountType, string>
 PhatbooksDatabaseConnection::account_types()
 {


fix bug in data_size calculation for EXIF chunk

wouldn't normally show, since we always reserve() more than needed,
but better be exact!

--- src/headers.cc
+++ src/headers.cc
@@ -62,7 +62,7 @@
   const size_t kEXIF_len = 6;  // includes the \0's
   const size_t data_size = data.size() + kEXIF_len + 2;
   if (data_size > 0xffff) return false;
-  bw_.Reserve(data_size);
+  bw_.Reserve(data_size + 2);
   bw_.PutByte(0xff);
   bw_.PutByte(0xe1);
   bw_.PutByte((data_size >> 8) & 0xff);
@@ -118,7 +118,7 @@
 }

 void Encoder::WriteDQT() {
-  const int data_size = 2 * 65 + 2;
+  const size_t data_size = 2 * 65 + 2;
   const uint8_t kDQTHeader[] = { 0xff, 0xdb, 0x00, (uint8_t)data_size };
   bw_.Reserve(data_size + 2);
   bw_.PutBytes(kDQTHeader, sizeof(kDQTHeader));
@@ -136,7 +136,7 @@
 #define DATA_16b(X) ((uint8_t)((X) >> 8)), ((uint8_t)((X) & 0xff))

 void Encoder::WriteSOF() {   // SOF
-  const int data_size = 8 + 3 * nb_comps_;
+  const size_t data_size = 3 * nb_comps_ + 8;
   assert(data_size <= 255);
   const uint8_t kHeader[] = {
     0xff, 0xc0, DATA_16b(data_size),         // SOF0 marker, size
@@ -159,7 +159,7 @@
   for (int c = 0; c < nb_tables; ++c) {   // luma, chroma
     for (int type = 0; type <= 1; ++type) {               // dc, ac
       const HuffmanTable* const h = Huffman_tables_[type * 2 + c];
-      const int data_size = 3 + 16 + h->nb_syms_;
+      const size_t data_size = 3 + 16 + h->nb_syms_;
       assert(data_size <= 255);
       bw_.Reserve(data_size + 2);
       bw_.PutByte(0xff);
@@ -176,7 +176,7 @@
 ////////////////////////////////////////////////////////////////////////////////

 void Encoder::WriteSOS() {   // SOS
-  const int data_size = 6 + nb_comps_ * 2;
+  const size_t data_size = 3 + nb_comps_ * 2 + 3;
   assert(data_size <= 255);
   const uint8_t kHeader[] = {
       0xff, 0xda, DATA_16b(data_size), (uint8_t)nb_comps_


MOD player

MOD player

--- 8088/demo/mod/mod.cpp
+++ 8088/demo/mod/mod.cpp
@@ -30,8 +30,17 @@
     }
     fread((void*)mod, (UInt16)s, 1, in);
     fclose(in);
-    // TODO: Compute offset of start of samples
-    // TODO: Compute segment for player/sample data
+    UInt8 positions = mod[950];
+    UInt8 highestPosition = 0;
+    for (UInt8 position = 0; position < positions; ++position) {
+        UInt8 pattern = mod[952+position];
+        if (pattern > highestPosition)
+            highestPosition = pattern;
+    }
+    UInt8 samplesStart = 1084 + (highestPosition + 1)*1024;
+    UInt8 far* p = &samplesStart;
+    UInt16 ss = FP_SEG(p);
+    UInt16 playerSegment = ss + 0x1000;

 }


Switched verts to follow single ordering

--- cube-slime.cpp
+++ cube-slime.cpp
@@ -35,7 +35,7 @@
 #include <glm/gtx/norm.hpp>

 //light stuff
-float light_direction[4] = {0, -0.5, -0.7, 0.0};
+float light_direction[4] = {0, 0.5, 0.7, 0.0};
 //----------

 typedef glm::mat3 mat3;
@@ -86,6 +86,7 @@
 	vector<int> ids;
 	vector<vec3> cols;
 	vector<float> normals;
+	vector<int> ids_adj;
 } sCube;

 int fpartition = 20;
@@ -113,32 +114,59 @@
 	float sx = (to.x - from.x) / face_fpartition;
 	float sy = (to.y - from.y) / face_fpartition;
 	float sz = (to.z - from.z) / face_fpartition;
-
-	int cx = 127.0 / face_fpartition;
-
-	//indices
+
+	cout << from.z << endl;
+	cout << to.z << endl;
+
+	//indices normally follow CW-ordering
 	for (int oft, quad = 0; quad < face_fpartition * face_fpartition * 6 ; quad++) {
 		oft = quad * 4;
+
+		// cout << "fp^2 = " << face_fpartition * face_fpartition << endl;
+		// cout << "quad no. " << quad << endl;

-		c.ids.push_back (oft);
-		c.ids.push_back (oft+3);
-		c.ids.push_back (oft+2);
-
-		c.ids.push_back (oft);
-		c.ids.push_back (oft+2);
-		c.ids.push_back (oft+1);
+		if (quad / (face_fpartition * face_fpartition) % 2) {
+			// cout << "cw\n";
+			c.ids.push_back (oft);
+			c.ids.push_back (oft+1);
+			c.ids.push_back (oft+2);
+
+			c.ids.push_back (oft);
+			c.ids.push_back (oft+3);
+			c.ids.push_back (oft+1);
+
+		}
+		else {
+			// cout << "ccw\n";
+			c.ids.push_back (oft);
+			c.ids.push_back (oft+2);
+			c.ids.push_back (oft+1);
+
+			c.ids.push_back (oft);
+			c.ids.push_back (oft+1);
+			c.ids.push_back (oft+3);
+
+		}
+	}
+
+	//indices for adjacency
+	for (int oft, quad = 0; quad < face_fpartition * face_fpartition * 6 ; quad++) {
+		oft = quad * 4;
+
+		// c.ids_adj.push_back (oft);   // 1
+		// c.ids_adj.push_back (oft+2); // 3
+		// c.ids_adj.push_back (oft+1); // 5
 	}

 	//1 (front)
-
 	for (int px = 0; px < face_fpartition; px++)
 		for (int py = 0; py < face_fpartition; py++) {
-
-			c.verts.push_back(from.x + px * sx); c.verts.push_back(from.y + (py+1) * sy); c.verts.push_back(from.z); c.verts.push_back(1.0);
-			c.verts.push_back(from.x + px * sx); c.verts.push_back(from.y + py * sy);     c.verts.push_back(from.z); c.verts.push_back(1.0);
-			c.verts.push_back(from.x + (px+1) * sx); c.verts.push_back( from.y + py * sy);     c.verts.push_back(from.z); c.verts.push_back(1.0);
-			c.verts.push_back(from.x + (px+1) * sx); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z); c.verts.push_back(1.0);
-		}
+			c.verts.push_back( from.x + px * sx); c.verts.push_back(     from.y + (py+1) * sy); c.verts.push_back(from.z); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + (px+1) * sx); c.verts.push_back( from.y + py * sy);     c.verts.push_back(from.z); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + px * sx); c.verts.push_back(     from.y + py * sy);     c.verts.push_back(from.z); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + (px+1) * sx); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z); c.verts.push_back(1.0);
+		}
+

 	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
 		c.normals.push_back(0.0); c.normals.push_back(0.0); c.normals.push_back(-1.0); c.normals.push_back(0.0);
@@ -147,70 +175,68 @@
 	//4 (back)
 	for (int px = 0; px < face_fpartition; px++)
 		for (int py = 0; py < face_fpartition; py++) {
+			c.verts.push_back( from.x + px * sx); c.verts.push_back(     from.y + (py+1) * sy); c.verts.push_back(to.z); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + (px+1) * sx); c.verts.push_back( from.y + py * sy);     c.verts.push_back(to.z); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + px * sx); c.verts.push_back(     from.y + py * sy);     c.verts.push_back(to.z); c.verts.push_back(1.0);
-			c.verts.push_back( from.x + px * sx); c.verts.push_back(     from.y + (py+1) * sy); c.verts.push_back(to.z); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + (px+1) * sx); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(to.z); c.verts.push_back(1.0);
-			c.verts.push_back( from.x + (px+1) * sx); c.verts.push_back( from.y + py * sy);     c.verts.push_back(to.z); c.verts.push_back(1.0);
-
 		}

 	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
 		c.normals.push_back(0.0); c.normals.push_back(0.0); c.normals.push_back(1.0); c.normals.push_back(0.0);
 	}

-
+	// 6 (left)
+	for (int pz = 0; pz < face_fpartition; pz++)
+		for (int py = 0; py < face_fpartition; py++) {
+			c.verts.push_back( from.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
+			c.verts.push_back( from.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
+			c.verts.push_back( from.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
+			c.verts.push_back( from.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + (pz+1)* sz);  c.verts.push_back(1.0);
+		}
+
+	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
+		c.normals.push_back(-1.0); c.normals.push_back(0.0); c.normals.push_back(0.0); c.normals.push_back(0.0);
+	}
+
  	// 2 (right)
 	for (int pz = 0; pz < face_fpartition; pz++)
 		for (int py = 0; py < face_fpartition; py++) {
+			c.verts.push_back( to.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
+			c.verts.push_back( to.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 			c.verts.push_back( to.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
-			c.verts.push_back( to.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
 			c.verts.push_back( to.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
-			c.verts.push_back( to.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 		}

 	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
 		c.normals.push_back(1.0); c.normals.push_back(0.0); c.normals.push_back(0.0); c.normals.push_back(0.0);
 	}

-	// // 6 (left)
-	for (int pz = 0; pz < face_fpartition; pz++)
-		for (int py = 0; py < face_fpartition; py++) {
-			c.verts.push_back( from.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x); c.verts.push_back( from.y + py     * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x); c.verts.push_back( from.y + (py+1) * sy); c.verts.push_back(from.z + (pz+1)* sz);  c.verts.push_back(1.0);
-		}
-
-	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
-		c.normals.push_back(-1.0); c.normals.push_back(0.0); c.normals.push_back(0.0); c.normals.push_back(0.0);
-	}
-
+
 	// 5 (top)
 	for (int pz = 0; pz < face_fpartition; pz++)
 		for (int px = 0; px < face_fpartition; px++) {
 			c.verts.push_back( from.x + px*sx); c.verts.push_back(     to.y); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( to.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + px*sx); c.verts.push_back(     to.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( to.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( to.y); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
 		}

 	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
 		c.normals.push_back(0.0); c.normals.push_back(1.0); c.normals.push_back(0.0); c.normals.push_back(0.0);
 	}
-
-	// //3 (bottom)
+
+	//3 (bottom)
 	for (int pz = 0; pz < face_fpartition; pz++)
 		for (int px = 0; px < face_fpartition; px++) {
+			c.verts.push_back( from.x + px*sx); c.verts.push_back(     from.y); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
+			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( from.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + px*sx); c.verts.push_back(     from.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x + px*sx); c.verts.push_back(     from.y); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
 			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( from.y); c.verts.push_back(from.z + (pz+1)* sz); c.verts.push_back(1.0);
-			c.verts.push_back( from.x + (px+1)*sx); c.verts.push_back( from.y); c.verts.push_back(from.z + pz * sz); c.verts.push_back(1.0);
 		}

 	for (int vid = 0; vid < face_fpartition * face_fpartition * 4; vid++) {
 		c.normals.push_back(0.0); c.normals.push_back(-1.0); c.normals.push_back(0.0); c.normals.push_back(0.0);
 	}
-
 }

 void checkGlErrors( void )
@@ -267,7 +293,7 @@

 void initCube(void)
 {
-	generatePolyCubeVerts(vec3(-10,-10,-10), vec3(10,10,10), fpartition, sCube);
+	generatePolyCubeVerts(vec3(10,10,10), vec3(-10,-10,-10),  fpartition, sCube);
 	initVertexBuffer();

 	cout << "Going to render " << sCube.verts.size() / 3 << " polygons" << endl;
@@ -509,9 +535,6 @@
 	glUniform1f(dmod4un, dmod4);
 }

-void setShadowVolUniforms() {
-
-}

 /*
   General transform feedback path:
@@ -553,6 +576,11 @@
 	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cubeIndexBO);

 	setCubeTransformUniforms(t);
+}
+
+void setShadowVolUniformsData() {
+
+
 }


sel: Support OEM record 0xE0~0xFF

sel: Support OEM record 0xE0~0xFF

The OEM record 0xE0~0xFF only includes record type and 13 bytes OEM
data.

Tested: Add 0xFF OEM SEL and verify the sel list shows the expected
        record.

Signed-off-by: Lei YU <fc52a17c06c071ee7cd115c972235443e2107013@bytedance.com>
Change-Id: Ied3d68cf4393d37f8841ac66c6ca10c66393b7da

--- selutility.cpp
+++ selutility.cpp
@@ -22,6 +22,13 @@

 constexpr auto systemEventRecord = 0x02;

+constexpr auto propAdditionalData = "AdditionalData";
+constexpr auto strEventDir = "EVENT_DIR";
+constexpr auto strGenerateId = "GENERATOR_ID";
+constexpr auto strRecordType = "RECORD_TYPE";
+constexpr auto strSensorData = "SENSOR_DATA";
+constexpr auto strSensorPath = "SENSOR_PATH";
+
 } // namespace

 namespace ipmi
@@ -38,6 +45,7 @@
     return recordType != systemEventRecord;
 }

+using additionalDataMap = std::map<std::string, std::string>;
 /** Parse the entry with format like key=val */
 std::pair<std::string, std::string> parseEntry(const std::string& entry)
 {
@@ -49,8 +57,7 @@
     return {key, val};
 }

-std::map<std::string, std::string>
-    parseAdditionalData(const AdditionalData& data)
+additionalDataMap parseAdditionalData(const AdditionalData& data)
 {
     std::map<std::string, std::string> ret;

@@ -81,6 +88,33 @@
     return ret;
 }

+/** Construct OEM SEL record according to IPMI spec 32.2, 32.3. */
+void constructOEMSel(uint8_t recordType, std::chrono::milliseconds timestamp,
+                     const additionalDataMap& m, GetSELEntryResponse& record)
+{
+    auto dataIter = m.find(strSensorData);
+    assert(dataIter != m.end());
+    auto sensorData = convertVec(dataIter->second);
+    if (recordType >= 0xC0 && recordType < 0xE0)
+    {
+        record.event.oemCD.timeStamp = static_cast<uint32_t>(
+            std::chrono::duration_cast<std::chrono::seconds>(timestamp)
+                .count());
+        record.event.oemCD.recordType = recordType;
+        // The ManufactureID and OEM Defined are packed in the sensor data
+        // Fill the 9 bytes of Manufacture ID and oemDefined
+        memcpy(&record.event.oemCD.manufacturerID, sensorData.data(),
+               std::min(sensorData.size(), static_cast<size_t>(9)));
+    }
+    else if (recordType >= 0xE0)
+    {
+        record.event.oemEF.recordType = recordType;
+        // The remaining 13 bytes are the OEM Defined data
+        memcpy(&record.event.oemEF.oemDefined, sensorData.data(),
+               std::min(sensorData.size(), static_cast<size_t>(13)));
+    }
+}
+
 GetSELEntryResponse
     prepareSELEntry(const std::string& objPath,
                     ipmi::sensor::InvObjectIDMap::const_iterator iter)
@@ -130,12 +164,6 @@
         // It is expected to be a custom SEL entry
         record.event.oemCD.recordID =
             static_cast<uint16_t>(std::get<uint32_t>(iterId->second));
-        static constexpr auto propAdditionalData = "AdditionalData";
-        // static constexpr auto strEventDir = "EVENT_DIR";
-        // static constexpr auto strGenerateId = "GENERATOR_ID";
-        static constexpr auto strRecordType = "RECORD_TYPE";
-        static constexpr auto strSensorData = "SENSOR_DATA";
-        // static constexpr auto strSensorPath = "SENSOR_PATH";
         iterId = entryData.find(propAdditionalData);
         if (iterId == entryData.end())
         {
@@ -148,24 +176,7 @@
         auto isOEM = isRecordOEM(recordType);
         if (isOEM)
         {
-            if (recordType >= 0xC0 && recordType < 0xE0)
-            {
-                record.event.oemCD.timeStamp = static_cast<uint32_t>(
-                    std::chrono::duration_cast<std::chrono::seconds>(
-                        chronoTimeStamp)
-                        .count());
-                record.event.oemCD.recordType = recordType;
-                // The ManufactureID and OEM Defined are packed in the sensor
-                // data
-                auto sensorData = convertVec(m[strSensorData]);
-                // Fill the 9 bytes of Manufacture ID and oemDefined
-                memcpy(&record.event.oemCD.manufacturerID, sensorData.data(),
-                       std::min(sensorData.size(), static_cast<size_t>(9)));
-            }
-            else if (recordType >= 0xE0)
-            {
-                // TODO
-            }
+            constructOEMSel(recordType, chronoTimeStamp, m, record);
         }
         else
         {


remove all debug prints

remove all debug prints

--- ma/maExtrude.cc
+++ ma/maExtrude.cc
@@ -6,9 +6,6 @@
 #include <sstream>
 #include <cstdlib>

-//DEBUG
-#include <iostream>
-
 namespace ma {

 namespace {
@@ -27,14 +24,11 @@
 };

 Fields gatherExtrudedFields(Mesh* m) {
-  std::cerr << "gathering extruded fields...\n";
   Fields fields;
   fields.clear();
   for (int i = 0; i < m->countFields(); ++i) {
     apf::Field* f = m->getField(i);
-    std::cerr << "field " << apf::getName(f) << " exists\n";
     if (apf::getShape(f) == m->getShape()) {
-      std::cerr << "field " << apf::getName(f) << " accepted\n";
       fields.push_back(f);
     }
   }
@@ -104,11 +98,6 @@

 Crawler::Layer getBase(Mesh* m, ModelSet const& bottoms, int d)
 {
-  std::cerr << "bottoms:\n";
-  APF_CONST_ITERATE(ModelSet, bottoms, it) {
-    std::cerr << "(" << m->getModelType(*it) << ", "
-      << m->getModelTag(*it) << ")\n";
-  }
   Crawler::Layer base;
   Iterator* it = m->begin(d);
   Entity* e;
@@ -116,7 +105,6 @@
     if (bottoms.count(m->toModel(e)))
       base.push_back(e);
   m->end(it);
-  std::cerr << "bottom layer has " << base.size() << " verts\n";
   return base;
 }

@@ -131,7 +119,6 @@
     for (size_t i = 0; i < current_layer.size(); ++i) {
       m->setIntTag(current_layer[i], visited, 0);
     }
-    std::cerr << "crawling a layer...\n";
     for (size_t i = 0; i < current_layer.size(); ++i) {
       Entity* v = current_layer[i];
       Entity* ov = getOtherVert(m, v, pred);
@@ -202,8 +189,6 @@

 void applyFlatField(Mesh* m, std::string const& extruded_name,
     int ncomps, FieldData const& field_data) {
-  std::cerr << "flat field " << extruded_name << " will have "
-    << field_data.size() << " layers\n";
   for (size_t i = 0; i < field_data.size(); ++i) {
     std::string flat_name = getFlatName(extruded_name, i);
     apf::Field* flat_field = apf::createPackedField(
@@ -222,14 +207,12 @@

 void applyFlatFields(Mesh* m, Fields const& extruded_fields,
     AllFieldsData const& all_data) {
-  std::cerr << "applying flat fields...\n";
   for (size_t i = 0; i < extruded_fields.size(); ++i) {
     apf::Field* extruded_field = extruded_fields[i];
     std::string extruded_name = apf::getName(extruded_field);
     int ncomps = apf::countComponents(extruded_field);
     apf::destroyField(extruded_field);
     FieldData const& field_data = all_data.flat_data[i];
-    std::cerr << "applying flat field " << extruded_name << '\n';
     applyFlatField(m, extruded_name, ncomps, field_data);
   }
   applyFlatField(m, "z", 1, all_data.flat_z_data);
@@ -313,7 +296,6 @@

 FullLayer buildLayer(Mesh* m, FullLayer const& prev_layer,
     ModelExtrusions const& extrusions, bool is_last) {
-  std::cerr << "buildLayer (is_last = " << is_last << ")\n";
   Crawler::Layer const& prev_verts = prev_layer.ents[0];
   Tag* indices = m->createIntTag("index", 1);
   for (size_t i = 0; i < prev_verts.size(); ++i) {
@@ -321,7 +303,6 @@
     m->setIntTag(prev_verts[i], indices, &i_int);
   }
   FullLayer next_layer;
-  std::cerr << "extruding " << prev_verts.size() << " verts...\n";
   for (size_t i = 0; i < prev_verts.size(); ++i) {
     Entity* ev[2];
     ev[0] = prev_verts[i];
@@ -333,7 +314,6 @@
     m->createEntity(apf::Mesh::EDGE, local_class.middle, ev);
     next_layer.ents[0].push_back(ev[1]);
   }
-  std::cerr << "extruding " << prev_layer.ents[1].size() << " edges...\n";
   for (size_t i = 0; i < prev_layer.ents[1].size(); ++i) {
     Entity* pe = prev_layer.ents[1][i];
     assert(m->getType(pe) == apf::Mesh::EDGE);
@@ -353,7 +333,6 @@
     apf::buildElement(m, local_class.middle, apf::Mesh::QUAD, qv, &qcb);
     next_layer.ents[1].push_back(ne);
   }
-  std::cerr << "extruding " << prev_layer.ents[2].size() << " tris...\n";
   for (size_t i = 0; i < prev_layer.ents[2].size(); ++i) {
     Entity* pt = prev_layer.ents[2][i];
     ModelExtrusion local_class = getLocalClass(m, pt, extrusions, is_last);


Delete seqMachine.cpp

Delete seqMachine.cpp

--- seqMachine.cpp
+++ seqMachine.cpp
@@ -1,149 +0,0 @@
-#include "seqMachine.h"
-
-seqMachine::seqMachine()
-{
-    /*
-    num_iters_ = num_iters;
-    num_passes_ = num_passes;
-    budget_ = budget;
-    */
-}
-
-void seqMachine::construct_envs_items(vw*model, istream &fin)
-{
-    int id, numItems;
-    //   char str[100];
-    string str;
-    envs.clear();
-    int ct = 0;
-    while (!fin.eof())
-	{
-	    //assume each environment starts with id,numItems
-	    /*
-	    getline(fin, str, '\n');
-	    if (fin.eof())
-		break;
-	    sscanf(str.c_str(), "%d %d", &id, &numItems);
-	    cout << id <<" " << numItems <<endl;
-	    */
-	    environment env;
-	    cout << "read_from_stream for EnvId " << ct <<endl;
-	    env.read_from_stream(model, fin);
-
-	    //  env.read_from_stream(model, fin, numItems);
-	    envs.push_back(env);
-	    // cout << "numItems " << envs[ct].get_numItems() <<endl;
-	    ct++;
-	}
-}
-
-void seqMachine::scp_train(vw*model, submodOracle & fOracle, string fileName)
-{
-
-    //initialize with greedy on each environment
-    cout <<"start SCP_TRAIN by Greedy Coaching" <<endl;
-    vector<int> randIndex;
-    ifstream fin;
-    fin.open(fileName.c_str());
-    //    construct_envs_items(model, fin);
-    envs.clear();
-    int ct = 0;
-    while (!fin.eof())
-	{
-	    environment env;
-	    //  cout << "read_from_stream for EnvId " << ct <<endl;
-	    env.read_from_stream(model, fin);
-	    env.setBudget(budget_);
-	    env.setAlgoType(algo_);
-	    envs.push_back(env);
-	    //   cout << "numItems " << envs[ct].get_numItems() <<endl;
-	    //  envs[ct].multiRoundTrain(model, fOracle, true, num_passes_);
-	    ct++;
-	}
-    //test whether can back up one copy of all enviroments
-    randIndex = generate_random_index(envs.size());
-    for (int i = 0; i< envs.size(); i++)
-	{
-   	    envs[randIndex[i]].multiRoundTrain(model, fOracle, true, num_passes_);
-	}
-    fin.close();
-    cout << "greedy coaching finished" <<endl;
-    for (int iter = 1; iter < num_iters_; iter++)
-	{
-	    cout << "iterations " << iter << endl;
-	    envs.clear();
-	    ct = 0;
-	    fin.open(fileName.c_str());
-	    while (!fin.eof())
-		{
-		    environment env;
-		    // cout << "read_from_stream for EnvId " << ct <<endl;
-		    env.read_from_stream(model, fin);
-		    env.setBudget(budget_);
-		    env.setAlgoType(algo_);
-		    envs.push_back(env);
-		    //  cout << "numItems " << envs[ct].get_numItems() <<endl;
-		    //   envs[ct].multiRoundTrain(model, fOracle, false, num_passes_);
-		    ct++;
-		}
-
-	    randIndex = generate_random_index(envs.size());
-	    for (int i = 0; i< envs.size(); i++)
-		{
-		    envs[randIndex[i]].multiRoundTrain(model, fOracle, false, num_passes_);
-		}
-
-	    fin.close();
-	}
-    cout << "training completed" << endl;
-}
-
-void seqMachine::scp_predict(vw* model, string fileName)
-{
-    cout << "Run SCP_Predict Only" <<endl;
-    ifstream fin;
-    fin.open(fileName.c_str());
-    //    construct_envs_items(model, fin);
-    // for (int i = 0; i < envs.size(); i++)
-    int ct = 0;
-    envs.clear();
-    while (!fin.eof())
-	{
-	    environment env;
-	    //	    cout << "read_from_stream for EnvId " << ct <<endl;
-	    env.read_from_stream(model, fin);
-	    env.setBudget(budget_);
-	    envs.push_back(env);
-	    //	    cout << "numItems " << envs[ct].get_numItems() <<endl;
-	    envs[ct].multiRoundPredictOnly(model);
-	    ct++;
-	}
-    fin.close();
-}
-
-void seqMachine::check_predict_score (submodOracle & fOracle)
-{
-    double avgFinalScore;
-    for (int i = 0; i < envs.size(); i++)
-	{
-	    cout << "For Environment " << i <<endl;
-	    vector<double> score = envs[i].getPerSlotScore(fOracle);
-	    avgFinalScore += score[score.size() - 1];
-	}
-    avgFinalScore /= envs.size();
-    cout << "Average Prediction Final Score " << avgFinalScore << endl;
-}
-
-vector<int> seqMachine::generate_random_index(int tot)
-{
-    vector<int> randIndex;
-    for (int i = 0; i < tot; i++ )
-	randIndex.push_back(i);
-    std::random_shuffle(randIndex.begin(), randIndex.end());
-    for (int i = 0; i < randIndex.size(); i++)
-	{
-	    cout << randIndex[i] << ",";
-	}
-    cout << endl;
-    return randIndex;
-}


[c++] debug message of array synchronizer

--- src/nbla/synced_array.cpp
+++ src/nbla/synced_array.cpp
@@ -15,6 +15,37 @@
 #include <nbla/array_registry.hpp>
 #include <nbla/context.hpp>
 #include <nbla/synced_array.hpp>
+
+#ifdef ENABLE_SYNC_DEBUG
+#include <cstdlib>
+static bool sync_debug_enabled() {
+  static bool enabled = false;
+  if (enabled) {
+    return enabled;
+  }
+  const char *env_c = std::getenv("NNABLA_SYNC_DEBUG");
+  if (env_c == nullptr) {
+    return true;
+  }
+  std::string env = std::string(env_c);
+  try {
+    if (std::stoi(env) == 0) {
+      return false;
+    }
+  } catch (...) {
+  }
+  enabled = true;
+  return true;
+}
+
+#define SYNC_DEBUG(...)                                                        \
+  if (sync_debug_enabled()) {                                                  \
+    printf(__VA_ARGS__);                                                       \
+    printf("\n");                                                              \
+  }
+#else
+#define SYNC_DEBUG(...)
+#endif

 namespace nbla {
 // Constructor
@@ -104,6 +135,12 @@
     } else {
       ArraySynchronizer::synchronize(head_.array_class, head_array,
                                      desc.array_class, array);
+      SYNC_DEBUG("SYNC: %s<%s> --[%ld elements (%ld bytes in %s)]--> %s<%s>.",
+                 head_.array_class.c_str(),
+                 dtype_to_string(head_.dtype).c_str(),
+                 size() / sizeof_dtype(head_.dtype), size(),
+                 dtype_to_string(head_.dtype).c_str(), desc.array_class.c_str(),
+                 dtype_to_string(desc.dtype).c_str());
     }
   }
   return desc;


[queso]: Make function and operators concrete

--- examples/infinite_dim/inverse_problem.C
+++ examples/infinite_dim/inverse_problem.C
@@ -1,3 +1,5 @@
+#include <uqLibMeshFunction.h>
+#include <uqLaplacianOperator.h>
 #include <uqEnvironment.h>
 #include <uqStatisticalInverseProblem.h>

@@ -18,14 +20,14 @@
   // A gaussian prior is specified by a mean function and a covariance operator

   // Mean function
-  FUNCTION *mu = new FUNCTION(something here);
+  uqLibMeshFunction *mu = new uqLibMeshFunction();
   // Maybe the default constructor should default to the zero function?

-  // Inverse covariance operator: e.g., the inverse laplacian
-  OPERATOR *C = new OPERATOR("Laplacian");
+  // Inverse covariance operator: e.g., the inverse laplacian to the 3
+  uqNegativeLaplacianOperator *C = new uqNegativeLaplacianOperator(-3.0);

-  // Set up the Gaussian measure. s is the power that determines regularity > 0
-  uqGaussianRF *prior = new GAUSSIAN_MEASURE(mu, C, s);
+  // Set up the Gaussian measure.
+  uqGaussianRF *prior = new GAUSSIAN_MEASURE(mu, C);

   // Set up the likelihood. It takes a field
   Likelihood *likelihood = new Likelihood(*env, true_initial_condition,
@@ -38,7 +40,7 @@
     uqStatisticalInverseProblemClass("", &opts, *prior, *likelihood);

   // MCMC seed
-  FUNCTION initialVals();  // Zero as the MCMC seed
+  uqLibMeshFunction initialVals();  // Zero as the MCMC seed
   ip->solveWithBayesMetropolisHastings (NULL, initialVals);

   delete env;


- Add fix for NvidiaML code in case it runs into GDK 6.x

--- coffee/graphics/common/private/query/nvidia_query.cpp
+++ coffee/graphics/common/private/query/nvidia_query.cpp
@@ -76,6 +76,7 @@

 uint64 GetProcMemInfo(gpucount_t i, proc_t pid)
 {
+#if NVML_API_VERSION >= 7
     auto dev = device(i);

     uint32 count = 0;
@@ -89,7 +90,7 @@
     for(nvmlProcessInfo_t const& p : procs)
         if(p.pid == pid)
             return p.usedGpuMemory;
-
+#endif
     return 0;
 }

@@ -173,6 +174,7 @@

 TransferStatus GetPcieTransfer(gpucount_t i)
 {
+#if NVML_API_VERSION >= 7
     auto dev = device(i);

     TransferStatus stat = {};
@@ -180,6 +182,9 @@
     r = nvmlDeviceGetPcieThroughput(dev, NVML_PCIE_UTIL_TX_BYTES, &stat.tx);

     return stat;
+#else
+    return {};
+#endif
 }

 GpuQueryInterface GetNvidia()


[fixit] Scale down large tests (#30678)

[fixit] Scale down large tests (#30678)

We have many tests that create 100 threads or more, and mounting evidence that
this is harmful to our CI environment.

When the original code for many of these tests was written we ran our tests
under run_tests, which had explicit handling for tracking the number of threads
each test needed and making sure that we weren't over subscribing the test
runner. Bazel has no such facility (and the facility in run_tests has since
been removed) and so we need to adjust.

This PR adjusts down a single test and is part of a series so that we can
review and roll back easily if required.

--- test/core/transport/binder/end2end/binder_server_test.cc
+++ test/core/transport/binder/end2end/binder_server_test.cc
@@ -176,7 +176,7 @@
   std::unique_ptr<grpc::Server> server = server_builder.BuildAndStart();
   void* raw_endpoint_binder = grpc::experimental::binder::GetEndpointBinder(
       "example.service.multiple.connections");
-  constexpr size_t kNumThreads = 128;
+  constexpr size_t kNumThreads = 10;

   auto thread_fn = [&](size_t id) {
     std::unique_ptr<grpc_binder::Binder> endpoint_binder =
@@ -225,7 +225,7 @@
   std::unique_ptr<grpc::testing::EchoTestService::Stub> stub =
       grpc::testing::EchoTestService::NewStub(channel);

-  constexpr size_t kNumRequests = 128;
+  constexpr size_t kNumRequests = 10;

   auto thread_fn = [&](size_t id) {
     grpc::testing::EchoRequest request;


clang: for now, maFoo is as good as m_aFoo

--- clang/find-unprefixed-members.cxx
+++ clang/find-unprefixed-members.cxx
@@ -62,12 +62,9 @@
         if (m_rContext.match(pRecord->getQualifiedNameAsString()))
         {
             std::string aName = pDecl->getNameAsString();
-            if (aName.find("m_") != 0)
+            if (aName.find("m") != 0)
             {
-                if (aName.find("m") == 0)
-                    aName.insert(1, "_");
-                else
-                    aName.insert(0, "m_");
+                aName.insert(0, "m_");
                 std::cout << pRecord->getQualifiedNameAsString() << "::" << pDecl->getNameAsString() << "," << aName << std::endl;
                 m_bFound = true;
             }


Fixed missing sampler

Fixed missing sampler

There was a bug where textures that did not specify a sampler were not using a sampler. This change makes it so that textures that don't specify a sampler will use a default sampler that will use `Sampler::Wrap::REPEAT`.

--- kepler/src/GLTF2Loader.cpp
+++ kepler/src/GLTF2Loader.cpp
@@ -28,9 +28,6 @@
 #include <chrono>
 #include <array>

-using std::string;
-using std::shared_ptr;
-
 #define RETURN_IF_FOUND(map, key) \
     { \
         auto i = (map).find(key); \
@@ -39,33 +36,37 @@
         } \
     }

-static constexpr GLchar* DEFAULT_VERT_SHADER = "precision highp float;\n"
-"\n"
-"uniform mat4 u_modelViewMatrix;\n"
-"uniform mat3 u_normalMatrix;\n"
-"uniform mat4 u_projectionMatrix;\n"
-"\n"
-"attribute vec3 a_normal;\n"
-"attribute vec3 a_position;\n"
-"\n"
-"void main(void)\n"
-"{\n"
-"    gl_Position = u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0);\n"
-"}\n";
-
-static constexpr GLchar* DEFAULT_FRAG_SHADER = "precision highp float;\n"
-"\n"
-"uniform vec4 u_emission;\n"
-"\n"
-"void main(void)\n"
-"{\n"
-"    gl_FragColor = u_emission;\n"
-"}\n";
-
-static constexpr const GLchar* BASIC_VERT_PATH = "../kepler/res/shaders/basic.vert";
-static constexpr const GLchar* BASIC_FRAG_PATH = "../kepler/res/shaders/basic.frag";
-
 namespace kepler {
+
+    static constexpr GLchar* DEFAULT_VERT_SHADER = "precision highp float;\n"
+        "\n"
+        "uniform mat4 u_modelViewMatrix;\n"
+        "uniform mat3 u_normalMatrix;\n"
+        "uniform mat4 u_projectionMatrix;\n"
+        "\n"
+        "attribute vec3 a_normal;\n"
+        "attribute vec3 a_position;\n"
+        "\n"
+        "void main(void)\n"
+        "{\n"
+        "    gl_Position = u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0);\n"
+        "}\n";
+
+    static constexpr GLchar* DEFAULT_FRAG_SHADER = "precision highp float;\n"
+        "\n"
+        "uniform vec4 u_emission;\n"
+        "\n"
+        "void main(void)\n"
+        "{\n"
+        "    gl_FragColor = u_emission;\n"
+        "}\n";
+
+    static constexpr const GLchar* BASIC_VERT_PATH = "../kepler/res/shaders/basic.vert";
+    static constexpr const GLchar* BASIC_FRAG_PATH = "../kepler/res/shaders/basic.frag";
+
+    using std::string;
+    using std::shared_ptr;
+    using std::chrono::high_resolution_clock;

     using ubyte = unsigned char;

@@ -82,6 +83,15 @@
     static Sampler::MagFilter toMagFilterMode(gltf2::Sampler::MagFilter filter);
     static GLint numComponentsOfType(const string& type);
     static void setState(int state, RenderState& block);
+    template<typename T>
+    static void printTime(T start, T end, const char* str) {
+        auto time = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
+        auto clogWidth = std::clog.width();
+        std::clog.width(8);
+        std::clog << static_cast<double>(time.count());
+        std::clog.width(clogWidth);
+        std::clog << str << std::endl;
+    }

     using time_type = std::chrono::nanoseconds;
     static time_type __totalTime;
@@ -123,6 +133,7 @@

         ref<Material> loadDefaultMaterial();
         ref<Technique> loadDefaultTechnique();
+        ref<Sampler> loadDefaultSampler();

         string uriToPath(const string& uri) const;

@@ -152,6 +163,7 @@

         ref<Material> _defaultMaterial;
         ref<Technique> _defaultTechnique;
+        ref<Sampler> _defaultSampler;

         string _baseDir;

@@ -224,11 +236,11 @@
     bool GLTF2Loader::Impl::loadJson(const char* path) {
         _baseDir = directoryName(path);

-        auto start = std::chrono::high_resolution_clock::now();
+        auto start = high_resolution_clock::now();

         _loaded = _gltf.load(path);

-        auto end = std::chrono::high_resolution_clock::now();
+        auto end = high_resolution_clock::now();
         _jsonLoadTime = std::chrono::duration_cast<time_type>(end - start);

         return _loaded;
@@ -236,7 +248,7 @@

     ref<Scene> GLTF2Loader::Impl::loadSceneFromFile(const char* path) {
         // TODO call clear() first?
-        auto start = std::chrono::high_resolution_clock::now();
+        auto start = high_resolution_clock::now();

         if (!loadJson(path)) {
             loge("LOAD_SCENE_FROM_FILE ", path);
@@ -245,12 +257,13 @@

         auto scene = loadDefaultScene();

-        auto end = std::chrono::high_resolution_clock::now();
+        auto end = high_resolution_clock::now();
         auto t = std::chrono::duration_cast<time_type>(end - start);
         __totalTime += t;
         auto clogWidth = std::clog.width();
         std::clog.width(8);
-        std::clog << std::chrono::duration_cast<std::chrono::milliseconds>(t).count() << " ms to load ";
+        std::clog << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms to load ";
+

         std::clog << "(";
         double percent = (double)_jsonLoadTime.count() / (double)t.count() * 100.0;
@@ -513,7 +526,7 @@
                     if (auto texture = loadTexture(textureIndex)) {
                         tech->setUniform("s_baseMap", MaterialParameter::create("s_baseMap", texture));
                     }
-                }
+                }
                 gPbr.baseColorFactor(glm::value_ptr(baseColorFactor));
             }
             tech->setAttribute("a_position", AttributeSemantic::POSITION);
@@ -555,12 +568,17 @@
             if (gTexture.source(imageIndex)) {
                 if (auto image = loadImage(imageIndex)) {
                     auto texture = Texture::create2D(image.get(), DEFAULT_FORMAT, true);
+                    ref<Sampler> sampler;
                     size_t samplerIndex;
                     if (gTexture.sampler(samplerIndex)) {
-                        if (auto sampler = loadSampler(samplerIndex)) {
+                        if (sampler = loadSampler(samplerIndex)) {
                             texture->setSampler(sampler);
                         }
                     }
+                    if (sampler == nullptr) {
+                        sampler = loadDefaultSampler();
+                    }
+                    texture->setSampler(sampler);
                     _textures[index] = texture;
                     return texture;
                 }
@@ -582,6 +600,7 @@
             minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR;
             sampler->setFilterMode(minFilter, magFilter);
             sampler->setWrapMode(wrapS, wrapT);
+            _samplers[index] = sampler;
             return sampler;
         }
         return nullptr;
@@ -590,6 +609,9 @@
     ref<Image> GLTF2Loader::Impl::loadImage(size_t index) {
         RETURN_IF_FOUND(_images, index);
         ref<Image> image = nullptr;
+
+        auto start = high_resolution_clock::now();
+
         if (auto gImage = _gltf.image(index)) {
             if (const char* uri = gImage.uri()) {
                 if (gImage.isBase64()) {
@@ -616,6 +638,9 @@
                 _images[index] = image;
             }
         }
+
+        auto end = high_resolution_clock::now();
+        printTime(start, end, " ms to load image");
         return image;
     }

@@ -662,6 +687,16 @@

         _defaultTechnique = tech;
         return _defaultTechnique;
+    }
+
+    ref<Sampler> GLTF2Loader::Impl::loadDefaultSampler() {
+        if (_defaultSampler) {
+            return _defaultSampler;
+        }
+        _defaultSampler = Sampler::create();
+        _defaultSampler->setWrapMode(Sampler::Wrap::REPEAT, Sampler::Wrap::REPEAT);
+        _defaultSampler->setFilterMode(Sampler::MinFilter::LINEAR_MIPMAP_LINEAR, Sampler::MagFilter::LINEAR);
+        return _defaultSampler;
     }

     string GLTF2Loader::Impl::uriToPath(const string& uri) const {


#98750# +getAccessibleCreator

#98750# +getAccessibleCreator

--- comphelper/inc/comphelper/accessiblecontexthelper.hxx
+++ comphelper/inc/comphelper/accessiblecontexthelper.hxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: accessiblecontexthelper.hxx,v $
  *
- *  $Revision: 1.2 $
- *
- *  last change: $Author: fs $ $Date: 2002-04-26 05:51:23 $
+ *  $Revision: 1.3 $
+ *
+ *  last change: $Author: fs $ $Date: 2002-04-26 14:21:46 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -118,7 +118,12 @@
             XAccessible, we can compare it with all the children, instead of asking all children for their
             context and comparing this context with ourself.</p>
         */
-        void lateInit( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& _rxAccessible );
+        void    lateInit( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& _rxAccessible );
+
+        /** retrieves the creator previously set with <method>lateInit</method>
+        */
+        ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >
+                getAccessibleCreator( ) const;

     public:
         // XAccessibleEventBroadcaster
@@ -270,6 +275,9 @@
 /*************************************************************************
  * history:
  *  $Log: not supported by cvs2svn $
+ *  Revision 1.2  2002/04/26 05:51:23  fs
+ *  #98750# use correct broadcasthelper (in the WeagAggComponentImpl* base)
+ *
  *  Revision 1.1  2002/04/23 11:07:38  fs
  *  initial checkin - helper for implementing an XAccessibleContext
  *


INTEGRATION: CWS ooo19126 (1.2.122); FILE MERGED 2005/09/05 15:24:10 rt 1.2.122.1: #i54170# Change license header: remove SISSL

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


Change `start` after histograms have been printed.

--- consumer.cc
+++ consumer.cc
@@ -46,6 +46,7 @@
       for (const auto& h : histograms) {
         std::cout << h.second << std::endl;
       }
+      start = now;
     }
   }
 }


Correct the mistakes

Correct the mistakes

--- photoeffects/src/edgeBlur.cpp
+++ photoeffects/src/edgeBlur.cpp
@@ -8,7 +8,8 @@
 int edgeBlur(InputArray src, OutputArray dst, int indentTop, int indentLeft)
 {
     CV_Assert(src.type() == CV_8UC3);
-    Mat image = src.getMat(), outputImage(image.size(), CV_8UC3);
+    dst.create(src.size(), src.type());
+    Mat image = src.getMat(), outputImage = dst.getMat();

     CV_Assert(indentTop >= 0 && indentTop <= (image.rows / 2 - 10));
     CV_Assert(indentLeft >= 0 && indentLeft <= (image.cols / 2 - 10));
@@ -21,29 +22,25 @@
             * (image.rows / 2.0f - indentTop);
     int kSizeEdges = halfWidth / a + halfHeight / b;

-    if (kSizeEdges > MAX_KERNELSIZE)
-    {
-        kSizeEdges = MAX_KERNELSIZE;
-    }
+    kSizeEdges = MIN(kSizeEdges, MAX_KERNELSIZE);
     Mat bearingImage(image.rows + 2 * kSizeEdges,
                     image.cols + 2 * kSizeEdges,
                     CV_8UC3);
     copyMakeBorder(image, bearingImage, kSizeEdges, kSizeEdges,
         kSizeEdges, kSizeEdges, BORDER_REPLICATE);

-    int size, maxI = bearingImage.rows - kSizeEdges,
-    maxJ = bearingImage.cols - kSizeEdges;
-    Vec3f sumF;
-    Vec3b Color;
-    float radius, sumC, coeff;
-    float bearHalfWidth = bearingImage.cols / 2.0f;
-    float bearHalfHeight = bearingImage.rows / 2.0f;

-    for (int i = kSizeEdges; i < maxI; i++)
+    for (int i = kSizeEdges; i < bearingImage.rows - kSizeEdges; i++)
     {
-        for (int j = kSizeEdges; j < maxJ; j++)
+        for (int j = kSizeEdges; j < bearingImage.cols - kSizeEdges; j++)
         {
-            radius = (bearHalfHeight - i)
+            int size;
+            Vec3f sumF;
+            Vec3b Color;
+            float sumC = 0.0f, coeff;
+            float bearHalfWidth = bearingImage.cols / 2.0f;
+            float bearHalfHeight = bearingImage.rows / 2.0f;
+            float radius = (bearHalfHeight - i)
                     * (bearHalfHeight - i)
                     / b

@@ -56,17 +53,9 @@
                     bearingImage.at<Vec3b>(i, j);
                 continue;
             }
-            sumF[0] = 0.0f;
-            sumF[1] = 0.0f;
-            sumF[2] = 0.0f;
-            sumC = 0.0f;
             size = radius;
-            radius -= 0.5f;
-            radius *= 2.0f * radius;
-            if (size > kSizeEdges)
-            {
-                size = kSizeEdges;
-            }
+            radius = 2.0f * (radius - 0.5f) * (radius - 0.5f);
+            size = MIN(size, kSizeEdges);
             for (int x = -size; x <= size; x++)
             {
                 for (int y = -size; y <= size; y++)
@@ -75,15 +64,14 @@
                             * exp(- (x * x + y * y) / radius);

                     Color = bearingImage.at<Vec3b>(x + i, y + j);
-                    sumF = sumF + (Vec3f) (coeff * Color);
+                    sumF += (Vec3f) (coeff * Color);
                     sumC += coeff;
                 }
             }
-            sumF = sumF * (1.0f / sumC);
+            sumF *= (1.0f / sumC);
             outputImage.at<Vec3b>(i - kSizeEdges, j - kSizeEdges) = sumF;
         }
     }

-    outputImage.convertTo(dst, CV_8UC3);
     return 0;
 }


Change double quotation for brackets

Change double quotation for brackets

--- mssql/mssql_datasource.cpp
+++ mssql/mssql_datasource.cpp
@@ -182,10 +182,10 @@
                     s << "SELECT column_name, data_type";
                     if (check_srid)
                     {
-                        s << ", (SELECT TOP 1 \""
-                          << geometry_field_ << "\".STSrid FROM \"" << geometry_table_
-                          << "\" WHERE \""
-                          << geometry_field_ << "\" IS NOT NULL)";
+                        s << ", (SELECT TOP 1 ["
+                          << geometry_field_ << "].STSrid FROM [" << geometry_table_
+                          << "] WHERE ["
+                          << geometry_field_ << "] IS NOT NULL)";
                     }
                     s << " FROM "
                       << "information_schema.columns "
@@ -235,8 +235,8 @@
                 {
                     s.str("");

-                    s << "SELECT TOP 1 (\"" << geometryColumn_ << "\").STSrid AS srid FROM "
-                      << populate_tokens(table_) << " WHERE \"" << geometryColumn_ << "\" IS NOT NULL;";
+                    s << "SELECT TOP 1 ([" << geometryColumn_ << "]).STSrid AS srid FROM "
+                      << populate_tokens(table_) << " WHERE [" << geometryColumn_ << "] IS NOT NULL;";

                     shared_ptr<ResultSet> rs = conn->executeQuery(s.str());
                     if (rs->next())
@@ -393,8 +393,7 @@

         // Close explicitly the connection so we can 'fork()' without sharing open connections
         conn->close();
-
-
+
         // Finally, add unique metadata to layer descriptor
         mapnik::parameters & extra_params = desc_.get_extra_parameters();
         // explicitly make copies of values due to https://github.com/mapnik/mapnik/issues/2651
@@ -547,13 +546,13 @@
             s << " WHERE ";
             if (wkb_)
             {
-                s << "\"" << geometryColumn_ << "\".STIsValid() = 1 AND ";
+                s << "[" << geometryColumn_ << "].STIsValid() = 1 AND ";
             }
             if (use_filter_) {
-                s << "\"" << geometryColumn_ << "\".Filter(" << box << ") = 1";
+                s << "[" << geometryColumn_ << "].Filter(" << box << ") = 1";
             }
             else {
-				s << "\"" << geometryColumn_ << "\".STIntersects(" << box << ") = 1";
+				s << "[" << geometryColumn_ << "].STIntersects(" << box << ") = 1";
 			}

         }
@@ -699,7 +698,7 @@
             s << " TOP " << row_limit_;
         }

-        s << "\"" << geometryColumn_ << "\"";
+        s << "[" << geometryColumn_ << "]";

         if (simplify_geometries_)
         {
@@ -817,7 +816,7 @@
             {
                 s << " TOP " << row_limit_;
             }
-            s << "\"" << geometryColumn_ << "\"";
+            s << "[" << geometryColumn_ << "]";
             if (wkb_)
             {
                 s << ".STAsBinary()";
@@ -1016,7 +1015,7 @@
                     s << " TOP 5";
                 }

-                s << "\"" << geometryColumn_ << "\".STGeometryType() AS geom"
+                s << "[" << geometryColumn_ << "].STGeometryType() AS geom"
                   << " FROM " << populate_tokens(table_);


determinant could go negative so a sqrt will fail then.

--- core/ilwisobjects/geometry/georeference/simpelgeoreference.cpp
+++ core/ilwisobjects/geometry/georeference/simpelgeoreference.cpp
@@ -53,7 +53,7 @@
     if ( _det == 0)
         return rUNDEF;

-    return sqrt( 1/ _det);
+    return sqrt( 1/ std::abs(_det));
 }

 std::vector<double> SimpelGeoReference::matrix() const {


ssl: more fine-grained test for cert validation failure (#18424)

ssl: more fine-grained test for cert validation failure

Signed-off-by: Shikugawa <39e454ed4b4d568a0df5432b0e6b1d4f397e6894@tetrate.io>

--- test/extensions/transport_sockets/tls/ssl_socket_test.cc
+++ test/extensions/transport_sockets/tls/ssl_socket_test.cc
@@ -272,6 +272,13 @@
   }
   const std::string& notExpectedClientStats() const { return not_expected_client_stats_; }

+  TestUtilOptions& setExpectedVerifyErrorCode(int code) {
+    expected_verify_error_code_ = code;
+    return *this;
+  }
+
+  int expectedVerifyErrorCode() const { return expected_verify_error_code_; }
+
 private:
   const std::string client_ctx_yaml_;
   const std::string server_ctx_yaml_;
@@ -295,6 +302,7 @@
   bool ocsp_stapling_enabled_{false};
   std::string expected_transport_failure_reason_contains_;
   std::string not_expected_client_stats_;
+  int expected_verify_error_code_{-1};
 };

 void testUtil(const TestUtilOptions& options) {
@@ -495,7 +503,12 @@
         .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { close_second_time(); }));
   }

-  dispatcher->run(Event::Dispatcher::RunType::Block);
+  if (options.expectedVerifyErrorCode() != -1) {
+    EXPECT_LOG_CONTAINS("debug", X509_verify_cert_error_string(options.expectedVerifyErrorCode()),
+                        dispatcher->run(Event::Dispatcher::RunType::Block));
+  } else {
+    dispatcher->run(Event::Dispatcher::RunType::Block);
+  }

   if (!options.expectedServerStats().empty()) {
     EXPECT_EQ(1UL, server_stats_store.counter(options.expectedServerStats()).value());
@@ -1501,7 +1514,8 @@
 )EOF";

   TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, false, GetParam());
-  testUtil(test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY));
 }

 TEST_P(SslSocketTest, FailedClientAuthSanVerificationNoClientCert) {
@@ -1900,7 +1914,8 @@
                                                    TEST_SAN_URI_CERT_256_HASH, "\"");

   TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, false, GetParam());
-  testUtil(test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY));
 }

 TEST_P(SslSocketTest, CertificatesWithPassword) {
@@ -4355,7 +4370,8 @@
 )EOF";

   TestUtilOptions revoked_test_options(revoked_client_ctx_yaml, server_ctx_yaml, false, GetParam());
-  testUtil(revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // This should succeed, since the cert isn't revoked.
   const std::string successful_client_ctx_yaml = R"EOF(
@@ -4397,7 +4413,8 @@
 )EOF";

   TestUtilOptions revoked_test_options(revoked_client_ctx_yaml, server_ctx_yaml, false, GetParam());
-  testUtil(revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // This should succeed, since the cert isn't revoked.
   const std::string successful_client_ctx_yaml = R"EOF(
@@ -4486,17 +4503,20 @@
   // Ensure that incomplete crl chains fail with revoked certificates.
   TestUtilOptions incomplete_revoked_test_options(revoked_client_ctx_yaml,
                                                   incomplete_server_ctx_yaml, false, GetParam());
-  testUtil(incomplete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(incomplete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // Ensure that incomplete crl chains fail with unrevoked certificates.
   TestUtilOptions incomplete_unrevoked_test_options(unrevoked_client_ctx_yaml,
                                                     incomplete_server_ctx_yaml, false, GetParam());
-  testUtil(incomplete_unrevoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(incomplete_unrevoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_UNABLE_TO_GET_CRL));

   // Ensure that complete crl chains fail with revoked certificates.
   TestUtilOptions complete_revoked_test_options(revoked_client_ctx_yaml, complete_server_ctx_yaml,
                                                 false, GetParam());
-  testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // Ensure that complete crl chains succeed with unrevoked certificates.
   TestUtilOptions complete_unrevoked_test_options(unrevoked_client_ctx_yaml,
@@ -4569,17 +4589,20 @@
   // Ensure that incomplete crl chains fail with revoked certificates.
   TestUtilOptions incomplete_revoked_test_options(revoked_client_ctx_yaml,
                                                   incomplete_server_ctx_yaml, false, GetParam());
-  testUtil(incomplete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(incomplete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // Ensure that incomplete crl chains fail with unrevoked certificates.
   TestUtilOptions incomplete_unrevoked_test_options(unrevoked_client_ctx_yaml,
                                                     incomplete_server_ctx_yaml, false, GetParam());
-  testUtil(incomplete_unrevoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(incomplete_unrevoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_UNABLE_TO_GET_CRL));

   // Ensure that complete crl chains fail with revoked certificates.
   TestUtilOptions complete_revoked_test_options(revoked_client_ctx_yaml, complete_server_ctx_yaml,
                                                 false, GetParam());
-  testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error"));
+  testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
+               .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));

   // Ensure that complete crl chains succeed with unrevoked certificates.
   TestUtilOptions complete_unrevoked_test_options(unrevoked_client_ctx_yaml,


Modified indentation

Modified indentation

--- mongo_cxx_extension.cpp
+++ mongo_cxx_extension.cpp
@@ -122,7 +122,7 @@
   }

   BSONObj GridFileBuilder::buildFile(const string &name,
-                                       const string& content_type) {
+                                     const string& content_type) {
     privateAppendPendingData();

     /* from gridfs.cpp at https://github.com/mongodb/mongo-cxx-driver/blob/legacy/src/mongo/client/gridfs.cpp */


Fix for #95 : update Wire.cpp to MPIDE's version.

--- pic32/libraries/Wire/Wire.cpp
+++ pic32/libraries/Wire/Wire.cpp
@@ -184,16 +184,22 @@

 uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity)
 {
-    DTWI::I2C_STATUS status;
+    DTWI::I2C_STATUS i2cStatus = di2c.getStatus();
+
+    // see if the bus is already in use
+    if(i2cStatus.fBusInUse && !i2cStatus.fMyBus)
+    {
+        return(0);
+    }

     // may have to wait for the last action to finish before
     // a repeated start can occur
-    while(!di2c.startMasterRead(address, quantity));
+    while(!di2c.startMasterRead(address, quantity) && di2c.getStatus().fMyBus);

     do
     {
-        status = di2c.getStatus();
-    } while(status.fMyBus && !status.fNacking);
+        i2cStatus = di2c.getStatus();
+    } while(i2cStatus.fMyBus && !i2cStatus.fNacking);

     while(!di2c.stopMaster());

@@ -207,7 +213,17 @@

 void TwoWire::beginTransmission(uint8_t address)
 {
-    while(!di2c.startMasterWrite(address));
+    DTWI::I2C_STATUS i2cStatus = di2c.getStatus();
+
+    // if someone else has the bus, then we won't get it; get out
+    if(i2cStatus.fBusInUse  && !i2cStatus.fMyBus)
+    {
+        return;
+    }
+
+    // we only want to loop on this with a repeated start
+    // otherwise it will pass on the first try
+    while(!di2c.startMasterWrite(address) && di2c.getStatus().fMyBus);
 }

 void TwoWire::beginTransmission(int address)
@@ -217,12 +233,45 @@

 uint8_t TwoWire::endTransmission(uint8_t fStopBit)
 {
+    uint8_t retStatus = 0;
+    DTWI::I2C_STATUS i2cStatus;
+
+    // if not my bus, then the beginMaster failed and we either had
+    // a collision or the slave acked, in either case report a NACK from the slave
+    if(!di2c.getStatus().fMyBus)
+    {
+        return(2);
+    }
+
+    // wait for the transmit buffer is empty
+    while(di2c.getStatus().fWrite && di2c.transmitting() != 0);
+
+    // Get the current status
+    i2cStatus = di2c.getStatus();
+
+    // what happened to the bus, we use to have it?
+    // other error
+    if(!i2cStatus.fMyBus)
+    {
+        return(4);
+    }
+
+    // we have the bus, but not writing
+    // the otherside NACKed our Write
+    else if(!i2cStatus.fWrite)
+    {
+            retStatus = 3;
+    }
+
+    // put a stop bit out if we are not going to attempt a repeated start
     if(fStopBit)
     {
         while(!di2c.stopMaster());
     }
-    return(true);
-}
+
+    return(retStatus);
+}
+
 uint8_t TwoWire::endTransmission(void)
 {
     return(endTransmission(true));


One more udword->uintptr_t

One more udword->uintptr_t

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@20089 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- plugins/collide/opcode/OPC_HybridModel.cpp
+++ plugins/collide/opcode/OPC_HybridModel.cpp
@@ -209,7 +209,7 @@
 				Data->mLeaves[Data->mNbLeaves] = *current->GetAABB();

 				// Setup leaf data
-				uintptr_t Index = (uintptr_t(current->GetPrimitives()) - uintptr_t(Data->mBase))/sizeof(udword);
+				uintptr_t Index = (uintptr_t(current->GetPrimitives()) - uintptr_t(Data->mBase))/sizeof(uintptr_t);
 				Data->mTriangles[Data->mNbLeaves].SetData(current->GetNbPrimitives(), Index);

 				Data->mNbLeaves++;


Soft error when config.yaml doesn't exist

--- control.cpp
+++ control.cpp
@@ -157,11 +157,20 @@

 bool KeyControls::load_from_file(const string& filename)
 {
-	YAML::Node bindings = YAML::LoadFile(filename);
-
-	if (!bindings.IsMap())
-	{
-		cerr << "Ignoring bad config file\n"
+	bool bad = false;
+	YAML::Node bindings;
+	try
+	{
+		bindings = YAML::LoadFile(filename);
+	}
+	catch (YAML::BadFile)
+	{
+		bad = true;
+	}
+
+	if (bad || !bindings.IsMap())
+	{
+		cerr << "Ignoring bad/missing config file\n";
 		return false;
 	}


skip the first frames

skip the first frames

--- magic/magic.cpp
+++ magic/magic.cpp
@@ -121,6 +121,7 @@

   for(int i = 0; i <= frames-1;i++){
     cap >> in;
+    if(i > skip_frames) {
     temp = in(rect);
     cvtColor(temp, dst, CV_RGB2GRAY, 0);
     absdiff(dst, background, temp);
@@ -134,6 +135,7 @@
     fs << i <<","<< i/fps <<","<< radius <<","<< center.x <<","<< center.y << "\n";
     std::cout << "\r" << i << "/" << frames;
     // imwrite(output + "/test-"+ std::to_string(i)+".tiff", dst, imageout_params);
+    }
   }

   fs << std::endl;


fix size_t - int issue again

fix size_t - int issue again

--- testing/adios2/engine/bp/TestBPStepsInSituLocalArray.cpp
+++ testing/adios2/engine/bp/TestBPStepsInSituLocalArray.cpp
@@ -160,8 +160,8 @@
     adios2::Engine reader = ior.Open(fname, adios2::Mode::Read);
     EXPECT_TRUE(reader);

-    size_t stepsWritten = 0;
-    size_t stepsRead = 0;
+    int stepsWritten = 0;
+    int stepsRead = 0;

     for (const auto act : schedule)
     {
@@ -288,8 +288,8 @@
     adios2::Engine reader = ior.Open(fname, adios2::Mode::Read);
     EXPECT_TRUE(reader);

-    size_t stepsWritten = 0;
-    size_t stepsRead = 0;
+    int stepsWritten = 0;
+    int stepsRead = 0;

     for (const auto act : schedule)
     {
@@ -421,7 +421,7 @@
     EXPECT_TRUE(writer);
     auto var_i32 = iow.DefineVariable<int32_t>("i32", shape, start, count);
     EXPECT_TRUE(var_i32);
-    auto var_step = iow.DefineVariable<size_t>("step");
+    auto var_step = iow.DefineVariable<int>("step");
     EXPECT_TRUE(var_step);

 #if ADIOS2_USE_MPI
@@ -438,10 +438,10 @@
     adios2::Engine reader = ior.Open(fname, adios2::Mode::Read);
     EXPECT_TRUE(reader);

-    size_t stepsWritten = 0;
-    size_t stepsRead = 0;
-    size_t varStepsWritten = 0;
-    size_t varStepsRead = 0;
+    int stepsWritten = 0;
+    int stepsRead = 0;
+    int varStepsWritten = 0;
+    int varStepsRead = 0;
     for (const auto act : schedule)
     {
         if (act == Act::Write)


ART: Enables x86_64 disassembly

ART: Enables x86_64 disassembly

This patch
  (a) cuts a REX prefix from the instruction and
  (b) adds missed 32bit disp to instructions with ModR/M and SIB bytes.

Change-Id: I2674678224ca27746b33d4006ed38d497972309f
Signed-off-by: Vladimir Kostyukov <0ee581568738a8d8f88a46a0d3ee15cfbd0c33d0@intel.com>

--- disassembler/disassembler_x86.cc
+++ disassembler/disassembler_x86.cc
@@ -145,6 +145,9 @@
     }
   } while (have_prefixes);
   uint8_t rex = (supports_rex_ && (*instr >= 0x40) && (*instr <= 0x4F)) ? *instr : 0;
+  if (rex != 0) {
+    instr++;
+  }
   bool has_modrm = false;
   bool reg_is_opcode = false;
   size_t immediate_bytes = 0;
@@ -746,14 +749,18 @@
     uint8_t reg_or_opcode = (modrm >> 3) & 7;
     uint8_t rm = modrm & 7;
     std::ostringstream address;
-    if (mod == 0 && rm == 5) {  // fixed address
-      address_bits = *reinterpret_cast<const uint32_t*>(instr);
-      address << StringPrintf("[0x%x]", address_bits);
+    if (mod == 0 && rm == 5) {
+      if (!supports_rex_) {  // Absolute address.
+        address_bits = *reinterpret_cast<const uint32_t*>(instr);
+        address << StringPrintf("[0x%x]", address_bits);
+      } else {  // 64-bit RIP relative addressing.
+        address << StringPrintf("[RIP + 0x%x]",  *reinterpret_cast<const uint32_t*>(instr));
+      }
       instr += 4;
     } else if (rm == 4 && mod != 3) {  // SIB
       uint8_t sib = *instr;
       instr++;
-      uint8_t ss = (sib >> 6) & 3;
+      uint8_t scale = (sib >> 6) & 3;
       uint8_t index = (sib >> 3) & 7;
       uint8_t base = sib & 7;
       address << "[";
@@ -765,11 +772,22 @@
       }
       if (index != 4) {
         DumpIndexReg(address, rex, index);
-        if (ss != 0) {
-          address << StringPrintf(" * %d", 1 << ss);
+        if (scale != 0) {
+          address << StringPrintf(" * %d", 1 << scale);
         }
       }
-      if (mod == 1) {
+      if (mod == 0) {
+        if (base == 5) {
+          if (index != 4) {
+            address << StringPrintf(" + %d", *reinterpret_cast<const int32_t*>(instr));
+          } else {
+            // 64-bit low 32-bit absolute address, redundant absolute address encoding on 32-bit.
+            address_bits = *reinterpret_cast<const uint32_t*>(instr);
+            address << StringPrintf("%d", address_bits);
+          }
+          instr += 4;
+        }
+      } else if (mod == 1) {
         address << StringPrintf(" + %d", *reinterpret_cast<const int8_t*>(instr));
         instr++;
       } else if (mod == 2) {


memory: attempt to catch underflows

memory: attempt to catch underflows

If someone attempts to allocate 0xffff'ffff'ffff'ff80 bytes, it was
probably some underflow that resulted in -128.  Abort to let someone
debug it.

--- core/memory.cc
+++ core/memory.cc
@@ -803,7 +803,16 @@
     return (span_bytes() % _object_size) / (1.0 * span_bytes());
 }

+void
+abort_on_underflow(size_t size) {
+    if (std::make_signed_t<size_t>(size) < 0) {
+        // probably a logic error, stop hard
+        abort();
+    }
+}
+
 void* allocate_large(size_t size) {
+    abort_on_underflow(size);
     unsigned size_in_pages = (size + page_size - 1) >> page_bits;
     assert((size_t(size_in_pages) << page_bits) >= size);
     return cpu_mem.allocate_large(size_in_pages);
@@ -811,6 +820,7 @@
 }

 void* allocate_large_aligned(size_t align, size_t size) {
+    abort_on_underflow(size);
     unsigned size_in_pages = (size + page_size - 1) >> page_bits;
     unsigned align_in_pages = std::max(align, page_size) >> page_bits;
     return cpu_mem.allocate_large_aligned(align_in_pages, size_in_pages);


memory: reclaim more aggressively

memory: reclaim more aggressively

If we didn't hit our target, try again.

--- core/memory.cc
+++ core/memory.cc
@@ -676,12 +676,11 @@
 void cpu_pages::reclaim() {
     current_min_free_pages = 0;
     reclaim_hook([this] {
-        if (nr_free_pages >= min_free_pages) {
-            return;
-        }
-        ++g_reclaims;
-        for (auto&& r : reclaimers) {
-            r->do_reclaim();
+        while (nr_free_pages < min_free_pages) {
+            ++g_reclaims;
+            for (auto&& r : reclaimers) {
+                r->do_reclaim();
+            }
         }
         current_min_free_pages = min_free_pages;
     });


Accept file paths from stdin; get rid of rm -p

--- fclip.cpp
+++ fclip.cpp
@@ -34,8 +34,6 @@
 bool oLinks;
 // "add" options:
 bool oNonRecursive;
-// "remove" options:
-bool oRemoveParents;
 // "for-each" options:
 bool oForEachRemove;
 bool oForEachPrint;
@@ -93,10 +91,7 @@
 }

 po::options_description remove_options(){
-  po::options_description options("Options");
-  options.add_options()
-          ("parents,p", po::bool_switch(&oRemoveParents), "remove parent directories if empty");
-  return move(options);
+  return po::options_description();
 }

 po::options_description list_options(){
@@ -169,29 +164,35 @@
           .options(options).positional(positional).run(), vm);
   po::notify(vm);

+  vector<string> files;
   if(vm.count("file")){
-    vector<string> files = vm["file"].as<vector<string> >();
-    // make file paths canonical
-    for(auto it = files.begin(); it != files.end(); ++it){
-      boost::system::error_code ec;
-      string path = file_functions::getCanonicalPathToSymlink(*it, ec).string();
-      if(ec.value() != boost::system::errc::success){
-        err() << "cannot access " << *it << ": " << ec.message() << endl;
-        it = files.erase(it);
-        if(it == files.end()) break;
-      }else{
-        *it = move(path);
-        if(oVerbose)
-          cout << *it << endl;
-      }
-    }
-
-    bool success;
-    fclip.Add(files, !oNonRecursive, serverMessages, success);
-    return success;
+    files = vm["file"].as<vector<string> >();
   }else{
-    throw runtime_error("no files specified");
-  }
+    string line;
+    while(getline(cin, line)){
+      if(line != "")
+        files.push_back(line);
+    }
+  }
+
+  // make file paths canonical
+  for(auto it = files.begin(); it != files.end(); ++it){
+    boost::system::error_code ec;
+    string path = file_functions::getCanonicalPathToSymlink(*it, ec).string();
+    if(ec.value() != boost::system::errc::success){
+      err() << "cannot access " << *it << ": " << ec.message() << endl;
+      it = files.erase(it);
+      if(it == files.end()) break;
+    }else{
+      *it = move(path);
+      if(oVerbose)
+        cout << *it << endl;
+    }
+  }
+
+  bool success;
+  fclip.Add(files, !oNonRecursive, serverMessages, success);
+  return success;
 }

 bool remove_run(const vector<string> &argv, FclipClient &fclip){
@@ -205,29 +206,35 @@
           .options(options).positional(positional).run(), vm);
   po::notify(vm);

+  vector<string> files;
   if(vm.count("file")){
-    vector<string> files = vm["file"].as<vector<string> >();
-    // make file paths canonical
-    for(auto it = files.begin(); it != files.end(); ++it){
-      boost::system::error_code ec;
-      string path = file_functions::getCanonicalPathToSymlink(*it, ec).string();
-      if(ec.value() != boost::system::errc::success){
-        err() << "cannot access " << *it << ": " << ec.message() << endl;
-        it = files.erase(it);
-        if(it == files.end()) break;
-      }else{
-        *it = move(path);
-        if(oVerbose)
-          cout << *it << endl;
-      }
-    }
-
-    bool success;
-    fclip.Remove(files, oRemoveParents, serverMessages, success);
-    return success;
+    files = vm["file"].as<vector<string> >();
   }else{
-    throw runtime_error("no files specified");
-  }
+    string line;
+    while(getline(cin, line)){
+      if(line != "")
+        files.push_back(line);
+    }
+  }
+
+  // make file paths canonical
+  for(auto it = files.begin(); it != files.end(); ++it){
+    boost::system::error_code ec;
+    string path = file_functions::getCanonicalPathToSymlink(*it, ec).string();
+    if(ec.value() != boost::system::errc::success){
+      err() << "cannot access " << *it << ": " << ec.message() << endl;
+      it = files.erase(it);
+      if(it == files.end()) break;
+    }else{
+      *it = move(path);
+      if(oVerbose)
+        cout << *it << endl;
+    }
+  }
+
+  bool success;
+  fclip.Remove(files, true, serverMessages, success);
+  return success;
 }

 bool list_run(const vector<string> &argv, FclipClient &fclip){
@@ -545,8 +552,9 @@
     "Display help information about a command."
   ));
   commands.emplace("add", Command(add_run, add_options,
-    "usage: fclip add [<options>] <files>...\n\n"
-    "Add one or more files to the clipboard."
+    "usage: fclip add [<options>] [<files>...]\n\n"
+    "Add one or more files to the clipboard. If no files are specified\n"
+    "as arguments, they will be read from standard input."
   ));
   commands.emplace("clear", Command(clear_run, clear_options,
     "usage: fclip clear\n\n"
@@ -565,9 +573,10 @@
     "List all files from the current directory that are in the clipboard."
   ));
   commands.emplace("remove", Command(remove_run, remove_options,
-    "usage: fclip remove [<options>] <files>...\n"
+    "usage: fclip remove [<files>...]\n"
     "alias: rm\n\n"
-    "Remove one or more files from the clipboard."
+    "Remove one or more files from the clipboard. If no files are specified\n"
+    "as arguments, they will be read from standard input."
   ));
   oss.str("");
   oss << "usage: fclip stash [ push | pop [<id>] | drop [<id>] | list | clear ]\n\n"


INTEGRATION: CWS changefileheader (1.5.20); FILE MERGED 2008/03/28 16:43:33 rt 1.5.20.1: #i87441# Change license header to LPGL v3.

--- chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -1,35 +1,30 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: tp_Wizard_TitlesAndObjects.cxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.5 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: kz $ $Date: 2008-03-06 19:18:01 $
+ * $RCSfile: tp_Wizard_TitlesAndObjects.cxx,v $
+ * $Revision: 1.6 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/


Autocomplete: Fix a typo that flipped the extension keyword provider check for enabling in incognito mode.

This is deliberately kept small for easy merging.

BUG=409705

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

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#293481}

--- chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc
+++ chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc
@@ -57,7 +57,7 @@
       extension_service->GetExtensionById(extension_id, false);
   return extension &&
       (!profile_->IsOffTheRecord() ||
-       !extensions::util::IsIncognitoEnabled(extension_id, profile_));
+       extensions::util::IsIncognitoEnabled(extension_id, profile_));
 }

 bool KeywordExtensionsDelegateImpl::Start(


Form AutoFill Phone number should be displayed as xxx-xxx-xxxx

Modifies the AutoFill label inferencing logic to skip over <img> tags when deriving labels.  It is common to use
small images as spacers between elements.  Also, extends the phone number heuristics to recognize numbers that are
split into three fields of the form [xxx]-[yyy]-[zzzz] where xxx is the area code, yyy is the phone number prefix and zzz
is the phone number suffix.

Note: This change has a dependency on WebKit change: https://bugs.webkit.org/show_bug.cgi?id=38825.
Will need to wait for that to land before committing this change.

BUG=38218
TEST=FormManagerTest.LabelsInferredWithImageTags:FormStructureTest.ThreePartPhoneNumber:PhoneFieldTest.ThreePartPhoneNumber

TBR:jhawkins@chromium.org

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

--- chrome/test/live_sync/two_client_live_autofill_sync_unittest.cc
+++ chrome/test/live_sync/two_client_live_autofill_sync_unittest.cc
@@ -190,7 +190,8 @@
           webkit_glue::FormField(string16(),
                                  (*i).name(),
                                  (*i).value(),
-                                 string16()));
+                                 string16(),
+                                 0));
     }

     WaitableEvent done_event(false, false);


Fix wake verb reinit

Fix wake verb reinit

--- AppleALC/kern_alc.cpp
+++ AppleALC/kern_alc.cpp
@@ -170,12 +170,10 @@
 			uint32_t alcId;
 			if (WIOKit::getOSDataValue(hdaService, "alc-layout-id", alcId)) {
 				DBGLOG("alc", "found normal alc-layout-id %u", alcId);
-			} else if (info->firmwareVendor != DeviceInfo::FirmwareVendor::Apple) {
-				uint32_t legacyId;
-				if (WIOKit::getOSDataValue(hdaService, "layout-id", legacyId)) {
-					DBGLOG("audio", "found legacy alc-layout-id (from layout-id) %u", legacyId);
-					hdaService->setProperty("alc-layout-id", &legacyId, sizeof(legacyId));
-				}
+			} else if (info->firmwareVendor != DeviceInfo::FirmwareVendor::Apple &&
+					   WIOKit::getOSDataValue(hdaService, "layout-id", alcId)) {
+				DBGLOG("audio", "found legacy alc-layout-id (from layout-id) %u", alcId);
+				hdaService->setProperty("alc-layout-id", &alcId, sizeof(alcId));
 			}
 		}

@@ -257,7 +255,7 @@

 		if (pinStatus && sleepStatus) {
 			bool pin = pinStatus->getValue();
-			bool sleep = pinStatus->getValue();
+			bool sleep = sleepStatus->getValue();
 			DBGLOG("alc", "power change %s at %s from %u to %u in from pin %d sleep %d",
 				   safeString(hdaDriver->getName()), safeString(hdaCodec->getName()), from, to, pin, sleep);