EC_WebView: fix warnings and a mem leak.

--- src/Application/SceneWidgetComponents/EC_WebView.cpp
+++ src/Application/SceneWidgetComponents/EC_WebView.cpp
@@ -44,7 +44,7 @@

 #include "MemoryLeakCheck.h"

-static u32 NoneControlID = 0;
+static const u32 NoneControlID = 0;

 EC_WebView::EC_WebView(Scene *scene) :
     IComponent(scene),
@@ -54,7 +54,6 @@
     webviewHasContent_(false),
     componentPrepared_(false),
     myControllerId_(0),
-    currentControllerName_(""),
     webviewUrl(this, "View URL", QString()),
     webviewSize(this, "View Size", QPoint(800,600)),
     renderSubmeshIndex(this, "Render Submesh", 0),
@@ -64,7 +63,7 @@
     illuminating(this, "Illuminating", true),
     enabled(this, "Enabled", true)
 {
-    interactionMetaData_ = new AttributeMetadata(); /**< @todo memory leak */
+    interactionMetaData_ = new AttributeMetadata();

     static AttributeMetadata submeshMetaData;
     static AttributeMetadata refreshRateMetadata;
@@ -85,7 +84,7 @@
     controllerId.SetMetadata(&nonDesignableMetadata);

     // Initializations depending if we are on the server or client
-    TundraLogic::TundraLogicModule *tundraLogic = GetFramework()->GetModule<TundraLogic::TundraLogicModule>();
+    TundraLogicModule *tundraLogic = GetFramework()->Module<TundraLogicModule>();
     if (tundraLogic)
     {
         if (tundraLogic->IsServer())
@@ -115,7 +114,7 @@
     connect(resizeRenderTimer_, SIGNAL(timeout()), SLOT(RenderDelayed()), Qt::UniqueConnection);

     // Prepare scene interactions
-    SceneInteract *sceneInteract = GetFramework()->GetModule<SceneInteract>();
+    SceneInteract *sceneInteract = GetFramework()->Module<SceneInteract>();
     if (sceneInteract)
     {
         connect(sceneInteract, SIGNAL(EntityClicked(Entity*, Qt::MouseButton, RaycastResult*)),
@@ -125,6 +124,7 @@

 EC_WebView::~EC_WebView()
 {
+    SAFE_DELETE(interactionMetaData_);
     disconnect();
     ResetWebView(true);
 }
@@ -198,7 +198,7 @@

 void EC_WebView::ServerCheckControllerValidity(u32 connectionID)
 {
-    TundraLogic::TundraLogicModule *tundraLogic = GetFramework()->GetModule<TundraLogic::TundraLogicModule>();
+    TundraLogicModule *tundraLogic = GetFramework()->Module<TundraLogicModule>();
     if (tundraLogic)
     {
         if (connectionID != NoneControlID)
@@ -524,7 +524,7 @@
 #endif

 #ifdef SCENEWIDGET_BROWSER_SHARED_DATA
-        BrowserUiPlugin *browserPlugin = framework->GetModule<BrowserUiPlugin>();
+        BrowserUiPlugin *browserPlugin = framework->Module<BrowserUiPlugin>();
         if (browserPlugin)
         {
             // Shared disk cache and cookies for all browsers
@@ -586,7 +586,7 @@
 }

 #ifndef QT_NO_OPENSSL
-void EC_WebView::OnSslErrors(QNetworkReply */*reply*/, const QList<QSslError>& errors)
+void EC_WebView::OnSslErrors(QNetworkReply * /*reply*/, const QList<QSslError>& errors)
 {
     LogWarning("EC_WebView: Could not load page, ssl errors occurred in url '" + getwebviewUrl() + "'");
     if (errors.isEmpty())
@@ -653,7 +653,7 @@
             // Above won't reset widget if its visible, then we use local instance
             if (!webview_)
             {
-                SceneWidgetComponents *sceneComponentsPlugin = GetFramework()->GetModule<SceneWidgetComponents>();
+                SceneWidgetComponents *sceneComponentsPlugin = GetFramework()->Module<SceneWidgetComponents>();
                 if (sceneComponentsPlugin)
                     sceneComponentsPlugin->WebRenderingRequest(this, url, QSize(getwebviewSize().x(), getwebviewSize().y()));
                 else
@@ -859,7 +859,7 @@

 void EC_WebView::AttributesChanged()
 {
-    TundraLogic::TundraLogicModule *tundraLogic = GetFramework()->GetModule<TundraLogic::TundraLogicModule>();
+    TundraLogicModule *tundraLogic = GetFramework()->Module<TundraLogicModule>();
     if (tundraLogic)
     {
         if (tundraLogic->IsServer())
@@ -1086,7 +1086,7 @@
         // Resolve our user name, use connection id if not available
         QString myControllerName;
         u32 myId = 0;
-        TundraLogic::TundraLogicModule *tundraLogic = GetFramework()->GetModule<TundraLogic::TundraLogicModule>();
+        TundraLogicModule *tundraLogic = GetFramework()->Module<TundraLogicModule>();
         if (tundraLogic)
         {
             if (!tundraLogic->IsServer())
@@ -1098,7 +1098,6 @@
             }
             else
             {
-                // Not sure if 0 is reserved for the server. Lets stick with -2 being server.
                 // Note that this quite a rare case that server wants to control outside of dev testing.
                 // Also note that servers wont get sync browsing as the entity actions are sent to peers.
                 myControllerName = "server";


Improved client failover.

Improved client failover.

--- src/Application/ShardServer/ShardQuorumProcessor.cpp
+++ src/Application/ShardServer/ShardQuorumProcessor.cpp
@@ -63,6 +63,8 @@
     if (proposalID != message.proposalID)
         return;

+    Log_Debug("received lease for quorum %U", GetQuorumID());
+
     SortedList<uint64_t>& shards = shardServer->GetConfigState()->GetQuorum(GetQuorumID())->shards;
     if (shards != message.shards)
         return;


apply forward slash for list_parameters (#224)

--- test_rclcpp/test/parameter_fixtures.hpp
+++ test_rclcpp/test/parameter_fixtures.hpp
@@ -37,8 +37,8 @@
     rclcpp::parameter::ParameterVariant("bar", "hello"),
     rclcpp::parameter::ParameterVariant("barstr", std::string("hello_str")),
     rclcpp::parameter::ParameterVariant("baz", 1.45),
-    rclcpp::parameter::ParameterVariant("foo.first", 8),
-    rclcpp::parameter::ParameterVariant("foo.second", 42),
+    rclcpp::parameter::ParameterVariant("foo/first", 8),
+    rclcpp::parameter::ParameterVariant("foo/second", 42),
     rclcpp::parameter::ParameterVariant("foobar", true),
   });
   printf("Got set_parameters result\n");
@@ -61,8 +61,8 @@
     rclcpp::parameter::ParameterVariant("bar", "hello"),
     rclcpp::parameter::ParameterVariant("barstr", std::string("hello_str")),
     rclcpp::parameter::ParameterVariant("baz", 1.45),
-    rclcpp::parameter::ParameterVariant("foo.first", 8),
-    rclcpp::parameter::ParameterVariant("foo.second", 42),
+    rclcpp::parameter::ParameterVariant("foo/first", 8),
+    rclcpp::parameter::ParameterVariant("foo/second", 42),
     rclcpp::parameter::ParameterVariant("foobar", true),
   });
   rclcpp::spin_until_future_complete(node, set_parameters_results);  // Wait for the results.
@@ -82,7 +82,7 @@
   auto parameters_and_prefixes = parameters_client->list_parameters({"foo", "bar"},
       rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
   for (auto & name : parameters_and_prefixes.names) {
-    EXPECT_TRUE(name == "foo" || name == "bar" || name == "foo.first" || name == "foo.second");
+    EXPECT_TRUE(name == "foo" || name == "bar" || name == "foo/first" || name == "foo/second");
   }
   for (auto & prefix : parameters_and_prefixes.prefixes) {
     EXPECT_STREQ("foo", prefix.c_str());
@@ -102,7 +102,7 @@
   // Test different depth
   auto parameters_and_prefixes5 = parameters_client->list_parameters({"foo"}, 2);
   for (auto & name : parameters_and_prefixes5.names) {
-    EXPECT_TRUE(name == "foo" || name == "foo.first" || name == "foo.second");
+    EXPECT_TRUE(name == "foo" || name == "foo/first" || name == "foo/second");
   }
   for (auto & prefix : parameters_and_prefixes5.prefixes) {
     EXPECT_STREQ("foo", prefix.c_str());
@@ -141,7 +141,7 @@
   parameters_and_prefixes = parameters_client->list_parameters({},
       rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
   std::vector<std::string> all_names = {
-    "foo", "bar", "barstr", "baz", "foo.first", "foo.second", "foobar"
+    "foo", "bar", "barstr", "baz", "foo/first", "foo/second", "foobar"
   };
   EXPECT_EQ(parameters_and_prefixes.names.size(), all_names.size());
   for (auto & name : all_names) {
@@ -189,7 +189,7 @@
   rclcpp::spin_until_future_complete(node, result);
   auto parameters_and_prefixes = result.get();
   for (auto & name : parameters_and_prefixes.names) {
-    EXPECT_TRUE(name == "foo" || name == "bar" || name == "foo.first" || name == "foo.second");
+    EXPECT_TRUE(name == "foo" || name == "bar" || name == "foo/first" || name == "foo/second");
   }
   for (auto & prefix : parameters_and_prefixes.prefixes) {
     EXPECT_STREQ("foo", prefix.c_str());
@@ -213,7 +213,7 @@
   rclcpp::spin_until_future_complete(node, result4a);
   auto parameters_and_prefixes4a = result4a.get();
   for (auto & name : parameters_and_prefixes4a.names) {
-    EXPECT_TRUE(name == "foo" || name == "foo.first" || name == "foo.second");
+    EXPECT_TRUE(name == "foo" || name == "foo/first" || name == "foo/second");
   }
   for (auto & prefix : parameters_and_prefixes4a.prefixes) {
     EXPECT_STREQ("foo", prefix.c_str());
@@ -259,7 +259,7 @@
   rclcpp::spin_until_future_complete(node, result5);
   parameters_and_prefixes = result5.get();
   std::vector<std::string> all_names = {
-    "foo", "bar", "barstr", "baz", "foo.first", "foo.second", "foobar"
+    "foo", "bar", "barstr", "baz", "foo/first", "foo/second", "foobar"
   };
   EXPECT_EQ(parameters_and_prefixes.names.size(), all_names.size());
   for (auto & name : all_names) {


- assign a unique serial number to each drive (fixes detection problems with   Linux kernels 2.6.x: "ignoring undecoded slave")

--- iodev/harddrv.cc
+++ iodev/harddrv.cc
@@ -2606,16 +2606,19 @@
 bx_hard_drive_c::identify_ATAPI_drive(Bit8u channel)
 {
   unsigned i;
+  char serial_number[21];

   BX_SELECTED_DRIVE(channel).id_drive[0] = (2 << 14) | (5 << 8) | (1 << 7) | (2 << 5) | (0 << 0); // Removable CDROM, 50us response, 12 byte packets

   for (i = 1; i <= 9; i++)
 	BX_SELECTED_DRIVE(channel).id_drive[i] = 0;

-  const char* serial_number = " VT00001\0\0\0\0\0\0\0\0\0\0\0\0";
+  strcpy(serial_number, "BXCD00000           ");
+  serial_number[7] = channel + 49;
+  serial_number[8] = BX_HD_THIS channels[channel].drive_select + 49;
   for (i = 0; i < 10; i++) {
-	BX_SELECTED_DRIVE(channel).id_drive[10+i] = (serial_number[i*2] << 8) |
-	      serial_number[i*2 + 1];
+    BX_SELECTED_DRIVE(channel).id_drive[10+i] = (serial_number[i*2] << 8) |
+      serial_number[i*2 + 1];
   }

   for (i = 20; i <= 22; i++)
@@ -2704,6 +2707,7 @@
 bx_hard_drive_c::identify_drive(Bit8u channel)
 {
   unsigned i;
+  char serial_number[21];
   Bit32u temp32;
   Bit16u temp16;

@@ -2719,10 +2723,10 @@
   BX_SELECTED_DRIVE(channel).id_drive[8] = 0x000a;
   BX_SELECTED_DRIVE(channel).id_drive[9] = 0x0000;

-  char* serial_number = " CA00GSQ\0\0\0\0\0\0\0\0\0\0\0\0";
+  strcpy(serial_number, " CA00GSQ\0\0\0\0\0\0\0\0\0\0\0\0";
   for (i = 0; i < 10; i++) {
-	BX_SELECTED_DRIVE(channel).id_drive[10+i] = (serial_number[i*2] << 8) |
-	      serial_number[i*2 + 1];
+    BX_SELECTED_DRIVE(channel).id_drive[10+i] = (serial_number[i*2] << 8) |
+      serial_number[i*2 + 1];
   }

   BX_SELECTED_DRIVE(channel).id_drive[20] = 3;
@@ -2865,8 +2869,13 @@

   // Word 10-19: Serial number (20 ASCII characters, 0000h=not specified)
   // This field is right justified and padded with spaces (20h).
-  for (i=10; i<=19; i++)
-    BX_SELECTED_DRIVE(channel).id_drive[i] = 0;
+  strcpy(serial_number, "BXHD00000           ");
+  serial_number[7] = channel + 49;
+  serial_number[8] = BX_HD_THIS channels[channel].drive_select + 49;
+  for (i = 0; i < 10; i++) {
+    BX_SELECTED_DRIVE(channel).id_drive[10+i] = (serial_number[i*2] << 8) |
+      serial_number[i*2 + 1];
+  }

   // Word 20: buffer type
   //          0000h = not specified


fuzzing client fully implements 9.1.x, 9.2.x, 9.7.x, 9.8.x

--- examples/fuzzing_client/fuzzing_client.cpp
+++ examples/fuzzing_client/fuzzing_client.cpp
@@ -25,37 +25,106 @@
  *
  */

-#include "../../src/endpoint.hpp"
 #include "../../src/roles/client.hpp"
-
+#include "../../src/websocketpp.hpp"
+
+#include <cstdlib>
+#include <ctime>
 #include <iostream>

-typedef websocketpp::endpoint<websocketpp::role::client,websocketpp::socket::plain> plain_endpoint_type;
-typedef plain_endpoint_type::handler_ptr plain_handler_ptr;
-typedef plain_endpoint_type::connection_ptr connection_ptr;
+using websocketpp::client;

 // base test case handler
-class test_case_handler : public plain_endpoint_type::handler {
+class test_case_handler : public client::handler {
 public:
     typedef test_case_handler type;
-    typedef plain_endpoint_type::connection_ptr connection_ptr;
-
-    virtual void end(connection_ptr connection) {
+
+    void start(connection_ptr con, int timeout) {
+        m_timer.reset(new boost::asio::deadline_timer(
+            con->get_io_service(),
+            boost::posix_time::seconds(0))
+        );
+        m_timer->expires_from_now(boost::posix_time::milliseconds(timeout));
+        m_timer->async_wait(boost::bind(&type::on_timer,
+                                        this,
+                                        con,
+                                        boost::asio::placeholders::error));
+
+        m_start_time = boost::posix_time::microsec_clock::local_time();
+    }
+
+    virtual void end(connection_ptr con) {
         // test is over, give control back to controlling handler
         boost::posix_time::time_period len(m_start_time,m_end_time);

-        if (m_pass) {
-            std::cout << " passes in " << len.length() << std::endl;
+        switch (m_pass) {
+            case FAIL:
+                std::cout << " fails in " << len.length() << std::endl;
+                break;
+            case PASS:
+                std::cout << " passes in " << len.length() << std::endl;
+                break;
+            case TIME_OUT:
+                std::cout << " times out in " << len.length() << std::endl;
+                break;
+        }
+
+        con->close(websocketpp::close::status::NORMAL,"");
+    }
+
+    // Just does random ascii right now. True random UTF8 with multi-byte stuff
+    // would probably be better
+    void fill_utf8(std::string& data,size_t size,bool random = true) {
+        if (random) {
+            uint32_t val;
+            for (int i = 0; i < size; i++) {
+                if (i%4 == 0) {
+                    val = uint32_t(rand());
+                }
+
+                data.push_back(char(((reinterpret_cast<uint8_t*>(&val)[i%4])%95)+32));
+            }
         } else {
-            std::cout << " fails in " << len.length() << std::endl;
-        }
-
-        connection->close(websocketpp::close::status::NORMAL,"");
+            data.assign(size,'*');
+        }
+    }
+
+    void fill_binary(std::string& data,size_t size,bool random = true) {
+        if (random) {
+            int32_t val;
+            for (int i = 0; i < size; i++) {
+                if (i%4 == 0) {
+                    val = rand();
+                }
+
+                data.push_back((reinterpret_cast<char*>(&val))[i%4]);
+            }
+        } else {
+            data.assign(size,'*');
+        }
+    }
+
+    void on_timer(connection_ptr con,const boost::system::error_code& error) {
+        if (error == boost::system::errc::operation_canceled) {
+            return; // timer was canceled because test finished
+        }
+
+        // time out
+        m_end_time = boost::posix_time::microsec_clock::local_time();
+        m_pass = TIME_OUT;
+        this->end(con);
     }
 protected:
-    bool                        m_pass;
+    enum status {
+        FAIL = 0,
+        PASS = 1,
+        TIME_OUT = 2
+    };
+
+    status                      m_pass;
     boost::posix_time::ptime    m_start_time;
     boost::posix_time::ptime    m_end_time;
+    boost::shared_ptr<boost::asio::deadline_timer> m_timer;
 };

 // test class for 9.1.* and 9.2.*
@@ -71,158 +140,131 @@
         m_test_sizes[5] = 16777216;
     }

-    void on_open(connection_ptr connection) {
+    void on_open(connection_ptr con) {
         std::cout << "Test 9." << m_minor << "." << m_subtest;

-
-
         m_data.reserve(m_test_sizes[m_subtest-1]);

+        int timeout = 10000; // 10 sec
+
+        // extend timeout to 100 sec for the longer tests
+        if ((m_minor == 1 && m_subtest >= 3) || (m_minor == 2 && m_subtest >= 5)) {
+            timeout = 100000;
+        }
+
         if (m_minor == 1) {
-            fill_utf8(connection,true);
-            m_start_time = boost::posix_time::microsec_clock::local_time();
-            connection->send(m_data,websocketpp::frame::opcode::TEXT);
+            fill_utf8(m_data,m_test_sizes[m_subtest-1],true);
+            start(con,timeout);
+            con->send(m_data,websocketpp::frame::opcode::TEXT);
         } else if (m_minor == 2) {
-            fill_binary(connection,true);
-            m_start_time = boost::posix_time::microsec_clock::local_time();
-            connection->send(m_data,websocketpp::frame::opcode::BINARY);
+            fill_binary(m_data,m_test_sizes[m_subtest-1],true);
+            start(con,timeout);
+            con->send(m_data,websocketpp::frame::opcode::BINARY);
         } else {
             std::cout << " has unknown definition." << std::endl;
         }
     }

-    // Just does random ascii right now. True random UTF8 with multi-byte stuff
-    // would probably be better
-    void fill_utf8(connection_ptr connection,bool random = true) {
-        if (random) {
-            uint32_t data;
-            for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
-                if (i%4 == 0) {
-                    data = uint32_t(connection->rand());
-                }
-
-                m_data.push_back(char(((reinterpret_cast<uint8_t*>(&data)[i%4])%95)+32));
-            }
-        } else {
-            m_data.assign(m_test_sizes[m_subtest-1],'*');
-        }
-    }
-
-    void fill_binary(connection_ptr connection, bool random = true) {
-        if (random) {
-            int32_t data;
-            for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
-                if (i%4 == 0) {
-                    data = connection->rand();
-                }
-
-                m_data.push_back((reinterpret_cast<char*>(&data))[i%4]);
-            }
-        } else {
-            m_data.assign(m_test_sizes[m_subtest-1],'*');
-        }
-    }
-
-    void on_message(connection_ptr connection,websocketpp::message::data_ptr msg) {
+    void on_message(connection_ptr con,websocketpp::message::data_ptr msg) {
+        m_timer->cancel();
         m_end_time = boost::posix_time::microsec_clock::local_time();

         // Check whether the echoed data matches exactly
-        m_pass = (msg->get_payload() == m_data);
-
-        this->end(connection);
+        m_pass = ((msg->get_payload() == m_data) ? PASS : FAIL);
+        this->end(con);
     }
 private:
     int         m_minor;
     int         m_subtest;
-    size_t      m_test_sizes[6];
+    int         m_test_sizes[6];
     std::string m_data;
 };

 // test class for 9.7.* and 9.8.*
-/*class test_9_7_X : public test_case_handler {
+class test_9_7_X : public test_case_handler {
 public:
-    test_9_1_X(int minor, int subtest) : m_minor(minor),m_subtest(subtest){
+    test_9_7_X(int minor, int subtest)
+     : m_minor(minor),
+       m_subtest(subtest),
+       m_iterations(1000),
+       m_acks(0)
+    {
         // needs more C++11 intializer lists =(
-        m_test_sizes[0] = 65536;
-        m_test_sizes[1] = 262144;
-        m_test_sizes[2] = 1048576;
-        m_test_sizes[3] = 4194304;
-        m_test_sizes[4] = 8388608;
-        m_test_sizes[5] = 16777216;
-    }
-
-    void on_open(connection_ptr connection) {
+        m_test_sizes[0] = 0;
+        m_test_sizes[1] = 16;
+        m_test_sizes[2] = 64;
+        m_test_sizes[3] = 256;
+        m_test_sizes[4] = 1024;
+        m_test_sizes[5] = 4096;
+
+        m_test_timeouts[0] = 60000;
+        m_test_timeouts[1] = 60000;
+        m_test_timeouts[2] = 60000;
+        m_test_timeouts[3] = 120000;
+        m_test_timeouts[4] = 240000;
+        m_test_timeouts[5] = 480000;
+    }
+
+    void on_open(connection_ptr con) {
         std::cout << "Test 9." << m_minor << "." << m_subtest;

-
-
+        // Get a message buffer from the connection
+        message_ptr msg = con->get_data_message();
+
+        // reserve space in our local data buffer
         m_data.reserve(m_test_sizes[m_subtest-1]);

-        if (m_minor == 1) {
-            fill_utf8(connection,true);
-            m_start_time = boost::posix_time::microsec_clock::local_time();
-            connection->send(m_data,false);
-        } else if (m_minor == 2) {
-            fill_binary(connection,true);
-            m_start_time = boost::posix_time::microsec_clock::local_time();
-            connection->send(m_data,true);
+        // Reset message to appropriate opcode and fill local buffer with
+        // appropriate types of random data.
+        if (m_minor == 7) {
+            fill_utf8(m_data,m_test_sizes[m_subtest-1],true);
+            msg->reset(websocketpp::frame::opcode::TEXT);
+        } else if (m_minor == 8) {
+            fill_binary(m_data,m_test_sizes[m_subtest-1],true);
+            msg->reset(websocketpp::frame::opcode::BINARY);
         } else {
             std::cout << " has unknown definition." << std::endl;
-        }
-    }
-
-    // Just does random ascii right now. True random UTF8 with multi-byte stuff
-    // would probably be better
-    void fill_utf8(connection_ptr connection,bool random = true) {
-        if (random) {
-            uint32_t data;
-            for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
-                if (i%4 == 0) {
-                    data = uint32_t(connection->rand());
-                }
-
-                m_data.push_back(char(((reinterpret_cast<uint8_t*>(&data)[i%4])%95)+32));
-            }
-        } else {
-            m_data.assign(m_test_sizes[m_subtest-1],'*');
-        }
-    }
-
-    void fill_binary(connection_ptr connection, bool random = true) {
-        if (random) {
-            int32_t data;
-            for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
-                if (i%4 == 0) {
-                    data = connection->rand();
-                }
-
-                m_data.push_back((reinterpret_cast<char*>(&data))[i%4]);
-            }
-        } else {
-            m_data.assign(m_test_sizes[m_subtest-1],'*');
-        }
-    }
-
-    void on_message(connection_ptr connection,websocketpp::message::data_ptr msg) {
-        m_end_time = boost::posix_time::microsec_clock::local_time();
-
-        // Check whether the echoed data matches exactly
-        m_pass = (msg->get_payload() == m_data);
-
-        connection->recycle(msg);
-        this->end(connection);
+            return;
+        }
+
+        msg->set_payload(m_data);
+
+        // start test timer with 60-480 second timeout based on test length
+        start(con,m_test_timeouts[m_subtest-1]);
+
+        // send 1000 copies of prepared message
+        for (int i = 0; i < m_iterations; i++) {
+            con->send(msg);
+        }
+    }
+
+    void on_message(connection_ptr con, message_ptr msg) {
+        if (msg->get_payload() == m_data) {
+            m_acks++;
+        }
+
+        if (m_acks == m_iterations) {
+            m_pass = PASS;
+            m_end_time = boost::posix_time::microsec_clock::local_time();
+            m_timer->cancel();
+            this->end(con);
+        }
     }
 private:
     int         m_minor;
     int         m_subtest;
+    int         m_test_timeouts[6];
     size_t      m_test_sizes[6];
     std::string m_data;
-};*/
+    int         m_iterations;
+    int         m_acks;
+
+};

 int main(int argc, char* argv[]) {
     std::string uri;

-
+    srand(time(NULL));

     if (argc != 2) {
         uri = "ws://localhost:9002/";
@@ -230,16 +272,24 @@
         uri = argv[1];
     }

-    std::vector<plain_handler_ptr>  tests;
-
+    std::vector<client::handler_ptr>  tests;
+
+    // 9.1.x and 9.2.x tests
     for (int i = 1; i <= 2; i++) {
         for (int j = 1; j <= 6; j++) {
-            tests.push_back(plain_handler_ptr(new test_9_1_X(i,j)));
+            tests.push_back(client::handler_ptr(new test_9_1_X(i,j)));
+        }
+    }
+
+    // 9.7.x and 9.8.x tests
+    for (int i = 7; i <= 8; i++) {
+        for (int j = 1; j <= 6; j++) {
+            tests.push_back(client::handler_ptr(new test_9_7_X(i,j)));
         }
     }

     try {
-        plain_endpoint_type endpoint(tests[0]);
+        client endpoint(tests[0]);

         endpoint.alog().unset_level(websocketpp::log::alevel::ALL);
         endpoint.elog().unset_level(websocketpp::log::elevel::ALL);
@@ -253,9 +303,6 @@
             endpoint.connect(uri);
             endpoint.run();
         }
-
-        std::cout << "done" << std::endl;
-
     } catch (std::exception& e) {
         std::cerr << "Exception: " << e.what() << std::endl;
     }


Undo unintended reformatting

Undo unintended reformatting

--- vespalib/src/vespa/vespalib/data/slime/binary_format.cpp
+++ vespalib/src/vespa/vespalib/data/slime/binary_format.cpp
@@ -90,12 +90,14 @@
 };

 void
-BinaryEncoder::entry(size_t, const Inspector &inspector) {
+BinaryEncoder::entry(size_t, const Inspector &inspector)
+{
     encodeValue(inspector);
 }

 void
-BinaryEncoder::field(const Symbol &symbol, const Inspector &inspector) {
+BinaryEncoder::field(const Symbol &symbol, const Inspector &inspector)
+{
     write_cmpr_ulong_impl(out, symbol.getValue());
     encodeValue(inspector);
 }
@@ -130,12 +132,12 @@
     }
 };

-template<bool remap_symbols>
+template <bool remap_symbols>
 struct SymbolHandler {
     typedef typename std::conditional<remap_symbols, MappedSymbols, DirectSymbols>::type type;
 };

-template<bool remap_symbols>
+template <bool remap_symbols>
 struct BinaryDecoder : SymbolHandler<remap_symbols>::type {

     InputReader ∈
@@ -212,9 +214,10 @@
     }
 };

-template<bool remap_symbols>
+template <bool remap_symbols>
 Cursor &
-BinaryDecoder<remap_symbols>::decodeArray(const Inserter &inserter, uint32_t meta) {
+BinaryDecoder<remap_symbols>::decodeArray(const Inserter &inserter, uint32_t meta)
+{
     Cursor &cursor = inserter.insertArray();
     ArrayInserter childInserter(cursor);
     uint64_t size = read_size(in, meta);
@@ -224,9 +227,10 @@
     return cursor;
 }

-template<bool remap_symbols>
+template <bool remap_symbols>
 Cursor &
-BinaryDecoder<remap_symbols>::decodeObject(const Inserter &inserter, uint32_t meta) {
+BinaryDecoder<remap_symbols>::decodeObject(const Inserter &inserter, uint32_t meta)
+{
     Cursor &cursor = inserter.insertObject();
     uint64_t size = read_size(in, meta);
     for (size_t i = 0; i < size; ++i) {


Use setContentsMargins() instead of setMargin().

setMargin() is deprecated.

--- examples/layouts/flowlayout/flowlayout.cpp
+++ examples/layouts/flowlayout/flowlayout.cpp
@@ -46,13 +46,13 @@
 FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing)
     : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing)
 {
-    setMargin(margin);
+    setContentsMargins(margin, margin, margin, margin);
 }

 FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing)
     : m_hSpace(hSpacing), m_vSpace(vSpacing)
 {
-    setMargin(margin);
+    setContentsMargins(margin, margin, margin, margin);
 }

 FlowLayout::~FlowLayout()


Add new unittests for TDBStore

Add new unittests for TDBStore

Add tests for iterators and reserved data.

--- UNITTESTS/moduletests/storage/kvstore/TDBStore/moduletest.cpp
+++ UNITTESTS/moduletests/storage/kvstore/TDBStore/moduletest.cpp
@@ -124,3 +124,28 @@
     EXPECT_EQ(heap.deinit(), MBED_SUCCESS);
     delete[] block;
 }
+
+TEST_F(TDBStoreModuleTest, set_multiple_iterate)
+{
+    char buf[100];
+    KVStore::iterator_t iterator;
+    EXPECT_EQ(tdb.set("primary_key", "data", 5, 0), MBED_SUCCESS);
+    EXPECT_EQ(tdb.set("primary_second_key", "value", 6, 0), MBED_SUCCESS);
+    EXPECT_EQ(tdb.iterator_open(&iterator, "primary"), MBED_SUCCESS);
+    EXPECT_EQ(tdb.iterator_next(iterator, buf, 100), MBED_SUCCESS);
+    EXPECT_EQ(tdb.iterator_next(iterator, buf, 100), MBED_SUCCESS);
+    EXPECT_EQ(tdb.iterator_next(iterator, buf, 100), MBED_ERROR_ITEM_NOT_FOUND);
+    EXPECT_EQ(tdb.iterator_close(iterator), MBED_SUCCESS);
+}
+
+TEST_F(TDBStoreModuleTest, reserved_data_set_get)
+{
+    char reserved_key[] = "value";
+    char buf[64];
+    size_t size;
+    EXPECT_EQ(tdb.reserved_data_set(reserved_key, 6), MBED_SUCCESS);
+    EXPECT_EQ(tdb.reserved_data_get(buf, 64, &size), MBED_SUCCESS);
+    EXPECT_STREQ("value", buf);
+    EXPECT_EQ(size, 6);
+    EXPECT_EQ(tdb.reserved_data_set(reserved_key, 6), MBED_ERROR_WRITE_FAILED);
+}


Remove extra character (radix) in display of result in calc history tip

git-svn-id: c806da28ca781a1e2f2d0b1fde2a9d9a144b325a@1213 295070fd-a27b-da4f-a32e-77c6a882a0e3

--- HexEdit/CalcEdit.cpp
+++ HexEdit/CalcEdit.cpp
@@ -790,6 +790,8 @@
 				}
 				else
 				{
+					CString tmpStr = ps->Mid(1);
+
 					// Add "Expression ="  then multiple lines of result
 					tip_.AddString(ss + " =");

@@ -799,7 +801,7 @@
 						CClientDC dc(&tip_);
 						int nSave = dc.SaveDC();
 						dc.SelectObject(tip_.GetFont());
-						sz = dc.GetTextExtent(*ps);
+						sz = dc.GetTextExtent(tmpStr);
 						dc.RestoreDC(nSave);
 					}

@@ -813,9 +815,9 @@
 					if (wrap > 0)
 					{
 						// First work out roughly how many characters to put on each line
-						int len = ps->GetLength() / (wrap+1);
-						char * start = ps->GetBuffer();
-						char * end = start + ps->GetLength();
+						int len = tmpStr.GetLength() / (wrap+1);
+						char * start = tmpStr.GetBuffer();
+						char * end = start + tmpStr.GetLength();

 						int ii;
 						for (ii = 0; ii < 10 && start + len < end; ++ii)
@@ -841,7 +843,7 @@
 							tip_.AddString("...   " + radix_str);
 					}
 					else
-						tip_.AddString(*ps + radix_str);
+						tip_.AddString(tmpStr + radix_str);
 				}

 				// Move the tip window just below the mouse and make visible


minor fixes.

minor fixes.

--- src/appleseed/renderer/modeling/bsdf/kelemenbrdf.cpp
+++ src/appleseed/renderer/modeling/bsdf/kelemenbrdf.cpp
@@ -54,6 +54,8 @@
 #include <cassert>
 #include <cmath>
 #include <cstddef>
+#include <iomanip>
+#include <sstream>
 #include <string>

 using namespace foundation;
@@ -594,7 +596,8 @@

         static void plot_specular_albedo_curves()
         {
-            MapleFile file("albedo.txt");
+            MapleFile file("albedo.mpl");
+
             plot_specular_albedo_curve(file, 0.8, Spectrum(1.0f));
             plot_specular_albedo_curve(file, 0.4, Spectrum(1.0f));
             plot_specular_albedo_curve(file, 0.03, Spectrum(1.0f));
@@ -605,7 +608,9 @@
             const double        m,
             const Spectrum&     rs)
         {
-            const string suffix = "_" + replace(to_string(m), ".", "_");
+            stringstream sstr;
+            sstr << fixed << m;
+            const string suffix = "_" + replace(sstr.str(), ".", "_");

             generate_specular_albedo_plot_data(file, "ward_" + suffix, WardMDF<double>(m), rs);
             generate_specular_albedo_plot_data(file, "beckmann_" + suffix, BeckmannMDF<double>(m), rs);


[HEVCe] Inherit LowPower parameter on reset

Add copying of coding option value instead of leaving this 0(UNKNOWN) in reset.

--- _studio/mfx_lib/encode_hw/h265/src/mfx_h265_encode_hw_par.cpp
+++ _studio/mfx_lib/encode_hw/h265/src/mfx_h265_encode_hw_par.cpp
@@ -1110,6 +1110,7 @@
     InheritOption(parInit.mfx.BufferSizeInKB,     parReset.mfx.BufferSizeInKB);
     InheritOption(parInit.mfx.NumSlice,           parReset.mfx.NumSlice);
     InheritOption(parInit.mfx.NumRefFrame,        parReset.mfx.NumRefFrame);
+    InheritOption(parInit.mfx.LowPower,           parReset.mfx.LowPower);

     if (parInit.mfx.RateControlMethod == MFX_RATECONTROL_CBR && parReset.mfx.RateControlMethod == MFX_RATECONTROL_CBR)
     {


[HEVCE] fix copy-paste typo

[HEVCE] fix copy-paste typo

DDI.NumActiveRefBL1 was L0.
Obvious and not affecting.

--- _studio/mfx_lib/encode_hw/h265/src/mfx_h265_encode_hw_par.cpp
+++ _studio/mfx_lib/encode_hw/h265/src/mfx_h265_encode_hw_par.cpp
@@ -2760,7 +2760,7 @@

         mfxU16 RefActiveP   = par.m_ext.DDI.NumActiveRefP;
         mfxU16 RefActiveBL0 = par.m_ext.DDI.NumActiveRefBL0;
-        mfxU16 RefActiveBL1 = par.m_ext.DDI.NumActiveRefBL0;
+        mfxU16 RefActiveBL1 = par.m_ext.DDI.NumActiveRefBL1;

         if (!RefActiveP)
             for (mfxU16 i = 0; i < 8; i++)  RefActiveP   = Max(RefActiveP, CO3.NumRefActiveP[i]);


Fixed a typo.

Fixed a typo.

--- src/classes/exceptions.cpp
+++ src/classes/exceptions.cpp
@@ -14,7 +14,7 @@
 		context->runtime_error = define_class("RuntimeError", context->standard_error);
 		context->local_jump_error = define_class("LocalJumpError", context->standard_error);
 		context->load_error = define_class("LoadError", context->standard_error);
-		context->system_call_error = define_class("SysemCallError", context->standard_error);
+		context->system_call_error = define_class("SystemCallError", context->standard_error);

 		context->signal_exception = define_class("SignalException", context->exception_class);
 		context->interrupt_class = define_class("Interrupt", context->signal_exception);


Fixed bug in object lookup that broke the browse command in CLI.

--- src/cli/clisrv_context.cpp
+++ src/cli/clisrv_context.cpp
@@ -144,8 +144,16 @@

     // Prepend root node name if not present (for compatibility reasons to
     // 'classic' DeCoF)
-    if (uri != object_dictionary_.name() && !boost::algorithm::starts_with(uri, object_dictionary_.name() + ":"))
-        uri = object_dictionary_.name() + ":" + uri;
+    if (uri != object_dictionary_.name() && !boost::algorithm::starts_with(uri, object_dictionary_.name() + ":")) {
+        auto new_uri = object_dictionary_.name();
+
+        if (!uri.empty()) {
+            new_uri.push_back(':');
+            new_uri.append(uri);
+        }
+
+        uri.swap(new_uri);
+    }

     std::ostream out(&outbuf_);
     encoder      encoder(out);


Crappy music.

Crappy music.

--- digitanks/src/ui/digitankswindow.cpp
+++ digitanks/src/ui/digitankswindow.cpp
@@ -108,8 +108,8 @@

 	CNetwork::Initialize();

-	if (!HasCommandLineSwitch("--nomusic"))
-		CSoundLibrary::PlayMusic("sound/digitanks-march.ogg");
+//	if (!HasCommandLineSwitch("--nomusic"))
+//		CSoundLibrary::PlayMusic("sound/digitanks-march.ogg");
 }

 CDigitanksWindow::~CDigitanksWindow()


Some minor cleaning up.

Some minor cleaning up.

--- src/plugins/editing/RawCellMLView/src/rawcellmlviewwidget.cpp
+++ src/plugins/editing/RawCellMLView/src/rawcellmlviewwidget.cpp
@@ -282,14 +282,10 @@

     QDomDocument domDocument;

-    if (!domDocument.setContent(pMathml))
+    if (domDocument.setContent(pMathml))
+        return domDocument.toString(-1);
+    else
         return QString();
-
-    QDomNode domNode = domDocument.documentElement();
-
-    cleanUpMathml(domNode);
-
-    return domDocument.toString(-1);
 }

 //==============================================================================


Improve scoring used by CombineSmallTiles

This commit improves CombineSmallTiles::scoreTiles by:

 * Testing for frames in A but not in B AND frames in B but not in A
   (something the previous commit did not do). And

 * Individually testing all four tiles in the second pass.

--- src/models/metasprite/compiler/combinesmalltiles.cpp
+++ src/models/metasprite/compiler/combinesmalltiles.cpp
@@ -41,24 +41,45 @@
 };

 struct FirstPassOutput {
-    unsigned firstTile = UINT_MAX;
-    unsigned secondTile = UINT_MAX;
-    std::vector<const MS::Frame*> frames;
+    const TileGraphItem& firstTile;
+    const TileGraphItem& secondTile;
+
+    FirstPassOutput(const TileGraphItem& first, const TileGraphItem& second)
+        : firstTile(first)
+        , secondTile(second)
+    {
+    }
+
+    size_t nFrames() const { return firstTile.frames.size() + secondTile.frames.size(); }
 };

-static int scoreTiles(const std::vector<const MS::Frame*>& a, const std::vector<const MS::Frame*>& b)
+static int scoreTilesVec(const std::vector<const MetaSprite::Frame*>& a, const std::vector<const MetaSprite::Frame*>& b)
 {
     int score = 0;
     for (const auto& f : a) {
         int count = std::count(b.begin(), b.end(), f);
         if (count > 0) {
-            score += 3 * count;
+            score += count;
         }
         else {
-            score -= 1;
+            score -= 3;
         }
     }
     return score;
+}
+
+static int scoreTiles(const TileGraphItem& a, const TileGraphItem& b)
+{
+    return scoreTilesVec(a.frames, b.frames)
+           + scoreTilesVec(b.frames, a.frames);
+}
+
+static int scoreTiles(const FirstPassOutput& a, const FirstPassOutput& b)
+{
+    return scoreTiles(a.firstTile, b.firstTile)
+           + scoreTiles(a.secondTile, b.firstTile)
+           + scoreTiles(b.firstTile, a.secondTile)
+           + scoreTiles(a.secondTile, b.secondTile);
 }

 // To improve packing the size of the output is always a multiple of four (4).
@@ -114,14 +135,12 @@
         assert(toProcess.size() % 2 == 0);

         auto mostPopularIt = toProcess.begin();
-        const TileGraphItem& mostPopular = *mostPopularIt;

         auto bestMatchIt = toProcess.end();
         {
             int bestScore = INT_MIN;
             for (auto it = mostPopularIt + 1; it != toProcess.end(); ++it) {
-                const TileGraphItem& tgi = *it;
-                int score = scoreTiles(tgi.frames, mostPopular.frames);
+                int score = scoreTiles(*it, *mostPopularIt);

                 if (score > bestScore) {
                     bestMatchIt = it;
@@ -129,18 +148,9 @@
                 }
             }
         }
-
         assert(bestMatchIt != toProcess.end());
-        const TileGraphItem& bestMatch = *bestMatchIt;
-
-        output.emplace_back();
-        auto& o = output.back();
-
-        o.firstTile = mostPopular.tileId;
-        o.secondTile = bestMatch.tileId;
-
-        o.frames = mostPopular.frames;
-        o.frames.insert(o.frames.end(), bestMatch.frames.begin(), bestMatch.frames.end());
+
+        output.emplace_back(*mostPopularIt, *bestMatchIt);

         toProcess.erase(bestMatchIt);
         toProcess.erase(mostPopularIt);
@@ -159,7 +169,7 @@
     // sort the input by popularity
     // should be mostly sorted anyways
     input.sort([](const FirstPassOutput& a, const FirstPassOutput& b) {
-        return a.frames.size() > b.frames.size();
+        return a.nFrames() > b.nFrames();
     });

     while (!input.empty()) {
@@ -170,7 +180,7 @@
             int bestScore = INT_MIN;
             auto it = mostPopular;
             for (++it; it != input.end(); ++it) {
-                int score = scoreTiles(mostPopular->frames, it->frames);
+                int score = scoreTiles(*mostPopular, *it);

                 if (score > bestScore) {
                     bestMatch = it;
@@ -183,10 +193,10 @@

         std::array<uint16_t, 4> combined;

-        combined[0] = mostPopular->firstTile;
-        combined[1] = mostPopular->secondTile;
-        combined[2] = bestMatch->firstTile;
-        combined[3] = bestMatch->secondTile;
+        combined[0] = mostPopular->firstTile.tileId;
+        combined[1] = mostPopular->secondTile.tileId;
+        combined[2] = bestMatch->firstTile.tileId;
+        combined[3] = bestMatch->secondTile.tileId;

         input.erase(bestMatch);
         input.erase(mostPopular);


Formatting fixes bug oh god this formatting is gross

--- src/render_engine/vulkan/vulkan_render_engine_renderables.cpp
+++ src/render_engine/vulkan/vulkan_render_engine_renderables.cpp
@@ -39,28 +39,28 @@
                 return result<std::vector<const material_pass*>>(std::move(passes));
             }
         }()
-        .map([&](const std::vector<const material_pass*>& passes) {
-            static_cast<void>(passes);
-            auto mesh_result =
-                [&]() {
-                    if(meshes.find(data.mesh) == meshes.end()) {
-                        return result<const vk_mesh*>(
-                            nova_error(fmt::format(fmt("Could not find mesh with id {:d}"), data.mesh)));
-                    }
+                .map([&](const std::vector<const material_pass*>& passes) {
+                    static_cast<void>(passes);
+                    auto mesh_result =
+                        [&]() {
+                            if(meshes.find(data.mesh) == meshes.end()) {
+                                return result<const vk_mesh*>(
+                                    nova_error(fmt::format(fmt("Could not find mesh with id {:d}"), data.mesh)));
+                            }

-                    return result<const vk_mesh*>(&meshes.at(data.mesh));
-                }()
-                .map([](const vk_mesh* mesh) {
-                    static_cast<void>(mesh);
+                            return result<const vk_mesh*>(&meshes.at(data.mesh));
+                        }()
+                            .map([](const vk_mesh* mesh) {
+                                static_cast<void>(mesh);

-                    // vk_static_mesh_renderable renderable = {};
-                    // renderable.draw_cmd = &mesh->draw_cmd;
+                                // vk_static_mesh_renderable renderable = {};
+                                // renderable.draw_cmd = &mesh->draw_cmd;
+
+                                return static_cast<renderable_id_t>(3);
+                            });

                     return static_cast<renderable_id_t>(3);
                 });
-
-            return static_cast<renderable_id_t>(3);
-        });
     }

     void vulkan_render_engine::set_renderable_visibility(renderable_id_t id, bool is_visible) {


Added test for mutex with time limited actuators

--- boost_test/ActuatorMutexTest.cpp
+++ boost_test/ActuatorMutexTest.cpp
@@ -103,5 +103,39 @@
     BOOST_CHECK_EQUAL(i,10); // act2 was allowed to go active after 10 seconds
 }

+BOOST_AUTO_TEST_CASE(mutex_works_with_time_limited_actuator) {
+    ActuatorDigital * act1 = new ActuatorBool();
+    ActuatorTimeLimited * act1tl = new ActuatorTimeLimited(act1, 10, 20);
+    ActuatorDigital * act2 = new ActuatorBool();
+
+    delay(20000); // let initial minimum off time pass
+
+
+    ActuatorMutexGroup * mutex = new ActuatorMutexGroup();
+
+    ActuatorMutexDriver * actm1 = new ActuatorMutexDriver(act1tl);
+    ActuatorMutexDriver * actm2 = new ActuatorMutexDriver(act2);
+    actm1->setMutex(mutex);
+    actm2->setMutex(mutex);
+
+
+    actm1->setActive(true, 5);
+    BOOST_CHECK(act1->isActive()); // target actuator is active
+
+    for(int i=0; i<200; i++){
+        mutex->update(); // does not pass time
+    }
+
+    actm1->setActive(false, 5);
+    BOOST_CHECK(act1->isActive()); // target actuator is still active due to time limit
+
+    for(int i=0; i<200; i++){
+        mutex->update();
+    }
+    actm2->setActive(true, 10);
+    BOOST_CHECK(!act2->isActive()); // actuator 2 is not allowed to go active while act1 is still active
+
+
+}
 BOOST_AUTO_TEST_SUITE_END()


Sequence Iterator Demo, adjusting braces.

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@5202 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/demos/tutorial/sequence/sequence_iterator_demo.cpp
+++ seqan/projects/library/demos/tutorial/sequence/sequence_iterator_demo.cpp
@@ -5,8 +5,7 @@
 #include <seqan/sequence.h>
 #include <seqan/file.h>

-int main()
-{
+int main() {
 // FRAGMENT(metafunctions)
 	seqan::String<char> str = "admn";
 	seqan::Iterator<seqan::String<char> >::Type it = begin(str);


Refactorize server code

Refactorize server code

--- src/command/s2s_server.cpp
+++ src/command/s2s_server.cpp
@@ -6,7 +6,7 @@

 typedef SimpleWeb::SocketServer<SimpleWeb::WS> WsServer;

-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
   using namespace marian;

   auto options = New<Config>(argc, argv, ConfigMode::translating);
@@ -15,58 +15,35 @@
   WsServer server_;
   server_.config.port = 1234;

-  auto &echo = server_.endpoint["^/translate/?$"];
+  auto &translate = server_.endpoint["^/translate/?$"];

-  echo.on_message = [&task](std::shared_ptr<WsServer::Connection> connection,
-                       std::shared_ptr<WsServer::Message> message) {
+  translate.on_message = [&task](Ptr<WsServer::Connection> connection,
+                                 Ptr<WsServer::Message> message) {
     auto message_str = message->string();
-
-    std::cout << "Server: Message received: \"" << message_str << "\" from "
-              << connection.get() << std::endl;
-    std::cout << "Server: Sending message \"" << message_str << "\" to "
-              << connection.get() << std::endl;
+    LOG(info)->info("Message received: \"" + message_str + "\"");

     auto send_stream = std::make_shared<WsServer::SendStream>();
     boost::timer::cpu_timer timer;
-    for(auto& transl : task->run({message_str})) {
+    for(auto &transl : task->run({message_str})) {
       *send_stream << transl << std::endl;
     }
     LOG(info)->info("Search took: {}", timer.format(5, "%ws"));

-    // connection->send is an asynchronous function
     connection->send(send_stream, [](const SimpleWeb::error_code &ec) {
       if(ec) {
-        std::cout << "Server: Error sending message. " <<
-            // Error Codes for error code meanings:
-            // http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference.html
-            "Error: " << ec << ", error message: " << ec.message() << std::endl;
+        auto ec_str = std::to_string(ec.value());
+        LOG(warn)
+            ->warn("Error sending message: (" + ec_str + ") " + ec.message());
       }
     });
-
-    // Alternatively, using a convenience function:
-    // connection->send(message_str, [](const SimpleWeb::error_code & /*ec*/) {
-    // /*handle error*/ });
-  };
-
-  echo.on_open = [](std::shared_ptr<WsServer::Connection> connection) {
-    std::cout << "Server: Opened connection " << connection.get() << std::endl;
-  };
-
-  // See RFC 6455 7.4.1. for status codes
-  echo.on_close = [](std::shared_ptr<WsServer::Connection> connection,
-                     int status,
-                     const std::string & /*reason*/) {
-    std::cout << "Server: Closed connection " << connection.get()
-              << " with status code " << status << std::endl;
   };

   // Error Codes for error code meanings
-  // http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference.html,
-  echo.on_error = [](std::shared_ptr<WsServer::Connection> connection,
-                     const SimpleWeb::error_code &ec) {
-    std::cout << "Server: Error in connection " << connection.get() << ". "
-              << "Error: " << ec << ", error message: " << ec.message()
-              << std::endl;
+  // http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference.html
+  translate.on_error = [](Ptr<WsServer::Connection> connection,
+                          const SimpleWeb::error_code &ec) {
+    auto ec_str = std::to_string(ec.value());
+    LOG(warn)->warn("Connection error: (" + ec_str + ") " + ec.message());
   };

   std::thread server_thread([&server_]() {


baremetal: don't append executable suffix

The current implementation has been tested with a wrongly
configured qmake on windows. But the suffix should not be
appended.

Change-Id: I5f01637698a1fe2dca646eb08ed1b7bd2a1f56a7
Reviewed-by: Christian Kandeler <3aa99dcdd3f0cac61fb81c2a11771c0cc2497607@digia.com>
Reviewed-by: hjk <f81b91af79013637d070c18d38a75b90eaae8ba3@nokiamail.com>

--- src/plugins/baremetal/baremetalruncontrolfactory.cpp
+++ src/plugins/baremetal/baremetalruncontrolfactory.cpp
@@ -89,7 +89,7 @@
     params.languages |= CppLanguage;
     params.processArgs = runConfig->arguments();
     params.startMode = AttachToRemoteServer;
-    params.executable = Utils::HostOsInfo::withExecutableSuffix(runConfig->localExecutableFilePath());
+    params.executable = runConfig->localExecutableFilePath();
     params.remoteSetupNeeded = false; //FIXME probably start debugserver with that, how?
     params.displayName = runConfig->displayName();
     if (const Project *project = target->project()) {


Made controller settings panel larger to accommodate the new gyroscope calibration buttons.

--- src/psmoveconfigtool/AppStage_ControllerSettings.cpp
+++ src/psmoveconfigtool/AppStage_ControllerSettings.cpp
@@ -147,7 +147,7 @@
     case eControllerMenuState::idle:
         {
             ImGui::SetNextWindowPosCenter();
-            ImGui::SetNextWindowSize(ImVec2(350, 350));
+            ImGui::SetNextWindowSize(ImVec2(350, 400));
             ImGui::Begin(k_window_title, nullptr, window_flags);

             if (m_hostSerial.length() > 1 && m_hostSerial != "00:00:00:00:00:00")


tests: network_topology_strategy_test: remove quadratic complexity

network_topology_strategy test creates a ring with hundreds of tokens (and one
token per node). Then, for each token, it calls get_primary_ranges(), which in
turn walks the token ring. However, because the each datacenter occupies a
disjoint token range, this walk practically has to walk the entire ring until
it collects enough endpoints for each datacenter. The whole thing takes 15 minutes.

Speed this up by randomizing the token<->dc relationship. This is more realistic,
and switches the algorithm to be O(token count), and now it completes in less
than a minute (still not great, but better).
Message-Id: <3cad0d252f2be73ba11020f5e8904209757d64ba@scylladb.com>

--- tests/network_topology_strategy_test.cc
+++ tests/network_topology_strategy_test.cc
@@ -31,6 +31,7 @@
 #include <iostream>
 #include <sstream>
 #include <boost/range/algorithm/adjacent_find.hpp>
+#include <boost/algorithm/cxx11/iota.hpp>

 static logging::logger nlogger("NetworkTopologyStrategyLogger");

@@ -276,14 +277,18 @@
         }

         int total_rf = 0;
-        double token_point = 1.0;
+        std::default_random_engine random_engine{};
+        std::vector<double> token_points(total_eps, 0.0);
+        boost::algorithm::iota(token_points, 1.0);
+        std::shuffle(token_points.begin(), token_points.end(), random_engine);
+        auto token_point_iterator = token_points.begin();
         for (size_t dc = 0; dc < dc_racks.size(); ++dc) {
             total_rf += dc_replication[dc];
             config_options.emplace(to_sstring(dc),
                                    to_sstring(dc_replication[dc]));
             for (int rack = 0; rack < dc_racks[dc]; ++rack) {
                 for (int ep = 1; ep <= dc_endpoints[dc]/dc_racks[dc]; ++ep) {
-
+                    double token_point = *token_point_iterator++;
                     // 10.dc.rack.ep
                     int32_t ip = 0x0a000000 + ((int8_t)dc << 16) +
                                  ((int8_t)rack << 8) + (int8_t)ep;


land_detector: don't estimate freefall on 0 data

--- src/modules/land_detector/MulticopterLandDetector.cpp
+++ src/modules/land_detector/MulticopterLandDetector.cpp
@@ -135,6 +135,11 @@

 	const uint64_t now = hrt_absolute_time();

+	if (_ctrl_state.timestamp == 0) {
+		// _ctrl_state is not valid yet, we have to assume we're not falling.
+		return false;
+	}
+
 	float acc_norm = _ctrl_state.x_acc * _ctrl_state.x_acc
 			 + _ctrl_state.y_acc * _ctrl_state.y_acc
 			 + _ctrl_state.z_acc * _ctrl_state.z_acc;


Update Catch to 1.9.4

Update Catch to 1.9.4

--- test/catch.hpp
+++ test/catch.hpp
@@ -1,6 +1,6 @@
 /*
- *  Catch v1.9.1
- *  Generated: 2017-04-09 21:21:06.285364
+ *  Catch v1.9.4
+ *  Generated: 2017-05-16 13:51:55.506519
  *  ----------------------------------------------------------
  *  This file has been merged from multiple headers. Please don't edit it directly
  *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -136,12 +136,18 @@
 #endif // __clang__

 ////////////////////////////////////////////////////////////////////////////////
-// Cygwin
-#ifdef __CYGWIN__
+// We know some environments not to support full POSIX signals
+#if defined(__CYGWIN__) || defined(__QNX__)

 #   if !defined(CATCH_CONFIG_POSIX_SIGNALS)
 #       define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
 #   endif
+
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Cygwin
+#ifdef __CYGWIN__

 // Required for some versions of Cygwin to declare gettimeofday
 // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
@@ -2266,7 +2272,7 @@
             INTERNAL_CATCH_REACT( __catchResult ) \
         } while( Catch::alwaysFalse() )
 #else
-    #define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \
+    #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, log ) \
         do { \
             Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
             __catchResult << log + ::Catch::StreamEndStop(); \
@@ -2397,14 +2403,19 @@
 // #included from: catch_timer.h
 #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED

-#ifdef CATCH_PLATFORM_WINDOWS
-typedef unsigned long long uint64_t;
+#ifdef _MSC_VER
+
+namespace Catch {
+    typedef unsigned long long UInt64;
+}
 #else
 #include <stdint.h>
-#endif
-
 namespace Catch {
-
+    typedef uint64_t UInt64;
+}
+#endif
+
+namespace Catch {
     class Timer {
     public:
         Timer() : m_ticks( 0 ) {}
@@ -2414,7 +2425,7 @@
         double getElapsedSeconds() const;

     private:
-        uint64_t m_ticks;
+        UInt64 m_ticks;
     };

 } // namespace Catch
@@ -2769,15 +2780,16 @@
             return Approx( 0 );
         }

-        Approx operator()( double value ) {
-            Approx approx( value );
+#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
+
+        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+        Approx operator()( T value ) {
+            Approx approx( static_cast<double>(value) );
             approx.epsilon( m_epsilon );
             approx.margin( m_margin );
             approx.scale( m_scale );
             return approx;
         }
-
-#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)

         template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
         explicit Approx( T value ): Approx(static_cast<double>(value))
@@ -2828,7 +2840,35 @@
         friend bool operator >= ( Approx const& lhs, T rhs ) {
             return lhs.m_value > double(rhs) || lhs == rhs;
         }
+
+        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+        Approx& epsilon( T newEpsilon ) {
+            m_epsilon = double(newEpsilon);
+            return *this;
+        }
+
+        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+        Approx& margin( T newMargin ) {
+            m_margin = double(newMargin);
+            return *this;
+        }
+
+        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+        Approx& scale( T newScale ) {
+            m_scale = double(newScale);
+            return *this;
+        }
+
 #else
+
+        Approx operator()( double value ) {
+            Approx approx( value );
+            approx.epsilon( m_epsilon );
+            approx.margin( m_margin );
+            approx.scale( m_scale );
+            return approx;
+        }
+
         friend bool operator == ( double lhs, Approx const& rhs ) {
             // Thanks to Richard Harris for his help refining this formula
             bool relativeOK = std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) );
@@ -2865,7 +2905,6 @@
         friend bool operator >= ( Approx const& lhs, double rhs ) {
             return lhs.m_value > rhs || lhs == rhs;
         }
-#endif

         Approx& epsilon( double newEpsilon ) {
             m_epsilon = newEpsilon;
@@ -2881,6 +2920,7 @@
             m_scale = newScale;
             return *this;
         }
+#endif

         std::string toString() const {
             std::ostringstream oss;
@@ -3133,8 +3173,18 @@
         }

     private:
-        T* nullableValue;
-        char storage[sizeof(T)];
+        T *nullableValue;
+        union {
+            char storage[sizeof(T)];
+
+            // These are here to force alignment for the storage
+            long double dummy1;
+            void (*dummy2)();
+            long double dummy3;
+#ifdef CATCH_CONFIG_CPP11_LONG_LONG
+            long long dummy4;
+#endif
+        };
     };

 } // end namespace Catch
@@ -6592,8 +6642,9 @@
                 m_totals.assertions.failed++;
             }

-            if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) )
-                m_messages.clear();
+            // We have no use for the return value (whether messages should be cleared), because messages were made scoped
+            // and should be let to clear themselves out.
+            static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));

             // Reset working state
             m_lastAssertionInfo = AssertionInfo( std::string(), m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
@@ -7001,6 +7052,32 @@
                 returnCode = run();
             return returnCode;
         }
+
+    #if defined(WIN32) && defined(UNICODE)
+        int run( int argc, wchar_t const* const* const argv ) {
+
+            char **utf8Argv = new char *[ argc ];
+
+            for ( int i = 0; i < argc; ++i ) {
+                int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
+
+                utf8Argv[ i ] = new char[ bufSize ];
+
+                WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
+            }
+
+            int returnCode = applyCommandLine( argc, utf8Argv );
+            if( returnCode == 0 )
+                returnCode = run();
+
+            for ( int i = 0; i < argc; ++i )
+                delete [] utf8Argv[ i ];
+
+            delete [] utf8Argv;
+
+            return returnCode;
+        }
+    #endif

         int run() {
             if( m_configData.showHelp )
@@ -8232,7 +8309,7 @@
     }

     inline Version libraryVersion() {
-        static Version version( 1, 9, 1, "", 0 );
+        static Version version( 1, 9, 4, "", 0 );
         return version;
     }

@@ -8418,21 +8495,21 @@

     namespace {
 #ifdef CATCH_PLATFORM_WINDOWS
-        uint64_t getCurrentTicks() {
-            static uint64_t hz=0, hzo=0;
+        UInt64 getCurrentTicks() {
+            static UInt64 hz=0, hzo=0;
             if (!hz) {
                 QueryPerformanceFrequency( reinterpret_cast<LARGE_INTEGER*>( &hz ) );
                 QueryPerformanceCounter( reinterpret_cast<LARGE_INTEGER*>( &hzo ) );
             }
-            uint64_t t;
+            UInt64 t;
             QueryPerformanceCounter( reinterpret_cast<LARGE_INTEGER*>( &t ) );
             return ((t-hzo)*1000000)/hz;
         }
 #else
-        uint64_t getCurrentTicks() {
+        UInt64 getCurrentTicks() {
             timeval t;
             gettimeofday(&t,CATCH_NULL);
-            return static_cast<uint64_t>( t.tv_sec ) * 1000000ull + static_cast<uint64_t>( t.tv_usec );
+            return static_cast<UInt64>( t.tv_sec ) * 1000000ull + static_cast<UInt64>( t.tv_usec );
         }
 #endif
     }
@@ -10218,7 +10295,8 @@
     public:
         JunitReporter( ReporterConfig const& _config )
         :   CumulativeReporterBase( _config ),
-            xml( _config.stream() )
+            xml( _config.stream() ),
+            m_okToFail( false )
         {
             m_reporterPrefs.shouldRedirectStdOut = true;
         }
@@ -10244,8 +10322,11 @@
             CumulativeReporterBase::testGroupStarting( groupInfo );
         }

+        virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE {
+            m_okToFail = testCaseInfo.okToFail();
+        }
         virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
-            if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException )
+            if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
                 unexpectedExceptions++;
             return CumulativeReporterBase::assertionEnded( assertionStats );
         }
@@ -10410,6 +10491,7 @@
         std::ostringstream stdOutForSuite;
         std::ostringstream stdErrForSuite;
         unsigned int unexpectedExceptions;
+        bool m_okToFail;
     };

     INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
@@ -11213,8 +11295,14 @@

 #ifndef __OBJC__

+#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
 // Standard C/C++ main entry point
 int main (int argc, char * argv[]) {
+#endif
+
 	int result = Catch::Session().run( argc, argv );
     return ( result < 0xff ? result : 0xff );
 }
@@ -11294,7 +11382,7 @@
     #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
     #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
     #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
-    #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
+    #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
     #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
     #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
 #else


Fixed issue with enabled and disabled buttons.

--- copasi/UI/CQEventWidget1.cpp
+++ copasi/UI/CQEventWidget1.cpp
@@ -1,9 +1,9 @@
 // Begin CVS Header
 //   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CQEventWidget1.cpp,v $
-//   $Revision: 1.11 $
+//   $Revision: 1.12 $
 //   $Name:  $
 //   $Author: shoops $
-//   $Date: 2009/04/27 14:43:59 $
+//   $Date: 2009/05/21 15:26:22 $
 // End CVS Header

 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
@@ -58,16 +58,6 @@
 /*! Slot to save all current values of the active event widget whenever the Commit button is clicked */
 void CQEventWidget1::slotBtnCommitClicked()
 {
-  /*  // check whether no empty expression widget exists
-    if (!checkAllExpressionsOK())
-      {
-        QString msg = "There is at least one empty expression widget. Please check it.";
-
-        CQMessageBox::critical(this, "Unable to save model with empty expression widget", msg,
-                               QMessageBox::Ok | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton, QMessageBox::NoButton);
-        return;
-      }
-  */
   saveToEvent();
   loadFromEvent();
 }
@@ -483,28 +473,19 @@
 /*! The slot to be done before leaving the active event widget */
 bool CQEventWidget1::leave()
 {
-  // std::cout << "CQEW1::leave" << std::endl;
-
-  if (mpBtnCommit->isEnabled())
-    {
-      mpExpressionTrigger->updateWidget();
-
-      if (!mpBtnDelayNone->isChecked())
-        mpExpressionDelay->updateWidget();
-
-      saveToEvent();
-      //  mObjectKeyDisplayName.resize(0);
-
-      // enable/disable buttons
-      mpBtnAddTarget->setEnabled(true);
-      mpBtnCommit->setEnabled(false);
-      mpBtnRevert->setEnabled(false);
-
-      if (mpLBTarget->count()) // not empty
-        mpBtnDeleteTarget->setEnabled(true);
-      else      // empty
-        mpBtnDeleteTarget->setEnabled(false);
-    }
+  mpExpressionTrigger->updateWidget();
+
+  if (!mpBtnDelayNone->isChecked())
+    mpExpressionDelay->updateWidget();
+
+  saveToEvent();
+
+  mpBtnAddTarget->setEnabled(true);
+
+  if (mpLBTarget->count())
+    mpBtnDeleteTarget->setEnabled(true);
+  else
+    mpBtnDeleteTarget->setEnabled(false);

   return true;
 }


classhandler: print error when dlopen fails

Signed-off-by: Sage Weil <6dd34506bbd5e58221bbb3e4732d97c91f02277b@newdream.net>

--- src/common/ClassHandler.cc
+++ src/common/ClassHandler.cc
@@ -35,7 +35,8 @@
   cls.handle = dlopen(fname, RTLD_NOW);

   if (!cls.handle) {
-    dout(0) << "could not open class (dlopen failed)" << dendl;
+    char buf[80];
+    dout(0) << "could not open class (dlopen failed) " << strerror_r(errno, buf, sizeof(buf)) << dendl;
     goto done;
   }
   cls_deps = (cls_deps_t *(*)())dlsym(cls.handle, "class_deps");


Need to use iterator to get output item because it may be in an included model

--- lib/flatten.cpp
+++ lib/flatten.cpp
@@ -4321,11 +4321,23 @@
     } else {
       // Create new output model
       OutputI* outputItem = NULL;
-
-      GC::lock();
-      if (e.orig->outputItem()) {
-        outputItem = copy(e.cmap, e.orig->outputItem())->cast<OutputI>();
-      } else {
+
+      class OV1 : public ItemVisitor {
+      public:
+        EnvI& env;
+        VarOccurrences& vo;
+        OutputI*& outputItem;
+        OV1(EnvI& env0, VarOccurrences& vo0, OutputI*& outputItem0)
+        : env(env0), vo(vo0), outputItem(outputItem0) {}
+        void vOutputI(OutputI* oi) {
+          GCLock lock;
+          outputItem = copy(env.cmap, oi)->cast<OutputI>();
+          env.output->addItem(outputItem);
+        }
+      } _ov1(e,e.output_vo,outputItem);
+      iterItems(_ov1,e.orig);
+
+      if (outputItem==NULL) {
         // Create output item for all variables defined at toplevel in the MiniZinc source
         GCLock lock;
         std::vector<Expression*> outputVars;
@@ -4363,9 +4375,8 @@
         OutputI* newOutputItem = new OutputI(Location(),new ArrayLit(Location(),outputVars));
         e.orig->addItem(newOutputItem);
         outputItem = copy(e.cmap, newOutputItem)->cast<OutputI>();
-      }
-      e.output->addItem(outputItem);
-      GC::unlock();
+        e.output->addItem(outputItem);
+      }

       class CollectFunctions : public EVisitor {
       public:


Add missing break in switch statement.

Add missing break in switch statement.

Signed-off-by: Henner Zeller <e393654266408b751fd8ad27b99ca78813d38e23@google.com>

--- templates/SynthSubset.cpp
+++ templates/SynthSubset.cpp
@@ -228,6 +228,7 @@
               case uhdmnamed_fork:
               case uhdmevent_stmt: {
                 reportError(top);
+                break;
               }
               default: {
               }


Change TZ_SYS_RO_SHARE from TZ_SYS_SHARE

Change-Id: I99c921a7cfe5a03920e8787087b9d38157df851d

--- src/common/smack-rules.cpp
+++ src/common/smack-rules.cpp
@@ -44,10 +44,10 @@
 const char *const SMACK_APP_LABEL_TEMPLATE     = "~APP~";
 const char *const SMACK_PKG_LABEL_TEMPLATE     = "~PKG~";
 const char *const SMACK_AUTHOR_LABEL_TEMPLATE  = "~AUTHOR~";
-const char *const APP_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", "app-rules-template.smack");
-const char *const PKG_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", "pkg-rules-template.smack");
+const char *const APP_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_RO_SHARE, "security-manager", "policy", "app-rules-template.smack");
+const char *const PKG_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_RO_SHARE, "security-manager", "policy", "pkg-rules-template.smack");
 const char *const AUTHOR_RULES_TEMPLATE_FILE_PATH =
-    tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", "author-rules-template.smack");
+    tzplatform_mkpath4(TZ_SYS_RO_SHARE, "security-manager", "policy", "author-rules-template.smack");
 const char *const SMACK_APP_IN_PACKAGE_PERMS   = "rwxat";
 const char *const SMACK_APP_CROSS_PKG_PERMS    = "rx";
 const char *const SMACK_APP_PATH_OWNER_PERMS = "rwxat";


invoke shutdown() from destructor

invoke shutdown() from destructor

--- core/banker/master_banker.cc
+++ core/banker/master_banker.cc
@@ -294,8 +294,7 @@
         cerr << "awaiting end of save operation..." << endl;
         ML::futex_wait(saving, true);
     }
-    unregisterServiceProvider(serviceName(), { "rtbBanker" });
-    monitorProviderClient.shutdown();
+    shutdown();
 }

 void
@@ -489,6 +488,7 @@
 MasterBanker::
 shutdown()
 {
+    unregisterServiceProvider(serviceName(), { "rtbBanker" });
     RestServiceEndpoint::shutdown();
     monitorProviderClient.shutdown();
 }