Fix C++14 build.

Fix C++14 build.

Before C++17, `KJ_SWITCH_ONEOF()` has a limitation that only one can be present in any particular scope.

--- c++/src/kj/async-io.c++
+++ c++/src/kj/async-io.c++
@@ -419,27 +419,29 @@
     Promise<ReadResult> tryReadWithFds(void* buffer, size_t minBytes, size_t maxBytes,
                                        AutoCloseFd* fdBuffer, size_t maxFds) override {
       size_t capCount = 0;
-      KJ_SWITCH_ONEOF(capBuffer) {
-        KJ_CASE_ONEOF(fds, ArrayPtr<const int>) {
-          capCount = kj::max(fds.size(), maxFds);
-          // Unfortunately, we have to dup() each FD, because the writer doesn't release ownership
-          // by default.
-          // TODO(perf): Should we add an ownership-releasing version of writeWithFds()?
-          for (auto i: kj::zeroTo(capCount)) {
-            int duped;
-            KJ_SYSCALL(duped = dup(fds[i]));
-            fdBuffer[i] = kj::AutoCloseFd(fds[i]);
+      {  // TODO(cleanup): Remove redundant braces when we update to C++17.
+        KJ_SWITCH_ONEOF(capBuffer) {
+          KJ_CASE_ONEOF(fds, ArrayPtr<const int>) {
+            capCount = kj::max(fds.size(), maxFds);
+            // Unfortunately, we have to dup() each FD, because the writer doesn't release ownership
+            // by default.
+            // TODO(perf): Should we add an ownership-releasing version of writeWithFds()?
+            for (auto i: kj::zeroTo(capCount)) {
+              int duped;
+              KJ_SYSCALL(duped = dup(fds[i]));
+              fdBuffer[i] = kj::AutoCloseFd(fds[i]);
+            }
+            fdBuffer += capCount;
+            maxFds -= capCount;
           }
-          fdBuffer += capCount;
-          maxFds -= capCount;
-        }
-        KJ_CASE_ONEOF(streams, Array<Own<AsyncCapabilityStream>>) {
-          if (streams.size() > 0 && maxFds > 0) {
-            // TODO(someday): We could let people pass a LowLevelAsyncIoProvider to newTwoWayPipe()
-            //   if we wanted to auto-wrap FDs, but does anyone care?
-            KJ_FAIL_REQUIRE(
-                "async pipe message was written with streams attached, but corresponding read "
-                "asked for FDs, and we don't know how to convert here");
+          KJ_CASE_ONEOF(streams, Array<Own<AsyncCapabilityStream>>) {
+            if (streams.size() > 0 && maxFds > 0) {
+              // TODO(someday): We could let people pass a LowLevelAsyncIoProvider to
+              //   newTwoWayPipe() if we wanted to auto-wrap FDs, but does anyone care?
+              KJ_FAIL_REQUIRE(
+                  "async pipe message was written with streams attached, but corresponding read "
+                  "asked for FDs, and we don't know how to convert here");
+            }
           }
         }
       }
@@ -469,22 +471,24 @@
         void* buffer, size_t minBytes, size_t maxBytes,
         Own<AsyncCapabilityStream>* streamBuffer, size_t maxStreams) override {
       size_t capCount = 0;
-      KJ_SWITCH_ONEOF(capBuffer) {
-        KJ_CASE_ONEOF(fds, ArrayPtr<const int>) {
-          if (fds.size() > 0 && maxStreams > 0) {
-            // TODO(someday): Maybe AsyncIoStream should have a `Maybe<int> getFd()` method?
-            KJ_FAIL_REQUIRE(
-                "async pipe message was written with FDs attached, but corresponding read "
-                "asked for streams, and we don't know how to convert here");
+      {  // TODO(cleanup): Remove redundant braces when we update to C++17.
+        KJ_SWITCH_ONEOF(capBuffer) {
+          KJ_CASE_ONEOF(fds, ArrayPtr<const int>) {
+            if (fds.size() > 0 && maxStreams > 0) {
+              // TODO(someday): Maybe AsyncIoStream should have a `Maybe<int> getFd()` method?
+              KJ_FAIL_REQUIRE(
+                  "async pipe message was written with FDs attached, but corresponding read "
+                  "asked for streams, and we don't know how to convert here");
+            }
           }
-        }
-        KJ_CASE_ONEOF(streams, Array<Own<AsyncCapabilityStream>>) {
-          capCount = kj::max(streams.size(), maxStreams);
-          for (auto i: kj::zeroTo(capCount)) {
-            streamBuffer[i] = kj::mv(streams[i]);
+          KJ_CASE_ONEOF(streams, Array<Own<AsyncCapabilityStream>>) {
+            capCount = kj::max(streams.size(), maxStreams);
+            for (auto i: kj::zeroTo(capCount)) {
+              streamBuffer[i] = kj::mv(streams[i]);
+            }
+            streamBuffer += capCount;
+            maxStreams -= capCount;
           }
-          streamBuffer += capCount;
-          maxStreams -= capCount;
         }
       }

@@ -917,26 +921,28 @@
                                ArrayPtr<const int> fds) override {
       KJ_REQUIRE(canceler.isEmpty(), "already pumping");

-      KJ_SWITCH_ONEOF(capBuffer) {
-        KJ_CASE_ONEOF(fdBuffer, ArrayPtr<AutoCloseFd>) {
-          size_t count = kj::max(fdBuffer.size(), fds.size());
-          // Unfortunately, we have to dup() each FD, because the writer doesn't release ownership
-          // by default.
-          // TODO(perf): Should we add an ownership-releasing version of writeWithFds()?
-          for (auto i: kj::zeroTo(count)) {
-            int duped;
-            KJ_SYSCALL(duped = dup(fds[i]));
-            fdBuffer[i] = kj::AutoCloseFd(duped);
+      {  // TODO(cleanup): Remove redundant braces when we update to C++17.
+        KJ_SWITCH_ONEOF(capBuffer) {
+          KJ_CASE_ONEOF(fdBuffer, ArrayPtr<AutoCloseFd>) {
+            size_t count = kj::max(fdBuffer.size(), fds.size());
+            // Unfortunately, we have to dup() each FD, because the writer doesn't release ownership
+            // by default.
+            // TODO(perf): Should we add an ownership-releasing version of writeWithFds()?
+            for (auto i: kj::zeroTo(count)) {
+              int duped;
+              KJ_SYSCALL(duped = dup(fds[i]));
+              fdBuffer[i] = kj::AutoCloseFd(duped);
+            }
+            capBuffer = fdBuffer.slice(count, fdBuffer.size());
+            readSoFar.capCount += count;
           }
-          capBuffer = fdBuffer.slice(count, fdBuffer.size());
-          readSoFar.capCount += count;
-        }
-        KJ_CASE_ONEOF(streamBuffer, ArrayPtr<Own<AsyncCapabilityStream>>) {
-          if (streamBuffer.size() > 0 && fds.size() > 0) {
-            // TODO(someday): Maybe AsyncIoStream should have a `Maybe<int> getFd()` method?
-            KJ_FAIL_REQUIRE(
-                "async pipe message was written with FDs attached, but corresponding read "
-                "asked for streams, and we don't know how to convert here");
+          KJ_CASE_ONEOF(streamBuffer, ArrayPtr<Own<AsyncCapabilityStream>>) {
+            if (streamBuffer.size() > 0 && fds.size() > 0) {
+              // TODO(someday): Maybe AsyncIoStream should have a `Maybe<int> getFd()` method?
+              KJ_FAIL_REQUIRE(
+                  "async pipe message was written with FDs attached, but corresponding read "
+                  "asked for streams, and we don't know how to convert here");
+            }
           }
         }
       }
@@ -961,23 +967,25 @@
                                    Array<Own<AsyncCapabilityStream>> streams) override {
       KJ_REQUIRE(canceler.isEmpty(), "already pumping");

-      KJ_SWITCH_ONEOF(capBuffer) {
-        KJ_CASE_ONEOF(fdBuffer, ArrayPtr<AutoCloseFd>) {
-          if (fdBuffer.size() > 0 && streams.size() > 0) {
-            // TODO(someday): We could let people pass a LowLevelAsyncIoProvider to newTwoWayPipe()
-            //   if we wanted to auto-wrap FDs, but does anyone care?
-            KJ_FAIL_REQUIRE(
-                "async pipe message was written with streams attached, but corresponding read "
-                "asked for FDs, and we don't know how to convert here");
+      {  // TODO(cleanup): Remove redundant braces when we update to C++17.
+        KJ_SWITCH_ONEOF(capBuffer) {
+          KJ_CASE_ONEOF(fdBuffer, ArrayPtr<AutoCloseFd>) {
+            if (fdBuffer.size() > 0 && streams.size() > 0) {
+              // TODO(someday): We could let people pass a LowLevelAsyncIoProvider to newTwoWayPipe()
+              //   if we wanted to auto-wrap FDs, but does anyone care?
+              KJ_FAIL_REQUIRE(
+                  "async pipe message was written with streams attached, but corresponding read "
+                  "asked for FDs, and we don't know how to convert here");
+            }
           }
-        }
-        KJ_CASE_ONEOF(streamBuffer, ArrayPtr<Own<AsyncCapabilityStream>>) {
-          size_t count = kj::max(streamBuffer.size(), streams.size());
-          for (auto i: kj::zeroTo(count)) {
-            streamBuffer[i] = kj::mv(streams[i]);
+          KJ_CASE_ONEOF(streamBuffer, ArrayPtr<Own<AsyncCapabilityStream>>) {
+            size_t count = kj::max(streamBuffer.size(), streams.size());
+            for (auto i: kj::zeroTo(count)) {
+              streamBuffer[i] = kj::mv(streams[i]);
+            }
+            capBuffer = streamBuffer.slice(count, streamBuffer.size());
+            readSoFar.capCount += count;
           }
-          capBuffer = streamBuffer.slice(count, streamBuffer.size());
-          readSoFar.capCount += count;
         }
       }


Modified error handling on startappservice for linux

--- qttasserver/services/startappservice.cpp
+++ qttasserver/services/startappservice.cpp
@@ -201,7 +201,7 @@
     // Environment bloc variable
     QStringList envList = QProcess::systemEnvironment() << environmentVars;

-	WCHAR* envp = (WCHAR*)malloc((envList.join(" ").length() + 2) * sizeof(WCHAR)); // just counting memory in cluding the NULL (\0) string ends and binal NULL block end
+    WCHAR* envp = (WCHAR*)malloc((envList.join(" ").length() + 2) * sizeof(WCHAR)); // just counting memory in cluding the NULL (\0) string ends and binal NULL block end
     LPTSTR env = (LPTSTR) envp;

     for (int i = 0; i < envList.length(); i++)
@@ -246,19 +246,6 @@

     pid_t pid, sid, grandpid;

-    /////int pidPipeDesc[2];
-    /////qt_safe_pipe(pidPipeDesc);
-    // Using shared memory pro IPC instead of qt pipes to avoid using private qt libraries.
-    QSharedMemory mem("pid_mem");
-    if ( !mem.create(sizeof(pid_t)) )
-    {
-        TasLogger::logger()->debug(QString("TasServer::startApplication: SharedMem ERROR: ").arg(mem.errorString()));
-    }
-    mem.lock();
-    pid_t *mem_ptr = (pid_t *) mem.data();
-    *mem_ptr = 0;
-    mem.unlock();
-
     // Create Arguments ARRAY (application path to executable on first element)
     QStringList paramList;
     paramList << applicationPath;
@@ -276,9 +263,6 @@

     // Create environment Array with NULL end element
     QStringList envList = QProcess::systemEnvironment() << environmentVars;
-    //TasLogger::logger()->debug(QString("TasServer::startApplipidPipeDesccation: ALL '%1'").arg(envList.join(",")));
-    //TasLogger::logger()->debug(QString("TasServer::startApplication: USER '%1'").arg(environmentVars.join(",")));
-
     char **envListArray = new char*[ envList.length() + 1 ];
     for( int i = 0; i < envList.length(); i++)
     {
@@ -289,110 +273,132 @@
     }
     envListArray[envList.length()] = NULL;

-    // START MAKING CHILDREN HERE :D
-    // Child
-    if ( (pid = fork()) == 0) {
-
-        // We are only going to write on the pipe for papa
-        /////qt_safe_close(pidPipeDesc[0]);
-
-        // Create new session for the process (detatch from parent process group)
-        sid = setsid();
-        if ( sid < 0 )
-        {
-            TasLogger::logger()->error( QString("TasServer::launchDetached:Failed to detach child."));
-            exit(1);
-        }
-
-        // Grandchild
-        if ( ( grandpid = fork() ) == 0 )
-        {
-            // detach ont he grandchild.
+
+    /////int pidPipeDesc[2];
+    /////qt_safe_pipe(pidPipeDesc);
+    // Using shared memory pro IPC instead of qt pipes to avoid using private qt libraries.
+    QSharedMemory mem("pid_mem");
+    if ( mem.create(sizeof(pid_t)) )
+    {
+
+        mem.lock();
+        pid_t *mem_ptr = (pid_t *) mem.data();
+        *mem_ptr = 0;
+        mem.unlock();
+
+        // START MAKING CHILDREN HERE :D
+        // Child
+        if ( (pid = fork()) == 0) {
+
+            // We are only going to write on the pipe for papa
+            /////qt_safe_close(pidPipeDesc[0]);
+
+            // Create new session for the process (detatch from parent process group)
+            sid = setsid();
+            if ( sid < 0 )
+            {
+                TasLogger::logger()->error( QString("TasServer::launchDetached:Failed to detach child."));
+                exit(1);
+            }
+
+            // Grandchild
+            if ( ( grandpid = fork() ) == 0 )
+            {
+                // detach ont he grandchild.
+                mem.detach();
+
+                // Try see if we don't need path
+                execve( paramListArray[0], paramListArray, envListArray);
+
+                // Try also on all path directories if above fails
+                const QString path = QString::fromLocal8Bit(::getenv("PATH"));
+                const QString file = QString::fromLocal8Bit(paramListArray[0]);
+                if (!path.isEmpty())
+                {
+                    QStringList pathEntries = path.split(QLatin1Char(':'));
+                    for (int k = 0; k < pathEntries.size(); ++k) {
+                        QByteArray tmp = QFile::encodeName(pathEntries.at(k));
+                        if (!tmp.endsWith('/')) tmp += '/';
+                        tmp += QFile::encodeName(file);
+                        paramListArray[0] = tmp.data();
+                        TasLogger::logger()->error( QString("TasServer::launchDetached: PATH = '%1'").arg((char *) paramListArray[0]));
+                        execve( paramListArray[0], paramListArray, envListArray);
+
+                    }
+                 }
+
+                TasLogger::logger()->error( QString("TasServer::launchDetached: Granhild process died straight away."));
+            }
+
+            // Child exit in order to end detachment of grandchild
+            else if( grandpid > 0)
+            {
+                /////qt_safe_write(pidPipeDesc[1], &grandpid, sizeof(pid_t));
+                /////qt_safe_close(pidPipeDesc[1]);
+                QSharedMemory mem("pid_mem");
+                mem.attach();
+                mem.lock();
+                pid_t *mem_ptr = (pid_t *) mem.data();
+                *mem_ptr = grandpid;
+                mem.unlock();
+                mem.detach();
+                _exit(0);
+            }
+            else
+            {
+                // if child fork fails detach mem and kill child
+                // TODO Return with error?
+                mem.detach();
+                _exit(0);
+            }
+
+        }
+
+        // Parent
+        else if (pid > 0) {
+
+            // We are only going to read from the pipe from child
+            /////qt_safe_close(pidPipeDesc[1]);
+            pid_t actualpid = 0;
+            /////qt_safe_read(pidPipeDesc[0], &actualpid, sizeof(pid_t));
+            /////qt_safe_close(pidPipeDesc[0]);
+            while(!actualpid)
+            {
+                mem.lock();
+                pid_t *mem_ptr = (pid_t *) mem.data();
+                actualpid = *mem_ptr;
+                mem.unlock();
+                TasLogger::logger()->debug( QString("TasServer::launchDetached: ACTUAL Child PID: %1").arg((int)actualpid) );
+                //TODO? add counter to break free if error on fork()
+            }
             mem.detach();

-            // Try see if we don't need path
-            execve( paramListArray[0], paramListArray, envListArray);
-
-            // Try also on all path directories if above fails
-            const QString path = QString::fromLocal8Bit(::getenv("PATH"));
-            const QString file = QString::fromLocal8Bit(paramListArray[0]);
-            if (!path.isEmpty())
-            {
-                QStringList pathEntries = path.split(QLatin1Char(':'));
-                for (int k = 0; k < pathEntries.size(); ++k) {
-                    QByteArray tmp = QFile::encodeName(pathEntries.at(k));
-                    if (!tmp.endsWith('/')) tmp += '/';
-                    tmp += QFile::encodeName(file);
-                    paramListArray[0] = tmp.data();
-                    TasLogger::logger()->error( QString("TasServer::launchDetached: PATH = '%1'").arg((char *) paramListArray[0]));
-                    execve( paramListArray[0], paramListArray, envListArray);
-
-                }
-             }
-
-            TasLogger::logger()->error( QString("TasServer::launchDetached: Granhild process died straight away."));
-        }
-
-        // Child exit in order to end detachment of grandchild
-        else if( grandpid > 0)
-        {
-            /////qt_safe_write(pidPipeDesc[1], &grandpid, sizeof(pid_t));
-            /////qt_safe_close(pidPipeDesc[1]);
-            QSharedMemory mem("pid_mem");
-            mem.attach();
-            mem.lock();
-            pid_t *mem_ptr = (pid_t *) mem.data();
-            *mem_ptr = grandpid;
-            mem.unlock();
-            mem.detach();
-            _exit(0);
+            pid = actualpid;
+
+            // Free memory
+            for (int i = 0; i < paramList.length(); i++ )
+            {
+                delete [] paramListArray[i];
+            }
+            delete [] paramListArray;
+
+            for (int i = 0; i < envList.length(); i++ )
+            {
+                delete [] envListArray[i];
+            }
+            delete [] envListArray;
+
+            TasLogger::logger()->debug( QString("TasServer::launchDetached: Child PID: %1").arg((int)pid) );
+            response.setData(QString::number((int) pid));
         }
         else
         {
-            // if child fork fails detach mem and kill child
-            // TODO Return with error?
+            //fails, clear mem and send error
             mem.detach();
-            _exit(0);
-        }
-
-    }
-
-    // Parent
-    else if (pid > 0) {
-
-        // We are only going to read from the pipe from child
-        /////qt_safe_close(pidPipeDesc[1]);
-        pid_t actualpid = 0;
-        /////qt_safe_read(pidPipeDesc[0], &actualpid, sizeof(pid_t));
-        /////qt_safe_close(pidPipeDesc[0]);
-        while(!actualpid)
-        {
-            mem.lock();
-            pid_t *mem_ptr = (pid_t *) mem.data();
-            actualpid = *mem_ptr;
-            mem.unlock();
-            TasLogger::logger()->debug( QString("TasServer::launchDetached: ACTUAL Child PID: %1").arg((int)actualpid) );
-            //TODO? add counter to break free if error on fork()
-        }
-        mem.detach();
-
-        pid = actualpid;
-
-        // Free memory
-        for (int i = 0; i < paramList.length(); i++ )
-        {
-            delete [] paramListArray[i];
-        }
-        delete [] paramListArray;
-
-        for (int i = 0; i < envList.length(); i++ )
-        {
-            delete [] envListArray[i];
-        }
-        delete [] envListArray;
-
-        TasLogger::logger()->debug( QString("TasServer::launchDetached: Child PID: %1").arg((int)pid) );
-        response.setData(QString::number((int) pid));
+            TasLogger::logger()->error("TasServer::launchDetached: Could not start the application " + applicationPath);
+            response.setErrorMessage("Could not start the application " + applicationPath);
+
+        }
     }

@@ -408,6 +414,7 @@
 #if (defined(Q_OS_UNIX) || defined(Q_OS_WS_MAC)) && !defined(Q_OS_SYMBIAN)
         // if parent fork fails, clear mem and send error
         mem.detach();
+        TasLogger::logger()->debug(QString("TasServer::startApplication: SharedMem ERROR: ").arg(mem.errorString()));
 #endif
         TasLogger::logger()->error("TasServer::launchDetached: Could not start the application " + applicationPath);
         response.setErrorMessage("Could not start the application " + applicationPath);


filestore: fix fiemap

filestore: fix fiemap

--- src/os/FileStore.cc
+++ src/os/FileStore.cc
@@ -2672,6 +2672,7 @@
         extent->fe_length = offset + len - extent->fe_logical;
       extmap[extent->fe_logical] = extent->fe_length;
       i++;
+      extent++;
     }
   }


Fix failing init_connect.test (5.1-runtime).

sql/sql_connect.cc:
  Fix failing init_connect.test (5.1-runtime). Add comments for the unjustified use
  of thd->is_slave_error.

--- sql/sql_connect.cc
+++ sql/sql_connect.cc
@@ -1030,7 +1030,17 @@
   if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL))
   {
     execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
-    if (thd->net.report_error)
+    /*
+      execute_init_command calls net_send_error.
+      If there was an error during execution of the init statements,
+      the error at this moment is present in thd->net.last_error and also
+      thd->is_slave_error and thd->net.report_error are set.
+      net_send_error sends the contents of thd->net.last_error and
+      clears thd->net.report_error. It doesn't, however, clean
+      thd->is_slave_error or thd->net.last_error. Here we make use of this
+      fact.
+    */
+    if (thd->is_slave_error)
     {
       thd->killed= THD::KILL_CONNECTION;
       sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),


added RayCast.Scan unit test

added RayCast.Scan unit test

--- test/test_ray_cast.cpp
+++ test/test_ray_cast.cpp
@@ -10,12 +10,12 @@
 #include <gtest/gtest.h>
 #include <opencv2/core/core.hpp>
 #include <opencv2/imgproc/imgproc.hpp>
-#include <opencv2/highgui/highgui.hpp>
+#include <sensor_msgs/LaserScan.h>

 // The fixture for testing class RayCast
 class RayCastTest : public ::testing::Test {};

-TEST_F(RayCastTest, TestTest) {
+TEST_F(RayCastTest, TraceTest) {
   RayCast rc;
   cv::Point start, end, hit;

@@ -37,6 +37,30 @@
   EXPECT_FALSE(rc.Trace(start, end, hit));
 }

+
+TEST_F(RayCastTest, ScanTest) {
+  RayCast rc(0, 50, -M_PI_2, M_PI_2, M_PI_2, 0);
+  cv::Point start(5,5);
+
+  // Set up the raycast with a very simple map
+  cv::Mat mat = cv::Mat::zeros(20, 20, CV_8UC1);
+  cv::rectangle( mat, cv::Point( 15, 0 ), cv::Point( 20, 20), 255, CV_FILLED);
+  cv::rectangle( mat, cv::Point( 0, 17 ), cv::Point( 20, 20), 255, CV_FILLED);
+  rc.SetMap(mat, 2.0);  // 2.0m per pixel
+
+  // Test tracing from empty space into wall
+  sensor_msgs::LaserScan s = rc.Scan(start, M_PI_2);  // Scan angled up
+
+  // General properties
+  EXPECT_NEAR(s.angle_min, -M_PI_2, 1e-5);
+  EXPECT_EQ(3, s.ranges.size());
+
+  // Right wall
+  EXPECT_NEAR(s.ranges[0], 20.0, 1e-5);  // 20m to right wall
+  EXPECT_NEAR(s.ranges[1], 24.0, 1e-5);  // 24m to top wall
+  EXPECT_NEAR(s.ranges[2], 51.0, 1e-5);  // max range + 1m for no return
+}
+
 int main(int argc, char **argv) {
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();


add failingtestcase for prop4

add failingtestcase for prop4

--- test/testpropagate.cpp
+++ test/testpropagate.cpp
@@ -590,6 +590,18 @@
     compareSpecific( N, batchSize, dim, fn, 1, 5 );
 }

+TEST( testpropagate, compare_1_4_fcscenario ) { // only need to do nopad, since fc wont work with pad
+    LayerDimensions dim;
+    int batchSize = 4;
+    int N = 4;
+    string activationName = "tanh";
+    dim.setInputPlanes( 10 ).setInputBoardSize(24).setNumFilters( 10 )
+        .setFilterSize( 24 )
+        .setPadZeros( false ).setBiased( true );
+    ActivationFunction *fn = ActivationFunction::fromName( activationName );
+    compareSpecific( N, batchSize, dim, fn, 1, 4 );
+}
+
 //TEST( SLOW_testpropagate, comparespecific ) {
 //    LayerDimensions dim;
 //    dim.setInputPlanes( 2 ).setInputBoardSize(5).setNumFilters( 1 ).setFilterSize( 5 )


・設定画面のwxDirPickerCtrlを修正

・設定画面のwxDirPickerCtrlを修正

--- src/otherpanels.cpp
+++ src/otherpanels.cpp
@@ -177,28 +177,35 @@
      // begin wxGlade: PathSettingPanel::PathSettingPanel
      browserCheck = new wxCheckBox(this, ID_BrowserCheck, wxT("ブラウザを指定する"));
      label_1 = new wxStaticText(this, wxID_ANY, wxT("ブラウザのパス"));
+
+#ifdef __WXGTK__
      browserPathTC = new wxTextCtrl(this,
 				    ID_BrowserPathTC,
 				    wxEmptyString,
 				    wxDefaultPosition,
 				    wxDefaultSize,
 				    wxTE_READONLY);
+#endif
      dirPicker1 = new wxDirPickerCtrl(this, ID_DirPickerBrowser);
      label_2 = new wxStaticText(this, wxID_ANY, wxT("ログとボード一覧のフォルダ（次回起動時から有効）"));
+#ifdef __WXGTK__
      boardListTC = new wxTextCtrl(this,
 				  ID_BoardListTC,
 				  wxEmptyString,
 				  wxDefaultPosition,
 				  wxDefaultSize,
 				  wxTE_READONLY);
+#endif
      dirPicker2 = new wxDirPickerCtrl(this, ID_DirPickerBoardList);
      label_3 = new wxStaticText(this, wxID_ANY, wxT("スキンのフォルダ（次回起動時から有効）"));
+#ifdef __WXGTK__
      skinPathTC = new wxTextCtrl(this,
 			       ID_SkinPathTC,
 			       wxEmptyString,
 			       wxDefaultPosition,
 			       wxDefaultSize,
 			       wxTE_READONLY);
+#endif
      dirPicker3 = new wxDirPickerCtrl(this, ID_DirPickerSkin);

      set_properties();
@@ -215,9 +222,16 @@
      JaneCloneUtil::GetJaneCloneProperties(wxT("DEFAULT_BOARDLIST_PATH"), &boardListPath);
      JaneCloneUtil::GetJaneCloneProperties(wxT("DEFAULT_SKINFILE_PATH"), &skinPath);
      browserCheck->SetValue(specifyBrowser);
+
+#ifdef __WXGTK__
      browserPathTC->SetValue(browserPath);
      boardListTC->SetValue(boardListPath);
      skinPathTC->SetValue(skinPath);
+#else
+     dirPicker1->SetPath(browserPath);
+     dirPicker2->SetPath(boardListPath);
+     dirPicker3->SetPath(skinPath);
+#endif
 }

@@ -226,18 +240,36 @@
     wxGridSizer* grid_sizer_1 = new wxGridSizer(7, 2, 0, 0);
     grid_sizer_1->Add(browserCheck, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
     grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
-    grid_sizer_1->Add(label_1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
-    grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
+
+#ifdef __WXGTK__
+    grid_sizer_1->Add(label_1, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
     grid_sizer_1->Add(browserPathTC, 0, wxALL|wxEXPAND, 5);
     grid_sizer_1->Add(dirPicker1, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+    grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
+#else
+    grid_sizer_1->Add(label_1, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
+    grid_sizer_1->Add(dirPicker1, 1, wxALL|wxEXPAND, 5);
+#endif
+
+#ifdef __WXGTK__
     grid_sizer_1->Add(label_2, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
-    grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
     grid_sizer_1->Add(boardListTC, 0, wxALL|wxEXPAND, 5);
     grid_sizer_1->Add(dirPicker2, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+    grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
+#else
+    grid_sizer_1->Add(label_2, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
+    grid_sizer_1->Add(dirPicker2, 1, wxALL|wxEXPAND, 5);
+#endif
+
+#ifdef __WXGTK__
     grid_sizer_1->Add(label_3, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
-    grid_sizer_1->Add(20, 20, 0, wxEXPAND, 0);
     grid_sizer_1->Add(skinPathTC, 0, wxALL|wxEXPAND, 5);
     grid_sizer_1->Add(dirPicker3, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+#else
+    grid_sizer_1->Add(label_3, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5);
+    grid_sizer_1->Add(dirPicker3, 1, wxALL|wxEXPAND, 5);
+#endif
+
     SetSizer(grid_sizer_1);
     grid_sizer_1->Fit(this);
     // end wxGlade


Check that ‘->’ is present in a TINA transition.

--- src/parsers/tina.cc
+++ src/parsers/tina.cc
@@ -106,14 +106,21 @@
           ss >> s1;
         }

+        bool found_arrow = false;
         while (ss >> s1)
         {
           if (s1 == "->")
           {
+            found_arrow = true;
             break;
           }
           std::tie(place_id, valuation) = place_valuation(s1);
           net.add_pre_place(s0, place_id, pn::arc(valuation));
+        }
+
+        if (not found_arrow)
+        {
+          throw parse_error("Invalid transition (missing '->'): " + line);
         }

         while (ss >> s1)


Add namespace comment.

Add namespace comment.

--- src/parsing/utf8.cc
+++ src/parsing/utf8.cc
@@ -177,4 +177,4 @@
     return is_valid_internal(str, end, reason);
 }

-};
+} // namespace utf8


Avoid box filtering when magnifying, because it's actually
nearest-neighbor.

BUG=222667
TEST=tab capture using SimpleMirror and --disable-force-compositing-mode=true

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@199144 0039d316-1c4b-4281-b951-d872f2087c98

--- content/browser/renderer_host/media/web_contents_video_capture_device.cc
+++ content/browser/renderer_host/media/web_contents_video_capture_device.cc
@@ -714,10 +714,21 @@
   SkBitmap scaled_bitmap;
   if (input.width() != region_in_frame.width() ||
       input.height() != region_in_frame.height()) {
+
+    skia::ImageOperations::ResizeMethod method;
+    if (input.width() < region_in_frame.width() ||
+        input.height() < region_in_frame.height()) {
+      // Avoid box filtering when magnifying, because it's actually
+      // nearest-neighbor.
+      method = skia::ImageOperations::RESIZE_HAMMING1;
+    } else {
+      method = skia::ImageOperations::RESIZE_BOX;
+    }
+
     TRACE_EVENT_ASYNC_STEP0("mirroring", "Capture", output.get(), "Scale");
-    scaled_bitmap = skia::ImageOperations::Resize(
-        input, skia::ImageOperations::RESIZE_BOX,
-        region_in_frame.width(), region_in_frame.height());
+    scaled_bitmap = skia::ImageOperations::Resize(input, method,
+                                                  region_in_frame.width(),
+                                                  region_in_frame.height());
   } else {
     scaled_bitmap = input;
   }


Configurable block size for fileperblock.

git-svn-id: b1ac999b5221095f81189147f8ea7346e71887ac@1218 4e380d45-d1fd-0310-85a7-d18ec86df0ad

--- mng/mng.cpp
+++ mng/mng.cpp
@@ -11,6 +11,7 @@
  *  http://www.boost.org/LICENSE_1_0.txt)
  **************************************************************************/

+#include <sstream>
 #include <stxxl/mng>
 #include <stxxl/bits/io/io.h>
 #include <stxxl/bits/version.h>
@@ -170,9 +171,16 @@
         result->lock();
         return result;
     }
-    else if (io_impl == "fileperblock")
-    {
-        fileperblock_file<syscall_file> * result = new fileperblock_file<syscall_file>(filename, options, 8 * 1048576, disk);
+    else if (io_impl.find_first_of("fileperblock(") == 0)
+    {
+        std::istringstream input(io_impl);
+        input.ignore(std::string("fileperblock(").size());
+        size_t block_size;
+        input >> block_size;
+        if(block_size <= 0)
+            STXXL_THROW(std::runtime_error, "FileCreator::create", "No/incorrect block size given for fileperblock.");
+
+        fileperblock_file<syscall_file> * result = new fileperblock_file<syscall_file>(filename, options, block_size, disk);
         result->lock();
         return result;
     }


improvement in GringoGrounder

improvement in GringoGrounder

--- src/GringoGrounder.cpp
+++ src/GringoGrounder.cpp
@@ -188,7 +188,8 @@
 					throw GeneralError(ss.str());

 				}
-				r.body.push_back(ID(ID::MAINKIND_LITERAL | ID::SUBKIND_ATOM_ORDINARYG | (indexToGroundAtomID[p].isAuxiliary() ? ID::PROPERTY_AUX : 0), indexToGroundAtomID[p].address));
+				r.body.push_back(ID::literalFromAtom(indexToGroundAtomID[p], false));
+//				r.body.push_back(ID(ID::MAINKIND_LITERAL | ID::SUBKIND_ATOM_ORDINARYG | (indexToGroundAtomID[p].isAuxiliary() ? ID::PROPERTY_AUX : 0), indexToGroundAtomID[p].address));
 			}
 			BOOST_FOREACH (uint32_t n, lpr.neg){
 				addSymbol(n);
@@ -199,7 +200,8 @@
 					throw GeneralError(ss.str());

 				}
-				r.body.push_back(ID(ID::MAINKIND_LITERAL | ID::SUBKIND_ATOM_ORDINARYG | (indexToGroundAtomID[n].isAuxiliary() ? ID::PROPERTY_AUX : 0) | ID::NAF_MASK, indexToGroundAtomID[n].address));
+				r.body.push_back(ID::literalFromAtom(indexToGroundAtomID[n], true));
+//				r.body.push_back(ID(ID::MAINKIND_LITERAL | ID::SUBKIND_ATOM_ORDINARYG | (indexToGroundAtomID[n].isAuxiliary() ? ID::PROPERTY_AUX : 0) | ID::NAF_MASK, indexToGroundAtomID[n].address));
 			}

 			if (r.head.size() == 0) r.kind |= ID::SUBKIND_RULE_CONSTRAINT;
@@ -262,6 +264,41 @@
 		ss << ")";
 	}
 	std::string atomstring = ss.str();
+
+	ID dlvhexId = ctx.registry()->ogatoms.getIDByString(atomstring);
+
+	if( dlvhexId == ID_FAIL )
+	{
+		// parse groundatom, register and store
+		DBGLOG(DBG,"parsing gringo ground atom '" << atomstring << "'");
+		OrdinaryAtom ogatom(ID::MAINKIND_ATOM | ID::SUBKIND_ATOM_ORDINARYG);
+		ogatom.text = atomstring;
+		{
+			// create ogatom.tuple
+			boost::char_separator<char> sep(",()");
+			typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+			tokenizer tok(ogatom.text, sep);
+			for(tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
+			{
+				DBGLOG(DBG,"got token '" << *it << "'");
+				Term term(ID::MAINKIND_TERM, *it);
+				// the following takes care of int vs const/string
+				ID id = ctx.registry()->storeTerm(term);
+				assert(id != ID_FAIL);
+				assert(!id.isVariableTerm());
+				if( id.isAuxiliary() ) ogatom.kind |= ID::PROPERTY_AUX;
+				ogatom.tuple.push_back(id);
+			}
+		}
+		dlvhexId = ctx.registry()->ogatoms.storeAndGetID(ogatom);
+	}
+
+	indexToGroundAtomID[atom.first] = dlvhexId;
+	DBGLOG(DBG, "Got atom " << atomstring << " with Gringo-ID " << atom.first << " and dlvhex-ID " << dlvhexId);
+}
+
+/*
+void GringoGrounder::GroundHexProgramBuilder::printSymbolTableEntry(uint32_t index, const std::string &atomstring){

 	ID dlvhexId = ctx.registry()->ogatoms.getIDByString(atomstring);

@@ -291,41 +328,6 @@
 		dlvhexId = ctx.registry()->ogatoms.storeAndGetID(ogatom);
 	}

-	indexToGroundAtomID[atom.first] = dlvhexId;
-	DBGLOG(DBG, "Got atom " << atomstring << " with Gringo-ID " << atom.first << " and dlvhex-ID " << dlvhexId);
-}
-
-/*
-void GringoGrounder::GroundHexProgramBuilder::printSymbolTableEntry(uint32_t index, const std::string &atomstring){
-
-	ID dlvhexId = ctx.registry()->ogatoms.getIDByString(atomstring);
-
-	if( dlvhexId == ID_FAIL )
-	{
-		// parse groundatom, register and store
-		DBGLOG(DBG,"parsing clingo ground atom '" << atomstring << "'");
-		OrdinaryAtom ogatom(ID::MAINKIND_ATOM | ID::SUBKIND_ATOM_ORDINARYG);
-		ogatom.text = atomstring;
-		{
-			// create ogatom.tuple
-			boost::char_separator<char> sep(",()");
-			typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-			tokenizer tok(ogatom.text, sep);
-			for(tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
-			{
-				DBGLOG(DBG,"got token '" << *it << "'");
-				Term term(ID::MAINKIND_TERM, *it);
-				// the following takes care of int vs const/string
-				ID id = ctx.registry()->storeTerm(term);
-				assert(id != ID_FAIL);
-				assert(!id.isVariableTerm());
-				if( id.isAuxiliary() ) ogatom.kind |= ID::PROPERTY_AUX;
-				ogatom.tuple.push_back(id);
-			}
-		}
-		dlvhexId = ctx.registry()->ogatoms.storeAndGetID(ogatom);
-	}
-
 	indexToGroundAtomID[index] = dlvhexId;
 	DBGLOG(DBG, "Got atom " << atomstring << " with Gringo-ID " << index << " and dlvhex-ID " << dlvhexId);
 }


+ delete helper file for copy/paste on application exit

--- src/Gui/MainWindow.cpp
+++ src/Gui/MainWindow.cpp
@@ -958,6 +958,14 @@
         delete d->assistant;
         d->assistant = 0;

+        // See createMimeDataFromSelection
+        QVariant prop = this->property("x-documentobject-file");
+        if (!prop.isNull()) {
+            Base::FileInfo fi((const char*)prop.toByteArray());
+            if (fi.exists())
+                fi.deleteFile();
+        }
+
         /*emit*/ mainWindowClosed();
         qApp->quit(); // stop the event loop
     }
@@ -1342,6 +1350,10 @@
         doc->exportObjects(sel, str);
         str.close();
         res = fi.filePath().c_str();
+
+        // store the path name as a custom property and
+        // delete this file when closing the application
+        const_cast<MainWindow*>(this)->setProperty("x-documentobject-file", res);
     }

     QMimeData *mimeData = new QMimeData();


Added MQTT to description

Added MQTT to description

--- src/HC_NodeMcuCode.cpp
+++ src/HC_NodeMcuCode.cpp
@@ -12,6 +12,7 @@
   Adafruit_Sensor.g https://github.com/adafruit/Adafruit_Sensor required for DHT.h
   ----------
   GUi: Locally hosted home assistant
+  MQTT: Locally hosted broker https://mosquitto.org/
   ----------
   The circuit:
   NodeMCU Amica (ESP8266)


Enabled test case again by exchanging unsupported input file.

--- lib/pddlparse/tests/TestOfficialPDDLInstances.cpp
+++ lib/pddlparse/tests/TestOfficialPDDLInstances.cpp
@@ -186,17 +186,17 @@
 		CHECK(goal2->arguments[1].get<pddl::ast::ConstantPointer>()->declaration->type.value().get<pddl::ast::PrimitiveTypePointer>()->declaration == typeBlock.get());
 	}

-	/*SECTION("“either” type in zenotravel domain")
-	{
-		context.mode = pddl::Mode::Compatibility;
-
-		const auto domainFile = pddlInstanceBasePath / "ipc-2002" / "domains" / "zenotravel-numeric-hand-coded" / "domain.pddl";
+	SECTION("“either” type in zenotravel domain")
+	{
+		context.mode = pddl::Mode::Compatibility;
+
+		const auto domainFile = pddlInstanceBasePath / "ipc-2002" / "domains" / "zenotravel-strips-hand-coded" / "domain.pddl";
 		context.tokenizer.read(domainFile);
 		auto description = pddl::parseDescription(context);

 		const auto &predicates = description.domain->predicates;

-		REQUIRE(predicates.size() == 2);
+		REQUIRE(predicates.size() == 4);
 		REQUIRE(predicates[0]->name == "at");
 		REQUIRE(predicates[0]->parameters.size() == 2);
 		REQUIRE(predicates[0]->parameters[0]->name == "x");
@@ -206,7 +206,7 @@
 		REQUIRE(predicates[0]->parameters[1]->name == "c");
 		REQUIRE(predicates[0]->parameters[1]->type);
 		CHECK(predicates[0]->parameters[1]->type.value().get<pddl::ast::PrimitiveTypePointer>()->declaration->name == "city");
-	}*/
+	}

 	SECTION("typed constants in schedule domain")
 	{


Fix comment for some instruction encodings, add TODO for others.

--- src/HexagonOffload.cpp
+++ src/HexagonOffload.cpp
@@ -316,7 +316,13 @@
             // 0111 1110 0uu1 iiii PP1i iiii iiid dddd
             mask = 0x000f1fe0;
         } else if ((inst >> 24) == 65 || (inst >> 24) == 77) {
+            // 0100 0001 000s ssss PP0t tiii iiid dddd
             // 0100 0001 001s ssss PP0t tiii iiid dddd
+            // 0100 0001 010s ssss PP0t tiii iiid dddd
+            // 0100 0001 011s ssss PP0t tiii iiid dddd
+            // 0100 0001 100s ssss PP0t tiii iiid dddd
+            // 0100 0001 110s ssss PP0t tiii iiid dddd
+            // TODO: Add instructions to comment for mask 77.
             mask = 0x000007e0;
         } else if ((inst >> 21) == 540) {
             // 0100 0011 100s ssss PP0t tiii iiid dddd


Allow ZMQ_PROBE_ROUTER and ZMQ_HANDSHAKE_IVL (#559)

--- binding.cc
+++ binding.cc
@@ -1533,7 +1533,9 @@
     opts_binary.insert(48); // ZMQ_CURVE_PUBLICKEY
     opts_binary.insert(49); // ZMQ_CURVE_SECRETKEY
     opts_binary.insert(50); // ZMQ_CURVE_SERVERKEY
+    opts_int.insert(51); //ZMQ_PROBE_ROUTER
     opts_binary.insert(55); // ZMQ_ZAP_DOMAIN
+    opts_int.insert(66); //ZMQ_HANDSHAKE_IVL
     #endif

     NODE_DEFINE_CONSTANT(target, ZMQ_CAN_DISCONNECT);


add register function

add register function

--- binding.cc
+++ binding.cc
@@ -711,6 +711,61 @@
     storj_bridge_delete_file(env, bucket_id_dup, file_id_dup, (void *) callback, DeleteFileCallback);
 }

+void RegisterCallback(uv_work_t *work_req, int status) {
+    Nan::HandleScope scope;
+
+    json_request_t *req = (json_request_t *) work_req->data;
+
+    Nan::Callback *callback = (Nan::Callback*)req->handle;
+
+    v8::Local<v8::Value> error = Nan::Null();
+    v8::Local<Value> result = Nan::Null();
+
+    if (error_and_status_check<json_request_t>(req, &error)) {
+        const char *result_str = json_object_to_json_string(req->response);
+        v8::Local<v8::String> result_json_string = Nan::New(result_str).ToLocalChecked();
+        Nan::JSON NanJSON;
+        Nan::MaybeLocal<v8::Value> res = NanJSON.Parse(result_json_string);
+        if (!res.IsEmpty()) {
+            result = res.ToLocalChecked();
+        }
+    }
+
+    Local<Value> argv[] = {
+        error,
+        result
+    };
+
+    callback->Call(2, argv);
+    free(req);
+    free(work_req);
+}
+
+void Register(const Nan::FunctionCallbackInfo<Value>& args) {
+    if (args.Length() != 3 || !args[2]->IsFunction()) {
+        return Nan::ThrowError("3 arguments expected and the third argument is expected to be a function");
+    }
+    if (args.This()->InternalFieldCount() != 1) {
+        return Nan::ThrowError("Environment not available for instance");
+    }
+    storj_env_t *env = (storj_env_t *)args.This()->GetAlignedPointerFromInternalField(0);
+    if (!env) {
+        return Nan::ThrowError("Environment is not initialized");
+    }
+
+    String::Utf8Value str_email(args[0]);
+    const char *email = *str_email;
+    const char *email_dup = strdup(email);
+
+    String::Utf8Value str_passwd(args[1]);
+    const char *passwd = *str_passwd;
+    const char *passwd_dup = strdup(passwd);
+
+    Nan::Callback *callback = new Nan::Callback(args[2].As<Function>());
+
+    storj_bridge_register(env, email_dup, passwd_dup, (void *) callback, RegisterCallback);
+}
+
 void DestroyEnvironment(const Nan::FunctionCallbackInfo<Value>& args) {
     if (args.This()->InternalFieldCount() != 1) {
         return Nan::ThrowError("Environment not available for instance");
@@ -768,6 +823,7 @@
     Nan::SetPrototypeMethod(constructor, "resolveFileCancel", ResolveFileCancel);
     Nan::SetPrototypeMethod(constructor, "deleteFile", DeleteFile);
     Nan::SetPrototypeMethod(constructor, "destroy", DestroyEnvironment);
+    Nan::SetPrototypeMethod(constructor, "register", Register);

     Nan::MaybeLocal<v8::Object> maybeInstance;
     v8::Local<v8::Object> instance;


reuse struct buffers

reuse struct buffers

--- test_apply3_perclt.cpp
+++ test_apply3_perclt.cpp
@@ -22,11 +22,12 @@

   kernel void test(int totalN,
       global struct Info *out_info,
+      global struct Info *in1_info,
+      global struct Info *in2_info,
       global float*out_data,
-      global struct Info *in1_info,
       global float *in1_data,
-      global struct Info *in2_info,
-      global float *in2_data) {
+      global float *in2_data
+      ) {
     int linearId = get_global_id(0);
     if(linearId < totalN) {
       out_data[linearId] = in1_data[linearId] * in2_data[linearId];
@@ -34,7 +35,7 @@
   }
 )DELIM";

-void test(EasyCL *cl, int its, int size) {
+void test(EasyCL *cl, int its, int size, bool reuseStructBuffers) {
   int totalN = size;
   string templatedSource = kernelSource;
   CLKernel *kernel = cl->buildKernelFromString(templatedSource, "test", "");
@@ -55,9 +56,6 @@
   in2wrap->copyToDevice();
   outwrap->createOnDevice();

-  cl->finish();
-  cl->dumpProfiling();
-
   Info outInfo;
   Info in1Info;
   Info in2Info;
@@ -66,21 +64,43 @@
   outInfo.sizes[0] = in1Info.sizes[0] = in2Info.sizes[0] = 6400;
   outInfo.strides[0] = in1Info.strides[0] = in2Info.strides[0] = 1;

+  float *outInfoFloat = reinterpret_cast<float *>(&outInfo);
+  float *in1InfoFloat = reinterpret_cast<float *>(&in1Info);
+  float *in2InfoFloat = reinterpret_cast<float *>(&in2Info);
+  CLWrapper *outInfoWrap = cl->wrap(64, outInfoFloat);
+  CLWrapper *in1InfoWrap = cl->wrap(64, in1InfoFloat);
+  CLWrapper *in2InfoWrap = cl->wrap(64, in2InfoFloat);
+  outInfoWrap->copyToDevice();
+  in1InfoWrap->copyToDevice();
+  in2InfoWrap->copyToDevice();
+
+  cl->finish();
+  cl->dumpProfiling();
+
   double start = StatefulTimer::instance()->getSystemMilliseconds();
   for(int it = 0; it < its; it++) {
     kernel->in(totalN);
-    kernel->in(1, &outInfo);
+
+    if(reuseStructBuffers) {
+      kernel->in(outInfoWrap);
+      kernel->in(in1InfoWrap);
+      kernel->in(in2InfoWrap);
+    } else {
+      kernel->in(1, &outInfo);
+      kernel->in(1, &in1Info);
+      kernel->in(1, &in2Info);
+    }
+
     kernel->out(outwrap);
-    kernel->in(1, &in1Info);
     kernel->in(in1wrap);
-    kernel->in(1, &in2Info);
     kernel->in(in2wrap);
+
     kernel->run_1d(numWorkgroups * workgroupSize, workgroupSize);
   }
   cl->finish();
   double end = StatefulTimer::instance()->getSystemMilliseconds();
   cl->dumpProfiling();
-  cout << "its=" << its << " size=" << size << "time=" << (end - start) << "ms" << endl;
+  cout << "its=" << its << " size=" << size << " reusestructbuffers=" << reuseStructBuffers << " time=" << (end - start) << "ms" << endl;
   outwrap->copyToHost();
   cl->finish();
   int errorCount = 0;
@@ -117,8 +137,10 @@
   cout << "using gpu " << gpu << endl;
   EasyCL *cl = EasyCL::createForIndexedGpu(gpu);
   cl->setProfiling(true);
-  test(cl, 900, 6400);
-  test(cl, 9000, 6400);
+  test(cl, 900, 6400, false);
+  test(cl, 900, 6400, true);
+  test(cl, 9000, 6400, false);
+  test(cl, 9000, 6400, true);
   cl->dumpProfiling();
   delete cl;
   return 0;


webaccess: improved websocket multi payload parsing

--- webaccess/src/qhttpserver/qhttpconnection.cpp
+++ webaccess/src/qhttpserver/qhttpconnection.cpp
@@ -402,7 +402,7 @@
         return;
     }

-    //qDebug() << "Websocket total data length:" << data.size();
+    qDebug() << "[webSocketRead] total data length:" << data.size();

     while (dataPos < data.size())
     {
@@ -434,33 +434,29 @@
             dataPos+=4;
         }

-        qDebug() << "WebSocket opCode:" << QString("0x%1").arg(opCode, 2, 16, QChar('0'));
+        qDebug() << "[webSocketRead] opCode:" << QString("0x%1").arg(opCode, 2, 16, QChar('0'));

         if (opCode == TextFrame)
         {
             int lengthCounter = dataLen;
-            qDebug() << "Text frame data length:" << dataLen;
-            data.remove(0, dataPos);
+            qDebug() << "[webSocketRead] Text frame length:" << dataLen;
             // if the payload is masked, then unmask
             if (masked == true)
             {
                 int i = 0;
-                char *cData = data.data();
+                char *cData = data.data() + dataPos;
                 while (lengthCounter-- > 0)
                     *cData++ ^= mask[i++ % 4];
             }

-            Q_EMIT webSocketDataReady(this, QString(data.mid(0, dataLen)));
-
-            // move the cursor to the end of the payload, keeping in mind
-            // that I have truncated it before
-            dataPos = dataLen;
+            Q_EMIT webSocketDataReady(this, QString(data.mid(dataPos, dataLen)));
         }
         else if (opCode == ConnectionClose)
         {
-            qDebug() << "Connection closed by the client";
+            qDebug() << "[webSocketRead] Connection closed by the client";
             Q_EMIT webSocketConnectionClose(this);
         }
+        dataPos += dataLen;
     }
 }


Make ZncManager more permissive for PanicBNC

--- src/plugins/znc/zncmanager.cpp
+++ src/plugins/znc/zncmanager.cpp
@@ -95,7 +95,7 @@
     }

     if (message->type() == IrcMessage::Private) {
-        if (message->nick() == QLatin1String("***") && message->ident() == QLatin1String("znc")) {
+        if (message->nick() == QLatin1String("***")) {
             IrcPrivateMessage* privMsg = static_cast<IrcPrivateMessage*>(message);
             QString content = privMsg->content();
             if (content == QLatin1String("Buffer Playback...")) {


Fixed potential bug in memctl port split implementation Second to last bug?

--- src/mem/DRAMSim2.cc
+++ src/mem/DRAMSim2.cc
@@ -114,8 +114,7 @@
                 //std::cout << "case 1" << std::endl;
                 dram->doAtomicAccess(pkt);
                 assert(pkt->isResponse());
-                //TODO possible bug fix required
-                schedTimingResp(pkt, curTick() + 1);
+                schedTimingResp(pkt, curTick() + 1, pkt->threadID);
                 return true;
             }

@@ -210,8 +209,7 @@
                   toSchedule = curTick() + 1;  //not accurate, but I have to
             if (toSchedule >= curTick() + SimClock::Int::ms)
                   toSchedule = curTick() + SimClock::Int::ms - 1; //not accurate
-            //TODO possible bug fix required
-            my_port->schedTimingResp(pkt, toSchedule);
+            my_port->schedTimingResp(pkt, toSchedule, threadID);
         } else {
             my_port->addPendingDelete(pkt);
         }


am 9d93915d: enable runtime changes to gamma tables

Merge commit '9d93915d4705b9f5c85b533012aca9b491b5a4ca' into eclair-plus-aosp

* commit '9d93915d4705b9f5c85b533012aca9b491b5a4ca':
  enable runtime changes to gamma tables

--- src/ports/SkFontHost_gamma.cpp
+++ src/ports/SkFontHost_gamma.cpp
@@ -4,7 +4,7 @@
 // define this to use pre-compiled tables for gamma. This is slightly faster,
 // and doesn't create any RW global memory, but means we cannot change the
 // gamma at runtime.
-#define USE_PREDEFINED_GAMMA_TABLES
+//#define USE_PREDEFINED_GAMMA_TABLES

 #ifndef USE_PREDEFINED_GAMMA_TABLES
     // define this if you want to spew out the "C" code for the tables, given
@@ -14,21 +14,22 @@

 ///////////////////////////////////////////////////////////////////////////////

+#include "SkGraphics.h"
+
+// declared here, so we can link against it elsewhere
+void skia_set_text_gamma(float blackGamma, float whiteGamma);
+
 #ifdef USE_PREDEFINED_GAMMA_TABLES

 #include "sk_predefined_gamma.h"

+void skia_set_text_gamma(float blackGamma, float whiteGamma) {}
+
 #else   // use writable globals for gamma tables
-
-static bool gGammaIsBuilt;
-static uint8_t gBlackGamma[256], gWhiteGamma[256];
-
-#define SK_BLACK_GAMMA     (1.4f)
-#define SK_WHITE_GAMMA     (1/1.4f)

 static void build_power_table(uint8_t table[], float ee)
 {
-    //    printf("------ build_power_table %g\n", ee);
+    SkDebugf("------ build_power_table %g\n", ee);
     for (int i = 0; i < 256; i++)
     {
         float x = i / 255.f;
@@ -39,6 +40,21 @@
         //   printf(" %d\n", xx);
         table[i] = SkToU8(xx);
     }
+}
+
+static bool gGammaIsBuilt;
+static uint8_t gBlackGamma[256], gWhiteGamma[256];
+
+static float gBlackGammaCoeff = 1.4f;
+static float gWhiteGammaCoeff = 1/1.4f;
+
+void skia_set_text_gamma(float blackGamma, float whiteGamma) {
+    gBlackGammaCoeff = blackGamma;
+    gWhiteGammaCoeff = whiteGamma;
+    gGammaIsBuilt = false;
+    SkGraphics::SetFontCacheUsed(0);
+    build_power_table(gBlackGamma, gBlackGammaCoeff);
+    build_power_table(gWhiteGamma, gWhiteGammaCoeff);
 }

 #ifdef DUMP_GAMMA_TABLES
@@ -72,13 +88,13 @@
 #ifndef USE_PREDEFINED_GAMMA_TABLES
     if (!gGammaIsBuilt)
     {
-        build_power_table(gBlackGamma, SK_BLACK_GAMMA);
-        build_power_table(gWhiteGamma, SK_WHITE_GAMMA);
+        build_power_table(gBlackGamma, gBlackGammaCoeff);
+        build_power_table(gWhiteGamma, gWhiteGammaCoeff);
         gGammaIsBuilt = true;

 #ifdef DUMP_GAMMA_TABLES
-        dump_a_table("gBlackGamma", gBlackGamma, SK_BLACK_GAMMA);
-        dump_a_table("gWhiteGamma", gWhiteGamma, SK_WHITE_GAMMA);
+        dump_a_table("gBlackGamma", gBlackGamma, gBlackGammaCoeff);
+        dump_a_table("gWhiteGamma", gWhiteGamma, gWhiteGammaCoeff);
 #endif
     }
 #endif


Fix VS's "helpful" deindent

Fix VS's "helpful" deindent

--- src/protocol/db.inl
+++ src/protocol/db.inl
@@ -15,8 +15,8 @@
  */

 FUS_NET_STRUCT_BEGIN(db_pingRequest)
-FUS_NET_FIELD_UINT32(transId)
-FUS_NET_FIELD_UINT32(pingTime)
+    FUS_NET_FIELD_UINT32(transId)
+    FUS_NET_FIELD_UINT32(pingTime)
 FUS_NET_STRUCT_END(db_pingRequest)

 FUS_NET_STRUCT_BEGIN(db_acctCreateRequest)
@@ -29,8 +29,8 @@
 // =================================================================================

 FUS_NET_STRUCT_BEGIN(db_pingReply)
-FUS_NET_FIELD_UINT32(transId)
-FUS_NET_FIELD_UINT32(pingTime)
+    FUS_NET_FIELD_UINT32(transId)
+    FUS_NET_FIELD_UINT32(pingTime)
 FUS_NET_STRUCT_END(db_pingReply)

 FUS_NET_STRUCT_BEGIN(db_acctCreateReply)


Factorisation of numeric marshals

Factorisation of numeric marshals

--- cassandra_statement.cpp
+++ cassandra_statement.cpp
@@ -273,7 +273,7 @@
     }

     const unsigned char *bytes = reinterpret_cast <const unsigned char *>(binary.c_str());
-    T val = 0;
+    T val = T();
     unsigned char *pval = reinterpret_cast<unsigned char *>(&val) + sizeof(val);
 	size_t siz = binary.size ();
     for (size_t i = 0; i < siz; i++) {
@@ -285,25 +285,9 @@
 /* }}} */

 template <class T>
-std::string pdo_cassandra_marshal_float(pdo_stmt_t *stmt,
+std::string pdo_cassandra_marshal_numeric_str_ret(pdo_stmt_t *stmt,
 										const std::string &binary) {
-	if (sizeof(T) != binary.size()) {
-		// Binary is null
-		if (!binary.size())
-			return "0,0";
-		// TODO change error conversion
-        pdo_cassandra_error(stmt->dbh, PDO_CASSANDRA_INTEGER_CONVERSION_ERROR,
-							"pdo_cassandra_marshal_numeric: Binary stream and receiver size doesn't match", "");
-        return "0.0";
-    }
-	const unsigned char *bytes = reinterpret_cast < const unsigned char *>(binary.c_str());
-    T val = 0;
-    unsigned char *pval = reinterpret_cast<unsigned char *>(&val) + sizeof(val);
-	size_t siz = binary.size ();
-    for (size_t i = 0; i < siz; i++) {
-		--pval;
-		*pval = bytes[i];
-	}
+	T val = pdo_cassandra_marshal_numeric<T>(stmt, binary);
 	std::stringstream ss;
     ss << val;
 	return ss.str();
@@ -410,7 +394,7 @@
                 break;
                 case PDO_CASSANDRA_TYPE_FLOAT:
                 {
-					std::string value = pdo_cassandra_marshal_float<float>(stmt, (*col_it).value);
+					std::string value = pdo_cassandra_marshal_numeric_str_ret<float>(stmt, (*col_it).value);
 					unsigned int size = sizeof(char) * value.size();
 					char *pvalue = (char *)emalloc(size);
 					memcpy(pvalue, value.c_str(), size);
@@ -421,7 +405,7 @@
                 break;
                 case PDO_CASSANDRA_TYPE_DOUBLE:
                 {
-					std::string value = pdo_cassandra_marshal_float<double>(stmt, (*col_it).value);
+					std::string value = pdo_cassandra_marshal_numeric_str_ret<double>(stmt, (*col_it).value);
 					unsigned int size = sizeof(char) * value.size();
 					char *pvalue = (char *)emalloc(size);
 					memcpy(pvalue, value.c_str(), size);


Revert "ensure asset vouts are in order"

This reverts commit 773e326f89818140838b5c6bca5235fdb658c383 [formerly 4c1566a406e04b197a4cdfaede6d6f4cb6a8af8e].

Former-commit-id: 9d4754c4c245389e9cce638fa484968aefa578cc

--- src/primitives/transaction.cpp
+++ src/primitives/transaction.cpp
@@ -353,7 +353,6 @@
             throw std::ios_base::failure("asset empty map");
         }
         const size_t &nVoutSize = vout.size();
-        uint32_t nLastOut = 0;
         for(const auto &it: voutAssets) {
             const uint32_t &nAsset = it.key;
             if(it.values.empty()) {
@@ -364,13 +363,9 @@
                 if(nOut >= nVoutSize) {
                     throw std::ios_base::failure("asset vout out of range");
                 }
-                if(nOut < nLastOut) {
-                    throw std::ios_base::failure("asset vout indexes must be in ascending order");
-                }
                 if(voutAsset.nValue > MAX_ASSET || voutAsset.nValue < 0) {
                     throw std::ios_base::failure("asset vout value out of range");
                 }
-                nLastOut = nOut;
                 // store in vout
                 CAssetCoinInfo& coinInfo = vout[nOut].assetInfo;
                 coinInfo.nAsset = nAsset;


apache module mod_acmacs development

apache module mod_acmacs development

--- cc/apache-mod-acmacs.cc
+++ cc/apache-mod-acmacs.cc
@@ -7,38 +7,57 @@
 #include "apache2/http_core.h"
 #include "apache2/http_protocol.h"
 #include "apache2/http_request.h"
+#include "apache2/http_log.h"
 #include "apache2/util_script.h"

 #include "acmacs-base/read-file.hh"

 // #include "apr_hooks.h"

+extern "C" {
+//    module acmacs_module;
+//AP_DECLARE_MODULE(acmacs);
+}
+
+#define AP_LOG_DEBUG(rec, fmt, ...) ap_log_rerror(APLOG_MARK, APLOG_DEBUG,  0, rec, fmt, ##__VA_ARGS__)
+#define AP_LOG_INFO(rec, fmt, ...)  ap_log_rerror(APLOG_MARK, APLOG_INFO,   0, rec, "[" HR_AUTH "] " fmt, ##__VA_ARGS__)
+#define AP_LOG_WARN(rec, fmt, ...)  ap_log_rerror(APLOG_MARK, APLOG_WARNING,0, rec, "[" HR_AUTH "] " fmt, ##__VA_ARGS__)
+#define AP_LOG_ERR(rec, fmt, ...)   ap_log_rerror(APLOG_MARK, APLOG_ERR,    0, rec, "[" HR_AUTH "] " fmt, ##__VA_ARGS__)
+
 static void register_hooks(apr_pool_t *pool);
 static int acmacs_handler(request_rec *r);

-extern "C" module acmacs_module;
+// extern "C" module acmacs_module;

+extern "C"  {
 module AP_MODULE_DECLARE_DATA acmacs_module = {
     STANDARD20_MODULE_STUFF, nullptr, nullptr, nullptr, nullptr, nullptr, register_hooks
 };
+}

 static void register_hooks(apr_pool_t * /*pool*/) {
     ap_hook_handler(acmacs_handler, nullptr, nullptr, APR_HOOK_LAST);
 }

+static int acmacs_handler_processed = 0;
+
 static int acmacs_handler(request_rec *r) {
     // std::cerr << "acmacs_handler handler " << r->handler << '\n';
     if (!r->handler || r->handler != std::string("acmacs"))
-        return (DECLINED);
+        return DECLINED;

     apr_table_t *GET;
     ap_args_to_table(r, &GET);
     const auto acv = apr_table_get(GET, "acv");
+    if (!acv)
+        return DECLINED;

+    ++acmacs_handler_processed;
+    // AP_LOG_DEBUG(r, "acv: %s processed: %d", acv, acmacs_handler_processed);
     const std::string data = acmacs::file::read(r->filename);

     ap_set_content_type(r, "application/json");
-    ap_rprintf(r, "{N: \"Hello, world! filename:[%s] args:[%s] acv:[%s]\"}\n\n", r->filename, r->args, acv ? acv : "null");
+    ap_rprintf(r, "{N: \"Hello, world! filename:[%s] args:[%s] acv:[%s]\", processed: %d}\n\n", r->filename, r->args, acv ? acv : "null", acmacs_handler_processed);
       // ap_rputs(data.c_str(), r);
     return OK;
 }


Increase ping timeout to 20 minutes.

Increase ping timeout to 20 minutes.

--- src/qmqttclient.cpp
+++ src/qmqttclient.cpp
@@ -131,7 +131,7 @@
     m_clientId(clientId),
     m_pongReceived(false),
     m_pingTimer(),
-    m_pingIntervalMs(10000),
+    m_pingIntervalMs(1200000), // 20 minutes
     m_webSocket(new QWebSocket),
     m_state(QMqttProtocol::State::OFFLINE),
     m_packetParser(new QMqttPacketParser),


Fixed multiple issues with RDPPeer

Fixed multiple issues with RDPPeer

* removed partial display update during activation
* fixed uninitialized read during full display update
* resolved issue where partials would try to fire before surface was initialized

--- src/rdp/RDPPeer.cpp
+++ src/rdp/RDPPeer.cpp
@@ -145,8 +145,6 @@

     VLOG(3) << std::dec << "PEER: client->settings->Desktop{Width,Height}: " << DesktopWidth << " " << DesktopHeight;
     context->peerObj->FullDisplayUpdate(context->peerObj->GetListener()->GetFormat());
-
-    context->peerObj->PartialDisplayUpdate(0, 0, context->peerObj->GetSurfaceWidth(), context->peerObj->GetSurfaceHeight());
     return TRUE;
 }

@@ -173,7 +171,7 @@

 static BOOL peer_synchronize_event(rdpInput *input, uint32_t flags)
 {
-    VLOG(2) << "PEER: Client sent a synchronize event(0x: " << std::hex << flags << ")";
+    VLOG(2) << "PEER: Client sent a synchronize event(0x" << std::hex << flags << ")" << std::dec;
     return TRUE;
 }

@@ -315,6 +313,7 @@
 {
     freerdp_peer_context_free(client);
     freerdp_peer_free(client);
+    LOG(INFO) << "PEER " << this << ": DESTRUCTING ACHTUNG WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING";
 }

 void RDPPeer::RunThread(freerdp_peer *client)
@@ -431,23 +430,23 @@

     switch(r) {
         case PIXEL_FORMAT_r8g8b8a8:
-            VLOG(2) << "PEER: Launching R8G8B8A8 Displaybuffer";
+            VLOG(2) << "PEER: Launching R8G8B8A8 Displaybuffer with dimensions " << buf_width << "x" << buf_height;
             surface = new DisplayBuffer_r8g8b8a8(buf_width, buf_height, shm_buffer_region);
             rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8A8);
             break;
         case PIXEL_FORMAT_r8g8b8:
-            VLOG(2) << "PEER: Launching R8G8B8 Displaybuffer";
+            VLOG(2) << "PEER: Launching R8G8B8 Displaybuffer with dimensions " << buf_width << "x" << buf_height;
             surface = new DisplayBuffer_r8g8b8(buf_width, buf_height, shm_buffer_region);
             // TODO: Ubuntu is a goddamn liar and I don't know what else to do about it.
             rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8);
             break;
         case PIXEL_FORMAT_b8g8r8:
-            VLOG(2) << "PEER: Launching R8G8B8 Displaybuffer to deal with BGR data";
+            VLOG(2) << "PEER: Launching R8G8B8 Displaybuffer to deal with BGR data with dimensions " << buf_width << "x" << buf_height;
             surface = new DisplayBuffer_r8g8b8(buf_width, buf_height, shm_buffer_region);
             rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8);
             break;
         case PIXEL_FORMAT_a8r8g8b8:
-            VLOG(2) << "PEER: Launching A8R8G8B8 Displaybuffer";
+            VLOG(2) << "PEER: Launching A8R8G8B8 Displaybuffer with dimensions " << buf_width << "x" << buf_height;
             surface = new DisplayBuffer_a8r8g8b8(buf_width, buf_height, shm_buffer_region);
             rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8A8);
         default:
@@ -459,6 +458,8 @@
 void RDPPeer::FullDisplayUpdate(pixman_format_code_t f)
 {
     PIXEL_FORMAT r;
+    buf_width = listener->GetWidth();
+    buf_height = listener->GetHeight();

     try {
         r = GetPixelFormatForPixmanFormat(f);
@@ -471,14 +472,14 @@
         return;
     }

+    VLOG(3) << "PEER " << this << ": Attempting to take lock on surface to recreate";
     {
         std::lock_guard<std::mutex> lock(surface_lock);
+        VLOG(3) << "PEER " << this << ": Locked surface to recreate";
         delete surface;
         CreateSurface(r);
     }
-
-    buf_width = listener->GetWidth();
-    buf_height = listener->GetHeight();
+    VLOG(3) << "PEER " << this << ": Recreated display surface object; lock released";

     UpdateRegion(0, 0, buf_width, buf_height, TRUE);
 }
@@ -493,6 +494,10 @@

     if (!context->activated) {
         VLOG(2) << "PEER: Context isn't activated, skipping";
+        return;
+    }
+    if (surface == nullptr || surface->isDestructed()) {
+        VLOG(3) << "PEER: Surface has been destructed, skipping update";
         return;
     }

@@ -527,24 +532,27 @@
         rect.width = w;
         rect.height = h;

+        VLOG(3) << "PEER " << this << ": Attempting to take lock on server surface now for update [(" << (int) x << ", " << (int) y << ") " << (int) w << "x" << (int) h << "];";
         {
             std::lock_guard<std::mutex> lock(surface_lock);
+            VLOG(3) << "PEER " << this << ": Lock on server surface taken for update [(" << (int) x << ", " << (int) y << ") " << (int) w << "x" << (int) h << "];";
             surface->FillDirtyRegion(x, y, w, h, dirty);
-        }
-
-        int scanline = surface->GetScanline(w);
-
-
-        rfx_compose_message(context->rfx_context, s, &rect, 1, dirty, rect.width, rect.height, scanline);
-
-        cmd->bitmapDataLength = Stream_GetPosition(s);
-        cmd->bitmapData = Stream_Buffer(s);
-        cmd->codecID = client->settings->RemoteFxCodecId;
-        cmd->skipCompression = TRUE;
-
-        update->SurfaceBits(update->context, cmd);
+
+            int scanline = surface->GetScanline(w);
+
+            rfx_compose_message(context->rfx_context, s, &rect, 1, dirty, rect.width, rect.height, scanline);
+
+            cmd->bitmapDataLength = Stream_GetPosition(s);
+            cmd->bitmapData = Stream_Buffer(s);
+            cmd->codecID = client->settings->RemoteFxCodecId;
+            cmd->skipCompression = TRUE;
+
+            update->SurfaceBits(update->context, cmd);
+        }
+        VLOG(3) << "PEER " << this << ": Server surface lock released for update [(" << (int) x << ", " << (int) y << ") " << (int) w << "x" << (int) h << "];";
     }

     end_frame(client);
     free(dirty);
-}
+    dirty = NULL;
+}


Clarify comment

Clarify comment

--- src/realm/table.cpp
+++ src/realm/table.cpp
@@ -2364,14 +2364,20 @@
     }

     // Copy linklist contents from row_ndx to new_row_ndx. row_ndx and
-    // new_row_ndx represent the loser and winner of a PK merge conflict, and
-    // the winner should end up with all the links. If the rule that list
-    // modifications may not be carried out before setting the primary key is
-    // followed, only the winner or the loser will have any list elements at the
-    // time of applying this instruction, but never both. This makes it safe for
-    // the merge algorithm to redirect linklist instructions, because it can
-    // make do with simply redirecting `SetLinkList` instructions, without
-    // having to resynthesize the whole instruction sequence on both sides.
+    // new_row_ndx represent the loser and winner of a PK merge conflict
+    // (respectively), and the winner should end up with all the links.
+    //
+    // A precondition for this logic is that linklist modifications always come
+    // strictly after the primary key has been set, and that the primary key
+    // never changes. This ensures that we never have to merge linklists outside
+    // of operational transform, which we cannot do because we don't have enough
+    // information in Core to perform such a merge.
+    //
+    // Instead, by relying on this invariant it follows that at the point when
+    // a primary key merge conflict is resolved, all linklists of either the
+    // winning or the losing row are empty. This means we can "merge" the rows
+    // by simply moving all elements to the winning row, and rely on OT to
+    // redirect any subsequent linklist operations to the winner.
     for (size_t col_ndx = 0; col_ndx < backlink_col_start; ++col_ndx) {
         if (m_spec.get_column_type(col_ndx) == col_type_LinkList) {
             auto& col = get_column_link_list(col_ndx);


Fix -Wmaybe-uninitialized.

Fix -Wmaybe-uninitialized.

In this case the warning is wrong, but I don't mind spending what, an extra
cycle when Adaboost starts?, to avoid the warning.

--- src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -73,7 +73,7 @@

   // crt is the cumulative rt value for terminating the optimization when rt is
   // changing by less than the tolerance.
-  double rt, crt, alphat = 0.0, zt;
+  double rt, crt = 0.0, alphat = 0.0, zt;

   ztProduct = 1.0;


Fix order_by on empty sequences.

Fix order_by on empty sequences.

--- src/rdb_protocol/terms/sort.cc
+++ src/rdb_protocol/terms/sort.cc
@@ -135,8 +135,11 @@
             seq = v0->as_seq(env->env);
         }

+        if (seq.has() && seq->is_exhausted()){
+            /* Do nothing for empty sequence */
+
         /* Add a sorting to the table if we're doing indexed sorting. */
-        if (counted_t<val_t> index = optarg(env, "index")) {
+        }else if (counted_t<val_t> index = optarg(env, "index")) {
             rcheck(tbl.has(), base_exc_t::GENERIC,
                    "Indexed order_by can only be performed on a TABLE.");
             rcheck(!seq.has(), base_exc_t::GENERIC,


Use Qt to load init.lua

Use Qt to load init.lua

--- demo/Bootstrapper.cpp
+++ demo/Bootstrapper.cpp
@@ -15,7 +15,8 @@
     _rainback(_lua)
 {
     _rainback.setWidget(&_desktop);
-    lua::load_file(_lua, "../../demo/init.lua");
+    QFile file("../../demo/init.lua");
+    _lua(file);
 }

 QWidget& Bootstrapper::mainWidget()


remove unused

remove unused

--- src/Band/apply.hpp
+++ src/Band/apply.hpp
@@ -165,8 +165,6 @@
     matrix<double_complex> alm(kp__->num_gkvec_loc(), unit_cell_.max_mt_aw_basis_size());
     matrix<double_complex> oalm(kp__->num_gkvec_loc(), unit_cell_.max_mt_aw_basis_size());
     matrix<double_complex> tmp(unit_cell_.max_mt_aw_basis_size(), n__);
-
-    //mdarray<double_complex, 1> v(n__);

     #ifdef __GPU
     if (ctx_.processing_unit() == GPU) {


Review fix. Added runtime sanity check for column type values

--- src/realm/table.cpp
+++ src/realm/table.cpp
@@ -1360,44 +1360,45 @@
 void Table::upgrade_file_format()
 {
     for (size_t col_ndx = 0; col_ndx < get_column_count(); col_ndx++) {
-        if (has_search_index(col_ndx)) {
-            ColumnType col_type = get_real_column_type(col_ndx);
-            switch (col_type) {
-                case col_type_String: {
-                    StringColumn& col = get_column_string(col_ndx);
-                    col.get_search_index()->clear();
-                    col.populate_search_index();
-                    break;
-                }
-                case col_type_Bool:
-                case col_type_Int:
-                case col_type_DateTime: {
-                    IntegerColumn& col = get_column(col_ndx);
-                    col.get_search_index()->clear();
-                    col.populate_search_index();
-                    break;
-                }
-                case col_type_StringEnum: {
-                    StringEnumColumn& col = get_column_string_enum(col_ndx);
-                    col.get_search_index()->clear();
-                    col.populate_search_index();
-                    break;
-                }
-                case col_type_Binary:
-                case col_type_Table:
-                case col_type_Mixed:
-                case col_type_Reserved1:
-                case col_type_Float:
-                case col_type_Double:
-                case col_type_Reserved4:
-                case col_type_Link:
-                case col_type_LinkList:
-                case col_type_BackLink:
-                    // Indices are not support on these column types
-                    REALM_ASSERT(false);
+        if (!has_search_index(col_ndx)) {
+            continue;
+        }
+        ColumnType col_type = get_real_column_type(col_ndx);
+        switch (col_type) {
+            case col_type_String: {
+                StringColumn& col = get_column_string(col_ndx);
+                col.get_search_index()->clear();
+                col.populate_search_index();
+                continue;
             }
-
-        }
+            case col_type_Bool:
+            case col_type_Int:
+            case col_type_DateTime: {
+                IntegerColumn& col = get_column(col_ndx);
+                col.get_search_index()->clear();
+                col.populate_search_index();
+                continue;
+            }
+            case col_type_StringEnum: {
+                StringEnumColumn& col = get_column_string_enum(col_ndx);
+                col.get_search_index()->clear();
+                col.populate_search_index();
+                continue;
+            }
+            case col_type_Binary:
+            case col_type_Table:
+            case col_type_Mixed:
+            case col_type_Reserved1:
+            case col_type_Float:
+            case col_type_Double:
+            case col_type_Reserved4:
+            case col_type_Link:
+            case col_type_LinkList:
+            case col_type_BackLink:
+                // Indices are not support on these column types
+                break;
+        }
+        REALM_ASSERT(false);
     }
 }


Remove the unused `m_table_linked_from` member from `Columns`.

--- src/realm/query_expression.hpp
+++ src/realm/query_expression.hpp
@@ -1321,8 +1321,7 @@
 template <> class Columns<StringData> : public Subexpr2<StringData>
 {
 public:
-    Columns(size_t column, const Table* table, std::vector<size_t> links) : m_table_linked_from(nullptr),
-                                                                            m_table(nullptr),
+    Columns(size_t column, const Table* table, std::vector<size_t> links) : m_table(nullptr),
                                                                             m_column(column)
     {
         m_link_map.init(const_cast<Table*>(table), links);
@@ -1330,15 +1329,15 @@
         REALM_ASSERT_3(m_link_map.m_table->get_column_type(column), ==, type_String);
     }

-    Columns(size_t column, const Table* table) : m_table_linked_from(nullptr), m_table(nullptr), m_column(column)
+    Columns(size_t column, const Table* table) : m_table(nullptr), m_column(column)
     {
         m_table = table;
     }

-    explicit Columns() : m_table_linked_from(nullptr), m_table(nullptr) { }
-
-
-    explicit Columns(size_t column) : m_table_linked_from(nullptr), m_table(nullptr), m_column(column)
+    explicit Columns() : m_table(nullptr) { }
+
+
+    explicit Columns(size_t column) : m_table(nullptr), m_column(column)
     {
     }

@@ -1424,8 +1423,6 @@
     {
         return string_compare<Contains, ContainsIns>(*this, col, case_sensitive);
     }
-
-    const Table* m_table_linked_from;

     // Pointer to payload table (which is the linked-to table if this is a link column) used for condition operator
     const Table* m_table;
@@ -1628,27 +1625,22 @@
     using ColType = typename ColumnTypeTraits<T, false>::column_type;
     using ColTypeN = typename ColumnTypeTraits<T, true>::column_type;

-    Columns(size_t column, const Table* table, std::vector<size_t> links) : m_table_linked_from(nullptr),
-                                                                            m_table(nullptr), m_sg(nullptr),
-                                                                            m_column(column)
+    Columns(size_t column, const Table* table, std::vector<size_t> links)
+        : m_table(table), m_sg(nullptr), m_column(column)
     {
         m_link_map.init(const_cast<Table*>(table), links);
-        m_table = table;
         m_nullable = m_link_map.m_table->is_nullable(m_column);
     }

-    Columns(size_t column, const Table* table) : m_table_linked_from(nullptr), m_table(nullptr), m_sg(nullptr),
-                                                 m_column(column)
-    {
-        m_table = table;
-        m_nullable = m_table->is_nullable(column);
-    }
-
-
-    Columns() : m_table_linked_from(nullptr), m_table(nullptr), m_sg(nullptr) { }
-
-    explicit Columns(size_t column) : m_table_linked_from(nullptr), m_table(nullptr), m_sg(nullptr),
-                                      m_column(column) {}
+    Columns(size_t column, const Table* table)
+        : m_table(table), m_sg(nullptr), m_column(column), m_nullable(m_table->is_nullable(m_column))
+    {
+    }
+
+
+    Columns() : m_table(nullptr), m_sg(nullptr) { }
+
+    explicit Columns(size_t column) : m_table(nullptr), m_sg(nullptr), m_column(column) { }

     ~Columns()
     {
@@ -1779,8 +1771,6 @@
         }
     }

-    const Table* m_table_linked_from;
-
     // m_table is redundant with ColumnAccessorBase<>::m_table, but is in order to decrease class
     // dependency/entanglement
     const Table* m_table;


Fixed most of client slowdowns caused by sending too many block changes (bad condition in FastSetBlock)

git-svn-id: ffe80d23790c2318db4f9b6ad70c6163efa9c8e4@1431 0a769ca7-a7f5-676a-18bf-c427514a06d6

--- source/Chunk.cpp
+++ source/Chunk.cpp
@@ -1419,7 +1419,7 @@

 	// The client doesn't need to distinguish between stationary and nonstationary fluids:
 	if (
-		(OldBlockMeta == a_BlockMeta) ||  // Different meta always gets sent to the client
+		(OldBlockMeta != a_BlockMeta) ||  // Different meta always gets sent to the client
 		!(
 			((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) ||             // Replacing stationary water with water
 			((OldBlockType == E_BLOCK_WATER)            && (a_BlockType == E_BLOCK_STATIONARY_WATER)) ||  // Replacing water with stationary water


Prevend possible crashes

Prevend possible crashes

svn path=/trunk/kdepim/; revision=341197

--- kaddressbook/kabcore.cpp
+++ kaddressbook/kabcore.cpp
@@ -910,6 +910,7 @@
   mJumpButtonBar->updateButtons();
   mSearchManager->reload();
   mViewManager->setSelected( QString::null, false );
+  setContactSelected( QString::null );
 }

 AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
@@ -927,9 +928,9 @@

 void KABCore::slotEditorDestroyed( const QString &uid )
 {
-  mEditorDict.remove( uid );
-
-  KABC::Addressee addr = mAddressBook->findByUid( uid );
+  AddresseeEditorDialog *dialog = mEditorDict.take( uid );
+
+  KABC::Addressee addr = dialog->addressee();

   if ( !addr.resource()->readOnly() ) {
     QApplication::setOverrideCursor( Qt::waitCursor );


i18n fix: remove word puzzle.

i18n fix: remove word puzzle.

svn path=/trunk/KDE/kdelibs/phonon/; revision=808904

--- kcm/devicepreference.cpp
+++ kcm/devicepreference.cpp
@@ -296,18 +296,23 @@
     if (currentItem && currentItem->type() == 1001) {
         CategoryItem *catItem = static_cast<CategoryItem *>(currentItem);
         const Phonon::Category cat = catItem->category();
-        QString deviceString;
         if (catItem->isOutputItem) {
             deviceList->setModel(m_outputModel[cat]);
-            deviceString = i18n("Output Device");
         } else {
             deviceList->setModel(m_captureModel[cat]);
-            deviceString = i18n("Capture Device");
         }
         if (cat == Phonon::NoCategory) {
-            m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default %1 Preference:", deviceString), Qt::DisplayRole);
+            if (catItem->isOutputItem) {
+                m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default Output Device Preference:"), Qt::DisplayRole);
+            } else {
+                m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default Capture Device Preference:"), Qt::DisplayRole);
+            }
         } else {
-            m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("%1 Preference for the '%2' Category:", deviceString, Phonon::categoryToString(cat)), Qt::DisplayRole);
+            if (catItem->isOutputItem) {
+                m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Output Device Preference for the '%1' Category:", Phonon::categoryToString(cat)), Qt::DisplayRole);
+            } else {
+                m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Capture Device Preference for the '%1' Category:", Phonon::categoryToString(cat)), Qt::DisplayRole);
+            }
         }
     } else {
         m_headerModel.setHeaderData(0, Qt::Horizontal, QString(), Qt::DisplayRole);


Converting bmvm to lambda.

Converting bmvm to lambda.

--- mu/llvmc/generator.cpp
+++ mu/llvmc/generator.cpp
@@ -381,24 +381,20 @@
                 auto selector (llvm::ExtractValueInst::Create (real_call, llvm::ArrayRef <unsigned> (function_result->getNumElements () - 1)));
                 new_last->getInstList ().push_back (selector);
                 auto selector_type (llvm::Type::getInt8Ty (context));
-                {
-                    auto current_result (call->source->target->results.begin ());
-                    auto end_result (call->source->target->results.end ());
-                    auto current_offset (call->source->target->branch_ends.begin ());
-                    auto end_offset (call->source->target->branch_ends.end ());
-                    auto current_element (call->source->elements.begin ());
-                    auto end_element (call->source->elements.end ());
-                    size_t current_selector (0);
-                    size_t position (0);
-                    unsigned result_index (0);
-                    auto compare (new llvm::ICmpInst (llvm::CmpInst::Predicate::ICMP_EQ, selector, llvm::ConstantInt::get (selector_type, current_selector)));
-                    new_last->getInstList ().push_back (compare);
-                    auto instruction (llvm::BinaryOperator::CreateAnd (predicate, compare));
-                    new_last->getInstList ().push_back (instruction);
-                    for (; current_result != end_result; ++current_result, ++position)
+                auto current_element (call->source->elements.begin ());
+                auto end_element (call->source->elements.end ());
+                size_t current_selector (0);
+                unsigned result_index (0);
+                auto compare (new llvm::ICmpInst (llvm::CmpInst::Predicate::ICMP_EQ, selector, llvm::ConstantInt::get (selector_type, current_selector)));
+                new_last->getInstList ().push_back (compare);
+                auto instruction (llvm::BinaryOperator::CreateAnd (predicate, compare));
+                new_last->getInstList ().push_back (instruction);
+                call->source->target->for_each_results (
+                    [&]
+                    (mu::llvmc::skeleton::result * result_a, size_t)
                     {
                         assert (current_element != end_element);
-                        if (!(*current_result)->type->is_unit_type ())
+                        if (!result_a->type->is_unit_type ())
                         {
                             auto extraction (llvm::ExtractValueInst::Create (real_call, llvm::ArrayRef <unsigned> (result_index)));
                             new_last->getInstList().push_back (extraction);
@@ -410,18 +406,19 @@
                         {
                             already_generated [*current_element] = mu::llvmc::value_data ({instruction, nullptr});
                         }
-                        if (position + 1 == *current_offset)
-                        {
-                            ++current_selector;
-                            compare = new llvm::ICmpInst (llvm::CmpInst::Predicate::ICMP_EQ, selector, llvm::ConstantInt::get (selector_type, current_selector));
-                            new_last->getInstList ().push_back (compare);
-                            instruction = llvm::BinaryOperator::CreateAnd (predicate, compare);
-                            new_last->getInstList ().push_back (instruction);
-                            ++current_offset;
-                        }
-                    }
-                    assert (current_element == end_element);
-                }
+                    },
+                    mu::llvmc::skeleton::function::empty_node,
+                    mu::llvmc::skeleton::function::empty_node,
+                    [&]
+                    (mu::llvmc::skeleton::result * result_a, size_t)
+                    {
+                        ++current_selector;
+                        compare = new llvm::ICmpInst (llvm::CmpInst::Predicate::ICMP_EQ, selector, llvm::ConstantInt::get (selector_type, current_selector));
+                        new_last->getInstList ().push_back (compare);
+                        instruction = llvm::BinaryOperator::CreateAnd (predicate, compare);
+                        new_last->getInstList ().push_back (instruction);
+                    });
+                assert (current_element == end_element);
                 break;
             }
             default:


Mark 64-bit constants as ULL to fix broken 32-bit Mac 10.6 build
TBR=bungeman
Review URL: https://codereview.appspot.com/6867079

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@6704 2bbb7eff-a529-9590-31e7-b0007b416f81

--- tests/ChecksumTest.cpp
+++ tests/ChecksumTest.cpp
@@ -125,13 +125,13 @@
             REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xd4de9dc9);
             REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0xecf0325d);
             fWhichAlgorithm = kSkCityHash64;
-            REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0x9ae16a3b2f90404f);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(4)   == 0x82bffd898958e540);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(8)   == 0xad5a13e1e8e93b98);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x10b153630af1f395);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x7db71dc4adcc6647);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xeee763519b91b010);
-            REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0x2fe19e0b2239bc23);
+            REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0x9ae16a3b2f90404fULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(4)   == 0x82bffd898958e540ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(8)   == 0xad5a13e1e8e93b98ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x10b153630af1f395ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x7db71dc4adcc6647ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xeee763519b91b010ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0x2fe19e0b2239bc23ULL);

             // TODO: note the weakness exposed by these collisions...
             // We need to improve the SkChecksum algorithm.


Faster mipmap smoothing

Faster mipmap smoothing

--- src/renderer_gl.cpp
+++ src/renderer_gl.cpp
@@ -1056,7 +1056,7 @@
 			{
 				if (tex->smoothLodMin > tex->lodMin)
 					tex->smoothLodMin = std::max((float)tex->lodMin,
-						tex->smoothLodMin - 0.1f*ceil(tex->smoothLodMin - tex->lodMin));
+						tex->smoothLodMin - 0.5f*ceil(tex->smoothLodMin - tex->lodMin));
 				glSamplerParameterf(tex->sampler, GL_TEXTURE_MIN_LOD, tex->smoothLodMin);
 			}
 		}


Check glGetString for glErrors.

Check glGetString for glErrors.

--- src/renderer_gl.cpp
+++ src/renderer_gl.cpp
@@ -2101,7 +2101,7 @@
 		if (0 < numCmpFormats)
 		{
 			GLint* formats = (GLint*)alloca(sizeof(GLint)*numCmpFormats);
-			glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
+			GL_CHECK(glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats) );

 			for (GLint ii = 0; ii < numCmpFormats; ++ii)
 			{
@@ -2123,6 +2123,7 @@
 		GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1);

 		const char* version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
+		GL_CHECK(version = version); // check if error is generated by glGetString.
 		BX_TRACE("GLSL version: %s", version);
 #endif // BGFX_CONFIG_DEBUG


Cimg: UnitTest: Windows compile fix

Cimg: UnitTest: Windows compile fix

--- modules/cimg/tests/unittests/savetobuffer-test.cpp
+++ modules/cimg/tests/unittests/savetobuffer-test.cpp
@@ -82,9 +82,9 @@
             throw Exception("could not create temporary file name");
         }

-        filename.assign(tempFile.begin(),
+        filename_.assign(tempFile.begin(),
                         tempFile.begin() + std::min<size_t>(wcslen(tempFile.data()), MAX_PATH));
-        filename += suffix;
+        filename_ += suffix;

         handle_ = fopen(filename_.c_str(), "w");
         if (!handle_) {


pass correct size to read(buffer, ...) tests

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@1398 2bbb7eff-a529-9590-31e7-b0007b416f81

--- tests/Reader32Test.cpp
+++ tests/Reader32Test.cpp
@@ -65,8 +65,8 @@
     assert_eof(reporter, reader);
     reader.rewind();
     assert_start(reporter, reader);
-    reader.read(buffer, sizeof(buffer));
-    REPORTER_ASSERT(reporter, !memcmp(data, buffer, sizeof(buffer)));
+    reader.read(buffer, sizeof(data));
+    REPORTER_ASSERT(reporter, !memcmp(data, buffer, sizeof(data)));

     reader.setMemory(data2, sizeof(data2));
     for (i = 0; i < SK_ARRAY_COUNT(data2); ++i) {
@@ -79,8 +79,8 @@
     assert_eof(reporter, reader);
     reader.rewind();
     assert_start(reporter, reader);
-    reader.read(buffer, sizeof(buffer));
-    REPORTER_ASSERT(reporter, !memcmp(data2, buffer, sizeof(buffer)));
+    reader.read(buffer, sizeof(data2));
+    REPORTER_ASSERT(reporter, !memcmp(data2, buffer, sizeof(data2)));

     reader.setMemory(NULL, 0);
     assert_empty(reporter, reader);


Remove unused header

Remove unused header

--- src/LoadBalancerS2.cpp
+++ src/LoadBalancerS2.cpp
@@ -35,7 +35,6 @@
 #include <imath.hpp>
 #include <int128_t.hpp>
 #include <min.hpp>
-#include <print.hpp>

 #include <stdint.h>


Recenter list of menu options

Recenter list of menu options

--- src/Menu/MenuStyle.cpp
+++ src/Menu/MenuStyle.cpp
@@ -16,12 +16,12 @@

 	title = new Window(main, Globals::title_height + 2, -1, 1, 1);

-	int hh = main->getH() - title->getH() - 2;
-	int ww = main->getW() / 3;
+	int h = main->getH() - title->getH() - 2;
+	int w = main->getW() / 3;
 	int y = title->getH() + 1;
-	int x = main->getW() / 3 - 2;
+	int x = main->getW()/2 - w/2;

-	menu = new Window(main, hh, ww, y, x);
+	menu = new Window(main, h, w, y, x);

 	// windows should be pushed from the background to the foreground
 	// otherwise expect the unexpected


Changed simulator commands

Changed simulator commands

--- src/MoCapSimulator.cpp
+++ src/MoCapSimulator.cpp
@@ -283,16 +283,16 @@
 	std::string strCmdLowerCase;
 	std::transform(strCommand.begin(), strCommand.end(), std::back_inserter(strCmdLowerCase), ::tolower);

-	if (strCmdLowerCase == "lossy" )
+	if (strCmdLowerCase == "enabletrackingloss" )
 	{
 		trackingUnreliable = true;
-		LOG_INFO("Tracking unreliable/lossy");
+		LOG_INFO("Tracking loss enabled");
 		processed = true;
 	}
-	else if (strCmdLowerCase == "lossless")
+	else if (strCmdLowerCase == "disabletrackingloss")
 	{
 		trackingUnreliable = false;
-		LOG_INFO("Tracking reliable/lossless");
+		LOG_INFO("Tracking loss disabled");
 		processed = true;
 	}


Fixed a quick thing.

Fixed a quick thing.

--- kernel/kernel/kernel.cpp
+++ kernel/kernel/kernel.cpp
@@ -108,7 +108,7 @@
 	printf ("First file name: %s\n", et->name);*/

 #if _GRAPHICS == 1
-	Desktop *desktop = new Desktop (new VGAContext (3, "vga"));
+	Desktop *desktop = new Desktop (new VGAContext ("vga"));
 	desktop->CreateWindow (10, 10, 80, 50);
 	desktop->CreateWindow (100, 50, 50, 60);
 	desktop->CreateWindow (200, 100, 50, 50);


fixed fromNDC

fixed fromNDC

git-svn-id: 8421b90a9a43b47d1a188336984f00166a5c4842@795 366fa382-4619-0410-88af-c27c993b82fa

--- src/ri/renderer.cpp
+++ src/ri/renderer.cpp
@@ -716,10 +716,10 @@
 	fromNDC[element(1,2)]		=	0;
 	fromNDC[element(1,3)]		=	screenTop;

-	fromNDC[element(1,0)]		=	0;
-	fromNDC[element(1,1)]		=	0;
-	fromNDC[element(1,2)]		=	0;
-	fromNDC[element(1,3)]		=	imagePlane;
+	fromNDC[element(2,0)]		=	0;
+	fromNDC[element(2,1)]		=	0;
+	fromNDC[element(2,2)]		=	0;
+	fromNDC[element(2,3)]		=	imagePlane;

 	fromNDC[element(3,0)]		=	0;
 	fromNDC[element(3,1)]		=	0;


add frequency filter of vocabulary.

add frequency filter of vocabulary.

--- example/encdec/encdec.cc
+++ example/encdec/encdec.cc
@@ -20,7 +20,9 @@
 #include <algorithm>
 #include <fstream>
 #include <iostream>
+#include <queue>
 #include <random>
+#include <sstream>
 #include <string>
 #include <utility>
 #include <vector>
@@ -43,25 +45,39 @@
 static const float DROPOUT_RATE = 0.5;

 // Gathers the set of words from space-separated corpus.
-unordered_map<string, unsigned> make_vocab(const string &filename) {
+unordered_map<string, unsigned> make_vocab(
+    const string &filename, unsigned size) {
+  if (size < 3) {
+    cerr << "vocab size should be equal-to or grater-than 3." << endl;
+    exit(1);
+  }
   ifstream ifs(filename);
   if (!ifs.is_open()) {
     cerr << "File could not be opened: " << filename << endl;
     exit(1);
   }
-  unordered_map<string, unsigned> vocab;
-  vocab.emplace(make_pair("<unk>", 0));
+  unordered_map<string, unsigned> freq;
   string line, word;
   while (getline(ifs, line)) {
-    line = "<s> " + line + " <s>";
     stringstream ss(line);
-    while (getline(ss, word, ' ')) {
-      if (vocab.find(word) == vocab.end()) {
-        const unsigned id = vocab.size();
-        vocab.emplace(make_pair(word, id));
-      }
-    }
-  }
+    while (getline(ss, word, ' ')) ++freq[word];
+  }
+  using freq_t = pair<string, unsigned>;
+  auto cmp = [](const freq_t &a, const freq_t &b) {
+    return a.second < b.second;
+  };
+  priority_queue<freq_t, vector<freq_t>, decltype(cmp)> q(cmp);
+  for (const auto &x : freq) q.push(x);
+
+  unordered_map<string, unsigned> vocab;
+  vocab.insert(make_pair("<unk>", 0));
+  vocab.insert(make_pair("<bos>", 1));
+  vocab.insert(make_pair("<eos>", 2));
+  for (unsigned i = 3; i < size; ++i) {
+    vocab.insert(make_pair(q.top().first, i));
+    q.pop();
+  }
+
   return vocab;
 }

@@ -76,7 +92,7 @@
   vector<vector<unsigned>> corpus;
   string line, word;
   while (getline(ifs, line)) {
-    line = "<s> " + line + " <s>";
+    line = "<bos> " + line + " <eos>";
     stringstream ss (line);
     vector<unsigned> sentence;
     while (getline(ss, word, ' ')) {
@@ -92,7 +108,7 @@
 // Counts output labels in the corpus.
 unsigned count_labels(const vector<vector<unsigned>> &corpus) {
   unsigned ret = 0;
-  for (const auto &sent :corpus) ret += sent.size() - 1;
+  for (const auto &sent :corpus) ret += sent.size() - 1;  // w/o <bos>
   return ret;
 }

@@ -193,10 +209,10 @@
   // Forward function for training encoder-decoder. Both source and target data
   // should be arranged as:
   // src_tokens, trg_tokens = {
-  //   {sent1_word1, sent2_word1, ..., sentN_word1},  // 1st token (<s>)
+  //   {sent1_word1, sent2_word1, ..., sentN_word1},  // 1st token (<bos>)
   //   {sent1_word2, sent2_word2, ..., sentN_word2},  // 2nd token (first word)
   //   ...,
-  //   {sent1_wordM, sent2_wordM, ..., sentN_wordM},  // last token (<s>)
+  //   {sent1_wordM, sent2_wordM, ..., sentN_wordM},  // last token (<eos>)
   // };
   Node forward_loss(
       const vector<vector<unsigned>> &src_tokens,
@@ -207,9 +223,9 @@
     Node why = F::input(pwhy_);
     Node by = F::input(pby_);

-    // Reversed encoding (w/o first <s>)
+    // Reversed encoding
     src_lstm_.init();
-    for (unsigned i = src_tokens.size(); i > 1; --i) {
+    for (unsigned i = src_tokens.size(); i > 0; --i) {
       Node x = F::pick(src_lookup, 1, src_tokens[i - 1]);
       x = F::dropout(x, DROPOUT_RATE, train);
       src_lstm_.forward(x);
@@ -239,12 +255,12 @@

 int main() {
   // Loads vocab.
-  const auto src_vocab = ::make_vocab("data/train.en");
-  const auto trg_vocab = ::make_vocab("data/train.ja");
+  const auto src_vocab = ::make_vocab("data/train.en", 4000);
+  const auto trg_vocab = ::make_vocab("data/train.ja", 5000);
   cout << "#src_vocab: " << src_vocab.size() << endl;
   cout << "#trg_vocab: " << trg_vocab.size() << endl;
-  const unsigned src_eos_id = src_vocab.at("<s>");
-  const unsigned trg_eos_id = trg_vocab.at("<s>");
+  const unsigned src_eos_id = src_vocab.at("<eos>");
+  const unsigned trg_eos_id = trg_vocab.at("<eos>");

   // Loads all corpus.
   const auto train_src_corpus = ::load_corpus("data/train.en", src_vocab);


added maxsolidangle for pt based lookup

added maxsolidangle for pt based lookup

--- src/ri/shaderPl.cpp
+++ src/ri/shaderPl.cpp
@@ -543,6 +543,8 @@
 		add(name,opIndex,step,data,offsetof(CShadingScratch,occlusionParams.pointHierarchyName));
 	} else if (strcmp(name,"maxpixeldist") == 0) {
 		add(name,opIndex,step,data,offsetof(CShadingScratch,occlusionParams.maxPixelDist));
+	} else if (strcmp(name,"maxsolidangle") == 0) {
+		add(name,opIndex,step,data,offsetof(CShadingScratch,occlusionParams.maxSolidAngle));
 	} else if (strcmp(name,"environmentcolor") == 0) {
 		add(name,opIndex,step,data,offsetof(CShadingScratch,occlusionParams.environmentColor));
 	} else if (strcmp(name,"maxBrightness") == 0) {
@@ -909,4 +911,4 @@
 	scratch->traceParams.sampleBase		=	1;
 	scratch->traceParams.maxDist		=	C_INFINITY;
 	scratch->traceParams.label			=	rayLabelGather;
-}+}


FontRendering: Use util to create texture

--- modules/fontrendering/processors/textoverlaygl.cpp
+++ modules/fontrendering/processors/textoverlaygl.cpp
@@ -203,16 +203,7 @@
 void TextOverlayGL::updateCache() {
     textRenderer_.setFontSize(fontSize_.getSelectedValue());
     std::string str(getString());
-
-    size2_t labelSize(textRenderer_.computeTextSize(str));
-    if (!cacheTexture_ ||
-        (cacheTexture_->getDimensions() != labelSize)) {
-        auto texture = std::make_shared<Texture2D>(labelSize, GL_RGBA, GL_RGBA,
-                                                   GL_UNSIGNED_BYTE, GL_LINEAR);
-        texture->initialize(nullptr);
-        cacheTexture_ = texture;
-    }
-    textRenderer_.renderToTexture(cacheTexture_, str, color_.get());
+    cacheTexture_ = util::createTextTexture(textRenderer_ , str , fontSize_.getSelectedValue() , color_.get() , cacheTexture_ );
 }

 }  // namespace