Don't use &* when get() will suffice; NFC.

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

--- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -3320,22 +3320,22 @@
     case RefVal::ErrorUseAfterRelease:
       if (!useAfterRelease)
         useAfterRelease.reset(new UseAfterRelease(this));
-      BT = &*useAfterRelease;
+      BT = useAfterRelease.get();
       break;
     case RefVal::ErrorReleaseNotOwned:
       if (!releaseNotOwned)
         releaseNotOwned.reset(new BadRelease(this));
-      BT = &*releaseNotOwned;
+      BT = releaseNotOwned.get();
       break;
     case RefVal::ErrorDeallocGC:
       if (!deallocGC)
         deallocGC.reset(new DeallocGC(this));
-      BT = &*deallocGC;
+      BT = deallocGC.get();
       break;
     case RefVal::ErrorDeallocNotOwned:
       if (!deallocNotOwned)
         deallocNotOwned.reset(new DeallocNotOwned(this));
-      BT = &*deallocNotOwned;
+      BT = deallocNotOwned.get();
       break;
   }


Remove unused overload from ArrayBufferAllocator.

R=jochen@chromium.org

Review URL: https://chromiumcodereview.appspot.com/23694051

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@158265 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/bindings/v8/V8Binding.cpp
+++ Source/bindings/v8/V8Binding.cpp
@@ -117,11 +117,6 @@
         return data;
     }

-    virtual void Free(void*)
-    {
-        IMMEDIATE_CRASH();
-    }
-
     virtual void Free(void* data, size_t size) OVERRIDE
     {
         WTF::ArrayBufferContents::freeMemory(data, size);


Removed a log message. It is no longer needed.

--- Rotation/dragonfly-v3.4/source/Exit.cpp
+++ Rotation/dragonfly-v3.4/source/Exit.cpp
@@ -11,7 +11,6 @@
 	GameState->Stage1.exit.y += GameState->Bounds.minY;
 	Position pos(GameState->Stage1.exit.x, GameState->Stage1.exit.y);
 	setPosition(pos);
-	l.writeLog("[Exit] New position: %d %d", pos.getX(), pos.getY());

 	registerInterest(DF_STEP_EVENT);


Added comment regarding heartbeat wait window.

--- agent/agent.cpp
+++ agent/agent.cpp
@@ -920,7 +920,11 @@
           // Sleep the remainder
           dlib::sleep((interMicros - delta) / 1000);
         }
-      } else if (observer.wait(aHeartbeat)) {
+      } else if (observer.wait(aHeartbeat)) {
+        // Last window... observer may be signaled just when wait begins. Will wait for next
+        // event or timeout. Need to hold the sequence mutex as well as the observer. Should
+        // change change observer to do this...
+
         // Get the sequence # signaled in the observer when the lastest event arrived.
         // This will allow the next set of data to be pulled. Any later events will have
         // greater sequence numbers, so this should not cause a problem. Also, signaled
@@ -941,9 +945,16 @@
         // will be set to the latest event or UINT64_MAX. Otherwise, nothing has arrived and
         // we set to the next sequence number and release the lock.
         dlib::auto_mutex lock(*mSequenceLock);
-        start = observer.getSequence();
-        if (start > mSequence)
+
+        if (observer.getSequence() < UINT64_MAX)
+          start = observer.getSequence();
+        else
           start = mSequence;
+
+        // How do we ensure we never skip any events and don't fall too far behind.
+        // Still not sure this is correct. start = mSequence requires that there
+        // have been no events since last fetch. This should be ensured by the
+        // sequence lock.
       }
     }
   }


Fixed duplicate checking for for multiple disconnects. Need to use the adapter dup check.

--- agent/agent.cpp
+++ agent/agent.cpp
@@ -729,7 +729,7 @@
             value = &sUnavailable;
           }

-          if (value != NULL && !dataItem->isDuplicate(*value))
+          if (value != NULL && !anAdapter->isDuplicate(dataItem, *value))
             addToBuffer(dataItem, *value, time);
         }
       } else if (dataItem == NULL) {


Can control each light property seperately with shift key

--- source/renderlib/SimpleDFPathTracer.cpp
+++ source/renderlib/SimpleDFPathTracer.cpp
@@ -394,42 +394,49 @@
 {
   PointerInfo& pi = pointers[0];
   _mousePos = pi.pos;
-  if(pi.down)
-  {
-    _currLights[0].x += pi.velocity.x;
-    _currLights[0].y += pi.velocity.y;
+  int lidx = 0;
+  if(InputManager::getShiftDown())
+    lidx = 1;
+  if(pi.down && pi.dragging)
+  {
+    _currLights[lidx].x += pi.velocity.x;
+    _currLights[lidx].z += pi.velocity.y;
     printf("light0: %2.4f, %2.4f, %2.4f, %2.4f   brightness: %2.4f\n",
-           _currLights[0].x,
-           _currLights[0].y,
-           _currLights[0].z,
-           _currLights[0].w,
-           _currLightColors[0].x);
-    resetFBOs();
-  }
-  if(pi.rdown)
-  {
-    _currLights[0].z += pi.velocity.x;
-    _currLights[0].w += pi.velocity.y;
+           _currLights[lidx].x,
+           _currLights[lidx].y,
+           _currLights[lidx].z,
+           _currLights[lidx].w,
+           _currLightColors[lidx].x);
+    resetFBOs();
+  }
+  if(pi.rdown && pi.dragging)
+  {
+    //Light height = right drag vertical
+    _currLights[lidx].y += pi.velocity.x;

     printf("light0: %2.4f, %2.4f, %2.4f, %2.4f   brightness: %2.4f\n",
-           _currLights[0].x,
-           _currLights[0].y,
-           _currLights[0].z,
-           _currLights[0].w,
-           _currLightColors[0].x);
-    resetFBOs();
-  }
-  if(pi.wdown)
-  {
-    float c = _currLightColors[0].x;
-    _currLightColors[0] = vec3(pi.velocity.y+c);
+           _currLights[lidx].x,
+           _currLights[lidx].y,
+           _currLights[lidx].z,
+           _currLights[lidx].w,
+           _currLightColors[lidx].x);
+    resetFBOs();
+  }
+  if(pi.wdown && pi.dragging)
+  {
+    //Intensity = middle drag horizontal
+    float c = _currLightColors[lidx].x;
+    _currLightColors[lidx] = vec3(pi.velocity.x+c);
+
+    //Size = middle drag vertical
+    _currLights[lidx].w += pi.velocity.y;

     printf("light0: %2.4f, %2.4f, %2.4f, %2.4f   brightness: %2.4f\n",
-           _currLights[0].x,
-           _currLights[0].y,
-           _currLights[0].z,
-           _currLights[0].w,
-           _currLightColors[0].x);
+           _currLights[lidx].x,
+           _currLights[lidx].y,
+           _currLights[lidx].z,
+           _currLights[lidx].w,
+           _currLightColors[lidx].x);
     resetFBOs();
   }


RawFifoQueue: add local PopFunctor class

--- source/synchronization/RawFifoQueue.cpp
+++ source/synchronization/RawFifoQueue.cpp
@@ -8,7 +8,7 @@
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
  * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * \date 2014-12-31
+ * \date 2015-01-01
  */

 #include "distortos/RawFifoQueue.hpp"
@@ -27,6 +27,47 @@
 /*---------------------------------------------------------------------------------------------------------------------+
 | local types
 +---------------------------------------------------------------------------------------------------------------------*/
+
+/// PopFunctor is a functor used for popping of data from the RawFifoQueue
+class PopFunctor : public scheduler::FifoQueueBase::Functor
+{
+public:
+
+	/**
+	 * \brief PopFunctor's constructor
+	 *
+	 * \param [out] buffer is a pointer to buffer for popped element
+	 * \param [in] size is the size of \a buffer, bytes
+	 */
+
+	constexpr PopFunctor(void* const buffer, const size_t size) :
+			buffer_{buffer},
+			size_{size}
+	{
+
+	}
+
+	/**
+	 * \brief Copies the data from RawFifoQueue's storage (with memcpy()) and increments the storage pointer to next
+	 * position (using the size of element).
+	 *
+	 * \param [in,out] storage is a reference to pointer to queue's storage
+	 */
+
+	virtual void operator()(void*& storage) const override
+	{
+		memcpy(buffer_, storage, size_);
+		storage = static_cast<uint8_t*>(storage) + size_;
+	}
+
+private:
+
+	/// pointer to buffer for popped element
+	void* const buffer_;
+
+	/// size of \a buffer_, bytes
+	const size_t size_;
+};

 /// PushFunctor is a functor used for pushing of data to the RawFifoQueue
 class PushFunctor : public scheduler::FifoQueueBase::Functor


Ease abort criterion for variance shift on energy reduction operation

Former-commit-id: 22cb949ff07cc6f956a3e73656b95dcd776e61d1

--- source/tensors/class_tensors_finite.cpp
+++ source/tensors/class_tensors_finite.cpp
@@ -137,9 +137,11 @@
         double critical_cancellation_max_decimals = 15.0 - std::log10(std::pow(static_cast<double>(get_length()) * site_energy.value(), 2));
         double critical_cancellation_error        = std::pow(10, -critical_cancellation_max_decimals);
         double variance_change                    = std::abs(var_bef_reset - var_aft_compr);
-        if(variance_change > 100 * critical_cancellation_error) {
-            tools::log->warn("Energy reduction changed the variance significantly: {:.4f}%", variance_change / var_bef_reset * 100);
-            throw std::runtime_error("Energy reduction changed the variance significantly");
+        if(variance_change > 100 * critical_cancellation_error){
+            tools::log->warn("Energy reduction changed the variance significantly: {:.16f}%", variance_change / var_bef_reset * 100);
+        }
+        if(variance_change > 1e6 * critical_cancellation_error) {
+            throw std::runtime_error("Energy reduction destroyed variance precision");
         }
     }
 }


again

again

--- WiFiManager.cpp
+++ WiFiManager.cpp
@@ -674,7 +674,7 @@
  */
 void WiFiManager::handleWifiSave() {
   DEBUG_WM(F("WiFi save"));
-
+
   //SAVE/connect here
   _ssid = server->arg("s").c_str();
   _pass = server->arg("p").c_str();
@@ -864,7 +864,7 @@
   _configPortalIsBlocking = shoudlBlock;
 }

-//wrapper for ESP wifi.persistent so we can remember it as WIFi._persistent is protected
+//setter for ESP wifi.persistent so we can remember it and restore user preference, as WIFi._persistent is protected
 void WiFiManager::setRestorePersistent(boolean persistent) {
   _userpersistent = persistent;
   if(!persistent) DEBUG_WM(F("persistent is off"));


warning--

warning--

--- gstreamer/plugininstaller.cpp
+++ gstreamer/plugininstaller.cpp
@@ -189,7 +189,7 @@
     } else {
         emit started();
     }
-    for(i;i>0;i--)
+    for(; i > 0; i--)
         free(details[i]);
     reset();
 }


fix customhtml parameters

fix customhtml parameters

--- WiFiManager.cpp
+++ WiFiManager.cpp
@@ -98,13 +98,15 @@
 bool WiFiManager::addParameter(WiFiManagerParameter *p) {

   // check param id is valid
-  for (int i = 0; i < strlen(p->getID()); i++){
-     if(!isAlphaNumeric(p->getID()[i])){
-      DEBUG_WM("[ERROR] parameter IDs can only contain alpha numeric chars");
-      return false;
-     }
-  }
-
+  // check param id is valid, unless null
+  if(p->getID()){
+    for (int i = 0; i < strlen(p->getID()); i++){
+       if(!isAlphaNumeric(p->getID()[i])){
+        DEBUG_WM("[ERROR] parameter IDs can only contain alpha numeric chars");
+        return false;
+       }
+    }
+  }
   if(_params == NULL){
     DEBUG_WM("allocating params bytes:",_max_params * sizeof(WiFiManagerParameter*));
     _params = (WiFiManagerParameter**)malloc(_max_params * sizeof(WiFiManagerParameter*));
@@ -153,6 +155,7 @@

   setMenu(_menuIds);
   _max_params = WIFI_MANAGER_MAX_PARAMS;
+  DEBUG_WM("allocating",_max_params * sizeof(WiFiManagerParameter*));
 }

 // destructor


VideoDataOutput is no longer a source, just a sink

--- gstreamer/videodataoutput.cpp
+++ gstreamer/videodataoutput.cpp
@@ -39,7 +39,7 @@

 VideoDataOutput::VideoDataOutput(Backend *backend, QObject *parent)
     : QObject(parent),
-    MediaNode(backend, VideoSink | VideoSource),
+    MediaNode(backend, VideoSink),
 	m_frontend(0)
 {
     static int count = 0;
@@ -49,7 +49,6 @@
     gst_object_ref(GST_OBJECT(m_queue));
     gst_object_sink(GST_OBJECT(m_queue));

-    GstElement* tee = gst_element_factory_make("tee", NULL);
     GstElement* sink = gst_element_factory_make("fakesink", NULL);
     GstElement* queue = gst_element_factory_make("queue", NULL);
     GstElement* convert = gst_element_factory_make("ffmpegcolorspace", NULL);
@@ -65,19 +64,15 @@
                                         "endianess", G_TYPE_INT, G_BYTE_ORDER,
                                         NULL);

-    gst_bin_add_many(GST_BIN(m_queue), tee, sink, convert, queue, NULL);
-    gst_element_link(tee, queue);
+    gst_bin_add_many(GST_BIN(m_queue), sink, convert, queue, NULL);
     gst_element_link(queue, convert);
     gst_element_link_filtered(convert, sink, caps);
     gst_caps_unref(caps);

-    GstPad *inputpad = gst_element_get_static_pad(tee, "sink");
+    GstPad *inputpad = gst_element_get_static_pad(queue, "sink");
     gst_element_add_pad(m_queue, gst_ghost_pad_new("sink", inputpad));
     gst_object_unref(inputpad);

-    GstPad *outputpad = gst_element_get_request_pad(tee, "src%d");
-    gst_element_add_pad(m_queue, gst_ghost_pad_new("src", outputpad));
-    gst_object_unref(outputpad);
     g_object_set(G_OBJECT(sink), "sync", true, (const char*)NULL);

     m_isValid = true;


Minor doc change

Minor doc change

--- lax/vectors.cc
+++ lax/vectors.cc
@@ -263,6 +263,13 @@
 /*! \class flatvector
  * \brief 2 Dimensional vector (x,y)
  */
+/*! \var flatvector::info
+ * This is used by some functions to store the type of point this represents, for
+ * instance by points returned from draw_thing_coordinates(), or points drawn by
+ * Displayer::drawFormattedPoints().
+ *
+ * Namely, see PointInfoTags.
+ */

 //! Make a unit vector, preserving angle. If null vector, do nothing.
 void flatvector::normalize()


hotfix #576

hotfix #576

--- WiFiManager.cpp
+++ WiFiManager.cpp
@@ -143,18 +143,17 @@
   dnsServer->start(DNS_PORT, "*", WiFi.softAPIP());

   /* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */
-  server->on(String(F("/")), std::bind(&WiFiManager::handleRoot, this));
-  server->on(String(F("/wifi")), std::bind(&WiFiManager::handleWifi, this, true));
-  server->on(String(F("/0wifi")), std::bind(&WiFiManager::handleWifi, this, false));
-  server->on(String(F("/wifisave")), std::bind(&WiFiManager::handleWifiSave, this));
-  server->on(String(F("/i")), std::bind(&WiFiManager::handleInfo, this));
-  server->on(String(F("/r")), std::bind(&WiFiManager::handleReset, this));
+  server->on(String(F("/")).c_str(), std::bind(&WiFiManager::handleRoot, this));
+  server->on(String(F("/wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, true));
+  server->on(String(F("/0wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, false));
+  server->on(String(F("/wifisave")).c_str(), std::bind(&WiFiManager::handleWifiSave, this));
+  server->on(String(F("/i")).c_str(), std::bind(&WiFiManager::handleInfo, this));
+  server->on(String(F("/r")).c_str(), std::bind(&WiFiManager::handleReset, this));
   //server->on("/generate_204", std::bind(&WiFiManager::handle204, this));  //Android/Chrome OS captive portal check.
-  server->on(String(F("/fwlink")), std::bind(&WiFiManager::handleRoot, this));  //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
+  server->on(String(F("/fwlink")).c_str(), std::bind(&WiFiManager::handleRoot, this));  //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
   server->onNotFound (std::bind(&WiFiManager::handleNotFound, this));
   server->begin(); // Web server start
   DEBUG_WM(F("HTTP server started"));
-
 }

 boolean WiFiManager::autoConnect() {


tweak webserver sample

tweak webserver sample

--- Samples/WebServer/Sources/WebServer.cpp
+++ Samples/WebServer/Sources/WebServer.cpp
@@ -40,11 +40,16 @@
 using Time::Duration;

 namespace {
-    Sequence<pair<RegularExpression, CacheControl>> kCacheControlSettings_{
+    Sequence<pair<RegularExpression, CacheControl>> kCacheControlSettings_
+    {
 #if __cpp_designated_initializers
-        {RegularExpression{L".*\\.gif", CompareOptions::eCaseInsensitive}, CacheControl{.fMaxAge = Duration{24h}.As<int32_t> ()}}
+        {
+            RegularExpression{L".*\\.gif", CompareOptions::eCaseInsensitive}, CacheControl { .fMaxAge = Duration{24h}.As<int32_t> () }
+        }
 #else
-        {RegularExpression{L".*\\.gif", CompareOptions::eCaseInsensitive}, CacheControl{nullopt, Duration{24h}.As<int32_t> ()}}
+        {
+            RegularExpression{L".*\\.gif", CompareOptions::eCaseInsensitive}, CacheControl { nullopt, Duration{24h}.As<int32_t> () }
+        }
 #endif
     };

@@ -63,12 +68,10 @@
         MyWebServer_ (uint16_t portNumber)
             : kRoutes_
         {
-            Route{L""_RegEx, DefaultPage_},
-                Route{HTTP::MethodsRegEx::kPost, L"SetAppState"_RegEx, SetAppState_},
-                Route{L"FRED"_RegEx, [] (Request*, Response* response) {
-                          response->write (L"FRED");
-                          response->contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
-                      }},
+            Route{L""_RegEx, DefaultPage_}, Route{HTTP::MethodsRegEx::kPost, L"SetAppState"_RegEx, SetAppState_}, Route{L"FRED"_RegEx, [] (Request*, Response* response) {
+                                                                                response->contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
+                                                                                response->write (L"FRED");
+                                                                                }},
                 Route
             {
                 L"Files/.*"_RegEx, FileSystemRequestHandler { Execution::GetEXEDir () / L"html", kFSHandlersOptions_ }
@@ -110,9 +113,9 @@
         // Can declare arguments as Message* message
         static void SetAppState_ (Message* message)
         {
-            String argsAsString = Streams::TextReader::New (message->rwRequest ().GetBody ()).ReadAll ();
+            message->rwResponse ().contentType = DataExchange::InternetMediaTypes::kHTML;
+            String argsAsString                = Streams::TextReader::New (message->rwRequest ().GetBody ()).ReadAll ();
             message->rwResponse ().writeln (L"
Hi SetAppState (" + argsAsString.As<wstring> () + L")
");
-            message->rwResponse ().contentType = DataExchange::InternetMediaTypes::kHTML;
         }
     };
 }


More work in the parsing

More work in the parsing

--- XMLDocument.cpp
+++ XMLDocument.cpp
@@ -108,7 +108,17 @@

     const XMLObject *object = dynamic_cast<const XMLObject*>(&doc);
     DOMDocument     *document = parser.getDocument();
+
+    if(!object)     throw runtime_error(doc.getName() + " is not a sibling class of XMLObject");
+    if(!document)   throw runtime_error("Failed to parse document");
+
     DOMElement      *root = document->getDocumentElement();
+
+    if(!root)       throw runtime_error("Failed to get document root");
+
+    //check that the name of the root node matches the name of the XMLDocument
+    if(!root->getLocalName() || X(root->getLocalName()) != doc.getName())
+        throw runtime_error("No local name for DOM document or supplied XML is not a " + doc.getName());

     return is;
 }


[asan] Hopefully fix the RTL build on Windows (part 2)

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

--- lib/asan/asan_report.cc
+++ lib/asan/asan_report.cc
@@ -340,7 +340,7 @@
   PrintStack(&alloca_stack);
   // Report the number of stack objects.
   char *p;
-  u64 n_objects = (uptr)internal_simple_strtoll(frame_descr, &p, 10);
+  uptr n_objects = (uptr)internal_simple_strtoll(frame_descr, &p, 10);
   CHECK_GT(n_objects, 0);
   Printf("  This frame has %zu object(s):\n", n_objects);

@@ -369,7 +369,7 @@
     internal_strncat(buf, vars[i].name_pos,
                      static_cast<uptr>(Min(kBufSize, vars[i].name_len)));
     uptr prev_var_end = i ? vars[i - 1].beg + vars[i - 1].size : 0;
-    uptr next_var_beg = i < n_objects - 1 ? vars[i + 1].beg : ~(0UL);
+    uptr next_var_beg = i + 1 < n_objects ? vars[i + 1].beg : ~(0UL);
     PrintAccessAndVarIntersection(buf, vars[i].beg, vars[i].size,
                                   offset, access_size,
                                   prev_var_end, next_var_beg);


Add tests for piecewise subsurface splitting routines.

--- test/geom/piecewise_surface/piecewise_surface_test_suite.hpp
+++ test/geom/piecewise_surface/piecewise_surface_test_suite.hpp
@@ -891,7 +891,7 @@

     void split_test()
     {
-      piecewise_surface_type ps1, ps2;
+      piecewise_surface_type ps1, ps2, pbefore, pafter;
       data_type u, v;

       // create 3x2 patches with unit spacing
@@ -1006,6 +1006,91 @@
       TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), ps2.f(u, v)));
       TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), ps2.f_u(u, v)));
       TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), ps2.f_v(u, v)));
+
+      // split u-direction
+      ps2 = ps1;
+      ps2.split_u(pbefore, pafter, 1.5);
+
+      // test evaluation before split
+      u=0.25;
+      v=1.5;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation before split
+      u=1.25;
+      v=1.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation at split, before surface
+      u=1.5;
+      v=1.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation at split, after surface
+      u=1.5;
+      v=0.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pafter.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pafter.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pafter.f_v(u, v)));
+
+      // test evaluation after split
+      u=1.75;
+      v=0.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pafter.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pafter.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pafter.f_v(u, v)));
+
+      // test evaluation after split
+      u=2.25;
+      v=0.25;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pafter.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pafter.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pafter.f_v(u, v)));
+
+      // split v-direction
+      ps2=ps1;
+      ps2.split_v(pbefore, pafter, 1.5);
+
+      // test evaluation before split
+      u=0.25;
+      v=0.5;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation before split
+      u=1.25;
+      v=0.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation at split
+      u=1.5;
+      v=1.5;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pbefore.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pbefore.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pbefore.f_v(u, v)));
+
+      // test evaluation at split
+      u=1.5;
+      v=1.5;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pafter.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pafter.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pafter.f_v(u, v)));
+
+      // test evaluation after split
+      u=1.75;
+      v=1.75;
+      TEST_ASSERT(tol.approximately_equal(ps1.f(u, v), pafter.f(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_u(u, v), pafter.f_u(u, v)));
+      TEST_ASSERT(tol.approximately_equal(ps1.f_v(u, v), pafter.f_v(u, v)));
     }

     void to_cubic_test()


SofaTopologyMapping: Fix ambiguous call for MSVC

Former-commit-id: 0c165063bee18da308d6212736dc1343c6e428d6

--- modules/SofaTopologyMapping/Bezier2MeshMechanicalMapping.inl
+++ modules/SofaTopologyMapping/Bezier2MeshMechanicalMapping.inl
@@ -112,7 +112,7 @@
 			u=(Real)i/(Real)bezierTesselation;
 			v=(Real)(1.0f-u);
 			for(j=0;j<=bezierDegree;++j){
-				weightArray[j]=(Real)(pow(u,j)*pow(v,bezierDegree-j)*sofa::component::topology::binomial<Real>(bezierDegree-j,j));
+				weightArray[j]=(Real)(pow(u,(int)j)*pow(v,(int)(bezierDegree-j))*sofa::component::topology::binomial<Real>(bezierDegree-j,j));
 			}
 			precomputedLinearBernsteinCoefficientArray[i-1]=weightArray;
 		}


DefaultVideoQualityAnalyzer cleanup.

DefaultVideoQualityAnalyzer cleanup.

Remove done todos

Bug: webrtc:10138
Change-Id: I33ad6da41bf51a0ed3bafd5ae671f94d00e16ce3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127563
Reviewed-by: Mirko Bonadei <d2c43c210eae6feef04f53bae50885e8152edcca@webrtc.org>
Commit-Queue: Artem Titov <1e27363ccc366a7ff0fdde48204d68d5ebfeccc5@webrtc.org>
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#27109}

--- test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
+++ test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
@@ -135,7 +135,6 @@
     uint16_t frame_id,
     const webrtc::EncodedImage& encoded_image) {
   rtc::CritScope crit(&lock_);
-  // TODO(titovartem) we need to pick right spatial index here.
   auto it = frame_stats_.find(frame_id);
   RTC_DCHECK(it != frame_stats_.end());
   RTC_DCHECK(it->second.encoded_time.IsInfinite())
@@ -154,7 +153,6 @@
 void DefaultVideoQualityAnalyzer::OnFrameReceived(
     uint16_t frame_id,
     const webrtc::EncodedImage& input_image) {
-  // TODO(titovartem) We should always receive only single spatial layer here.
   rtc::CritScope crit(&lock_);
   auto it = frame_stats_.find(frame_id);
   RTC_DCHECK(it != frame_stats_.end());


Simplify compilation of CallIC interceptor stub.
Review URL: http://codereview.chromium.org/604054

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

--- src/arm/stub-cache-arm.cc
+++ src/arm/stub-cache-arm.cc
@@ -408,51 +408,6 @@
 }

-template <class Compiler>
-static void CompileLoadInterceptor(Compiler* compiler,
-                                   StubCompiler* stub_compiler,
-                                   MacroAssembler* masm,
-                                   JSObject* object,
-                                   JSObject* holder,
-                                   String* name,
-                                   LookupResult* lookup,
-                                   Register receiver,
-                                   Register scratch1,
-                                   Register scratch2,
-                                   Label* miss) {
-  ASSERT(holder->HasNamedInterceptor());
-  ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
-
-  // Check that the receiver isn't a smi.
-  __ BranchOnSmi(receiver, miss);
-
-  // Check that the maps haven't changed.
-  Register reg =
-      stub_compiler->CheckPrototypes(object, receiver, holder,
-                                     scratch1, scratch2, name, miss);
-
-  if (lookup->IsValid() && lookup->IsCacheable()) {
-    compiler->CompileCacheable(masm,
-                               stub_compiler,
-                               receiver,
-                               reg,
-                               scratch1,
-                               scratch2,
-                               holder,
-                               lookup,
-                               name,
-                               miss);
-  } else {
-    compiler->CompileRegular(masm,
-                             receiver,
-                             reg,
-                             scratch2,
-                             holder,
-                             miss);
-  }
-}
-
-
 static void PushInterceptorArguments(MacroAssembler* masm,
                                      Register receiver,
                                      Register holder,
@@ -619,108 +574,48 @@
 };

-class CallInterceptorCompiler BASE_EMBEDDED {
- public:
-  CallInterceptorCompiler(const ParameterCount& arguments, Register name)
-      : arguments_(arguments), argc_(arguments.immediate()), name_(name) {}
-
-  void CompileCacheable(MacroAssembler* masm,
-                        StubCompiler* stub_compiler,
-                        Register receiver,
-                        Register holder,
-                        Register scratch1,
-                        Register scratch2,
-                        JSObject* holder_obj,
-                        LookupResult* lookup,
-                        String* name,
-                        Label* miss_label) {
-    JSFunction* function = 0;
-    bool optimize = false;
-    // So far the most popular case for failed interceptor is
-    // CONSTANT_FUNCTION sitting below.
-    if (lookup->type() == CONSTANT_FUNCTION) {
-      function = lookup->GetConstantFunction();
-      // JSArray holder is a special case for call constant function
-      // (see the corresponding code).
-      if (function->is_compiled() && !holder_obj->IsJSArray()) {
-        optimize = true;
-      }
-    }
-
-    if (!optimize) {
-      CompileRegular(masm, receiver, holder, scratch2, holder_obj, miss_label);
-      return;
-    }
-
-    // Constant functions cannot sit on global object.
-    ASSERT(!lookup->holder()->IsGlobalObject());
-
-    __ EnterInternalFrame();
-    __ push(holder);  // Save the holder.
-    __ push(name_);  // Save the name.
-
-    CompileCallLoadPropertyWithInterceptor(masm,
-                                           receiver,
-                                           holder,
-                                           name_,
-                                           holder_obj);
-
-    ASSERT(!r0.is(name_));
-    ASSERT(!r0.is(scratch1));
-    __ pop(name_);  // Restore the name.
-    __ pop(scratch1);  // Restore the holder.
-    __ LeaveInternalFrame();
-
-    // Compare with no_interceptor_result_sentinel.
-    __ LoadRoot(scratch2, Heap::kNoInterceptorResultSentinelRootIndex);
-    __ cmp(r0, scratch2);
-    Label invoke;
-    __ b(ne, &invoke);
-
-    stub_compiler->CheckPrototypes(holder_obj, scratch1,
-                                   lookup->holder(), scratch1,
-                                   scratch2,
-                                   name,
-                                   miss_label);
-    GenerateCallConstFunction(masm, function, arguments_);
-
-    __ bind(&invoke);
-  }
-
-  void CompileRegular(MacroAssembler* masm,
-                      Register receiver,
-                      Register holder,
-                      Register scratch,
-                      JSObject* holder_obj,
-                      Label* miss_label) {
-    __ EnterInternalFrame();
-    // Save the name_ register across the call.
-    __ push(name_);
-
-    PushInterceptorArguments(masm,
+static void CompileLoadInterceptor(LoadInterceptorCompiler* compiler,
+                                   StubCompiler* stub_compiler,
+                                   MacroAssembler* masm,
+                                   JSObject* object,
+                                   JSObject* holder,
+                                   String* name,
+                                   LookupResult* lookup,
+                                   Register receiver,
+                                   Register scratch1,
+                                   Register scratch2,
+                                   Label* miss) {
+  ASSERT(holder->HasNamedInterceptor());
+  ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
+
+  // Check that the receiver isn't a smi.
+  __ BranchOnSmi(receiver, miss);
+
+  // Check that the maps haven't changed.
+  Register reg =
+      stub_compiler->CheckPrototypes(object, receiver, holder,
+                                     scratch1, scratch2, name, miss);
+
+  if (lookup->IsValid() && lookup->IsCacheable()) {
+    compiler->CompileCacheable(masm,
+                               stub_compiler,
+                               receiver,
+                               reg,
+                               scratch1,
+                               scratch2,
+                               holder,
+                               lookup,
+                               name,
+                               miss);
+  } else {
+    compiler->CompileRegular(masm,
                              receiver,
+                             reg,
+                             scratch2,
                              holder,
-                             name_,
-                             holder_obj);
-
-    ExternalReference ref = ExternalReference(
-        IC_Utility(IC::kLoadPropertyWithInterceptorForCall));
-    __ mov(r0, Operand(5));
-    __ mov(r1, Operand(ref));
-
-    CEntryStub stub(1);
-    __ CallStub(&stub);
-
-    // Restore the name_ register.
-    __ pop(name_);
-    __ LeaveInternalFrame();
-  }
-
- private:
-  const ParameterCount& arguments_;
-  int argc_;
-  Register name_;
-};
+                             miss);
+  }
+}

 #undef __
@@ -764,7 +659,7 @@
     object = JSObject::cast(object->GetPrototype());
   }

-  // Return the register containin the holder.
+  // Return the register containing the holder.
   return result;
 }

@@ -1075,7 +970,14 @@
   // ----------- S t a t e -------------
   //  -- lr: return address
   // -----------------------------------
-  Label miss;
+  ASSERT(holder->HasNamedInterceptor());
+  ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
+  Label miss;
+
+  const Register receiver = r0;
+  const Register name_reg = r1;
+  const Register holder_reg = r2;
+  const Register scratch = r3;

   // Get the number of arguments.
   const int argc = arguments().immediate();
@@ -1083,28 +985,88 @@
   LookupResult lookup;
   LookupPostInterceptor(holder, name, &lookup);

-  // Get the receiver from the stack into r0.
-  __ ldr(r0, MemOperand(sp, argc * kPointerSize));
-  // Load the name from the stack into r1.
-  __ ldr(r1, MemOperand(sp, (argc + 1) * kPointerSize));
-
-  CallInterceptorCompiler compiler(arguments(), r1);
-  CompileLoadInterceptor(&compiler,
-                         this,
-                         masm(),
-                         JSObject::cast(object),
-                         holder,
-                         name,
-                         &lookup,
-                         r0,
-                         r2,
-                         r3,
-                         &miss);
+  // Load the receiver from the stack.
+  __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
+  // Load the name from the stack.
+  __ ldr(name_reg, MemOperand(sp, (argc + 1) * kPointerSize));
+
+  // Check that the receiver isn't a smi.
+  __ BranchOnSmi(receiver, &miss);
+
+  // Check that the maps haven't changed.
+  Register reg =
+      CheckPrototypes(JSObject::cast(object), receiver, holder,
+                      holder_reg, scratch, name, &miss);
+  if (!reg.is(holder_reg)) {
+    __ mov(holder_reg, reg);
+  }
+
+  // If we call a constant function when the interceptor returns
+  // the no-result sentinel, generate code that optimizes this case.
+  if (lookup.IsValid() &&
+      lookup.IsCacheable() &&
+      lookup.type() == CONSTANT_FUNCTION &&
+      lookup.GetConstantFunction()->is_compiled() &&
+      !holder->IsJSArray()) {
+    // Constant functions cannot sit on global object.
+    ASSERT(!lookup.holder()->IsGlobalObject());
+
+    // Call the interceptor.
+    __ EnterInternalFrame();
+    __ push(holder_reg);
+    __ push(name_reg);
+    CompileCallLoadPropertyWithInterceptor(masm(),
+                                           receiver,
+                                           holder_reg,
+                                           name_reg,
+                                           holder);
+    __ pop(name_reg);
+    __ pop(holder_reg);
+    __ LeaveInternalFrame();
+    // r0 no longer contains the receiver.
+
+    // If interceptor returns no-result sentinal, call the constant function.
+    __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex);
+    __ cmp(r0, scratch);
+    Label invoke;
+    __ b(ne, &invoke);
+    // Check the prototypes between the interceptor's holder and the
+    // constant function's holder.
+    CheckPrototypes(holder, holder_reg,
+                    lookup.holder(), r0,
+                    scratch,
+                    name,
+                    &miss);
+    GenerateCallConstFunction(masm(),
+                              lookup.GetConstantFunction(),
+                              arguments());
+    __ bind(&invoke);
+
+  } else {
+    // Call a runtime function to load the interceptor property.
+    __ EnterInternalFrame();
+    __ push(name_reg);
+
+    PushInterceptorArguments(masm(), receiver, holder_reg, name_reg, holder);
+
+    ExternalReference ref = ExternalReference(
+        IC_Utility(IC::kLoadPropertyWithInterceptorForCall));
+    __ mov(r0, Operand(5));
+    __ mov(r1, Operand(ref));
+
+    CEntryStub stub(1);
+    __ CallStub(&stub);
+
+    __ pop(name_reg);
+    __ LeaveInternalFrame();
+  }
+

   // Move returned value, the function to call, to r1.
+  // Neither receiver nor name contain their original value at this point.
   __ mov(r1, r0);
   // Restore receiver.
-  __ ldr(r0, MemOperand(sp, argc * kPointerSize));
+  __ ldr(receiver, MemOperand(sp, argc * kPointerSize));

   GenerateCallFunction(masm(), object, arguments(), &miss);


Making the generation test a function pass

--- SymbolicRangeAnalysisGenTest.cpp
+++ SymbolicRangeAnalysisGenTest.cpp
@@ -10,13 +10,13 @@

 using namespace llvm;

-class SymbolicRangeAnalysisGenTest : public ModulePass {
+class SymbolicRangeAnalysisGenTest : public FunctionPass {
 public:
   static char ID;
-  SymbolicRangeAnalysisGenTest() : ModulePass(ID) { }
+  SymbolicRangeAnalysisGenTest() : FunctionPass(ID) { }

   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-  virtual bool runOnModule(Module&);
+  virtual bool runOnFunction(Function&);
 };

 static RegisterPass<SymbolicRangeAnalysisGenTest>
@@ -28,26 +28,23 @@
   AU.setPreservesAll();
 }

-bool SymbolicRangeAnalysisGenTest::runOnModule(Module& M) {
-  for (auto &F : M) {
-    if (F.isIntrinsic() || F.isDeclaration())
-      continue;
+bool SymbolicRangeAnalysisGenTest::runOnFunction(Function& F) {
+  auto &SRA = getAnalysis<SymbolicRangeAnalysis>();

-    auto &SRA = getAnalysis<SymbolicRangeAnalysis>(F);
+  dbgs() << "SRA-GEN: runOnFunction: " << F.getName() << "\n";

-    for (auto &BB : F) {
-      IRBuilder<> IRB(BB.getTerminator());
-      std::vector<Instruction*> Ins;
-      for (auto &I : BB)
-        if (I.getType()->isIntegerTy()) {
-          Ins.push_back(&I);
-        }
+  for (auto &BB : F) {
+    IRBuilder<> IRB(BB.getTerminator());
+    std::vector<Instruction*> Ins;
+    for (auto &I : BB)
+      if (I.getType()->isIntegerTy()) {
+        Ins.push_back(&I);
+      }

-      for (auto I : Ins) {
-        DEBUG(dbgs() << "Generating ranges: " << SRA.getStateOrInf(I)
-                     << " for instruction " << *I << "\n");
-        SRA.getRangeValuesFor(I, IRB);
-      }
+    for (auto I : Ins) {
+      DEBUG(dbgs() << "Generating ranges: " << SRA.getStateOrInf(I)
+                   << " for instruction " << *I << "\n");
+      SRA.getRangeValuesFor(I, IRB);
     }
   }


Jenkins: Format fixes

Jenkins: Format fixes

--- modules/basecl/src/processors/entryexitpointsclprocessor.cpp
+++ modules/basecl/src/processors/entryexitpointsclprocessor.cpp
@@ -66,10 +66,8 @@
     addProperty(workGroupSize_);
     addProperty(useGLSharing_);
     addProperty(trackball_);
-
-    workGroupSize_.onChange([this]() {
-        entryExitPoints_.setWorkGroupSize(workGroupSize_.get());
-    });
+
+    workGroupSize_.onChange([this]() { entryExitPoints_.setWorkGroupSize(workGroupSize_.get()); });

     // Will enable the processor to invalidate when the kernel has recompiled
     entryExitPoints_.addObserver(this);


Use retarget defines

Use retarget defines

--- TESTS/filesystem/fopen/fopen.cpp
+++ TESTS/filesystem/fopen/fopen.cpp
@@ -40,14 +40,6 @@
  * consistent values for all toolchains */
 #include "platform/mbed_retarget.h"

-/* This is needed for stat() test, but is not available on ARMCC.
- * The following checks whether GCC_ARM compiler is being used because:
- * - both the ARMCC compiler and the GCC_ARM compile define __GNUC__.
- * - only the ARMCC compiler defines __ARMCC_VERSION.
- * - hence if __ARMCC_VERSION is not defined and __GNUC__ is defined, it must be GCC_ARM. */
-#if ! defined(__ARMCC_VERSION) && defined(__GNUC__)
-#include <sys/stat.h>
-#endif
 using namespace utest::v1;

 /// @cond FSFAT_DOXYGEN_DISABLE
@@ -79,7 +71,7 @@
 #if defined(DEVICE_SPI) && ( defined(MBED_CONF_APP_FSFAT_SDCARD_INSTALLED) || (MBED_CONF_SD_FSFAT_SDCARD_INSTALLED))
 static char fsfat_fopen_utest_msg_g[FSFAT_UTEST_MSG_BUF_SIZE];
 #define FSFAT_FOPEN_TEST_MOUNT_PT_NAME      "sd"
-#define FSFAT_FOPEN_TEST_MOUNT_PT_PATH      "/"FSFAT_FOPEN_TEST_MOUNT_PT_NAME
+#define FSFAT_FOPEN_TEST_MOUNT_PT_PATH      "/" FSFAT_FOPEN_TEST_MOUNT_PT_NAME
 #define FSFAT_FOPEN_TEST_WORK_BUF_SIZE_1    64
 #define FSFAT_FOPEN_TEST_FILEPATH_MAX_DEPTH 20
 static const char *sd_badfile_path = "/sd/badfile.txt";


Fixed formatting of status printing

Fixed formatting of status printing

--- apps/drivers/px4io/px4io.cpp
+++ apps/drivers/px4io/px4io.cpp
@@ -1158,11 +1158,13 @@
 void
 PX4IO::print_status()
 {
-	printf("\tRC status:\t%s\n", (_status & PX4IO_P_STATUS_FLAGS_RC_OK) ? "OK" : "LOST");
+	printf("\tRC status:\t%s\n", (_status & PX4IO_P_STATUS_FLAGS_RC_OK) ? "OK" : "FAIL");
 	if (_status & PX4IO_P_STATUS_FLAGS_RC_OK) {
 		printf("\tRC type:\t%s\n", (_status & PX4IO_P_STATUS_FLAGS_RC_SBUS) ? "S.BUS" : ((_status & PX4IO_P_STATUS_FLAGS_RC_DSM) ? "DSM" : "PPM"));
 		// printf("\tRC chans:\t%d\n", xxx);
 	}
+	//printf("\tRC Config:\t%s\n", (_status & PX4IO_P_STATUS_FLAGS_RC_CONFIG_OK) ? "OK" : "FAIL");
+	printf("\tFMU link:\t%s\n", (_status & PX4IO_P_STATUS_FLAGS_FMU_OK) ? "OK" : "FAIL");
 }

 int


temporarily fixed brakeinfo74_test. TODO: extract chassis_detail data from rosbag and use them for test.

--- modules/canbus/vehicle/lincoln/protocol/brakeinfo_74_test.cc
+++ modules/canbus/vehicle/lincoln/protocol/brakeinfo_74_test.cc
@@ -29,10 +29,10 @@

 TEST_F(Brakeinfo74Test, simple) {
   Brakeinfo74 brakeinfo;
-  uint8_t data = 0x64U;
+  uint8_t data[8] = {0x64U};
   int32_t length = 8;
   ChassisDetail cd;
-  brakeinfo.Parse(&data, length, &cd);
+  brakeinfo.Parse(data, length, &cd);

   EXPECT_FALSE(cd.esp().is_abs_active());
   EXPECT_FALSE(cd.esp().is_abs_enabled());
@@ -42,11 +42,11 @@
   EXPECT_FALSE(cd.esp().is_trac_enabled());

   EXPECT_EQ(cd.epb().parking_brake_status(), Epb::PBRAKE_OFF);
-  EXPECT_DOUBLE_EQ(cd.brake().brake_torque_req(), 8592.0);
+  EXPECT_DOUBLE_EQ(cd.brake().brake_torque_req(), 400.0);
   EXPECT_EQ(cd.brake().hsa_status(), Brake::HSA_INACTIVE);
   EXPECT_DOUBLE_EQ(cd.brake().brake_torque_act(), 0.0);
   EXPECT_EQ(cd.brake().hsa_status(), Brake::HSA_OFF);
-  EXPECT_DOUBLE_EQ(cd.brake().wheel_torque_act(), 8192.0);
+  EXPECT_DOUBLE_EQ(cd.brake().wheel_torque_act(), 0.0);
   EXPECT_FALSE(cd.vehicle_spd().is_vehicle_standstill());
   EXPECT_DOUBLE_EQ(cd.vehicle_spd().acc_est(), 0.0);
 }


VTBuilder: Fix hang on trying to import a .dbf file

--- TerrainApps/VTBuilder/Import.cpp
+++ TerrainApps/VTBuilder/Import.cpp
@@ -384,7 +384,7 @@
 		VTLOG("Couldn't open file %s\n", (const char *) fname);
 		return false;
 	}
-	bool bIsDB = !strExt.Left(2).CmpNoCase(_T("db"));
+	bool bIsDB = (strExt.Len() == 2 && !strExt.Left(2).CmpNoCase(_T("db")));
 	if (bIsDB)
 	{
 		// Get type from DB file


Add ability to compute observed range deviations

git-svn-id: 6625e4d6743179724b113c04fbf297d122273a36@582 108fab2b-820f-0410-9f2c-e5cc2c41d7be

--- apps/positioning/PRSolve.cpp
+++ apps/positioning/PRSolve.cpp
@@ -69,7 +69,7 @@

    // prgm data
 string PrgmName("PRSolve");
-string PrgmVers("2.01 3/07");
+string PrgmVers("2.1 5/07");

 // data input from command line
 typedef struct Configuration {
@@ -92,6 +92,7 @@
    Position knownpos;
    Matrix<double> Rot;
    bool APSout;
+   string ordFile;
    string OutRinexObs;
    string HDPrgm;       // header of output RINEX file
    string HDRunby;
@@ -108,7 +109,7 @@
    DayTime Tbeg, Tend;
       // output files
    string LogFile;
-   ofstream oflog;
+   ofstream oflog,oford;
       // processing
    double DataInt;
    int Freq;
@@ -132,7 +133,8 @@
 const double F2=120.0;
 const double wl1=CFF/F1;
 const double wl2=CFF/F2;
-const double alpha=((F1*F1)/(F2*F2) - 1.0);
+const double F1F2=(F1/F2)*(F1/F2);
+const double alpha=(F1F2 - 1.0);
 const double if1r=1.0/(1.0-(F2/F1)*(F2/F1));
 const double if2r=1.0/(1.0-(F1/F2)*(F1/F2));
 clock_t totaltime;
@@ -329,6 +331,22 @@
       C.Rot(0,0) = -sa*co; C.Rot(0,1) = -sa*so; C.Rot(0,2) = ca;
    }

+   if(!C.ordFile.empty()) {
+      if(C.knownpos.getCoordinateSystem() == Position::Unknown) {
+         C.oflog << "Error - ORD output to file (" << C.ordFile << ") requires "
+            << " --PosXYZ input. Abort output of ORDs." << endl;
+      }
+      else {
+         C.oford.open(C.ordFile.c_str(),ios::out);
+         if(C.oford.fail()) {
+            C.oflog << "Failed to open ORD file " << C.ordFile << endl;
+            C.ordFile = string();
+         }
+         else C.oford
+            << "#   sat week seconds_wk ok? elev       ORD(C/A)       ORD(P)" << endl;
+      }
+   }
+
    // initialize global solution and residual statistics
    // not necessary SSA[0].Reset(); SSA[1].Reset(); SSA[2].Reset();
    // not necessary SSR[0].Reset(); SSR[1].Reset(); SSR[2].Reset();
@@ -370,6 +388,7 @@
       << double(totaltime)/double(CLOCKS_PER_SEC) << " seconds.\n";

    C.oflog.close();
+   C.oford.close();

    return iret;
 }
@@ -489,28 +508,28 @@
    C.oflog << "Process frequency " << C.Freq << endl;

       // initialize file solution and residual statistics
-      SA[0].Reset(); SA[1].Reset(); SA[2].Reset();
-      SR[0].Reset(); SR[1].Reset(); SR[2].Reset();
-      PA = Matrix<double>(3,3,0.0);
-      PR = Matrix<double>(3,3,0.0);
-      zA = Vector<double>(3,0.0);
-      zR = Vector<double>(3,0.0);
-      if(C.knownpos.getCoordinateSystem() != Position::Unknown) {
-         if(C.APSout) {
-            SAPR[0].Reset(); SAPR[1].Reset(); SAPR[2].Reset();
-            SANE[0].Reset(); SANE[1].Reset(); SANE[2].Reset();
-            PAPR = Matrix<double>(3,3,0.0);
-            PANE = Matrix<double>(3,3,0.0);
-            zAPR = Vector<double>(3,0.0);
-            zANE = Vector<double>(3,0.0);
-         }
-         SRPR[0].Reset(); SRPR[1].Reset(); SRPR[2].Reset();
-         SRNE[0].Reset(); SRNE[1].Reset(); SRNE[2].Reset();
-         PRPR = Matrix<double>(3,3,0.0);
-         PRNE = Matrix<double>(3,3,0.0);
-         zRPR = Vector<double>(3,0.0);
-         zRNE = Vector<double>(3,0.0);
-      }
+   SA[0].Reset(); SA[1].Reset(); SA[2].Reset();
+   SR[0].Reset(); SR[1].Reset(); SR[2].Reset();
+   PA = Matrix<double>(3,3,0.0);
+   PR = Matrix<double>(3,3,0.0);
+   zA = Vector<double>(3,0.0);
+   zR = Vector<double>(3,0.0);
+   if(C.knownpos.getCoordinateSystem() != Position::Unknown) {
+      if(C.APSout) {
+         SAPR[0].Reset(); SAPR[1].Reset(); SAPR[2].Reset();
+         SANE[0].Reset(); SANE[1].Reset(); SANE[2].Reset();
+         PAPR = Matrix<double>(3,3,0.0);
+         PANE = Matrix<double>(3,3,0.0);
+         zAPR = Vector<double>(3,0.0);
+         zANE = Vector<double>(3,0.0);
+      }
+      SRPR[0].Reset(); SRPR[1].Reset(); SRPR[2].Reset();
+      SRNE[0].Reset(); SRNE[1].Reset(); SRNE[2].Reset();
+      PRPR = Matrix<double>(3,3,0.0);
+      PRNE = Matrix<double>(3,3,0.0);
+      zRPR = Vector<double>(3,0.0);
+      zRNE = Vector<double>(3,0.0);
+   }

       // loop over epochs in the file
    first = true;
@@ -518,7 +537,7 @@
          // read next obs
       double RMSrof;
       vector<SatID> Satellites;
-      vector<double> Ranges;
+      vector<double> Ranges,vC1,vP1,vP2;
       Matrix<double> inform;
       RinexObsData robsd,auxPosData;

@@ -582,16 +601,19 @@
          Nsvs = 0;
          Satellites.clear();
          Ranges.clear();
+         vC1.clear(); vP1.clear(); vP2.clear();
          RinexObsData::RinexSatMap::const_iterator it;
          for(it=robsd.obs.begin(); it != robsd.obs.end(); ++it) {
             // loop over sat=it->first, ObsTypeMap=it->second
             int in,n;
-            double P1=0,P2=0,L1,L2,D1,D2,S1,S2;
+            double C1=0,P1=0,P2=0,L1,L2,D1,D2,S1,S2;
             SatID sat=it->first;
             RinexObsData::RinexObsTypeMap otmap=it->second;

                // pull out the data
             RinexObsData::RinexObsTypeMap::const_iterator jt;
+            if(inC1>-1 && (jt=otmap.find(rhead.obsTypeList[inC1])) != otmap.end())
+               C1=jt->second.data;
             if(inP1>-1 && (jt=otmap.find(rhead.obsTypeList[inP1])) != otmap.end())
                P1=jt->second.data;
             if(inP2>-1 && (jt=otmap.find(rhead.obsTypeList[inP2])) != otmap.end())
@@ -645,6 +667,11 @@
             Satellites.push_back(sat);
             Ranges.push_back(C.Freq == 3 ? if1r*P1+if2r*P2 :
                             (C.Freq == 2 ? P2 : P1));
+            if(!C.ordFile.empty()) {
+               vC1.push_back(C1);
+               vP1.push_back(P1);
+               vP2.push_back(P2);
+            }
             Nsvs++;

          }  // end loop over sats
@@ -679,7 +706,35 @@

       if(C.Debug) C.oflog << "processing returned " << iret << endl;
       if(iret == -1) { iret=0; break; }         // end of file
-      if(iret == 1 || iret == -4) continue;     // ignore this epoch
+      if(iret == -4) continue;                  // ignore this epoch - no ephemeris
+         // NB output ORDs before quitting on too few sats
+
+         // write out ORDs
+      if(!C.ordFile.empty()) {
+         for(i=0; i<Satellites.size(); i++) {
+            SatID sat=Satellites[i];
+            CorrectedEphemerisRange CER;
+            try { CER.ComputeAtReceiveTime(CurrEpoch, C.knownpos, sat, *pEph); }
+            catch(EphemerisStore::NoEphemerisFound& nef) { continue; }
+
+            // compute ionosphere - note that P1-R-RI == P2-R-RI*(F1/F2)**2
+            double RI = (vP2[i]-vP1[i])/alpha;
+            double R = CER.rawrange + prsol.Solution(3)
+               - CER.svclkbias - CER.relativity
+               + C.pTropModel->correction(C.knownpos,CER.svPosVel.x,CurrEpoch);
+            C.oford << "ORD"
+               << " G" << setw(2) << setfill('0') << abs(sat.id) << setfill(' ')
+               << " " << CurrEpoch.printf(C.timeFormat)
+               << " " << (sat.id < 0 ? "0" : "1")
+               << fixed << setprecision(3)
+               << " " << CER.elevation
+               << " " << setw(13) << vC1[i] - R - RI
+               << " " << setw(13) << vP1[i] - R - RI
+               << endl;
+         }
+      }
+
+      if(iret == 1) continue;                   // ignore this epoch - too few sats

          // accumulate simple statistics, Autonomous and RAIM
       if(C.APSout) {
@@ -707,7 +762,7 @@
       zR += inform * Vector<double>(prsol.Solution,0,3);
       zzR += inform * Vector<double>(prsol.Solution,0,3);

-      if(!writeout) continue;
+      if(!writeout) continue;                   // go to next epoch

          // output to RINEX
       if(first) {                               // edit the output RINEX header
@@ -741,7 +796,7 @@
       if(iret > 2) {                         // output position first
          auxPosData.time = robsd.time;
          auxPosData.epochFlag = 4;
-         auxPosData.numSvs = 2;
+         auxPosData.numSvs = 2;              // must be sure only 2 lines are written
          auxPosData.auxHeader.clear();
          ostringstream stst1,stst2;
          stst1 << "XYZT";
@@ -896,7 +951,7 @@
          for(i=0; i<Sats.size(); i++) C.oflog << " " << setw(3) << Sats[i].id;
          C.oflog << endl;

-         // accumulate statistis
+         // accumulate statistics
          SAPR[0].Add(V(0)); SAPR[1].Add(V(1)); SAPR[2].Add(V(2));
          SSAPR[0].Add(V(0)); SSAPR[1].Add(V(1)); SSAPR[2].Add(V(2));
          inform = inverseSVD(Cov);
@@ -946,8 +1001,7 @@
       return iret;
    }
    for(Nsvs=0,i=0; i<Sats.size(); i++)
-      if(Sats[i].id > 0)
-         Nsvs++;
+      if(Sats[i].id > 0) Nsvs++;
    RMSresid = prsol.RMSResidual;

    C.oflog << "RPF " << setw(2) << Sats.size()-Nsvs
@@ -1203,6 +1257,7 @@
    C.elevLimit = 0.0;

    C.LogFile = string("prs.log");
+   C.ordFile = string();

    C.APSout = false;
    C.UseCA = false;
@@ -1355,13 +1410,19 @@

    CommandOption dashXYZ(CommandOption::hasArgument, CommandOption::stdType,
       0,"PosXYZ", " --PosXYZ <X,Y,Z>     "
-      "Known position (ECEF,m), used to compute output residuals ()");
+      "Known position (ECEF,m), used to compute output residuals and ORDs ()");
    dashXYZ.setMaxCount(1);

    CommandOptionNoArg dashAPSout(0,"APSout", string(" --APSout             ")
       + string("Output autonomous pseudorange solution [tag APS, no RAIM] (")
       + (C.APSout ? "true" : "false") + string(")") );
    dashAPSout.setMaxCount(1);
+
+   CommandOption dashORDs(CommandOption::hasArgument, CommandOption::stdType,
+      0,"ORDs", " --ORDs <file>        "
+      "Output ORDs (Observed Range Deviations) to file [PosXYZ req'd] ("
+      + C.ordFile + ")");
+   dashORDs.setMaxCount(1);

    CommandOption dashForm(CommandOption::hasArgument, CommandOption::stdType,
       0,"TimeFormat", " --TimeFormat <fmt>   "
@@ -1649,6 +1710,11 @@
       C.timeFormat = values[0];
       if(help) cout << " Input: time format " << C.timeFormat << endl;
    }
+   if(dashORDs.getCount()) {
+      values = dashORDs.getValue();
+      C.ordFile = values[0];
+      if(help) cout << " Input: output ORDs to file " << C.ordFile << endl;
+   }
    if(dashXsat.getCount()) {
       values = dashXsat.getValue();
       for(i=0; i<values.size(); i++) {
@@ -1822,6 +1888,8 @@
    if(C.knownpos.getCoordinateSystem() != Position::Unknown)
       os << " Output residuals: known position is\n   " << C.knownpos.printf(
          "ECEF(m) %.4x %.4y %.4z\n     = %A deg N %L deg E %h m\n");
+   if(!C.ordFile.empty())
+      os << " Output ORDs to file " << C.ordFile << endl;
    if(C.APSout) os << " Output autonomous solution (no RAIM) - APS,etc.\n";
    os << " Output format for time tags (cf. class DayTime) is "
       << C.timeFormat << endl;


Fix replacing parameter names in expressions for lambda based formula functions

--- hist/hist/src/TFormula.cxx
+++ hist/hist/src/TFormula.cxx
@@ -2567,8 +2567,8 @@
       return;
    }

-   //replace also parameter name in formula expression
-   ReplaceParamName(fFormula, oldName, name);
+   //replace also parameter name in formula expression in case is not a lambda
+   if (! TestBit(TFormula::kLambda))  ReplaceParamName(fFormula, oldName, name);

 }


Planning: add third order derivate into objective function


fix wrong request IDs

fix wrong request IDs

--- example/http_client.cpp
+++ example/http_client.cpp
@@ -68,10 +68,11 @@
 class OnError : LIBJ_JS_FUNCTION(OnError)
  public:
     OnError(
-        Int id_,
+        Int id,
         String::CPtr method,
         String::CPtr url)
-        : method_(method)
+        : id_(id)
+        , method_(method)
         , url_(url) {}

     virtual Value operator()(JsArray::Ptr args) {


Planning: fixed worldsim 7.

Planning: fixed worldsim 7.

--- modules/planning/toolkits/deciders/side_pass_path_decider.cc
+++ modules/planning/toolkits/deciders/side_pass_path_decider.cc
@@ -186,8 +186,8 @@
     const IndexedList<std::string, Obstacle> &indexed_obstacles) {
   std::vector<std::tuple<double, double, double>> lateral_bounds;

-  const auto nearest_obstacle = GetNearestObstacle(
-      adc_sl_boundary, reference_line, indexed_obstacles);
+  const auto nearest_obstacle =
+      GetNearestObstacle(adc_sl_boundary, reference_line, indexed_obstacles);
   if (nearest_obstacle == nullptr) {
     AERROR << "Can't find nearest obstacle.";
     return lateral_bounds;
@@ -306,11 +306,6 @@
     if (obs_start_l > lane_left_width || obs_end_l < -lane_right_width) {
       continue;
     }
-    // do NOT sidepass non-vehicle obstacles.
-    if (obstacle->Perception().type() !=
-        perception::PerceptionObstacle::VEHICLE) {
-      continue;
-    }
     // For obstacles of interests, select the nearest one.
     // TODO(All): currently, regardless of the orientation
     // of the obstacle, it treats the obstacle as a rectangle


Planning: coding style fixes.

Planning: coding style fixes.

--- modules/planning/toolkits/deciders/side_pass_path_decider.cc
+++ modules/planning/toolkits/deciders/side_pass_path_decider.cc
@@ -36,9 +36,9 @@
 using ::apollo::common::Status;
 using ::apollo::hdmap::PathOverlap;

-double ROAD_BUFFER = 0.2;
-double OBSTACLE_BUFFER = 0.2;
-double PLANNING_DIST_AFTER_OBSTACLE = 3.0;
+constexpr double kRoadBuffer = 0.2;
+constexpr double kObstacleBuffer = 0.2;
+constexpr double kPlanDistAfterObs = 3.0;

 SidePassPathDecider::SidePassPathDecider(const TaskConfig &config)
     : Decider(config) {
@@ -93,8 +93,10 @@
   double adc_end_s = reference_line_info->AdcSlBoundary().end_s();
   // Get obstacle info.
   bool no_obs_selected = true;
-  double nearest_obs_start_s, nearest_obs_end_s,
-         nearest_obs_start_l, nearest_obs_end_l;
+  double nearest_obs_start_s = 0.0;
+  double nearest_obs_end_s = 0.0;
+  double nearest_obs_start_l = 0.0;
+  double nearest_obs_end_l = 0.0;
   for (const auto* path_obstacle :
        reference_line_info->path_decision()->path_obstacles().Items()) {
     // Filter out obstacles that are behind ADC.
@@ -111,8 +113,10 @@
       continue;
     }
     // Filter out those out-of-lane obstacles.
-    double lane_left_width_at_start_s, lane_left_width_at_end_s,
-           lane_right_width_at_start_s, lane_right_width_at_end_s;
+    double lane_left_width_at_start_s = 0.0;
+    double lane_left_width_at_end_s = 0.0;
+    double lane_right_width_at_start_s = 0.0;
+    double lane_right_width_at_end_s = 0.0;
     reference_line.GetLaneWidth(obs_start_s,
         &lane_left_width_at_start_s, &lane_right_width_at_start_s);
     reference_line.GetLaneWidth(obs_end_s,
@@ -173,31 +177,33 @@
     std::tuple<double, double, double> s_leftbound_rightbound;
     std::get<0>(s_leftbound_rightbound) = curr_s;
     // Check if boundary should be dictated by obstacle or road
-    if (curr_s >= nearest_obs_start_s && curr_s <= nearest_obs_end_s) {
+    if (curr_s >= nearest_obs_start_s - kObstacleBuffer
+        && curr_s <= nearest_obs_end_s + kObstacleBuffer) {
       is_blocked_by_obs = true;
     } else {
       is_blocked_by_obs = false;
     }
     // Get the road info at the current s.
-    double road_left_width_at_curr_s, road_right_width_at_curr_s;
+    double road_left_width_at_curr_s = 0.0;
+    double road_right_width_at_curr_s = 0.0;
     reference_line.GetRoadWidth(curr_s,
         &road_left_width_at_curr_s, &road_right_width_at_curr_s);
     if (!is_blocked_by_obs) {
       std::get<1>(s_leftbound_rightbound) =
-          -std::abs(road_left_width_at_curr_s-ROAD_BUFFER);
+          -std::abs(road_left_width_at_curr_s - kRoadBuffer);
       std::get<2>(s_leftbound_rightbound) =
-          std::abs(road_right_width_at_curr_s-ROAD_BUFFER);
+          std::abs(road_right_width_at_curr_s - kRoadBuffer);
     } else {
       if (decided_direction_ == LEFT) {
         std::get<1>(s_leftbound_rightbound) =
-            -std::abs(road_left_width_at_curr_s-ROAD_BUFFER);
+            -std::abs(road_left_width_at_curr_s - kRoadBuffer);
         std::get<2>(s_leftbound_rightbound) =
-            -nearest_obs_end_l;
+            -nearest_obs_end_l - kObstacleuffer;
       } else if (decided_direction_ == RIGHT) {
         std::get<1>(s_leftbound_rightbound) =
-            -nearest_obs_start_l;
+            -nearest_obs_start_l + kObstacleBuffer;
         std::get<2>(s_leftbound_rightbound) =
-            std::abs(road_right_width_at_curr_s-ROAD_BUFFER);
+            std::abs(road_right_width_at_curr_s - kRoadBuffer);
       } else {
         AERROR << "Side-pass direction undefined.";
         return false;
@@ -206,7 +212,7 @@
     list_s_leftbound_rightbound.push_back(s_leftbound_rightbound);
     // Move to next s
     curr_s += s_increment;
-    if (curr_s > PLANNING_DIST_AFTER_OBSTACLE + nearest_obs_end_s) {
+    if (curr_s > kPlanDistAfterObs + nearest_obs_end_s) {
       bound_cond_gen_finished = true;
     }
   }


Added a screen listing test.

Added a screen listing test.

--- apps/tests/test_platform.cpp
+++ apps/tests/test_platform.cpp
@@ -12,6 +12,11 @@
 {
 	auto sys = platform::platform::common().create();

+	auto screens = sys->screens();
+
+	for ( auto scr: screens )
+		std::cout << "Screen " << scr->bounds() << ' ' << scr->dpi() << std::endl;
+
 	auto win = sys->new_window();
 	win->set_title( "Hello World" );
 	win->exposed.callback( [&]( void )
@@ -21,6 +26,10 @@
 		glClearColor( 0.0, 1.0, 0.0, 1.0 );
 		glClear( GL_COLOR_BUFFER_BIT );
 		win->release();
+	} );
+	win->resized.callback( [&]( double w, double h )
+	{
+		std::cout << "Resized to: " << w << 'x' << h << std::endl;
 	} );

 	win->show();


Ignore no-op call to handleVisibilityChange in Symbian camera backend

Reviewed-by: Gareth Stockwell

--- plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp
+++ plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp
@@ -684,6 +684,9 @@

 void S60CameraViewfinderEngine::handleVisibilityChange(const bool isVisible)
 {
+    if (m_isViewFinderVisible == isVisible)
+        return;
+
     m_isViewFinderVisible = isVisible;

     if (m_isViewFinderVisible) {


regenerated the acceptance test resources


Fixed position setting.  Added a few more video buffers for testing.

--- example/src/testApp.cpp
+++ example/src/testApp.cpp
@@ -41,7 +41,7 @@
     currentVideoSource  = 0;

-    for(int i = 0; i < 4; i++) {
+    for(int i = 0; i < 6; i++) {
         ofxVideoBuffer* videoBuffer = new ofxVideoBuffer(100);
         buffers.push_back(videoBuffer);
         ofxVideoBufferPlayer* videoPlayer = new ofxVideoBufferPlayer();
@@ -123,12 +123,15 @@
     keys += "  [[] Loop Point (start) (DOWN)\n";
     keys += "  [{] Loop Point (end)   (DOWN)\n";
     keys += "  []] Loop Point (start) (UP)\n";
-    keys += "  [}] Loop Point (end)    (UP)\n";
+    keys += "  [}] Loop Point (end)   (UP)\n";
     keys += "  [c] Clear Loop Points\n";
     keys += "\n";
     keys += "  [-] Decrease Speed\n";
     keys += "  [=] Increase Speed\n";
-
+    keys += "\n";
+    keys += "  [_] Decrease Position\n";
+    keys += "  [+] Increase Position\n";
+

     ofSetColor(255);
     ofDrawBitmapString(keys,20,400);
@@ -174,9 +177,9 @@
         ofDrawBitmapString(stats, x + 20, y + 20);

-        x += (camWidth + 5);
+        x += (camWidth + 0);
         if((x + 320)> ofGetWidth()) {
-            y+= camHeight + 5;
+            y+= camHeight + 0;
             x = 320;
         }
     }
@@ -200,6 +203,7 @@

     float speed = bufferPlayers[currentBufferPlayer]->getSpeed();

+    int position = bufferPlayers[currentBufferPlayer]->getPosition();

     switch (key) {
         case '`':
@@ -249,14 +253,19 @@
             bufferPlayers[currentBufferPlayer]->getVideoBuffer()->loadMovie("fingers.mov");
             break;
         case '-':
-            speed -= .25;
+            speed -= .05;
             bufferPlayers[currentBufferPlayer]->setSpeed(speed);
             break;
         case '=':
-            speed += .25;
+            speed += .05;
             bufferPlayers[currentBufferPlayer]->setSpeed(speed);
             break;
-
+        case '_':
+            bufferPlayers[currentBufferPlayer]->setPosition(position - 1);
+            break;
+        case '+':
+            bufferPlayers[currentBufferPlayer]->setPosition(position + 1);
+            break;
         default:
             break;
     }


Fixed bug in XML object write

Fixed bug in XML object write

--- src/asmith/serial/xml.cpp
+++ src/asmith/serial/xml.cpp
@@ -85,7 +85,6 @@
 			}
 			break;
 		case value::OBJECT_T:
-			aStream << ">";
 			{
 				const value::object_t tmp = aType.get_object();
 				const size_t s = tmp.size();


Added multiple compute dispatches.

Added multiple compute dispatches.

--- examples/03_compute.cpp
+++ examples/03_compute.cpp
@@ -27,36 +27,50 @@
     mtlpp::ComputePipelineState computePipelineState = device.NewComputePipelineState(sqrFunc, nullptr);
     assert(computePipelineState);

-    const uint32_t inDataCount = 8;
-    const float inData[inDataCount] = { 0.0f, 1.0f, 2.0f, 10.0f, 11.0f, 12.0f, 20, 21 };
+    const uint32_t dataCount = 6;

-    mtlpp::Buffer inBuffer = device.NewBuffer(inData, sizeof(inData), mtlpp::ResourceOptions::CpuCacheModeDefaultCache);
+    mtlpp::Buffer inBuffer = device.NewBuffer(sizeof(float) * dataCount, mtlpp::ResourceOptions::CpuCacheModeDefaultCache);
     assert(inBuffer);

-    mtlpp::Buffer outBuffer = device.NewBuffer(sizeof(inData), mtlpp::ResourceOptions::CpuCacheModeDefaultCache);
+    mtlpp::Buffer outBuffer = device.NewBuffer(sizeof(float) * dataCount, mtlpp::ResourceOptions::CpuCacheModeDefaultCache);
     assert(outBuffer);

-    mtlpp::CommandQueue commandQueue = device.NewCommandQueue();
-    assert(commandQueue);
-    mtlpp::CommandBuffer commandBuffer = commandQueue.CommandBuffer();
-    assert(commandBuffer);
+    for (uint32_t i=0; i<4; i++)
+    {
+        // update input data
+        {
+            float* inData = static_cast<float*>(inBuffer.GetContents());
+            for (uint32_t j=0; j<dataCount; j++)
+                inData[j] = 10 * i + j;
+            inBuffer.DidModify(ns::Range(0, sizeof(float) * dataCount));
+        }

-    mtlpp::ComputeCommandEncoder commandEncoder = commandBuffer.ComputeCommandEncoder();
-    commandEncoder.SetBuffer(inBuffer, 0, 0);
-    commandEncoder.SetBuffer(outBuffer, 0, 1);
-    commandEncoder.SetComputePipelineState(computePipelineState);
+        mtlpp::CommandQueue commandQueue = device.NewCommandQueue();
+        assert(commandQueue);
+        mtlpp::CommandBuffer commandBuffer = commandQueue.CommandBuffer();
+        assert(commandBuffer);

-    commandEncoder.DispatchThreadgroups(
-        mtlpp::Size(1, 1, 1),
-        mtlpp::Size(inDataCount, 1, 1));
+        mtlpp::ComputeCommandEncoder commandEncoder = commandBuffer.ComputeCommandEncoder();
+        commandEncoder.SetBuffer(inBuffer, 0, 0);
+        commandEncoder.SetBuffer(outBuffer, 0, 1);
+        commandEncoder.SetComputePipelineState(computePipelineState);

-    commandEncoder.EndEncoding();
-    commandBuffer.Commit();
-    commandBuffer.WaitUntilCompleted();
+        commandEncoder.DispatchThreadgroups(
+            mtlpp::Size(1, 1, 1),
+            mtlpp::Size(dataCount, 1, 1));

-    float* outData = static_cast<float*>(outBuffer.GetContents());
-    for (uint32_t i=0; i<inDataCount; i++)
-        printf("sqr(%g) = %g\n", inData[i], outData[i]);
+        commandEncoder.EndEncoding();
+        commandBuffer.Commit();
+        commandBuffer.WaitUntilCompleted();
+
+        // read the data
+        {
+            float* inData = static_cast<float*>(inBuffer.GetContents());
+            float* outData = static_cast<float*>(outBuffer.GetContents());
+            for (uint32_t j=0; j<dataCount; j++)
+                printf("sqr(%g) = %g\n", inData[j], outData[j]);
+        }
+    }

     return 0;
 }


Cleanup.

Cleanup.

--- examples/18-ibl/ibl.cpp
+++ examples/18-ibl/ibl.cpp
@@ -14,7 +14,6 @@
 #include <bx/readerwriter.h>
 #include <bx/string.h>

-static bool s_flipV = false;
 static float s_texelHalf = 0.0f;

 struct Uniforms
@@ -443,19 +442,6 @@
 		, 1.0f
 		, 0
 		);
-
-	// Setup root path for binary shaders. Shader binaries are different
-	// for each renderer.
-	switch (bgfx::getRendererType() )
-	{
-	default:
-		break;
-
-	case bgfx::RendererType::OpenGL:
-	case bgfx::RendererType::OpenGLES:
-		s_flipV = true;
-		break;
-	}

 	// Imgui.
 	void* data = load("font/droidsans.ttf");


Fix FSR (#2628)

Fix FSR (#2628)

* Clear full framebuffer

* Fix type coercion

* Use bgfx API properly

* Remove redundant calls

--- examples/46-fsr/app.cpp
+++ examples/46-fsr/app.cpp
@@ -531,6 +531,17 @@

 				bgfx::ViewId view = 0;

+				// Clear full frame buffer to avoid sampling into garbage during FSR pass
+				if (!m_state.m_renderNativeResolution)
+				{
+					bgfx::setViewRect(view, 0, 0, (uint16_t)m_state.m_width, (uint16_t)m_state.m_height);
+					bgfx::setViewClear(view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0);
+					bgfx::setViewFrameBuffer(view, m_state.m_frameBuffer);
+					bgfx::touch(view);
+
+					++view;
+				}
+
 				// Draw models into scene
 				{
 					bgfx::setViewName(view, "forward scene");


_Pragma fix

_Pragma fix

--- fem/bilininteg_mass.cpp
+++ fem/bilininteg_mass.cpp
@@ -776,7 +776,7 @@
       {
          MFEM_FOREACH_THREAD(dx,x,D1D)
          {
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; ++dz)
             {
                X[dz][dy][dx] = x(dx,dy,dz,e);
@@ -793,21 +793,21 @@
          MFEM_FOREACH_THREAD(qx,x,Q1D)
          {
             double u[D1D];
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; dz++)
             {
                u[dz] = 0;
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dx = 0; dx < D1D; ++dx)
             {
-               _Pragma("unroll D1D");
+               _Pragma("unroll D1D")
                for (int dz = 0; dz < D1D; ++dz)
                {
                   u[dz] += X[dz][dy][dx] * B[qx][dx];
                }
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; ++dz)
             {
                DDQ[dz][dy][qx] = u[dz];
@@ -820,21 +820,21 @@
          MFEM_FOREACH_THREAD(qx,x,Q1D)
          {
             double u[D1D];
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; dz++)
             {
                u[dz] = 0;
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dy = 0; dy < D1D; ++dy)
             {
-               _Pragma("unroll D1D");
+               _Pragma("unroll D1D")
                for (int dz = 0; dz < D1D; dz++)
                {
                   u[dz] += DDQ[dz][dy][qx] * B[qy][dy];
                }
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; dz++)
             {
                DQQ[dz][qy][qx] = u[dz];
@@ -847,21 +847,21 @@
          MFEM_FOREACH_THREAD(qx,x,Q1D)
          {
             double u[Q1D];
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; qz++)
             {
                u[qz] = 0;
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; ++dz)
             {
-               _Pragma("unroll Q1D");
+               _Pragma("unroll Q1D")
                for (int qz = 0; qz < Q1D; qz++)
                {
                   u[qz] += DQQ[dz][qy][qx] * B[qz][dz];
                }
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; qz++)
             {
                QQQ[qz][qy][qx] = u[qz] * op(qx,qy,qz,e);
@@ -882,21 +882,21 @@
          MFEM_FOREACH_THREAD(dx,x,D1D)
          {
             double u[Q1D];
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; ++qz)
             {
                u[qz] = 0;
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qx = 0; qx < Q1D; ++qx)
             {
-               _Pragma("unroll Q1D");
+               _Pragma("unroll Q1D")
                for (int qz = 0; qz < Q1D; ++qz)
                {
                   u[qz] += QQQ[qz][qy][qx] * Bt[dx][qx];
                }
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; ++qz)
             {
                QQD[qz][qy][dx] = u[qz];
@@ -909,21 +909,21 @@
          MFEM_FOREACH_THREAD(dx,x,D1D)
          {
             double u[Q1D];
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; ++qz)
             {
                u[qz] = 0;
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qy = 0; qy < Q1D; ++qy)
             {
-               _Pragma("unroll Q1D");
+               _Pragma("unroll Q1D")
                for (int qz = 0; qz < Q1D; ++qz)
                {
                   u[qz] += QQD[qz][qy][dx] * Bt[dy][qy];
                }
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; ++qz)
             {
                QDD[qz][dy][dx] = u[qz];
@@ -936,21 +936,21 @@
          MFEM_FOREACH_THREAD(dx,x,D1D)
          {
             double u[D1D];
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; ++dz)
             {
                u[dz] = 0;
             }
-            _Pragma("unroll Q1D");
+            _Pragma("unroll Q1D")
             for (int qz = 0; qz < Q1D; ++qz)
             {
-               _Pragma("unroll D1D");
+               _Pragma("unroll D1D")
                for (int dz = 0; dz < D1D; ++dz)
                {
                   u[dz] += QDD[qz][dy][dx] * Bt[dz][qz];
                }
             }
-            _Pragma("unroll D1D");
+            _Pragma("unroll D1D")
             for (int dz = 0; dz < D1D; ++dz)
             {
                y(dx,dy,dz,e) += u[dz];


reset rigid body sizes to zero

reset rigid body sizes to zero

--- hoomd/md/ForceComposite.cc
+++ hoomd/md/ForceComposite.cc
@@ -44,6 +44,13 @@

     GlobalArray<unsigned int> body_len(m_pdata->getNTypes(), m_exec_conf);
     m_body_len.swap(body_len);
+
+    // reset elements to zero
+    ArrayHandle<unsigned int> h_body_len(m_body_len, access_location::host, access_mode::readwrite);
+    for (unsigned int i = 0; i < this->m_pdata->getNTypes(); ++i)
+        {
+        h_body_len.data[i] = 0;
+        }

     #ifdef ENABLE_CUDA
     GlobalVector<unsigned int> rigid_center(m_exec_conf);


Jenkins: Format fixes

Jenkins: Format fixes


Qt: fix profiles with vcodec=copy (fix #9342, fix #9485)

--- modules/gui/qt4/components/sout/profile_selector.cpp
+++ modules/gui/qt4/components/sout/profile_selector.cpp
@@ -287,10 +287,6 @@
             HASHPICK( "vcodec", "height" );
             if ( !value.isEmpty() && value.toInt() > 0 )
                 smrl.option( "height", value );
-        } else {
-            HASHPICK( "video", "copy" );
-            if ( ! value.isEmpty() )
-                smrl.option( "vcodec", "copy" );
         }
     } else {
         smrl.option( "vcodec", "none" );
@@ -320,10 +316,6 @@
                 smrl.option( "afilter", valuesList.join( ":" ) );
             }

-        } else {
-            HASHPICK( "audio", "copy" );
-            if ( ! value.isEmpty() )
-                smrl.option( "acodec", "copy" );
         }
     } else {
         smrl.option( "acodec", "none" );


add phtread based sparse test bench

add phtread based sparse test bench

--- benchmarks/sparse_test.cpp
+++ benchmarks/sparse_test.cpp
@@ -16,23 +16,96 @@
 #include <shogun/lib/SGSparseVector.h>
 #include <shogun/mathematics/Math.h>
 #include <shogun/mathematics/eigen3.h>
+#include <pthread.h>

 using namespace shogun;
 using namespace Eigen;

+struct APPLY_THREAD_PARAM
+{
+	int32_t start;
+	int32_t stop;
+	float64_t* result;
+	float64_t* vec;
+	int32_t len;
+	SGSparseVector<float64_t>* sm;
+};
+
+
+int32_t get_nnz(SGSparseMatrix<float64_t> m)
+{
+
+	int32_t nnz=0;
+	int32_t n=m.num_vectors;
+
+	for (int i=0; i<n; i++)
+	{
+		nnz+=m[i].num_feat_entries;
+	}
+	return nnz;
+}
+
+static void* dot_helper(void* p)
+{
+	APPLY_THREAD_PARAM* par=(APPLY_THREAD_PARAM*) p;
+	float64_t* r = par->result;
+	SGSparseVector<float64_t>* m=par->sm;
+	float64_t* vec = par->vec;
+	int32_t len = par->len;
+	int32_t start = par->start;
+	int32_t stop = par->stop;
+
+	for (index_t i=start; i<stop; ++i)
+		r[i]=m[i].dense_dot(1.0, vec, len, 0.0);
+}
+
+
 SGVector<float64_t> sg_m_apply(SGSparseMatrix<float64_t> m, SGVector<float64_t> v)
 {
 	SGVector<float64_t> r(v.vlen);
 	ASSERT(v.vlen==m.num_vectors);
-#pragma omp parallel for
-	for (index_t i=0; i<m.num_vectors; ++i)
-		r[i]=m[i].dense_dot(1.0, v.vector, v.vlen, 0.0);
+
+	int num_threads=8;
+	pthread_t* threads = SG_MALLOC(pthread_t, num_threads-1);
+	APPLY_THREAD_PARAM* params = SG_MALLOC(APPLY_THREAD_PARAM, num_threads);
+	int32_t step= m.num_vectors/num_threads;
+
+	int32_t start=0;
+	int32_t stop=m.num_vectors;
+	int32_t t;
+
+	for (t=0; t<num_threads-1; t++)
+	{
+		params[t].start = start+t*step;
+		params[t].stop = start+(t+1)*step;
+		params[t].result = r.vector;
+		params[t].sm=m.sparse_matrix;
+		params[t].vec=v.vector;
+		params[t].len=v.vlen;
+		pthread_create(&threads[t], NULL,
+				dot_helper, (void*)&params[t]);
+	}
+
+	params[t].start = start+t*step;
+	params[t].stop = stop;
+	params[t].result = r.vector;
+	params[t].sm=m.sparse_matrix;
+	params[t].vec=v.vector;
+	params[t].len=v.vlen;
+	dot_helper((void*) &params[t]);
+
+	for (t=0; t<num_threads-1; t++)
+		pthread_join(threads[t], NULL);
+
+	SG_FREE(params);
+	SG_FREE(threads);

 	return r;
 }

 int main(int argc, char** argv)
 {
+	Eigen::initParallel();
 	init_shogun_with_defaults();
 	//sg_io->set_loglevel(MSG_GCDEBUG);

@@ -43,6 +116,7 @@
 	v.set_const(1.0);
 	Map<VectorXd> map_v(v.vector, v.vlen);
 	CTime time;
+	CMath::init_random(17);

 	SG_SPRINT("time\tshogun (s)\teigen3 (s)\n\n");
 	for (index_t t=0; t<times; ++t)
@@ -71,21 +145,31 @@
 		Entry** rest=SG_MALLOC(Entry*, size-1);
 		for (index_t i=0; i<size-1; ++i)
 		{
+			int num=40;
 			// the first col
-			rest[i]=SG_MALLOC(Entry, 2);
-			rest[i][0].feat_index=0;
-			rest[i][0].entry=0.01;
-
-			// the diagonal element
-			rest[i][1].feat_index=i+1;
-			rest[i][1].entry=1.836593;
+			rest[i]=SG_MALLOC(Entry, num);
+
+			for (int j=0; j<i && j<num; j++)
+			{
+				rest[i][j].feat_index=j;
+				rest[i][j].entry=0.01+j;
+			}
+
+			if (i>num)
+			{
+				//// the diagonal element
+				rest[i][num-1].feat_index=i+1;
+				rest[i][num-1].entry=1.836593;
+			}

 			vec[i+1].features=rest[i];
-			vec[i+1].num_feat_entries=2;
+			vec[i+1].num_feat_entries=num;

 			sg_m[i+1]=vec[i+1].get();
 		}
 		SGVector<float64_t> r(size);
+
+		SG_SPRINT("nnz=%d\n", get_nnz(sg_m));

 		// sg starts
 		time.start();


- write wave and midi data in binary mode
- adlib registers enabled (OPL emulation still not complete)
- fixed a warning in function opl_data()
- write current time into sb16 logfile

--- iodev/sb16.cc
+++ iodev/sb16.cc
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// $Id: sb16.cc,v 1.13 2001/10/03 13:10:38 bdenney Exp $
+// $Id: sb16.cc,v 1.14 2001/12/22 13:30:10 vruppert Exp $
 /////////////////////////////////////////////////////////////////////////
 //
 //  Copyright (C) 2001  MandrakeSoft S.A.
@@ -127,7 +127,7 @@
   if ( (bx_options.sb16.Omidimode->get () == 2) ||
        (bx_options.sb16.Omidimode->get () == 3) )
     {
-      MIDIDATA = fopen(bx_options.sb16.Omidifile->getptr (),"w");
+      MIDIDATA = fopen(bx_options.sb16.Omidifile->getptr (),"wb");
       if (MIDIDATA == NULL)
 	{
 	  writelog (MIDILOG(2), "Error opening file %s. Midimode disabled.", bx_options.sb16.Omidifile->getptr ());
@@ -140,7 +140,7 @@
   if ( (bx_options.sb16.Owavemode->get () == 2) ||
        (bx_options.sb16.Owavemode->get () == 3) )
     {
-      WAVEDATA = fopen(bx_options.sb16.Owavefile->getptr (),"w");
+      WAVEDATA = fopen(bx_options.sb16.Owavefile->getptr (),"wb");
       if (WAVEDATA == NULL)
 	{
 	  writelog (WAVELOG(2), "Error opening file %s. Wavemode disabled.", bx_options.sb16.Owavefile);
@@ -215,14 +215,12 @@
     BX_SB16_THIS devices->register_io_write_handler(this,
        &write_handler, addr, "SB16");
     }
-  /* Uncomment this if you know the consequences...
   for (addr=BX_SB16_IOADLIB; addr<BX_SB16_IOADLIB+BX_SB16_IOADLIBLEN; addr++) {
     BX_SB16_THIS devices->register_io_read_handler(this,
        read_handler, addr, "SB16");
     BX_SB16_THIS devices->register_io_write_handler(this,
        write_handler, addr, "SB16");
     }
-  */

   writelog(BOTHLOG(3),
 	   "driver initialised, IRQ %d, IO %03x/%03x/%03x, DMA %d/%d",
@@ -2256,7 +2254,7 @@
       if (channum != -1)
 	{
 	  int needchange = 0;
-	  if ((OPL.oper[OPL.chan[channum].opnum[0]][4] & 1) != (value & 1))
+	  if ((OPL.oper[OPL.chan[channum].opnum[0]][4] & 1) != (int)(value & 1))
 	    needchange = 1;

 	  opl_changeop(channum, OPL.chan[channum].opnum[0], 4, value & 0x3f);
@@ -3139,8 +3137,8 @@
     {
 	time_t timep = time(NULL);
 	tm *t = localtime(&timep);
-	BX_INFO(( "SB16 %02d:%02d:%02d (%i): ",
-		t->tm_hour, t->tm_min, t->tm_sec, loglevel ));
+	fprintf(LOGFILE, "%02d:%02d:%02d (%i): ",
+		t->tm_hour, t->tm_min, t->tm_sec, loglevel );
 	va_list ap;
 	va_start(ap, str);
 	vfprintf(LOGFILE, str, ap);


make_keyword expects the buffer size is >=256B

--- hwpfilter/source/hwpeq.cpp
+++ hwpfilter/source/hwpeq.cpp
@@ -670,7 +670,7 @@
 static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
 {
   MzString  white, token;
-  char      key[20];
+  char      key[256];
   int       ch, result;
   hwpeq     *eq = 0;


r9410/sofa-dev : FIX : Compilation

r9410/sofa-dev : FIX : Compilation

--- modules/sofa/component/collision/FrictionContact.inl
+++ modules/sofa/component/collision/FrictionContact.inl
@@ -383,7 +383,7 @@
             return false;
         }

-        parent = fromObjects[0]->getContext();
+        BaseContext *parent = fromObjects[0]->getContext();
         parentNode = dynamic_cast< Node* >(parent);
     }
     else


Clear memory buffers before using

Clear memory buffers before using

git-svn-id: 769d22dfa2d22aad706b9a451492fb87c0735f19@10276 08b38cba-cd3b-11de-854e-f91c5b6e4272

--- modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.cpp
+++ modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.cpp
@@ -57,6 +57,7 @@
 {
    vpr::ReturnStatus status(vpr::ReturnStatus::Fail);
    char local_host_name[257];
+   memset(local_host_name, 0, 257);

    if ( PR_GetSystemInfo(PR_SI_HOSTNAME, local_host_name, 256) == PR_SUCCESS )
    {
@@ -145,6 +146,7 @@
 std::string InetAddrNSPR::getAddressString (void) const
 {
    char ip_str[256];
+   memset(ip_str, 0, 256);
    PR_NetAddrToString(&mAddr, ip_str, sizeof(PRNetAddr));
    std::string temp(ip_str);
    return temp;
@@ -154,6 +156,7 @@
 {
    std::string hostname;
    char buffer[PR_NETDB_BUF_SIZE];
+   memset(buffer, 0, PR_NETDB_BUF_SIZE);
    PRStatus ret_status;
    PRHostEnt hostent;


Remove (useless) opengl functions in RestShapeSpringsForceField

Former-commit-id: f256d39a732f17c5d73617f2146352403795df20

--- modules/SofaDeformable/RestShapeSpringsForceField.cpp
+++ modules/SofaDeformable/RestShapeSpringsForceField.cpp
@@ -340,14 +340,9 @@

     sofa::helper::vector<sofa::defaulttype::Vector3> vertices;

-    sofa::defaulttype::Vec4f green(0.0, 1.0, 0.0, 1.0);
     for (unsigned int i=0; i<m_indices.size(); i++)
     {
         const unsigned int index = m_indices[i];
-
-        glLineWidth(4.0);
-        glBegin(GL_LINES);
-        glColor3f(0,1,0);

         sofa::defaulttype::Vector3 v0(p[index].getCenter()[0],
                                       p[index].getCenter()[1],


Make sure that the stanza is intialized to something because otherwise it might crap out because of a double-free.

--- iq-stanza.cpp
+++ iq-stanza.cpp
@@ -83,6 +83,9 @@
 	result = new IqStanza();
       }
     }
+    else {
+      result = new IqStanza();
+    }
   }
   if (NULL != result) {
     if ("" != errorMessage) {


a potential fix for a locking bug

a potential fix for a locking bug

git-svn-id: ab31aa9d750fa55c180f0babe9bbbc56aba70783@62 72a8a67b-58ad-ce6a-cf8f-6a8106eb947b

--- leveldb_ext.cc
+++ leveldb_ext.cc
@@ -112,6 +112,8 @@
 		INITERROR;
 	}

+	PyEval_InitThreads();
+
 	#if PY_MAJOR_VERSION >= 3
 	return leveldb_module;
 	#endif


Fix multi-threading send message though libevent

Change-Id: I2faa6e6c6f3bf8a08e43fc3972a762562bbbde92
Reviewed-on: http://gerrit.aldebaran.lan:8080/2480
Reviewed-by: cgestes <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>
Tested-by: cgestes <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>

--- libqimessaging/src/transport_socket_libevent_p.cpp
+++ libqimessaging/src/transport_socket_libevent_p.cpp
@@ -286,48 +286,50 @@
     qi::Message *m = new qi::Message();
     *m = msg;
     m->_p->complete();
-    assert(m->isValid());
-
-    struct evbuffer *evb = bufferevent_get_output(bev);
-
+
+    struct evbuffer *mess = evbuffer_new();
     // m might be deleted.
     qi::Buffer *b = new qi::Buffer(m->buffer());
-
-    if (evbuffer_add_reference(evb,
+    if (evbuffer_add_reference(mess,
                                m->_p->getHeader(),
                                sizeof(qi::MessagePrivate::MessageHeader),
                                qi::TransportSocketLibEvent::onMessageSent,
                                static_cast<void *>(m)) != 0)
     {
       qiLogError("qimessaging.TransportSocketLibevent") << "Add reference fail in header";
+      evbuffer_free(mess);
       delete m;
       delete b;
       return false;
     }
     size_t sz = b->size();
-    if (sz) {
-      if (evbuffer_add_reference(evb,
+
+    if (sz)
+    {
+      if (evbuffer_add_reference(mess,
                                  b->data(),
                                  sz,
                                  qi::TransportSocketLibEvent::onBufferSent,
                                  static_cast<void *>(b)) != 0)
       {
         qiLogError("qimessaging.TransportSocketLibevent") << "Add reference fail for block of size " << sz;
+        evbuffer_free(mess);
         delete b;
         return false;
       }
     }
-    else {
+    else
+    {
       delete b;
     }

-    if (bufferevent_write_buffer(bev, evb) != 0)
+    if (bufferevent_write_buffer(bev, mess) != 0)
     {
       qiLogError("qimessaging.TransportSocketLibevent") << "Can't add buffer to the send queue";
-      evbuffer_drain(evb, sizeof(qi::MessagePrivate::MessageHeader) + sz);
+      evbuffer_free(mess);
       return false;
     }
-
+    evbuffer_free(mess);
     return true;
   }
 }


Fix post-merge issues

Fix post-merge issues

--- library/MultiRegions/AssemblyMap/AssemblyMapCG.cpp
+++ library/MultiRegions/AssemblyMap/AssemblyMapCG.cpp
@@ -62,7 +62,7 @@
          * These mappings are used by GlobalLinSys to generate the global
          * system.
          */
-
+
         /**
          *
          */
@@ -139,7 +139,7 @@

                 }

-                // If all boundaries are Dirichlet take out of mask
+                // If all boundaries are Dirichlet take out of mask
                 if(cnt == bndConditions.num_elements())
                 {
                     for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
@@ -401,7 +401,7 @@
             // Find the minimum boundary vertex ID on each process
             Array<OneD, int> bcminvertid(n, 0);
             bcminvertid[p] = vMaxVertId;
-            vCommRow->AllReduce(bcminvertid, LibUtilities::ReduceMax);
+            vComm->AllReduce(bcminvertid, LibUtilities::ReduceMax);

             // Find the process rank with the minimum boundary vertex ID
             int maxIdx = Vmath::Imax(n, bcminvertid, 1);
@@ -1728,7 +1728,7 @@
                         for (j = 0; j < exp->GetNfaces(); ++j)
                         {
                             meshFaceId = exp->GetGeom()->GetFid(j);
-
+
                             if (graph[2][meshFaceId] >= firstNonDirGraphVertId)
                             {
                                 vwgts_perm[graph[2][meshFaceId] -


Perception: Fix a bug in fusion about not initialized

--- modules/perception/obstacle/onboard/fusion_subnode.cc
+++ modules/perception/obstacle/onboard/fusion_subnode.cc
@@ -138,8 +138,8 @@

   auto lane_iter = reserve_field_map.find("lane_event_id");
   if (lane_iter == reserve_field_map.end()) {
-    AWARN << "Failed to find camera_event_id:" << reserve_;
-    AINFO << "camera_event_id will be set -1";
+    AWARN << "Failed to find lane_event_id_:" << reserve_;
+    AINFO << "lane_event_id_ will be set -1";
     lane_event_id_ = -1;
   } else {
     lane_event_id_ = static_cast<EventID>(atoi((lane_iter->second).c_str()));
@@ -150,8 +150,7 @@

 Status FusionSubnode::ProcEvents() {
   for (auto event_meta : sub_meta_events_) {
-    // ignore lane event from polling
-    if (event_meta.event_id == lane_event_id_) continue;
+    if (event_meta.event_id == lane_event_id_) continue;  // ignore lane event

     std::vector<Event> events;
     if (!SubscribeEvents(event_meta, &events)) {
@@ -305,11 +304,13 @@
   } else if (event.event_id == camera_event_id_ &&
              camera_object_data_ != nullptr) {
     get_data_succ = camera_object_data_->Get(data_key, objs);
-    // trying to get lane shared data as well
-    Event lane_event;
-    if (event_manager_->Subscribe(lane_event_id_, &lane_event, false)) {
-      get_data_succ = lane_shared_data_->Get(data_key, &lane_objects_);
-      ADEBUG << "getting lane data successfully for data key " << data_key;
+
+    if (lane_shared_data_ != nullptr && lane_event_id_ != -1) {
+      Event lane_event;
+      if (event_manager_->Subscribe(lane_event_id_, &lane_event, false)) {
+        get_data_succ = lane_shared_data_->Get(data_key, &lane_objects_);
+        ADEBUG << "getting lane data successfully for data key " << data_key;
+      }
     }
   } else {
     AERROR << "Event id is not supported. event:" << event.to_string();
@@ -344,15 +345,17 @@
   }

   if (FLAGS_use_navigation_mode) {
-    // generate lane marker protobuf messages
-    LaneMarkers *lane_markers = obstacles->mutable_lane_marker();
-    LaneObjectsToLaneMarkerProto(*(lane_objects_), lane_markers);
-
     // Relative speed of objects + latest ego car speed in X
     for (auto obstacle : obstacles->perception_obstacle()) {
       obstacle.mutable_velocity()->set_x(obstacle.velocity().x() +
                                          chassis_speed_mps_);
     }
+
+    // generate lane marker protobuf messages
+    if (lane_shared_data_ != nullptr && lane_event_id_ != -1) {
+      LaneMarkers *lane_markers = obstacles->mutable_lane_marker();
+      LaneObjectsToLaneMarkerProto(*(lane_objects_), lane_markers);
+    }
   }

   ADEBUG << "PerceptionObstacles: " << obstacles->ShortDebugString();


planning: remove the most common unnecessary log.

FYI: top 10 most common logs in plannning:
 102128 st_boundary_mapper.cc:136] No mapping for decision: ignore {
  39561 dp_st_speed_optimizer.cc:163] Mapping obstacle for dp st speed optimizer failed.
  39560 em_planner.cc:462] Slowing down the car with polynomial.
  39560 em_planner.cc:194] Failed to run tasks[DpStSpeedOptimizer], Error message: Mapping obstacle for dp st speed optimizer failed.
  18354 too small. It should be larger than half vehicle width[1.05].
   3822 hdmap_common.cc:184] lane[id = id: "11265_1_-1"
   3822 hdmap_common.cc:175] lane[id = id: "11265_1_-1"
   3801 hdmap_common.cc:184] lane[id = id: "11265dup0_1_-1"
   3801 hdmap_common.cc:175] lane[id = id: "11265dup0_1_-1"

--- modules/planning/tasks/st_graph/st_boundary_mapper.cc
+++ modules/planning/tasks/st_graph/st_boundary_mapper.cc
@@ -132,7 +132,7 @@
         return Status(ErrorCode::PLANNING_ERROR,
                       "Fail to map overtake/yield decision");
       }
-    } else {
+    } else if (!decision.has_ignore()) {
       AWARN << "No mapping for decision: " << decision.DebugString();
     }
   }


INTEGRATION: CWS ooo19126 (1.2.18); FILE MERGED 2005/09/05 13:11:31 rt 1.2.18.1: #i54170# Change license header: remove SISSL

--- autodoc/source/inc/manip.hxx
+++ autodoc/source/inc/manip.hxx
@@ -1,61 +1,35 @@
 /*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
  *
  *  $RCSfile: manip.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.3 $
  *
- *  last change: $Author: obo $ $Date: 2004-11-15 13:38:02 $
+ *  last change: $Author: rt $ $Date: 2005-09-07 18:09:37 $
  *
- *  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
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
  *
  *
- *  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.
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
  *
- *  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.
+ *    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.
  *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *    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.
  *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
+ *    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
  *
  ************************************************************************/


Fix compiler warning

Fix compiler warning

--- src/MissionManager/MissionController.cc
+++ src/MissionManager/MissionController.cc
@@ -464,7 +464,7 @@
     for (int i=0; i<visualItems->count(); i++) {
         if (visualItems->value<VisualMissionItem*>(i)->isSimpleItem()) {
             SimpleMissionItem* doJumpItem = visualItems->value<SimpleMissionItem*>(i);
-            if (doJumpItem->command() == MAV_CMD_DO_JUMP) {
+            if (doJumpItem->command() == (MAV_CMD)MAV_CMD_DO_JUMP) {
                 bool found = false;
                 int findDoJumpId = doJumpItem->missionItem().param1();
                 for (int j=0; j<visualItems->count(); j++) {


VTOL Takeoff should be considered a transition to FW

--- src/MissionManager/MissionController.cc
+++ src/MissionManager/MissionController.cc
@@ -1548,11 +1548,9 @@
         // Update VTOL state
         if (simpleItem && _controllerVehicle->vtol()) {
             switch (simpleItem->command()) {
-            case MAV_CMD_NAV_TAKEOFF:
+            case MAV_CMD_NAV_TAKEOFF:       // This will do a fixed wing style takeoff
+            case MAV_CMD_NAV_VTOL_TAKEOFF:  // Vehicle goes straight up and then transitions to FW
                 vtolInHover = false;
-                break;
-            case MAV_CMD_NAV_VTOL_TAKEOFF:
-                vtolInHover = true;
                 break;
             case MAV_CMD_NAV_LAND:
                 vtolInHover = false;


MeshGui::SoFCIndexedFaceSet: fix missing normal cache unlock

--- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp
+++ src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp
@@ -576,6 +576,9 @@

         drawCoords(static_cast<const SoGLCoordinateElement*>(coords), cindices, numindices,
                    normals, nindices, &mb, mindices, binding, &tb, tindices);
+
+        if(normalCacheUsed)
+            this->readUnlockNormalCache();
         // Disable caching for this node
         SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DONT_AUTO_CACHE);
 #endif
@@ -847,6 +850,9 @@
     }

     render.generateGLArrays(action, matbind, face_vertices, face_indices);
+
+    if(normalCacheUsed)
+        this->readUnlockNormalCache();
 }

 void SoFCIndexedFaceSet::doAction(SoAction * action)