Tracking through N frames

Tracking through N frames

--- vpp/algorithms/Line_tracker_4_sfm/Hough_Extruder/feature_matching_hough.hh
+++ vpp/algorithms/Line_tracker_4_sfm/Hough_Extruder/feature_matching_hough.hh
@@ -11,8 +11,6 @@

 namespace vpp {

-float val_diff = 0;
-int nb_diff = 0;

 struct feature_matching_hough_ctx {
     feature_matching_hough_ctx(box2d domain) : keypoints(domain), frame_id(0) {}
@@ -41,50 +39,34 @@
 void feature_matching_hough_update_three_first(feature_matching_hough_ctx& ftx,
                                                std::vector<float>& frame1,
                                                std::vector<float>& frame2,
-                                               image2d<uchar> &frame_gradient,image2d<uchar> &frame_point,
+                                               image2d<uchar> &frame_grad,
+                                               image2d<uchar> &frame_point,
+                                               Sclare_rho scale,
                                                int type_video,image2d<uchar> img,
-                                               int T_theta,int rhomax,bool first, Type_output type_sortie,
-                                               int &id_trackers,Type_Lines type_line,Frequence freq,std::vector<vint2>& old_vects,
+                                               int T_theta,int rhomax,bool first,
+                                               Type_output type_sortie,int &id_trackers,
+                                               Type_Lines type_line,Frequence freq,
+                                               std::vector<vint2>& old_clusters,
                                                int wkf,
                                                OPTS... options);

 template <typename... OPTS>
-void feature_matching_hough_update_three_first_3_frames(feature_matching_hough_ctx& ftx,
-                                                        std::vector<float>& frame1,
-                                                        std::vector<float>& frame2,
-                                                        std::vector<float>& frame3,
-                                                        int nb_matcher,
-                                                        image2d<uchar> &frame_grad,
-                                                        image2d<uchar> &frame_point,
-                                                        std::vector<vint2>& new_values1,
-                                                        int type_video,
-                                                        image2d<uchar> img,
-                                                        int T_theta,int rhomax,bool first,
-                                                        Type_output type_sortie,int &id_trackers,
-                                                        Type_Lines type_line,Frequence freq,std::list<vint2>& old_vects,
-                                                        //float precision_runtime_balance = 0,
-                                                        OPTS... options);
-
-template <typename... OPTS>
-void feature_matching_hough_update_three_first_mat(feature_matching_hough_ctx& ftx,
+void feature_matching_hough_update_N_first(feature_matching_hough_ctx& ftx,
                                                std::vector<float>& frame1,
                                                std::vector<float>& frame2,
-                                               Mat &frame_grad,Sclare_rho scale,
-                                               int type_video,image2d<uchar> img, Mat &img_ori,
+                                               image2d<uchar> &frame_grad,
+                                               image2d<uchar> &frame_point,
+                                               Sclare_rho scale,
+                                               int type_video,image2d<uchar> img,
                                                int T_theta,int rhomax,bool first,
                                                Type_output type_sortie,int &id_trackers,
-                                               Type_Lines type_line,Frequence freq,std::list<vint2>& old_vects,
-                                               //float precision_runtime_balance = 0,
+                                               Type_Lines type_line,Frequence freq,
+                                               std::vector<vint2>& old_clusters,
+                                               int wkf,int N, std::list<image2d<uchar>> liste_images,
                                                OPTS... options);

-template <typename... OPTS>
-void feature_matching_hough_update_local(feature_matching_hough_ctx& ftx,
-                                    std::vector<float>& frame1,
-                                    std::vector<float>& frame2,int type_video,image2d<vuchar1> img,
-                                   int T_theta,int rhomax,bool first, std::vector<vint2>& old_values,
-                                   int &id_trackers,
-                                   //float precision_runtime_balance = 0,
-                                   OPTS... options);
+
+

 float Distance_between_curve_L1(std::vector<float> frame1, std::vector<float>  frame2, int taille);


SimonStewart: More reliable support for uploading files in IE. Patch from noel.

r5542

--- jobbie/src/cpp/InternetExplorerDriver/ElementWrapper.cpp
+++ jobbie/src/cpp/InternetExplorerDriver/ElementWrapper.cpp
@@ -102,39 +102,40 @@
 };

 struct keyboardData {
+	HWND main;
 	HWND hwnd;
 	const wchar_t* text;
 };

 WORD WINAPI setFileValue(keyboardData* data) {
-	HWND parentWindow = data->hwnd;
-	const wchar_t* filename = data->text;
-	HWND dialogHwnd = FindWindowW(fileDialogNames[0], NULL);
-
-	int lookFor = 30;
-	while (!dialogHwnd && lookFor) {
+	Sleep(200);
+	HWND ieMain = data->main;
+	HWND dialogHwnd = ::GetLastActivePopup(ieMain);
+
+	int maxWait = 10;
+	while ((dialogHwnd == ieMain) && --maxWait) {
 		Sleep(200);
-		--lookFor;
-		dialogHwnd = FindWindowW(fileDialogNames[0], NULL);
-	}
-
-	if (!dialogHwnd) {
+		dialogHwnd = ::GetLastActivePopup(ieMain);
+	}
+
+	if (!dialogHwnd || (dialogHwnd == ieMain)) {
 		cout << "No dialog found" << endl;
 		return false;
 	}

 	HWND editHwnd = NULL;
-	int max_count = 10;
-	for (int max_count = 10; max_count && !editHwnd; --max_count) {
+	maxWait = 10;
+	while (!editHwnd && --maxWait) {
 		wait(200);
 		editHwnd = dialogHwnd;
-		for (int i = 1; fileDialogNames[i] && dialogHwnd; i++) {
+		for (int i = 1; fileDialogNames[i]; ++i) {
 			editHwnd = getChildWindow(editHwnd, fileDialogNames[i]);
 		}
 	}

 	if (editHwnd) {
 		// Attempt to set the value, looping until we succeed.
+		const wchar_t* filename = data->text;
 		size_t expected = wcslen(filename);
 		size_t curr = 0;

@@ -284,6 +285,7 @@
 	const HWND ieWindow = getIeServerWindow(hWnd);

 	keyboardData keyData;
+	keyData.main = hWnd;  // IE's main window
 	keyData.hwnd = ieWindow;
 	keyData.text = newValue.c_str();


RDA: fix adding new definitions in GVN

RDA: fix adding new definitions in GVN

--- lib/analysis/ReachingDefinitions/ReachingDefinitions.cpp
+++ lib/analysis/ReachingDefinitions/ReachingDefinitions.cpp
@@ -152,9 +152,13 @@
             assert(phi->overwrites.size() == 1);
             const auto& ds = *(phi->overwrites.begin());
             auto newphis = readValue(*I, phi, ds);
+            assert(newphis.size() <= 1);

+            // update phi nodes and block definitions
             for (auto phi : newphis) {
                 I->prependAndUpdateCFG(phi);
+                assert(I->definitions.get(ds).empty());
+                I->definitions.update(ds, phi);
                 // queue the new phi for processing
                 phis.insert(phi);
             }


[chip-tool] When sending a command fails for some reasons, chip-tool ignore the error (#13690)

--- examples/chip-tool/commands/clusters/ModelCommand.cpp
+++ examples/chip-tool/commands/clusters/ModelCommand.cpp
@@ -33,7 +33,9 @@
 {
     ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
     VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null"));
-    command->SendCommand(device, command->mEndPointId);
+
+    CHIP_ERROR err = command->SendCommand(device, command->mEndPointId);
+    VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err));
 }

 void ModelCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err)


bail out of Rebuild call if the VBO / VAO have not been allocated yet.

fixes #100


Minor improvements to HUD pulldown

Minor improvements to HUD pulldown

- don't close the pull-down when selecting an item
- change color of down-arrow to yellow when the pulldown is open

--- examples/common/hud.cpp
+++ examples/common/hud.cpp
@@ -182,9 +182,10 @@
     for (std::vector<PullDown>::iterator it = _pulldowns.begin();
          it != _pulldowns.end(); ++it) {
         if (hitTest(*it, x, y)) {
-            it->h = FONT_CHAR_HEIGHT;
             if (not it->open) {
+                it->h = FONT_CHAR_HEIGHT;
                 it->h *= (int)it->labels.size();
+                it->open=true;
             } else {
                 int label_width = (3+(int)it->label.size()) * FONT_CHAR_WIDTH;
                 if (x > it->x + label_width) {
@@ -193,9 +194,10 @@
                     if (it->selected!=sel) {
                         it->callback(it->values[it->selected]);
                     }
+                } else {
+                    it->open=not it->open;
                 }
             }
-            it->open=not it->open;
             _requiresRebuildStatic = true;
             return true;
         }
@@ -527,7 +529,7 @@
         x += FONT_CHAR_WIDTH;

         if (it->open) {
-            x = drawChar(_staticVboSource, x, y, .5f, .5f, .5f, FONT_ARROW_DOWN);
+            x = drawChar(_staticVboSource, x, y, 1, 1, 0, FONT_ARROW_DOWN);
             x += FONT_CHAR_WIDTH;
             for (int i=0; i<(int)it->labels.size(); ++i, y+=FONT_CHAR_HEIGHT) {
                 if (i==it->selected) {


locate the cause of the combinatoric explosion.

--- opencog/learning/moses/representation/build_knobs.cc
+++ opencog/learning/moses/representation/build_knobs.cc
@@ -758,7 +758,7 @@
         _exemplar.swap(sib, it.last_child());
 }

-/// caonize_times: turn 'it' into a  binary * with second arg a constant.
+/// canonize_times: turn 'it' into a  binary * with second arg a constant.
 pre_it build_knobs::canonize_times(pre_it it)
 {
     // get contin child of 'it', if 'it' == 'times' and such contin
@@ -821,10 +821,28 @@
         for (sib_it sib = it.begin(); sib != it.end(); ++sib) {
             if (!is_contin(*sib)) {
                 sib = canonize_times(sib);
+
+                // This is ifdef-ed out because it is (perhaps
+                // unintentionally?) raising the power of any polynomial.
+                // Worse, for every quadratic, this means arity-squared
+                // knobs are created; for every cubic, arity-cubed knobs,
+                // and so on.  For arity > 1K, this is a disaster.
+                // (A million knobs!? Think about it...)  For
+                // arity > 10K, this is an insta-OOM-killer.  This
+                // happens because append_linear_combination, below,
+                // appends not just some, but *all* of the literals,
+                // whence the combinatoric explosion of knobs.
+
+                // So... if you want to create polynomials, then do so
+                // explicitly, instead of the sneaky tricky below. And
+                // when you do, make sure the combinatoric explosion is
+                // under control.
+#ifdef MAKE_A_POLYNOMIAL
                 rec_canonize(sib.begin());
                 OC_ASSERT(is_contin(*sib.last_child()),
                           "Sibling's last child isn't id::contin.");
                 rec_canonize(_exemplar.insert_above(sib.last_child(), id::plus));
+#endif // MAKE_A_POLYNOMIAL
             }
         }


added more detailed error reporting on initialization problems

--- livesupport/modules/playlistExecutor/src/HelixPlayer.cxx
+++ livesupport/modules/playlistExecutor/src/HelixPlayer.cxx
@@ -21,8 +21,8 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

-    Author   : $Author: fgerlits $
-    Version  : $Revision: 1.17 $
+    Author   : $Author: maroy $
+    Version  : $Revision: 1.18 $
     Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $

 ------------------------------------------------------------------------------*/
@@ -165,7 +165,7 @@
     std::string     staticLibPath(dllPath);
     staticLibPath += clntcoreName;
     if (DLLAccess::DLL_OK != dllAccess.open(staticLibPath.c_str())) {
-        throw std::exception();
+        throw std::runtime_error("Couldn't open Helix shared object");
     }

     // get the main entry function pointers
@@ -177,7 +177,8 @@
                 (FPRMSETDLLACCESSPATH) dllAccess.getSymbol("SetDLLAccessPath");

     if (!createEngine || !closeEngine || !setDLLAccessPath) {
-        throw std::exception();
+        throw std::runtime_error(
+			"Couldn't access symbols from Helix shared object");
     }

     // set the DLL access path
@@ -195,11 +196,11 @@

     // create the client engine and the player
     if (HXR_OK != createEngine(&clientEngine)) {
-        throw std::exception();
+        throw std::runtime_error("Couldn't create Helix Client Engine");
     }

     if (HXR_OK != clientEngine->CreatePlayer(player)) {
-        throw std::exception();
+        throw std::runtime_error("Couldn't create Helix Client Player");
     }

     // create and attach the client context


moses: fix insane OC_ASSERT usage in knob building.

--- opencog/learning/moses/representation/build_knobs.cc
+++ opencog/learning/moses/representation/build_knobs.cc
@@ -68,18 +68,19 @@
     type_tree contin_type_tree(id::contin_type);
     type_tree ann_type_tree(id::ann_type);

-    // Make sure that the output type is one that we can work with.
-    stringstream ss;
-    ss << output_type;
-    stringstream art_ss; //action_result_type
-    art_ss << combo::id::action_result_type;
-    OC_ASSERT((((perceptions != NULL || actions != NULL) &&
-                output_type == action_result_type_tree) ||
-               output_type == boolean_type_tree ||
-               output_type == contin_type_tree ||
-               output_type == ann_type_tree),
-              "Types differ. Expected '%s', got '%s'",
-              art_ss.str().c_str(), ss.str().c_str());
+    // If there are perceptions/actions, then output had better be
+    // an action result.
+    if ((perceptions != NULL || actions != NULL) &&
+        (output_type != action_result_type_tree))
+    {
+        stringstream ss;
+        ss << output_type;
+        stringstream art_ss;
+        art_ss << combo::id::action_result_type;
+        OC_ASSERT(0, "ERROR: During representation building, "
+                     "expected action type '%s', got '%s'",
+                      art_ss.str().c_str(), ss.str().c_str());
+    }

     // Determine if the tree is of 'predicate type'. A predicate type
     // tree is a lambda which outputs boolean, but is a mixture of
@@ -127,13 +128,17 @@
         ann_canonize(_exemplar.begin());
         build_contin(_exemplar.begin());
     }
-    else {
-        OC_ASSERT(output_type == contin_type_tree,
-                  "Types differ. Expected 'combo::id::contin_type', got '%s'",
-                  ss.str().c_str());
-
+    else if (output_type == contin_type_tree) {
         contin_canonize(_exemplar.begin());
         build_contin(_exemplar.begin());
+    }
+    else
+    {
+        stringstream ss;
+        ss << output_type;
+        OC_ASSERT(0, "Unsupported output type, got '%s'",
+                  ss.str().c_str());
+
     }
 }

@@ -237,10 +242,10 @@
  */
 void build_knobs::sample_logical_perms(pre_it it, vector<combo_tree>& perms)
 {
-    //all n literals
-    foreach(int i, from_one(_arity)) {
+    // All n literals can each be a subtree.
+    foreach (int i, from_one(_arity)) {
         vertex arg = argument(i);
-        if(permitted_op(arg))
+        if (permitted_op(arg))
             perms.push_back(combo_tree(arg));
     }

@@ -410,6 +415,14 @@

 void build_knobs::sample_predicate_perms(pre_it it, vector<combo_tree>& perms)
 {
+    // A literal argument can be a subtree if and only if it's boolean.
+    foreach (int i, from_one(_arity)) {
+        vertex arg = argument(i);
+cout << "duuuude i="<<i<< " and arg=" << arg <<endl;
+        if (permitted_op(arg))
+            perms.push_back(combo_tree(arg));
+    }
+
 }

 void build_knobs::add_predicate_knobs(pre_it it, bool add_if_in_exemplar)


add scaling assert test for AnimatedDrawable

--- Test/Unit/AnconaTest/Engine/Core2D/Systems/Drawable/DrawableSystemTests.cpp
+++ Test/Unit/AnconaTest/Engine/Core2D/Systems/Drawable/DrawableSystemTests.cpp
@@ -91,6 +91,10 @@

     ASSERT_EQ(animatedDrawable.size(), sf::Vector2f(50.0f, 50.0f));

+    shape1->scale(sf::Vector2f(2.0f, 2.0f));
+
+    ASSERT_EQ(animatedDrawable.size(), sf::Vector2f(100.0f, 100.0f));
+
     ASSERT_EQ(animatedDrawable.FindDrawable("shape1"), shape1);
     animatedDrawable.RemoveFrame("shape1");
     ASSERT_EQ(animatedDrawable.FindDrawable("shape1"), nullptr);


implement LIKEs for extended attributes table (#3541)

--- osquery/tables/system/darwin/extended_attributes.cpp
+++ osquery/tables/system/darwin/extended_attributes.cpp
@@ -21,6 +21,8 @@

 #include "osquery/core/conversions.h"

+namespace fs = boost::filesystem;
+
 namespace osquery {
 namespace tables {

@@ -45,18 +47,18 @@

 // Pull the requested extended attribute from the path and return
 // the XAttrAttribute structure
-struct XAttrAttribute getAttribute(const std::string &path,
-                                   const std::string &attribute) {
+struct XAttrAttribute getAttribute(const std::string& path,
+                                   const std::string& attribute) {
   struct XAttrAttribute x_att;
   x_att.buffer_length =
       getxattr(path.c_str(), attribute.c_str(), nullptr, (size_t)0, 0, 0);
-  char *buffer = (char *)malloc(x_att.buffer_length);
+  char* buffer = (char*)malloc(x_att.buffer_length);
   if (buffer == nullptr) {
     return x_att;
   }

-  x_att.return_value = getxattr(path.c_str(), attribute.c_str(), buffer,
-                                x_att.buffer_length, 0, 0);
+  x_att.return_value = getxattr(
+      path.c_str(), attribute.c_str(), buffer, x_att.buffer_length, 0, 0);

   if (x_att.return_value != -1) {
     x_att.attribute_data = std::string(buffer, x_att.buffer_length);
@@ -69,10 +71,10 @@
 }

 // Pull the list of all the extended attributes for a path
-std::vector<std::string> parseExtendedAttributeList(const std::string &path) {
+std::vector<std::string> parseExtendedAttributeList(const std::string& path) {
   std::vector<std::string> attributes;
   ssize_t value = listxattr(path.c_str(), nullptr, (size_t)0, 0);
-  char *content = (char *)malloc(value);
+  char* content = (char*)malloc(value);
   if (content == nullptr) {
     return attributes;
   }
@@ -82,7 +84,7 @@
     return attributes;
   }

-  char *stable = content;
+  char* stable = content;
   do {
     attributes.push_back(std::string(content));
     content += attributes.back().size() + 1;
@@ -91,10 +93,10 @@
   return attributes;
 }

-void setRow(QueryData &results,
-            const std::string &path,
-            const std::string &key,
-            const std::string &value) {
+void setRow(QueryData& results,
+            const std::string& path,
+            const std::string& key,
+            const std::string& value) {
   Row r;
   r["path"] = path;
   r["directory"] = boost::filesystem::path(path).parent_path().string();
@@ -105,8 +107,7 @@
   results.push_back(r);
 }

-void parseWhereFrom(QueryData &results, const std::string &path) {
-
+void parseWhereFrom(QueryData& results, const std::string& path) {
   CFStringRef CFPath = CFStringCreateWithCString(
       kCFAllocatorDefault, path.c_str(), kCFStringEncodingUTF8);

@@ -141,10 +142,10 @@
   CFRelease(attributes);
 }

-void extractQuarantineProperty(const std::string &table_key_name,
+void extractQuarantineProperty(const std::string& table_key_name,
                                CFTypeRef property,
-                               const std::string &path,
-                               QueryData &results) {
+                               const std::string& path,
+                               QueryData& results) {
   std::string value;
   if (CFGetTypeID(property) == CFStringGetTypeID()) {
     value = stringFromCFString((CFStringRef)property);
@@ -158,9 +159,9 @@
   setRow(results, path, table_key_name, value);
 }

-void parseQuarantineFile(QueryData &results, const std::string &path) {
+void parseQuarantineFile(QueryData& results, const std::string& path) {
   CFURLRef url = CFURLCreateFromFileSystemRepresentation(
-      kCFAllocatorDefault, (const UInt8 *)path.c_str(), path.length(), false);
+      kCFAllocatorDefault, (const UInt8*)path.c_str(), path.length(), false);

   if (url == nullptr) {
     VLOG(1) << "Error obtaining CFURLRef for " << path;
@@ -181,7 +182,7 @@
   }

   CFTypeRef property = nullptr;
-  for (const auto &kv : kQuarantineKeys) {
+  for (const auto& kv : kQuarantineKeys) {
     CFStringRef key = CFStringCreateWithCString(
         kCFAllocatorDefault, kv.second.c_str(), kCFStringEncodingUTF8);
     if (key != nullptr) {
@@ -198,9 +199,9 @@
 }

 // Process a file and extract all attribute information, parsed or not.
-void getFileData(QueryData &results, const std::string &path) {
+void getFileData(QueryData& results, const std::string& path) {
   std::vector<std::string> attributes = parseExtendedAttributeList(path);
-  for (const auto &attribute : attributes) {
+  for (const auto& attribute : attributes) {
     struct XAttrAttribute x_att = getAttribute(path, attribute);

     if (attribute == kMetadataXattr) {
@@ -213,11 +214,27 @@
   }
 }

-QueryData genXattr(QueryContext &context) {
+QueryData genXattr(QueryContext& context) {
   QueryData results;
+  // Resolve file paths for EQUALS and LIKE operations.
   auto paths = context.constraints["path"].getAll(EQUALS);
-
-  for (const auto &path_string : paths) {
+  context.expandConstraints(
+      "path",
+      LIKE,
+      paths,
+      ([&](const std::string& pattern, std::set<std::string>& out) {
+        std::vector<std::string> patterns;
+        auto status =
+            resolveFilePattern(pattern, patterns, GLOB_ALL | GLOB_NO_CANON);
+        if (status.ok()) {
+          for (const auto& resolved : patterns) {
+            out.insert(resolved);
+          }
+        }
+        return status;
+      }));
+
+  for (const auto& path_string : paths) {
     boost::filesystem::path path = path_string;
     // Folders can have extended attributes too
     if (!(boost::filesystem::is_regular_file(path) ||
@@ -227,16 +244,35 @@
     getFileData(results, path.string());
   }

+  // Resolve directories for EQUALS and LIKE operations.
   auto directories = context.constraints["directory"].getAll(EQUALS);
-  for (const auto &directory : directories) {
-    if (!boost::filesystem::is_directory(directory)) {
+  context.expandConstraints(
+      "directory",
+      LIKE,
+      directories,
+      ([&](const std::string& pattern, std::set<std::string>& out) {
+        std::vector<std::string> patterns;
+        auto status =
+            resolveFilePattern(pattern, patterns, GLOB_FOLDERS | GLOB_NO_CANON);
+        if (status.ok()) {
+          for (const auto& resolved : patterns) {
+            out.insert(resolved);
+          }
+        }
+        return status;
+      }));
+
+  // Now loop through constraints using the directory column constraint.
+  for (const auto& directory_string : directories) {
+    if (!isReadable(directory_string) || !isDirectory(directory_string)) {
       continue;
     }
+
     std::vector<std::string> files;
-    listFilesInDirectory(directory, files);
-
-    for (auto &file : files) {
-      getFileData(results, file);
+    if (listFilesInDirectory(directory_string, files).ok()) {
+      for (const auto& file : files) {
+        getFileData(results, file);
+      }
     }
   }
   return results;


Impose unicity before getting the difference of two vectors.

--- packages/Operators/src/Search/DTK_ParallelSearch.cpp
+++ packages/Operators/src/Search/DTK_ParallelSearch.cpp
@@ -42,7 +42,6 @@
 #include "DTK_DBC.hpp"

 #include <Tpetra_Distributor.hpp>
-#include <Teuchos_Comm.hpp>

 namespace DataTransferKit
 {
@@ -258,20 +257,22 @@
 				   import_found.begin(), import_found.end(),
 				   false_positive_missed.begin() );

+  // Create a unique list of missed entities
+	std::sort( import_missed.begin(), import_missed.end() );
+  auto import_missed_unique_end = std::unique(
+      import_missed.begin(), import_missed.end());
+  import_missed.resize(std::distance(import_missed.begin(), import_missed_unique_end));
+
 	// Create a list of missed entities without the false positives.
 	d_missed_range_entity_ids.resize( num_import_missed );
 	auto missed_range_end = std::set_difference(
 	    import_missed.begin(), import_missed.end(),
 	    false_positive_missed.begin(), false_positive_end,
 	    d_missed_range_entity_ids.begin() );
-
-	// Create a unique list of missed entities without the false positives.
-	std::sort( d_missed_range_entity_ids.begin(), missed_range_end );
-	auto missed_range_unique_end = std::unique(
-	    d_missed_range_entity_ids.begin(), missed_range_end );
 	d_missed_range_entity_ids.resize(
 	    std::distance(d_missed_range_entity_ids.begin(),
-			  missed_range_unique_end) );
+			  missed_range_end) );
+
 #if HAVE_DTK_DBC
   unsigned long long int n_entities = d_missed_range_entity_ids.size() +
     num_import_found;


made target_identity return a protocol for the NV+cluster system

--- nv-control.cpp
+++ nv-control.cpp
@@ -460,9 +460,11 @@
   if (exact) return protocol::Identity(pow(2,cluster_spins));

   const MatrixXcd H = H_sys(nv,cluster) - H_nZ(nv,cluster,nv.static_gBz*zhat);
-  const MatrixXcd proj_0 = act(dn*dn.adjoint(),{0},cluster_spins+1); // |0><0|
+  const MatrixXcd proj_0 = act(dn*dn.adjoint(), {0}, cluster_spins+1); // |0><0|
   const MatrixXcd H_0 = ptrace(H*proj_0, {0}); // <0|H|0>

-  const MatrixXcd U = exp(-j*time*H_0);
-  return protocol(U);
-}
+  const MatrixXcd U_cluster = exp(-j*time*H_0);
+  const MatrixXcd U = tp(I2, U_cluster);
+
+  return protocol(U,time);
+}


Planning: add early stop when reach unfeasible situations in qp_frenet_frame.cc

--- modules/planning/tasks/qp_spline_path/qp_frenet_frame.cc
+++ modules/planning/tasks/qp_spline_path/qp_frenet_frame.cc
@@ -344,6 +344,7 @@
              << "further_point: " << further_point.DebugString()
              << "impact_index: " << impact_index << "(*constraint)[" << i << "]"
              << (*constraint)[i];
+      break;
     }
   }

@@ -430,6 +431,7 @@
       reference_line_.SLToXY(sl, &xy);
       AERROR << "evaluated_knot x: " << std::fixed << xy.x()
              << " y: " << xy.y();
+      break;
     }
   }
 }


change oapi define

change oapi define

--- oapi/oapis.hpp
+++ oapi/oapis.hpp
@@ -14,10 +14,13 @@
 #include "XSDK/TimeUtils.h"
 #include "XSDK/XSocket.h"
 #include "XSDK/XSSLSocket.h"
+#include "Poco/UUIDGenerator.h"
+#include "XSDK/XMD5.h"

 using namespace XSDK;
 using namespace std;
 using namespace oapi;
+using namespace Poco;

 class OAPIConverter
 {
@@ -39,6 +42,7 @@
 	inline BOOL ProcessGetDevice(s32 len);
 	inline BOOL ProcessStartLive(s32 len);
 	inline BOOL ProcessStopLive(s32 len);
+	inline BOOL ProcessLogin(s32 len);
 public:
 	inline void DataHandler1(VideoFrame& frame);
 	inline static void DataHandler(VideoFrame& frame, void * pParam);
@@ -58,6 +62,8 @@
 	Factory &m_pFactory;
 	int m_nLiveviewId;
 	int m_cnt;
+	BOOL m_bLogin;
+	astring m_seesionId;
 };

 #include "oapisimpl.hpp"


FIX ConstantForceField for some use cases.

Former-commit-id: 540735e56da1fcb1346bfcd6e8c3396c0c6071e2

--- modules/sofa/component/forcefield/ConstantForceField.inl
+++ modules/sofa/component/forcefield/ConstantForceField.inl
@@ -79,51 +79,49 @@
     sofa::helper::WriteAccessor< core::objectmodel::Data< VecDeriv > > _f1 = f1;
     _f1.resize(p1.getValue().size());

-//        sout << "Points = " << points.getValue() << sendl;
     Deriv singleForce;
-    if ( totalForce.getValue()*totalForce.getValue() > 0.0)
-    {
-        for (unsigned comp = 0; comp < totalForce.getValue().size(); comp++)
-            singleForce[comp] = (totalForce.getValue()[comp])/(Real(points.getValue().size()));
-        //std::cout << "Setting forces for each node to = " << singleForce << std::endl;
-    }
-    else if (force.getValue()*force.getValue() > 0.0)
-    {
-        singleForce = force.getValue();
-        //std::cout << "Setting forces for each node to = " << singleForce << std::endl;
-    }
-
+    const Deriv& forceVal = force.getValue();
+    const Deriv& totalForceVal = totalForce.getValue();
     const VecIndex& indices = points.getValue();
-//        sout << "indices = " << indices << sendl;
     const VecDeriv& f = forces.getValue();
-    //const Deriv f_end = (f.empty()? force.getValue() : f[f.size()-1]);
-    const Deriv f_end = (f.empty()? singleForce : f[f.size()-1]);
-    unsigned int i = 0;
-
-
-    if (!indexFromEnd.getValue())
-    {
-        for (; i < f.size(); i++)
-        {
-            sout<<"_f1[indices[i]] += f[i], "<< _f1[indices.empty() ? i : indices[i]] << " += " << f[i] << sendl;
-            _f1[ indices.empty() ? i : indices[i] ] += f[i];  // if indices are not set, use the force indices
-
-        }
-        for (; i < indices.size(); i++)
-        {
-//                    sout<<"_f1[indices[i]] += f_end, "<< _f1[indices[i]] << " += " << f_end << sendl;
-            _f1[indices[i]] += f_end;
-        }
+    unsigned int i = 0, nbForcesIn = f.size(), nbForcesOut = _f1.size();
+
+    if (totalForceVal * totalForceVal > 0)
+    {
+        unsigned int nbForces = indices.empty() ? nbForcesOut : indices.size();
+        singleForce = totalForceVal / (Real)nbForces;
+    }
+    else if (forceVal * forceVal > 0.0)
+        singleForce = forceVal;
+
+    const Deriv f_end = (f.empty() ? singleForce : f.back());
+
+    // When no indices are given, copy the forces from the start
+    if (indices.empty())
+    {
+        unsigned int nbCopy = std::min(nbForcesIn, nbForcesOut);
+        for (; i < nbCopy; ++i) // Copy from the forces list
+            _f1[i] += f[i];
+        for (; i < nbForcesOut; ++i) // Copy from the single value or the last value of the forces list
+            _f1[i] += f_end;
     }
     else
     {
-        for (; i < f.size(); i++)
-        {
-            _f1[_f1.size() - indices[i] - 1] += f[i];
-        }
-        for (; i < indices.size(); i++)
-        {
-            _f1[_f1.size() - indices[i] - 1] += f_end;
+        unsigned int nbIndices = indices.size();
+        unsigned int nbCopy = std::min(nbForcesIn, nbIndices); // forces & points are not garanteed to be of the same size
+        if (!indexFromEnd.getValue())
+        {
+            for (; i < nbCopy; ++i)
+                _f1[indices[i]] += f[i];
+            for (; i < nbIndices; ++i)
+                _f1[indices[i]] += f_end;
+        }
+        else
+        {
+            for (; i < nbCopy; ++i)
+                _f1[nbForcesOut - indices[i] - 1] += f[i];
+            for (; i < nbIndices; ++i)
+                _f1[nbForcesOut - indices[i] - 1] += f_end;
         }
     }
 }
@@ -254,8 +252,7 @@

             float norm = (float)(p2-p1).norm();

-//            static const defaulttype::Vec<4,float> color(1.0f,0.4f,0.4f,1.0f);
-            static const defaulttype::Vec<4,float> color(0.2,0.9,0.3,1.0f);
+            static const defaulttype::Vec<4,float> color(0.2f,0.9f,0.3f,1.0f);

             if( aSC > 0)
             {


Added doxygen documentation to MovementReader.hpp

--- inc/MovementReader.hpp
+++ inc/MovementReader.hpp
@@ -1,8 +1,8 @@
-/*
- * MovementReader.hpp
+/**
+ * \file MovementReader.hpp
  *
- *  Created on: Mar 16, 2013
- *      Author: link
+ * \date 16.03.2013
+ * \author Michał Orynicz
  */

 #ifndef MOVEMENTREADER_HPP_
@@ -17,25 +17,58 @@
 #include "FeatureTracker.hpp"
 #include "FeatureFilter.hpp"

+/**
+ * Base class for objects reading position changes of the camera
+ * based on image from it.
+ */
 class MovementReader {
     protected:
+        /// Features tracked
         std::vector<std::list<cv::Point2f> > _trackedFeatures;
-        FeatureTracker *_tracker;
-        FeatureExtractor *_extractor;
-        std::list<FeatureFilter*> _filters;
+        FeatureTracker *_tracker; ///<Feature tracker
+        FeatureExtractor *_extractor; ///<Feature extractor
+        std::list<FeatureFilter*> _filters; ///<List of feature filters
+        ///Upper limit on number of features to track
         unsigned int _maxFeatures;
-        cv::Mat _oldFrame;
+        cv::Mat _oldFrame;        ///<Previous frame
+        ///Constructor
+        /**
+         * Constructor
+         * @param tracker - feature tracker
+         * @param extractor - feature extractor
+         * @param filters - list of feature filter pointers
+         * @param maxFeatures - upper limit for number of tracked features
+         * @param trackedFeatures - tracked features
+         */
         MovementReader(const FeatureTracker &tracker,
                 const FeatureExtractor &extractor,
                 const std::list<FeatureFilter*> &filters,
                 const unsigned int &maxFeatures,
                 const std::vector<std::list<cv::Point2f> > &trackedFeatures =
                         std::vector<std::list<cv::Point2f> >());
+        ///Deep copy constructor
+        /**
+         * Deep copy constructor
+         * @param toCopy - object to initialize with
+         */
         MovementReader(const MovementReader &toCopy);
     public:
+        ///Default constructor
         MovementReader();
+        /// Getter method for tracked features
+        /**
+         * Getter method for tracked features
+         * @return Tracked features container
+         */
         std::vector<std::list<cv::Point2f> > getTrackedFeatures() const;
+        /// Complement missing features up to maxFeatures
+        /**
+         * Complement the collection of tracked features so it contains
+         * up to maxFeatures of features.
+         * @param maxFeatures Upper limit for number of features tracked
+         */
         void refillFeatures(const int &maxFeatures);
+        ///Destructor
         virtual ~MovementReader();
 };


fixed: typo

fixed: typo

--- inc/support/hasher.inl
+++ inc/support/hasher.inl
@@ -23,7 +23,7 @@

 // includes, project

-#include <>
+//#include <>

 namespace std {


Update BinaryTree.hpp

Update BinaryTree.hpp

--- include/BinaryTree.hpp
+++ include/BinaryTree.hpp
@@ -26,6 +26,7 @@
 	BinaryTree(const std::initializer_list<T>&);
 	unsigned int count() const;
 	void insert_node(const T&x);
+	Node<T>* root_();
 	Node<T> *find_node(const T&, Node<T>*)const;
 	void deleteNode(Node<T>* temp);
 	void writing(const std::string& filename)const;
@@ -94,40 +95,6 @@
 		return find_node(value, temp->left);
 }

-
-template <typename T>
-void BinaryTree<T>::_deleteElements(Node<T>* temp)
-{
-	if (!temp)
-	{
-		throw "error";
-	}
-	_deleteElements(temp->left);
-	_deleteElements(temp->right);
-	delete node;
-}
-
-template<typename T>
-void BinaryTree<T>::deleteNode(Node<T>* temp)
-{
-	if (!temp)
-	{
-		throw "error";
-	}
-	if (temp->left)
-	{
-		deleteNode(temp->left);
-		temp->left = nullptr;
-	}
-
-	if (temp->right)
-	{
-		deleteNode(temp->right);
-		temp->right = nullptr;
-	}
-	delete temp;
-}
-
 template<typename T>
 void BinaryTree<T>::output(std::ostream& ost, const Node<T>* temp)
 {


Add sabretooth prototype

Add sabretooth prototype

--- include/EntityUtil.hpp
+++ include/EntityUtil.hpp
@@ -39,6 +39,8 @@
 	static ashley::Entity *generateTigerEntity(ashley::Engine &engine, int x, int y);

 	static ashley::Entity *generateChestEntity(ashley::Engine &engine, int x, int y, const Item &item);
+
+	static ashley::Entity *generateSabretoothEntity(ashley::Engine &engine, int x, int y);
 };

 }


refactor(font): More robust font size calculation

Originally the size function returned the scaled `size` property for
scalable fonts and the non-scaled `pixelsize` property for non-scalable
fonts. This caused lots of issues when that property was 0 (empty bars,
characters not drawn without warning, see references at the bottom).
This behavior was mostly observed on debian where `size` is set to 0 if
`pixelsize` is set.

We now try to use both properties for both types, but prefering `size`
for scalable fonts and `pixelsize` for non-scalable ones.

This behavior doesn't break existing correct behavior but now never
returns 0. It will always try to fall back to the other property or to
some fallback value if both properties are 0.

I originally thought this could also make font patterns more expressive
by being able to specify the size of scalable fonts directly in pixels
like so:

  Unifont:size=0:pixelsize=20

or to scale non-scalable fonts by forcing polybar to fall back to the
`size` property (which is always scaled):

  Wuncon Siji:pixelsize=0:size=20

But how these two patterns are matched by `fc-match` depends both on the
font and on the distro/fontconfig setup.

Ref #706
Ref #1450
Ref #1257

--- include/cairo/font.hpp
+++ include/cairo/font.hpp
@@ -112,19 +112,75 @@
       return m_offset;
     }

+    /**
+     * Calculates the font size in pixels for the given dpi
+     *
+     * We use the two font properties size and pixelsize. size is in points and
+     * needs to be scaled with the given dpi. pixelsize is not scaled.
+     *
+     * If both size properties are 0, we fall back to a default value of 10
+     * points for scalable fonts or 10 pixel for non-scalable ones. This should
+     * only happen if both properties are purposefully set to 0
+     *
+     * For scalable fonts we try to use the size property scaled according to
+     * the dpi.
+     * For non-scalable fonts we try to use the pixelsize property as-is
+     */
     double size(double dpi) const override {
       bool scalable;
-      double px;
+      double fc_pixelsize = 0, fc_size = 0;
+
       property(FC_SCALABLE, &scalable);
+
+      // Size in points
+      property(FC_SIZE, &fc_size);
+
+      // Size in pixels
+      property(FC_PIXEL_SIZE, &fc_pixelsize);
+
+      // Fall back to a default value if the size is 0
+      double pixelsize = fc_pixelsize == 0? 10 : fc_pixelsize;
+      double size = fc_size == 0? 10 : fc_size;
+
+      // Font size in pixels if we use the pixelsize property
+      int px_pixelsize = pixelsize + 0.5;
+
+      /*
+       * Font size in pixels if we use the size property. Since the size
+       * specifies the font size in points, this is converted to pixels
+       * according to the dpi given.
+       * One point is 1/72 inches, thus this gives us the number of 'dots'
+       * (or pixels) for this font
+       */
+      int px_size = size / 72.0 * dpi + 0.5;
+
+      if (fc_size == 0 && fc_pixelsize == 0) {
+        return scalable? px_size : px_pixelsize;
+      }
+
       if (scalable) {
-        // convert from pt to px using the provided dpi
-        property(FC_SIZE, &px);
-        px = static_cast<int>(px * dpi / 72.0 + 0.5);
+        /*
+         * Use the point size if it's not 0. The pixelsize is only used if the
+         * size property is 0 and pixelsize is not
+         */
+        if (fc_size != 0) {
+          return px_size;
+        }
+        else {
+          return px_pixelsize;
+        }
       } else {
-        property(FC_PIXEL_SIZE, &px);
-        px = static_cast<int>(px + 0.5);
-      }
-      return px;
+        /*
+         * Non-scalable fonts do it the other way around, here the size
+         * property is only used if pixelsize is 0 and size is not
+         */
+        if (fc_pixelsize != 0) {
+          return px_pixelsize;
+        }
+        else {
+          return px_size;
+        }
+      }
     }

     void use() override {


Add support for parallel randomization

Add support for parallel randomization

--- include/cpm/random.hpp
+++ include/cpm/random.hpp
@@ -10,7 +10,109 @@

 #include <random>

+#ifdef CPM_PARALLEL_RANDOMIZE
+#include <thread>
+#include <future>
+#endif
+
 namespace cpm {
+
+#ifndef CPM_PARALLEL_THRESHOLD
+#define CPM_PARALLEL_THRESHOLD 10000
+#endif
+
+#ifndef CPM_PARALLEL_THREADS
+//We are assuming Hyper-Threading by default
+#define CPM_PARALLEL_THREADS std::thread::hardware_concurrency() / 2
+#endif
+
+#ifdef CPM_PARALLEL_RANDOMIZE
+
+#ifndef CPM_FAST_RANDOMIZE
+
+template<typename T>
+void randomize_double(T& container){
+    if(container.size() > CPM_PARALLEL_THRESHOLD){
+        const std::size_t n = CPM_PARALLEL_THREADS; //We are assuming Hyper-Threading
+        const std::size_t p = container.size() / n;
+
+        std::vector<std::future<void>> futures;
+
+        for(std::size_t i = 0; i < n; ++i){
+            futures.push_back(std::async(std::launch::async, [&](std::size_t ii){
+                static std::random_device rd;
+                static std::mt19937_64 rand_engine(rd());
+                static std::uniform_real_distribution<double> real_distribution(-10000.0, 10000.0);
+                static auto generator = std::bind(real_distribution, rand_engine);
+
+                for(std::size_t j = p * ii; j < p * (ii + 1); ++j){
+                    container[j] = generator();
+                }
+                }, i));
+        }
+
+        static std::random_device rd;
+        static std::mt19937_64 rand_engine(rd());
+        static std::uniform_real_distribution<double> real_distribution(-10000.0, 10000.0);
+        static auto generator = std::bind(real_distribution, rand_engine);
+
+        for(std::size_t j = container.size() - container.size() % p; j < container.size(); ++j){
+            container[j] = generator();
+        }
+    } else {
+        static std::random_device rd;
+        static std::mt19937_64 rand_engine(rd());
+        static std::uniform_real_distribution<double> real_distribution(-10000.0, 10000.0);
+        static auto generator = std::bind(real_distribution, rand_engine);
+
+        for(auto& v : container){
+            v = generator();
+        }
+    }
+}
+
+#else
+
+template<typename T>
+void randomize_double(T& container){
+    static std::random_device rd;
+    static std::mt19937_64 rand_engine(rd());
+    static std::uniform_real_distribution<double> real_distribution(-10000.0, 10000.0);
+    static auto generator = std::bind(real_distribution, rand_engine);
+
+    const auto a = generator();
+    const auto b = generator();
+    const auto c = generator();
+
+    if(container.size() > CPM_PARALLEL_THRESHOLD){
+        const std::size_t n = CPM_PARALLEL_THREADS; //We are assuming Hyper-Threading
+        const std::size_t p = container.size() / n;
+
+        std::vector<std::future<void>> futures;
+
+        for(std::size_t i = 0; i < n; ++i){
+            futures.push_back(std::async(std::launch::async, [&](std::size_t ii){
+                for(std::size_t j = p * ii; j < p * (ii + 1); ++j){
+                    container[j] = a + (j * b) + (-j * c);
+                }
+                }, i));
+        }
+
+        for(std::size_t j = container.size() - container.size() % p; j < container.size(); ++j){
+            container[j] = a + (j * b) + (-j * c);
+        }
+    } else {
+        std::size_t i = 0;
+        for(auto& v : container){
+            v = a + (i * b) + (-i * c);
+            ++i;
+        }
+    }
+}
+
+#endif //CPM_FAST_RANDOMIZE
+
+#else

 #ifndef CPM_FAST_RANDOMIZE

@@ -46,8 +148,9 @@
     }
 }

-#endif
+#endif //CPM_FAST_RANDOMIZE

+#endif //CPM_PARALLEL_RANDOMIZE

 inline void randomize(){}


A bit more verbosity in exception.

A bit more verbosity in exception.

--- include/ecto/spore.hpp
+++ include/ecto/spore.hpp
@@ -87,7 +87,7 @@
     {
       tendril::const_ptr _p = tendril_.lock();
       if (!_p)
-        throw std::logic_error("This spore points to nothing.");
+        throw std::logic_error("This spore points to nothing. Type name:" + name_of<T>());
       return _p;
     }


can highlight a block for visualization

can highlight a block for visualization

--- include/htool/view.hpp
+++ include/htool/view.hpp
@@ -45,7 +45,7 @@
 		unsigned int nblabels;
 		unsigned int visudepth;
 		R3 lbox, ubox;
-		Palette& palette;
+		Palette palette;
 		std::shared_ptr<Cluster_tree> cluster;
 		std::vector<int> tab;

@@ -54,7 +54,7 @@

 		~GLMesh();

-		GLMesh(std::vector<R3>& X0, std::vector<N4>&  Elts0, std::vector<int>& NbPts0, std::vector<R3>& normals0, const std::shared_ptr<Cluster_tree>& cluster0 = nullptr, Palette& palette0 = default_palette);
+		GLMesh(const std::vector<R3>& X0, const std::vector<N4>&  Elts0, const std::vector<int>& NbPts0, const std::vector<R3>& normals0, const std::shared_ptr<Cluster_tree>& cluster0 = nullptr, const Palette& palette0 = default_palette);

 		const R3& get_lbox() const;

@@ -69,6 +69,8 @@

 		void set_labels(std::vector<int>& l);
 		void set_nblabels(unsigned int n);
+
+		void set_palette(const Palette& p);

 		void TraversalBuildLabel(const Cluster& t, std::vector<int>& labeldofs);
 		void set_visudepth(const unsigned int depth);
@@ -371,12 +373,17 @@
 				Eigen::Vector2f fp((float)(p[0]-mPos.x())/mSize.x(),(float)(p[1]-mPos.y())/mSize.y());

 				int found = 0;
+
+				Eigen::Vector2i offsets;
+				Eigen::Vector2i dims;

 				for (int i=0;i<dmats.size();i++) {
 						const SubMatrix<K>& l = *(dmats[i]);
-						if ((fp[0] > (float)l.get_offset_i()/si) && (fp[0] < (float)(l.get_offset_i()+l.nb_rows())/si))
-						if ((fp[1] > (float)l.get_offset_j()/sj) && (fp[1] < (float)(l.get_offset_j()+l.nb_cols())/sj)) {
+						if ((fp[0] >= (float)l.get_offset_i()/si) && (fp[0] <= (float)(l.get_offset_i()+l.nb_rows())/si))
+						if ((fp[1] >= (float)l.get_offset_j()/sj) && (fp[1] <= (float)(l.get_offset_j()+l.nb_cols())/sj)) {
 								std::cout << "Dense block of size " << l.nb_rows() << " x " << l.nb_cols() << " at (" << l.get_offset_i() << "," << l.get_offset_j() << ")" << std::endl;
+								offsets = Eigen::Vector2i(l.get_offset_i(),l.get_offset_j());
+								dims = Eigen::Vector2i(l.nb_rows(),l.nb_cols());
 								found = 1;
 								break;
 						}
@@ -385,17 +392,36 @@
 				if (!found)
 				for (int i=0;i<lrmats.size();i++) {
 						const LowRankMatrix<K>& l = *(lrmats[i]);
-						if ((fp[0] > (float)l.get_offset_i()/si) && (fp[0] < (float)(l.get_offset_i()+l.nb_rows())/si))
-						if ((fp[1] > (float)l.get_offset_j()/sj) && (fp[1] < (float)(l.get_offset_j()+l.nb_cols())/sj)) {
+						if ((fp[0] >= (float)l.get_offset_i()/si) && (fp[0] <= (float)(l.get_offset_i()+l.nb_rows())/si))
+						if ((fp[1] >= (float)l.get_offset_j()/sj) && (fp[1] <= (float)(l.get_offset_j()+l.nb_cols())/sj)) {
 								std::cout << "Low rank block of size " << l.nb_rows() << " x " << l.nb_cols() << " at (" << l.get_offset_i() << "," << l.get_offset_j() << "): rank = " << l.rank_of() << ", compression = " << l.compression() << std::endl;
-								found = 1;
+								offsets = Eigen::Vector2i(l.get_offset_i(),l.get_offset_j());
+								dims = Eigen::Vector2i(l.nb_rows(),l.nb_cols());
 								break;
 						}
 				}

-				std::vector<int> labs(1);
-				//Scene::gv.active_project->get_mesh()->get_labels();
+				int sizeg = Scene::gv.active_project->get_ctrs()->size();
+				std::vector<int> labs(sizeg);
 				std::fill(labs.begin(), labs.end(), 0);
+				for (int i=offsets[0]; i<offsets[0]+dims[0]-1; i++)
+				  labs[Scene::gv.active_project->get_mesh()->get_tab()[i]] = 1;
+				for (int j=offsets[1]; j<offsets[1]+dims[1]-1; j++)
+					labs[Scene::gv.active_project->get_mesh()->get_tab()[j]] += 2;
+
+				Scene::gv.active_project->get_mesh()->set_labels(labs);
+				Scene::gv.active_project->get_mesh()->set_nblabels(4);
+
+				Palette block_palette;
+				std::vector<R3> colorsblock(4);
+				colorsblock[0][0]=255;colorsblock[0][1]=0;colorsblock[0][2]=0;
+				colorsblock[1][0]=0;colorsblock[1][1]=0;colorsblock[1][2]=0;
+				colorsblock[2][0]=255;colorsblock[2][1]=255;colorsblock[2][2]=255;
+				colorsblock[3][0]=127;colorsblock[3][1]=127;colorsblock[3][2]=127;
+				block_palette.n = 4;
+				block_palette.colors = colorsblock;
+				Scene::gv.active_project->get_mesh()->set_palette(block_palette);
+
 				Scene::gv.active_project->get_mesh()->set_buffers();
 			}
 			return true;
@@ -498,7 +524,7 @@
   //delete cluster;
 }

-GLMesh::GLMesh(std::vector<R3>& X0, std::vector<N4>&  Elts0, std::vector<int>& NbPts0, std::vector<R3>& normals0, const std::shared_ptr<Cluster_tree>& cluster0, Palette& palette0)
+GLMesh::GLMesh(const std::vector<R3>& X0, const std::vector<N4>&  Elts0, const std::vector<int>& NbPts0, const std::vector<R3>& normals0, const std::shared_ptr<Cluster_tree>& cluster0, const Palette& palette0)
 	: palette(palette0), cluster(cluster0){
 	X = X0;
 	Elts = Elts0;
@@ -558,6 +584,10 @@

 void GLMesh::set_nblabels(unsigned int n) {
 	nblabels = n;
+}
+
+void GLMesh::set_palette(const Palette& p) {
+	palette = p;
 }

 void GLMesh::TraversalBuildLabel(const Cluster& t, std::vector<int>& labeldofs){
@@ -978,7 +1008,7 @@
 	glfwWindowHint(GLFW_SAMPLES, 4);
 	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

-	gv.glwindow = glfwCreateWindow(1024, 768, "htool gui", nullptr, nullptr);
+	gv.glwindow = glfwCreateWindow(1280, 1024, "htool gui", nullptr, nullptr);

 	int width, height;
 	glfwGetFramebufferSize(gv.glwindow, &width, &height);


Reformat header file of Angle

Reformat header file of Angle

--- include/ics3/angle.hpp
+++ include/ics3/angle.hpp
@@ -39,6 +39,7 @@
 public:
   using rawType = uint16_t;
   using type = double;
+
   static constexpr Angle newDegree(type = 0.0);
   static constexpr Angle newRadian(type = 0.0);
   static constexpr Angle newSameUnit(const Angle&, type = 0.0);
@@ -50,6 +51,7 @@

   Angle(const Angle&) noexcept = default;
   Angle& operator=(const Angle&) noexcept;
+
   constexpr type get() const noexcept;
   constexpr operator type() const noexcept;
   void set(type);
@@ -58,6 +60,7 @@
   void setRaw(rawType);
 private:
   constexpr Angle(type, type); // non explicit, user cannot touch this
+
   static constexpr rawType castToRaw(type, type) noexcept;
   static constexpr rawType checkValidAngle(rawType);


Fix include

Fix include

--- include/os/fstatat.hxx
+++ include/os/fstatat.hxx
@@ -38,7 +38,7 @@
     };

 #  undef _
-#  include "c/SYS_fstat.h"
+#  include "c/SYS_fstatat.h"

     return Result<void, Error>(SYS_fstatat, dirfd, pathname, buf, flags);


Fix enumu compilation problem

Fix enumu compilation problem

--- include/utxx/enumu.hpp
+++ include/utxx/enumu.hpp
@@ -133,12 +133,13 @@
                         (BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__))))              \
         )

-#define UTXX_ENUMU__(ENUM, TYPE, DEF_NAME, DEF_VAL, ...)                       \
+#define UTXX_ENUMU__(ENUM, TYPE, DEF_NAME, DEF_VAL, FIRST_VAL, ...)            \
     struct ENUM {                                                              \
         using value_type = TYPE;                                               \
                                                                                \
         enum type : TYPE {                                                     \
             DEF_NAME = (DEF_VAL),                                              \
+            _START_  = FIRST_VAL-1,                                            \
             BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TRANSFORM(                          \
                 UTXX_ENUM_INTERNAL_GET_NAMEVAL__, _,                           \
                 BOOST_PP_VARIADIC_SEQ_TO_SEQ(__VA_ARGS__)))                    \
@@ -230,7 +231,7 @@
         static void for_each(const Visitor& a_fun) {                           \
             int i=0;                                                           \
             for (auto& m : metas())                                            \
-                if (i++ && !a_fun(m))                                          \
+                if (i++ && !a_fun(std::get<0>(m), m))                          \
                     break;                                                     \
         }                                                                      \
                                                                                \


Changes default value of alpha

Changes default value of alpha

--- include/visualizer.hpp
+++ include/visualizer.hpp
@@ -95,7 +95,7 @@
   bool resizingEnabled{true};
   bool colorLimitsSetByUser{false};
   sf::Uint8 *pixels{NULL};
-  sf::Uint8 alpha{0};
+  sf::Uint8 alpha{255};

   /** Set color corresponding to value */
   void setColor( double value, sf::Color &color ) const;


Attempt to fix ' and \ in messages

Attempt to fix ' and \ in messages

--- interfaces/pyMsgCb.cpp
+++ interfaces/pyMsgCb.cpp
@@ -27,25 +27,38 @@
   int PyRun_SimpleString(const char *string);
 }

-static void pythonMessageCallback(CSOUND *csound, int attr, const char *format, va_list valist)
+static void pythonMessageCallback(CSOUND *csound,
+                                  int attr, const char *format, va_list valist)
 {
-  static char buffer[0x1000];
-  static char buffer1[0x1000];
-  vsprintf(buffer, format, valist);
-  static std::string actualBuffer;
-  static std::string lineBuffer;
-  actualBuffer.append(buffer);
-  size_t position = 0;
-  while((position = actualBuffer.find("\n")) != std::string::npos)
+  char          buffer[8192];
+  static std::string  lineBuffer = "print '''";     // FIXME
+  unsigned int  i, len;
+#ifdef HAVE_C99
+  len = (unsigned int) vsnprintf(&(buffer[0]), (size_t) 8192, format, valist);
+  if (len >= 8192U)
     {
-      lineBuffer = actualBuffer.substr(0, position);
-      actualBuffer.erase(0, position + 1);
-#ifndef MSVC
-      actualBuffer.clear();
+      PyRun_SimpleString("print '''Error: message buffer overflow'''");
+      return;
+    }
+#else
+  len = (unsigned int) vsprintf(&(buffer[0]), format, valist);
+  if (len >= 8192U)
+    {
+      PyRun_SimpleString("print '''Error: message buffer overflow'''");
+      exit(-1);
+    }
 #endif
-      sprintf(buffer1, "print '''%s'''", lineBuffer.c_str());
-      PyRun_SimpleString(buffer1);
+  for (i = 0; i < len; i++) {
+    if (buffer[i] == '\n') {
+      lineBuffer += "'''";
+      PyRun_SimpleString(lineBuffer.c_str());
+      lineBuffer = "print '''";
+      continue;
     }
+    if (buffer[i] == '\'' || buffer[i] == '\\')
+      lineBuffer += '\\';
+    lineBuffer += buffer[i];
+  }
 }

 void CppSound::setPythonMessageCallback()


fix return values for pam_get_user & pam_get_authtok

As pam_get_{user,authtok} return valid PAM return values use them
instead of the generic PAM_AUTH_ERR.

Signed-off-by: Richard Leitner <0f2fdd4d2dfbb4dde6236fd550af0a2071b34781@skidata.com>

--- pam_ldapdb.cpp
+++ pam_ldapdb.cpp
@@ -93,13 +93,17 @@
 {
     const char* user;
     const char* pass;
+    int ret;
     ArgMap arguments = get_args(argc, argv);

-    if (pam_get_user(pamh, &user, NULL) != PAM_SUCCESS) {
-        return PAM_AUTH_ERR;
+    ret = pam_get_user(pamh, &user, NULL);
+    if (ret != PAM_SUCCESS) {
+        return ret;
     }
-    if (pam_get_authtok(pamh, PAM_AUTHTOK, &pass, NULL) != PAM_SUCCESS) {
-        return PAM_AUTH_ERR;
+
+    ret = pam_get_authtok(pamh, PAM_AUTHTOK, &pass, NULL);
+    if (ret != PAM_SUCCESS) {
+        return ret;
     }

     // ensure uri and binddn PAM parameters were specified


Fix \file to match doxygen expectation.

Fix \file to match doxygen expectation.

--- io/io/v7/src/TFile.cxx
+++ io/io/v7/src/TFile.cxx
@@ -1,4 +1,4 @@
-/// \file TFile.cxx
+/// \file v7/src/TFile.cxx
 /// \ingroup Base ROOT7
 /// \author Axel Naumann <axel@cern.ch>
 /// \date 2015-07-31


removed unused includes

removed unused includes

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@804 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- io/src/compression.cpp
+++ io/src/compression.cpp
@@ -45,9 +45,9 @@
 #include "pcl/compression/entropy_range_coder.h"
 #include "pcl/compression/impl/entropy_range_coder.hpp"

-#include "pcl/compression/octree_pointcloud_compression.h"
-#include "pcl/compression/impl/octree_pointcloud_compression.hpp"
+//#include "pcl/compression/octree_pointcloud_compression.h"
+//#include "pcl/compression/impl/octree_pointcloud_compression.hpp"

-template class pcl::octree::OctreePointCloudCompression<pcl::PointXYZRGB>;
+//template class pcl::octree::OctreePointCloudCompression<pcl::PointXYZRGB>;


Add ValueType alias and size() to PriorityQueue

--- packages/Search/src/details/DTK_DetailsPriorityQueue.hpp
+++ packages/Search/src/details/DTK_DetailsPriorityQueue.hpp
@@ -37,10 +37,13 @@
 {
   public:
     using SizeType = size_t;
+    using ValueType = T;

     KOKKOS_FUNCTION PriorityQueue() = default;

     KOKKOS_INLINE_FUNCTION bool empty() const { return _size == 0; }
+
+    KOKKOS_INLINE_FUNCTION IndexType size() const { return _size; }

     template <typename... Args>
     KOKKOS_INLINE_FUNCTION void push( Args &&... args )


Set the NX-compatible bit for patched executables.
If something goes wrong while patching, print it out.

git-svn-id: 43fbdb37a1fde3402d8d2922bf6a94a542354cf8@403 41632dc1-7a16-0410-8441-a1f66f767317

--- wcpatch/src/main.cpp
+++ wcpatch/src/main.cpp
@@ -116,6 +116,10 @@
 		output_file.write(file_buffer.data(), file_buffer.size());
 		return EXIT_SUCCESS;
 	}
+	catch (const exception& e)
+	{
+		cerr << e.what() << endl;
+	}
 	catch (...)
 	{
 	}
@@ -172,8 +176,15 @@
 	file_data.write(uint16_t(5));
 	file_data.write(uint16_t(1));

+	// Set the NX-compatible bit
+	file_data.seek(18);
+	file_data.read(flags);
+	flags |= 0x0100;
+	file_data.seek(-2);
+	file_data.write(flags);
+
 	// Skip to the data directories and clear out the relocation table entry.
-	file_data.seek(40);
+	file_data.seek(20);
 	uint32_t count;
 	file_data.read(count);
 	if (count >= 6)


Set up and tear down the prefilter pipeline

--- tile.cpp
+++ tile.cpp
@@ -1243,6 +1243,18 @@
 			*geompos_in = og;
 		}

+		int prefilter_write = -1, prefilter_read = -1;
+		pid_t prefilter_pid = 0;
+		FILE *prefilter_fd = NULL;
+		if (prefilter != NULL) {
+			setup_filter(prefilter, &prefilter_write, &prefilter_read, &prefilter_pid, z, tx, ty);
+			prefilter_fd = fdopen(prefilter_write, "w");
+			if (prefilter_fd == NULL) {
+				perror("freopen prefilter");
+				exit(EXIT_FAILURE);
+			}
+		}
+
 		while (1) {
 			signed char t;
 			deserialize_byte_io(geoms, &t, geompos_in);
@@ -1449,7 +1461,7 @@
 				decode_meta(m, metakeys, metavals, stringpool + pool_off[segment], tmp_layer, tmp_feature);
 				tmp_layer.features.push_back(tmp_feature);

-				layer_to_geojson(stdout, tmp_layer, 0, 0, 0, false, true);
+				layer_to_geojson(prefilter_fd, tmp_layer, 0, 0, 0, false, true);
 			}

 			if (gamma > 0) {
@@ -1525,6 +1537,27 @@
 			merge_previndex = index;
 		}

+		if (prefilter != NULL) {
+			if (fclose(prefilter_fd) != 0) {
+				perror("fclose output to prefilter");
+				exit(EXIT_FAILURE);
+			}
+			if (close(prefilter_read) != 0) {
+				perror("close output from prefilter");
+				exit(EXIT_FAILURE);
+			}
+			while (1) {
+				int stat_loc;
+				if (waitpid(prefilter_pid, &stat_loc, 0) < 0) {
+					perror("waitpid for prefilter\n");
+					exit(EXIT_FAILURE);
+				}
+				if (WIFEXITED(stat_loc) || WIFSIGNALED(stat_loc)) {
+					break;
+				}
+			}
+		}
+
 		first_time = false;
 		bool merge_successful = true;


Functions need to be compiled once before they can get used.

--- copasi/model/CReaction.cpp
+++ copasi/model/CReaction.cpp
@@ -1,9 +1,9 @@
 /* Begin CVS Header
    $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/model/CReaction.cpp,v $
-   $Revision: 1.128 $
+   $Revision: 1.129 $
    $Name:  $
-   $Author: gauges $
-   $Date: 2005/06/29 09:06:34 $
+   $Author: shoops $
+   $Date: 2005/06/30 15:59:15 $
    End CVS Header */

 // CReaction
@@ -941,6 +941,8 @@
               pFun->addVariable(pFunPar->getObjectName(), pFunPar->getUsage(), pFunPar->getType());
               ++it;
             }
+          pFun->compile();
+
           this->setFunction(pFun);
           it = replacementMap.begin();
           while (it != endIt)


Bug 2631. Guard for NULL pointer added to fix.

--- copasi/model/CReaction.cpp
+++ copasi/model/CReaction.cpp
@@ -1707,11 +1707,11 @@
     }

   // add to function database
-  if (!pFunctionDB->add(pTmpFunction, true))
-  {
-	  CCopasiMessage(CCopasiMessage::ERROR_FILTERED, "Couldn't add expression for '%s' to the function database.", pTmpFunction->getObjectName().c_str());
-  }
-
+  if (pTmpFunction != NULL &&
+      !pFunctionDB->add(pTmpFunction, true))
+    {
+      CCopasiMessage(CCopasiMessage::ERROR_FILTERED, "Couldn't add expression for '%s' to the function database.", pTmpFunction->getObjectName().c_str());
+    }

   return pTmpFunction;
 }


Fix unit test

Fix unit test

--- modules/dreamview/backend/simulation_world/simulation_world_service_test.cc
+++ modules/dreamview/backend/simulation_world/simulation_world_service_test.cc
@@ -61,6 +61,11 @@
       auto* sub_config = config.add_config();
       sub_config->set_mode(AdapterConfig::PUBLISH_ONLY);
       sub_config->set_type(AdapterConfig::ROUTING_RESPONSE);
+    }
+    {
+      auto* sub_config = config.add_config();
+      sub_config->set_mode(AdapterConfig::DUPLEX);
+      sub_config->set_type(AdapterConfig::DRIVE_EVENT);
     }
     AdapterManager::Reset();
     AdapterManager::Init(config);


do not use boost::multiprecision::msb()

do not use boost::multiprecision::msb()

It is not available in boost older than 1.55.

--- types.cc
+++ types.cc
@@ -929,8 +929,7 @@
         if (!num) {
             return 1;
         }
-        auto pnum = abs(num);
-        return align_up(boost::multiprecision::msb(pnum) + 2, 8u) / 8;
+        return boost::multiprecision::cpp_int::canonical_value(num).size() * sizeof(boost::multiprecision::limb_type) + 1;
     }
     virtual int32_t compare(bytes_view v1, bytes_view v2) const override {
         if (v1.empty()) {


Formatted types.hh

Formatted types.hh

--- types.hh
+++ types.hh
@@ -41,32 +41,45 @@
 				inline type_info(const type_info_enum cat) : category(cat) {
 				}

-				inline type_info(const type_info_enum cat, type_info ext) : category(cat), single_extension(new type_info(ext)) {
-				}
-
-				inline type_info(const type_info_enum cat, std::vector<type_info> group) : category(cat), first_group(group) {
-				}
-
-				inline type_info(const type_info_enum cat, type_info ext, std::vector<type_info> group)
-				: category(cat), single_extension(new type_info(ext)), first_group(group) {
-				}
-
-				inline type_info(const type_info_enum cat, std::vector<type_info> first, std::vector<type_info> second)
-				: category(cat), first_group(first), second_group(second) {
-				}
-
-				inline type_info(const type_info_enum cat, type_info ext, std::vector<type_info> first, std::vector<type_info> second)
-				: category(cat), single_extension(new type_info(ext)), first_group(first), second_group(second) {
-				}
-
-				inline type_info(const size_t index) : category(type_info_enum::generic), generic_index(index) {
+				inline type_info(const type_info_enum cat, type_info ext)
+					: category(cat), single_extension(new type_info(ext)) {
+				}
+
+				inline type_info(const type_info_enum cat,
+						std::vector<type_info> group)
+					: category(cat), first_group(group) {
+				}
+
+				inline type_info(const type_info_enum cat, type_info ext,
+						std::vector<type_info> group)
+					: category(cat), single_extension(new type_info(ext)),
+					  first_group(group) {
+				}
+
+				inline type_info(const type_info_enum cat,
+						std::vector<type_info> first,
+						std::vector<type_info> second)
+					: category(cat), first_group(first), second_group(second) {
+				}
+
+				inline type_info(const type_info_enum cat, type_info ext,
+						std::vector<type_info> first,
+						std::vector<type_info> second)
+					: category(cat), single_extension(new type_info(ext)), first_group(first), second_group(second) {
+				}
+
+				inline type_info(const size_t index)
+					: category(type_info_enum::generic), generic_index(index) {
 				}

 				inline type_info(const type_info other, const std::string lbl)
-				: category(other.category), single_extension(other.single_extension), first_group(other.first_group),
-				  second_group(other.second_group), generic_index(other.generic_index), lbl(lbl) {
-				}
-
+					: category(other.category),
+					  single_extension(other.single_extension),
+					  first_group(other.first_group),
+					  second_group(other.second_group),
+					  generic_index(other.generic_index), lbl(lbl) {
+				}
+
 				public:
 				inline type_info() : type_info(type_info_enum::tuple) {
 				}
@@ -80,7 +93,8 @@
 						if (b.single_extension != nullptr)
 							if (*a.single_extension != *b.single_extension)
 								return false;
-							else;
+							else
+								;
 						else
 							return false;
 					else
@@ -108,7 +122,9 @@
 						return false;
 					if (a.single_extension != nullptr)
 						if (b.single_extension != nullptr)
-							if (not (*a.single_extension).is_equivalent(*b.single_extension))
+							if (not (*a.single_extension).is_equivalent(
+										*b.single_extension
+									))
 								return false;
 							else;
 						else
@@ -119,12 +135,16 @@
 					if (a.first_group.size() != b.first_group.size())
 						return false;
 					for (size_t i = 0; i < a.first_group.size(); ++i)
-						if (not a.first_group[i].is_equivalent(b.first_group[i]))
+						if (not a.first_group[i].is_equivalent(
+									b.first_group[i]
+								))
 							return false;
 					if (a.second_group.size() != b.second_group.size())
 						return false;
 					for (size_t i = 0; i < a.second_group.size(); ++i)
-						if (not a.second_group[i].is_equivalent(b.second_group[i]))
+						if (not a.second_group[i].is_equivalent(
+									b.second_group[i]
+								))
 							return false;
 					if (a.generic_index != b.generic_index)
 						return false;
@@ -259,7 +279,10 @@
 				}

 				static inline type_info tuple(const type_info of, const size_t times) {
-					return type_info(type_info_enum::tuple, std::vector<type_info>(times, of));
+					return type_info(
+							type_info_enum::tuple,
+							std::vector<type_info>(times, of)
+						);
 				}

 				static inline type_info tuple(const std::vector<type_info> types) {
@@ -270,11 +293,13 @@
 					return type_info(index);
 				}

-				static inline type_info function(const type_info ret, const std::vector<type_info> args) {
+				static inline type_info function(const type_info ret,
+						const std::vector<type_info> args) {
 					return type_info(type_info_enum::function, ret, args);
 				}

-				static inline type_info code(const std::vector<type_info> inputs, const std::vector<type_info> outputs) {
+				static inline type_info code(const std::vector<type_info> inputs,
+						const std::vector<type_info> outputs) {
 					return type_info(type_info_enum::code, inputs, outputs);
 				}

@@ -325,7 +350,7 @@
 			std::vector<boost::recursive_variant_>,
 			tuple<boost::recursive_variant_>,
 			std::string
-		>::type;
+				>::type;

 		namespace representations {


Exercises.

Exercises.

--- Labiec7.cpp
+++ Labiec7.cpp
@@ -1,5 +1,7 @@
 #include <iostream>
 using namespace std;
+
+int h;

 string printSymbol(char s, int n) {
 	int i = 0;
@@ -12,14 +14,36 @@
 	return line;
 }

+string printSymbol2(char s1, char s2, int n) {
+	string line = "";
+
+	cout << printSymbol(s1, n);
+	cout << s2;
+	cout << printSymbol(s1, h - (2 * n - 1));
+	cout << s2;
+
+	return line;
+}
+
 int main() {
-	int n, i = 1;
+	int i = 1;

-	cin >> n;
+	cin >> h;

-	for (; i <= n; i++) {
-		cout << printSymbol(' ', n - i);
+	for (; i <= h; i++) {
+		cout << printSymbol(' ', h - i);
 		cout << printSymbol('*', 2 * i - 1);
+		cout << "\n";
+	}
+
+	for (i = 1; i <= h; i++) {
+		if (i > 1 && i < h) {
+			cout << printSymbol2(' ', '*', h - i);
+		} else {
+			cout << printSymbol(' ', h - i);
+			cout << printSymbol('*', 2 * i - 1);
+		}
+
 		cout << "\n";
 	}


Fixed arrows along oneway roads

Fixed arrows along oneway roads

--- drape_frontend/stylist.cpp
+++ drape_frontend/stylist.cpp
@@ -125,8 +125,10 @@

     m_auxCaptionFound |= (dRule->GetCaption(1) != nullptr);

-    // Skip lines with zero width.
-    if (dRule->GetLine() != nullptr && dRule->GetLine()->width() < 1e-5)
+    // Skip lines with zero width. Lines can have zero width only if they have
+    // path symbols along.
+    auto const lineRule = dRule->GetLine();
+    if (lineRule != nullptr && (lineRule->width() < 1e-5 && !lineRule->has_pathsym()))
       return;

     m_rules.emplace_back(make_pair(dRule, depth));


Recognize 'weight' style property for CURSES too; LexLPeg.cxx Just make any weight over the normal value be bold. Thanks to Markus F.X.J. Oberhumer.

--- LexLPeg.cxx
+++ LexLPeg.cxx
@@ -243,8 +243,10 @@
 				// SC_WEIGHT_BOLD values stored in the lower 16 bits. Then set the
 				// appropriate curses attr.
 				sptr_t weight = SS(sci, SCI_STYLEGETWEIGHT, num, 0) & ~A_COLORCHAR;
+				int bold = *option == 'b' ||
+				           (*option == 'w' && p && atoi(p) > SC_WEIGHT_NORMAL);
 				SS(sci, SCI_STYLESETWEIGHT, num,
-				   (*option == 'b') ? weight | A_BOLD : weight & ~A_BOLD);
+				   bold ? weight | A_BOLD : weight & ~A_BOLD);
 #endif
 			} else if (streq(option, "italics") || streq(option, "notitalics"))
 				SS(sci, SCI_STYLESETITALIC, num, *option == 'i');


[functionals.l2] disallow copy or move of L2VolumeVectorFunctional

--- dune/gdt/functionals/l2.hh
+++ dune/gdt/functionals/l2.hh
@@ -45,9 +45,17 @@
           class Field = typename Space::RangeFieldType>
 class L2VolumeVectorFunctional : public VectorFunctionalBase<Vector, Space, GridView, Field>
 {
+  typedef L2VolumeVectorFunctional<FunctionType, Space, Vector, GridView, Field> ThisType;
   typedef VectorFunctionalBase<Vector, Space, GridView, Field> BaseType;

 public:
+  /// \sa VectorFunctionalBase
+  L2VolumeVectorFunctional(const ThisType& other) = delete;
+  L2VolumeVectorFunctional(ThisType&& source) = delete;
+
+  ThisType& operator=(const ThisType& other) = delete;
+  ThisType& operator=(ThisType&& source) = delete;
+
   template <class... Args>
   explicit L2VolumeVectorFunctional(const FunctionType& function, Args&&... args)
     : BaseType(std::forward<Args>(args)...)


[operators.base] replaced AssemblableVolumeBase by MatrixBasedBase

--- dune/gdt/operators/base.hh
+++ dune/gdt/operators/base.hh
@@ -17,9 +17,8 @@

 template< class Traits >
-class AssemblableVolumeBase
-    : public AssemblableOperatorInterface< Traits >
-    , public Functor::Codim0< typename Traits::GridViewType >
+class MatrixBasedBase
+  : public AssemblableOperatorInterface< Traits >
 {
   typedef AssemblableOperatorInterface< Traits > InterfaceType;
 public:
@@ -30,53 +29,35 @@

   typedef typename MatrixType::ScalarType   FieldType;
 private:
-  typedef TmpStorageProvider::Matrices< FieldType >         TmpMatricesProviderType;
-  typedef typename Traits::LocalOperatorType                LocalOperatorType;
-  typedef LocalAssembler::Codim0Matrix< LocalOperatorType > LocalAssemblerType;
-  typedef Stuff::LA::Solver< MatrixType >                   LinearSolverType;
+  typedef Stuff::LA::Solver< MatrixType > LinearSolverType;

 public:
   using typename InterfaceType::EntityType;

-  AssemblableVolumeBase(MatrixType& matrix,
-                        const SourceSpaceType& source_space,
-                        const RangeSpaceType& range_space,
-                        const GridViewType& grid_view)
+  MatrixBasedBase(MatrixType& matrix,
+                  const SourceSpaceType& source_space,
+                  const RangeSpaceType& range_space,
+                  const GridViewType& grid_view)
     : matrix_(matrix)
     , source_space_(source_space)
     , range_space_(range_space)
     , grid_view_(grid_view)
-    , local_assembler_(nullptr)
-    , tmp_storage_(nullptr)
-    , linear_solver_(nullptr)
-    , prepared_(false)
     , assembled_(false)
   {}

-  AssemblableVolumeBase(MatrixType& matrix,
-                        const SourceSpaceType& source_space,
-                        const RangeSpaceType& range_space)
+  MatrixBasedBase(MatrixType& matrix, const SourceSpaceType& source_space, const RangeSpaceType& range_space)
     : matrix_(matrix)
     , source_space_(source_space)
     , range_space_(range_space)
     , grid_view_(*(source_space_.grid_view()))
-    , local_assembler_(nullptr)
-    , tmp_storage_(nullptr)
-    , linear_solver_(nullptr)
-    , prepared_(false)
     , assembled_(false)
   {}

-  AssemblableVolumeBase(MatrixType& matrix,
-                        const SourceSpaceType& source_space)
+  MatrixBasedBase(MatrixType& matrix, const SourceSpaceType& source_space)
     : matrix_(matrix)
     , source_space_(source_space)
     , range_space_(source_space_)
     , grid_view_(*(source_space_.grid_view()))
-    , local_assembler_(nullptr)
-    , tmp_storage_(nullptr)
-    , linear_solver_(nullptr)
-    , prepared_(false)
     , assembled_(false)
   {}

@@ -105,57 +86,14 @@
     return matrix_;
   }

-private:
-  virtual const LocalOperatorType& local_operator() const = 0;
-
-public:
-  virtual void prepare()
-  {
-    if (!assembled_ && !prepared_) {
-      local_assembler_ = std::unique_ptr< LocalAssemblerType >(new LocalAssemblerType(local_operator()));
-      tmp_storage_
-          = std::unique_ptr< TmpMatricesProviderType >(new TmpMatricesProviderType(local_assembler_->numTmpObjectsRequired(),
-                                                                                range_space_.mapper().maxNumDofs(),
-                                                                                source_space_.mapper().maxNumDofs()));
-      prepared_ = true;
-    }
-  } // ... prepare()
-
-  virtual void apply_local(const EntityType& entity)
-  {
-    assert(prepared_);
-    assert(local_assembler_);
-    assert(tmp_storage_);
-    local_assembler_->assembleLocal(range_space_, source_space_,
-                                    entity,
-                                    matrix(),
-                                    tmp_storage_->matrices(), tmp_storage_->indices());
-  } // ... apply_local(...)
-
-  virtual void finalize()
-  {
-    if (!linear_solver_)
-      linear_solver_ = std::unique_ptr< LinearSolverType >(new LinearSolverType(matrix_));
-  }
-
-  void assemble()
-  {
-    if (!assembled_) {
-      GridWalker< GridViewType > grid_walker(grid_view_);
-      grid_walker.add(*this);
-      grid_walker.walk();
-      assembled_ = true;
-    }
-  } // ... assemble()
+  virtual void assemble() = 0;

   template< class S, class R >
   void apply(const Stuff::LA::VectorInterface< S >& source, Stuff::LA::VectorInterface< R >& range)
   {
-    typedef typename S::derived_type SourceType;
-    typedef typename R::derived_type RangeType;
     assemble();
-    matrix_.mv(static_cast< const SourceType& >(source), static_cast< RangeType& >(range));
-  }
+    matrix_.mv(source.as_imp(), range.as_imp());
+  } // ... apply(...)

   static std::vector< std::string > invert_options()
   {
@@ -172,24 +110,17 @@
                      Stuff::LA::VectorInterface< S >& source,
                      const Stuff::Common::ConfigTree& opts)
   {
-    typedef typename S::derived_type SourceType;
-    typedef typename R::derived_type RangeType;
     assemble();
-    assert(linear_solver_);
-    linear_solver_->apply(static_cast< const RangeType& >(range), static_cast< SourceType& >(source), opts);
-  }
+    LinearSolverType(matrix).apply(range.as_imp(), source.as_imp(), opts);
+  } // ... apply_inverse(...)

 private:
   MatrixType& matrix_;
   const SourceSpaceType& source_space_;
   const RangeSpaceType& range_space_;
   const GridViewType& grid_view_;
-  std::unique_ptr< LocalAssemblerType > local_assembler_;
-  std::unique_ptr< TmpMatricesProviderType > tmp_storage_;
-  std::unique_ptr< LinearSolverType > linear_solver_;
-  bool prepared_;
   bool assembled_;
-}; // class AssemblableVolumeBase
+}; // class MatrixBasedBase

 } // namespace Operators


PropertyEditor: Add missing MAKE_PROPSELECT.

Fixes #15745

--- editor/property_editor.cpp
+++ editor/property_editor.cpp
@@ -665,6 +665,8 @@

 			} else if (hint == PROPERTY_HINT_PROPERTY_OF_INSTANCE) {

+				MAKE_PROPSELECT
+
 				Object *instance = ObjectDB::get_instance(hint_text.to_int64());
 				if (instance)
 					property_select->select_property_from_instance(instance, v);


Fixed setting node as root showing error and making invisible children visible.

Fixed setting node as root showing error and making invisible children visible.

--- editor/scene_tree_dock.cpp
+++ editor/scene_tree_dock.cpp
@@ -574,6 +574,8 @@
 			editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node);
 			editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename());
 			editor_data->get_undo_redo().add_do_method(root, "set_filename", String());
+			editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)NULL);
+			editor_data->get_undo_redo().add_do_method(root, "set_owner", node);
 			_node_replace_owner(root, root, node, MODE_DO);

 			editor_data->get_undo_redo().add_undo_method(root, "set_filename", root->get_filename());
@@ -581,6 +583,9 @@
 			editor_data->get_undo_redo().add_undo_method(node, "remove_child", root);
 			editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root);
 			editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node);
+			editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)NULL);
+			editor_data->get_undo_redo().add_undo_method(node, "set_owner", root);
+
 			_node_replace_owner(root, root, root, MODE_UNDO);

 			editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
@@ -982,7 +987,7 @@

 void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root, ReplaceOwnerMode p_mode) {

-	if (p_node->get_owner() == p_base || !p_node->get_owner()) {
+	if (p_node->get_owner() == p_base && p_node != p_root) {
 		UndoRedo *undo_redo = &editor_data->get_undo_redo();
 		switch (p_mode) {
 			case MODE_BIDI: {


midterm refactoring

midterm refactoring

--- elenasrc2/elc/compiler.cpp
+++ elenasrc2/elc/compiler.cpp
@@ -2209,26 +2209,26 @@
 //      case nsInlineExpression:
 //         result = compileNestedExpression(objectNode, scope, HINT_ACTION);
 //         break;
-//      case nsExpression:
-////         if (isCollection(member)) {
-////            TerminalInfo parentInfo = objectNode.Terminal();
-////            // if the parent class is defined
-////            if (parentInfo == tsIdentifier || parentInfo == tsReference || parentInfo == tsPrivate) {
-////               ref_t vmtReference = scope.moduleScope->mapTerminal(parentInfo, true);
-////               if (vmtReference == 0)
-////                  scope.raiseError(errUnknownObject, parentInfo);
-////
-////               result = compileCollection(member, scope, 0, vmtReference);
-////            }
-////            else result = compileCollection(member, scope, 0);
-////         }
-//         /*else {*/
-//         result = compileExpression(member, scope, 0);
-//         /*}*/
+      case nsExpression:
+//         if (isCollection(member)) {
+//            TerminalInfo parentInfo = objectNode.Terminal();
+//            // if the parent class is defined
+//            if (parentInfo == tsIdentifier || parentInfo == tsReference || parentInfo == tsPrivate) {
+//               ref_t vmtReference = scope.moduleScope->mapTerminal(parentInfo, true);
+//               if (vmtReference == 0)
+//                  scope.raiseError(errUnknownObject, parentInfo);
+//
+//               result = compileCollection(member, scope, 0, vmtReference);
+//            }
+//            else result = compileCollection(member, scope, 0);
+//         }
+         /*else {*/
+         result = compileExpression(member, scope, 0);
+         /*}*/
+         break;
+//      case nsMessageReference:
+//         result = compileMessageReference(member, scope);
 //         break;
-////      case nsMessageReference:
-////         result = compileMessageReference(member, scope);
-////         break;
       default:
          result = compileTerminal(objectNode, scope, mode);
    }


Core now has option to print out memory

Core now has option to print out memory

--- emulator/emulator_main.cpp
+++ emulator/emulator_main.cpp
@@ -11,6 +11,8 @@

 #include <fstream>
 #include <iostream>
+#include <limits>
+#include <sstream>
 #include <stdexcept>
 #include <vector>

@@ -78,7 +80,7 @@

     string in;
     while(true) {
-        cin >> in;
+        getline(cin, in);

         if(in == "q" || in == "quit") {
             cout << "Goodbye" << endl;
@@ -89,8 +91,23 @@
             core.printRegisters();
         } else if(in == "h" || in == "help") {
             printMainLoopHelp();
+        } else if(in.find("pm") == 0 || in.find("print memory") == 0) {
+            cout << "Enter index and length" << endl;
+
+            string s;
+            getline(cin, s);
+            stringstream ss{s};
+
+            uint16_t begin = 0, len = 0;
+            if(!(ss >> begin) || !(ss >> len)) {
+                cout << "Wrong line encountered - " << s << endl;
+                continue;
+            }
+            core.printMemory(begin, begin + len);
         } else {
-            cout << "Use 'h' or 'help' for help on commands, 'q' or 'quit' to quit" << endl;
+            if(in.size()) {
+                cout << "Use 'h' or 'help' for help on commands, 'q' or 'quit' to quit" << endl;
+            }
         }
     }
 }


Option flags: create separate namespaces

--- DataLoader.hpp
+++ DataLoader.hpp
@@ -21,6 +21,24 @@
 		// No Flags
 		const unsigned NullOpts = 0;

+		namespace Arbitrary
+		{
+			/*
+			-- Work with arbitrary values/numbers
+			*/
+
+			namespace Parse
+			{
+				// If met delimeter separated values, read one by one
+				const unsigned Separately = 1;
+
+				// If met delimeter separated values, read as vector
+				const unsigned Continuously = (1 << 1);
+			}
+
+			namespace Check {}
+		}
+
 		namespace Vector
 		{
 			namespace Parse
@@ -55,7 +73,7 @@
 				// Read dimentions: each value on separate line {val_1 \n val_2}
 				const unsigned DimentionsLineByLine = 1;

-				// Read dimentions: each value on the same line {val_1 <delim> val_2 }
+				// Read dimentions: both values on the same line {val_1 <delim> val_2 }
 				const unsigned DimentionsAtOnce = (1 << 1);
 			}

@@ -64,38 +82,12 @@
 	}

 	// Namespace Aliases
+	namespace Flags_Arbitrary_Parse = Flags::Arbitrary::Parse;
+	namespace Flags_Arbitrary_Check = Flags::Arbitrary::Check;
 	namespace Flags_Vector_Parse = Flags::Vector::Parse;
 	namespace Flags_Vector_Check = Flags::Vector::Check;
 	namespace Flags_Matrix_Parse = Flags::Matrix::Parse;
 	namespace Flags_Matrix_Check = Flags::Matrix::Check;
-
-	namespace Flags
-	{
-		// [ReadVector]
-
-		/* Assume that size for vector is not provided */
-		//const unsigned VectorNoSize = 1;
-		/* Read size of vector and validate if the number of given items corresponds */
-		//const unsigned VectorReadSize = (1 << 1);
-		/* Check if all vectors have the same length */
-		//const unsigned CheckVectorsLenEquality = (1 << 2);
-
-		// [ReadMatrix]
-
-		/* Read dimensions (row, col) */
-		//const unsigned ReadDimentions = (1 << 3);
-		/* Read dimentions: each value on separate line {val_1 \n val_2} */
-		//const unsigned ReadDimLineByLine = (1 << 4);
-		/* Read dimentions: each value on the same line {val_1 <delim> val_2 } */
-		//const unsigned ReadDimOneLine = (1 << 5);
-
-		// [ReadArbitrary]
-
-		/* If met delimeter separated values, read one by one */
-		const unsigned ReadSeparately = (1 << 6);
-		/* If met delimeter separated values, read as vector */
-		const unsigned ReadContinuously = (1 << 7);
-	}

 	namespace State
 	{
@@ -226,7 +218,7 @@
 			storage.reserve(_storageVector[idx].size());
 			std::copy(_storageVector[idx].begin(), _storageVector[idx].end(), std::back_inserter(storage));
 		};
-
+
 		// Fill in given array storage
 		void arg_vector(size_t idx, U* storage)
 		{
@@ -240,7 +232,7 @@
 		// Return flattened matrix
 		std::vector<U> arg_matrix()
 		{
-			return _storageMatrix();
+			return _storageMatrix;
 		}

 		// Fill in given array storage
@@ -260,7 +252,8 @@
 		}

 		// Parse input file without data specification
-		void read_arbitrary(unsigned opts = Flags::ReadSeparately, Kind type = Kind::Arbitrary)
+		void read_arbitrary(unsigned check_opts = Flags::NullOpts,
+			unsigned parse_opts = Flags_Arbitrary_Parse::Separately, Kind type = Kind::Arbitrary)
 		{}

 		// Parse input file for vector-based data
@@ -290,16 +283,16 @@
 			// we are to read in one vector storage until the end of the file
 			bool readUntilEOF = !checkVecLength && (parse_opts & Flags_Vector_Parse::ItemsLineByLine);

-			while (std::getline(fstream, line))
+			while (fstream.good())
 			{
 				std::vector<U> storageItem;

 				// Read vector's length
-				if (checkVecLength)
+				if (checkVecLength && std::getline(fstream, line))
 				{
 					sstream.str(line);
 					sstream >> lenNextVector;
-					sstream.clear();
+					sstream.clear();

 					storageItem.reserve(lenNextVector);
 				}


fix to rename tagdb0000.002.dat

fix to rename tagdb0000.002.dat

--- RdbBase.cpp
+++ RdbBase.cpp
@@ -1372,7 +1372,9 @@
 	long numFiles = m_numFiles;
 	if ( numFiles > 0 && m_dump->isDumping() ) numFiles--;
 	// need at least 1 file to merge, stupid (& don't forget: u r stooopid)
-	if ( numFiles <= 1 ) return;
+	// crap, we need to recover those tagdb0000.002.dat files, so
+	// comment this out so we can do a resume on it
+	//if ( numFiles <= 1 ) return;
 	// . wait for all unlinking and renaming activity to flush out
 	// . otherwise, a rename or unlink might still be waiting to happen
 	//   and it will mess up our merge
@@ -1544,6 +1546,10 @@
 		resuming = true;
 		break;
 	}
+
+	// this triggers the negative rec concentration msg below and
+	// tries to merge on one file...
+	if ( ! resuming && m_numFiles <= 1 ) return;

 	// what percent of recs in the collections' rdb are negative?
 	// the rdbmaps hold this info
@@ -1808,7 +1814,12 @@
 			log("merge: Only merging %li instead of the "
 			    "original %li files.",mm,n);
 			// cause the "if (mm==0)" to kick in below
-			//if ( mm == 1 ) mm = 0;
+			if ( mm == 1 || mm == 0 ) {
+				mm = 0;
+				// fix renaming final merged file tagdb-001.dat
+				mergeFileId = 2;
+				m_fileIds[j] = 1;
+			}
 		}
 		// how many files to merge?
 		n = mm;
@@ -1830,6 +1841,7 @@
 				sprintf(fbuf,"%s%04li-%03li.dat",
 					m_dbname,mergeFileId-1,id2);
 			log("merge: renaming final merged file %s",fbuf);
+			// this does not use a thread...
 			m_files[j]->rename(fbuf);
 			sprintf(fbuf,"%s%04li.map",m_dbname,mergeFileId-1);
 			//File *mf = m_maps[j]->getFile();


Initialize RelativeRel for AMDGPU.

Initialize RelativeRel for AMDGPU.

Target->RelativeRel is used for all platforms, but AMDGPU did
not send that member.

Fixes bug 30227 - RelativeRel is used, but not initialized for AMDGPU.

Differential Revision: https://reviews.llvm.org/D24100

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@280291 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -1457,6 +1457,7 @@
 }

 AMDGPUTargetInfo::AMDGPUTargetInfo() {
+  RelativeRel = R_AMDGPU_REL64;
   GotRel = R_AMDGPU_ABS64;
   GotEntrySize = 8;
 }


add miss constructor (#1)

add miss constructor (#1)

* add miss constructor

* remove empty line

* Update Resolver.cc

--- Resolver.cc
+++ Resolver.cc
@@ -50,6 +50,19 @@
   ctx_ = ::dns_new(NULL);
   assert(ctx_ != NULL);
   ::dns_set_opt(ctx_, DNS_OPT_TIMEOUT, 2);
+}
+
+Resolver::Resolver(EventLoop *loop, const InetAddress &nameServer):
+    loop_(loop),
+    ctx_(NULL),
+    fd_(-1),
+    timerActive_(false)
+{
+    init_udns();
+    ctx_ = ::dns_new(NULL);
+    assert(ctx_ != NULL);
+    ::dns_add_serv_s(ctx_, nameServer.getSockAddr());
+    ::dns_set_opt(ctx_, DNS_OPT_TIMEOUT, 2);
 }

 Resolver::~Resolver()


ELF: Move GNU_IFUNC relocation handler to one place. NFC.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@259468 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -306,6 +306,24 @@
       }
     }

+    // An STT_GNU_IFUNC symbol always uses a PLT entry, and all references
+    // to the symbol go through the PLT. This is true even for a local
+    // symbol, although local symbols normally do not require PLT entries.
+    if (Body && isGnuIFunc<ELFT>(*Body)) {
+      Body->setUsedInDynamicReloc();
+      if (Body->isInGot())
+        continue;
+      Out<ELFT>::Plt->addEntry(Body);
+      if (Target->UseLazyBinding) {
+        Out<ELFT>::GotPlt->addEntry(Body);
+        Out<ELFT>::RelaPlt->addReloc({&C, &RI});
+      } else {
+        Out<ELFT>::Got->addEntry(Body);
+        Out<ELFT>::RelaDyn->addReloc({&C, &RI});
+      }
+      continue;
+    }
+
     bool NeedsGot = false;
     bool NeedsPlt = false;

@@ -326,15 +344,6 @@
           Out<ELFT>::Got->addEntry(Body);
         }
       }
-    }
-
-    // An STT_GNU_IFUNC symbol always uses a PLT entry, and all references
-    // to the symbol go through the PLT. This is true even for a local
-    // symbol, although local symbols normally do not require PLT entries.
-    if (Body && isGnuIFunc<ELFT>(*Body)) {
-      Body->setUsedInDynamicReloc();
-      Out<ELFT>::RelaPlt->addReloc({&C, &RI});
-      continue;
     }

     if (Config->EMachine == EM_MIPS) {


mutex instance

mutex instance

--- EiTOS/main.cpp
+++ EiTOS/main.cpp
@@ -5,6 +5,8 @@
 #include "drivers/serial.hpp"

 Serial serial;
+
+mutex muteks_01;

 void Task1() {
     while (1) {
@@ -37,8 +39,8 @@
     PORTB = 0;

     sys::taskCreate(&Task1, 0, 0xFF);
-    sys::taskCreate(&Task2, 0, 0x10);
-    sys::taskCreate(&Task3, 0, 0x10);
+    sys::taskCreate(&Task2, 0, 0x20);
+    sys::taskCreate(&Task3, 0, 0x20);

     // TP ONLY END


added const to some char arrays

added const to some char arrays

--- Exceptions.hpp
+++ Exceptions.hpp
@@ -9,13 +9,14 @@

 #include <exception>
 #include <stdio.h>
+namespace SIPL {

 class SIPLException : public std::exception {
     public:
         SIPLException() {
             this->line = -1;
         };
-        SIPLException(char * message) {
+        SIPLException(const char * message) {
             this->line = -1;
             this->message = message;
         };
@@ -23,7 +24,7 @@
             this->line = line;
             this->file = file;
         };
-        SIPLException(char * message, int line, char * file) {
+        SIPLException(const char * message, int line, char * file) {
             this->message = message;
             this->line = line;
             this->file = file;
@@ -43,13 +44,13 @@
         void setFile(const char * file) {
             this->file = file;
         };
-        void setMessage(char * message) {
+        void setMessage(const char * message) {
             this->message = message;
         };
     private:
         int line;
         const char * file;
-        char * message;
+        const char * message;
 };

 class IOException : public SIPLException {
@@ -163,4 +164,6 @@
 class ConversionException : public SIPLException {
 };

+}; // END NAMESPACE SIPL
+
 #endif


Added makeframe with no ack

Added makeframe with no ack

--- SRQNode.cpp
+++ SRQNode.cpp
@@ -77,7 +77,7 @@
 	frame = frame << 4;
 	frame = frame | 11;
 	frame = frame << 2;
-	frame = frame | 0; //00 means send; 10 means send ack; 11 means nack
+	frame = frame | 0; //00 means send; 01 means send ack; 11 means nack
 }

 void * requestToSendHandler(void * arg){


everything works, but theres a few optimizations that can be fixed. it now 'acts' like a ks0108 in terms of orientation


fix a memory leak

fix a memory leak

--- ServEnv.cpp
+++ ServEnv.cpp
@@ -56,7 +56,6 @@
     if (ini->perror == Ini::NO_ERROR) {
         LOGI("Parse config file \"%s\" %ssuc%s", path, ANSI_COLOR_GREEN, ANSI_COLOR_NORMAL);
     } else {
-        ini = new Ini();
         LOGI(
                 "Parse config file \"%s\" %sfailed%s, maybe file not exist, will use default values for all params",
                 path, ANSI_COLOR_ORANGE, ANSI_COLOR_NORMAL


fixed typo

fixed typo

--- HTTPServer.cpp
+++ HTTPServer.cpp
@@ -818,7 +818,7 @@
 		url.parse_query(params);

 		std::string token = params["token"];
-		if (!token.empty () || m_Tokens.find (std::stoi (token)) == m_Tokens.end ())
+		if (token.empty () || m_Tokens.find (std::stoi (token)) == m_Tokens.end ())
 		{
 			ShowError(s, "Invalid token");
 			return;


Rewrote fillCircle method...

Rewrote fillCircle method...

--- SSD1306.cpp
+++ SSD1306.cpp
@@ -135,16 +135,24 @@
   setPixel(x0, y0 - radius);
 }

-void SSD1306::fillCircle(int16_t x, int16_t y, int16_t radius) {
-  int sqrRadius = radius * radius;
-  for (int xv = -radius; xv < radius; xv++) {
-    for (int yv = -radius; yv < radius; yv++) {
-      int currentSqrRadius = xv * xv + yv * yv;
-      if (currentSqrRadius <= sqrRadius) {
-        setPixel(x + xv, y + yv);
-      }
-    }
-  }
+void SSD1306::fillCircle(int16_t x0, int16_t y0, int16_t radius) {
+  int16_t x = 0, y = radius;
+	int16_t dp = 1 - radius;
+	do {
+		if (dp < 0)
+			dp = dp + 2 * (++x) + 3;
+		else
+			dp = dp + 2 * (++x) - 2 * (--y) + 5;
+
+    drawHorizontalLine(x0 - x, y0 - y, 2*x);
+    drawHorizontalLine(x0 - x, y0 + y, 2*x);
+    drawHorizontalLine(x0 - y, y0 - x, 2*y);
+    drawHorizontalLine(x0 - y, y0 + x, 2*y);
+
+
+	} while (x < y);
+  drawHorizontalLine(x0 - radius, y0, 2 * radius);
+
 }

 void SSD1306::drawHorizontalLine(int16_t x, int16_t y, int16_t length) {


Adjustments due to moving to standard fixed width int types

--- SafeInt.hpp
+++ SafeInt.hpp
@@ -5763,31 +5763,31 @@
         return val;
     }

-    _CONSTEXPR14 operator std::int16_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator short() const SAFEINT_CPP_THROW
     {
         std::int16_t val = 0;
-        SafeCastHelper< std::int16_t, T, GetCastMethod< std::int16_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< short, T, GetCastMethod< short, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

-    _CONSTEXPR14 operator std::uint16_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator unsigned short() const SAFEINT_CPP_THROW
     {
         std::uint16_t val = 0;
-        SafeCastHelper< std::uint16_t, T, GetCastMethod< std::uint16_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< unsigned short, T, GetCastMethod< unsigned short, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

-    _CONSTEXPR14 operator std::int32_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator int() const SAFEINT_CPP_THROW
     {
         std::int32_t val = 0;
-        SafeCastHelper< std::int32_t, T, GetCastMethod< std::int32_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< int, T, GetCastMethod< int, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

-    _CONSTEXPR14 operator std::uint32_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator unsigned int() const SAFEINT_CPP_THROW
     {
         std::uint32_t val = 0;
-        SafeCastHelper< std::uint32_t, T, GetCastMethod< std::uint32_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< unsigned int, T, GetCastMethod< unsigned int, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

@@ -5807,17 +5807,17 @@
         return val;
     }

-    _CONSTEXPR14 operator std::int64_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator long long() const SAFEINT_CPP_THROW
     {
         std::int64_t val = 0;
-        SafeCastHelper< std::int64_t, T, GetCastMethod< std::int64_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< long long, T, GetCastMethod< long long, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

-    _CONSTEXPR14 operator std::uint64_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator unsigned long long() const SAFEINT_CPP_THROW
     {
         std::uint64_t val = 0;
-        SafeCastHelper< std::uint64_t, T, GetCastMethod< std::uint64_t, T >::method >::template CastThrow< E >( m_int, val );
+        SafeCastHelper< unsigned long long, T, GetCastMethod< unsigned long long, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }

@@ -5828,15 +5828,17 @@
         return val;
     }

+#ifdef SIZE_T_CAST_NEEDED
     // We also need an explicit cast to size_t, or the compiler will complain
     // Apparently, only SOME compilers complain, and cl 14.00.50727.42 isn't one of them
     // Leave here in case we decide to backport this to an earlier compiler
-    operator size_t() const SAFEINT_CPP_THROW
+    _CONSTEXPR14 operator size_t() const SAFEINT_CPP_THROW
     {
         size_t val = 0;
         SafeCastHelper< size_t, T, GetCastMethod< size_t, T >::method >::template CastThrow< E >( m_int, val );
         return val;
     }
+#endif

     // Also provide a cast operator for floating point types
     _CONSTEXPR14 operator float() const SAFEINT_CPP_THROW