Update in RESERVE operations.

Update in RESERVE operations.

--- src/cli/batch.cpp
+++ src/cli/batch.cpp
@@ -174,7 +174,7 @@
     add(&Flags::framework_capabilities,
         "framework_capabilities",
         "Comma separated list of optional framework capabilities to enable.\n"
-        "(the only valid value is currently 'GPU_RESOURCES')");
+        "(e.g. 'SHARED_RESOURCES' or 'GPU_RESOURCES')");

     add(&Flags::role,
         "role",
@@ -348,28 +348,31 @@
         }
         if(!persistentVolumeReserved &&
              !persistentVolumeCreated){
-                cout << "Requested reserved resources: " <<
-                persistentVolumeResource->resources() << endl;
-                Call call;
-                call.set_type(Call::ACCEPT);
-
-                CHECK(frameworkInfo.has_id());
-
-                call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
-                Call::Accept* accept = call.mutable_accept();
-                accept->add_offer_ids()->CopyFrom(offer.id());
-
-                Offer::Operation* operation = accept->add_operations();
-                operation->set_type(Offer::Operation::RESERVE);
-
-                operation->mutable_reserve()
-                ->mutable_resources()
-                ->CopyFrom(Resources(persistentVolumeResource->resources()));
-
-                mesos->send(call);
-                persistentVolumeReserved = true;
-                cout << "Volume reserved using " <<
-                persistentVolumeResource->resources() << endl;
+          cout << "Requested reserved resources: " <<
+          persistentVolumeResource->resources() << endl;
+          Call call;
+          call.set_type(Call::ACCEPT);
+
+		  CHECK(!reserved.contains(Resources(persistentVolumeResource
+          ->resources())));
+          CHECK(frameworkInfo.has_id());
+
+          call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
+          Call::Accept* accept = call.mutable_accept();
+          accept->add_offer_ids()->CopyFrom(offer.id());
+
+          Offer::Operation* operation = accept->add_operations();
+          operation->set_type(Offer::Operation::RESERVE);
+
+          operation->mutable_reserve()
+            ->mutable_resources()
+            ->CopyFrom(Resources(persistentVolumeResource->resources()));
+
+          mesos->send(call);
+		  sleep(5);
+          persistentVolumeReserved = true;
+          cout << "Volume reserved using " <<
+          persistentVolumeResource->resources() << endl;
         }
       }

@@ -800,14 +803,6 @@
                 " '" << capability << "'" << endl;
         return EXIT_FAILURE;
       }
-
-      if (type != FrameworkInfo::Capability::GPU_RESOURCES) {
-        cerr << "Flags '--framework_capabilities'"
-                " specifes an unsupported capability"
-                " '" << capability << "'" << endl;
-        return EXIT_FAILURE;
-      }
-
       frameworkCapabilities.push_back(type);
     }
   }


fix cxxtools::Clock::getSystemTime

fix cxxtools::Clock::getSystemTime

--- src/clockimpl.cpp
+++ src/clockimpl.cpp
@@ -75,10 +75,18 @@
     struct timeval tod;
     gettimeofday(&tod, NULL);

-    Date date(tod.tv_sec / 24 / 60 / 60);
-    Time time;
-    time.setTotalUSecs(tod.tv_usec);
-    return DateTime(date, time);
+    struct tm tim;
+    time_t sec = tod.tv_sec;
+    gmtime_r(&sec, &tim);
+
+    return DateTime( tim.tm_year + 1900,
+                     tim.tm_mon + 1,
+                     tim.tm_mday,
+                     tim.tm_hour,
+                     tim.tm_min,
+                     tim.tm_sec,
+                     0,
+                     tod.tv_usec);
 }


flags

flags

--- src/cm-logjoin.cc
+++ src/cm-logjoin.cc
@@ -98,12 +98,12 @@
       "<path>");

   flags.defineFlag(
-      "feedserver_addr",
+      "publish_to",
       fnord::cli::FlagParser::T_STRING,
       false,
       NULL,
       "http://localhost:8000",
-      "feedserver addr",
+      "upload target url",
       "<addr>");

   flags.defineFlag(
@@ -300,7 +300,7 @@
   /* set up logjoin upload */
   cm::LogJoinUpload logjoin_upload(
       sessdb,
-      flags.getString("feedserver_addr"),
+      flags.getString("publish_to"),
       &http);

   /* setup logjoin */


cleaning up

cleaning up

--- src/cm-logjoin.cc
+++ src/cm-logjoin.cc
@@ -180,8 +180,6 @@
   /* schema... */
   auto joined_sessions_schema = joinedSessionsSchema();

-  //fnord::iputs("$0", joined_sessions_schema.toString());
-
   /* set up cmdata */
   auto cmdata_path = flags.getString("cmdata");
   if (!FileUtil::isDirectory(cmdata_path)) {
@@ -248,9 +246,9 @@
   feed_reader.setMaxSpread(10 * kMicrosPerSecond);

   HashMap<String, URI> input_feeds;
-  //input_feeds.emplace(
-  //    "tracker_log.feedserver01.nue01.production.fnrd.net",
-  //    URI("http://s01.nue01.production.fnrd.net:7001/rpc"));
+  input_feeds.emplace(
+      "tracker_log.feedserver01.nue01.production.fnrd.net",
+      URI("http://s01.nue01.production.fnrd.net:7001/rpc"));
   input_feeds.emplace(
       "tracker_log.feedserver02.nue01.production.fnrd.net",
       URI("http://s02.nue01.production.fnrd.net:7001/rpc"));


Removed illegal but functional use of MPI_Comm_create in favor of MPI_Comm_split.

--- src/core/Grid.cpp
+++ src/core/Grid.cpp
@@ -195,9 +195,9 @@

     // Split the viewing comm into the owning and not owning subsets
     if( _inGrid )
-        mpi::CommCreate( _viewingComm, _owningGroup, _owningComm );
+        mpi::CommSplit( _viewingComm, true, _owningRank, _owningComm );
     else
-        mpi::CommCreate( _viewingComm, _notOwningGroup, _notOwningComm );
+        mpi::CommSplit( _viewingComm, false, 0, _notOwningComm );

     if( _inGrid )
     {


add operator "" _mask() to make Assembler clearer

Change-Id: I145f0f60288eef368fc7648b25661356cb6e9f12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223980
Commit-Queue: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>
Reviewed-by: Herb Derby <9e12a3d2bbf73546e47cc9958f6ba8f3215b7eaf@google.com>


Use boringssl trick on trashMemory to prevent optimization on the memsets.

--- src/core/Util.cpp
+++ src/core/Util.cpp
@@ -60,6 +60,12 @@
     std::memset(buffer, 0x55, length);
     std::memset(buffer, 0xAA, length);
     std::memset(buffer,    0, length);
+#ifdef __GNUC__
+    // break compiler optimization of this function for gcc
+    // see trick used in google's boring ssl:
+    // https://boringssl.googlesource.com/boringssl/+/ad1907fe73334d6c696c8539646c21b11178f20f%5E!/#F0
+    __asm__ __volatile__("" : : "r"(buffer) : "memory");
+#endif
   }
 }
 #ifdef _WIN32


Fix Windows build breakage from 3b45e53

Fix Windows build breakage from 3b45e53

--- src/core/Util.cpp
+++ src/core/Util.cpp
@@ -24,7 +24,11 @@

 #include <stdio.h>
 #include <time.h>
+#ifdef _WIN32
+#include <sys/timeb.h>
+#else
 #include <sys/time.h>
+#endif
 #include <sstream>
 #include <iomanip>
 #include <errno.h>
@@ -431,12 +435,14 @@
   struct _timeb *ptimebuffer;
   ptimebuffer = new _timeb;
   _ftime_s(ptimebuffer);
+  time_t the_time = ptimebuffer->time;
 #else
   struct timeval *ptimebuffer;
   ptimebuffer = new timeval;
   gettimeofday(ptimebuffer, NULL);
+  time_t the_time = ptimebuffer->tv_sec;
 #endif
-  StringX cmys_now = ConvertToDateTimeString(ptimebuffer->tv_sec, TMC_EXPORT_IMPORT);
+  StringX cmys_now = ConvertToDateTimeString(the_time, TMC_EXPORT_IMPORT);

   if (bShort) {
     sTimeStamp = cmys_now.c_str();
@@ -444,7 +450,7 @@
     ostringstreamT *p_os;
     p_os = new ostringstreamT;
     *p_os << cmys_now << TCHAR('.') << setw(3) << setfill(TCHAR('0'))
-          << static_cast<unsigned int>(ptimebuffer->tv_usec);
+          << static_cast<unsigned int>(the_time);

     sTimeStamp = p_os->str();
     delete p_os;


(Block::renderNonInline): Fix a bug

(Block::renderNonInline): Fix a bug

--- src/css/BoxGL.cpp
+++ src/css/BoxGL.cpp
@@ -631,7 +631,7 @@
         }
     }

-    if (isClipped())
+    if (isClipped() && last != stackingContext->getLastFloat())
         stackingContext->renderFloats(view, last, this);
 }


Create typedef symbols

Create typedef symbols

--- src/cxx/parser.cc
+++ src/cxx/parser.cc
@@ -3289,6 +3289,8 @@
     rewind(after_declarator);
   }

+  const bool isTypedef = decl.specifiers.isTypedef;
+
   InitDeclaratorAST* initDeclarator = new (pool) InitDeclaratorAST();

   initDeclarator->declarator = declarator;
@@ -3302,6 +3304,12 @@

   *declIt = new (pool) List(initDeclarator);
   declIt = &(*declIt)->next;
+
+  if (isTypedef) {
+    auto typedefSymbol = symbols->newTypedefSymbol(sem->scope(), decl.name);
+    typedefSymbol->setType(decl.type);
+    sem->scope()->add(typedefSymbol);
+  }

   while (match(TokenKind::T_COMMA)) {
     InitDeclaratorAST* initDeclarator = nullptr;
@@ -4227,6 +4235,12 @@

   ast->declarator = declarator;
   ast->initializer = initializer;
+
+  if (decl.specifiers.isTypedef) {
+    auto typedefSymbol = symbols->newTypedefSymbol(sem->scope(), decl.name);
+    typedefSymbol->setType(decl.type);
+    sem->scope()->add(typedefSymbol);
+  }

   return true;
 }


Fix: saving modified note, having \x0 at the end, to database

--- src/dbmanager.cpp
+++ src/dbmanager.cpp
@@ -93,10 +93,16 @@
 bool DBManager::addNote(NoteData* note)
 {
     QSqlQuery query;
-
-    qint64 epochTimeDateCreated = note->creationDateTime().toMSecsSinceEpoch();
-    QString content = note->content().replace("'","''");
-    QString fullTitle = note->fullTitle().replace("'","''");
+    QString emptyStr;
+
+    qint64 epochTimeDateCreated = note->creationDateTime()
+                                  .toMSecsSinceEpoch();
+    QString content = note->content()
+                      .replace("'","''")
+                      .replace(QChar('\x0'), emptyStr);
+    QString fullTitle = note->fullTitle()
+                        .replace("'","''")
+                        .replace(QChar('\x0'), emptyStr);

     QString queryStr = QString("INSERT INTO active_notes (creation_date, modification_date, deletion_date, content, full_title) "
                                "VALUES (%1, %1, -1, '%2', '%3');")
@@ -112,6 +118,7 @@
 bool DBManager::removeNote(NoteData* note)
 {
     QSqlQuery query;
+    QString emptyStr;

     int id = note->id().split('_')[1].toInt();

@@ -124,8 +131,12 @@
     qint64 epochTimeDateCreated = note->creationDateTime().toMSecsSinceEpoch();
     qint64 epochTimeDateModified = note->lastModificationdateTime().toMSecsSinceEpoch();
     qint64 epochTimeDateDeleted = note->deletionDateTime().toMSecsSinceEpoch();
-    QString content = note->content().replace("'","''");
-    QString fullTitle = note->fullTitle().replace("'","''");
+    QString content = note->content()
+                      .replace("'","''")
+                      .replace(QChar('\x0'), emptyStr);
+    QString fullTitle = note->fullTitle()
+                        .replace("'","''")
+                        .replace(QChar('\x0'), emptyStr);

     queryStr = QString("INSERT INTO deleted_notes "
                        "VALUES (%1, %2, %3, %4, '%5', '%6');")
@@ -145,11 +156,16 @@
 bool DBManager::modifyNote(NoteData* note)
 {
     QSqlQuery query;
-
-    int id = note->id().split('_')[1].toInt();
-    qint64 epochTimeDateModified = note->lastModificationdateTime().toMSecsSinceEpoch();
-    QString content = note->content().replace("'","''");
-    QString fullTitle = note->fullTitle().replace("'","''");
+    QString emptyStr;
+
+    int id = note->id().split('_')[1].toInt();
+    qint64 epochTimeDateModified = note->lastModificationdateTime().toMSecsSinceEpoch();
+    QString content = note->content()
+                      .replace("'","''")
+                      .replace(QChar('\x0'), emptyStr);
+    QString fullTitle = note->fullTitle()
+                        .replace("'","''")
+                        .replace(QChar('\x0'), emptyStr);

     QString queryStr = QStringLiteral("UPDATE active_notes "
                                       "SET modification_date=%1, content='%2', full_title='%3' "
@@ -193,7 +209,6 @@
 bool DBManager::migrateTrash(NoteData* note)
 {
     QSqlQuery query;
-
     QString emptyStr;

     int id = note->id().split('_')[1].toInt();


Fixed some off-by-ones in StretchBlit(). They only caused imperceptible inaccuracy in the output.

--- src/df_bitmap.cpp
+++ src/df_bitmap.cpp
@@ -871,6 +871,7 @@
         }
         // End of clipping.

+
         for (int y = 0; y < dstH; y++) {
             if (dstY + y < 0) continue;

@@ -881,7 +882,7 @@
             DfColour *srcRow = &srcBmp->pixels[srcY * srcBmp->width];

             unsigned weightY2 = srcYAndWeight & 0xFF;
-            unsigned weightY = 256 - weightY2;
+            unsigned weightY = 255 - weightY2;

             for (int x = 0; x < srcXMax; x++) {
                 if (x < srcXMin) continue;
@@ -908,7 +909,7 @@
                 int srcXAndWeight = ((x * widthRatio) >> 8) + srcXErr;
                 int srcX = srcXAndWeight >> 8;
                 unsigned weightX2 = srcXAndWeight & 0xFF;
-                unsigned weightX = 256 - weightX2;
+                unsigned weightX = 255 - weightX2;

                 // Pixel 0,0
                 DfColour *srcPixel = &dstRow[srcX];


Query no longer propagates. Solves a lot of problems.

--- src/discovery.cpp
+++ src/discovery.cpp
@@ -425,29 +425,18 @@
     std::vector<QueryItem> items;
     it = unpackAll(it, last, node, items);

-    std::vector<QueryItem> toForward;
-
     for (const auto& key : items) {
         auto it = keys.find(key);
-
-        if (it != keys.end()) {
-            std::vector<KeyItem> items;
-            for (const auto& node : it->second) {
-                if (!node.ttl()) continue;
-                items.emplace_back(key, node.addrs, node.ttl());
-            }
-
-            endpoint.send(conn.handle, packAll(msg::Keys, items));
+        if (it == keys.end()) continue;
+
+        std::vector<KeyItem> items;
+        for (const auto& node : it->second) {
+            if (!node.ttl()) continue;
+            items.emplace_back(key, node.addrs, node.ttl());
         }

-        else {
-            keys[key] = List<Node>();
-            toForward.emplace_back(key);
-        }
-    }
-
-    if (!toForward.empty())
-        endpoint.broadcast(packAll(msg::Query, toForward));
+        endpoint.send(conn.handle, packAll(msg::Keys, items));
+    }

     return it;
 }


評価関数のミスを修正

評価関数のミスを修正

--- src/evaluator.cpp
+++ src/evaluator.cpp
@@ -424,7 +424,8 @@
         attacks = Util::GetPawnAttack(piece_square, piece_side);

         // アンパッサン。
-        if (engine_ptr_->en_passant_square()) {
+        if (engine_ptr_->en_passant_square()
+        && (piece_side == engine_ptr_->to_move())) {
           en_passant =
           Util::SQUARE[engine_ptr_->en_passant_square()] & attacks;
         }


Made exec.cpp use namespace process like the others for readability.

--- src/exec/exec.cpp
+++ src/exec/exec.cpp
@@ -10,6 +10,7 @@

 #include <mesos/executor.hpp>

+#include <process/dispatch.hpp>
 #include <process/process.hpp>
 #include <process/protobuf.hpp>

@@ -24,10 +25,10 @@
 using namespace mesos;
 using namespace mesos::internal;

+using namespace process;
+
 using boost::bind;
 using boost::cref;
-
-using process::UPID;

 using std::string;

@@ -72,7 +73,7 @@
     installProtobufHandler<ShutdownMessage>(
         &ExecutorProcess::shutdown);

-    installMessageHandler(process::EXITED, &ExecutorProcess::exited);
+    installMessageHandler(EXITED, &ExecutorProcess::exited);
   }

   virtual ~ExecutorProcess() {}
@@ -90,29 +91,27 @@
     message.mutable_executor_id()->MergeFrom(executorId);
     send(slave, message);

-    do { if (serve() == process::TERMINATE) break; } while (true);
+    do { if (serve() == TERMINATE) break; } while (true);
   }

   void registered(const ExecutorArgs& args)
   {
     VLOG(1) << "Executor registered on slave " << args.slave_id();
     slaveId = args.slave_id();
-    process::invoke(bind(&Executor::init, executor, driver, cref(args)));
+    invoke(bind(&Executor::init, executor, driver, cref(args)));
   }

   void runTask(const TaskDescription& task)
   {
     VLOG(1) << "Executor asked to run task '" << task.task_id() << "'";

-    process::invoke(bind(&Executor::launchTask, executor, driver,
-                         cref(task)));
+    invoke(bind(&Executor::launchTask, executor, driver, cref(task)));
   }

   void killTask(const TaskID& taskId)
   {
     VLOG(1) << "Executor asked to kill task '" << taskId << "'";
-    process::invoke(bind(&Executor::killTask, executor, driver,
-                         cref(taskId)));
+    invoke(bind(&Executor::killTask, executor, driver, cref(taskId)));
   }

   void frameworkMessage(const SlaveID& slaveId,
@@ -121,19 +120,18 @@
 			const string& data)
   {
     VLOG(1) << "Executor received framework message";
-    process::invoke(bind(&Executor::frameworkMessage, executor, driver,
-                         cref(data)));
+    invoke(bind(&Executor::frameworkMessage, executor, driver, cref(data)));
   }

   void shutdown()
   {
     VLOG(1) << "Executor asked to shutdown";
     // TODO(benh): Any need to invoke driver.stop?
-    process::invoke(bind(&Executor::shutdown, executor, driver));
+    invoke(bind(&Executor::shutdown, executor, driver));
     if (!local) {
       exit(0);
     } else {
-      process::terminate(self());
+      terminate(this);
     }
   }

@@ -142,7 +140,7 @@
     VLOG(1) << "Slave exited, trying to shutdown";

     // TODO: Pass an argument to shutdown to tell it this is abnormal?
-    process::invoke(bind(&Executor::shutdown, executor, driver));
+    invoke(bind(&Executor::shutdown, executor, driver));

     // This is a pretty bad state ... no slave is left. Rather
     // than exit lets kill our process group (which includes
@@ -152,8 +150,32 @@
     if (!local) {
       killpg(0, SIGKILL);
     } else {
-      process::terminate(self());
+      terminate(this);
     }
+  }
+
+  void sendStatusUpdate(const TaskStatus& status)
+  {
+    StatusUpdateMessage message;
+    StatusUpdate* update = message.mutable_update();
+    update->mutable_framework_id()->MergeFrom(frameworkId);
+    update->mutable_executor_id()->MergeFrom(executorId);
+    update->mutable_slave_id()->MergeFrom(slaveId);
+    update->mutable_status()->MergeFrom(status);
+    update->set_timestamp(elapsedTime());
+    update->set_uuid(UUID::random().toBytes());
+    message.set_reliable(false);
+    send(slave, message);
+  }
+
+  void sendFrameworkMessage(const string& data)
+  {
+    ExecutorToFrameworkMessage message;
+    message.mutable_slave_id()->MergeFrom(slaveId);
+    message.mutable_framework_id()->MergeFrom(frameworkId);
+    message.mutable_executor_id()->MergeFrom(executorId);
+    message.set_data(data);
+    send(slave, message);
   }

 private:
@@ -196,7 +218,7 @@
 {
   // Just as in SchedulerProcess, we might wait here indefinitely if
   // MesosExecutorDriver::stop has not been invoked.
-  process::wait(process->self());
+  wait(process);
   delete process;

   pthread_mutex_destroy(&mutex);
@@ -269,7 +291,7 @@
   process =
     new ExecutorProcess(slave, this, executor, frameworkId, executorId, local);

-  process::spawn(process);
+  spawn(process);

   running = true;

@@ -286,11 +308,8 @@
   }

   CHECK(process != NULL);
-
-  process::terminate(process->self());
-
+  terminate(process);
   running = false;
-
   pthread_cond_signal(&cond);

   return 0;
@@ -326,18 +345,7 @@
   }

   CHECK(process != NULL);
-
-  // TODO(benh): Do a dispatch to Executor first?
-  StatusUpdateMessage message;
-  StatusUpdate* update = message.mutable_update();
-  update->mutable_framework_id()->MergeFrom(process->frameworkId);
-  update->mutable_executor_id()->MergeFrom(process->executorId);
-  update->mutable_slave_id()->MergeFrom(process->slaveId);
-  update->mutable_status()->MergeFrom(status);
-  update->set_timestamp(process->elapsedTime());
-  update->set_uuid(UUID::random().toBytes());
-  message.set_reliable(false);
-  process->send(process->slave, message);
+  dispatch(process, &ExecutorProcess::sendStatusUpdate, status);

   return 0;
 }
@@ -353,14 +361,7 @@
   }

   CHECK(process != NULL);
-
-  // TODO(benh): Do a dispatch to Executor first?
-  ExecutorToFrameworkMessage message;
-  message.mutable_slave_id()->MergeFrom(process->slaveId);
-  message.mutable_framework_id()->MergeFrom(process->frameworkId);
-  message.mutable_executor_id()->MergeFrom(process->executorId);
-  message.set_data(data);
-  process->send(process->slave, message);
-
-  return 0;
-}
+  dispatch(process, &ExecutorProcess::sendFrameworkMessage, data);
+
+  return 0;
+}


src/executors.cpp: Changed compilation of bytecode sequence

--- src/executors.cpp
+++ src/executors.cpp
@@ -256,17 +256,13 @@
       /*assign bultin global*/
       ;/*end initializer*/

-    /// build and assemble reducto_cont_bytecode
+    /// build and assemble various bytecode sequences
     reducto_cont_bytecode =
       inline_assemble("(reducto-continuation) (continue)");
     ccc_fn =
       inline_assemble("(check-vars 3) (continue-on-clos 0)");
-
-    std::stringstream com_cont("(composeo-continuation ) (continue )");
-    BytecodeSeq com_seq;
-    while (!com_cont.eof())
-      com_cont >> red_seq;
-    assemble(com_seq, composeo_cont_bytecode);
+    composeo_cont_bytecode =
+      inline_assemble("(composeo-continuation ) (continue )");

     return process_running;
   }


move closing of files outside of file pool mutex

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@10776 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/file_pool.cpp
+++ src/file_pool.cpp
@@ -119,6 +119,13 @@
 	file_handle file_pool::open_file(void* st, std::string const& p
 		, int file_index, file_storage const& fs, int m, error_code& ec)
 	{
+		// potentially used to hold a reference to a file object that's
+		// about to be destructed. If we have such object we assign it to
+		// this member to be destructed after we release the mutex. On some
+		// operating systems (such as OSX) closing a file may take a long
+		// time. We don't want to hold the mutex for that.
+		file_handle defer_destruction;
+
 		mutex::scoped_lock l(m_mutex);

 #if TORRENT_USE_ASSERTS
@@ -163,6 +170,7 @@
 				// be outstanding operations on it, we can't close the
 				// file, we can only delete our reference to it.
 				// if this is the only reference to the file, it will be closed
+				defer_destruction = e.file_ptr;
 				e.file_ptr = boost::make_shared<file>();

 				std::string full_path = fs.file_path(file_index, p);


Animation without interpolation

Animation without interpolation

--- GameEngine/Tools/AssimpTest/Main.cpp
+++ GameEngine/Tools/AssimpTest/Main.cpp
@@ -4,9 +4,13 @@
 #include <assimp/scene.h>

 #include <iostream>
+
 #include <glm/glm.hpp>
 #include <glm/gtc/matrix_transform.hpp>
 #include <glm/gtx/transform.hpp>
+#include <glm/gtx/quaternion.hpp>
+#include <glm/gtx/quaternion.hpp>
+
 #include <vector>
 #include <map>

@@ -45,6 +49,37 @@
 		std::vector<glm::vec4> boneIndices;
 		std::vector<std::string>bones;
 	};
+
+	template <typename T>
+	struct AnimationKey
+	{
+		T value;
+		float time;
+
+		AnimationKey(const T &_value, float _time)
+			: value(_value)
+			, time(_time)
+		{}
+		AnimationKey(T &&_value, float _time)
+			: value(std::move(_value))
+			, time(_time)
+		{}
+
+	};
+
+	struct AnimationChannel
+	{
+		unsigned int boneIndex;
+		std::vector<AnimationKey<glm::vec3>> scale;
+		std::vector<AnimationKey<glm::quat>> rotation;
+		std::vector<AnimationKey<glm::vec3>> translation;
+	};
+
+	struct Animation
+	{
+		std::string name;
+		std::vector<AnimationChannel> channels;
+	};
 }

 static glm::mat4 aiMat4ToGlm(const aiMatrix4x4 &m)
@@ -53,16 +88,38 @@
 }

-void readNodeHierarchy(unsigned int boneID, const glm::mat4 &parentTrans, std::vector<AGE::Bone> &bones, std::vector<glm::mat4> &trans)
+void readNodeHierarchy(unsigned int boneID
+	, const glm::mat4 &parentTrans
+	, std::vector<AGE::Bone> &bones
+	, std::vector<glm::mat4> &trans
+	, AGE::Animation *animation = nullptr
+	, float time = 0.0f)
 {
 	trans.resize(bones.size());
-
-	glm::mat4 t = parentTrans * bones[boneID].transformation;
+	glm::mat4 nodeT = bones[boneID].transformation;
+
+	if (animation)
+	{
+		for (unsigned int i = 0; i < animation->channels.size(); ++i)
+		{
+			if (animation->channels[i].boneIndex != boneID)
+				continue;
+			auto id = (int)(time * 4.0f) % animation->channels[i].scale.size();
+			auto s = glm::scale(glm::mat4(1), animation->channels[i].scale[id].value);
+			id = (int)(time * 4.0f) % animation->channels[i].rotation.size();
+			auto r = glm::toMat4(animation->channels[i].rotation[id].value);
+			id = (int)(time * 4.0f) % animation->channels[i].translation.size();
+			auto tr = glm::translate(glm::mat4(1), animation->channels[i].translation[id].value);
+			nodeT = tr * r * s;
+		}
+	}
+
+	glm::mat4 t = parentTrans * nodeT;
 	trans[boneID] = t * bones[boneID].offset;

 	for (unsigned int i = 0; i < bones[boneID].children.size(); ++i)
 	{
-		readNodeHierarchy(bones[boneID].children[i], t, bones, trans);
+		readNodeHierarchy(bones[boneID].children[i], t, bones, trans, animation, time);
 	}
 }

@@ -132,6 +189,8 @@

 	std::vector<AGE::Mesh> meshs;
 	std::vector<AGE::Bone> bones;
+	std::vector<AGE::Animation> animations;
+
 	unsigned int skeletonRoot = 0;

 	meshs.resize(scene->mNumMeshes);
@@ -316,6 +375,51 @@
 		}
 	}

+	// we load animations
+
+	if (scene->HasAnimations())
+	{
+		animations.resize(scene->mNumAnimations);
+		for (unsigned int animNum = 0; animNum < scene->mNumAnimations; ++animNum)
+		{
+			auto aiAnim = scene->mAnimations[animNum];
+			auto &anim = animations[animNum];
+			anim.name = aiAnim->mName.data;
+			anim.channels.resize(aiAnim->mNumChannels);
+			for (unsigned int channelNbr = 0; channelNbr < aiAnim->mNumChannels; ++channelNbr)
+			{
+				auto aiChannel = aiAnim->mChannels[channelNbr];
+				auto &channel = anim.channels[channelNbr];
+				auto findBoneName = bonesTable.find(aiChannel->mNodeName.data);
+				assert(findBoneName != std::end(bonesTable));
+				unsigned int boneIndex = findBoneName->second;
+
+				channel.boneIndex = boneIndex;
+				// we push positions
+				for (unsigned int i = 0; i < aiChannel->mNumPositionKeys; ++i)
+				{
+					channel.translation.emplace_back(
+						glm::vec3(aiChannel->mPositionKeys[i].mValue.x, aiChannel->mPositionKeys[i].mValue.y, aiChannel->mPositionKeys[i].mValue.z)
+						, aiChannel->mPositionKeys->mTime);
+				}
+				// we push scale
+				for (unsigned int i = 0; i < aiChannel->mNumScalingKeys; ++i)
+				{
+					channel.scale.emplace_back(
+						glm::vec3(aiChannel->mScalingKeys[i].mValue.x, aiChannel->mScalingKeys[i].mValue.y, aiChannel->mScalingKeys[i].mValue.z)
+						, aiChannel->mScalingKeys->mTime);
+				}
+				// we push rotation
+				for (unsigned int i = 0; i < aiChannel->mNumRotationKeys; ++i)
+				{
+					channel.rotation.emplace_back(
+						glm::quat(aiChannel->mRotationKeys[i].mValue.w, aiChannel->mRotationKeys[i].mValue.x, aiChannel->mRotationKeys[i].mValue.y, aiChannel->mRotationKeys[i].mValue.z)
+						, aiChannel->mRotationKeys->mTime);
+				}
+			}
+		}
+	}
+
 	auto shader = e->getInstance<Renderer>()->addShader("basic",
 		"./basic.vp",
 		"./basic.fp");
@@ -363,6 +467,9 @@
 	do
 	{
 		auto time = e->getInstance<Timer>()->getElapsed();
+		static float totalTime = 0.0f;
+		totalTime += time;
+
 		glm::vec4 color;
 		shader->use();
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -396,7 +503,9 @@

 		std::vector<glm::mat4> bonesTrans;
 		bonesTrans.resize(bones.size());
-		readNodeHierarchy(skeletonRoot, glm::mat4(1), bones, bonesTrans);
+
+		readNodeHierarchy(skeletonRoot, glm::mat4(1), bones, bonesTrans, &(animations[0]), totalTime);
+
 		glUniformMatrix4fv(glGetUniformLocation(shader->getId(), "bones"), bonesTrans.size(), GL_FALSE, glm::value_ptr(bonesTrans[0]));

 		for (unsigned int i = 0; i < vertices.size(); ++i)


Tart up documentation.

Tart up documentation.

--- GeographicLib/TransverseMercator.cpp
+++ GeographicLib/TransverseMercator.cpp
@@ -363,14 +363,14 @@
     //    F[n](x) = sin(n * x)
     //    a(n, x) = 2 * cos(x)
     //    b(n, x) = -1
+    //    [ sin(A+B) - 2*cos(B)*sin(A) + sin(A-B) = 0, A = n*x, B = x ]
     //    N = maxpow
     //    c[k] = _hp[k-1]
     //    S = y[1] * sin(x)
     double
       c0 = cos(2 * xip), ch0 = cosh(2 * etap),
       s0 = sin(2 * xip), sh0 = sinh(2 * etap),
-      ar =  2 * c0 * ch0,
-      ai = -2 * s0 * sh0;
+      ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2*zeta')
     double
       xi0 = _hp[maxpow - 1], eta0 = 0,
       xi1 = 0, eta1 = 0,
@@ -381,7 +381,7 @@
       xi0  = ar * xi1 - ai * eta1 - xi2 + _hp[j];
       eta0 = ai * xi1 + ar * eta1 - eta2;
     }
-    ar = s0 * ch0; ai = c0 * sh0;
+    ar = s0 * ch0; ai = c0 * sh0; // sin(2* zeta')
     double
       xi  = xip  + ar * xi0 - ai * eta0,
       eta = etap + ai * xi0 + ar * eta0;
@@ -417,8 +417,7 @@
     double
       c0 = cos(2 * xi), ch0 = cosh(2 * eta),
       s0 = sin(2 * xi), sh0 = sinh(2 * eta),
-      ar =  2 * c0 * ch0,
-      ai = -2 * s0 * sh0;
+      ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2* zeta')
     double
       xip0 = -_h[maxpow - 1], etap0 = 0,
       xip1 = 0, etap1 = 0,
@@ -429,7 +428,7 @@
       xip0  = ar * xip1 - ai * etap1 - xip2 - _h[j];
       etap0 = ai * xip1 + ar * etap1 - etap2;
     }
-    ar = s0 * ch0; ai = c0 * sh0;
+    ar = s0 * ch0; ai = c0 * sh0; // sin(2* zeta)
     double
       xip  = xi  + ar * xip0 - ai * etap0,
       etap = eta + ai * xip0 + ar * etap0;


Chapter 04 exercice 4-3 partial progress. Test of identify one to lots of characters.

--- cap04/cap04-ex4_3-01-test-identify_targets.cpp
+++ cap04/cap04-ex4_3-01-test-identify_targets.cpp
@@ -1,4 +1,4 @@
-//2014.03.28 - 2014.03.30 - 2014.03.31 Gustaf - CTG.
+//2014.03.28 - 2014.03.30 - 2014.03.31 - 2014.04.01 Gustaf - CTG.

 /* EXERCISE 4-3 :
@@ -18,12 +18,12 @@
 === PLAN ===

 OK - Diagram of the example.
-- Traverse (go over) the SOURCE string and identify the initial and final positions of the TARGET string.
+OK - Traverse (go over) the SOURCE string and identify the initial and final positions of the TARGET string.
   ok- Identify one character.
   ok- Identify two characters.
   ok- Identify three characters.
   ok- Identify four characters.
-  - Identify lots of characters.
+  ok- Identify FROM one TO lots of characters.

 */

@@ -75,7 +75,7 @@

   // --- Identifying two contiguous characters.
-  cout << "Identifying two contiguous character." << endl;
+  cout << "Identifying two contiguous characters." << endl;

   char targetArray[2] = {'a', 'b'};
   // char targetArray[2] = {'b', 'z'};
@@ -106,7 +106,7 @@

   // --- Identifying three contiguous characters.
-  cout << "Identifying three contiguous character." << endl;
+  cout << "Identifying three contiguous characters." << endl;

   char targetArrayThree[3] = {'a', 'b', 'c'};
   // char targetArrayThree[3] = {'b', 'e', 'e'};
@@ -154,7 +154,7 @@

   // --- Identifying four contiguous characters.
-  cout << "Identifying four contiguous character." << endl;
+  cout << "Identifying four contiguous characters." << endl;

   char targetArrayFour[4] = {'a', 'b', 'c', 'd'};
@@ -220,7 +220,102 @@
   }

-  delete a; // Free memory of the dinamic array.
+  // --- Identifying lots of contiguous characters.
+
+  // const int TARGET_SIZE = 9; char targetArrayLots[TARGET_SIZE] = {'b', 'c', 'd', 'a', 'b', 'c', 'e', 'f', 'g'};
+  // const int TARGET_SIZE = 7; char targetArrayLots[TARGET_SIZE] = {'b', 'c', 'd', 'a', 'b', 'c', 'e'};
+  const int TARGET_SIZE = 3; char targetArrayLots[TARGET_SIZE] = {'a', 'b', 'c'};
+  // const int TARGET_SIZE = 2; char targetArrayLots[TARGET_SIZE] = {'a', 'b'};
+  // const int TARGET_SIZE = 1; char targetArrayLots[TARGET_SIZE] = {'b'};
+
+
+  cout << "Identifying " << TARGET_SIZE << " contiguous characters." << endl;
+
+
+  a[0] = 'a'; a[1] = 'b'; a[2] = 'c'; a[3] = 'd';
+  a[4] = 'a'; a[5] = 'b'; a[6] = 'c'; a[7] = 'e'; a[8] = 0;
+  cout << "Initial string: " << a << endl << endl;
+
+
+
+  posIni = -1, posFinal = -1;
+  for (int i = 0; i < ARRAY_SIZE; ++i)
+  {
+
+    // Find first character.
+    if ( (posIni == -1) && (posFinal == -1) && (a[i] == targetArrayLots[0]) )
+    {
+      posIni = i;
+
+
+      // Handles special case of one character.
+      if (TARGET_SIZE == 1)
+      {
+        cout << "Target initial/final - index: " << targetArrayLots[0] << " - " << posIni << endl;
+        cout << endl;
+
+        posIni = -1, posFinal = -1; // Reset.
+      }
+
+
+      // Handles cases from two characters until ...
+      for (int j = 1; j < TARGET_SIZE; ++j)
+      {
+
+        // Check second adjacent character.
+        if ( (posFinal == -1) && ( (i + j) == (posIni + j)) )
+        {
+          if (a[i + j] == targetArrayLots[j])
+          {
+            posFinal = i + j;
+          }
+
+          if (a[i + j] != targetArrayLots[j])
+          {
+            posIni = -1, posFinal = -1; // Reset.
+          }
+        }
+
+
+        // Check next adjacent character. BUT not the last.
+        if ( (posFinal != -1) && ((i + j) == (posIni + j)) && (j <= (TARGET_SIZE - 2)) )
+        {
+          if (a[i + j] == targetArrayLots[j])
+          {
+            posFinal = i + j;
+          }
+
+          if (a[i + j] != targetArrayLots[j])
+          {
+            posIni = -1, posFinal = -1; // Reset.
+          }
+        }
+
+
+        // Check last adjacent character.
+        if ( (posFinal != -1) && ((i + j) == (posIni + j)) && (j == (TARGET_SIZE - 1)) )
+        {
+          if (a[i + j] == targetArrayLots[j])
+          {
+            posFinal = i + j;
+
+            cout << "Target initial - index: " << targetArrayLots[0] << " - " << posIni << endl;
+            cout << "Target final   - index: " << targetArrayLots[j] << " - " << posFinal << endl;
+            cout << endl;
+          }
+
+          posIni = -1, posFinal = -1; // Reset.
+        }
+
+      } // internal for
+    } // if that check the first character.
+
+  } // external for
+
+
+
+
+  delete a; // Free memory of the dynamic array.

   cout << endl;


[OpenThread] ReceivePacket should use PBUF_LINK when allocating pbuf (#1591)

--- src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.ipp
+++ src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.ipp
@@ -378,7 +378,7 @@
     struct netif * threadNetIf = ThreadStackMgrImpl().ThreadNetIf();

     // Allocate an LwIP pbuf to hold the inbound packet.
-    pbuf = pbuf_alloc(PBUF_RAW, pktLen, PBUF_POOL);
+    pbuf = pbuf_alloc(PBUF_LINK, pktLen, PBUF_POOL);
     VerifyOrExit(pbuf != NULL, lwipErr = ERR_MEM);

     // Copy the packet data from the OpenThread message object to the pbuf.


ENH: do not bail out from Test() with empty inputs

--- Infovis/vtkContingencyStatistics.cxx
+++ Infovis/vtkContingencyStatistics.cxx
@@ -701,49 +701,29 @@
                                      vtkMultiBlockDataSet* inMeta,
                                      vtkTable* outMeta )
 {
+  if ( ! inMeta )
+    {
+    return;
+    }
+
+  vtkTable* summaryTab = vtkTable::SafeDownCast( inMeta->GetBlock( 0 ) );
+  if ( ! summaryTab )
+    {
+    return;
+    }
+
+  vtkTable* contingencyTab = vtkTable::SafeDownCast( inMeta->GetBlock( 1 ) );
+  if ( ! contingencyTab  )
+    {
+    return;
+    }
+
   if ( ! outMeta )
     {
     return;
     }

-  if ( ! inData || inData->GetNumberOfColumns() <= 0 )
-    {
-    return;
-    }
-
-  vtkIdType nRowData = inData->GetNumberOfRows();
-  if ( nRowData <= 0 )
-    {
-    return;
-    }
-
-  if ( ! inMeta || inMeta->GetNumberOfBlocks() < 4 ) // We need at least 2 marginal PDFs in addition to the contingency table
-    {
-    return;
-    }
-
-  vtkTable* summaryTab;
-  if ( ! ( summaryTab = vtkTable::SafeDownCast( inMeta->GetBlock( 0 ) ) )
-       || summaryTab->GetNumberOfColumns() < 2 )
-    {
-    return;
-    }
-
-  vtkIdType nRowSumm = summaryTab->GetNumberOfRows();
-  if ( nRowSumm <= 0 )
-    {
-    return;
-    }
-
-  vtkTable* contingencyTab;
-  if ( ! ( contingencyTab = vtkTable::SafeDownCast( inMeta->GetBlock( 1 ) ) )
-       || contingencyTab->GetNumberOfColumns() < 7 )
-    {
-    return;
-    }
-
-  vtkIdType nRowCont = contingencyTab->GetNumberOfRows();
-  if ( nRowCont <= 0 )
+  if ( ! inData )
     {
     return;
     }
@@ -777,6 +757,8 @@
   vtkIdTypeArray* card = vtkIdTypeArray::SafeDownCast( contingencyTab->GetColumnByName( "Cardinality" ) );

   // Loop over requests
+  vtkIdType nRowSumm = summaryTab->GetNumberOfRows();
+  vtkIdType nRowCont = contingencyTab->GetNumberOfRows();
   for ( vtksys_stl::set<vtksys_stl::set<vtkStdString> >::const_iterator rit = this->Internals->Requests.begin();
         rit != this->Internals->Requests.end(); ++ rit )
     {


yet another attrib update lock fix

yet another attrib update lock fix

--- src/game/Attr.cpp
+++ src/game/Attr.cpp
@@ -430,7 +430,12 @@
 				ScriptVar_t& oldValue = u->oldValue;

 				attrDesc->getAttrExt(oPt).updated = false;
-				if(oldValue == attrDesc->get(oPt)) continue; // TODO: this causes a copy, cannot be done locked
+				// Note: In most cases, the attrib is static and this will not create
+				// any temporary ScriptVar_t copy.
+				// If it would, that would be dangerous because that can have many
+				// side effects which might again access the object attrib system
+				// - but we have te objUpdatesMutex locked here.
+				if(attrDesc->compare(oPt, oldValue) == 0) continue;

 				if(oPt->thisRef) // if registered
 					game.gameStateUpdates->pushObjAttrUpdate(ObjAttrRef(oPt->thisRef, attrDesc));


Some minor cleaning up.

Some minor cleaning up.

--- src/generator.cpp
+++ src/generator.cpp
@@ -532,13 +532,13 @@
     bool isPiecewiseStatement(const GeneratorEquationAstImplPtr &ast) const;

     std::string generateOperatorCode(const std::string &op,
-                                     const GeneratorEquationAstImplPtr &ast) const;
-    std::string generateMinusUnaryCode(const GeneratorEquationAstImplPtr &ast) const;
+                                     const GeneratorEquationAstImplPtr &ast);
+    std::string generateMinusUnaryCode(const GeneratorEquationAstImplPtr &ast);
     std::string generatePiecewiseIfCode(const std::string &condition,
-                                        const std::string &value) const;
-    std::string generatePiecewiseElseCode(const std::string &value) const;
+                                        const std::string &value);
+    std::string generatePiecewiseElseCode(const std::string &value);
     std::string generateCode(const GeneratorEquationAstImplPtr &ast,
-                             const GeneratorEquationAstImplPtr &parentAst = nullptr) const;
+                             const GeneratorEquationAstImplPtr &parentAst = nullptr);
 };

 bool Generator::GeneratorImpl::hasValidModel() const
@@ -1295,7 +1295,7 @@
 }

 std::string Generator::GeneratorImpl::generateOperatorCode(const std::string &op,
-                                                           const GeneratorEquationAstImplPtr &ast) const
+                                                           const GeneratorEquationAstImplPtr &ast)
 {
     // Generate the code for the left and right branches of the given AST

@@ -1591,7 +1591,7 @@
     return left + op + right;
 }

-std::string Generator::GeneratorImpl::generateMinusUnaryCode(const GeneratorEquationAstImplPtr &ast) const
+std::string Generator::GeneratorImpl::generateMinusUnaryCode(const GeneratorEquationAstImplPtr &ast)
 {
     // Generate the code for the left branch of the given AST

@@ -1611,7 +1611,7 @@
 }

 std::string Generator::GeneratorImpl::generatePiecewiseIfCode(const std::string &condition,
-                                                              const std::string &value) const
+                                                              const std::string &value)
 {
     return replace(replace(mProfile->hasConditionalOperator() ?
                                mProfile->conditionalOperatorIfString() :
@@ -1620,7 +1620,7 @@
                    "#if", value);
 }

-std::string Generator::GeneratorImpl::generatePiecewiseElseCode(const std::string &value) const
+std::string Generator::GeneratorImpl::generatePiecewiseElseCode(const std::string &value)
 {
     return replace(mProfile->hasConditionalOperator() ?
                        mProfile->conditionalOperatorElseString() :
@@ -1629,7 +1629,7 @@
 }

 std::string Generator::GeneratorImpl::generateCode(const GeneratorEquationAstImplPtr &ast,
-                                                   const GeneratorEquationAstImplPtr &parentAst) const
+                                                   const GeneratorEquationAstImplPtr &parentAst)
 {
     // Generate the code for the given AST


Generator: improved our tracking and retrieval of generator variables.

--- src/generator.cpp
+++ src/generator.cpp
@@ -357,7 +357,7 @@
     size_t mathmlChildCount(const XmlNodePtr &node) const;
     XmlNodePtr mathmlChildNode(const XmlNodePtr &node, size_t index) const;

-    GeneratorVariableImplPtr generatorVariable(const VariablePtr &variable) const;
+    GeneratorVariableImplPtr generatorVariable(const VariablePtr &variable);

     void processNode(const XmlNodePtr &node, GeneratorEquationAstImplPtr &ast,
                      const GeneratorEquationAstImplPtr &astParent,
@@ -444,15 +444,25 @@
     return res;
 }

-GeneratorVariableImplPtr Generator::GeneratorImpl::generatorVariable(const VariablePtr &variable) const
-{
+GeneratorVariableImplPtr Generator::GeneratorImpl::generatorVariable(const VariablePtr &variable)
+{
+    // Find and return, if there is one, the generator variable associated with
+    // given variable
+
     for (const auto &generatorVariable : mVariables) {
         if (variable->isEquivalentVariable(generatorVariable->mVariable)) {
             return generatorVariable;
         }
     }

-    return {};
+    // No generator variable exists for the given variable, so create one, track
+    // it and return it
+
+    GeneratorVariableImplPtr generatorVariable = std::make_shared<GeneratorVariableImpl>();
+
+    mVariables.push_back(generatorVariable);
+
+    return generatorVariable;
 }

 void Generator::GeneratorImpl::processNode(const XmlNodePtr &node,
@@ -818,26 +828,11 @@
     // makes sense

     for (size_t i = 0; i < component->variableCount(); ++i) {
-        // Track the variable if it isn't already being tracked
-
-        bool componentVariableTracked = false;
+        // Retrieve the corresponding generator variable
+
         VariablePtr componentVariable = component->variable(i);
-        GeneratorVariableImplPtr trackedVariable;
-
-        for (const auto &variable : mVariables) {
-            if (componentVariable->isEquivalentVariable(variable->mVariable)) {
-                componentVariableTracked = true;
-                trackedVariable = variable;
-
-                break;
-            }
-        }
-
-        if (!componentVariableTracked) {
-            trackedVariable = std::make_shared<GeneratorVariableImpl>();
-
-            mVariables.push_back(trackedVariable);
-        }
+
+        GeneratorVariableImplPtr trackedVariable = Generator::GeneratorImpl::generatorVariable(componentVariable);

         // Set the variable held by trackedVariable, in case there was none
         // before or in case the existing one has no initial value while


Generator: improved our stateCount() and variableCount() methods and implemented our state() and variable() methods.

--- src/generator.cpp
+++ src/generator.cpp
@@ -497,6 +497,8 @@
     std::list<GeneratorEquationPrivPtr> mEquations;

     VariablePtr mVariableOfIntegration;
+    std::vector<GeneratorVariablePtr> mStates;
+    std::vector<GeneratorVariablePtr> mVariables;

     GeneratorProfilePtr mProfile = std::make_shared<libcellml::GeneratorProfile>();

@@ -1200,6 +1202,8 @@
     mEquations.clear();

     mVariableOfIntegration = nullptr;
+    mStates.clear();
+    mVariables.clear();

     mNeedMin = false;
     mNeedMax = false;
@@ -2201,6 +2205,8 @@
     mPimpl->mEquations = rhs.mPimpl->mEquations;

     mPimpl->mVariableOfIntegration = rhs.mPimpl->mVariableOfIntegration;
+    mPimpl->mStates = rhs.mPimpl->mStates;
+    mPimpl->mVariables = rhs.mPimpl->mVariables;

     mPimpl->mProfile = rhs.mPimpl->mProfile;

@@ -2282,15 +2288,7 @@
         return 0;
     }

-    size_t res = 0;
-
-    for (const auto &internalVariable : mPimpl->mInternalVariables) {
-        if (internalVariable->mType == GeneratorVariablePriv::Type::STATE) {
-            ++res;
-        }
-    }
-
-    return res;
+    return mPimpl->mStates.size();
 }

 size_t Generator::variableCount() const
@@ -2299,18 +2297,7 @@
         return 0;
     }

-    size_t res = 0;
-
-    for (const auto &internalVariable : mPimpl->mInternalVariables) {
-        if ((internalVariable->mType == GeneratorVariablePriv::Type::ALGEBRAIC)
-            || (internalVariable->mType == GeneratorVariablePriv::Type::CONSTANT)
-            || (internalVariable->mType == GeneratorVariablePriv::Type::COMPUTED_TRUE_CONSTANT)
-            || (internalVariable->mType == GeneratorVariablePriv::Type::COMPUTED_VARIABLE_BASED_CONSTANT)) {
-            ++res;
-        }
-    }
-
-    return res;
+    return mPimpl->mVariables.size();
 }

 VariablePtr Generator::variableOfIntegration() const
@@ -2324,16 +2311,20 @@

 GeneratorVariablePtr Generator::state(size_t index) const
 {
-    (void)index;
-
-    return {};
+    if (!mPimpl->hasValidModel() || (index >= mPimpl->mStates.size())) {
+        return {};
+    }
+
+    return mPimpl->mStates[index];
 }

 GeneratorVariablePtr Generator::variable(size_t index) const
 {
-    (void)index;
-
-    return {};
+    if (!mPimpl->hasValidModel() || (index >= mPimpl->mVariables.size())) {
+        return {};
+    }
+
+    return mPimpl->mVariables[index];
 }

 std::string Generator::code() const


Rearrange glfw window context calls.

Rearrange glfw window context calls.

--- src/glfw_main.cpp
+++ src/glfw_main.cpp
@@ -691,27 +691,6 @@
         exit(EXIT_FAILURE);
     }

-    glfwMakeContextCurrent(l_Window);
-    glfwSetWindowSizeCallback(l_Window, resize);
-    glfwSetMouseButtonCallback(l_Window, mouseDown);
-    glfwSetCursorPosCallback(l_Window, mouseMove);
-    glfwSetScrollCallback(l_Window, mouseWheel);
-    glfwSetCursorPosCallback(l_Window, mousePassive);
-    glfwSetKeyCallback(l_Window, keyboard);
-
-    // Don't forget to initialize Glew, turn glewExperimental on to
-    // avoid problems fetching function pointers...
-    glewExperimental = GL_TRUE;
-    const GLenum l_Result = glewInit();
-    if (l_Result != GLEW_OK)
-    {
-        printf("glewInit() error.\n");
-        LOG_INFO("glewInit() error.\n");
-        exit(EXIT_FAILURE);
-    }
-
-    printGLContextInfo(l_Window);
-
     // Required for SDK rendering (to do the buffer swap on its own)
 #ifdef USE_OCULUSSDK
   #if defined(_WIN32)
@@ -720,6 +699,27 @@
     g_app.setWindow(glfwGetX11Window(l_Window), glfwGetX11Display());
   #endif
 #endif //USE_OCULUSSDK
+
+    glfwMakeContextCurrent(l_Window);
+    glfwSetWindowSizeCallback(l_Window, resize);
+    glfwSetMouseButtonCallback(l_Window, mouseDown);
+    glfwSetCursorPosCallback(l_Window, mouseMove);
+    glfwSetScrollCallback(l_Window, mouseWheel);
+    glfwSetCursorPosCallback(l_Window, mousePassive);
+    glfwSetKeyCallback(l_Window, keyboard);
+
+    // Don't forget to initialize Glew, turn glewExperimental on to
+    // avoid problems fetching function pointers...
+    glewExperimental = GL_TRUE;
+    const GLenum l_Result = glewInit();
+    if (l_Result != GLEW_OK)
+    {
+        printf("glewInit() error.\n");
+        LOG_INFO("glewInit() error.\n");
+        exit(EXIT_FAILURE);
+    }
+
+    printGLContextInfo(l_Window);

 #ifdef USE_ANTTWEAKBAR
   #ifdef USE_CORE_CONTEXT


Fix mouse wheel scrolling in aux window's AntTweakbar.

--- src/glfw_main.cpp
+++ src/glfw_main.cpp
@@ -486,8 +486,10 @@

 void mouseWheel_Aux(GLFWwindow* pWindow, double x, double y)
 {
-#ifdef USE_ANTTWEAKBAR
-    int ant = TwEventMouseWheelGLFW(static_cast<int>(x));
+#ifdef USE_ANTTWEAKBAR
+    static int scrollpos = 0;
+    scrollpos += static_cast<int>(y);
+    int ant = TwEventMouseWheelGLFW(scrollpos);
     if (ant != 0)
         return;
 #endif


update unique label set

update unique label set

--- src/gspan_init.cc
+++ src/gspan_init.cc
@@ -70,6 +70,7 @@
 		uint32_t edge_id = 0;
 		double total_edge = 0.0f;
 		double density = 0.0f;
+		std::vector<std::set<uint32_t> > edge_label_set;

 		for (size_t i = 0; i < input.size(); ++i) {
 			if (input[i][0] == "t") {
@@ -85,6 +86,8 @@
 					graph.clear();
 					vertice.clear();
 				}
+
+				edge_label_set.resize(edge_label_set.size() + 1);

 				char indicator, seperator;
 				uint32_t idx;
@@ -118,6 +121,9 @@
 				sscanf(input[i][2].c_str(), "%u", &to);
 				sscanf(input[i][3].c_str(), "%u", &label);

+				//add label
+				edge_label_set[graph_idx - 1].insert(label);
+
 				struct edge_t edge;
 				edge.from = from;
 				edge.to = to;
@@ -142,6 +148,28 @@

 		printf("average graph size : %f\n", total_edge / database->size());
 		printf("average density: %f\n", density / database->size());
+		for (size_t i = 0; i < graph_idx; ++i) {
+			for (size_t j = i + 1; j < graph_idx; ++j) {
+				printf("unique edge label set of %zu and %zu \n", i, j);
+				printf("%zu : \n", i);
+				for (std::set<uint32_t>::iterator edge_iterator = edge_label_set[i].begin();
+						edge_iterator != edge_label_set[i].end(); ++edge_iterator) {
+					if (edge_label_set[j].find(*edge_iterator) == edge_label_set[j].end()) {
+						printf("%zu ", *edge_iterator);
+					}
+				}
+				printf("\n");
+
+				printf("%zu : \n", j);
+				for (std::set<uint32_t>::iterator edge_iterator = edge_label_set[j].begin();
+						edge_iterator != edge_label_set[j].end(); ++edge_iterator) {
+					if (edge_label_set[i].find(*edge_iterator) == edge_label_set[i].end()) {
+						printf("%zu ", *edge_iterator);
+					}
+				}
+				printf("\n");
+			}
+		}

 		_m_nsupport = static_cast<uint32_t>(graph_idx * _m_support);


am 8c212ebe: Merge "Only use  if it exists and is writable."

# Via Elliott Hughes (1) and Gerrit Code Review (1)
* commit '8c212ebe53bb2baab3575f03069016f1fb11e449':
  Only use $EXTERNAL_STORAGE if it exists and is writable.

--- src/gtest-port.cc
+++ src/gtest-port.cc
@@ -508,16 +508,23 @@
 // ANDROID
 #elif GTEST_OS_LINUX_ANDROID
     // Get $EXTERNAL_STORAGE from the environment, since this can change
-    // for shell users (fallback is still /sdcard, but this probably will
-    // never work properly again).
-    ::std::string external_storage = "/sdcard";
+    // for shell users (fallback is /data/nativetest, for emulator users).
+    ::std::string external_storage = "/data/nativetest";
     char *sdcard_path = getenv("EXTERNAL_STORAGE");
-    if (sdcard_path) {
-      external_storage = sdcard_path;
+    if (sdcard_path != NULL) {
+      // Check that $EXTERNAL_STORAGE exists and is writable before trying to use it.
+      struct stat sb;
+      if (stat(sdcard_path, &sb) != -1) {
+        if ((sb.st_mode & S_IWUSR) != 0) {
+          external_storage = sdcard_path;
+        }
+      }
     }
     external_storage += "/captured_stderr.XXXXXX";
     char *name_template = strdup(external_storage.c_str());
     const int captured_fd = mkstemp(name_template);
+    GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
+                                    << name_template;
     filename_ = name_template;
     free(name_template);
     name_template = NULL;


uORB: Header cleanup

uORB: Header cleanup

--- src/modules/uORB/uORB_tests/uORBTest_UnitTest.hpp
+++ src/modules/uORB/uORB_tests/uORBTest_UnitTest.hpp
@@ -36,6 +36,7 @@
 #include "../uORBCommon.hpp"
 #include "../uORB.h"
 #include <px4_time.h>
+#include <px4_tasks.h>

 struct orb_test {
 	int val;


src/ios_posix.cpp: Added event creation

src/ios_posix.cpp: Added event creation

--- src/ios_posix.cpp
+++ src/ios_posix.cpp
@@ -291,6 +291,92 @@

 	friend class PosixIOPort;
 };
+
+/*-----------------------------------------------------------------------------
+Event creation
+-----------------------------------------------------------------------------*/
+
+boost::shared_ptr<Event> PosixIOPort::write(
+		boost::shared_ptr<ProcessInvoker> proc,
+		boost::shared_ptr<std::vector<unsigned char> >& pdat) {
+	if(!writeable) {
+		throw IOError(
+			std::string("Attempt to write to non-writeable port.")
+		);
+	}
+	/*first check if the relevant FD is immediately writeable*/
+	/*On most *nixes, disk filesystems are assumed to be so fast
+	that they never block (never mind that in reality they do) and
+	thus select()/poll() would immediately reply with "ready".
+	Trying to ask the OS to decently poll this just don't work.
+	The specs thus make a proviso that '<bc>write-event can
+	return with the write actually done, reducing the message-
+	passing overhead to the central I/O process.
+	*/
+	int rv;
+	#ifdef USE_POSIX_SELECT
+		fd_set rd, wr, exc; FD_ZERO(&rd); FD_ZERO(&wr); FD_ZERO(&exc);
+		FD_SET(fd, &wr);
+		struct timeval tm; tm.tv_usec = 0; tm.tv_sec = 0;
+	#endif
+	do {
+		errno = 0;
+		#ifdef USE_POSIX_SELECT
+			rv = ::select(fd + 1, &rd, &wr, &exc, &tm);
+		#endif
+	} while(rv < 0 && errno == EINTR);
+	/*We ignore errors on the select()/poll().  If errors occured,
+	just assume that we can't immediately write.
+	*/
+	/*if select()/poll() succeeded*/
+	if(rv == 1
+		#ifdef USE_POSIX_SELECT
+			&& FD_ISSET(fd, &wr)
+		#endif
+			) {
+		/*can write: try writing*/
+		ssize_t wrv;
+		size_t len = pdat->size();
+		unsigned char* dat = &((*pdat)[0]);
+		do {
+			errno = 0;
+			wrv = ::write(fd, (void*) dat, len);
+		} while(wrv < 0 && errno == EINTR);
+		/*handle errors except EAGAIN; for EAGAIN, just fall through*/
+		if(wrv < 0 && errno != EAGAIN) {
+			/*TODO*/
+		}
+		if(wrv == len) {
+			/*complete write; now we can just exit with NULL*/
+			return boost::shared_ptr<Event>();
+		}
+		if(wrv > 0) {
+			/*incomplete write; schedule the rest of the
+			data for event.
+			*/
+			boost::shared_ptr<WriteEvent> rv(
+				new WriteEvent(
+					proc,
+					*this,
+					pdat
+				)
+			);
+			/*start at point that was written to*/
+			rv->start_write = wrv;
+			return boost::static_pointer_cast<Event>(rv);
+		}
+	}
+	/*if we fell through to here, it means we were not able to
+	write at all.  So return an event.
+	*/
+	return boost::shared_ptr<Event>(
+		new WriteEvent(
+			proc,
+			*this,
+			pdat
+		)
+	);
+}

 /*-----------------------------------------------------------------------------
 Core code


Remove leftover dead code from command line parsing

(...and relocate the initialization of `_argc` where it fits
better.)

IoT.js-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

--- src/iotjs_env.cpp
+++ src/iotjs_env.cpp
@@ -60,10 +60,6 @@
     return false;
   }

-  // Second argument should be IoT.js application.
-  char* app = argv[1];
-  _argc = 2;
-
   // Parse IoT.js command line arguments.
   int i = 2;
   while (i < argc) {
@@ -83,6 +79,7 @@
   }

   // Remaining arguments are for application.
+  _argc = 2;
   _argv = new char*[_argc + argc - i];
   _argv[0] = argv[0];
   _argv[1] = argv[1];


consistency_level: make it more const correct

Message-Id: <a384c816065c159a7c72fb2c8581cddf0d222402@scylladb.com>

--- db/consistency_level.hh
+++ db/consistency_level.hh
@@ -71,7 +71,7 @@
 bool is_local(gms::inet_address endpoint);

 template<typename Range>
-inline size_t count_local_endpoints(Range& live_endpoints) {
+inline size_t count_local_endpoints(const Range& live_endpoints) {
     return std::count_if(live_endpoints.begin(), live_endpoints.end(), is_local);
 }

@@ -98,7 +98,7 @@
 template <typename Range, typename PendingRange = std::array<gms::inet_address, 0>>
 inline std::unordered_map<sstring, dc_node_count> count_per_dc_endpoints(
         keyspace& ks,
-        Range& live_endpoints,
+        const Range& live_endpoints,
         const PendingRange& pending_endpoints = std::array<gms::inet_address, 0>()) {
     using namespace locator;

@@ -138,7 +138,7 @@
 inline bool assure_sufficient_live_nodes_each_quorum(
         consistency_level cl,
         keyspace& ks,
-        Range& live_endpoints,
+        const Range& live_endpoints,
         const PendingRange& pending_endpoints) {
     using namespace locator;

@@ -165,7 +165,7 @@
 inline void assure_sufficient_live_nodes(
         consistency_level cl,
         keyspace& ks,
-        Range& live_endpoints,
+        const Range& live_endpoints,
         const PendingRange& pending_endpoints = std::array<gms::inet_address, 0>()) {
     size_t need = block_for(ks, cl);


ARM32: fix switch jump table generation bug for RyuJIT

Signed-off-by: Petr Bred <240e5f80fc72498dce662d23121702ab806c37e1@gmail.com>

--- src/jit/lower.cpp
+++ src/jit/lower.cpp
@@ -549,6 +549,21 @@
     flowList* oldEdge = comp->fgRemoveRefPred(jumpTab[jumpCnt - 1], afterDefaultCondBlock);
     comp->fgAddRefPred(jumpTab[jumpCnt - 1], originalSwitchBB, oldEdge);

+    bool useJumpSequence = jumpCnt < minSwitchTabJumpCnt;
+
+#if defined(_TARGET_UNIX_) && defined(_TARGET_ARM_)
+    // Force using an inlined jumping instead switch table generation.
+    // Switch jump table is generated with incorrect values in CoreRT case,
+    // so any large switch will crash after loading to PC any such value.
+    // I think this is due to the fact that we use absolute addressing
+    // instead of relative. But in CoreRT is used as a rule relative
+    // addressing when we generate an executable.
+    // This bug is also present in Legacy JIT.
+    // See also https://github.com/dotnet/coreclr/issues/13194
+    // Also https://github.com/dotnet/coreclr/pull/13197
+    useJumpSequence = useJumpSequence || comp->IsTargetAbi(CORINFO_CORERT_ABI);
+#endif // defined(_TARGET_UNIX_) && defined(_TARGET_ARM_)
+
     // If we originally had 2 unique successors, check to see whether there is a unique
     // non-default case, in which case we can eliminate the switch altogether.
     // Note that the single unique successor case is handled above.
@@ -594,7 +609,7 @@
     // If the number of possible destinations is small enough, we proceed to expand the switch
     // into a series of conditional branches, otherwise we follow the jump table based switch
     // transformation.
-    else if ((jumpCnt < minSwitchTabJumpCnt) || comp->compStressCompile(Compiler::STRESS_SWITCH_CMP_BR_EXPANSION, 50))
+    else if (useJumpSequence || comp->compStressCompile(Compiler::STRESS_SWITCH_CMP_BR_EXPANSION, 50))
     {
         // Lower the switch into a series of compare and branch IR trees.
         //


use the document schema instead the index schema to get the property type info

--- source/core/aggregator-manager/IndexWorker.cpp
+++ source/core/aggregator-manager/IndexWorker.cpp
@@ -707,13 +707,15 @@
         if(documentManager_->getPropertyValue(docid, propname, oldvalue))
         {
             tempPropertyConfig.propertyName_ = propname;
-            IndexBundleSchema::iterator iter = bundleConfig_->indexSchema_.find(tempPropertyConfig);
-            bool isIndexSchema = (iter != bundleConfig_->indexSchema_.end());
+            //IndexBundleSchema::iterator iter = bundleConfig_->indexSchema_.find(tempPropertyConfig);
+            DocumentSchema::const_iterator iter = bundleConfig_->documentSchema_.find(tempPropertyConfig);
+
+            bool isInSchema = (iter != bundleConfig_->documentSchema_.end());
             int inplace_type = 0;
             // determine how to do the inplace operation by different property type.
-            if(isIndexSchema)
-            {
-                switch(iter->getType())
+            if(isInSchema)
+            {
+                switch(iter->propertyType_)
                 {
                 case INT8_PROPERTY_TYPE:
                 case INT16_PROPERTY_TYPE:
@@ -737,7 +739,7 @@
                     break;
                 default:
                     {
-                        LOG(INFO) << "property type: " << iter->getType() << " does not support the inplace update." << std::endl;
+                        LOG(INFO) << "property type: " << iter->propertyType_ << " does not support the inplace update." << std::endl;
                         return false;
                     }
                 }


[RyuJIT/ARM32] Fix comment and ifdef condition

Fix comment for elif and endif
Apply fix for RyuJIT/ARM32 only (not for LegacyJIT/ARM32)

--- src/jit/morph.cpp
+++ src/jit/morph.cpp
@@ -2048,7 +2048,7 @@
     if (varTypeIsStruct(type))
     {

-#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || defined(_TARGET_ARM_)
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || (!defined(LEGACY_BACKEND) && defined(_TARGET_ARM_))

 #ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING

@@ -2112,7 +2112,7 @@
 #endif // FEATURE_MULTIREG_ARGS
         }

-#else // not (_TARGET_AMD64_ or _TARGET_ARM64_)
+#else // not (_TARGET_AMD64_ or _TARGET_ARM64_ or (!LEGACY_BACKEND and _TARGET_ARM_))

         // other targets, we pass the struct by value
         assert(varTypeIsStruct(type));
@@ -2123,7 +2123,7 @@
         // gtNewObjNode will set the GTF_EXCEPT flag if this is not a local stack object.
         arg = gtNewObjNode(lvaGetStruct(tmpVarNum), addrNode);

-#endif // not (_TARGET_AMD64_ or _TARGET_ARM64_)
+#endif // not (_TARGET_AMD64_ or _TARGET_ARM64_ or (!LEGACY_BACKEND and _TARGET_ARM_))

     } // (varTypeIsStruct(type))


INTEGRATION: CWS tune04 (1.47.146); FILE MERGED 2004/06/11 11:59:20 cmc 1.47.146.1: #i29636# turn global objects into local static data protected with swishy double-locked templated template

--- svtools/source/filter.vcl/filter/filter.cxx
+++ svtools/source/filter.vcl/filter/filter.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: filter.cxx,v $
  *
- *  $Revision: 1.49 $
+ *  $Revision: 1.50 $
  *
- *  last change: $Author: hjs $ $Date: 2004-06-25 16:38:52 $
+ *  last change: $Author: hjs $ $Date: 2004-06-25 17:26:21 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -142,6 +142,9 @@
 #ifndef _COMPHELPER_PROCESSFACTORY_HXX_
 #include <comphelper/processfactory.hxx>
 #endif
+#ifndef INCLUDED_RTL_INSTANCE_HXX
+#include <rtl/instance.hxx>
+#endif

 #include "SvFilterOptionsDialog.hxx"

@@ -1094,7 +1097,7 @@

 // ------------------------------------------------------------------------

-static ImpFilterLibCache aCache;
+namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }

 // -----------------
 // - GraphicFilter -
@@ -1634,8 +1637,9 @@

         // find first filter in filter pathes
         xub_StrLen i, nTokenCount = aFilterPath.GetTokenCount( ';' );
+        ImpFilterLibCache &rCache = Cache::get();
         for( i = 0; ( i < nTokenCount ) && ( pFilter == NULL ); i++ )
-            pFilter = aCache.GetFilter( aFilterPath, aFilterName );
+            pFilter = rCache.GetFilter( aFilterPath, aFilterName );
         if( !pFilter )
             nStatus = GRFILTER_FILTERERROR;
         else
@@ -2086,46 +2090,6 @@
 BOOL GraphicFilter::DoImportDialog( Window* pWindow, USHORT nFormat )
 {
     return sal_True;
-/*
-    String  aFilterName( pConfig->GetImportFilterName( nFormat ) );
-    BOOL    bRet = FALSE;
-
-    if ( pConfig->IsImportInternalFilter( nFormat ) )
-    {
-        if( ( aFilterName.EqualsIgnoreCaseAscii( IMP_BMP ) ) || ( aFilterName.EqualsIgnoreCaseAscii( IMP_SVMETAFILE ) ) )
-        {
-            // Bitmaps und SV-MetaFiles
-        }
-        else if( aFilterName.EqualsIgnoreCaseAscii( IMP_WMF ) )
-        {
-            // Import-Filter fuer WMF
-        }
-        else if( ( aFilterName.EqualsIgnoreCaseAscii( IMP_SVSGF ) ) || ( aFilterName.EqualsIgnoreCaseAscii( IMP_SVSGV ) ) )
-        {
-            // StarDraw- und StarWriter-Filter
-        }
-    }
-    else
-    {
-        ImpFilterLibCacheEntry* pFilter = NULL;
-
-        // find first filter in filter pathes
-        xub_StrLen i, nTokenCount = aFilterPath.GetTokenCount( ';' );
-        for( i = 0; ( i < nTokenCount ) && ( pFilter == NULL ); i++ )
-            pFilter = aCache.GetFilter( aFilterPath.GetToken( i ), aFilterName );
-        if( pFilter )
-        {
-            PFilterDlgCall pFunc = pFilter->GetImportDlgFunction();
-            // Dialog in DLL ausfuehren
-            if( pFunc )
-            {
-                FltCallDialogParameter aFltCallDlgPara( pWindow, NULL, FUNIT_MM );
-                bRet = (*pFunc)( aFltCallDlgPara );
-            }
-        }
-    }
-    return bRet;
-*/
 }

 // ------------------------------------------------------------------------


fix typo

fix typo

--- dune/gdt/local/integrands/elliptic-ipdg.hh
+++ dune/gdt/local/integrands/elliptic-ipdg.hh
@@ -31,8 +31,8 @@
  *
  *              For the choice of penalization and the role of the user input see Epshteyn, Riviere (2007):
  *              "Estimation of penalty parameters for symmetric interior penalty Galerkin methods"
- *              For the coice of the weighting see Ern, Stephansen, Zunino (2007): "A discontinuous Galerkin method with
- *              weighted averages for advection-diffusion equations with locally small and anisotropic diffusivity"
+ *              For the choice of the weighting see Ern, Stephansen, Zunino (2007): "A discontinuous Galerkin method
+ *              with weighted averages for advection-diffusion equations with locally small and anisotropic diffusivity"
  */
 namespace LocalEllipticIpdgIntegrands {


read and display cvmfsbundles file as JSON

--- cvmfs/sync_mediator.cc
+++ cvmfs/sync_mediator.cc
@@ -19,6 +19,7 @@
 #include "directory_entry.h"
 #include "fs_traversal.h"
 #include "hash.h"
+#include "json_document.h"
 #include "publish/repository.h"
 #include "smalloc.h"
 #include "sync_union.h"
@@ -97,6 +98,22 @@
   // .cvmfsbundles file type
   if(entry->isBundleSpec()){
     printf("cvmfsbundles file found. filename: %s\n", (entry->GetRelativePath()).c_str());
+
+    std::string json_string;
+
+    int fd = open (entry->GetUnionPath().c_str(), O_RDONLY);
+    if(fd >= 0) {
+      if(SafeReadToString(fd, &json_string)) {
+        printf("creating JSON\n");
+        JsonDocument* json = JsonDocument::Create(json_string);
+        printf("content found:\n");
+        printf("%s\n", (json->PrintPretty()).c_str());
+      }
+    }
+    else{
+      printf("Could not open file: %s\n", entry->GetUnionPath().c_str());
+    }
+
     // for now using AddFile()
     AddFile(entry);
     return;


Removed the automatic registration of GraphicsContextImplementation.

git-svn-id: 23b6355f2bb369032457de4eb5f713ee134f73a8@6001 16af8721-9629-0410-8352-f15c8da7e697

--- src/osgProducer/GraphicsContextImplementation.cpp
+++ src/osgProducer/GraphicsContextImplementation.cpp
@@ -18,6 +18,7 @@

 using namespace osgProducer;

+#if 0
 namespace osgProducer
 {
     struct MyWindowingSystemInterface : public osg::GraphicsContext::WindowingSystemInterface
@@ -58,7 +59,7 @@

     RegisterWindowingSystemInterfaceProxy createWindowingSystemInterfaceProxy;
 };
-
+#endif

 GraphicsContextImplementation::GraphicsContextImplementation(Traits* traits)


Fix of #5606 (Force invalidation when object settings are deleted)

--- src/slic3r/GUI/GUI_ObjectList.cpp
+++ src/slic3r/GUI/GUI_ObjectList.cpp
@@ -2393,6 +2393,8 @@
         m_config->set_key_value("extruder", new ConfigOptionInt(extruder));
     if (is_layer_settings)
         m_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
+
+    changed_object();
 }

 void ObjectList::del_instances_from_object(const int obj_idx)


working on sn

working on sn

Signed-off-by: Nikolaj Bjorner <0654de5c81f471cf6f3d20a913eab9a374626acd@microsoft.com>

--- src/smt/theory_pb.cpp
+++ src/smt/theory_pb.cpp
@@ -100,6 +100,9 @@
             else if (n == 1) {
                 out.push_back(xs[0]);
             }
+            else if (n == 2) {
+                merge(t, 1, xs, 1, xs+1, out);
+            }
             else {
                 literal_vector out1, out2;
                 unsigned l = n/2;  // TBD
@@ -112,7 +115,30 @@
             }
         }

-        void smerge(cmp_t t, );
+        void smerge(cmp_t t,
+                    unsigned a, literal const* as,
+                    unsigned b, literal const* bs,
+                    unsigned c,
+                    literal_vector& out) {
+            if (a == 1 && b == 1 && c == 1) {
+                literal y = fresh();
+                add_clause(~as[0], y);
+                add_clause(~bs[0], y);
+                out.push_back(y);
+            }
+            else if (a > c) {
+                smerge(t, a - c, as, b, bs, c, out);
+            }
+            else if (b > c) {
+                smerge(t, a, as, b - c, bs, c, out);
+            }
+            else if (a + b <= c) {
+                merge(t, a, as, b, bs, out);
+            }
+            else if (a <= c && b <= c && even(c)) {
+
+            }
+        }
     };
 #endif
     class pb_lit_rewriter_util {


[spaces.continuouslagrange.base] fix (clang) compile error

--- dune/gdt/spaces/continuouslagrange/base.hh
+++ dune/gdt/spaces/continuouslagrange/base.hh
@@ -10,6 +10,7 @@

 #include <dune/common/typetraits.hh>
 #include <dune/common/dynvector.hh>
+#include <dune/common/version.hh>

 #include <dune/stuff/common/disable_warnings.hh>
 #if DUNE_VERSION_NEWER(DUNE_COMMON, 3, 9) // EXADUNE


enforce handle_hardlinks_ in related methods

--- cvmfs/sync_mediator.cc
+++ cvmfs/sync_mediator.cc
@@ -192,6 +192,8 @@
   params_->spooler->WaitForUpload();

   if (!hardlink_queue_.empty()) {
+    assert(handle_hardlinks_);
+
     LogCvmfs(kLogPublish, kLogStdout, "Processing hardlinks...");
     params_->spooler->UnregisterListeners();
     params_->spooler->RegisterListener(&SyncMediator::PublishHardlinksCallback,
@@ -247,6 +249,8 @@

 void SyncMediator::InsertHardlink(const SyncItem &entry) {
+  assert(handle_hardlinks_);
+
   uint64_t inode = entry.GetUnionInode();
   LogCvmfs(kLogPublish, kLogVerboseMsg, "found hardlink %"PRIu64" at %s",
            inode, entry.GetUnionPath().c_str());
@@ -270,6 +274,8 @@
   // As we are looking through all files in one directory here, there might be
   // completely untouched hardlink groups, which we can safely skip.
   // Finally we have to see if the hardlink is already part of this group
+
+  assert(handle_hardlinks_);

   if (entry.GetUnionLinkcount() < 2)
     return;
@@ -312,6 +318,8 @@
  * or edited ones.
  */
 void SyncMediator::CompleteHardlinks(const SyncItem &entry) {
+  assert(handle_hardlinks_);
+
   // If no hardlink in this directory was changed, we can skip this
   if (GetHardlinkMap().empty())
     return;
@@ -660,6 +668,8 @@
  * added to the catalogs.
  */
 void SyncMediator::AddLocalHardlinkGroups(const HardlinkGroupMap &hardlinks) {
+  assert(handle_hardlinks_);
+
   for (HardlinkGroupMap::const_iterator i = hardlinks.begin(),
        iEnd = hardlinks.end(); i != iEnd; ++i)
   {
@@ -693,6 +703,8 @@

 void SyncMediator::AddHardlinkGroup(const HardlinkGroup &group) {
+  assert(handle_hardlinks_);
+
   // Create a DirectoryEntry list out of the hardlinks
   catalog::DirectoryEntryBaseList hardlinks;
   for (SyncItemList::const_iterator i = group.hardlinks.begin(),


mdbx-test: refine 'ttl' testcase.

mdbx-test: refine 'ttl' testcase.

Change-Id: Ic4d759cfa29496bd46fa50fef1e974847b52bb41

--- test/ttl.cc
+++ test/ttl.cc
@@ -14,12 +14,12 @@

 #include "test.h"
 #include <cmath>
-#include <queue>
+#include <deque>

 static unsigned edge2window(uint64_t edge, unsigned window_max) {
   const double rnd = u64_to_double1(bleach64(edge));
   const unsigned window = window_max - std::lrint(std::pow(window_max, rnd));
-  return window - (window > 0);
+  return window;
 }

 static unsigned edge2count(uint64_t edge, unsigned count_max) {
@@ -33,9 +33,7 @@

   txn_begin(false);
   MDBX_dbi dbi = db_table_open(true);
-  int rc = mdbx_drop(txn_guard.get(), dbi, false);
-  if (unlikely(rc != MDBX_SUCCESS))
-    failure_perror("mdbx_drop(delete=false)", rc);
+  db_table_clear(dbi);
   txn_end(false);

   /* LY: тест "эмуляцией time-to-live":
@@ -63,7 +61,8 @@
   log_info("ttl: using `batch_read` value %u for window_max", window_max);
   log_info("ttl: using `batch_write` value %u for count_max", count_max);

-  uint64_t seed = prng64_map2_white(config.params.keygen.seed) + config.actor_id;
+  uint64_t seed =
+      prng64_map2_white(config.params.keygen.seed) + config.actor_id;
   keyvalue_maker.setup(config.params, config.actor_id, 0 /* thread_number */);
   key = keygen::alloc(config.params.keylen_max);
   data = keygen::alloc(config.params.datalen_max);
@@ -71,37 +70,44 @@
                                     ? MDBX_NODUPDATA
                                     : MDBX_NODUPDATA | MDBX_NOOVERWRITE;

-  std::queue<std::pair<uint64_t, unsigned>> fifo;
+  std::deque<std::pair<uint64_t, unsigned>> fifo;
   uint64_t serial = 0;
   while (should_continue()) {
     if (!txn_guard)
       txn_begin(false);
-    const uint64_t salt = prng64_white(seed)/* mdbx_txn_id(txn_guard.get()) */;
+    const uint64_t salt = prng64_white(seed) /* mdbx_txn_id(txn_guard.get()) */;

-    const unsigned window = edge2window(salt, window_max);
-    log_trace("ttl: window %u at %" PRIu64, window, salt);
-    while (fifo.size() > window) {
-      uint64_t tail_serial = fifo.front().first;
-      const unsigned tail_count = fifo.front().second;
-      log_trace("ttl: pop-tail (serial %" PRIu64 ", count %u)", tail_serial,
-                tail_count);
-      fifo.pop();
-      for (unsigned n = 0; n < tail_count; ++n) {
-        log_trace("ttl: remove-tail %" PRIu64, serial);
-        generate_pair(tail_serial);
-        int err = mdbx_del(txn_guard.get(), dbi, &key->value, &data->value);
-        if (unlikely(err != MDBX_SUCCESS))
-          failure_perror("mdbx_del(tail)", err);
-        if (unlikely(!keyvalue_maker.increment(tail_serial, 1)))
-          failure("ttl: unexpected key-space overflow on the tail");
+    const unsigned window_width = edge2window(salt, window_max);
+    const unsigned head_count = edge2count(salt, count_max);
+    log_info("ttl: step #%zu (serial %" PRIu64
+             ", window %u, count %u) salt %" PRIu64,
+             nops_completed, serial, window_width, head_count, salt);
+
+    if (window_width) {
+      while (fifo.size() > window_width) {
+        uint64_t tail_serial = fifo.back().first;
+        const unsigned tail_count = fifo.back().second;
+        log_trace("ttl: pop-tail (serial %" PRIu64 ", count %u)", tail_serial,
+                  tail_count);
+        fifo.pop_back();
+        for (unsigned n = 0; n < tail_count; ++n) {
+          log_trace("ttl: remove-tail %" PRIu64, serial);
+          generate_pair(tail_serial);
+          int err = mdbx_del(txn_guard.get(), dbi, &key->value, &data->value);
+          if (unlikely(err != MDBX_SUCCESS))
+            failure_perror("mdbx_del(tail)", err);
+          if (unlikely(!keyvalue_maker.increment(tail_serial, 1)))
+            failure("ttl: unexpected key-space overflow on the tail");
+        }
       }
+    } else {
+      log_trace("ttl: purge state");
+      db_table_clear(dbi);
+      fifo.clear();
     }

     txn_restart(false, false);
-    const unsigned head_count = edge2count(salt, count_max);
-    fifo.push(std::make_pair(serial, head_count));
-    log_trace("ttl: push-head (serial %" PRIu64 ", count %u)", serial,
-              head_count);
+    fifo.push_front(std::make_pair(serial, head_count));

     for (unsigned n = 0; n < head_count; ++n) {
       log_trace("ttl: insert-head %" PRIu64, serial);


natus warnings

natus warnings

--- applications/mne_scan/plugins/natus/natus.cpp
+++ applications/mne_scan/plugins/natus/natus.cpp
@@ -72,9 +72,9 @@
 : m_iSamplingFreq(2048)
 , m_iNumberChannels(46)
 , m_iSamplesPerBlock(256)
+, m_qStringResourcePath(qApp->applicationDirPath()+"/resources/mne_scan/plugins/natus/")
+, m_pRMTSA_Natus(PluginOutputData<RealTimeMultiSampleArray>::create(this, "Natus", "EEG output data"))
 , m_pFiffInfo(QSharedPointer<FiffInfo>::create())
-, m_pRMTSA_Natus(PluginOutputData<RealTimeMultiSampleArray>::create(this, "Natus", "EEG output data"))
-, m_qStringResourcePath(qApp->applicationDirPath()+"/resources/mne_scan/plugins/natus/")
 {
     m_pRMTSA_Natus->data()->setName(this->getName());//Provide name to auto store widget settings
 }
@@ -93,7 +93,7 @@

 QSharedPointer<IPlugin> Natus::clone() const
 {
-    QSharedPointer<Natus> pNatusClone(new Natus());
+    QSharedPointer<IPlugin> pNatusClone(new Natus());
     return pNatusClone;
 }


BUG: Removed warnings

BUG: Removed warnings

--- Widgets/vtkContourWidget.cxx
+++ Widgets/vtkContourWidget.cxx
@@ -30,7 +30,7 @@
 #include <vtkstd/algorithm>
 #include <vtkstd/iterator>

-vtkCxxRevisionMacro(vtkContourWidget, "1.3");
+vtkCxxRevisionMacro(vtkContourWidget, "1.4");
 vtkStandardNewMacro(vtkContourWidget);

 //----------------------------------------------------------------------
@@ -173,12 +173,6 @@
   vtkContourRepresentation *rep =
     reinterpret_cast<vtkContourRepresentation*>(self->WidgetRep);

-  int X = self->Interactor->GetEventPosition()[0];
-  int Y = self->Interactor->GetEventPosition()[1];
-  double pos[2];
-  pos[0] = X;
-  pos[1] = Y;
-
   if ( self->WidgetState ==  vtkContourWidget::Define &&
        rep->GetNumberOfNodes() >= 1 )
     {


[functions.ESV2007] refs #10

[functions.ESV2007] refs #10

--- dune/stuff/playground/functions/ESV2007.hh
+++ dune/stuff/playground/functions/ESV2007.hh
@@ -95,8 +95,8 @@
         RangeFieldType minimum = std::numeric_limits< RangeFieldType >::max();
         const auto local_diffusion_factor = diffusion_factor.local_function(ent);
         const size_t ord = local_diffusion_factor->order();
-        assert(ord < std::numeric_limits< int >::max());
-        const auto& quadrature = QuadratureRules< DomainFieldType, dimDomain >::rule(ent.type(), int(ord));
+        const auto& quadrature = QuadratureRules< DomainFieldType, dimDomain >::rule(ent.type(),
+                                                                                boost::numeric_cast< int >(ord));
         const auto quad_point_it_end = quadrature.end();
         for (auto quad_point_it = quadrature.begin(); quad_point_it != quad_point_it_end; ++quad_point_it) {
           local_diffusion_factor->evaluate(quad_point_it->position(), tmp_value);


Change to generalized Feature/Descriptor/Matcher interfaces and use of SIFT feature detector. Add color visualization for depth/disparity.

--- src/sp_navigation.cpp
+++ src/sp_navigation.cpp
@@ -5,6 +5,7 @@
 #include <opencv2/core/core.hpp>
 #include <opencv2/video/tracking.hpp>
 #include <opencv2/contrib/contrib.hpp>
+#include <opencv2/nonfree/nonfree.hpp>
 #include <pcl_ros/point_cloud.h>
 #include <pcl/point_types.h>
 #include <image_transport/subscriber_filter.h>
@@ -19,6 +20,9 @@
 #include <tf/LinearMath/Quaternion.h>
 #include <geometry_msgs/PoseStamped.h>
 #include <geometry_msgs/TransformStamped.h>
+
+#include <sensor_msgs/PointCloud.h>
+#include <pcl_conversions/pcl_conversions.h>
 //#include <cvsba/cvsba.h>	// External library for sparse bundle adjustment

@@ -61,6 +65,10 @@
  */
 struct Node
 	{
+	static cv::Ptr<cv::FeatureDetector> fDetector; /**< Feature detector interface.*/
+	static cv::Ptr<cv::DescriptorExtractor> dExtractor; /**< Descriptor extractor interface.*/
+	static cv::Ptr<cv::DescriptorMatcher> dMatcher; /**< Descriptor matcher interface.*/
+
 	static cv::ORB oFDDE; /**< ORB feature detector and descriptor extractor.*/
 	static cv::BFMatcher bfMatcher; /**< Bruteforce matcher with cross-checking of matches.*/

@@ -215,15 +223,20 @@
 		// Detect features in left and right image
 		std::vector<cv::KeyPoint> keyPoints_l, keyPoints_r;
 		cv::Mat descriptors_l, descriptors_r;
-		oFDDE(img_l, cv::noArray(), keyPoints_l, descriptors_l);
-		oFDDE(img_r, cv::noArray(), keyPoints_r, descriptors_r);
+//		oFDDE(img_l, cv::noArray(), keyPoints_l, descriptors_l);
+//		oFDDE(img_r, cv::noArray(), keyPoints_r, descriptors_r);
+		fDetector->detect(img_l, keyPoints_l);
+		fDetector->detect(img_r, keyPoints_r);
+		dExtractor->compute(img_l, keyPoints_l, descriptors_l);
+		dExtractor->compute(img_r, keyPoints_r, descriptors_r);

 //		std::cout << "Found features left:		" << keyPoints_l.size() << std::endl;
 //		std::cout << "Found features right:		" << keyPoints_r.size() << std::endl;

 		// Match features with a descriptor(!)-distance below a threshold
 		std::vector< std::vector<cv::DMatch> > matches;
-		bfMatcher.radiusMatch(descriptors_l, descriptors_r, matches, 25);
+//		bfMatcher.radiusMatch(descriptors_l, descriptors_r, matches, 25);
+		dMatcher->radiusMatch(descriptors_l, descriptors_r, matches, 35);

 		// Only use matches that fulfill the epipolar constraint, thus lying on a horizontal line
 		std::vector<cv::Point2f> refinedPoints_l, refinedPoints_r;
@@ -304,7 +317,8 @@
 		{
 		// Match features with a descriptor(!)-distance below a threshold
 		std::vector< std::vector<cv::DMatch> > radiusMatches;
-		bfMatcher.radiusMatch(desc_l_, previousNode.desc_l_, radiusMatches, 20);
+//		bfMatcher.radiusMatch(desc_l_, previousNode.desc_l_, radiusMatches, 20);
+		dMatcher->radiusMatch(desc_l_, previousNode.desc_l_, radiusMatches, 35);

 		// Create Vectors containing the matched points
 		std::vector<cv::Point2f> matchedPointsCurr1, matchedPointsPrev1;
@@ -456,6 +470,9 @@

 cv::ORB Node::oFDDE(3000);
 cv::BFMatcher Node::bfMatcher(cv::NORM_HAMMING, true); // Only cross-checked matches will be used
+cv::Ptr<cv::FeatureDetector> Node::fDetector = cv::FeatureDetector::create("SURF");
+cv::Ptr<cv::DescriptorExtractor> Node::dExtractor = cv::DescriptorExtractor::create("ORB");
+cv::Ptr<cv::DescriptorMatcher> Node::dMatcher = cv::DescriptorMatcher::create("BruteForce-Hamming");

 /**
  * Class for synchronized image subscribing
@@ -580,6 +597,8 @@
 		ros::Publisher posePub_; /**< Pose publisher. */
 		ros::Publisher pcPub_; /**< PointCloud publisher. */
 		unsigned int matchFails_; /**< Number of failed matches. */
+
+		ros::Publisher testPub;

 	public:
 		cv::Mat imgPrev_l_; /**< Previous left image. */
@@ -609,6 +628,7 @@
 			ros::NodeHandle nh;
 			posePub_ = nh.advertise<geometry_msgs::PoseStamped>("sp_navigation/Pose", 50);
 			pcPub_ = nh.advertise<PointCloud>("sp_navigation/PointCloud", 50);
+			testPub = nh.advertise<sensor_msgs::PointCloud>("sp_navigation/PointCloud2", 50);
 			}

 		/*
@@ -784,16 +804,31 @@
 		 * */
 		void publishPC()
 			{
-			if (sbaMap_.empty() ? computeMeanMap() : true)
+//			if (sbaMap_.empty() ? computeMeanMap() : true)
+			if (computeMeanMap())
 				{
 				PointCloud pointCloud;
 				pointCloud.height = 1;
 				pointCloud.width = map_.size();
 				for (unsigned int i = 0; i < map_.size(); ++i) {pointCloud.points.push_back(PointT(map_[i].x, map_[i].y, map_[i].z));}
-//std::cout << pointCloud.back() << std::endl;
+if (!pointCloud.points.empty()) std::cout << pointCloud.points[0] << std::endl;
 				pointCloud.header.frame_id = parentFrame_;
 				pointCloud.header.stamp = ros::Time::now().toNSec();
 				pcPub_.publish(pointCloud);
+
+				sensor_msgs::PointCloud test;
+				for (unsigned int i = 0; i < map_.size(); ++i)
+					{
+					geometry_msgs::Point32 p;
+					p.x = map_[i].x;
+					p.y = map_[i].y;
+					p.z = map_[i].z;
+					test.points.push_back(p);
+					}
+				test.header.frame_id = parentFrame_;
+				test.header.stamp = ros::Time::now();
+				testPub.publish(test);
+
 				std::cout << "PointCloud published (" << pointCloud.points.size() << ")" << std::endl;
 				}
 			}
@@ -896,14 +931,24 @@
 					cv::line(imgPrev_l_, pointPrev, pointCurr, cv::Scalar(0,200,0));
 					}

-				// Draw stereo matches
+				// Draw stereo matches after getting min and max disparity to set the color accordingly
+				double minDisp = 1000., maxDisp = 0., dispRange;
+				std::vector<double> disparities;
+				for (unsigned int i = 0; i < currNode.stereoPoints_l_.size(); ++i)
+					{
+					double disparity = currNode.stereoPoints_l_[i].x - currNode.stereoPoints_r_[i].x;
+					minDisp = MIN(disparity, minDisp);
+					maxDisp = MAX(disparity, maxDisp);
+					disparities.push_back(disparity);
+					}
+				dispRange = maxDisp - minDisp;
 				for (unsigned int i = 0; i < currNode.stereoPoints_l_.size(); ++i)
 					{
 					cv::Point2f& pointLeft = currNode.stereoPoints_l_[i];
 					cv::Point2f& pointRight = currNode.stereoPoints_r_[i];
+					cv::line(imgCurr_r_, pointLeft, pointRight, cv::Scalar(0,255*(disparities[i]-minDisp)/dispRange,255));
+					cv::circle(imgCurr_r_, pointRight, 1, cv::Scalar(0,255,255));
 					//cv::circle(imgCurr_r_, pointLeft, 1, cv::Scalar(0,153,255));
-					cv::circle(imgCurr_r_, pointRight, 1, cv::Scalar(0,255,255));
-					cv::line(imgCurr_r_, pointLeft, pointRight, cv::Scalar(255,153,0));
 					}
 				}
 			stereoSub_->publishCVImages(imgPrev_l_, imgCurr_r_);
@@ -915,6 +960,27 @@

 int main(int argc, char** argv)
 	{
+	cv::initModule_nonfree();
+	sp_navigation::Node::dMatcher->set("crossCheck", true);
+
+// ORB
+//	sp_navigation::Node::fDetector->set("nFeatures", 5000);
+
+// SIFT
+//	sp_navigation::Node::fDetector->set("contrastThreshold", 0.01);
+//	sp_navigation::Node::fDetector->set("edgeThreshold", 20);
+
+//SURF
+	sp_navigation::Node::fDetector->set("hessianThreshold", 100);
+	sp_navigation::Node::fDetector->set("nOctaves", 4);
+	sp_navigation::Node::fDetector->set("upright", true);
+
+// HARRIS
+//	sp_navigation::Node::fDetector->set("nfeatures", 5000);
+//	sp_navigation::Node::fDetector->set("qualityLevel", 0.01);
+//	sp_navigation::Node::fDetector->set("minDistance", 2);
+//	sp_navigation::Node::fDetector->set("k", 0.001);
+
 	// Those parameters are here temporarily to change feature/descriptor extraction parameters without recompiling
 	int nfeatures = 3000;
 	float scaleFactor = argc > 1 ? std::atof(argv[1]) : 1.2f;
@@ -938,8 +1004,8 @@
 	ros::Time begin = ros::Time::now();
 	ros::Duration collDur(12.0);
 //	while (ros::ok() && ros::Time::now()-begin < collDur) // run a certain time
-//	while (ros::ok() && visualOdo.nodes_.size() < 3) // Run until a certain amount of nodes have been created
-	while (ros::ok())
+	while (ros::ok() && visualOdo.nodes_.size() < 50) // Run until a certain amount of nodes have been created
+//	while (ros::ok())
 		{
 		// Take time of each loop
 		double tickTime = (double)cv::getTickCount();


some minor fixes

some minor fixes

--- XLCUtils/XLCObjCppHelpers.hh
+++ XLCUtils/XLCObjCppHelpers.hh
@@ -14,6 +14,7 @@
 #include <utility>
 #include <string>
 #include <typeinfo>
+#include <memory>

 #include <cxxabi.h>

@@ -139,7 +140,7 @@
         }

         return str;
-    };
+    }
 }

 #ifdef __OBJC__


splashcore: Fixed bug where BuildGraphNode searched for recursive configs in the wrong place

--- src/splashcore/BuildGraphNode.cpp
+++ src/splashcore/BuildGraphNode.cpp
@@ -151,7 +151,7 @@
 			//If the flag is "global" pull in the upstream flags
 			string flag = it.as<std::string>();
 			if(flag == "global")
-				graph->GetFlags(toolchain, config, path, m_flags);
+				graph->GetFlags(toolchain, config, scriptpath, m_flags);
 			else
 				m_flags.emplace(BuildFlag(flag));
 		}
@@ -159,7 +159,7 @@

 	//No flags specified, import base flags
 	else
-		graph->GetFlags(toolchain, config, path, m_flags);
+		graph->GetFlags(toolchain, config, scriptpath, m_flags);

 	//anything else is handled in base class (source files etc)


fix to yahoo parser

fix to yahoo parser

--- src/plugins/img_websearch/se_parser_yahoo_img.cpp
+++ src/plugins/img_websearch/se_parser_yahoo_img.cpp
@@ -83,14 +83,15 @@
 		  if (pos != std::string::npos && pos+7 < furl.size())
 		    {
 		       std::string imgurl = furl.substr(pos+7);
-		       pos = imgurl.find("%26");
+		       char *imgurl_str = encode::url_decode(imgurl.c_str());
+		       imgurl = imgurl_str;
+		       free(imgurl_str);
+		       pos = imgurl.find("&");
 		       if (pos != std::string::npos)
 			 {
 			    imgurl = imgurl.substr(0,pos);
 			    imgurl = "http://" + imgurl;
-			    char *imgurl_str = encode::url_decode(imgurl.c_str());
-			    pc->_current_snippet->set_url(imgurl_str);
-			    free(imgurl_str);
+			    pc->_current_snippet->set_url(imgurl);
 			 }
 		    }
 	       }


Fixed issue with incorrect diagnostic printing

--- odr-check/OdrCheck.cpp
+++ odr-check/OdrCheck.cpp
@@ -86,16 +86,6 @@
   llvm::sys::PrintStackTraceOnErrorSignal();
   //CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory);

-
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
-  TextDiagnosticPrinter DiagnosticPrinter(
-      llvm::errs(), &*DiagOpts);
-  IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics = new DiagnosticsEngine(
-      IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
-      &DiagnosticPrinter, false);
-
-
-
   std::vector<ASTUnitPtr> units;

   bool shouldDumpAST = false;
@@ -109,6 +99,14 @@
       shouldDumpAST = true;
       continue;
     }
+
+    IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
+    std::unique_ptr<TextDiagnosticPrinter> DiagnosticPrinter = llvm::make_unique<TextDiagnosticPrinter>(
+        llvm::errs(), &*DiagOpts);
+
+    IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics = new DiagnosticsEngine(
+        IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+        DiagnosticPrinter.release());

     llvm::errs() << "processing file [" << arg << "]...\n";
     ASTUnitPtr unit = ASTUnit::LoadFromASTFile(arg, Diagnostics, FileSystemOptions());


修改bug

修改bug

--- XML2DataBase/ClassCreate.cpp
+++ XML2DataBase/ClassCreate.cpp
@@ -1642,8 +1642,9 @@
 						obj_XML_Proc.m_obj_vec_Table_Info[i].m_obj_vec_Column_Info[j].m_sz_Column_Name);
 					fwrite(szTemp, strlen(szTemp), sizeof(char), pFile);

-					sprintf_safe(szTemp, 200, "\t\tarray_%s.PushBack(object, allocator);\n",
-						obj_XML_Proc.m_obj_vec_Table_Info[i].m_obj_vec_Column_Info[j].m_sz_Column_Name);
+					sprintf_safe(szTemp, 200, "\t\tarray_%s.PushBack(object%s, allocator);\n",
+						obj_XML_Proc.m_obj_vec_Table_Info[i].m_obj_vec_Column_Info[j].m_sz_Column_Name,
+						obj_XML_Proc.m_obj_vec_Table_Info[i].m_sz_Class_Name);
 					fwrite(szTemp, strlen(szTemp), sizeof(char), pFile);

 					sprintf_safe(szTemp, 200, "\t}\n");


INTEGRATION: CWS warnings01 (1.11.4); FILE MERGED 2005/11/01 12:47:37 cd 1.11.4.1: #i53898# Warning free code for sun solaris compiler

--- configmgr/source/treemgr/nodechangeimpl.hxx
+++ configmgr/source/treemgr/nodechangeimpl.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: nodechangeimpl.hxx,v $
  *
- *  $Revision: 1.11 $
- *
- *  last change: $Author: rt $ $Date: 2005-09-08 04:30:33 $
+ *  $Revision: 1.12 $
+ *
+ *  last change: $Author: hr $ $Date: 2006-06-19 23:32:49 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -224,6 +224,7 @@
             UnoAny getNewValue() const { return m_aNewValue; }

         protected:
+                     using NodeChangeImpl::setTarget;
         // override information items
             /// the path from base to 'affected' node - here is the name of the changing node
             virtual RelativePath doGetChangingNodePath(ChangeCount _ix) const;


EnvironmentWidget: Sort the changes

EnvironmentWidget: Sort the changes

Task-number: QTCREATORBUG-3889

--- src/plugins/projectexplorer/environmentwidget.cpp
+++ src/plugins/projectexplorer/environmentwidget.cpp
@@ -184,10 +184,17 @@
     updateSummaryText();
 }

+bool sortEnvironmentItem(const Utils::EnvironmentItem &a, const Utils::EnvironmentItem &b)
+{
+    return a.name < b.name;
+}
+
 void EnvironmentWidget::updateSummaryText()
 {
+    QList<Utils::EnvironmentItem> list = d->m_model->userChanges();
+    qSort(list.begin(), list.end(), &sortEnvironmentItem);
+
     QString text;
-    const QList<Utils::EnvironmentItem> &list = d->m_model->userChanges();
     foreach (const Utils::EnvironmentItem &item, list) {
         if (item.name != Utils::EnvironmentModel::tr("<VARIABLE>")) {
             text.append("<br>");


Don't reset view if a query fails.
The view of a table gets reset if for example a query fails.
However this also resets and removes the Header views of the
table. A better solution visually is to keep them displayed.

Task-number: QTBUG-3162

--- src/sql/models/qsqlquerymodel.cpp
+++ src/sql/models/qsqlquerymodel.cpp
@@ -314,6 +314,7 @@
     QSqlRecord newRec = query.record();
     bool columnsChanged = (newRec != d->rec);
     bool hasQuerySize = query.driver()->hasFeature(QSqlDriver::QuerySize);
+    bool hasNewData = (newRec != QSqlRecord()) || !query.lastError().isValid();

     if (d->colOffsets.size() != newRec.count() || columnsChanged)
         d->initColOffsets(newRec.count());
@@ -328,13 +329,13 @@
     d->error = QSqlError();
     d->query = query;
     d->rec = newRec;
-
+
     if (mustClearModel)
         endRemoveRows();
-
-    d->atEnd = false;
-
-    if (columnsChanged)
+
+    d->atEnd = false;
+
+    if (columnsChanged && hasNewData)
         reset();

     if (!query.isActive() || query.isForwardOnly()) {


Leaving the widget stops press repeats.

Leaving the widget stops press repeats.

--- src/plugins/render/navigation/ArrowDiscWidget.cpp
+++ src/plugins/render/navigation/ArrowDiscWidget.cpp
@@ -111,6 +111,9 @@
         m_imagePath = "marble/navigation/navigational_arrows";
         repaint();
     }
+
+    m_initialPressTimer.stop();
+    m_repeatPressTimer.stop();
 }

 void ArrowDiscWidget::startPressRepeat()


Pass focusOutEvent to the superclass

Pass focusOutEvent to the superclass

Task-number: QTCREATORBUG-5981

Change-Id: I46e62849f277bc9ac959b95f328dff6d13ffc658
Reviewed-on: http://codereview.qt.nokia.com/4128
Reviewed-by: Daniel Teske <d8a411aec9a206efedb4d45b75fe8d13f1e2b628@nokia.com>

--- src/plugins/texteditor/snippets/snippeteditor.cpp
+++ src/plugins/texteditor/snippets/snippeteditor.cpp
@@ -78,6 +78,7 @@
         document()->setModified(false);
         emit snippetContentChanged();
     }
+    BaseTextEditorWidget::focusOutEvent(event);
 }

 BaseTextEditor *SnippetEditorWidget::createEditor()


Avoid using previously declared variables

Change-Id: Ie2f003cacc99fda00b666ed194cb044a7ee3faf1
Reviewed-by: Michael Brasser <acf66a4a6ae67569abc58c29c7a264afd3e1cc1c@nokia.com>

--- src/qml/animations/qparallelanimationgroupjob.cpp
+++ src/qml/animations/qparallelanimationgroupjob.cpp
@@ -216,8 +216,8 @@
         return;

     int maxDuration = 0;
-    for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling())
-        maxDuration = qMax(maxDuration, animation->totalDuration());
+    for (QAbstractAnimationJob *job = firstChild(); job; job = job->nextSibling())
+        maxDuration = qMax(maxDuration, job->totalDuration());

     if (m_currentTime >= maxDuration)
         stop();


Avoid post_global() whenever possible.

Avoid post_global() whenever possible.

Calling post_global() multiple times is a bad idea
after selection offers are handled as real globals.

--- src/qt-compositor/wayland_wrapper/wlselection.cpp
+++ src/qt-compositor/wayland_wrapper/wlselection.cpp
@@ -261,9 +261,6 @@
         offer = &m_retainedSelection->selection_offer;
     }
     if (selection && offer) {
-        wl_client_post_event(client, &offer->object,
-                             WL_SELECTION_OFFER_KEYBOARD_FOCUS, 0);
-        wl_client_post_global(client, &offer->object);
         foreach (const QString &mimeType, m_offerList) {
             QByteArray mimeTypeBa = mimeType.toLatin1();
             wl_client_post_event(client, &offer->object,


strip boost::optional from non-optional marker ptr

--- src/renderer_common/render_markers_symbolizer.cpp
+++ src/renderer_common/render_markers_symbolizer.cpp
@@ -128,12 +128,12 @@

         agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);

-        boost::optional<svg_path_ptr> const& stock_vector_marker = mark.get_data();
-        svg_path_ptr marker_ptr = *stock_vector_marker;
+        svg_path_ptr stock_vector_marker = mark.get_data();
+        svg_path_ptr marker_ptr = stock_vector_marker;
         bool is_ellipse = false;

         svg_attribute_type s_attributes;
-        auto const& r_attributes = get_marker_attributes(*stock_vector_marker, s_attributes);
+        auto const& r_attributes = get_marker_attributes(stock_vector_marker, s_attributes);

         // special case for simple ellipse markers
         // to allow for full control over rx/ry dimensions