server/touch: Add test for Button1Motion mask on emulated pointer motion

Signed-off-by: Peter Hutterer <b9c50af7afa7642f6f854434cda9ffe54ece8b85@who-t.net>

--- tests/server/touch.cpp
+++ tests/server/touch.cpp
@@ -197,6 +197,27 @@
     ASSERT_EQ(ev.type, ButtonRelease);
     EXPECT_EQ(ev.xbutton.state, (unsigned int)Button1Mask);
     EXPECT_EQ(ev.xbutton.button, 1U) << "ButtonRelease must have button 1 mask down";
+}
+
+TEST_P(TouchTestXI2Version, EmulatedButton1MotionMaskOnTouch)
+{
+    XORG_TESTCASE("Select for core Pointer1Motion mask on the root window.\n"
+                  "Create a pointer-emulating touch event.\n"
+                  "Expect a motion event with the button mask 1.\n")
+
+    XSelectInput(Display(), DefaultRootWindow(Display()), Button1MotionMask);
+    XSync(Display(), False);
+
+    dev->Play(RECORDINGS_DIR "tablets/N-Trig-MultiTouch.touch_1_begin.events");
+    dev->Play(RECORDINGS_DIR "tablets/N-Trig-MultiTouch.touch_1_end.events");
+
+    ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(Display(),
+                                                           MotionNotify,
+                                                           -1, -1));
+    XEvent ev;
+    XNextEvent(Display(), &ev);
+    ASSERT_EQ(ev.type, MotionNotify);
+    EXPECT_EQ(ev.xmotion.state, (unsigned int)Button1Mask);
 }

 TEST_P(TouchTestXI2Version, EmulatedButtonMaskOnTouchBeginEndXI2)


Add VAST error categories to Broker config

--- tools/bro-to-vast/bro-to-vast.cpp
+++ tools/bro-to-vast/bro-to-vast.cpp
@@ -33,6 +33,7 @@
 #include <vast/system/writer_command_base.hpp>
 #include <vast/system/sink.hpp>

+#include <vast/detail/add_error_categories.hpp>
 #include <vast/detail/add_message_types.hpp>
 #include <vast/detail/assert.hpp>
 #include <vast/detail/overload.hpp>
@@ -157,6 +158,7 @@
   // Parse the command line.
   config cfg;
   vast::detail::add_message_types(cfg);
+  vast::detail::add_error_categories(cfg);
   cfg.parse(argc, argv);
   std::string address = caf::get_or(cfg, "address", default_address);
   uint16_t port = caf::get_or(cfg, "port", default_port);


[llvm-cov] Adjust column widths for function and file reports

Previously, we only expanded function and filename column widths when
rendering file reports. This commit makes the change for function
reports as well.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@250900 91177308-0d34-0410-b5e6-96231b3b80d8

--- tools/llvm-cov/CoverageReport.cpp
+++ tools/llvm-cov/CoverageReport.cpp
@@ -90,6 +90,17 @@

 static size_t FileReportColumns[] = {25, 10, 8, 8, 10, 10};
 static size_t FunctionReportColumns[] = {25, 10, 8, 8, 10, 8, 8};
+
+/// \brief  Adjust column widths to fit long file paths and function names.
+static void adjustColumnWidths(coverage::CoverageMapping *CM) {
+  for (StringRef Filename : CM->getUniqueSourceFiles()) {
+    FileReportColumns[0] = std::max(FileReportColumns[0], Filename.size());
+    for (const auto &F : CM->getCoveredFunctions(Filename)) {
+      FunctionReportColumns[0] =
+          std::max(FunctionReportColumns[0], F.Name.size());
+    }
+  }
+}

 /// \brief Prints a horizontal divider which spans across the given columns.
 template <typename T, size_t N>
@@ -162,6 +173,7 @@

 void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files,
                                            raw_ostream &OS) {
+  adjustColumnWidths(Coverage.get());
   bool isFirst = true;
   for (StringRef Filename : Files) {
     if (isFirst)
@@ -196,15 +208,7 @@
 }

 void CoverageReport::renderFileReports(raw_ostream &OS) {
-  // Adjust column widths to accomodate long paths and names.
-  for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
-    FileReportColumns[0] = std::max(FileReportColumns[0], Filename.size());
-    for (const auto &F : Coverage->getCoveredFunctions(Filename)) {
-      FunctionReportColumns[0] =
-          std::max(FunctionReportColumns[0], F.Name.size());
-    }
-  }
-
+  adjustColumnWidths(Coverage.get());
   OS << column("Filename", FileReportColumns[0])
      << column("Regions", FileReportColumns[1], Column::RightAlignment)
      << column("Miss", FileReportColumns[2], Column::RightAlignment)


Initialize V8 external data (XFA version).

This is a quick patch to fix the segv which occurs in pdfium_test when
the v8 external data is not provided.  Fixing the full-up initialization
is left as a follow-on exercise.

Path manipulations remain a nuisance since we don't want to depend on a
particular /base library.

BUG=439793
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/810793004

--- samples/pdfium_test.cc
+++ samples/pdfium_test.cc
@@ -11,6 +11,7 @@
 #include <list>
 #include <string>
 #include <utility>
+#include <vector>

 #include "../fpdfsdk/include/fpdf_dataavail.h"
 #include "../fpdfsdk/include/fpdf_ext.h"
@@ -21,7 +22,10 @@
 #include "v8/include/v8.h"

 #ifdef _WIN32
-  #define snprintf _snprintf
+#define snprintf _snprintf
+#define PATH_SEPARATOR '\\'
+#else
+#define PATH_SEPARATOR '/'
 #endif

 enum OutputFormat {
@@ -32,6 +36,80 @@
   OUTPUT_EMF,
 #endif
 };
+
+struct Options {
+  Options() : output_format(OUTPUT_NONE) { }
+
+  OutputFormat output_format;
+  std::string exe_path;
+  std::string bin_directory;
+};
+
+// Reads the entire contents of a file into a newly malloc'd buffer.
+static char* GetFileContents(const char* filename, size_t* retlen) {
+  FILE* file = fopen(filename, "rb");
+  if (!file) {
+    fprintf(stderr, "Failed to open: %s\n", filename);
+    return NULL;
+  }
+  (void) fseek(file, 0, SEEK_END);
+  size_t file_length = ftell(file);
+  if (!file_length) {
+    return NULL;
+  }
+  (void) fseek(file, 0, SEEK_SET);
+  char* buffer = (char*) malloc(file_length);
+  if (!buffer) {
+    return NULL;
+  }
+  size_t bytes_read = fread(buffer, 1, file_length, file);
+  (void) fclose(file);
+  if (bytes_read != file_length) {
+    fprintf(stderr, "Failed to read: %s\n", filename);
+    free(buffer);
+    return NULL;
+  }
+  *retlen = bytes_read;
+  return buffer;
+}
+
+#ifdef V8_USE_EXTERNAL_STARTUP_DATA
+// Returns the full path for an external V8 data file based on either
+// the currect exectuable path or an explicit override.
+static std::string GetFullPathForSnapshotFile(const Options& options,
+                                              const std::string& filename) {
+  std::string result;
+  if (!options.bin_directory.empty()) {
+    result = options.bin_directory;
+    if (*options.bin_directory.rbegin() != PATH_SEPARATOR) {
+      result += PATH_SEPARATOR;
+    }
+  } else if (!options.exe_path.empty()) {
+    size_t last_separator = options.exe_path.rfind(PATH_SEPARATOR);
+    if (last_separator != std::string::npos)  {
+      result = options.exe_path.substr(0, last_separator + 1);
+    }
+  }
+  result += filename;
+  return result;
+}
+
+// Reads an extenal V8 data file from the |options|-indicated location,
+// returing true on success and false on error.
+static bool GetExternalData(const Options& options,
+                            const std::string& bin_filename,
+                            v8::StartupData* result_data) {
+  std::string full_path = GetFullPathForSnapshotFile(options, bin_filename);
+  size_t data_length = 0;
+  char* data_buffer = GetFileContents(full_path.c_str(), &data_length);
+  if (!data_buffer) {
+    return false;
+  }
+  result_data->data = const_cast<const char*>(data_buffer);
+  result_data->raw_size = data_length;
+  return true;
+}
+#endif  // V8_USE_EXTERNAL_STARTUP_DATA

 static void WritePpm(const char* pdf_name, int num, const void* buffer_void,
                      int stride, int width, int height) {
@@ -198,34 +276,57 @@
   printf("Unsupported feature: %s.\n", feature.c_str());
 }

-bool ParseCommandLine(int argc, const char* argv[], OutputFormat* output_format,
-                      std::list<const char*>* files) {
-  *output_format = OUTPUT_NONE;
-  files->clear();
-
-  int cur_arg = 1;
-  for (; cur_arg < argc; ++cur_arg) {
-    if (strcmp(argv[cur_arg], "--ppm") == 0)
-      *output_format = OUTPUT_PPM;
+bool ParseCommandLine(const std::vector<std::string>& args,
+                      Options* options, std::list<std::string>* files) {
+  if (args.empty()) {
+    return false;
+  }
+  options->exe_path = args[0];
+  int cur_idx = 1;
+  for (; cur_idx < args.size(); ++cur_idx) {
+    const std::string& cur_arg = args[cur_idx];
+    if (cur_arg == "--ppm") {
+      if (options->output_format != OUTPUT_NONE) {
+        fprintf(stderr, "Duplicate or conflicting --ppm argument\n");
+        return false;
+      }
+      options->output_format = OUTPUT_PPM;
+    }
 #ifdef _WIN32
-    else if (strcmp(argv[cur_arg], "--emf") == 0)
-      *output_format = OUTPUT_EMF;
-    else if (strcmp(argv[cur_arg], "--bmp") == 0)
-      *output_format = OUTPUT_BMP;
-#endif
+    else if (cur_arg == "--emf") {
+      if (options->output_format != OUTPUT_NONE) {
+        fprintf(stderr, "Duplicate or conflicting --emf argument\n");
+        return false;
+      }
+      options->output_format = OUTPUT_EMF;
+    }
+    else if (cur_arg == "--bmp") {
+      if (options->output_format != OUTPUT_NONE) {
+        fprintf(stderr, "Duplicate or conflicting --bmp argument\n");
+        return false;
+      }
+      options->output_format = OUTPUT_BMP;
+    }
+#endif  // _WIN32
+#ifdef V8_USE_EXTERNAL_STARTUP_DATA
+    else if (cur_arg.size() > 10 && cur_arg.compare(0, 10, "--bin-dir=") == 0) {
+      if (!options->bin_directory.empty()) {
+        fprintf(stderr, "Duplicate --bin-dir argument\n");
+        return false;
+      }
+      options->bin_directory = cur_arg.substr(10);
+    }
+#endif  // V8_USE_EXTERNAL_STARTUP_DATA
     else
       break;
   }
-
-  if (cur_arg > 2)  // Multiple options.
+  if (cur_idx >= args.size()) {
+    fprintf(stderr, "No input files.\n");
     return false;
-
-  if (cur_arg >= argc)  // No input files.
-    return false;
-
-  for (int i = cur_arg; i < argc; i++)
-    files->push_back(argv[i]);
-
+  }
+  for (int i = cur_idx; i < args.size(); i++) {
+    files->push_back(args[i]);
+  }
   return true;
 }

@@ -256,9 +357,9 @@
 void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) {
 }

-void RenderPdf(const char* name, const char* pBuf, size_t len,
+void RenderPdf(const std::string& name, const char* pBuf, size_t len,
                OutputFormat format) {
-  printf("Rendering PDF file %s.\n", name);
+  printf("Rendering PDF file %s.\n", name.c_str());

   IPDF_JSPLATFORM platform_callbacks;
   memset(&platform_callbacks, '\0', sizeof(platform_callbacks));
@@ -350,15 +451,15 @@
     switch (format) {
 #ifdef _WIN32
       case OUTPUT_BMP:
-        WriteBmp(name, i, buffer, stride, width, height);
+        WriteBmp(name.c_str(), i, buffer, stride, width, height);
         break;

       case OUTPUT_EMF:
-        WriteEmf(page, name, i);
+        WriteEmf(page.c_str(), name, i);
         break;
 #endif
       case OUTPUT_PPM:
-        WritePpm(name, i, buffer, stride, width, height);
+        WritePpm(name.c_str(), i, buffer, stride, width, height);
         break;
       default:
         break;
@@ -382,18 +483,32 @@
 }

 int main(int argc, const char* argv[]) {
-  v8::V8::InitializeICU();
-  OutputFormat format = OUTPUT_NONE;
-  std::list<const char*> files;
-  if (!ParseCommandLine(argc, argv, &format, &files)) {
+  std::vector<std::string> args(argv, argv + argc);
+  Options options;
+  std::list<std::string> files;
+  if (!ParseCommandLine(args, &options, &files)) {
     printf("Usage: pdfium_test [OPTION] [FILE]...\n");
-    printf("--ppm    write page images <pdf-name>.<page-number>.ppm\n");
+    printf("--bin-dir=<path> - override path to v8 external data\n");
+    printf("--ppm - write page images <pdf-name>.<page-number>.ppm\n");
 #ifdef _WIN32
-    printf("--bmp    write page images <pdf-name>.<page-number>.bmp\n");
-    printf("--emf    write page meta files <pdf-name>.<page-number>.emf\n");
+    printf("--bmp - write page images <pdf-name>.<page-number>.bmp\n");
+    printf("--emf - write page meta files <pdf-name>.<page-number>.emf\n");
 #endif
     return 1;
   }
+
+  v8::V8::InitializeICU();
+
+#ifdef V8_USE_EXTERNAL_STARTUP_DATA
+  v8::StartupData natives;
+  v8::StartupData snapshot;
+  if (!GetExternalData(options, "natives_blob.bin", &natives) ||
+      !GetExternalData(options, "snapshot_blob.bin", &snapshot)) {
+    return 1;
+  }
+  v8::V8::SetNativesDataBlob(&natives);
+  v8::V8::SetSnapshotDataBlob(&snapshot);
+#endif  // V8_USE_EXTERNAL_STARTUP_DATA

   FPDF_InitLibrary();

@@ -405,25 +520,14 @@
   FSDK_SetUnSpObjProcessHandler(&unsuppored_info);

   while (!files.empty()) {
-    const char* filename = files.front();
+    std::string filename = files.front();
     files.pop_front();
-    FILE* file = fopen(filename, "rb");
-    if (!file) {
-      fprintf(stderr, "Failed to open: %s\n", filename);
+    size_t file_length = 0;
+    char* file_contents = GetFileContents(filename.c_str(), &file_length);
+    if (!file_contents)
       continue;
-    }
-    (void) fseek(file, 0, SEEK_END);
-    size_t len = ftell(file);
-    (void) fseek(file, 0, SEEK_SET);
-    char* pBuf = (char*) malloc(len);
-    size_t ret = fread(pBuf, 1, len, file);
-    (void) fclose(file);
-    if (ret != len) {
-      fprintf(stderr, "Failed to read: %s\n", filename);
-    } else {
-      RenderPdf(filename, pBuf, len, format);
-    }
-    free(pBuf);
+    RenderPdf(filename, file_contents, file_length, options.output_format);
+    free(file_contents);
   }

   FPDF_DestroyLibrary();


Fixing msgwnd test

Fixing msgwnd test

--- tests/win32/msgwnd.cpp
+++ tests/win32/msgwnd.cpp
@@ -9,24 +9,41 @@
 #include "tests/catch.hpp"

 #include "win32/msgwnd.hpp"
+#include "win32/synch.hpp"

 TEST_CASE("Message window", "[Win32]")
 {
   SECTION("send a message")
   {
+    Windows::Synch::Semaphore s(0,1);
+
+    REQUIRE(s);
+
+    bool flag = false;
+
     Windows::MsgWnd w(
       GetModuleHandle(NULL),
-      [] (UINT uMsg, WPARAM wP, LPARAM lP)
+      [&s, &flag] (UINT uMsg, WPARAM wP, LPARAM lP)
         {
-          REQUIRE(uMsg == (WM_USER + 1));
-          REQUIRE(wP == static_cast< WPARAM >(0x01234567));
-          REQUIRE(lP == static_cast< LPARAM >(0x89ABCDEF));
+          if ((uMsg == (WM_USER + 1)) &&
+              (wP == static_cast< WPARAM >(0x01234567)) &&
+              (lP == static_cast< LPARAM >(0x89ABCDEF)))
+            flag = true;
+
+          s.release();
         });

     w.start();
     REQUIRE(w.handle() != NULL);

-    SendMessage(w.handle(),WM_USER + 1,static_cast< WPARAM >(0x01234567),static_cast< LPARAM >(0x89ABCDEF));
+    PostMessage(
+      w.handle(),
+      WM_USER + 1,
+      static_cast< WPARAM >(0x01234567),
+      static_cast< LPARAM >(0x89ABCDEF));
+
+    s.acquire();
+    REQUIRE(flag);
   }
 }


debug = false

debug = false

--- thrill/mem/manager.hpp
+++ thrill/mem/manager.hpp
@@ -27,7 +27,7 @@
  */
 class Manager
 {
-    static const bool debug = true;
+    static const bool debug = false;

 public:
     explicit Manager(Manager* super, const char* name)


limesdr - enumerate set media and device name

The device name was set to "USB 3.0 (LimeSDR USB)" which looked odd.
Now the device name field reports as LimeSDR USB,
and the media name reports as USB 3.0.

--- src/ConnectionSTREAM/ConnectionSTREAMEntry.cpp
+++ src/ConnectionSTREAM/ConnectionSTREAMEntry.cpp
@@ -157,25 +157,22 @@
                     printf("Cannot Claim Interface\n");
                 }

-                std::string fullName;
+                ConnectionHandle handle;
+
                 //check operating speed
                 int speed = libusb_get_device_speed(devs[i]);
                 if(speed == LIBUSB_SPEED_HIGH)
-                    fullName = "USB 2.0";
+                    handle.media = "USB 2.0";
                 else if(speed == LIBUSB_SPEED_SUPER)
-                    fullName = "USB 3.0";
+                    handle.media = "USB 3.0";
                 else
-                    fullName = "USB";
-                fullName += " (";
+                    handle.media = "USB";
+
                 //read device name
                 char data[255];
                 r = libusb_get_string_descriptor_ascii(tempDev_handle,  LIBUSB_CLASS_COMM, (unsigned char*)data, sizeof(data));
-                if(r > 0) fullName += std::string(data, size_t(r));
-                fullName += ")";
-
-                ConnectionHandle handle;
-                handle.media = "USB";
-                handle.name = fullName;
+                if(r > 0) handle.name = std::string(data, size_t(r));
+
                 r = std::sprintf(data, "%.4x:%.4x", int(vid), int(pid));
                 if (r > 0) handle.addr = std::string(data, size_t(r));


fullscreen on secondary monitor if one

fullscreen on secondary monitor if one

--- FluxOF/src/ofApp.cpp
+++ FluxOF/src/ofApp.cpp
@@ -52,6 +52,26 @@

+    } else if(numberOfMonitors == 2){
+
+
+        //Find the positions of the monitors
+        //
+        vector<ofRectangle> monitorSizes;
+        for (int iC=0; iC < numberOfMonitors; iC++){
+            int xM; int yM;
+            glfwGetMonitorPos(monitors[iC], &xM, &yM);
+            const GLFWvidmode * desktopMode = glfwGetVideoMode(monitors[iC]);
+            ofRectangle monitorRect(xM, yM, desktopMode->width, desktopMode->height);
+            monitorSizes.push_back(monitorRect);
+        }
+
+        ofSetWindowPosition(monitorSizes[0].width + 200, 100);
+        ofSetFullscreen(true);
+
+
+
+
     } else {
         ofToggleFullscreen();
     }


fix bug in suspending edges

fix bug in suspending edges

--- src/src/bundle.cc
+++ src/src/bundle.cc
@@ -712,6 +712,9 @@
 		//if(vi.lpos == gr.get_vertex_info(s).rpos) continue;

 		printf("end suspend boundary: vertex = %d weight = %.2lf stddev = %.2lf length = %d\n", i, wv, vi.stddev, vi.length);
+
+		gr.remove_edge(e1);
+		gr.remove_edge(e2);
 	}
 	return 0;
 }


Add brightness and contrast controls to AlignWidget.

--- tomviz/AlignWidget.cxx
+++ tomviz/AlignWidget.cxx
@@ -61,6 +61,7 @@

 #include <QButtonGroup>
 #include <QComboBox>
+#include <QFormLayout>
 #include <QGridLayout>
 #include <QHBoxLayout>
 #include <QHeaderView>
@@ -69,6 +70,7 @@
 #include <QLineEdit>
 #include <QPushButton>
 #include <QRadioButton>
+#include <QSlider>
 #include <QSpinBox>
 #include <QTableWidget>
 #include <QTableWidgetItem>
@@ -117,6 +119,43 @@
     this->referenceSliceOffset[1] = offset[1];
     this->update();
   }
+  void brightnessAndContrast(double& brightness, double& contrast)
+  {
+    vtkScalarsToColors* dataLUT =
+      vtkScalarsToColors::SafeDownCast(this->getLUT()->GetClientSideObject());
+    if (dataLUT) {
+      double* adjustedRange = dataLUT->GetRange();
+      double dataRange[2];
+      this->range(dataRange);
+
+      brightness = adjustedRange[1] / dataRange[1];
+      contrast = 1. - (adjustedRange[0] - dataRange[0]) / dataRange[1];
+    }
+  }
+  void setBrightnessAndContrast(double brightness, double contrast)
+  {
+    // clamp brightness and contrast between 0. and 1.
+    brightness = brightness < 0. ? 0. : brightness > 1. ? 1. : brightness;
+    contrast = contrast < 0. ? 0. : contrast > 1. ? 1. : contrast;
+
+    vtkScalarsToColors* dataLUT =
+      vtkScalarsToColors::SafeDownCast(this->getLUT()->GetClientSideObject());
+    if (dataLUT) {
+      double dataRange[2];
+      this->range(dataRange);
+      double adjustedRange[2];
+      adjustedRange[1] = dataRange[1] * brightness;
+      adjustedRange[0] = dataRange[0] + dataRange[1] * (1. - contrast);
+
+      vtkSMTransferFunctionProxy::RescaleTransferFunction(this->getLUT(),
+                                                          adjustedRange);
+    }
+  }
+  virtual void range(double r[2])
+  {
+    this->originalData->GetScalarRange(r);
+  }
+
   virtual void timeout() {}
   virtual void timerStopped() {}
   virtual double* bounds() const = 0;
@@ -214,22 +253,9 @@
     this->lut = tfmgr->GetColorTransferFunction("AlignWidgetLUT", pxm);
     vtkScalarsToColors* dataLUT =
       vtkScalarsToColors::SafeDownCast(this->lut->GetClientSideObject());
-    vtkSmartPointer<vtkSMProxy> source;
-    source.TakeReference(pxm->NewProxy("sources", "TrivialProducer"));
-    vtkTrivialProducer::SafeDownCast(source->GetClientSideObject())
-      ->SetOutput(data);
-    vtkPVArrayInformation* ainfo = tomviz::scalarArrayInformation(
-      vtkSMSourceProxy::SafeDownCast(source.Get()));
-    if (ainfo != nullptr) {
-      double range[2];
-      ainfo->GetComponentRange(0, range);
-      double lutRange[2] = { std::min(range[0], -range[1]),
-                             std::max(range[1], -range[0]) };
-      vtkNew<vtkSMTransferFunctionPresets> presets;
-      vtkSMTransferFunctionProxy::ApplyPreset(
-        this->lut, presets->GetFirstPresetWithName("Cool to Warm (Extended)"));
-      vtkSMTransferFunctionProxy::RescaleTransferFunction(this->lut, lutRange);
-    }
+    vtkNew<vtkSMTransferFunctionPresets> presets;
+    vtkSMTransferFunctionProxy::ApplyPreset(
+      this->lut, presets->GetFirstPresetWithName("Cool to Warm (Extended)"));
     this->imageSlice->GetProperty()->SetLookupTable(dataLUT);
   }
   void addToView(vtkRenderer* renderer) override
@@ -255,6 +281,23 @@
     }
     this->diffImage->Modified();
     this->imageSliceMapper->Update();
+  }
+  virtual void range(double r[2]) override
+  {
+    vtkSMSessionProxyManager* pxm = ActiveObjects::instance().proxyManager();
+    vtkSmartPointer<vtkSMProxy> source;
+    source.TakeReference(pxm->NewProxy("sources", "TrivialProducer"));
+    vtkTrivialProducer::SafeDownCast(source->GetClientSideObject())
+      ->SetOutput(originalData);
+    vtkPVArrayInformation* ainfo = tomviz::scalarArrayInformation(
+      vtkSMSourceProxy::SafeDownCast(source.Get()));
+
+    if (ainfo != nullptr) {
+      double range[2];
+      ainfo->GetComponentRange(0, range);
+      r[0] = std::min(range[0], -range[1]);
+      r[1] = std::max(range[1], -range[0]);
+    }
   }
   double* bounds() const override
   {
@@ -376,7 +419,49 @@
     new QPushButton(QIcon(":/pqWidgets/Icons/pqResetCamera24.png"), "Reset");
   this->connect(resetCamera, SIGNAL(pressed()), this, SLOT(resetCamera()));
   viewControls->addWidget(resetCamera);
+
   v->addLayout(viewControls);
+
+  static const double sliderRange[2] = {0., 100.};
+
+  QWidget *brightnessAndContrastWidget = new QWidget;
+  QFormLayout* brightnessAndContrastControls = new QFormLayout;
+  brightnessAndContrastWidget->setLayout(brightnessAndContrastControls);
+  QSlider* brightness = new QSlider(Qt::Horizontal);
+  brightness->setMinimum(sliderRange[0]);
+  brightness->setMaximum(sliderRange[1]);
+  this->connect(
+    brightness, &QSlider::valueChanged, this,
+    // use a lambda to convert integer (0,100) to float (0.,1.)
+    [&](int i) {
+      double bAndC[2];
+      // grab current values
+      this->modes[currentMode]->brightnessAndContrast(bAndC[0], bAndC[1]);
+      // set the new values
+      this->modes[currentMode]->setBrightnessAndContrast(
+        ((static_cast<double>(i)-sliderRange[0])/sliderRange[1]), bAndC[1]);
+      this->widget->update();
+    });
+  brightness->setValue(sliderRange[1]);
+  brightnessAndContrastControls->addRow("Brightness", brightness);
+
+  QSlider* contrast = new QSlider(Qt::Horizontal);
+  contrast->setMinimum(sliderRange[0]);
+  contrast->setMaximum(sliderRange[1]);
+  this->connect(
+    contrast, &QSlider::valueChanged, this,
+    [&](int i) {
+      double bAndC[2];
+      this->modes[currentMode]->brightnessAndContrast(bAndC[0], bAndC[1]);
+      this->modes[currentMode]->setBrightnessAndContrast(
+        bAndC[0], ((static_cast<double>(i)-sliderRange[0])/sliderRange[1]));
+      this->widget->update();
+    });
+  contrast->setValue(sliderRange[1]);
+  brightnessAndContrastControls->addRow("Contrast", contrast);
+  brightnessAndContrastWidget->setMaximumWidth(this->minimumWidth()/2);
+
+  v->addWidget(brightnessAndContrastWidget);

   this->currentMode = 0;
   QHBoxLayout* optionsLayout = new QHBoxLayout;
@@ -713,9 +798,14 @@
   if (this->modes.length() == 0) {
     return;
   }
+  // brightness and contrast are not persistent, so grab them from the former
+  // mode and reapply them to the new mode
+  double bc[2];
+  this->modes[this->currentMode]->brightnessAndContrast(bc[0], bc[1]);
   this->modes[this->currentMode]->removeFromView(this->renderer.Get());
   this->currentMode = mode;
   this->modes[this->currentMode]->addToView(this->renderer.Get());
+  this->modes[this->currentMode]->setBrightnessAndContrast(bc[0], bc[1]);
   this->modes[this->currentMode]->update();
   this->resetCamera();
 }


ENH: fixn quicklook issue over small image in Viewer

--- Code/Visualization/Viewer/Model/otbViewerModel.cxx
+++ Code/Visualization/Viewer/Model/otbViewerModel.cxx
@@ -169,11 +169,24 @@
     quicklook->DisconnectPipeline();
     shrinkFactor = (1 << (resSize - 1));
     }
-  //// If not jpeg2000 or trouble in jpeg2000 quicloock, use a streaming shrink image filter
+  //// If not jpeg2000 or trouble in jpeg2000 quicloock, use a
+  //// streaming shrink image filter
+  unsigned int maxSize = std::max( reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0],
+                                   reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] );
   if (quicklook.IsNull())
     {
     typedef otb::StreamingShrinkImageFilter<ImageType> StreamingShrinkImageFilterType;
     StreamingShrinkImageFilterType::Pointer shrinker = StreamingShrinkImageFilterType::New();
+
+    // Default shrink factor is 10. Adapt it for small images
+    unsigned int maxSize = std::max( reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0],
+                                    reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] );
+    if( maxSize > 512 )
+      {
+      shrinkFactor = static_cast<unsigned int>( vcl_floor( static_cast<double>(maxSize)/static_cast<double>(256) + 0.5) );
+      }
+
+    shrinker->SetShrinkFactor(shrinkFactor);
     shrinker->SetInput(reader->GetOutput());
     FltkFilterWatcher qlwatcher(shrinker->GetStreamer(), 0, 0, 200, 20,
                                 otbGetTextMacro("Generating QuickLook ..."));


Use mpg123_feed instead of mpg123_decode

--- src/streamdec.cpp
+++ src/streamdec.cpp
@@ -966,7 +966,7 @@
                 amt = fstream->gcount();
                 if(amt == 0)  break;
                 total += amt;
-                ret = mpg123_decode(newFile, data, amt, NULL, 0, NULL);
+                ret = mpg123_feed(newFile, data, amt);
             } while(ret == MPG123_NEED_MORE && total < 64*1024);

             if(ret == MPG123_NEW_FORMAT &&
@@ -1004,7 +1004,7 @@
                 amt = fstream->gcount();
                 if(amt == 0)  break;
                 total += amt;
-                ret = mpg123_decode(mp3File, data, amt, NULL, 0, NULL);
+                ret = mpg123_feed(mp3File, data, amt);
             } while(ret == MPG123_NEED_MORE && total < 64*1024);

             if(ret == MPG123_NEW_FORMAT &&


Update Appfs.cpp

Update Appfs.cpp

--- src/sys/Appfs.cpp
+++ src/sys/Appfs.cpp
@@ -317,7 +317,7 @@
 	fs::File::remove(
 				path
 			#if defined __link
-				, link_driver
+				, m_file.driver()
 			#endif
 				);


Fix: apppend autual read size to buffer

Fix: apppend autual read size to buffer

--- src/tcpserver.cpp
+++ src/tcpserver.cpp
@@ -30,11 +30,12 @@

 // Register channel to eventloop
 // including selector, events, and event-callback
-void TCPChannel::Register(Ref<TCPChannel> self) {
+void TCPChannel::Register() {
   channel_ = eventloop_->RegisterChannel(connectionSocket_);
   // TODO: should register kWriteEventFlag ?
   channel_->SetReadEnable();
   state_ = State::CONNECTED;
+  auto self = shared_from_this();
   channel_->OnRead([self] { self->OnReadable(); });
 }

@@ -51,7 +52,7 @@
   while (state_ == State::CONNECTED) {
     Ptr<char[]> buffer(new char[predictInBufferSize_]);
     ssize_t actualReadSize = connectionSocket_.read(buffer.get(), predictInBufferSize_);
-    DEBUG("Channel id(%lu) fd(%d) read(%zu/%zd)",
+    DEBUG("Channel id(%lu) fd(%d) read(%zd/%zu)",
       channel_->id(), channel_->fd(), actualReadSize, predictInBufferSize_);

     if (actualReadSize == -1) {
@@ -67,7 +68,7 @@
     } else if (actualReadSize == 0) {
       break;
     } else {
-      inBuffer_.append(buffer.get(), predictInBufferSize_);
+      inBuffer_.append(buffer.get(), actualReadSize);
       if (actualReadSize == predictInBufferSize_ && predictInBufferSize_ < maxBufferSize) {
         predictInBufferSize_ <<= 1;
       }
@@ -109,24 +110,24 @@
   Bind(listenFD);
   EXIT_IF(listenFD.listen(128) == false, "fd(%d) listen to port(%d) failed",
           listenFD.fd(), address_.port);
-  INFO("fd(%d) is now listening on port(%d)", listenFD.fd(), address_.port);
+  INFO("Server Socket FD(%d) is now listening on port(%d)", listenFD.fd(), address_.port);
   listenChannel_ = eventloop_->RegisterChannel(listenFD);
-  listenChannel_->SetReadEnable().OnRead([this]() { OnAcceptable(); });
+  listenChannel_->SetReadEnable().OnRead([this] { this->OnAcceptable(); });
 }

 void TCPServer::Bind(ServerSocketFD& listenFD) {
   // Fail the program if these fail
-  EXIT_IF(listenFD.invalid(), "create listen socket fd failed");
-  EXIT_IF(listenFD.setNonBlock() == false, "fd(%d) set NONBLOCK fail",
+  EXIT_IF(listenFD.invalid(), "Create Server Socket fd failed");
+  EXIT_IF(listenFD.setNonBlock() == false, "Server Socket fd(%d) set NONBLOCK fail",
           listenFD.fd());

   // Still go on even if these fail
-  EXPECT(listenFD.setReusePort(), "fd(%d) set REUSEPORT fail", listenFD.fd());
-  EXPECT(listenFD.setCloseOnExec(), "fd(%d) set CLOSEONEXEC fail",
+  EXPECT(listenFD.setReusePort(), "Server Socket fd(%d) set REUSEPORT fail", listenFD.fd());
+  EXPECT(listenFD.setCloseOnExec(), "Server Socket fd(%d) set CLOSEONEXEC fail",
          listenFD.fd());

   EXIT_IF(listenFD.bind(address_.host, address_.port) == false,
-          "fd(%d) bind port(%d) failed", listenFD.fd(), address_.port);
+          "Server Socket fd(%d) bind port(%d) failed", listenFD.fd(), address_.port);
 }

 void TCPServer::OnAcceptable() {
@@ -135,12 +136,12 @@
     ConnectionSocketFD connectionSocket(listenFD);
     if (connectionSocket.invalid()) {
       if (connectionSocket.err() != EAGAIN && connectionSocket.err() != EINTR)
-        ERROR("accept connection failed on listen fd(%d)", listenFD);
+        ERROR("Accept connection failed on Server Socket fd(%d)", listenFD);
       break;
     }
-    DEBUG("accept connection fd(%d) succeed on listen fd(%d)", connectionSocket.fd(), listenFD);
+    DEBUG("Accept connection fd(%d) succeed on Server Socket fd(%d)", connectionSocket.fd(), listenFD);
     Ref<TCPChannel> connection = newInstance<TCPChannel>(eventloop_, std::move(connectionSocket));
-    connection->Register(connection);
+    connection->Register();
     // connected !
     OnConnect();
   }


Remove std::make_unique as is C++14

Remove std::make_unique as is C++14

--- tests/server/CoreServer.cpp
+++ tests/server/CoreServer.cpp
@@ -95,7 +95,7 @@
     server_thread = TestThread(std::bind(&Server::run, &server));

     {
-        ClientConnection conn(std::make_unique<TcpSocket>("localhost", BASE_PORT + 3));
+        ClientConnection conn(std::unique_ptr<Socket>(new TcpSocket("localhost", BASE_PORT + 3)));
         Request req;
         req.method = GET;
         req.headers.add("Host", "localhost");
@@ -109,7 +109,7 @@
     }

     {
-        ClientConnection conn(std::make_unique<TcpSocket>("localhost", BASE_PORT + 3));
+        ClientConnection conn(std::unique_ptr<Socket>(new TcpSocket("localhost", BASE_PORT + 3)));
         Request req;
         req.method = GET;
         req.headers.add("Host", "localhost");


use BOOST_CHECK

use BOOST_CHECK

--- himan-tests/unit-tests/source/unit_util.cpp
+++ himan-tests/unit-tests/source/unit_util.cpp
@@ -136,7 +136,7 @@
 	B = std::get<0>(grad_A);
 	C = std::get<1>(grad_A);

-	assert(B==D && C==E);
+	BOOST_CHECK(B==D && C==E);

 }


Fixed typo in error message (lib)

Fixed typo in error message (lib)

--- src/time_entry.cc
+++ src/time_entry.cc
@@ -68,7 +68,7 @@

 bool TimeEntry::isMissingCreatedWith(const error err) const {
     return std::string::npos != std::string(err).find(
-        "created_with needs to be provided an a valid string");
+        "created_with needs to be provided a valid string");
 }

 bool TimeEntry::userCannotAccessTheSelectedProject(


Fix size check

Fix size check

--- src/timestamp.cpp
+++ src/timestamp.cpp
@@ -139,7 +139,7 @@
 int timestamp::format(stamp_type a_tp, time_val tv, char* a_buf, size_t a_sz,
                       bool a_utc, bool a_day_chk, bool a_use_cached_date)
 {
-    BOOST_ASSERT((a_tp < DATE_TIME && a_sz > 17) || a_sz > 27);
+    BOOST_ASSERT(a_sz >= format_size(a_tp));

     if (unlikely(a_tp == NO_TIMESTAMP)) {
         a_buf[0] = '\0';


- comment

- comment

--- src/tmxparser.cpp
+++ src/tmxparser.cpp
@@ -582,7 +582,7 @@
 		index++;
 	}

-	// if we made it here, tile indices could not be f
+	// if we made it here, tile indices could not be found
 	return TmxReturn::kUnknownTileIndices;
 }


hash: added calc overloads for StringRef.

--- src/togo/hash.hpp
+++ src/togo/hash.hpp
@@ -12,6 +12,7 @@
 #include <togo/config.hpp>
 #include <togo/debug_constraints.hpp>
 #include <togo/types.hpp>
+#include <togo/string.hpp>

 #include <am/hash/fnv.hpp>

@@ -53,6 +54,13 @@
 }

 /**
+	Calculate 32-bit hash from string reference.
+*/
+inline hash32 calc32(StringRef const& ref) {
+	return hash::calc32(ref.data, ref.size);
+}
+
+/**
 	Calculate 64-bit hash.
 */
 inline hash64
@@ -65,6 +73,13 @@
 		? am::hash::fnv1a<hash64_length>(data, size)
 		: hash64{0}
 	;
+}
+
+/**
+	Calculate 64-bit hash from string reference.
+*/
+inline hash64 calc64(StringRef const& ref) {
+	return hash::calc64(ref.data, ref.size);
 }

 /**


tags: added bool_tag.

tags: added bool_tag.

--- src/togo/tags.hpp
+++ src/togo/tags.hpp
@@ -30,6 +30,11 @@
 */
 enum class cstr_tag {};

+/**
+	Bool string tag.
+*/
+enum class bool_tag {};
+
 /// @}

 /** @} */ // end of doc-group utility


Workaround i387 issue in unit test

Workaround i387 issue in unit test

--- test/ref.cpp
+++ test/ref.cpp
@@ -17,6 +17,18 @@
 #include "main.h"

 // test Ref.h
+
+// Deal with i387 extended precision
+#if EIGEN_ARCH_i386 && !(EIGEN_ARCH_x86_64)
+
+#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(4,4)
+#pragma GCC optimize ("-ffloat-store")
+#else
+#undef VERIFY_IS_EQUAL
+#define VERIFY_IS_EQUAL(X,Y) VERIFY_IS_APPROX(X,Y)
+#endif
+
+#endif

 template<typename MatrixType> void ref_matrix(const MatrixType& m)
 {
@@ -54,7 +66,6 @@
   m2.block(i,j,brows,bcols).setRandom();
   rm2 = m2.block(i,j,brows,bcols);
   VERIFY_IS_EQUAL(m1, m2);
-

   ConstRefDynMat rm3 = m1.block(i,j,brows,bcols);
   m1.block(i,j,brows,bcols) *= 2;


Hard code values, not only signs

Hard code values, not only signs

--- uranus_dp/test/allocator_test.cpp
+++ uranus_dp/test/allocator_test.cpp
@@ -36,6 +36,22 @@
     pub.publish(msg);
   }

+  // TODO: This should be vectorized somehow in number of arguments
+  void ExpectThrustNear(double f1, double f2, double f3, double f4, double f5, double f6)
+  {
+    double arr[] = {f1, f2, f3, f4, f5, f6};
+    std::vector<double> thrust_expected (arr, arr + sizeof(arr) / sizeof(arr[0]) );
+
+    for (int i = 0; i < thrust.size(); ++i)
+      EXPECT_NEAR(thrust[i], thrust_expected[i], MAX_ERROR);
+  }
+
+  void ExpectThrustNear(double* arr)
+  {
+    for (int i = 0; i < thrust.size(); ++i)
+      EXPECT_NEAR(thrust[i], arr[i], MAX_ERROR);
+  }
+
   void WaitForMessage()
   {
     while (!message_received)
@@ -44,7 +60,7 @@

   int                 num_thrusters;
   std::vector<double> thrust;
-  static const double MAX_ERROR = 1e-6;
+  static const double MAX_ERROR = 1e-4;

  private:
   ros::NodeHandle nh;
@@ -75,10 +91,8 @@
   Publish(0, 0, 0, 0, 0, 0);
   WaitForMessage();

-  for(std::vector<double>::iterator it = thrust.begin(); it != thrust.end(); ++it)
-  {
-    EXPECT_NEAR(*it, 0, MAX_ERROR);
-  }
+  double thrust_expected[] = {0,0,0,0,0,0};
+  ExpectThrustNear(thrust_expected);
 }

 TEST_F(AllocatorTest, Forward)
@@ -86,12 +100,8 @@
   Publish(1, 0, 0, 0, 0, 0);
   WaitForMessage();

-  EXPECT_TRUE(thrust[0] > 0);
-  EXPECT_TRUE(thrust[1] > 0);
-  EXPECT_TRUE(thrust[2] < 0);
-  EXPECT_TRUE(thrust[3] < 0);
-  EXPECT_TRUE(thrust[4] < 0);
-  EXPECT_TRUE(thrust[5] > 0);
+  double thrust_expected[] = {0.35356, 0.35356, -0.35356, -0.35356, -0.20639, 0.20639};
+  ExpectThrustNear(thrust_expected);
 }

 TEST_F(AllocatorTest, Sideways)
@@ -99,12 +109,8 @@
   Publish(0, 1, 0, 0, 0, 0);
   WaitForMessage();

-  EXPECT_TRUE(thrust[0] > 0);
-  EXPECT_TRUE(thrust[1] < 0);
-  EXPECT_TRUE(thrust[2] < 0);
-  EXPECT_TRUE(thrust[3] > 0);
-  EXPECT_NEAR(thrust[4], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[5], 0, MAX_ERROR);
+  double thrust_expected[] = {0.35356, -0.35356, -0.35356, 0.35356, 0.0, 0.0};
+  ExpectThrustNear(thrust_expected);
 }

 TEST_F(AllocatorTest, Downward)
@@ -112,12 +118,8 @@
   Publish(0, 0, 1, 0, 0, 0);
   WaitForMessage();

-  EXPECT_NEAR(thrust[0], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[1], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[2], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[3], 0, MAX_ERROR);
-  EXPECT_TRUE(thrust[4] > 0);
-  EXPECT_TRUE(thrust[5] > 0);
+  double thrust_expected[] = {0.0, 0.0, 0.0, 0.0, 0.5, 0.5};
+  ExpectThrustNear(thrust_expected);
 }

 TEST_F(AllocatorTest, TiltUp)
@@ -125,12 +127,8 @@
   Publish(0, 0, 0, 0, 1, 0);
   WaitForMessage();

-  EXPECT_NEAR(thrust[0], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[1], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[2], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[3], 0, MAX_ERROR);
-  EXPECT_TRUE(thrust[4] < 0);
-  EXPECT_TRUE(thrust[5] > 0);
+  double thrust_expected[] = {0.0, 0.0, 0.0, 0.0, -3.1250, 3.1250};
+  ExpectThrustNear(thrust_expected);
 }

 TEST_F(AllocatorTest, TurnRight)
@@ -138,12 +136,8 @@
   Publish(0, 0, 0, 0, 0, 1);
   WaitForMessage();

-  EXPECT_TRUE(thrust[0] > 0);
-  EXPECT_TRUE(thrust[1] < 0);
-  EXPECT_TRUE(thrust[2] > 0);
-  EXPECT_TRUE(thrust[3] < 0);
-  EXPECT_NEAR(thrust[4], 0, MAX_ERROR);
-  EXPECT_NEAR(thrust[5], 0, MAX_ERROR);
+  double thrust_expected[] = {1.1666, -1.1666, 1.1666, -1.1666, 0.0, 0.0};
+  ExpectThrustNear(thrust_expected);
 }

 int main(int argc, char **argv)


Always return image assoc array

Always return image assoc array

--- urbackupclient/client_restore.cpp
+++ urbackupclient/client_restore.cpp
@@ -1026,20 +1026,18 @@
 			image.set("time_str", images[i].time_str);
 			image.set("letter", images[i].letter);

-			if (!images[i].assoc.empty())
-			{
-				JSON::Array assoc;
-				for (size_t j = 0; j < images[i].assoc.size(); ++j)
-				{
-					JSON::Object image_assoc;
-					image_assoc.set("id", images[i].assoc[j].id);
-					image_assoc.set("time_s", images[i].assoc[j].time_s);
-					image_assoc.set("time_str", images[i].assoc[j].time_str);
-					image_assoc.set("letter", images[i].assoc[j].letter);
-					assoc.add(image_assoc);
-				}
-				image.set("assoc", assoc);
-			}
+			JSON::Array assoc;
+			for (size_t j = 0; j < images[i].assoc.size(); ++j)
+			{
+				JSON::Object image_assoc;
+				image_assoc.set("id", images[i].assoc[j].id);
+				image_assoc.set("time_s", images[i].assoc[j].time_s);
+				image_assoc.set("time_str", images[i].assoc[j].time_str);
+				image_assoc.set("letter", images[i].assoc[j].letter);
+				assoc.add(image_assoc);
+			}
+			image.set("assoc", assoc);
+
 			ret.add(image);
 		}


Do not store the stack pointer if the stack size is 0.
Also, convert C-style comments to C++ and make sure code wraps at 80 cols.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@15245 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/PowerPC/PowerPCRegisterInfo.cpp
+++ lib/Target/PowerPC/PowerPCRegisterInfo.cpp
@@ -166,7 +166,7 @@
   if (!hasFP(MF))
     Offset += MF.getFrameInfo()->getStackSize();

-  MI.SetMachineOperandConst(OffIdx, MachineOperand::MO_SignExtendedImmed, Offset);
+  MI.SetMachineOperandConst(OffIdx,MachineOperand::MO_SignExtendedImmed,Offset);
   DEBUG(std::cerr << "offset = " << Offset << std::endl);
 }

@@ -195,13 +195,12 @@
     // eliminates the need for add/sub brackets around call sites.
     //
     NumBytes += MFI->getMaxCallFrameSize() +
-                24   /* Predefined PowerPC link area */ +
-                32   /* Predefined PowerPC params area */ +
-                 0   /* local variables - managed by llvm*/ +
-             0 * 4   /* volatile GPRs used - managed by llvm */ +
-             0 * 8   /* volatile FPRs used - managed by llvm */;
+                24 + // Predefined PowerPC link area
+                32 + // Predefined PowerPC params area
+                 0 + // local variables - managed by LLVM
+             0 * 4 + // volatile GPRs used - managed by LLVM
+             0 * 8;  // volatile FPRs used - managed by LLVM

-
     // Round the size to a multiple of the alignment (don't forget the 4 byte
     // offset though).
     unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
@@ -217,6 +216,9 @@
   // Update frame info to pretend that this is part of the stack...
   MFI->setStackSize(NumBytes);

+  // Do we need to allocate space on the stack?
+  if (NumBytes == 0) return;
+
   // adjust stack pointer: r1 -= numbytes
   if (NumBytes <= 32768) {
     MI = BuildMI(PPC32::STWU, 3).addReg(PPC32::R1).addSImm(-NumBytes)
@@ -252,11 +254,15 @@
   // conservative.
   if (MFI->hasCalls() || true) {
     // Restore LR
-    MI = BuildMI(PPC32::LWZ, 2, PPC32::R0).addSImm(NumBytes+8).addReg(PPC32::R1);
+    MI = BuildMI(PPC32::LWZ, 2,PPC32::R0).addSImm(NumBytes+8).addReg(PPC32::R1);
     MBB.insert(MBBI, MI);
     MI = BuildMI(PPC32::MTLR, 1).addReg(PPC32::R0);
     MBB.insert(MBBI, MI);
   }
+
+  // Do we need to adjust the stack pointer back?
+  if (NumBytes == 0) return;
+
   // Adjust stack pointer back
   if (NumBytes <= 32767) {
     MI = BuildMI(PPC32::ADDI, 2, PPC32::R1).addReg(PPC32::R1).addSImm(NumBytes);


tests: Add newline at the end of file

tests: Add newline at the end of file

--- tests/test_dom_traverse.cpp
+++ tests/test_dom_traverse.cpp
@@ -1150,4 +1150,4 @@
 	CHECK(node.attribute(STR("attr1"), hint) == attr1 && hint == attr2);

 	CHECK(!node.attribute(STR("attr"), hint) && hint == attr2);
-}+}


Create metadata directory if directory symlink changes to a directory during incremental file backup

--- urbackupserver/IncrFileBackup.cpp
+++ urbackupserver/IncrFileBackup.cpp
@@ -771,12 +771,17 @@
 											{
 												ServerLogger::Log(logid, "Error deleting metadata file \"" + metadata_fn_curr + "\". " + os_last_error_str(), LL_WARNING);
 											}
+											if (!os_create_dir(os_file_prefix(backuppath_hashes + local_curr_os_path)))
+											{
+												ServerLogger::Log(logid, "Error creating metadata directory \"" + backuppath_hashes + local_curr_os_path + "\". " + os_last_error_str(), LL_WARNING);
+											}

 											metadata_srcpath = last_backuppath_hashes + convertToOSPathFromFileClient(orig_curr_os_path + "/" + escape_metadata_fn(cf.name));
 										}
 									}
 									else if( (os_get_file_type(os_file_prefix(backuppath + local_curr_os_path)) & EFileType_Symlink) == 0 )
 									{
+										//Directory to directory symlink
 										if( !Server->deleteFile(os_file_prefix(metadata_fn + os_file_sep() + metadata_dir_fn))
 											|| !os_remove_dir(os_file_prefix(metadata_fn)) )
 										{


[SystemZ]  Remove confusing comment in combineEXTRACT_VECTOR_ELT()

It isn't just one-element vectors that can appear here.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@299762 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/SystemZ/SystemZISelLowering.cpp
+++ lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -5001,8 +5001,6 @@
 SDValue SystemZTargetLowering::combineEXTRACT_VECTOR_ELT(
     SDNode *N, DAGCombinerInfo &DCI) const {

-  // <1 x ..> vectors may be present in the function even without vector
-  // support, which will be handled during legalization.
   if (!Subtarget.hasVector())
     return SDValue();


Made walking methods; Debating whether should be completely separated

--- include/clotho/recombination/scan_classify_switch_bit_block_recombiner.hpp
+++ include/clotho/recombination/scan_classify_switch_bit_block_recombiner.hpp
@@ -52,11 +52,132 @@

     template < class Block, class ElementIterator >
     Block operator()( const Block b0, const Block b1, const ElementIterator first ) {
+
+        Block mask = walk( InspectMethodTag::select(b0, b1), first );
+
+        Block rec = ((b0 & mask) | (b1 & ~mask));
+        return rec;
+    }
+
+protected:
+    classifier_type m_cfier;
+    unsigned int indices[ 64 ];
+
+    template < class ElementIterator >
+    unsigned int walk( unsigned int b, const ElementIterator first ) {
         // Only compute the hash of each set bit
         // In effect, delay the offset lookup to be performed by the switching logic
         // Goal is to eliminate a 'double-lookup' (lookup from hash table, lookup based upon hash)
         // This assumes switch logic results in a 'jump table'
-        unsigned int count = clotho::utility::hash_set_bits( InspectMethodTag::select(b0, b1), indices );
+        //
+        typedef unsigned int Block;
+        unsigned int count = clotho::utility::hash_set_bits( b, indices );
+
+        Block res = (Block)0;
+        unsigned int * idx = indices;
+        while( count-- ) {
+            switch( *idx++ ) {
+            case 0:
+                CHECK_0() break;
+            case 1:
+                CHECK(1) break;
+            case 2:
+                CHECK(28) break;
+            case 3:
+                CHECK(2) break;
+            case 4:
+                CHECK(29) break;
+            case 5:
+                CHECK(14) break;
+            case 6:
+                CHECK(24) break;
+            case 7:
+                CHECK(3) break;
+            case 8:
+                CHECK(30) break;
+            case 9:
+                CHECK(22) break;
+            case 10:
+                CHECK(20) break;
+            case 11:
+                CHECK(15) break;
+            case 12:
+                CHECK(25) break;
+            case 13:
+                CHECK(17) break;
+            case 14:
+                CHECK(4) break;
+            case 15:
+                CHECK(8) break;
+            case 16:
+                CHECK(31) break;
+            case 17:
+                CHECK(27) break;
+            case 18:
+                CHECK(13) break;
+            case 19:
+                CHECK(23) break;
+            case 20:
+                CHECK(21) break;
+            case 21:
+                CHECK(19) break;
+            case 22:
+                CHECK(16) break;
+            case 23:
+                CHECK(7) break;
+            case 24:
+                CHECK(26) break;
+            case 25:
+                CHECK(12) break;
+            case 26:
+                CHECK(18) break;
+            case 27:
+                CHECK(6) break;
+            case 28:
+                CHECK(11) break;
+            case 29:
+                CHECK(5) break;
+            case 30:
+                CHECK(10) break;
+            case 31:
+                CHECK(9) break;
+            default:
+                break;
+            }
+        }
+        return res;
+    }
+
+    template < class ElementIterator >
+    unsigned long walk( unsigned long b, const ElementIterator first ) {
+        // Only compute the hash of each set bit
+        // In effect, delay the offset lookup to be performed by the switching logic
+        // Goal is to eliminate a 'double-lookup' (lookup from hash table, lookup based upon hash)
+        // This assumes switch logic results in a 'jump table'
+        //
+
+        unsigned int lo = (unsigned int)b;
+        unsigned long mask = (unsigned long)walk( lo, first );
+
+        lo = (unsigned int) ( b >> 32 );
+        if( lo ) {
+            ElementIterator tmp = (first + 32);
+            unsigned long hi_mask = (unsigned long)walk(lo, tmp );
+            mask |= (hi_mask << 32);
+        }
+
+        return mask;
+    }
+
+    template < class ElementIterator >
+    unsigned long unrolled_walk( unsigned long b, const ElementIterator first ) {
+        // Only compute the hash of each set bit
+        // In effect, delay the offset lookup to be performed by the switching logic
+        // Goal is to eliminate a 'double-lookup' (lookup from hash table, lookup based upon hash)
+        // This assumes switch logic results in a 'jump table'
+        //
+        typedef unsigned long Block;
+        unsigned int count = clotho::utility::hash_set_bits( b, indices );

         Block res = (Block)0;
         unsigned int * idx = indices;
@@ -194,14 +315,8 @@
                 break;
             }
         }
-
-        Block rec = ((b0 & res) | (b1 & ~res));
-        return rec;
+        return res;
     }
-
-protected:
-    classifier_type m_cfier;
-    unsigned int indices[ 64 ];
 };

 #undef CHECK_0


Generate a real signal to be recorded in two MprRecorder unit test where previously it was recording silence.

git-svn-id: 8a77b5e12cf30fc5f8c95b12d648985d6db39537@12743 a612230a-c5fa-0310-af8b-88eea846685b

--- sipXmediaLib/src/test/mp/MprRecorderTest.cpp
+++ sipXmediaLib/src/test/mp/MprRecorderTest.cpp
@@ -397,6 +397,16 @@
                 // Build flowgraph with source, MprRecorder and sink resources
                 setupFramework(recorder);

+                // Set parameters to signal to record
+                for(int inputIndex = 0; inputIndex < recorder->maxInputs(); inputIndex++)
+                {
+                    mpSourceResource->setSignalAmplitude(inputIndex,
+                                                      (0x1 << (12 - inputIndex)));
+                    mpSourceResource->setSignalPeriod(inputIndex,
+                          sSampleRates[rateIndex] / (250 * (0x1 << inputIndex)));
+                }
+                mpSourceResource->setOutSignalType(MpTestResource::MP_SINE);
+
                 // Add the notifier so that we get resource events
                 OsMsgQ resourceEventQueue;
                 OsMsgDispatcher messageDispatcher(&resourceEventQueue);
@@ -1484,7 +1494,6 @@
                 // Build flowgraph with source, MprRecorder and sink resources
                 setupFramework(recorder);

-#if 0 // TODO
                 // Set parameters to signal to record
                 for(int inputIndex = 0; inputIndex < recorder->maxInputs(); inputIndex++)
                 {
@@ -1494,7 +1503,7 @@
                           sSampleRates[rateIndex] / (250 * (0x1 << inputIndex)));
                 }
                 mpSourceResource->setOutSignalType(MpTestResource::MP_SINE);
-#endif
+
                 // Add the notifier so that we get resource events
                 OsMsgQ resourceEventQueue;
                 OsMsgDispatcher messageDispatcher(&resourceEventQueue);


Corrected unit test condition checks

Corrected unit test condition checks

--- test/stl.cpp
+++ test/stl.cpp
@@ -25,7 +25,7 @@
     vector< STLData<float> > objs;
     stl::read<float>(objs, TEST_DIR "/cube_binary.stl");

-    EXPECT_TRUE((objs[0] == referenceObjs[0]) == true);
+    EXPECT_TRUE(objs[0] == referenceObjs[0]);

     referenceObjs.clear();
     objs.clear();
@@ -40,7 +40,7 @@
     vector< STLData<float> > objs;
     stl::read<float>(objs, TEST_DIR "/cube_ascii.stl");

-    EXPECT_TRUE((objs[0] == referenceObjs[0]) == true);
+    EXPECT_TRUE(objs[0] == referenceObjs[0]);

     referenceObjs.clear();
     objs.clear();
@@ -68,5 +68,5 @@
     vector< STLData<float> > asciiReadObjs;
     stl::read<float>(asciiReadObjs, TEST_DIR "/cube_ascii.stl");

-    EXPECT_TRUE((binReadObjs[0] == asciiReadObjs[0]) == true);
+    EXPECT_TRUE(binReadObjs[0] == asciiReadObjs[0]);
 }


simpler prompt

simpler prompt

--- calculator/src/main.cpp
+++ calculator/src/main.cpp
@@ -3,7 +3,7 @@

 int main(){
 	while (std::cin) {
-		std::cout << "Please type your term to calculate: ";
+		std::cout << "Please type your input term: ";
 		int result = calc(std::cin);
 		std::cout << "= " << result << '\n';
 	}


Use less evil form of switch stmt.

Use less evil form of switch stmt.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@104331 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/X86/X86FloatingPointRegKill.cpp
+++ lib/Target/X86/X86FloatingPointRegKill.cpp
@@ -71,11 +71,13 @@
       const TargetRegisterClass *RegClass =
         MRI.getRegClass(I->getOperand(op).getReg());

-      switch (RegClass->getID())
+      switch (RegClass->getID()) {
+      default: break;
       case X86::RFP32RegClassID:
       case X86::RFP64RegClassID:
       case X86::RFP80RegClassID:
-      return true;
+        return true;
+      }
     }
   }


Corrected error in error handling in getLinkIndex, getJunctionIndex

--- src/treegraph.cpp
+++ src/treegraph.cpp
@@ -193,29 +193,35 @@
     LinkMap::const_iterator TreeGraph::getLink(const std::string& name) const
     {
         LinkNameMap::const_iterator ret_value = links_names.find(name);
-        #ifndef NDEBUG
-        if( ret_value == links_names.end() ) { std::cerr << "Link " << name << " not found " << std::endl; }
-        #endif
-        //assert(ret_value != links_names.end());
+        if( ret_value == links_names.end() ) {
+			//std::cerr << "TreeGraph: Link " << name << " not found " << std::endl;
+			return getInvalidLinkIterator();
+		}
         return ret_value->second;
     }

     LinkMap::const_iterator TreeGraph::getLink(const int index) const
     {
-        assert(index >= 0 && index < (int)getNrOfLinks());
+        if(!(index >= 0 && index < (int)getNrOfLinks())) {
+			return getInvalidLinkIterator();
+		}
         return links.begin()+index;
     }

     JunctionMap::const_iterator TreeGraph::getJunction(const int index) const
     {
-        assert(index >= 0 && index < (int)getNrOfJunctions());
+        if( !(index >= 0 && index < (int)getNrOfJunctions()) ) {
+			return getInvalidJunctionIterator();
+		}
         return junctions.begin()+index;
     }

     JunctionMap::const_iterator TreeGraph::getJunction(const std::string& name) const
     {
         JunctionNameMap::const_iterator ret_value = junctions_names.find(name);
-        assert(ret_value != junctions_names.end());
+        if(ret_value == junctions_names.end()) {
+			return getInvalidJunctionIterator();
+		}
         return ret_value->second;
     }


Adds a ThreadCrosser unit test that changes stack order of loggers.

--- test/test.cc
+++ test/test.cc
@@ -296,6 +296,38 @@
   worker.join();
 }

+TEST(ThreadCrosserTest, ReverseOrderOfLoggersOnStack) {
+  LogText logger1;
+  const auto callback = ThreadCrosser::WrapCall([] {
+        LogText::Log("logged 1");
+      });
+
+  LogText logger2;
+  const auto worker_call = ThreadCrosser::WrapCall([callback] {
+        // In callback(), logger1 overrides logger2, whereas in the main thread
+        // logger2 overrides logger1.
+        callback();
+        LogText::Log("logged 2");
+      });
+
+  LogText logger3;
+
+  // Call using a thread.
+  std::thread worker(worker_call);
+  worker.join();
+
+  EXPECT_THAT(logger1.GetLinesUnsafe(), ElementsAre("logged 1"));
+  EXPECT_THAT(logger2.GetLinesUnsafe(), ElementsAre("logged 2"));
+  EXPECT_THAT(logger3.GetLinesUnsafe(), ElementsAre());
+
+  // Call in the main thread.
+  worker_call();
+
+  EXPECT_THAT(logger1.GetLinesUnsafe(), ElementsAre("logged 1", "logged 1"));
+  EXPECT_THAT(logger2.GetLinesUnsafe(), ElementsAre("logged 2", "logged 2"));
+  EXPECT_THAT(logger3.GetLinesUnsafe(), ElementsAre());
+}
+
 }  // namespace capture_thread

 int main(int argc, char *argv[]) {


[LV] Remove more unused functions.  NFC

[LV] Remove more unused functions.  NFC

LoopVectorizationLegality::strides_begin/end are also unused.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@272781 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Transforms/Vectorize/LoopVectorize.cpp
+++ lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1375,10 +1375,6 @@
   unsigned getMaxSafeDepDistBytes() { return LAI->getMaxSafeDepDistBytes(); }

   bool hasStride(Value *V) { return StrideSet.count(V); }
-  SmallPtrSet<Value *, 8>::iterator strides_begin() {
-    return StrideSet.begin();
-  }
-  SmallPtrSet<Value *, 8>::iterator strides_end() { return StrideSet.end(); }

   /// Returns true if the target machine supports masked store operation
   /// for the given \p DataType and kind of access to \p Ptr.


Fix warning from r332654 with LLVM_ATTRIBUTE_USED

r332654 tried to fix an unused function warning with
a void cast. This approach worked for clang and gcc
but not for MSVC. This commit replaces the void cast
with the LLVM_ATTRIBUTE_USED approach.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@332910 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Transforms/Vectorize/VPlanVerifier.cpp
+++ lib/Transforms/Vectorize/VPlanVerifier.cpp
@@ -26,7 +26,8 @@

 /// Utility function that checks whether \p VPBlockVec has duplicate
 /// VPBlockBases.
-static bool hasDuplicates(const SmallVectorImpl<VPBlockBase *> &VPBlockVec) {
+LLVM_ATTRIBUTE_USED static bool
+hasDuplicates(const SmallVectorImpl<VPBlockBase *> &VPBlockVec) {
   SmallDenseSet<const VPBlockBase *, 8> VPBlockSet;
   for (const auto *Block : VPBlockVec) {
     if (VPBlockSet.count(Block))
@@ -52,7 +53,6 @@
     // TODO: This won't work for switch statements.
     assert(!hasDuplicates(Successors) &&
            "Multiple instances of the same successor.");
-    (void)hasDuplicates;

     for (const VPBlockBase *Succ : Successors) {
       // There must be a bi-directional link between block and successor.


fit in 80 cols

fit in 80 cols

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@96541 91177308-0d34-0410-b5e6-96231b3b80d8

--- utils/TableGen/DAGISelEmitter.cpp
+++ utils/TableGen/DAGISelEmitter.cpp
@@ -1047,8 +1047,10 @@
                "N->getDebugLoc(), MVT::Other, "
                "&InChains[0], InChains.size());");
       if (GenDebug) {
-        emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"yellow\");");
-        emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"black\");");
+        emitCode("CurDAG->setSubgraphColor(" + ChainName +
+                 ".getNode(), \"yellow\");");
+        emitCode("CurDAG->setSubgraphColor(" + ChainName +
+                 ".getNode(), \"black\");");
       }
     }

@@ -1755,15 +1757,17 @@
         // Replace the emission code within selection routines with calls to the
         // emission functions.
         if (GenDebug)
-          GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N, \"red\");"));
-        CallerCode = "SDNode *Result = Emit_" + utostr(EmitFuncNum) + CallerCode;
+          GeneratedCode.push_back(std::make_pair(0,
+                                      "CurDAG->setSubgraphColor(N, \"red\");"));
+        CallerCode = "SDNode *Result = Emit_" + utostr(EmitFuncNum) +CallerCode;
         GeneratedCode.push_back(std::make_pair(3, CallerCode));
         if (GenDebug) {
           GeneratedCode.push_back(std::make_pair(0, "if(Result) {"));
-          GeneratedCode.push_back(std::make_pair(0, "  CurDAG->setSubgraphColor(Result, \"yellow\");"));
-          GeneratedCode.push_back(std::make_pair(0, "  CurDAG->setSubgraphColor(Result, \"black\");"));
+          GeneratedCode.push_back(std::make_pair(0,
+                            "  CurDAG->setSubgraphColor(Result, \"yellow\");"));
+          GeneratedCode.push_back(std::make_pair(0,
+                             "  CurDAG->setSubgraphColor(Result, \"black\");"));
           GeneratedCode.push_back(std::make_pair(0, "}"));
-          //GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N, \"black\");"));
         }
         GeneratedCode.push_back(std::make_pair(0, "return Result;"));
       }


Make CTxMemPool::check more thourough by using CheckInputs

--- src/txmempool.cpp
+++ src/txmempool.cpp
@@ -6,7 +6,7 @@
 #include "txmempool.h"

 #include "clientversion.h"
-#include "main.h" // for COINBASE_MATURITY
+#include "main.h"
 #include "streams.h"
 #include "util.h"
 #include "utilmoneystr.h"
@@ -539,17 +539,22 @@

     uint64_t checkTotal = 0;

-    LOCK(cs);
+    CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(pcoins));
+
+    LOCK(cs);
+    list<const CTxMemPoolEntry*> waitingOnDependants;
     for (std::map<uint256, CTxMemPoolEntry>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
         unsigned int i = 0;
         checkTotal += it->second.GetTxSize();
         const CTransaction& tx = it->second.GetTx();
+        bool fDependsWait = false;
         BOOST_FOREACH(const CTxIn &txin, tx.vin) {
             // Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
             std::map<uint256, CTxMemPoolEntry>::const_iterator it2 = mapTx.find(txin.prevout.hash);
             if (it2 != mapTx.end()) {
                 const CTransaction& tx2 = it2->second.GetTx();
                 assert(tx2.vout.size() > txin.prevout.n && !tx2.vout[txin.prevout.n].IsNull());
+                fDependsWait = true;
             } else {
                 const CCoins* coins = pcoins->AccessCoins(txin.prevout.hash);
                 assert(coins && coins->IsAvailable(txin.prevout.n));
@@ -561,6 +566,29 @@
             assert(it3->second.n == i);
             i++;
         }
+        if (fDependsWait)
+            waitingOnDependants.push_back(&it->second);
+        else {
+            CValidationState state; CTxUndo undo;
+            assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL));
+            UpdateCoins(tx, state, mempoolDuplicate, undo, 1000000);
+        }
+    }
+    unsigned int stepsSinceLastRemove = 0;
+    while (!waitingOnDependants.empty()) {
+        const CTxMemPoolEntry* entry = waitingOnDependants.front();
+        waitingOnDependants.pop_front();
+        CValidationState state;
+        if (!mempoolDuplicate.HaveInputs(entry->GetTx())) {
+            waitingOnDependants.push_back(entry);
+            stepsSinceLastRemove++;
+            assert(stepsSinceLastRemove < waitingOnDependants.size());
+        } else {
+            assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL));
+            CTxUndo undo;
+            UpdateCoins(entry->GetTx(), state, mempoolDuplicate, undo, 1000000);
+            stepsSinceLastRemove = 0;
+        }
     }
     for (std::map<COutPoint, CInPoint>::const_iterator it = mapNextTx.begin(); it != mapNextTx.end(); it++) {
         uint256 hash = it->second.ptx->GetHash();


fix mempool check

fix mempool check

Former-commit-id: fd4bff04cc7f7e61d7055ec04a44f41d552f6d56

--- src/txmempool.cpp
+++ src/txmempool.cpp
@@ -1051,7 +1051,8 @@
                 child_sizes += childit->GetTxSize();
             }
         }
-        assert(setChildrenCheck == GetMemPoolChildren(it));
+        if(!bAssetAllocationTX)
+            assert(setChildrenCheck == GetMemPoolChildren(it));
         // Also check to make sure size is greater than sum with immediate children.
         // just a sanity check, not definitive that this calc is correct...
         assert(it->GetSizeWithDescendants() >= child_sizes + it->GetTxSize());


Fix coverity

Fix coverity

--- ITS/AliITSQASDDDataMakerRec.cxx
+++ ITS/AliITSQASDDDataMakerRec.cxx
@@ -821,6 +821,7 @@
   TClonesArray *recpoints=NULL;
   if(fkOnline){recpoints = rpcont->FetchClusters(0,clustersTree,fAliITSQADataMakerRec->GetEventNumber());}
   else{recpoints = rpcont->FetchClusters(0,clustersTree);}
+  AliDebug(10,Form("Fetched RecPoints for %d SDD modules",recpoints->GetEntriesFast()));
   if(!rpcont->GetStatusOK() || !rpcont->IsSDDActive()){
     AliError("can't get SDD clusters !");
     return rv;


vcl108: #i107358# fix uninitialized member (thanks cmc!)

--- vcl/source/gdi/pdfwriter_impl.hxx
+++ vcl/source/gdi/pdfwriter_impl.hxx
@@ -679,6 +679,7 @@
                 m_aOverlineColor( COL_TRANSPARENT ),
                 m_nAntiAlias( 1 ),
                 m_nLayoutMode( 0 ),
+                m_aDigitLanguage( 0 ),
                 m_nTransparentPercent( 0 ),
                 m_nFlags( 0xffff ),
                 m_nUpdateFlags( 0xffff )
@@ -693,6 +694,7 @@
                 m_aClipRegion( rState.m_aClipRegion ),
                 m_nAntiAlias( rState.m_nAntiAlias ),
                 m_nLayoutMode( rState.m_nLayoutMode ),
+                m_aDigitLanguage( rState.m_aDigitLanguage ),
                 m_nTransparentPercent( rState.m_nTransparentPercent ),
                 m_nFlags( rState.m_nFlags ),
                 m_nUpdateFlags( rState.m_nUpdateFlags )
@@ -710,6 +712,7 @@
             m_aClipRegion           = rState.m_aClipRegion;
             m_nAntiAlias            = rState.m_nAntiAlias;
             m_nLayoutMode           = rState.m_nLayoutMode;
+            m_aDigitLanguage        = rState.m_aDigitLanguage;
             m_nTransparentPercent   = rState.m_nTransparentPercent;
             m_nFlags                = rState.m_nFlags;
             m_nUpdateFlags          = rState.m_nUpdateFlags;


Remove manual file close().

Remove manual file close().

--- src/ultracomm.cpp
+++ src/ultracomm.cpp
@@ -170,8 +170,6 @@
         write_numframes_in_header(framesReceived);
         //mylog << "Closing datafile.\n";
         //mylog.flush();
-        datafile.close();
-        indexfile.close();
         //printf("Last frame was %d.\n", lastFrame);
         int expected = lastFrame + frame_incr + 1;
         double pct = 100.0 * framesReceived / expected;
@@ -479,7 +477,6 @@
             cerr << "Wrote cine data for frame " << idx << ".\n";
         }
     }
-    datafile.close();
 }

 /*


BMC: Adding call to markTargetChanged

BMC: Adding call to markTargetChanged

Adding the call to mark a target as changed if the PNOR and
SEEPROM part numbers don't match.

Change-Id: I66053f49a864bf2ac4093e82aef38ed0fc10eb28
RTC:116553
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14260
Tested-by: Jenkins Server
Reviewed-by: STEPHEN M. CPREK <449c81c8ca240ee26e6e5e8e94a7cb83f7b02ee8@us.ibm.com>
Reviewed-by: Daniel M. Crowell <912029ca9254ac7b5854e56910561d682e1fa2d0@us.ibm.com>
Reviewed-by: A. Patrick Williams III <c87e37b1a4035affd737b461af89fb722d635f4d@us.ibm.com>

--- src/usr/vpd/vpd.C
+++ src/usr/vpd/vpd.C
@@ -29,6 +29,7 @@
 #include <vpd/vpdreasoncodes.H>
 #include <initservice/initserviceif.H>
 #include <devicefw/driverif.H>
+#include <hwas/hwasPlat.H>
 #include <sys/mm.h>
 #include "vpd.H"
 #include "mvpd.H"
@@ -539,7 +540,9 @@
         {
             TRACFCOMP(g_trac_vpd,"VPD::ensureCacheIsInSync: PNOR_PN/SN != SEEPROM_PN/SN, Loading PNOR from SEEPROM");

-            // @todo RTC 116553 - Need HCDB update call here
+            //Set the targets as changed since the p/n's don't match
+            HWAS::markTargetChanged(i_target);
+
             // Load the PNOR data from the SEEPROM
             if( ( l_type == TARGETING::TYPE_PROC   ) ||
                 ( l_type == TARGETING::TYPE_MEMBUF ) )


Fix TRACE_EVENT snapshotting for LayerImpl

There are two problems with how LayerImpl was instrumented:
1. We never issued TRACE_EVENT_OBJECT_DELETED commands. This meant
   that if a pointer changed from a layer to something else, tracing
   woudl get confused and you would get import errors.
2. We didn't set the category on the snapshot. This meant that
   if a layer was AsValued() into a containing trace of some other category,
   this would cause it in some corner cases to become untraced.

I'm pretty amazed that this ever worked.

R=danakj,enne

Review URL: https://codereview.chromium.org/167893004

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

--- cc/layers/layer_impl.cc
+++ cc/layers/layer_impl.cc
@@ -109,6 +109,10 @@

   if (clip_parent_)
     clip_parent_->RemoveClipChild(this);
+
+  TRACE_EVENT_OBJECT_DELETED_WITH_ID(
+      TRACE_DISABLED_BY_DEFAULT("cc.debug"),
+      LayerTypeAsString(), this);
 }

 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) {
@@ -1405,7 +1409,9 @@
 }

 void LayerImpl::AsValueInto(base::DictionaryValue* state) const {
-  TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this);
+  TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
+      TRACE_DISABLED_BY_DEFAULT("cc.debug"),
+      state, LayerTypeAsString(), this);
   state->SetInteger("layer_id", id());
   state->Set("bounds", MathUtil::AsValue(bounds()).release());
   state->SetInteger("draws_content", DrawsContent());


* Fix small memory leak on SysAllocString.
** Use IAccPropServices::SetHwndPropStr == no more BSTR
* Change for cpplint.py

Caller owns BSTR on call:
http://www.codeguru.com/forum/showthread.php?t=364511

BUG=n/a
TEST=Use Task Manager for monitoring memory usage after setting long title with document.title

Review URL: http://codereview.chromium.org/7806010

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

--- views/widget/native_widget_win.cc
+++ views/widget/native_widget_win.cc
@@ -6,6 +6,8 @@

 #include <dwmapi.h>
 #include <shellapi.h>
+
+#include <algorithm>

 #include "base/string_util.h"
 #include "base/system_monitor/system_monitor.h"
@@ -679,13 +681,10 @@
   base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
   HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
       IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
-  if (SUCCEEDED(hr)) {
-    VARIANT var;
-    var.vt = VT_BSTR;
-    var.bstrVal = SysAllocString(name.c_str());
-    hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
-                                       CHILDID_SELF, PROPID_ACC_NAME, var);
-  }
+  if (SUCCEEDED(hr))
+    hr = pAccPropServices->SetHwndPropStr(GetNativeView(), OBJID_CLIENT,
+                                          CHILDID_SELF, PROPID_ACC_NAME,
+                                          name.c_str());
 }

 void NativeWidgetWin::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
@@ -710,6 +709,7 @@
   if (SUCCEEDED(hr)) {
     VARIANT var;
     if (state) {
+      var.vt = VT_I4;
       var.lVal = NativeViewAccessibilityWin::MSAAState(state);
       hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
                                          CHILDID_SELF, PROPID_ACC_STATE, var);
@@ -1049,7 +1049,7 @@
 }

 void NativeWidgetWin::SetCursor(gfx::NativeCursor cursor) {
-  if(cursor) {
+  if (cursor) {
     previous_cursor_ = ::SetCursor(cursor);
   } else if (previous_cursor_) {
     ::SetCursor(previous_cursor_);
@@ -1597,7 +1597,7 @@
   }

   RECT* client_rect = mode ?
-      &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] :
+      &(reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0]) :
       reinterpret_cast<RECT*>(l_param);
   client_rect->left += insets.left();
   client_rect->top += insets.top();


Added checks for non-emitting of other signals than the one we expect

--- tests/tst_dataprocessor.cpp
+++ tests/tst_dataprocessor.cpp
@@ -30,9 +30,8 @@
 //DONE: test continuation frames for too small frame
 //DONE: test continuation frames for bad rsv fields, etc.
 //DONE: test continuation frames for incomplete payload
-
-//TODO: besides spying on errors, we should also check if the frame and message signals are not emitted (or partially emitted)
 //DONE: test close frame with payload length 1 (is either 0, if no close code, or at least 2, close code + optional reason)
+//DONE: besides spying on errors, we should also check if the frame and message signals are not emitted (or partially emitted)

 //TODO: test invalid frame sequences

@@ -288,9 +287,13 @@

     QSignalSpy spyFrameReceived(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
     QSignalSpy spyMessageReceived(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
+    QSignalSpy spyTextFrameReceived(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
+    QSignalSpy spyTextMessageReceived(&dataProcessor, SIGNAL(textMessageReceived(QString)));
     dataProcessor.process(&buffer);
     QCOMPARE(spyFrameReceived.count(), 1);
     QCOMPARE(spyMessageReceived.count(), 1);
+    QCOMPARE(spyTextFrameReceived.count(), 0);
+    QCOMPARE(spyTextMessageReceived.count(), 0);
     QList<QVariant> arguments = spyFrameReceived.takeFirst();
     QCOMPARE(arguments.at(0).toByteArray().length(), payload.length());
     arguments = spyMessageReceived.takeFirst();
@@ -333,9 +336,13 @@

     QSignalSpy spyFrameReceived(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
     QSignalSpy spyMessageReceived(&dataProcessor, SIGNAL(textMessageReceived(QString)));
+    QSignalSpy spyBinaryFrameReceived(&dataProcessor, SIGNAL(binaryFrameReceived(QString,bool)));
+    QSignalSpy spyBinaryMessageReceived(&dataProcessor, SIGNAL(binaryMessageReceived(QString)));
     dataProcessor.process(&buffer);
     QCOMPARE(spyFrameReceived.count(), 1);
     QCOMPARE(spyMessageReceived.count(), 1);
+    QCOMPARE(spyBinaryFrameReceived.count(), 0);
+    QCOMPARE(spyBinaryMessageReceived.count(), 0);
     QList<QVariant> arguments = spyFrameReceived.takeFirst();
     QCOMPARE(arguments.at(0).toString().length(), payload.length());
     arguments = spyMessageReceived.takeFirst();
@@ -361,9 +368,17 @@
     buffer.open(QIODevice::ReadOnly);

     QSignalSpy spyCloseFrameReceived(&dataProcessor, SIGNAL(closeReceived(QWebSocketProtocol::CloseCode,QString)));
+    QSignalSpy spyTextFrameReceived(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
+    QSignalSpy spyTextMessageReceived(&dataProcessor, SIGNAL(textMessageReceived(QString)));
+    QSignalSpy spyBinaryFrameReceived(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
+    QSignalSpy spyBinaryMessageReceived(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));

     dataProcessor.process(&buffer);
     QCOMPARE(spyCloseFrameReceived.count(), 1);
+    QCOMPARE(spyTextFrameReceived.count(), 0);
+    QCOMPARE(spyTextMessageReceived.count(), 0);
+    QCOMPARE(spyBinaryFrameReceived.count(), 0);
+    QCOMPARE(spyBinaryMessageReceived.count(), 0);
     QList<QVariant> arguments = spyCloseFrameReceived.takeFirst();
     QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), closeCode);
     QCOMPARE(arguments.at(1).toString().length(), payload.length());
@@ -383,6 +398,8 @@
     DataProcessor dataProcessor;
     QSignalSpy frameSpy(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
     QSignalSpy messageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
+    QSignalSpy binaryFrameSpy(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
+    QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QByteArray)));

     data.append(firstByte).append(secondByte);
     data.append(payload);
@@ -393,6 +410,8 @@

     QCOMPARE(frameSpy.count(), 1);
     QCOMPARE(messageSpy.count(), 1);
+    QCOMPARE(binaryFrameSpy.count(), 0);
+    QCOMPARE(binaryMessageSpy.count(), 0);

     QVariantList arguments = frameSpy.takeFirst();
     QCOMPARE(arguments.at(0).value<QString>().toUtf8(), payload);
@@ -418,11 +437,23 @@
     buffer.setData(data);
     buffer.open(QIODevice::ReadWrite);
     QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
+    QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
+    QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
+    QSignalSpy textFrameSpy(&dataProcessor, SIGNAL(textFrameReceived(QString, bool)));
+    QSignalSpy binaryFrameSpy(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
     dataProcessor.process(&buffer);
     QCOMPARE(spy.count(), 1);
+    QCOMPARE(textMessageSpy.count(), 0);
+    QCOMPARE(binaryMessageSpy.count(), 0);
+    QCOMPARE(textFrameSpy.count(), 0);
+    QCOMPARE(binaryFrameSpy.count(), 0);
     QList<QVariant> arguments = spy.takeFirst();
     QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), QWebSocketProtocol::CC_GOING_AWAY);
     spy.clear();
+    textMessageSpy.clear();
+    binaryMessageSpy.clear();
+    textFrameSpy.clear();
+    binaryFrameSpy.clear();
     buffer.close();
     data.clear();

@@ -433,10 +464,18 @@
     buffer.open(QIODevice::ReadOnly);
     dataProcessor.process(&buffer);
     QCOMPARE(spy.count(), 1);
+    QCOMPARE(textMessageSpy.count(), 0);
+    QCOMPARE(binaryMessageSpy.count(), 0);
+    QCOMPARE(textFrameSpy.count(), 0);
+    QCOMPARE(binaryFrameSpy.count(), 0);
     arguments = spy.takeFirst();
     QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), QWebSocketProtocol::CC_GOING_AWAY);
     buffer.close();
     spy.clear();
+    textMessageSpy.clear();
+    binaryMessageSpy.clear();
+    textFrameSpy.clear();
+    binaryFrameSpy.clear();
     data.clear();

@@ -457,9 +496,17 @@
         QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
         dataProcessor.process(&buffer);
         QCOMPARE(spy.count(), 1);
+        QCOMPARE(textMessageSpy.count(), 0);
+        QCOMPARE(binaryMessageSpy.count(), 0);
+        QCOMPARE(textFrameSpy.count(), 1);
+        QCOMPARE(binaryFrameSpy.count(), 0);
         QList<QVariant> arguments = spy.takeFirst();
         QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), QWebSocketProtocol::CC_GOING_AWAY);
         spy.clear();
+        textMessageSpy.clear();
+        binaryMessageSpy.clear();
+        textFrameSpy.clear();
+        binaryFrameSpy.clear();
         buffer.close();
         data.clear();

@@ -469,9 +516,18 @@
         buffer.open(QIODevice::ReadWrite);
         dataProcessor.process(&buffer);

+        QCOMPARE(textMessageSpy.count(), 0);
+        QCOMPARE(binaryMessageSpy.count(), 0);
+        QCOMPARE(textFrameSpy.count(), 1);
+        QCOMPARE(binaryFrameSpy.count(), 0);
+
         buffer.close();
         data.clear();
         spy.clear();
+        textMessageSpy.clear();
+        binaryMessageSpy.clear();
+        textFrameSpy.clear();
+        binaryFrameSpy.clear();

         //only 1 byte follows in continuation frame; should time out with close code CC_GOING_AWAY
         data.append('a');
@@ -480,6 +536,10 @@

         dataProcessor.process(&buffer);
         QCOMPARE(spy.count(), 1);
+        QCOMPARE(textMessageSpy.count(), 0);
+        QCOMPARE(binaryMessageSpy.count(), 0);
+        QCOMPARE(textFrameSpy.count(), 0);
+        QCOMPARE(binaryFrameSpy.count(), 0);
         arguments = spy.takeFirst();
         QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), QWebSocketProtocol::CC_GOING_AWAY);
         spy.clear();
@@ -578,6 +638,10 @@
     QBuffer buffer;
     DataProcessor dataProcessor;
     QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
+    QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
+    QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
+    QSignalSpy textFrameSpy(&dataProcessor, SIGNAL(textFrameReceived(QString, bool)));
+    QSignalSpy binaryFrameSpy(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));

     if (isContinuationFrame)
     {
@@ -589,6 +653,17 @@
     buffer.open(QIODevice::ReadWrite);
     dataProcessor.process(&buffer);
     QCOMPARE(spy.count(), 1);
+    QCOMPARE(textMessageSpy.count(), 0);
+    QCOMPARE(binaryMessageSpy.count(), 0);
+    QCOMPARE(textFrameSpy.count(), isContinuationFrame ? 1 : 0);
+    QCOMPARE(binaryFrameSpy.count(), 0);
+    QVariantList arguments = spy.takeFirst();
+    QCOMPARE(arguments.at(0).value<QWebSocketProtocol::CloseCode>(), expectedCloseCode);
+    buffer.close();
+    spy.clear();
+    data.clear();
+}
+
 void tst_DataProcessor::doCloseFrameTest()
 {
     QFETCH(quint8, firstByte);
@@ -787,20 +862,20 @@
     }
     else
     {
-    QTest::newRow(QString("Text frame with invalid UTF8-sequence: %1").arg(dataTag).toStdString().data())
-            << quint8(FIN | QWebSocketProtocol::OC_TEXT)
-            << quint8(payload.length())
-            << payload
-            << false
-            << QWebSocketProtocol::CC_WRONG_DATATYPE;
-
-    QTest::newRow(QString("Continuation text frame with invalid UTF8-sequence: %1").arg(dataTag).toStdString().data())
-            << quint8(FIN | QWebSocketProtocol::OC_CONTINUE)
-            << quint8(payload.length())
-            << payload
-            << true
-            << QWebSocketProtocol::CC_WRONG_DATATYPE;
-}
+        QTest::newRow(QString("Text frame with invalid UTF8-sequence: %1").arg(dataTag).toStdString().data())
+                << quint8(FIN | QWebSocketProtocol::OC_TEXT)
+                << quint8(payload.length())
+                << payload
+                << false
+                << QWebSocketProtocol::CC_WRONG_DATATYPE;
+
+        QTest::newRow(QString("Continuation text frame with invalid UTF8-sequence: %1").arg(dataTag).toStdString().data())
+                << quint8(FIN | QWebSocketProtocol::OC_CONTINUE)
+                << quint8(payload.length())
+                << payload
+                << true
+                << QWebSocketProtocol::CC_WRONG_DATATYPE;
+    }
 }

 void tst_DataProcessor::invalidField(const char *dataTag, quint8 invalidFieldValue)


build fix

build fix

--- src/utki/span.hpp
+++ src/utki/span.hpp
@@ -65,7 +65,7 @@
 	 * @brief Constructor for automatic conversion from nullptr.
      * @param bufPtr - pointer to the memory buffer. Makes not much sense, because size is 0 anyway.
      */
-	span(nullptr_t)noexcept :
+	span(std::nullptr_t)noexcept :
 			buf(nullptr),
 			bufSize(0)
 	{}


add few more manipulations on variables

add few more manipulations on variables

--- src/variables.cpp
+++ src/variables.cpp
@@ -1,11 +1,24 @@
 // operations with variables
 #include <iostream>
+#include <string>

 int main()
 {
   // declaring variables
-  int a, b;
-  int result;
+  int a = 0;      // c-like initialization
+  int b (0);      // constructor initialization
+  int result {0}; // uniform initialization
+
+  int foo (0);
+  auto bar (foo); // compiler will determine bar's type
+  decltype(foo) baar;
+  decltype(foo) baar2 (5);
+
+  // simulate use
+  (void)bar;
+  (void)baar;
+  // actual use
+  std::cout << baar2 << std::endl;

   // process
   a = 5;
@@ -16,6 +29,10 @@
   // print the result
   std::cout << result << std::endl;

+  // using strings
+  std::string oneString ("So this is what a string looks like");
+
+  std::cout << oneString << std::endl;
   // terminate the program
   return 0;
 }


view: move to the parent's output when parent is set

Fixes #480

--- src/view/view.cpp
+++ src/view/view.cpp
@@ -111,6 +111,7 @@
         if (this->get_output())
             this->get_output()->workspace->remove_view(self());

+        this->set_output(parent->get_output());
         /* if the view isn't mapped, then it will be positioned properly in map() */
         if (is_mapped())
             reposition_relative_to_parent(self());


Fix comment

Fix comment

--- ospray/mpi/MPIDevice.cpp
+++ ospray/mpi/MPIDevice.cpp
@@ -74,8 +74,8 @@

         - all *all* MPI_COMM_WORLD processes are going into this function

-        - this fct is called from ospInit (with startworkers=true) or
-          from ospdMpiInit (w/ startwoe3kers = false)
+        - this fct is called from ospInit (with ranksBecomeWorkers=true) or
+          from ospdMpiInit (w/ ranksBecomeWorkers = false)
     */
     ospray::api::Device *createMPI_runOnExistingRanks(int *ac, const char **av,
                                                       bool ranksBecomeWorkers)


Fix 14421

Fix 14421

Disable tiered jitting in debuggable methods.

I also removed the policy comment because I'm not aware of any more planned changes we'll need to make to the policy here.

--- src/vm/method.hpp
+++ src/vm/method.hpp
@@ -1231,11 +1231,6 @@
     {
         LIMITED_METHOD_DAC_CONTRACT;

-        // This policy will need to change some more before tiered compilation feature
-        // can be properly supported across a broad range of scenarios. For instance it
-        // wouldn't interact correctly with debugging at the moment because we enable
-        // it too aggresively and it conflicts with the operations of those features.
-
         // Keep in-sync with MethodTableBuilder::NeedsNativeCodeSlot(bmtMDMethod * pMDMethod)
         // to ensure native slots are available where needed.
         return g_pConfig->TieredCompilation() &&
@@ -1244,10 +1239,8 @@
             HasNativeCodeSlot() &&
             !IsUnboxingStub() &&
             !IsInstantiatingStub() &&
-            !IsDynamicMethod();
-
-        // We should add an exclusion for modules with debuggable code gen flags
-
+            !IsDynamicMethod() &&
+            !CORDisableJITOptimizations(GetModule()->GetDebuggerInfoBits());
     }
 #endif


Implemented changes to FunctionDB related to GUI and CCopasiObject.

--- copasi/model/CSpec2Model.cpp
+++ copasi/model/CSpec2Model.cpp
@@ -462,24 +462,24 @@
 void CSpec2Model::processFunctions()
 {
   // Find each function line
-  CFunction *pFunction;
+  CKinFunction Function;
   std::vector<CSpecLine>::iterator it = mSpecLines.begin();

   for (; it < mSpecLines.end(); it++)
     {
       if (it->getType() == CSpecLine::FUN)
         {
-          pFunction = new CKinFunction();
+          Function.cleanup();
           std::string tmp = it->extractLeft();

           std::string::size_type p1 = tmp.find_first_not_of(" \t");
           std::string::size_type p2 = tmp.find_first_of("(");
-          pFunction->setName(tmp.substr(p1, p2 - p1));
+          Function.setName(tmp.substr(p1, p2 - p1));

           std::string parameter =
             tmp.substr(p2 + 1, tmp.find_last_of(")") - p2 - 1);

-          //CFunctionParameters & Parameters = pFunction->getParameters();
+          //CFunctionParameters & Parameters = Function.getParameters();
           p1 = 0;
           p2 = 0;
           std::string ParameterName;
@@ -492,16 +492,16 @@
               //Parameters.add(ParameterName,
               //               CFunctionParameter::FLOAT64,
               //               "unknown");
-              pFunction->addParameter(ParameterName,
-                                      CFunctionParameter::FLOAT64,
-                                      "unknown");
+              Function.addParameter(ParameterName,
+                                    CFunctionParameter::FLOAT64,
+                                    "unknown");
             }

           tmp = it->extractRight();
           p1 = tmp.find_first_not_of(" \t");
           p2 = tmp.find_last_not_of(" \t");
           tmp = tmp.substr(p1, p2 - p1 + 1);
-          pFunction->setDescription(tmp);
+          Function.setDescription(tmp);
           // :TODO: We have to identify constants
           //        and define them as parameters.

@@ -521,9 +521,9 @@
                       //Parameters.add(ParameterName,
                       //               CFunctionParameter::FLOAT64,
                       //               "PARAMETER");
-                      pFunction->addParameter(ParameterName,
-                                              CFunctionParameter::FLOAT64,
-                                              "PARAMETER");
+                      Function.addParameter(ParameterName,
+                                            CFunctionParameter::FLOAT64,
+                                            "PARAMETER");
                     }
                   catch (CCopasiException Exception)
                     {
@@ -535,8 +535,8 @@
                     }
                 }
             }
-          std::cout << pFunction->getParameters() << std::endl;
-          Copasi->pFunctionDB->add(pFunction);
+          std::cout << Function.getParameters() << std::endl;
+          Copasi->pFunctionDB->add(Function);
           // ((CKinFunction *)pFunction)->compile();
           std::cout << it->getString() << std::endl;
         }


wallet: Do not iterate a directory if having an error while accessing it

This change prevents infinite looping for, for example, system folders
on Windows.

--- src/wallet/db.cpp
+++ src/wallet/db.cpp
@@ -18,7 +18,12 @@

     for (auto it = fs::recursive_directory_iterator(wallet_dir, ec); it != fs::recursive_directory_iterator(); it.increment(ec)) {
         if (ec) {
-            LogPrintf("%s: %s %s\n", __func__, ec.message(), it->path().string());
+            if (fs::is_directory(*it)) {
+                it.no_push();
+                LogPrintf("%s: %s %s -- skipping.\n", __func__, ec.message(), it->path().string());
+            } else {
+                LogPrintf("%s: %s %s\n", __func__, ec.message(), it->path().string());
+            }
             continue;
         }


Cut dead/legacy thrift/test/FbBenchmark.cpp

Summary: [Thrift] Cut dead/legacy `thrift/test/FbBenchmark.cpp`.

Reviewed By: spalamarchuk

Differential Revision: D7721231

fbshipit-source-id: bd57e697ed02ca524dbfb20b940698155a64640d

--- thrift/test/FbBenchmark.cpp
+++ thrift/test/FbBenchmark.cpp
@@ -1,205 +0,0 @@
-/*
- * Copyright 2017-present Facebook, Inc.
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include <folly/Benchmark.h>
-
-#include <thrift/lib/cpp/transport/TBufferTransports.h>
-#include <thrift/lib/cpp/protocol/TBinaryProtocol.h>
-#include <thrift/lib/cpp/protocol/THeaderProtocol.h>
-
-#include <thrift/test/gen-cpp/DebugProtoTest_types.h>
-
-#include <gflags/gflags.h>
-
-using namespace boost;
-using namespace apache::thrift::transport;
-using namespace apache::thrift::protocol;
-using namespace thrift::test::debug;
-
-/** An adaptor class that maps the Duplex THeaderProtocolFactory back to a
- * TProtocolFactory
- */
-class TSingleHeaderProtocolFactory : public TProtocolFactory {
- public:
-  TSingleHeaderProtocolFactory() {}
-
-  ~TSingleHeaderProtocolFactory() override {}
-
-  std::shared_ptr<TProtocol> getProtocol(
-      std::shared_ptr<TTransport> trans) override {
-    TProtocolPair protocols = factory_.getProtocol(trans);
-    return protocols.first;
-  }
-
- private:
-  THeaderProtocolFactory factory_;
-};
-
-template <class Protocol_>
-void WriteOneOfEach(TProtocolFactory& prot_factory, int iters) {
-  OneOfEach ooe;
-  ooe.im_true   = true;
-  ooe.im_false  = false;
-  ooe.a_bite    = 0xd6;
-  ooe.integer16 = 27000;
-  ooe.integer32 = 1<<24;
-  ooe.integer64 = (uint64_t)6000 * 1000 * 1000;
-  ooe.double_precision = M_PI;
-  ooe.some_characters  = "JSON THIS! \"\1";
-  ooe.zomg_unicode     = "\xd7\n\a\t";
-  ooe.base64 = "\1\2\3\255";
-  ooe.string_string_map["one"] = "two";
-  ooe.string_string_hash_map["three"] = "four";
-  ooe.float_precision = (float)12.345;
-  ooe.rank_map[567419810] = (float)0.211184;
-  ooe.rank_map[507959914] = (float)0.080382;
-  std::shared_ptr<TMemoryBuffer> buf(new TMemoryBuffer());
-  std::shared_ptr<TProtocol> generic_prot(prot_factory.getProtocol(buf));
-
-  Protocol_* prot = dynamic_cast<Protocol_*>(generic_prot.get());
-  if (!prot) {
-    abort();
-  }
-
-  for (int i = 0; i < iters; ++i) {
-    buf->resetBuffer();
-    ooe.write(prot);
-    prot->getTransport()->flush();
-  }
-}
-
-template <class Protocol_>
-void ReadOneOfEach(TProtocolFactory& prot_factory, int iters) {
-  OneOfEach ooe;
-  ooe.im_true   = true;
-  ooe.im_false  = false;
-  ooe.a_bite    = 0xd6;
-  ooe.integer16 = 27000;
-  ooe.integer32 = 1<<24;
-  ooe.integer64 = (uint64_t)6000 * 1000 * 1000;
-  ooe.double_precision = M_PI;
-  ooe.some_characters  = "JSON THIS! \"\1";
-  ooe.zomg_unicode     = "\xd7\n\a\t";
-  ooe.base64 = "\1\2\3\255";
-  ooe.string_string_map["one"] = "two";
-  ooe.string_string_hash_map["three"] = "four";
-  ooe.float_precision = (float)12.345;
-  ooe.rank_map[567419810] = (float)0.211184;
-  ooe.rank_map[507959914] = (float)0.080382;
-
-  std::shared_ptr<TMemoryBuffer> rbuf(new TMemoryBuffer());
-  std::shared_ptr<TMemoryBuffer> wbuf(new TMemoryBuffer());
-  std::shared_ptr<TProtocol> generic_iprot(prot_factory.getProtocol(rbuf));
-  std::shared_ptr<TProtocol> generic_oprot(prot_factory.getProtocol(wbuf));
-
-  Protocol_* iprot = dynamic_cast<Protocol_*>(generic_iprot.get());
-  Protocol_* oprot = dynamic_cast<Protocol_*>(generic_oprot.get());
-  if (!iprot || !oprot) {
-    abort();
-  }
-
-  ooe.write(oprot);
-  oprot->getTransport()->flush();
-  uint8_t* data;
-  uint32_t datasize;
-  wbuf->getBuffer(&data, &datasize);
-
-  // Don't construct a new OneOfEach object each time around the loop.
-  // The vector insert operations in the constructor take up a significant
-  // fraction of the time.
-  OneOfEach ooe2;
-  for (int i = 0; i < iters; ++i) {
-      rbuf->resetBuffer(data, datasize);
-      ooe2.read(iprot);
-  }
-}
-
-BENCHMARK(BM_WriteFullyTemplatized, iters) {
-  // Test with TBinaryProtocolT<TBufferBase>,
-  // and OneOfEach.write< TBinaryProtocolT<TBufferBase> >
-  TBinaryProtocolFactoryT<TBufferBase> prot_factory;
-  WriteOneOfEach< TBinaryProtocolT<TBufferBase> >(prot_factory, iters);
-}
-
-BENCHMARK(BM_WriteTransportTemplatized, iters) {
-  // Test with TBinaryProtocolT<TBufferBase>,
-  // but OneOfEach.write<TProtocol>
-  TBinaryProtocolFactoryT<TBufferBase> prot_factory;
-  WriteOneOfEach<TProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_WriteProtocolTemplatized, iters) {
-  // Test with TBinaryProtocol and OneOfEach.write<TBinaryProtocol>
-  TBinaryProtocolFactory prot_factory;
-  WriteOneOfEach<TBinaryProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_WriteGeneric, iters) {
-  // Test with TBinaryProtocol and OneOfEach.write<TProtocol>
-  TBinaryProtocolFactory prot_factory;
-  WriteOneOfEach<TProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_WriteHeaderGeneric, iters) {
-  // Test with TBinaryProtocol and OneOfEach.write<TProtocol>
-  TSingleHeaderProtocolFactory prot_factory;
-  WriteOneOfEach<THeaderProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_ReadFullyTemplatized, iters) {
-  // Test with TBinaryProtocolT<TBufferBase>,
-  // and OneOfEach.write< TBinaryProtocolT<TBufferBase> >
-  TBinaryProtocolFactoryT<TBufferBase> prot_factory;
-  ReadOneOfEach< TBinaryProtocolT<TBufferBase> >(prot_factory, iters);
-}
-
-BENCHMARK(BM_ReadTransportTemplatized, iters) {
-  // Test with TBinaryProtocolT<TBufferBase>,
-  // but OneOfEach.write<TProtocol>
-  TBinaryProtocolFactoryT<TBufferBase> prot_factory;
-  ReadOneOfEach<TProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_ReadProtocolTemplatized, iters) {
-  // Test with TBinaryProtocol and OneOfEach.write<TBinaryProtocol>
-  TBinaryProtocolFactory prot_factory;
-  ReadOneOfEach<TBinaryProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_ReadGeneric, iters) {
-  // Test with TBinaryProtocolT<TTransport> and OneOfEach.write<TProtocol>
-  TBinaryProtocolFactory prot_factory;
-  ReadOneOfEach<TProtocol>(prot_factory, iters);
-}
-
-BENCHMARK(BM_ReadHeaderGeneric, iters) {
-  // Test with TBinaryProtocolT<TTransport> and OneOfEach.write<TProtocol>
-  TSingleHeaderProtocolFactory prot_factory;
-  ReadOneOfEach<THeaderProtocol>(prot_factory, iters);
-}
-
-int main(int argc, char** argv) {
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  // Run the benchmarks
-  folly::runBenchmarksOnFlag();
-
-  return 0;
-}


Sync attributes of reference::assign_from definitions with their declarations.

Fixes compilation error with recent clang.

--- thrust/detail/reference.inl
+++ thrust/detail/reference.inl
@@ -96,6 +96,7 @@

 template<typename Element, typename Pointer, typename Derived>
   template<typename System>
+    __host__ __device__
     typename reference<Element,Pointer,Derived>::value_type
       reference<Element,Pointer,Derived>
         ::convert_to_value_type(System *system) const
@@ -139,6 +140,7 @@

 template<typename Element, typename Pointer, typename Derived>
   template<typename System1, typename System2, typename OtherPointer>
+    __host__ __device__
     void reference<Element,Pointer,Derived>
       ::assign_from(System1 *system1, System2 *system2, OtherPointer src)
 {


fixed infinite recursion bug

fixed infinite recursion bug

--- NINJA/CandidateHeap.cpp
+++ NINJA/CandidateHeap.cpp
@@ -165,8 +165,9 @@
 		delete[] prevActiveNode;
 		prevActiveNode = NULL;
 	}
+	/*
 	if (this->tb!=NULL){
 		delete this->tb;
 		tb = NULL;
-	}
+	}*/
 }


Use DataInfo() instead of DataSetInfo(). DataSetInfo() is the constructor so a new instance of the class is created in this case with default values, instead of using the one stored in the Method class that is returned by the member function MethodBase::DataInfo().
This fixes a bug in the GradientBoosting reported in the forum, causing the signal peak to be in the wrong side.
See https://root-forum.cern.ch/t/signal-peaking-on-the-wrong-side/35223

The bug was introduced last year in ROOT 6.16

--- tmva/tmva/src/MethodBDT.cxx
+++ tmva/tmva/src/MethodBDT.cxx
@@ -1520,7 +1520,7 @@
       std::map<const TMVA::Event *, std::vector<double>> & residuals = this->fResiduals;
       DecisionTree & lastTree = *(this->fForest.back());

-      UInt_t signalClass = DataSetInfo().GetSignalClassIndex();
+      UInt_t signalClass = DataInfo().GetSignalClassIndex();

       #ifdef R__USE_IMT
       auto update_residuals = [&residuals, &lastTree, signalClass](const TMVA::Event * e) {


Update launcher.cpp

Update launcher.cpp

--- tools/Launcher/launcher.cpp
+++ tools/Launcher/launcher.cpp
@@ -85,7 +85,7 @@

 enum ClangBuilderChannel : int {
   kOpenEnvironment = 0, ///
-  kUseMSBuild = 1,
+  kBaseBuilder = 1,
   kNinjaBootstrap
 };

@@ -100,7 +100,7 @@
   case kOpenEnvironment:
     psfile += L"\\bin\\ClangBuilderEnvironment.ps1";
     break;
-  case kUseMSBuild:
+  case kBaseBuilder:
     psfile += L"\\bin\\ClangBuilderManager.ps1";
     break;
   case kNinjaBootstrap:
@@ -158,7 +158,7 @@
   bool buildReleasedRevision = false;
   bool useStaticCRT = false;
   bool buildLLDB = false;
-  int channel = kUseMSBuild;
+  int channel = kBaseBuilder;
   int Argc = 0;
   auto Argv_ = CommandLineToArgvW(GetCommandLineW(), &Argc);
   wchar_t *const *Argv = Argv_;
@@ -244,10 +244,10 @@
     if (useStaticCRT) {
       StringCbCatW(szBuffer, UNC_MAX_PATH, L" -Static");
     }
-    if (useNmake && channel == kUseMSBuild) {
+    if (useNmake && channel == kBaseBuilder) {
       StringCbCatW(szBuffer, UNC_MAX_PATH, L" -NMake");
     }
-    if (buildLLDB && channel == kUseMSBuild) {
+    if (buildLLDB && channel == kBaseBuilder) {
       StringCbCatW(szBuffer, UNC_MAX_PATH, L" -LLDB");
     }
   }