Data: Rename to last_driving_mode_ to make it clear.

--- modules/data/tools/event_collector_main.cc
+++ modules/data/tools/event_collector_main.cc
@@ -119,7 +119,7 @@
  private:
   // Event time and message.
   std::vector<std::tuple<double, std::string>> events_;
-  Chassis::DrivingMode current_driving_mode_;
+  Chassis::DrivingMode last_driving_mode_;

   void OnDriveEvent(const apollo::common::DriveEvent& event) {
     // The header time is the real event time.
@@ -129,11 +129,11 @@
   void OnChassis(const Chassis& chassis) {
     // Save event when driving_mode changes from COMPLETE_AUTO_DRIVE to
     // EMERGENCY_MODE which is taken as a disengagement.
-    if (current_driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE &&
+    if (last_driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE &&
         chassis.driving_mode() == Chassis::EMERGENCY_MODE) {
       SaveEvent(chassis.header().timestamp_sec(), "Disengagement");
     }
-    current_driving_mode_ = chassis.driving_mode();
+    last_driving_mode_ = chassis.driving_mode();
   }

   void OnMonitorMessage(


skins2: fix a refresh artefact (not frequent corner case)

If, for instance, video is not embedded and visible="vlc.hasVout" is used
for a video control, the video control background was not refreshed.
Yet, partial redraw (overlapping windows) could occur, leading to a visual artefact.

--- modules/gui/skins2/controls/ctrl_video.cpp
+++ modules/gui/skins2/controls/ctrl_video.cpp
@@ -154,6 +154,7 @@
     {
         msg_Dbg( getIntf(), "VideoCtrl : Visibility changed (visible=%d)",
                                   isVisible() );
+        notifyLayout();
     }

     // Active Layout changed


Mono/C#: Fix bindings generator with void vararg methods

Commit 4d727f1ee6b970298a7c1752ba19b49d7060c405 made it possible for vararg
methods to return void. This broke the C# bindings generator which was
assuming in one place that vararg methods always return Variant.

--- modules/mono/editor/bindings_generator.cpp
+++ modules/mono/editor/bindings_generator.cpp
@@ -2066,9 +2066,11 @@
 			p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
 			p_output.append(", total_length, vcall_error);\n");

-			// See the comment on the C_LOCAL_VARARG_RET declaration
-			if (return_type->cname != name_cache.type_Variant) {
-				p_output.append("\t" C_LOCAL_RET " = " C_LOCAL_VARARG_RET ";\n");
+			if (!ret_void) {
+				// See the comment on the C_LOCAL_VARARG_RET declaration
+				if (return_type->cname != name_cache.type_Variant) {
+					p_output.append("\t" C_LOCAL_RET " = " C_LOCAL_VARARG_RET ";\n");
+				}
 			}
 		} else {
 			p_output.append("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", ");


planning: modified default values for lateral trajectory optimization weights

--- modules/planning/common/planning_gflags.cc
+++ modules/planning/common/planning_gflags.cc
@@ -347,13 +347,13 @@
 DEFINE_double(weight_lateral_offset, 1.0,
     "weight for lateral offset "
     "in lateral trajectory optimization");
-DEFINE_double(weight_lateral_derivative, 1.0,
+DEFINE_double(weight_lateral_derivative, 10.0,
     "weight for lateral derivative "
     "in lateral trajectory optimization");
-DEFINE_double(weight_lateral_second_order_derivative, 1.0,
+DEFINE_double(weight_lateral_second_order_derivative, 30.0,
     "weight for lateral second order derivative "
     "in lateral trajectory optimization");
-DEFINE_double(weight_lateral_obstacle_distance, 1.0,
+DEFINE_double(weight_lateral_obstacle_distance, 5.0,
     "weight for lateral obstacle distance in lateral trajectory optimization");
 DEFINE_double(lateral_third_order_derivative_max, 2.0,
     "the maximal allowance for lateral third order derivative");


Cleanup core-test

Cleanup core-test

--- test/core-test.cc
+++ test/core-test.cc
@@ -11,15 +11,14 @@

 #include "fmt/core.h"

-#include <algorithm>
-#include <climits>
-#include <cstring>
-#include <functional>
-#include <iterator>
-#include <limits>
-#include <memory>
-#include <string>
-#include <type_traits>
+#include <algorithm>    // std::copy_n
+#include <climits>      // INT_MAX
+#include <cstring>      // std::strlen
+#include <functional>   // std::equal_to
+#include <iterator>     // std::back_insert_iterator
+#include <limits>       // std::numeric_limits
+#include <string>       // std::string
+#include <type_traits>  // std::is_same

 #include "gmock.h"

@@ -69,6 +68,50 @@
   check_op<std::less_equal>();
   check_op<std::greater>();
   check_op<std::greater_equal>();
+}
+
+namespace test_ns {
+template <typename Char> class test_string {
+ private:
+  std::basic_string<Char> s_;
+
+ public:
+  test_string(const Char* s) : s_(s) {}
+  const Char* data() const { return s_.data(); }
+  size_t length() const { return s_.size(); }
+  operator const Char*() const { return s_.c_str(); }
+};
+
+template <typename Char>
+fmt::basic_string_view<Char> to_string_view(const test_string<Char>& s) {
+  return {s.data(), s.length()};
+}
+
+struct non_string {};
+}  // namespace test_ns
+
+template <typename T> class is_string_test : public testing::Test {};
+
+using string_char_types = testing::Types<char, wchar_t, char16_t, char32_t>;
+TYPED_TEST_SUITE(is_string_test, string_char_types);
+
+template <typename Char>
+struct derived_from_string_view : fmt::basic_string_view<Char> {};
+
+TYPED_TEST(is_string_test, is_string) {
+  EXPECT_TRUE(fmt::detail::is_string<TypeParam*>::value);
+  EXPECT_TRUE(fmt::detail::is_string<const TypeParam*>::value);
+  EXPECT_TRUE(fmt::detail::is_string<TypeParam[2]>::value);
+  EXPECT_TRUE(fmt::detail::is_string<const TypeParam[2]>::value);
+  EXPECT_TRUE(fmt::detail::is_string<std::basic_string<TypeParam>>::value);
+  EXPECT_TRUE(fmt::detail::is_string<fmt::basic_string_view<TypeParam>>::value);
+  EXPECT_TRUE(
+      fmt::detail::is_string<derived_from_string_view<TypeParam>>::value);
+  using fmt_string_view = fmt::detail::std_string_view<TypeParam>;
+  EXPECT_TRUE(std::is_empty<fmt_string_view>::value !=
+              fmt::detail::is_string<fmt_string_view>::value);
+  EXPECT_TRUE(fmt::detail::is_string<test_ns::test_string<TypeParam>>::value);
+  EXPECT_FALSE(fmt::detail::is_string<test_ns::non_string>::value);
 }

 #if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 470
@@ -453,6 +496,14 @@
   static_assert(fmt::is_formattable<disabled_formatter_convertible>::value, "");
 }

+TEST(core_test, format) { EXPECT_EQ(fmt::format("{}", 42), "42"); }
+
+TEST(core_test, format_to) {
+  std::string s;
+  fmt::format_to(std::back_inserter(s), "{}", 42);
+  EXPECT_EQ(s, "42");
+}
+
 struct convertible_to_int {
   operator int() const { return 42; }
 };
@@ -487,76 +538,24 @@
   EXPECT_EQ(fmt::format("{}", convertible_to_c_string()), "bar");
 }

-namespace my_ns {
-template <typename Char> class my_string {
- private:
-  std::basic_string<Char> s_;
-
- public:
-  my_string(const Char* s) : s_(s) {}
-  const Char* data() const FMT_NOEXCEPT { return s_.data(); }
-  size_t length() const FMT_NOEXCEPT { return s_.size(); }
-  operator const Char*() const { return s_.c_str(); }
-};
-
-template <typename Char>
-fmt::basic_string_view<Char> to_string_view(const my_string<Char>& s)
-    FMT_NOEXCEPT {
-  return {s.data(), s.length()};
-}
-
-struct non_string {};
-}  // namespace my_ns
-
-template <typename T> class IsStringTest : public testing::Test {};
-
-typedef testing::Types<char, wchar_t, char16_t, char32_t> StringCharTypes;
-TYPED_TEST_SUITE(IsStringTest, StringCharTypes);
-
-namespace {
-template <typename Char>
-struct derived_from_string_view : fmt::basic_string_view<Char> {};
-}  // namespace
-
-TYPED_TEST(IsStringTest, IsString) {
-  EXPECT_TRUE(fmt::detail::is_string<TypeParam*>::value);
-  EXPECT_TRUE(fmt::detail::is_string<const TypeParam*>::value);
-  EXPECT_TRUE(fmt::detail::is_string<TypeParam[2]>::value);
-  EXPECT_TRUE(fmt::detail::is_string<const TypeParam[2]>::value);
-  EXPECT_TRUE(fmt::detail::is_string<std::basic_string<TypeParam>>::value);
-  EXPECT_TRUE(fmt::detail::is_string<fmt::basic_string_view<TypeParam>>::value);
-  EXPECT_TRUE(
-      fmt::detail::is_string<derived_from_string_view<TypeParam>>::value);
-  using fmt_string_view = fmt::detail::std_string_view<TypeParam>;
-  EXPECT_TRUE(std::is_empty<fmt_string_view>::value !=
-              fmt::detail::is_string<fmt_string_view>::value);
-  EXPECT_TRUE(fmt::detail::is_string<my_ns::my_string<TypeParam>>::value);
-  EXPECT_FALSE(fmt::detail::is_string<my_ns::non_string>::value);
-}
-
-TEST(core_test, Format) { EXPECT_EQ(fmt::format("{}", 42), "42"); }
-
+// Test that check is not found by ADL.
 template <typename T> void check(T);
-TEST(core_test, ADL) { EXPECT_EQ(fmt::format("{}", test_struct()), "test"); }
-
-TEST(core_test, FormatTo) {
-  std::string s;
-  fmt::format_to(std::back_inserter(s), "{}", 42);
-  EXPECT_EQ(s, "42");
-}
-
-TEST(core_test, ToStringViewForeignStrings) {
-  using namespace my_ns;
-  EXPECT_EQ(to_string_view(my_string<char>("42")), "42");
+TEST(core_test, adl_check) {
+  EXPECT_EQ(fmt::format("{}", test_struct()), "test");
+}
+
+TEST(core_test, to_string_view_foreign_strings) {
+  using namespace test_ns;
+  EXPECT_EQ(to_string_view(test_string<char>("42")), "42");
   fmt::detail::type type =
-      fmt::detail::mapped_type_constant<my_string<char>,
+      fmt::detail::mapped_type_constant<test_string<char>,
                                         fmt::format_context>::value;
   EXPECT_EQ(type, fmt::detail::type::string_type);
 }

-TEST(core_test, FormatForeignStrings) {
-  using namespace my_ns;
-  EXPECT_EQ(fmt::format(my_string<char>("{}"), 42), "42");
+TEST(core_test, format_foreign_strings) {
+  using namespace test_ns;
+  EXPECT_EQ(fmt::format(test_string<char>("{}"), 42), "42");
 }

 struct implicitly_convertible_to_string {
@@ -567,7 +566,7 @@
   operator fmt::string_view() const { return "foo"; }
 };

-TEST(core_test, FormatImplicitlyConvertibleToStringView) {
+TEST(core_test, format_implicitly_convertible_to_string_view) {
   EXPECT_EQ("foo", fmt::format("{}", implicitly_convertible_to_string_view()));
 }

@@ -577,7 +576,7 @@
   explicit operator fmt::string_view() const { return "foo"; }
 };

-TEST(core_test, FormatExplicitlyConvertibleToStringView) {
+TEST(core_test, format_explicitly_convertible_to_string_view) {
   EXPECT_EQ("foo", fmt::format("{}", explicitly_convertible_to_string_view()));
 }

@@ -586,7 +585,7 @@
   explicit operator std::string_view() const { return "foo"; }
 };

-TEST(core_test, FormatExplicitlyConvertibleToStdStringView) {
+TEST(core_test, format_explicitly_convertible_to_std_string_view) {
   EXPECT_EQ("foo",
             fmt::format("{}", explicitly_convertible_to_std_string_view()));
 }
@@ -600,6 +599,6 @@
   operator const char*() && = delete;
 };

-TEST(core_test, DisabledRValueConversion) {
+TEST(core_test, disabled_rvalue_conversion) {
   EXPECT_EQ("foo", fmt::format("{}", disabled_rvalue_conversion()));
 }


Add SV-COMP'13 Sigma benchmark as test case

--- test/crv_test.cpp
+++ test/crv_test.cpp
@@ -1019,12 +1019,12 @@
   EXPECT_EQ(smt::sat, encoder.check(x == 'A', tracer()));
 }

-void array_t0(crv::External<char[]>& array)
+void array_t0(External<char[]>& array)
 {
   array[0] = 'X';
 }

-void array_t1(crv::External<char[]>& array)
+void array_t1(External<char[]>& array)
 {
   array[0] = 'Y';
 }
@@ -1048,6 +1048,43 @@
   EXPECT_EQ(smt::sat, encoder.check(array[0] != 'Y', tracer()));
   EXPECT_EQ(smt::sat, encoder.check(array[0] == 'X', tracer()));
   EXPECT_EQ(smt::sat, encoder.check(array[0] == 'Y', tracer()));
+  EXPECT_FALSE(tracer().flip());
+}
+
+void array_index(
+  External<unsigned[]>& array,
+  const External<size_t>& index)
+{
+  array[index] = 1;
+}
+
+TEST(CrvTest, ArrayIndex)
+{
+  tracer().reset();
+  Encoder encoder;
+
+  External<unsigned[]> array;
+  External<size_t> index(0);
+
+  Thread t1(array_index, array, index);
+  index = index + 1;
+
+  Thread t2(array_index, array, index);
+  index = index + 1;
+
+  Thread t3(array_index, array, index);
+
+  t1.join();
+  t2.join();
+  t3.join();
+
+  Internal<unsigned> sum(array[0] + array[1] + array[2]);
+
+  EXPECT_TRUE(tracer().assertions().empty());
+  EXPECT_TRUE(tracer().errors().empty());
+  EXPECT_EQ(smt::unsat, encoder.check(sum == 4, tracer()));
+  EXPECT_EQ(smt::sat, encoder.check(sum == 3, tracer()));
+  EXPECT_EQ(smt::sat, encoder.check(sum != 3, tracer()));
   EXPECT_FALSE(tracer().flip());
 }


constexpr test for FALCON_UNPACK

constexpr test for FALCON_UNPACK

--- test/cxx_test.cpp
+++ test/cxx_test.cpp
@@ -6,12 +6,17 @@
 #include "falcon/cxx/move.hpp"

 template<class... T>
-void foo(T... x)
+constexpr int foo(T... x)
 {
   static_assert(noexcept(FALCON_UNPACK(x+1)), "must be noexcept");
+  int sum = 0;
+  FALCON_UNPACK(sum += x);
+  return sum;
 }
+
+template<int i> class i_{};

 int main()
 {
-  foo(1, 2);
+  i_<foo(1, 2)>{};
 }


Review comment: Make clear that `filename` is a function in test name

--- test/download.cpp
+++ test/download.cpp
@@ -51,7 +51,7 @@
 	}
 }

-TEST_CASE("Filename returns download's target filename", "[Download]")
+TEST_CASE("filename() returns download's target filename", "[Download]")
 {
 	auto emptyCallback = []() {};


exchanged a test with View

exchanged a test with View

--- test/ds_tests.cpp
+++ test/ds_tests.cpp
@@ -111,7 +111,8 @@
     //check lexicographic order
     for(size_t i = 1; i < n+1; i++) {
         ASSERT_GE(t[sa[i]], t[sa[i-1]]);
-		ASSERT_LT(str.substr(sa[i-1]), str.substr(sa[i])); //TODO: use basic_string_view to speed up!
+		ASSERT_LT(str.substr(sa[i-1]), str.substr(sa[i])); //TODO: remove this (should be equal to below
+		ASSERT_LT(View(str,sa[i-1]), View(str,sa[i]));
     }

     auto& phi = t.require_phi();


Fix a CINT warning:
Warning: wrong member access operator '->' FILE:dt_MakeRef.C LINE:172
Warning: wrong member access operator '->' FILE:dt_MakeRef.C LINE:250

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@7093 27541ba8-7e3a-0410-8455-c3a389f83636

--- test/dt_MakeRef.C
+++ test/dt_MakeRef.C
@@ -169,7 +169,7 @@
       Int_t ncx = refTriggerBits->GetXaxis()->GetNbins();
       Int_t nextbit = -1;
       while(1) {
-         nextbit = bits->FirstSetBit(nextbit+1);
+         nextbit = bits.FirstSetBit(nextbit+1);
          if (nextbit >= nbits) break;
          if (nextbit > ncx) refTriggerBits->Fill(ncx+1);
          else               refTriggerBits->Fill(nextbit);
@@ -247,7 +247,7 @@
          Int_t ncx = refTrackTrigger->GetXaxis()->GetNbins();
          Int_t nextbit = -1;
          while(1) {
-            nextbit = bits->FirstSetBit(nextbit+1);
+            nextbit = bits.FirstSetBit(nextbit+1);
             if (nextbit >= nbits) break;
             if (nextbit > ncx) refTrackTrigger->Fill(ncx+1);
             else               refTrackTrigger->Fill(nextbit);


fix ut for geosearch

fix ut for geosearch

--- test/geo_test.cpp
+++ test/geo_test.cpp
@@ -26,9 +26,12 @@
     {
         char name[100];
         sprintf(name, "p%u", i);
-        double xx = x + i * 0.1;
-        double yy = y + i * 0.1;
-        if (((xx - p_x) * (xx - p_x) + (yy - p_y) * (yy - p_y)) < raius * raius)
+        /*
+         * min accuracy is 0.2meters
+         */
+        double xx = x + i * 0.3;
+        double yy = y + i * 0.3;
+        if (((xx - p_x) * (xx - p_x) + (yy - p_y) * (yy - p_y)) <= raius * raius)
         {
             GeoPoint p;
             p.x = xx;


Fixed recursive call bug

Fixed recursive call bug

--- imaging/vtkPNMReader.cxx
+++ imaging/vtkPNMReader.cxx
@@ -218,8 +218,6 @@

   this->SetDataScalarTypeToUnsignedChar();
   this->SetNumberOfScalarComponents(comp);
-
-  vtkImageReader::UpdateInformation();
-}
-
-
+}
+
+


MTG: for fuzzy deletion didn't use history just reduce size of kmer begin

--- include/FindDeletion.hpp
+++ include/FindDeletion.hpp
@@ -66,12 +66,11 @@
     for(repeat_size = 0; begin.substr(begin.length() - 1 - repeat_size, 1) == end.substr(repeat_size, 1); repeat_size++);

     // Compute del_size
-    unsigned int del_size = this->_find->gap_stretch_size() - this->_find->kmer_size() + repeat_size;
+    unsigned int del_size = this->_find->gap_stretch_size() - this->_find->kmer_size() + repeat_size + 1;

     if(repeat_size != 0)
-    {
-	unsigned char hist_begin_pos = this->_find->position() - del_size - 1 % 256;
-	begin = this->_find->model().toString(this->_find->het_kmer_history(hist_begin_pos).kmer);
+    {
+	begin = begin.substr(0, begin.length() - repeat_size)
     }

     // Check gap is a deletion
@@ -92,7 +91,7 @@
     }

     // Write the breakpoint
-    this->_find->writeBreakpoint(this->_find->breakpoint_id(), this->_find->chrom_name(), this->_find->position() - del_size - 2, begin, end, repeat_size, STR_DEL_TYPE);
+    this->_find->writeBreakpoint(this->_find->breakpoint_id(), this->_find->chrom_name(), this->_find->position() - del_size - 1, begin, end, repeat_size, STR_DEL_TYPE);
     this->_find->breakpoint_id_iterate();

     if(repeat_size != 0)


Comment out print

Comment out print

--- darr/da.cpp
+++ darr/da.cpp
@@ -88,18 +88,13 @@
 #endif

         t = base[r] + a;
-        printf("has move base[%d] + %c = %d + %d = %d, base[t=%d] = %d basesize:%d\n", r, chars[h], base[r], a, t, t, base[t], base.size());
-        if (t >= base.size()) {
-            printf("OVER\n");
-        }
-
-#ifdef DEBUG
-        printf("t=%d\n", t);
-#endif
-
-//        if (check[t] != r) {
+//        printf("has move base[%d] + %c = %d + %d = %d, base[t=%d] = %d basesize:%d\n", r, chars[h], base[r], a, t, t, base[t], base.size());
+//        if (t >= base.size()) {
+//            printf("OVER\n");
+//        }
+
         if (check[t] != r || t >= check.size()) {
-            printf("!has1 check[t=%d]=%d != %d = r\n", t, check[t], r);
+//            printf("!has1 check[t=%d]=%d != %d = r\n", t, check[t], r);
             return -1;
         } else {
             r = t;
@@ -109,11 +104,6 @@
     }

     if (h == n_char+1) {
-//    if (h == n_char) {
-#ifdef DEBUG
-        printf("found1: t=%d\n", t);
-        std::cout << "value=" << value[t] << std::endl;
-#endif
 //        printf("has1\n");
         return t;
     } else {
@@ -121,26 +111,26 @@
         std::vector<uint8_t> s_temp = fetch_str(-base[r]);
         std::vector<uint8_t> remain = get_subchars(chars, h, n_char+1);

-        std::string remains;
-        for (int i=0; i < remain.size(); ++i) {
-            remains += remain[i];
-        }
-        std::cout << "remain:" << remains << std::endl;
-        std::string stemps;
-        for (int i=0; i < s_temp.size(); ++i) {
-            stemps += s_temp[i];
-        }
-        std::cout << "s_temp:" << stemps << std::endl;
+//        std::string remains;
+//        for (int i=0; i < remain.size(); ++i) {
+//            remains += remain[i];
+//        }
+//        std::cout << "remain:" << remains << std::endl;
+//        std::string stemps;
+//        for (int i=0; i < s_temp.size(); ++i) {
+//            stemps += s_temp[i];
+//        }
+//        std::cout << "s_temp:" << stemps << std::endl;

         uint8_t* remain_ = remain.data();
         uint8_t* s_temp_ = s_temp.data();
         int match = mem_cmp(s_temp_, remain_, remain.size());

         if (match == -1) {
-            printf("has2\n");
+//            printf("has2\n");
             return t;
         } else {
-            printf("!has2 t=%d\n", t);
+//            printf("!has2 t=%d\n", t);
             return -1;
         }

@@ -149,7 +139,6 @@

 template<typename val_t>
 int darr::DoubleArray<val_t>::del(const std::string& key) {
-//    std::string key_ = key + "#";
     std::vector<uint8_t> chars;
     int keysize = key.size();
     for (int i=0; i < keysize; ++i) {
@@ -157,7 +146,6 @@
     }
     int n_char = chars.size();
     chars.push_back('\0');
-//    chars.push_back('#');

     int r = 0; // current node id
     int h = 0; // current position of the given string
@@ -172,16 +160,11 @@
 #ifdef DEBUG
         int a = keymap[key_[h]];
 #else
-//        int a = chars[h] + 1;
         int a = chars[h];
 #endif

         t = base[r] + a;

-#ifdef DEBUG
-        printf("t=%d\n", t);
-#endif
-
         if (check[t] != r) {
             return -1;
         } else {
@@ -192,11 +175,7 @@
     }

     if (h == n_char+1) {
-#ifdef DEBUG
-        printf("found1: t=%d\n", t);
-        std::cout << "value=" << value[t] << std::endl;
-#endif
-        printf("DEL base[t=%d]=0\n", t);
+//        printf("DEL base[t=%d]=0\n", t);
         base[t] = 0;
         check[t] = -1;
         value[t] = val_t{};
@@ -207,7 +186,7 @@
         uint8_t* start_ptr = &tail[-base[r]-1];
         int match = mem_cmp(start_ptr, a, a_h12.size());
         if (match == -1) {
-            printf("DEL base[t=%d]=0\n", t);
+//            printf("DEL base[t=%d]=0\n", t);
             base[t] = 0;
             check[t] = -1;
             value[t] = val_t{};
@@ -225,12 +204,10 @@
 template<typename val_t>
 val_t darr::DoubleArray<val_t>::get(const std::string& key) {
     int id = has(key);
-//    printf("get id:%d\n", id);
-
     int valuesize = value.size();
-    if (id >= valuesize) {
-        std::cout << "id:" << id << " > valuesize:" << valuesize << std::endl;
-    }
+//    if (id >= valuesize) {
+//        std::cout << "id:" << id << " > valuesize:" << valuesize << std::endl;
+//    }

     if (id != -1) {
         val_t val = value[id];
@@ -248,30 +225,27 @@

     int keysize = key.size();
     std::vector<uint8_t> chars(keysize);
-//    std::cout << "insert key:" << key << std::endl;
     for (int i=0; i < keysize; ++i) {
         chars[i] = key[i];
     }
-//    std::cout << std::endl;
     int n_char = chars.size();
     chars.push_back('\0');
-//    chars.push_back('#');

     int r = 0; // current node id
     int h = 0; // current position of the given string

-#ifdef DEBUG
-    printf("INSERT %s %f\n", key_.c_str(), val);
-#endif
+//#ifdef DEBUG
+//    printf("INSERT %s %f\n", key_.c_str(), val);
+//#endif

     while (1) {

-#ifdef DEBUG
-        int a = keymap[key_[h]];
-#else
+//#ifdef DEBUG
+//        int a = keymap[key_[h]];
+//#else
 //        int a = chars[h] + 1;
         int a = chars[h];
-#endif
+//#endif

         int t = base[r] + a;

@@ -290,27 +264,19 @@
             }
         }

-        printf("insert move base[%d] + %c[h=%d] = %d + %d = %d, base[t=%d] = %d basesize:%d\n", r, chars[h], h, base[r], a, t, t, base[t], base.size());
-        if (t >= base.size()) {
-            printf("OVER\n");
-        }
-
-
-#ifdef DEBUG
-        printf("t = base[r=%d] + %c = %d\n", r, key_[h], t);
-        printf("size:%d check[t=%d]=%d\n", check.size(), t, check[t]);
-#endif
+//        printf("insert move base[%d] + %c[h=%d] = %d + %d = %d, base[t=%d] = %d basesize:%d\n", r, chars[h], h, base[r], a, t, t, base[t], base.size());
+//        if (t >= base.size()) {
+//            printf("OVER\n");
+//        }
+

         if (check[t] != r || t > check.size()) {
-//        if (check[t] != r ){
             std::vector<uint8_t> sub_key = get_subchars(chars, h, n_char+1);
             std::string a_;
             for (int i=0; i < sub_key.size(); ++i) {
                 a_ += sub_key[i];
             }
-//            printf("nchar:%d\n", n_char);
-//            printf("sub_key size:%d\n", sub_key.size());
-            printf("A_INSERT(r=%d, %s)\n", r, a_.c_str());
+//            printf("A_INSERT(r=%d, %s)\n", r, a_.c_str());
             int basesize = base.size();
             if (r > basesize) {
                 for (int k=basesize-1; k<=r; ++k) {
@@ -320,14 +286,6 @@
             }

             a_insert(r, sub_key, val);
-
-#ifdef DEBUG
-            printf("after insert %s t=%d\n", key_.c_str(), t);
-//            darr::printvec(base);
-//            darr::printvec(check);
-//            darr::printvec_char(tail);
-            printf("POS=%d\n", POS);
-#endif

             return false;
         } else {
@@ -355,31 +313,20 @@

         std::vector<uint8_t> s_temp = fetch_str(-base[r]);

-#ifdef DEBUG
-        printf("s_temp:%s\n", s_temp.c_str());
-        printf("remain:%s\n", remain.c_str());
-#endif
-
-//        printf("TAIL\n");
-//        for (int i=0; i < tail.size(); ++i) {
-//            printf("%c, ", tail[i]);
-//        }
-//        printf("\n");
-        printf("h:%d \n", h+1);
+//        printf("h:%d \n", h+1);

         std::vector<uint8_t> remain = get_subchars(chars, h+1, n_char+1);
-//        std::vector<uint8_t> remain = get_subchars(chars, h, n_char+1);
-
-        std::string remains;
-        for (int i=0; i < remain.size(); ++i) {
-            remains += remain[i];
-        }
-        std::cout << "remain:" << remains << std::endl;
-        std::string stemps;
-        for (int i=0; i < s_temp.size(); ++i) {
-            stemps += s_temp[i];
-        }
-        std::cout << "s_temp:" << stemps << std::endl;
+
+//        std::string remains;
+//        for (int i=0; i < remain.size(); ++i) {
+//            remains += remain[i];
+//        }
+//        std::cout << "remain:" << remains << std::endl;
+//        std::string stemps;
+//        for (int i=0; i < s_temp.size(); ++i) {
+//            stemps += s_temp[i];
+//        }
+//        std::cout << "s_temp:" << stemps << std::endl;

         uint8_t* remain_ = remain.data();
         uint8_t* s_temp_ = s_temp.data();
@@ -390,28 +337,17 @@

             std::vector<uint8_t> prefix = get_subchars(chars, h+1, h+1+prefix_len);
             std::vector<uint8_t> remain_key = get_subchars(chars, h+1+prefix_len, n_char+1);
-//            std::vector<uint8_t> prefix = get_subchars(chars, h, h+prefix_len);
-//            std::vector<uint8_t> remain_key = get_subchars(chars, h+prefix_len, n_char+1);
-
             std::vector<uint8_t> remain_s_temp = get_subchars(s_temp, prefix_len, s_temp.size());

-            std::string prefixs;
-            for (int i=0; i < prefix.size(); ++i) {
-                prefixs += prefix[i];
-            }
-            std::cout << "prefix:" << prefixs << std::endl;
-
-            printf("B_INSERT\n");
+//            std::string prefixs;
+//            for (int i=0; i < prefix.size(); ++i) {
+//                prefixs += prefix[i];
+//            }
+//            std::cout << "prefix:" << prefixs << std::endl;
+
+//            printf("B_INSERT\n");
             b_insert(r, prefix, remain_key, remain_s_temp, val);

-
-#ifdef DEBUG
-            printf("after insert %s t=%d\n", key_.c_str(), h);
-//            darr::printvec(base);
-//            darr::printvec(check);
-//            darr::printvec_char(tail);
-#endif
-
             return false;
         }
     }
@@ -421,68 +357,47 @@
 template<typename val_t>
 void darr::DoubleArray<val_t>::a_insert(int r, const std::vector<uint8_t>& key, const val_t& val) {

-#ifdef DEBUG
-//    printf("A_INSERT(%d %s)\n", r, key.c_str());
-    int a = keymap[key[0]];
-#else
-//    int a = key[0] + 1;
     int a = key[0];
-#endif

     int t = base[r] + a;
 //    printf("t = base[r=%d] + %c = %d\n", r, key[0], a);

-#ifdef DEBUG
-    printf("t = base[r=%d] + %c = %d\n", r, key[0], t);
-    printf("check[t=%d] = %d\n", t, check[t]);
-#endif
-
     int checksize = check.size();
     if (t >= checksize) {
-        printf("t = %d >= check.size() = %d\n", t, checksize);
+//        printf("t = %d >= check.size() = %d\n", t, checksize);
         for (int i=checksize; i <= t; ++i) {
             check.push_back(-1);
         }
     }

     if (check[t] <= -1) {
-//    if (check[t] > -1) {
         insert_str(r, key, POS, val);
     } else {
-        printf("MODIFY\n");
+//        printf("MODIFY\n");
         std::vector<uint8_t> rlist2 = set_list(r);
         std::vector<uint8_t> tlist2 = set_list(check[t]);

         int s;
         if (rlist2.size() + 1 < tlist2.size()) {
             std::vector<uint8_t> b = {key[0]};
-            printf("MODIFY1\n");
+//            printf("MODIFY1\n");
             s = modify(r, r, b, rlist2);
         } else {
-            printf("MODIFY2\n");
+//            printf("MODIFY2\n");
             std::vector<uint8_t> empty;
             s = modify(r, check[t], empty, tlist2);
         }

-//#ifdef DEBUG
-//        printf("A_INSERT INS_STR(%d, %s, %d)\n", s, key.c_str(), POS);
-//#endif
         insert_str(s, key, POS, val);

     }
-//    insert_str(r, key, POS, val);
 };

 template<typename val_t>
 void darr::DoubleArray<val_t>::insert_str(int h, const std::vector<uint8_t>& key, int d_pos, const val_t& val) {
-#ifdef DEBUG
-    int e1 = keymap[key[0]];
-#else
+
     int e1 = key[0];
-//    int e1 = key[0] + 1;
-#endif
-
-//    printf("INSERTSTR\n");
+
     int t = base[h] + e1;

     int basesize = base.size();
@@ -504,32 +419,14 @@
         }
     }

-#ifdef DEBUG
-    printf("insert! %s t=%d val=%f\n", key.c_str(), t, val);
-    printf("t = base[h=%d] + %c = %d + %d = %d\n", h, key[0], base[h], e1, t);
-#endif
-
-//    printf("basesize=%d\n", basesize);
-//    printf("checksize=%d\n", checksize);
-//    printf("valuesize=%d\n", valuesize);
-//    printf("-d_pos=%d\n", -d_pos);
-
     base[t] = -d_pos;
     check[t] = h;
     value[t] = val;
-    printf("t = base[h=%d] + %c = %d + %d = %d\n", h, key[0], base[h], e1, t);
-    printf("INSERT check[t=%d]=%d\n", t, check[t]);
-
-#ifdef DEBUG
-    printf("INSERT base[t=%d]=%d\n", t, base[t]);
-    printf("INSERT check[t=%d]=%d\n", t, check[t]);
-#endif
+//    printf("t = base[h=%d] + %c = %d + %d = %d\n", h, key[0], base[h], e1, t);
+//    printf("INSERT check[t=%d]=%d\n", t, check[t]);

     check[0] = check.size();

-#ifdef DEBUG
-    printf("key=%s\n", key.c_str());
-#endif
     std::vector<uint8_t> e = get_subchars(key, 1, key.size());
     e.push_back('$');

@@ -539,10 +436,7 @@
     for (int i=0; i < e.size(); ++i) {
         a += e[i];
     }
-    printf("POS = STR_TAIL(%d, %s) = %d\n", d_pos, a.c_str(), POS + pos);
-//#ifdef DEBUG
-//    printf("POS = STR_TAIL(%d, %s) = %d\n", d_pos, e.c_str(), POS + pos);
-//#endif
+//    printf("POS = STR_TAIL(%d, %s) = %d\n", d_pos, a.c_str(), POS + pos);
     POS = POS + pos;
 };

@@ -559,12 +453,6 @@
     for (int i=0; i < s_y; ++i) {
         tail[p-1+i] = y[i];
     }
-
-//    printf("TAIL\n");
-//    for (int i=0; i < tail.size(); ++i) {
-//        printf("%c, ", tail[i]);
-//    }
-//    printf("\n");

     if (p == POS) {
         return s_y;
@@ -593,10 +481,8 @@
 int darr::DoubleArray<val_t>::mem_cmp(uint8_t* x, uint8_t* y, int len) {
     int k = 0;
     for (int i=0; i < len; ++i) {
-//        printf("compare %c %c\n", x[i], y[i]);
         if (x[i] == y[i]) {
             k += 1;
-//            printf("k+=1=%d\n", k);
         } else {
             break;
         }
@@ -613,40 +499,28 @@
 template<typename val_t>
 void darr::DoubleArray<val_t>::b_insert(int r, const std::vector<uint8_t>& prefix, const std::vector<uint8_t>& a, const std::vector<uint8_t>& b, const val_t& val) {

-    std::string a_;
-    for (int i=0; i < a.size(); ++i) {
-        a_ += a[i];
-    }
-    std::string b_;
-    for (int i=0; i < b.size(); ++i) {
-        b_ += b[i];
-    }
-    std::string prefix_;
-    for (int i=0; i < prefix.size(); ++i) {
-        prefix_ += prefix[i];
-    }
-    printf("B_INSERT(%d, %s, %s, %s)\n", r, prefix_.c_str(), a_.c_str(), b_.c_str());
-
-#ifdef DEBUG
-    printf("B_INSERT(%d, %s, %s, %s)\n", r, prefix.c_str(), a.c_str(), b.c_str());
-#endif
+//    std::string a_;
+//    for (int i=0; i < a.size(); ++i) {
+//        a_ += a[i];
+//    }
+//    std::string b_;
+//    for (int i=0; i < b.size(); ++i) {
+//        b_ += b[i];
+//    }
+//    std::string prefix_;
+//    for (int i=0; i < prefix.size(); ++i) {
+//        prefix_ += prefix[i];
+//    }
+//    printf("B_INSERT(%d, %s, %s, %s)\n", r, prefix_.c_str(), a_.c_str(), b_.c_str());

     int old_pos = -base[r];
-
-#ifdef DEBUG
-    printf("old_pos = -base[r=%d] = %d\n", r, old_pos);
-#endif

     int prefixsize = prefix.size();
     for (int i=0; i < prefixsize; ++i) {
         std::vector<uint8_t> pi = {prefix[i]};

-#ifdef DEBUG
-        int b = keymap[prefix[i]];
-#else
         int b = prefix[i];
 //        int b = prefix[i] + 1;
-#endif

         int basesize = base.size();
         if (r >= basesize) {
@@ -656,7 +530,7 @@
         }

         int t = x_check(pi);
-        printf("B_INSERT x_check(%c) = %d\n", prefix[i], t);
+//        printf("B_INSERT x_check(%c) = %d\n", prefix[i], t);
         base[r] = t;

         int checksize = check.size();
@@ -675,14 +549,10 @@
         check[base[r] + b] = r;
         value[base[r] + b] = value[r];

-        printf("B_INSERT base[r=%d] = %d\n", r, t);
-        printf("B_INSERT check[base[r]+b] = check[%d+%d] = check[%d] = %d\n",
-                base[r], b, base[r]+b, check[base[r]+b]);
-//        printf("value[base[r]+b] = value[%d+%d]=", base[r], b);
-//        std::cout << value[base[r]+b] << std::endl;
-//        printf("checksize:%d index:%d\n", check.size(), base[r]+b);
+//        printf("B_INSERT base[r=%d] = %d\n", r, t);
+//        printf("B_INSERT check[base[r]+b] = check[%d+%d] = check[%d] = %d\n",
+//                base[r], b, base[r]+b, check[base[r]+b]);
         r = base[r] + b;
-//        printf("r = base[r=%d] + %c = %d + %d = %d\n", r, prefix[i], base[r], b,r);
     }

     int basesize = base.size();
@@ -695,22 +565,12 @@
     std::vector<uint8_t> list = {a[0], b[0]};
     int q = x_check(list);
     base[r] = q;
-    printf("B_INSERT base[r=%d]=%d\n", r, q);
-
-#ifdef DEBUG
-    printf("r=%d value[r=%d]=%d\n", r, r, value[r]);
-    printf("B_INSERT1 INS_STR(%d, %s, %d)\n", r, b.c_str(), old_pos);
-#endif
-    printf("B_INSERT1 INS_STR(%d, %s, %d)\n", r, b_.c_str(), old_pos);
-//    std::cout << "value:" << value[r] << std::endl;
+//    printf("B_INSERT base[r=%d]=%d\n", r, q);
+
+//    printf("B_INSERT1 INS_STR(%d, %s, %d)\n", r, b_.c_str(), old_pos);
     insert_str(r, b, old_pos, value[r]);

-#ifdef DEBUG
-    printf("r=%d value[r=%d]=%d\n", r, r, value[r]);
-    printf("B_INSERT2 INS_STR(%d, %s, %d)\n", r, a.c_str(), POS);
-#endif
-    printf("B_INSERT2 INS_STR(%d, %s, %d)\n", r, a_.c_str(), POS);
-//    std::cout << "value:" << val << std::endl;
+//    printf("B_INSERT2 INS_STR(%d, %s, %d)\n", r, a_.c_str(), POS);
     insert_str(r, a, POS, val);
 };

@@ -718,22 +578,9 @@
 template<typename val_t>
 int darr::DoubleArray<val_t>::x_check(const std::vector<uint8_t>& list) {
     int minq = -1;
-//    int minc = -1;
-//    int minc = list[0];
-
-//    int minc = 1;
-//    if (list.size() > 0) {
-//        minc = list[0] + 1;
-//        minc = list[0];
-//    }
     bool found = false;

-#ifdef DEBUG
-    printf("list '%s'\n", list.c_str());
-#endif
-
     int listsize = list.size();
-//    for (int q=0; q < check.size(); ++q) {
     for (int q=1; q < check.size(); ++q) {
         bool ok = true;
         for (int i=0; i < listsize; ++i) {
@@ -753,89 +600,36 @@
         }
     }

-//    int listsize = list.size();
-//    for (int i=0; i < listsize; ++i) {
-//#ifdef DEBUG
-//        int c = keymap[list[i]];
-//#else
-//        int c = list[i];
-//        int c = list[i] + 1;
-//#endif
-//        if (c < minc) {
-//            minc = c;
-//        }
-//        for (int q=0; q < check.size(); ++q) {
-//            if (q + c >= check.size()) {
-//                continue;
-//            }
-//            if (check[q + c] <= -1) {
-//                if (q < minq) {
-//                    minq = q;
-//                    found = true;
-//                }
-//            }
-//        }
-//    }
     if (!found) {
-//        minq = check.size() - minc;
-//#ifdef DEBUG
-//        printf("minq update: check.size() - minc = %d - %d = %d\n", check.size(), minc, minq);
-//#endif
-//        printf("expand in x_check\n");
         base.push_back(0);
         check.push_back(-1);
         value.push_back(val_t{});
         minq = base.size();
     }

-//#ifdef DEBUG
-//    std::cout << "found:" << found << std::endl;
 //    printf("minq:%d\n", minq);
-//#endif
-    printf("minq:%d\n", minq);
-    if (minq == 0) {
-        printf("MINQ == 0!\n");
-    }
     return minq;
 };

 template<typename val_t>
 std::vector<uint8_t> darr::DoubleArray<val_t>::set_list(int k) {
     std::vector<uint8_t> ret;
-//std::vector<int> darr::DoubleArray<val_t>::set_list(int k) {
-//    std::vector<int> ret;
-
-//    fprintf(stderr, "set-list k=%d base.size()=%d\n", k, base.size());
+
     if (k >= base.size()) {
         return ret;
     }

-//    for (int i=0; i < check.size(); ++i) {
     int checksize = check.size();
     for (int i=0; i < checksize; ++i) {
-//        uint8_t c = i + 1;
-        uint8_t c = i;
-//        if (base[k] + c >= checksize) {
-//            break;
-//        }
-//        if (base[k] + c >= checksize || base[k] + c < 0) {
+//        uint8_t c = i;
         if (base[k] + i >= checksize || base[k] + i < 0) {
             continue;
         }

-//        fprintf(stderr, "base[k=%d]=%d\n", k, base[k]);
-//        fprintf(stderr, "base[k] + c = %d checksize=%d\n", base[k] + c, checksize);
-//        fprintf(stderr, "check[base[k]=%d + c=%d]=%d\n", base[k], c, check[base[k]+c]);
-
-//        if (check[base[k] + c] == k) {
         if (check[base[k] + i] == k) {
-#ifdef DEBUG
-            ret.push_back(itos[i]);
-#else
-            printf("set_list: add[i=%d] %c %d\n", ret.size(), c, i);
+//            printf("set_list: add[i=%d] %c %d\n", ret.size(), c, i);
 //            ret.push_back(c);
             ret.push_back(i);
-#endif
         }
     }
     return ret;
@@ -845,45 +639,25 @@
 template<typename val_t>
 int darr::DoubleArray<val_t>::modify(int current_s, int h, const std::vector<uint8_t>& add, const std::vector<uint8_t>& org) {

-//    if (h >= base.size()) {
-//        printf("h = %d >= base.size() = %d\n", h, base.size());
-//    }
-
     int old_base = base[h];

-//#ifdef DEBUG
-    printf("old_base = BASE[h=%d] = %d\n", h, old_base);
-//#endif
+//    printf("old_base = BASE[h=%d] = %d\n", h, old_base);

     int t = x_check(_or(add, org));
     base[h] = t;
-    printf("MODIFY base[h=%d] = x_check() = %d\n", h, t);
-//    print_vec(base);
-
-//#ifdef DEBUG
-    printf("BASE[h=%d] = %d\n", h, base[h]);
-//#endif
+//    printf("MODIFY base[h=%d] = x_check() = %d\n", h, t);

     int orgsize = org.size();
     for (int i=0; i < orgsize; ++i) {
-//#ifdef DEBUG
-//        int c = keymap[org[i]];
-//#else
         int c = org[i];
-        printf("MODIFY char[i=%d]:%c %d\n", i, org[i], c);
-//        int c = org[i] + 1;
-//#endif
+//        printf("MODIFY char[i=%d]:%c %d\n", i, org[i], c);

         int t = old_base + c;

-//#ifdef DEBUG
-        printf("t = old_base(%d) + %c(%d) = %d\n", old_base, org[i], c, t);
-//#endif
+//        printf("t = old_base(%d) + %c(%d) = %d\n", old_base, org[i], c, t);

         int t2 = base[h] + c;
-//#ifdef DEBUG
-        printf("t2 = base[h=%d] + %c(%d) = %d\n", h, org[i], c, t2);
-//#endif
+//        printf("t2 = base[h=%d] + %c(%d) = %d\n", h, org[i], c, t2);

         int checksize = check.size();
         if (t2 >= checksize) {
@@ -906,23 +680,19 @@
             }
         }

-        printf("MODIFY base[t=%d]=%d\n", t, base[t]);
+//        printf("MODIFY base[t=%d]=%d\n", t, base[t]);
         check[t2] = h;
         base[t2] = base[t];
         value[t2] = value[t];

-//#ifdef DEBUG
-        printf("MODIFY check[t2=%d] = %d\n", t2, h);
-//        printf("MODIFY base[t2=%d] = base[t] = %d\n", t2, h, base[t2]);
-        printf("MODIFY base[t2=%d] = base[t=%d] = %d\n", t2, t, base[t2]);
-//        print_vec(base);
-//#endif
+//        printf("MODIFY check[t2=%d] = %d\n", t2, h);
+//        printf("MODIFY base[t2=%d] = base[t=%d] = %d\n", t2, t, base[t2]);

         if (base[t] > 0) {
             for (int q=0; q < check.size(); ++q) {
                 if (check[q] == t) {
                     check[q] = t2;
-                    printf("MODIFY check[q=%d] = t = %d => t2 = %d\n", q, t, t2);
+//                    printf("MODIFY check[q=%d] = t = %d => t2 = %d\n", q, t, t2);
                 }
                 if (t == current_s) {
                     current_s = t2;
@@ -931,12 +701,8 @@

         }

-//#ifdef DEBUG
-//        printf("base[t=%d] = 0\n", t);
-//        printf("check[t=%d] = 0\n", t);
-//#endif
-        printf("MODIFY clear base[t=%d] = 0\n", t);
-        printf("MODIFY clear check[t=%d] = 0\n", t);
+//        printf("MODIFY clear base[t=%d] = 0\n", t);
+//        printf("MODIFY clear check[t=%d] = 0\n", t);

         base[t] = 0;
         check[t] = -1;
@@ -979,12 +745,10 @@
 //        }
 //    }

-//#if DEBUG
 //    printf("write basesize:%d\n", basesize);
 //    printf("write checksize:%d\n", checksize);
 //    printf("write tailsize:%d\n", tailsize);
 //    printf("write valuesize:%d\n", valuesize);
-//#endif

     fclose(fp);
 };
@@ -1030,12 +794,10 @@
         fread(&value[i], sizeof(val_t), 1, fp);
     }

-//#if DEBUG
 //    printf("read basesize:%d\n", basesize);
 //    printf("read checksize:%d\n", checksize);
 //    printf("read tailsize:%d\n", tailsize);
 //    printf("read valuesize:%d\n", valuesize);
-//#endif

     fclose(fp);
 };


database: Don't use std::cbegin() and std::cend()

They're not supported by GCC 4.9.

Fixes #1305
Message-Id: <154f640c6056e77b39fbaf3d0e9adbf918c2e6c6@scylladb.com>

--- database.cc
+++ database.cc
@@ -1355,7 +1355,7 @@
     } else {
         dblog.info("Populating Keyspace {}", ks_name);
         auto& ks = i->second;
-        return parallel_for_each(std::cbegin(_column_families), std::cend(_column_families),
+        return parallel_for_each(_column_families,
             [ks_name, &ks] (const std::pair<utils::UUID, lw_shared_ptr<column_family>>& e) {
                 utils::UUID uuid = e.first;
                 lw_shared_ptr<column_family> cf = e.second;


Using unique_ptr in search if is field is range

--- database.cc
+++ database.cc
@@ -506,10 +506,16 @@
 	std::vector<std::unique_ptr<DateFieldProcessor>> dfps;
 	std::vector<std::unique_ptr<BooleanFieldProcessor>> bfps;
 	std::vector<std::unique_ptr<LatLongFieldProcessor>> gfps;
+	std::vector<std::unique_ptr<Xapian::NumberValueRangeProcessor>> nvrps;
+	std::vector<std::unique_ptr<Xapian::StringValueRangeProcessor>> svrps;
+	std::vector<std::unique_ptr<DateTimeValueRangeProcessor>> dvrps;
 	NumericFieldProcessor *nfp;
 	DateFieldProcessor *dfp;
 	BooleanFieldProcessor *bfp;
 	LatLongFieldProcessor *gfp;
+	Xapian::NumberValueRangeProcessor *nvrp;
+	Xapian::StringValueRangeProcessor *svrp;
+	DateTimeValueRangeProcessor *dvrp;
 	while ((pcre_search(e.query.c_str(), len, offset, 0, FIND_FIELD_RE, &compiled_find_field_re, &g)) != -1) {
 		offset = g[0].end;
 		std::string field_name_dot, field_name, field_value;
@@ -522,19 +528,21 @@

 		if(isRange(field_value)){
 			switch (field_type(field_name)) {
-				case 0:{
-					Xapian::NumberValueRangeProcessor vrp(get_slot(field_name), "");
-					queryparser.add_valuerangeprocessor(&vrp);
+				case NUMERIC_TYPE:
+					nvrp = new Xapian::NumberValueRangeProcessor(get_slot(field_name), "");
+					nvrps.push_back(std::unique_ptr<Xapian::NumberValueRangeProcessor>(nvrp));
+					queryparser.add_valuerangeprocessor(nvrp);
+					break;
+				case STRING_TYPE: {
+					svrp = new Xapian::StringValueRangeProcessor(get_slot(field_name));
+					svrps.push_back(std::unique_ptr<Xapian::StringValueRangeProcessor>(svrp));
+					queryparser.add_valuerangeprocessor(svrp);
 					break; }

-				case 1: {
-					Xapian::StringValueRangeProcessor vrp(get_slot(field_name));
-					queryparser.add_valuerangeprocessor(&vrp);
-					break; }
-
-				case 2: {
-					DateTimeValueRangeProcessor vrp(get_slot(field_name), get_prefix(field_name, std::string(DOCUMENT_CUSTOM_TERM_PREFIX)));
-					queryparser.add_valuerangeprocessor(&vrp);
+				case DATE_TYPE: {
+					dvrp = new DateTimeValueRangeProcessor(get_slot(field_name), get_prefix(field_name, std::string(DOCUMENT_CUSTOM_TERM_PREFIX)));
+					dvrps.push_back(std::unique_ptr<DateTimeValueRangeProcessor>(dvrp));
+					queryparser.add_valuerangeprocessor(dvrp);
 					break; }

 				default: LOG_ERR(this, "This type of Data has no support for range search\n");


database: Compare view id instead of name in find_views()

Signed-off-by: Duarte Nunes <a60e8b7496f7715d71354fe4c06dd24017025bf1@scylladb.com>

--- database.cc
+++ database.cc
@@ -4270,9 +4270,10 @@

 static std::vector<view_ptr>::iterator find_view(std::vector<view_ptr>& views, const view_ptr& v) {
     return std::find_if(views.begin(), views.end(), [&v] (auto&& e) {
-        return e->cf_name() == v->cf_name();
-    });
-}
+        return e->id() == v->id();
+    });
+}
+
 void column_family::add_or_update_view(view_ptr v) {
     auto existing = find_view(_views, v);
     if (existing != _views.end()) {


Add note

Add note

--- include/etl/impl/sum.hpp
+++ include/etl/impl/sum.hpp
@@ -14,6 +14,10 @@
  * parallel versus serial is also done at this level. The implementation
  * functions should never be used directly, only functions of this header can
  * be used directly.
+ *
+ * Note: In a perfect world (full constexpr function and variable templates),
+ * the selection should be done with a template parameter in a variable
+ * template full sspecialization (alias for each real functions).
  */

 #pragma once


Implemented some "meta operators" AdaptiveModel, Join and the collapse of Join.

--- include/fl/util/meta.hpp
+++ include/fl/util/meta.hpp
@@ -218,13 +218,17 @@
   : TypeSequence<>
 { };

+template <typename Model, typename ParameterModel>
+struct AdaptiveModel { };
+
 /**
  * \ingroup meta
  *
  * Same as CreateTypeSequence, however with a reversed parameter order. This is
- * an attempt to make the use of \c CreateTypeSequence more natural.
- */
-template <typename Type, int Count>
+ * an attempt to make the use of \c CreateTypeSequence more natural. It also
+ * allows dynamic sizes if needed.
+ */
+template <typename Type, int Count = Eigen::Dynamic>
 struct MultipleOf
     : CreateTypeSequence<Count, Type>
 { };
@@ -240,6 +244,158 @@
     : CreateTypeSequence<Eigen::Dynamic, Type>
 { };

+/**
+ * \c Join represents a meta operator taking an argument pack which should be
+ * unified in a specific way. The operator is defined by the following axioms
+ *
+ * - pack of Join<P1, P2, ...>  {P1, P2, ...}
+ * - positive pack:             sizeof...(T) of Join<T...>
+ * - nesting:                   Join<P1, Join<P2, P3>> = {P1, P2, P3}
+ * - Comm.                      Join<P1, Join<P2, P3>> = Join<Join<P1, P2>, P3>
+ * - MultipleOf operator:       Join<MultipleOf<P, #>>
+ *
+ * \ingroup meta
+ */
+template <typename...T> struct Join;
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * Collapes the argument pack of the Join operator into Model<T...> of ay given
+ * Join<...> operator.
+ */
+template <typename...T> struct CollapseJoin;
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * CollapseJoin specialization which expands the type sequence by the Head
+ * element assuming Head is neither a Join<...> nor a MultipleOf<P, #> operator.
+ */
+template <
+    typename...S,
+    typename Head,
+    typename...T,
+    template <typename...> class Model
+>
+struct CollapseJoin<
+           Model<>,                 // Final model type
+           TypeSequence<S...>,      // Type sequence holding the pack expansion
+           Head,                    // Current non-operator pack head element
+           T...>                    // Remaining Tail
+  : CollapseJoin<
+        Model<>,                    // Final model type
+        TypeSequence<Head, S...>,   // updated type sequence
+        T...>                       // Remaining Tail
+{ };
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * CollapseJoin specialization which unifies a Join<...> pack Head into the
+ * outer Join pack, i.e.
+ *
+ * Join<T1..., Join<T2...>, T3 > = Join<T1..., T2..., T3...>
+ */
+template <
+    typename...S,
+    typename...T,
+    typename...U,
+    template <typename...> class Model
+>
+struct CollapseJoin<
+           Model<>,                 // Final model type
+           TypeSequence<S...>,      // Type sequence holding the pack expansion
+           Join<T...>,              // Current pack head element
+           U...>                    // Remaining Tail
+  : CollapseJoin<
+        Model<>,                    // Final model type
+        TypeSequence<S...>,         // Type sequence holding the pack expansion
+        T...,                       // Extracted pack from inner Join operator
+        U...>                       // Remaining Tail
+{ };
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * CollapseJoin specialization which translates a MultipleOf<P,#> operator,
+ * at the head of the pack, into Model<MultipleOf<P, #>>, i.e
+ *
+ * Join<T1..., MultipleOf<P, 10>, T2...> =
+ * Join<T1..., Model<MultipleOf<P, 10>>, T2...>.
+ */
+template <
+    typename...S,
+    typename...T,
+    typename U,
+    int Count,
+    template <typename...> class Model
+>
+struct CollapseJoin<
+           Model<>,                 // Final model type
+           TypeSequence<S...>,      // Type sequence holding the pack expansion
+           MultipleOf<U, Count>,    // Current pack head element
+           T...>                    // Remaining Join pack, the tail
+  : CollapseJoin<
+        Model<>,                    // Final model type
+        TypeSequence<S...>,         // Type sequence holding the pack expansion
+        Model<MultipleOf<U, Count>>,// Redefine head in terms of Model<>
+        T...>                       // Remaining Tail
+{ };
+
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * Terminal case of Join operator collapsing. The final result of Join<T...>
+ * is Model<U...> where U are all the expanded non operator types.
+ */
+template <
+    typename...S,
+    template <typename...> class Model
+>
+struct CollapseJoin<
+           Model<>,
+           TypeSequence<S...>>
+{
+    /**
+     * \brief Final type outcome of the Join Operator
+     */
+    typedef Model<S...> Type;
+
+
+  static_assert(sizeof...(S) > 1, "Join<A, B, ...> operator must take 2 or more"
+                                  " operands");
+};
+
+/**
+ * \internal
+ * \ingroup meta
+ *
+ * Terminal case of Join operator collapsing for a Join of the form
+ * Join<MultipleOf<P, #>> resulting in Model<MultipleOf<P, #>>
+ */
+template <
+    typename M,
+    int Count,
+    template <typename...> class Model
+>
+struct CollapseJoin<Model<>, TypeSequence<Model<MultipleOf<M, Count>>>>
+{
+    typedef Model<MultipleOf<M, Count>> Type;
+
+    static_assert(Count > 0 || Count == -1,
+                  "Cannot expand Join<MultipleOf<M, Count>> operator on M. "
+                  "Count must be positive or set to -1 for the dynamic size "
+                  "case.");
+};
+
+
 }

 #endif


database: add non-const getter for compaction_manager

Signed-off-by: Paweł Dziepak <e29bb3265626c60caf76d587cabdfcd8b379ef80@scylladb.com>

--- database.hh
+++ database.hh
@@ -566,6 +566,9 @@
         return _commitlog.get();
     }

+    compaction_manager& get_compaction_manager() {
+        return _compaction_manager;
+    }
     const compaction_manager& get_compaction_manager() const {
         return _compaction_manager;
     }


optimization

optimization

--- include/gemmi/select.hpp
+++ include/gemmi/select.hpp
@@ -36,7 +36,6 @@
       return inverted ? "!" + list : list;
     }

-    // assumes that list.all is checked before this function is called
     bool has(const std::string& name) const {
       if (all)
         return true;
@@ -129,8 +128,8 @@
   }
   bool matches(const gemmi::Atom& a) const {
     return atom_names.has(a.name) &&
-           elements.has(a.element.uname()) &&
-           altlocs.has(std::string(a.altloc ? 0 : 1, a.altloc)) &&
+           (elements.all || elements.has(a.element.uname())) &&
+           (altlocs.all || altlocs.has(std::string(a.altloc ? 1 : 0, a.altloc))) &&
            atom_flags.has(a.flag);
   }
   bool matches(const gemmi::CRA& cra) const {


data method for matrix added

data method for matrix added

--- include/htool/matrix.hpp
+++ include/htool/matrix.hpp
@@ -186,11 +186,17 @@

   //! ### Access operator
 	/*!
-	 If _A_ is the instance calling the operator
-	 _A.get_stridedslice(i,j,k)_ returns the slice of _A_ containing every element from _start_ to _start_+_lenght with a step of _stride_. Modification forbidden
 	 */

    const std::vector<T>& get_mat(){return this->mat;}
+
+
+   //! ### Access operator
+  /*!
+   */
+
+    T *  data() const{return this->mat.data();}
+    const T *  data() const{return this->mat.data();}

   //! ### Access operator
 	/*!


[FIX] LlvmIkos preserves all passes. Not just CFG.

This creates a problem if other passes that depend on LlvmIkos claim
that they preserve too much.

--- include/ikos/LlvmIkos.hh
+++ include/ikos/LlvmIkos.hh
@@ -41,9 +41,7 @@
     ~LlvmIkos (){ m_inv_map.clear(); }

     virtual void getAnalysisUsage (llvm::AnalysisUsage &AU) const
-    {
-      AU.setPreservesCFG();
-    }
+    {AU.setPreservesAll ();}

     virtual bool runOnModule (llvm::Module& M);


BlendState enum update

BlendState enum update

--- include/jikken/enums.hpp
+++ include/jikken/enums.hpp
@@ -38,8 +38,16 @@

 	enum class BlendState : uint8_t
 	{
-		eSrcAlpha = 0,
-		eOneMinusSrcAlpha
+		eZero = 0,
+		eOne,
+		eSrcColor,
+		eOneMinusSrcColor,
+		eSrcAlpha,
+		eOneMinusSrcAlpha,
+		eDstAlpha,
+		eOneMinusDstAlpha,
+		eDstColor,
+		eOneMinusDstColor
 	};

 	enum class DepthFunc : uint8_t


+ fixed template parameter shadowing (clang++)

git-svn-id: 5adfda8227e14e59fd47d5bd9925a30df16fed74@1894 d397654b-2ff0-0310-9e29-ba003691a0f9

--- include/mapnik/utils.hpp
+++ include/mapnik/utils.hpp
@@ -96,7 +96,7 @@
 };

 template <typename T,
-          template <typename T> class CreatePolicy=CreateStatic> class singleton
+          template <typename U> class CreatePolicy=CreateStatic> class singleton
 {
 #ifdef __SUNPRO_CC
     /* Sun's C++ compiler will issue the following errors if CreatePolicy<T> is used:
@@ -159,13 +159,13 @@
 };
 #ifdef MAPNIK_THREADSAFE
 template <typename T,
-          template <typename T> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
+          template <typename U> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
 #endif

 template <typename T,
-          template <typename T> class CreatePolicy> T* singleton<T,CreatePolicy>::pInstance_=0;
+          template <typename U> class CreatePolicy> T* singleton<T,CreatePolicy>::pInstance_=0;
 template <typename T,
-          template <typename T> class CreatePolicy> bool singleton<T,CreatePolicy>::destroyed_=false;
+          template <typename U> class CreatePolicy> bool singleton<T,CreatePolicy>::destroyed_=false;

 }


--- db/hrtl.cpp
+++ db/hrtl.cpp
@@ -20,6 +20,7 @@
  * 17 May 02 - Mike: Split off from rtl.cc (was getting too large)
  * 26 Nov 02 - Mike: Generate code for HlReturn with semantics (eg SPARC RETURN)
  * 26 Nov 02 - Mike: In getReturnLoc test for null procDest
+ * 03 Dec 02 - Mike: Made a small mod to HLCall::killLive for indirect calls
  */

 #include <assert.h>
@@ -1289,7 +1290,11 @@
 {
     // conservative solution: if calling a userproc, kill everything.
     //                        if calling a libproc, kill return address.
-    assert(procDest);
+//assert(procDest);			// Mod MVE: Fails for all non direct calls
+	if (procDest == NULL) {
+		live.clear();
+		return;
+	}
     if (procDest->isLib()) {
         std::set<Statement*> kills;
         for (std::set<Statement*>::iterator it = live.begin(); it != live.end(); it++) {


Fix KD index typo.

Fix KD index typo.

--- include/pdal/KDIndex.hpp
+++ include/pdal/KDIndex.hpp
@@ -64,7 +64,7 @@
         case 1:
             id = Dimension::Id::Y;
             break;
-        case 3:
+        case 2:
             id = Dimension::Id::Z;
             break;
         }


Added configuration for cache alignment and cacheline length.

--- include/proxc/config.hpp
+++ include/proxc/config.hpp
@@ -145,11 +145,13 @@

 #endif

-#else
+#endif // PROXC_ARCH

 static_assert(((PROXC_ARCH) == 32) || ((PROXC_ARCH) == 64), "Architecture specified by PROXC_ARCH only supports 32 or 64 value.");

-#endif // PROXC_ARCH
+// cache alignment and cachelines
+static constexpr std::size_t cache_alignment{ PROXC_ARCH };
+static constexpr std::size_t cacheline_length{ PROXC_ARCH };

 ////////////////////////////////////////////////////////////////////////////////
 // Namespace macros


Update pidfile.hpp

Update pidfile.hpp

--- include/utxx/pidfile.hpp
+++ include/utxx/pidfile.hpp
@@ -30,8 +30,7 @@

 ***** END LICENSE BLOCK *****
 */
-#ifndef _UTXX_PIDFILE_HPP_
-#define _UTXX_PIDFILE_HPP_
+#pragma once

 #include <unistd.h>
 #include <sys/types.h>
@@ -74,6 +73,3 @@
 };

 } // namespace utxx
-
-#endif // _UTXX_PIDFILE_HPP_
-


* added variants of columnVector() and rowVector() * added missing 'inline'

--- include/vigra/matrix.hxx
+++ include/vigra/matrix.hxx
@@ -658,6 +658,22 @@
     return m.subarray(Shape(d, 0), Shape(d+1, columnCount(m)));
 }

+
+    /** Create a row vector view of the matrix \a m starting at element \a first and ranging
+        to column \a end (non-inclusive).
+
+    \#include "vigra/matrix.hxx" or

+    \#include "vigra/linear_algebra.hxx"

+        Namespaces: vigra and vigra::linalg
+     */
+template <class T, class C>
+MultiArrayView <2, T, C>
+rowVector(MultiArrayView <2, T, C> const & m, MultiArrayShape<2>::type first, int end)
+{
+    typedef typename MultiArrayView <2, T, C>::difference_type Shape;
+    return m.subarray(first, Shape(first[0]+1, end));
+}
+
     /** Create a column vector view for column \a d of the matrix \a m

     \#include "vigra/matrix.hxx" or

@@ -670,6 +686,21 @@
 {
     typedef typename MultiArrayView <2, T, C>::difference_type Shape;
     return m.subarray(Shape(0, d), Shape(rowCount(m), d+1));
+}
+
+    /** Create a column vector view of the matrix \a m starting at element \a first and
+        ranging to row \a end (non-inclusive).
+
+    \#include "vigra/matrix.hxx" or

+    \#include "vigra/linear_algebra.hxx"

+        Namespaces: vigra and vigra::linalg
+     **/
+template <class T, class C>
+MultiArrayView <2, T, C>
+columnVector(MultiArrayView<2, T, C> const & m, MultiArrayShape<2>::type first, int end)
+{
+    typedef typename MultiArrayView <2, T, C>::difference_type Shape;
+    return m.subarray(first, Shape(end, first[1]+1));
 }

     /** Check whether matrix \a m is symmetric.
@@ -2340,7 +2371,7 @@

 enum DataPreparationGoals { ZeroMean = 1, UnitVariance = 2, UnitNorm = 4 };

-DataPreparationGoals operator|(DataPreparationGoals l, DataPreparationGoals r)
+inline DataPreparationGoals operator|(DataPreparationGoals l, DataPreparationGoals r)
 {
     return DataPreparationGoals(int(l) | int(r));
 }


Added more building “useless” types.

Added more building “useless” types.

--- indexer/feature_data.cpp
+++ indexer/feature_data.cpp
@@ -77,6 +77,7 @@
     // 1-arity
     char const * arr1[][1] = {
       { "building" },
+      { "building:part" },
       { "hwtag" },
       { "internet_access" },
     };
@@ -86,7 +87,8 @@

     // 2-arity
     char const * arr2[][2] = {
-      { "amenity", "atm" }
+      { "amenity", "atm" },
+      { "building", "address" },
     };

     AddTypes(arr2);


FIRE-521, open up floaters in the center by default. Conflicts less with top bars, insures better eye focus.

--- indra/llui/llfloater.cpp
+++ indra/llui/llfloater.cpp
@@ -165,7 +165,7 @@
 	save_rect("save_rect", false),
 	save_visibility("save_visibility", false),
 	can_dock("can_dock", false),
-	open_centered("open_centered", false),
+	open_centered("open_centered", true),
 	header_height("header_height", 0),
 	legacy_header_height("legacy_header_height", 0),
 	close_image("close_image"),


Debug time

Debug time

--- decrypt.cpp
+++ decrypt.cpp
@@ -230,7 +230,7 @@
                             tag11.write();
                             data = "Data written to file '" + Tag11(data).get_filename() + "'";
                         }
-
+                        std::cout << data << std::endl;
                     }
                     // else{
                         // data += p -> show() + "\n";


Fix a few casts.

Fix a few casts.

--- insts/jg/JCHOR/JCHOR.cpp
+++ insts/jg/JCHOR/JCHOR.cpp
@@ -413,13 +413,13 @@
             newsig = (double)in[index + inchan];
          incount++;
          k++;
-         if (counter - (float)incount < 0.5)
+         if (counter - (double)incount < 0.5)
             getflag = 0;
       }
       frac = counter - (double)incount + 2.0;
       grain[i] = (float)interp(oldersig, oldsig, newsig, frac) * grainamp;
       counter += increment;
-      if (counter - (float)incount >= -0.5)
+      if (counter - (double)incount >= -0.5)
          getflag = 1;
    }


ENH: Added optimizer's step length and number of iterations to the command line      arguments of the test.

--- Examples/Registration/DeformableRegistration14.cxx
+++ Examples/Registration/DeformableRegistration14.cxx
@@ -114,6 +114,7 @@
     std::cerr << " [deformationField] ";
     std::cerr << " [useExplicitPDFderivatives ] [useCachingBSplineWeights ] ";
     std::cerr << " [filenameForFinalTransformParameters] ";
+    std::cerr << " [maximumStepLength] [maximumNumberOfIterations]";
     std::cerr << std::endl;
     return EXIT_FAILURE;
     }
@@ -179,6 +180,7 @@

   if( argc > 11 )
     {
+    #if BACKWARD_COMPATIBILITY_OF_TRANSFORM_IO_IS_SOLVED
     std::cout << "Loading Transform: " << argv[11] << std::endl;
     transformReader->SetFileName( argv[11] );
     transformReader->Update();
@@ -203,6 +205,7 @@
       std::cerr << "Bulk transform wasn't an affine transform." << std::endl;
       return EXIT_FAILURE;
       }
+    #endif
     }

@@ -292,14 +295,26 @@

   // Software Guide : BeginCodeSnippet
-  const double stepMagnitudeRedistributionFactor =  1.0;
-
-  optimizer->SetMaximumStepLength( 10.0 * stepMagnitudeRedistributionFactor  );
+  optimizer->SetMaximumStepLength( 10.0 );
   optimizer->SetMinimumStepLength(  0.01 );

   optimizer->SetRelaxationFactor( 0.7 );
-  optimizer->SetNumberOfIterations( 200 );
+  optimizer->SetNumberOfIterations( 50 );
   // Software Guide : EndCodeSnippet
+
+
+  // Optionally, get the step length from the command line arguments
+  if( argc > 12 )
+    {
+    optimizer->SetMaximumStepLength( atof( argv[12] ) );
+    }
+
+  // Optionally, get the number of iterations from the command line arguments
+  if( argc > 13 )
+    {
+    optimizer->SetNumberOfIterations( atoi( argv[13] ) );
+    }
+

   // Create the Command observer and register it with the optimizer.
   //


silence warning in trace code

silence warning in trace code

--- Library/Sources/Stroika/Foundation/Debug/Trace.cpp
+++ Library/Sources/Stroika/Foundation/Debug/Trace.cpp
@@ -341,7 +341,7 @@
 				fLastNCharBuf_Token_++;	// even if not buffering, increment, so other buffers known to be invalid
 			}
 			else {
-				Assert ((e-p) > bufferLastNChars);
+				Assert ((e-p) > static_cast<ptrdiff_t> (bufferLastNChars));
 				BufferNChars_ (bufferLastNChars, e - bufferLastNChars);
 				DoEmit_ (p, e - bufferLastNChars);
 				fLastNCharBuf_WriteTickcount_ = curRelativeTime + sStartOfTime;


BUG: ctkVTKSliceView - setupCornerAnnotation is now called

--- Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp
+++ Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp
@@ -528,6 +528,7 @@
   d->RenderWindowColumnCount = columnCount;

   d->setupRendering();
+  d->setupCornerAnnotation();

   if (d->ImageData)
     {


chromeos: Make Enter key works on the Captcha dialog.

BUG=chromium-os:6928
TEST=see bug

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

git-svn-id: http://src.chromium.org/svn/trunk/src@61901 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 5662bdcd9b19fd2256767e71406c009b839edde5

--- chrome/browser/chromeos/login/captcha_view.cc
+++ chrome/browser/chromeos/login/captcha_view.cc
@@ -59,6 +59,10 @@

 bool CaptchaView::HandleKeystroke(views::Textfield* sender,
     const views::Textfield::Keystroke& keystroke) {
+  if (sender == captcha_textfield_ &&
+      keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+    GetDialogClientView()->AcceptWindow();
+  }
   return false;
 }


Correct call to create dictionary in Local State if it doesn't exist.

BUG=chromiumos:7612
TEST=Login after clean install and press Skip button on image screen. Chrome should not crash.

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@62538 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- chrome/browser/chromeos/login/user_manager.cc
+++ chrome/browser/chromeos/login/user_manager.cc
@@ -299,7 +299,7 @@
   const ListValue* prefs_users = local_state->GetList(kLoggedInUsers);
   DCHECK(prefs_users);
   const DictionaryValue* prefs_images =
-      local_state->GetDictionary(kUserImages);
+      local_state->GetMutableDictionary(kUserImages);
   DCHECK(prefs_images);

   // We want to distribute default images between users uniformly so that if


Fixing: Media file doesn't play after closing the media player using ctrl + w

BUG=chromium-os:19257
TEST=None

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

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

--- chrome/browser/chromeos/media/media_player.cc
+++ chrome/browser/chromeos/media/media_player.cc
@@ -167,9 +167,9 @@
 void MediaPlayer::Observe(int type,
                           const NotificationSource& source,
                           const NotificationDetails& details) {
-  DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING);
+  DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED);
   registrar_.Remove(this,
-                    chrome::NOTIFICATION_BROWSER_CLOSING,
+                    chrome::NOTIFICATION_BROWSER_CLOSED,
                     source);
   if (Source<Browser>(source).ptr() == mediaplayer_browser_) {
     mediaplayer_browser_ = NULL;
@@ -205,7 +205,7 @@
                                             gfx::Rect(),
                                             profile);
   registrar_.Add(this,
-                 chrome::NOTIFICATION_BROWSER_CLOSING,
+                 chrome::NOTIFICATION_BROWSER_CLOSED,
                  Source<Browser>(playlist_browser_));
   playlist_browser_->AddSelectedTabWithURL(GetMediaplayerPlaylistUrl(),
                                            PageTransition::LINK);
@@ -230,7 +230,7 @@
                                                gfx::Rect(),
                                                profile);
   registrar_.Add(this,
-                 chrome::NOTIFICATION_BROWSER_CLOSING,
+                 chrome::NOTIFICATION_BROWSER_CLOSED,
                  Source<Browser>(mediaplayer_browser_));

 #if defined(OS_CHROMEOS)


Remove the test DLLs from the blacklist.
Demo is done.

TBR=huanr
BUG=51105
TEST=None

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@67446 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- chrome/browser/enumerate_modules_model_win.cc
+++ chrome/browser/enumerate_modules_model_win.cc
@@ -84,14 +84,6 @@
 // Entries without any Description, Signer info, or Location will never be
 // marked as confirmed bad (only as suspicious).
 const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
-  // Test DLLs, to demonstrate the feature. Will be removed soon.
-  {     // apphelp.dll, "%systemroot%\\system32\\"
-    "f5fda581", "23d01d5b", "", "", "", NONE
-  }, {  // rsaenh.dll, "%systemroot%\\system32\\", "Microsoft Windows"
-    "6af212cb", "23d01d5b", "7b47bf79", "", "",
-        static_cast<RecommendedAction>(UPDATE | DISABLE | SEE_LINK)
-  },
-
   // NOTE: Please keep this list sorted by dll name, then location.

   // foldersizecolumn.dll.


Ensure speech synthesis and ChromeVox run outside of normal user sessions.

Due to crbug.com/445048, extensions without incognito: split within their manifest no longer run outside of a logged in user session. This caused some component extensions to stop working in specific contexts (e.g. ChromeVox in OOBE).

BUG=450705
TEST=manual.

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

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#312537}

--- chrome/browser/extensions/component_loader.cc
+++ chrome/browser/extensions/component_loader.cc
@@ -32,6 +32,7 @@
 #include "ui/base/resource/resource_bundle.h"

 #if defined(OS_CHROMEOS)
+#include "components/user_manager/user_manager.h"
 #include "grit/keyboard_resources.h"
 #include "ui/file_manager/grit/file_manager_resources.h"
 #include "ui/keyboard/keyboard_util.h"
@@ -86,6 +87,12 @@
   CHECK(localized) << error;
   return manifest.Pass();
 }
+
+bool IsNormalSession() {
+  return !base::CommandLine::ForCurrentProcess()->HasSwitch(
+             chromeos::switches::kGuestSession) &&
+         user_manager::UserManager::Get()->IsUserLoggedIn();
+}
 #endif  // defined(OS_CHROMEOS)

 }  // namespace
@@ -356,12 +363,9 @@
   base::FilePath chromevox_path =
       resources_path.Append(extension_misc::kChromeVoxExtensionPath);

-  const base::CommandLine* command_line =
-      base::CommandLine::ForCurrentProcess();
-  bool is_guest = command_line->HasSwitch(chromeos::switches::kGuestSession);
   const char* manifest_filename =
-      is_guest ? extension_misc::kChromeVoxGuestManifestFilename
-               : extension_misc::kChromeVoxManifestFilename;
+      IsNormalSession() ? extension_misc::kChromeVoxManifestFilename
+                        : extension_misc::kChromeVoxGuestManifestFilename;

   BrowserThread::PostTaskAndReplyWithResult(
       BrowserThread::FILE,
@@ -385,10 +389,8 @@
 }

 std::string ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
-  const base::CommandLine* command_line =
-      base::CommandLine::ForCurrentProcess();
-  int idr = command_line->HasSwitch(chromeos::switches::kGuestSession) ?
-      IDR_SPEECH_SYNTHESIS_GUEST_MANIFEST : IDR_SPEECH_SYNTHESIS_MANIFEST;
+  int idr = IsNormalSession() ? IDR_SPEECH_SYNTHESIS_MANIFEST
+                              : IDR_SPEECH_SYNTHESIS_GUEST_MANIFEST;
   std::string id = Add(idr,
       base::FilePath(extension_misc::kSpeechSynthesisExtensionPath));
   EnableFileSystemInGuestMode(id);
@@ -645,9 +647,7 @@

 void ComponentLoader::EnableFileSystemInGuestMode(const std::string& id) {
 #if defined(OS_CHROMEOS)
-  const base::CommandLine* command_line =
-      base::CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
+  if (!IsNormalSession()) {
     // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
     // the extension. Some component extensions don't work without temporary
     // file system access. Make sure temporary file system is enabled in the off


Hide the URL for all chrome_url_overrides.

BUG=37356
TEST=None

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

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

--- chrome/browser/extensions/extension_dom_ui.cc
+++ chrome/browser/extensions/extension_dom_ui.cc
@@ -30,13 +30,9 @@

   // For chrome:// overrides, some of the defaults are a little different.
   GURL url = tab_contents->GetURL();
-  if (url.SchemeIs(chrome::kChromeUIScheme)) {
-    if (url.host() == chrome::kChromeUINewTabHost) {
-      focus_location_bar_by_default_ = true;
-    } else {
-      // Current behavior of other chrome:// pages is to display the URL.
-      should_hide_url_ = false;
-    }
+  if (url.SchemeIs(chrome::kChromeUIScheme) &&
+      url.host() == chrome::kChromeUINewTabHost) {
+    focus_location_bar_by_default_ = true;
   }
 }


fix for build break
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6334063

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@73504 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- chrome/browser/prerender/prerender_manager.cc
+++ chrome/browser/prerender/prerender_manager.cc
@@ -16,6 +16,9 @@
 #include "chrome/common/render_messages.h"

 // static
+base::TimeTicks PrerenderManager::last_prefetch_seen_time_;
+
+// static
 PrerenderManager::PrerenderManagerMode PrerenderManager::mode_ =
     PRERENDER_MODE_ENABLED;


Scope ManifestTest.RestrictedKeys to DEV channel for the commands API.

TBR=finnur@chromium.org

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

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

--- chrome/common/extensions/manifest_unittest.cc
+++ chrome/common/extensions/manifest_unittest.cc
@@ -191,15 +191,21 @@
       &manifest, keys::kPlatformAppBackground, NULL);

   // "commands" is restricted to manifest_version >= 2.
-  MutateManifest(
-      &manifest, keys::kCommands, new DictionaryValue());
-  EXPECT_FALSE(manifest->HasKey(keys::kCommands));
-  EXPECT_FALSE(manifest->Get(keys::kCommands, &output));
-
-  MutateManifest(
-      &manifest, keys::kManifestVersion, Value::CreateIntegerValue(2));
-  EXPECT_TRUE(manifest->HasKey(keys::kCommands));
-  EXPECT_TRUE(manifest->Get(keys::kCommands, &output));
+  {
+    // ... and dev channel, for now.
+    Feature::ScopedCurrentChannel dev_channel_scope(
+        chrome::VersionInfo::CHANNEL_DEV);
+
+    MutateManifest(
+        &manifest, keys::kCommands, new DictionaryValue());
+    EXPECT_FALSE(manifest->HasKey(keys::kCommands));
+    EXPECT_FALSE(manifest->Get(keys::kCommands, &output));
+
+    MutateManifest(
+        &manifest, keys::kManifestVersion, Value::CreateIntegerValue(2));
+    EXPECT_TRUE(manifest->HasKey(keys::kCommands));
+    EXPECT_TRUE(manifest->Get(keys::kCommands, &output));
+  }
 };

 }  // namespace extensions


Fix missing cast

Fix missing cast

--- Modules/CameraCalibration/mitkCameraIntrinsics.cpp
+++ Modules/CameraCalibration/mitkCameraIntrinsics.cpp
@@ -241,7 +241,7 @@
   elem->SetAttribute( "p1", s.str().c_str());
   s.str(""); s << DistorsionCoeffs.at<double>(0,3);
   elem->SetAttribute( "p2", s.str().c_str());
-  elem->SetAttribute("Valid", m_Valid);
+  elem->SetAttribute("Valid", static_cast<int>(m_Valid));
   //s.str(""); s << DistorsionCoeffs.at<double>(4,0);
   //elem->SetAttribute( "k3", s.str().c_str() );
 }


Verify that SendAndRunNestedMessageLoop is the source of the Intl2
page cycler regression.

TBR=jam
BUG=36310
TEST=none

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

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

--- chrome/renderer/renderer_webkitclient_impl.cc
+++ chrome/renderer/renderer_webkitclient_impl.cc
@@ -131,8 +131,12 @@
   // when there is no active script context.
   int32 routing_id = RenderThread::RoutingIDForCurrentContext();

+  // TODO(darin): We should use SendAndRunNestedMessageLoop here to avoid dead-
+  // locking the browser, but this causes a performance regression.  Switching
+  // back to Send to verify.  See http://crbug.com/36310.
+
   std::string value_utf8;
-  RenderThread::current()->SendAndRunNestedMessageLoop(
+  RenderThread::current()->Send(
       new ViewHostMsg_GetCookies(routing_id, url, first_party_for_cookies,
                                  &value_utf8));


Handle only special folders with PR_EXTENDED_FOLDER_FLAGS property for the moment.

--- messaging/winhelpers.cpp
+++ messaging/winhelpers.cpp
@@ -566,13 +566,13 @@
                 bool isNewsGroup = (row->lpProps[1].ulPropTag == PR_IS_NEWSGROUP && row->lpProps[1].Value.b);
                 bool isNewsGroupAnchor = (row->lpProps[2].ulPropTag == PR_IS_NEWSGROUP_ANCHOR && row->lpProps[2].Value.b);
                 bool special = false;
-#ifndef _WIN32_WCE // Skip slow folders, necessary evil
+// Skip slow folders, necessary evil
+// TODO handle special folders without the PR_EXTENDED_FOLDER_FLAGS property
+#ifndef _WIN32_WCE
                 if (row->lpProps[3].ulPropTag == PR_EXTENDED_FOLDER_FLAGS) {
                     QByteArray extendedFlags(reinterpret_cast<const char*>(row->lpProps[3].Value.bin.lpb), row->lpProps[3].Value.bin.cb);
                     if (extendedFlags[2] & 8) // Synchronization issues, skip like Outlook
                         special = true;
-                } else {
-                    special = true;
                 }
 #endif
                 FreeProws(rows);


tools: rina-gw: add getopt() loop

tools: rina-gw: add getopt() loop

--- user/tools/rina-gw.cpp
+++ user/tools/rina-gw.cpp
@@ -290,7 +290,7 @@
         return n;

     } else {
-        if (verbose) {
+        if (verbose >= 2) {
             printf("Read 0 bytes from %d\n", ifd);
         }
     }
@@ -304,7 +304,9 @@
     struct pollfd pollfds[1 + MAX_FDS];
     char buf[MAX_BUF_SIZE];

-    printf("w%d starts\n", idx);
+    if (verbose >= 1) {
+        printf("w%d starts\n", idx);
+    }

     for (;;) {
         int nrdy;
@@ -766,17 +768,48 @@
     }
 }

-int main()
+static void
+usage(void)
+{
+    cout << "rina-gw\n"
+            << "-h <show this help>\n"
+            << "-v <increase verbosity>\n"
+            << "-c PATH_TO_CONFIG_FILE (default = '/etc/rlite/rina-gw.conf')\n";
+}
+
+int main(int argc, char **argv)
 {
     const char *confname = "/etc/rlite/rina-gw.conf";
     struct pollfd pfd[128];
     int ret;
+    int opt;

     errno = 0;
     signal(SIGPIPE, SIG_IGN);
     if (errno) {
         perror("signal()");
         return -1;
+    }
+
+    while ((opt = getopt(argc, argv, "hvc:")) != -1) {
+        switch (opt) {
+            case 'h':
+                usage();
+                return 0;
+
+            case 'v':
+                verbose ++;
+                break;
+
+            case 'c':
+                confname = optarg;
+                break;
+
+            default:
+                printf("    Unrecognized option %c\n", opt);
+                usage();
+                return -1;
+        }
     }

     ret = parse_conf(confname);


Removed code that was commented out.

Removed code that was commented out.

--- src/XSLT/StylesheetExecutionContextDefault.cpp
+++ src/XSLT/StylesheetExecutionContextDefault.cpp
@@ -960,100 +960,7 @@
 			const XalanNode&			node,
 			const ElemTemplateElement*	styleNode)
 {
-#if 1
 	m_xsltProcessor->cloneToResultTree(node, m_cloneTextNodesOnly, styleNode);
-#else
-	XalanNode::NodeType		posNodeType = node.getNodeType();
-
-	if (this->m_cloneTextNodesOnly == true &&
-		posNodeType != XalanNode::TEXT_NODE)
-	{
-		const Locator*		theLocator = 0;
-		const char* const	theErrorMessage =
-					"Only text nodes can be copied in this context.  The node is ignored";
-
-		if (styleNode != 0)
-		{
-			theLocator = styleNode->getLocator();
-		}
-
-		if (theLocator != 0)
-		{
-			warn(
-				theErrorMessage,
-				&node,
-				theLocator);
-		}
-		else
-		{
-			warn(
-				XalanDOMString(theErrorMessage),
-				&node,
-				styleNode);
-		}
-	}
-	else
-	{
-		const XalanNode*	pos = &node;
-
-		while(pos != 0)
-		{
-			if(posNodeType != XalanNode::ATTRIBUTE_NODE)
-			{
-				flushPending();
-			}
-
-			cloneToResultTree(
-							*pos,
-							posNodeType,
-							false,
-							false,
-							true,
-							styleNode);
-
-			const XalanNode*	nextNode = pos->getFirstChild();
-
-			while(nextNode == 0)
-			{
-				if(XalanNode::ELEMENT_NODE == posNodeType)
-				{
-					endElement(c_wstr(pos->getNodeName()));
-				}
-
-				if(&node == pos)
-					break;
-
-				nextNode = pos->getNextSibling();
-
-				if(nextNode == 0)
-				{
-					pos = pos->getParentNode();
-					assert(pos != 0);
-
-					posNodeType = pos->getNodeType();
-
-					if(&node == pos)
-					{
-						if(XalanNode::ELEMENT_NODE == posNodeType)
-						{
-							endElement(c_wstr(pos->getNodeName()));
-						}
-
-						nextNode = 0;
-						break;
-					}
-				}
-			}
-
-			pos = nextNode;
-
-			if (pos != 0)
-			{
-				posNodeType = pos->getNodeType();
-			}
-		}
-	}
-#endif
 }


BUG 13198: Newer Tcl/Tk packages need static_cast with ckalloc.

The ckalloc() function that Tcl uses for memory allocation has
been changed in Tcl 8.6 to return "void *" instead of "char *".

Change-Id: I7a09bd1e247748c4f4b4b017ca26f1cc8130463d

--- Rendering/vtkTkRenderWidget.cxx
+++ Rendering/vtkTkRenderWidget.cxx
@@ -941,8 +941,9 @@
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
                                "vtkRenderWindow");
 #endif
-    self->RW = ckalloc(
-      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1));
+    // in Tcl 8.6.x, ckalloc was changed to return "void *".
+    self->RW = static_cast<char *>(ckalloc(
+      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1)));
     strcpy(self->RW, Tcl_GetStringResult(self->Interp));
     Tcl_ResetResult(self->Interp);
     }
@@ -1113,8 +1114,9 @@
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
           "vtkRenderWindow");
 #endif
-    self->RW = ckalloc(
-      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1));
+    // in Tcl 8.6.x, ckalloc was changed to return "void *".
+    self->RW = static_cast<char *>(ckalloc(
+      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1)));
     strcpy(self->RW, Tcl_GetStringResult(self->Interp));
     Tcl_ResetResult(self->Interp);
     }
@@ -1306,8 +1308,9 @@
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
           "vtkRenderWindow");
 #endif
-    self->RW = ckalloc(
-      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1));
+    // in Tcl 8.6.x, ckalloc was changed to return "void *".
+    self->RW = static_cast<char *>(ckalloc(
+      static_cast<unsigned int>(strlen(Tcl_GetStringResult(self->Interp)) + 1)));
     strcpy(self->RW, Tcl_GetStringResult(self->Interp));
     Tcl_ResetResult(self->Interp);
     }


Removed ^M characters from the file. No other changes from previous version.

git-svn-id: 1001b6e0dd469eaa302a741812f7f5d223cf35f7@635 ff5d1e40-2be0-497f-93bd-dc18237bd3c7

--- applications/NXtranslate/text_xml/xml_retriever.cpp
+++ applications/NXtranslate/text_xml/xml_retriever.cpp
@@ -114,7 +114,7 @@
         if(cur_node->type == XML_ELEMENT_NODE){
           cout << "node type: Element, name: " << cur_node->name << endl;
         }
-
+
         //print_element_names(cur_node->children);
     }
 }
@@ -123,7 +123,7 @@
   // error check input
   if(begin==end)
     return NULL;
-
+
   // locate the next part of the path
   node=find_element(node,*begin);


benchmark double_v, too; use forceToRegisters instead of black hole

--- benchmarks/math.cpp
+++ benchmarks/math.cpp
@@ -31,16 +31,10 @@
     typedef typename Vector::Mask Mask;
     typedef typename Vector::EntryType Scalar;

-    static Vector *blackHole;
-
-    static void setBlackHole();
-
     static void run(const int Repetitions)
     {
         const int Factor = CpuId::L1Data() / sizeof(Vector);
         const int opPerSecondFactor = Factor * Vector::Size;
-
-        setBlackHole();

         Vector *data = new Vector[Factor];
         for (int i = 0; i < Factor; ++i) {
@@ -52,7 +46,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = round(data[i]);
+                    Vector tmp = round(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -63,7 +58,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = sqrt(data[i]);
+                    Vector tmp = sqrt(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -74,7 +70,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = log(data[i]);
+                    Vector tmp = log(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -85,7 +82,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = sin(data[i]);
+                    Vector tmp = sin(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -96,7 +94,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = cos(data[i]);
+                    Vector tmp = cos(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -107,7 +106,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = asin(data[i]);
+                    Vector tmp = asin(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -118,7 +118,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = atan(data[i]);
+                    Vector tmp = atan(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -129,7 +130,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor - 1; ++i) {
-                    *blackHole = atan2(data[i], data[i + 1]);
+                    Vector tmp = atan2(data[i], data[i + 1]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -140,7 +142,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = rsqrt(data[i]);
+                    Vector tmp = rsqrt(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -151,7 +154,8 @@
             for (int rep = 0; rep < Repetitions; ++rep) {
                 timer.Start();
                 for (int i = 0; i < Factor; ++i) {
-                    *blackHole = reciprocal(data[i]);
+                    Vector tmp = reciprocal(data[i]);
+                    Vc::forceToRegisters(tmp);
                 }
                 timer.Stop();
             }
@@ -162,25 +166,15 @@
     }
 };

-template<typename Vec> Vec *Helper<Vec>::blackHole = 0;
-
-// global (not file-static!) variable keeps the compiler from identifying the benchmark as dead code
-float_v blackHoleFloat;
-template<> inline void Helper<float_v>::setBlackHole() { blackHole = &blackHoleFloat; }
-#if VC_IMPL_SSE
-sfloat_v blackHoleSFloat;
-template<> inline void Helper<sfloat_v>::setBlackHole() { blackHole = &blackHoleSFloat; }
-#endif
-
 int bmain(Benchmark::OutputMode out)
 {
     const int Repetitions = out == Benchmark::Stdout ? 4 : (g_Repetitions > 0 ? g_Repetitions : 100);
     Benchmark::addColumn("datatype");
     Benchmark::setColumnData("datatype", "float_v");
     Helper<float_v>::run(Repetitions);
-#if VC_IMPL_SSE
     Benchmark::setColumnData("datatype", "sfloat_v");
     Helper<sfloat_v>::run(Repetitions);
-#endif
+    Benchmark::setColumnData("datatype", "double_v");
+    Helper<double_v>::run(Repetitions);
     return 0;
 }


initialized scalar value in constructor -- cov197454

--- applications/mne_scan/plugins/neuromag/neuromag.cpp
+++ applications/mne_scan/plugins/neuromag/neuromag.cpp
@@ -99,6 +99,7 @@
 , m_iRecordingMSeconds(5*60*1000)
 , m_iBlinkStatus(-1)
 , m_iSplitCount(0)
+, m_bUseRecordTimer(false)
 {
     m_pActionSetupProject = new QAction(QIcon(":/images/database.png"), tr("Setup Project"),this);
     m_pActionSetupProject->setStatusTip(tr("Setup Project"));


Create code.cpp

Create code.cpp


First shot a windows process compat.

First shot a windows process compat.

--- src/configure/Process.cpp
+++ src/configure/Process.cpp
@@ -2,6 +2,7 @@
 #include "log.hpp"
 #include "Filesystem.hpp"

+#include <boost/config.hpp>
 #include <boost/algorithm/string/join.hpp>
 #include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/device/file_descriptor.hpp>
@@ -9,11 +10,16 @@
 #include <cassert>
 #include <stdexcept>

-#include <sys/wait.h>
-#include <unistd.h>
-
-#if defined(__APPLE__) && defined(__DYNAMIC__)
-#include <crt_externs.h>
+#if defined(BOOST_POSIX_API)
+# include <sys/wait.h>
+# include <unistd.h>
+# if defined(__APPLE__) && defined(__DYNAMIC__)
+#  include <crt_externs.h> // For _NSGetEnviron()
+# endif
+#elif defined(BOOST_WINDOWS_API)
+# include <Windows.h>
+#else
+# error "Unsupported platform"
 #endif

 namespace io = boost::iostreams;
@@ -30,6 +36,12 @@
 			return environ;
 #endif
 		}
+
+#ifdef BOOST_WINDOWS_API
+		typedef HANDLE file_descriptor_t;
+#else
+		typedef int file_descriptor_t;
+#endif

 		struct Pipe
 		{
@@ -40,11 +52,17 @@
 		public:
 			Pipe()
 			{
-				int fds[2];
+				file_descriptor_t fds[2];
+#ifdef BOOST_WINDOWS_API
+				if (!::CreatePipe(&fds[0], &fds[1], NULL, 0))
+#else
 				if (::pipe(fds) == -1)
+#endif
 					throw std::runtime_error("pipe error");
-				_source = io::file_descriptor_source(fds[0], io::file_descriptor_flags::close_handle);
-				_sink = io::file_descriptor_sink(fds[1], io::file_descriptor_flags::close_handle);
+				_source = io::file_descriptor_source(
+				  fds[0], io::file_descriptor_flags::close_handle);
+				_sink = io::file_descriptor_sink(
+				  fds[1], io::file_descriptor_flags::close_handle);
 			}

 		public:
@@ -58,6 +76,49 @@
 				_source.close();
 			}
 		};
+
+#ifdef BOOST_WINDOWS_API
+		struct Child
+		{
+		private:
+			PROCESS_INFORMATION _proc_info;
+
+		public:
+			explicit Child(PROCESS_INFORMATION const& proc_info)
+			    : _proc_info(proc_info)
+			{}
+
+			Child(Child&& other)
+				: _proc_info(other._proc_info)
+			{
+				other._proc_info.hProcess = INVALID_HANDLE_VALUE;
+				other._proc_info.hThread = INVALID_HANDLE_VALUE;
+			}
+
+			~Child()
+			{
+				::CloseHandle(proc_info.hProcess);
+				::CloseHandle(proc_info.hThread);
+			}
+
+			HANDLE process_handle() const { return proc_info.hProcess; }
+		};
+#else
+		struct Child
+		{
+		private:
+			pid_t _pid;
+
+		public:
+			explicit Child(pid_t pid) : _pid(pid) {}
+			pid_t process_handle() const { return _pid; }
+		};
+#endif
+
+		std::ostream& operator <<(std::ostream& out, Child const& child)
+		{
+			return out << "<Process " << child.process_handle() << ">";
+		}

 	} // !anonymous

@@ -66,8 +127,10 @@
 		Command const command;
 		Options const options;
 		boost::optional<ExitCode> exit_code;
+		io::file_descriptor_sink stdin_sink;
 		io::file_descriptor_source stdout_source;
-		pid_t child;
+		io::file_descriptor_source stderr_source;
+		Child child;

 		Impl(Command cmd, Options options)
 			: command(_prepare_command(std::move(cmd)))
@@ -76,6 +139,7 @@
 			, child(_create_child())
 		{}

+#ifdef BOOST_POSIX_API
 		pid_t _create_child()
 		{
 			char** env = nullptr;
@@ -154,11 +218,102 @@
 			}
 			else // Parent
 			{
+				if (this->options.stdin_ == Stream::PIPE)
+					this->stdin_sink = stdin_pipe->sink();
 				if (this->options.stdout_ == Stream::PIPE)
 					this->stdout_source = stdout_pipe->source();
+				if (this->options.stderr_ == Stream::PIPE)
+					this->stderr_source = stderr_pipe->source();
 			}
 			return child;
 		}
+#elif defined(BOOST_WINDOWS_API)
+		PROCESS_INFORMATION _create_child()
+		{
+			LPCTSTR exe = cmd[0].c_str();
+			LPTSTR cmd_line;
+			LPSECURITY_ATTRIBUTES proc_attrs = 0
+			LPSECURITY_ATTRIBUTES thread_attrs = 0;
+			BOOL inherit_handles = false;
+			LPVOID env = nullptr;
+			LPCTSTR work_dir = nullptr;
+#if (_WIN32_WINNT >= 0x0600)
+			DWORD creation_flags = EXTENDED_STARTUPINFO_PRESENT;
+			STARTUPINFOEX startup_info_ex;
+			ZeroMemory(&startup_info_ex, sizeof(STARTUPINFOEX));
+			STARTUPINFO& startup_info = startup_info_ex.StartupInfo;
+			startup_info.cb = sizeof(STARTUPINFOEX);
+#else
+			DWORD creation_flags = 0;
+			STARTUPINFO startup_info;
+			ZeroMemory(&startup_info, sizeof(STARTUPINFO));
+			startup_info.cb = sizeof(STARTUPINFO);
+#endif
+
+			std::unique_ptr<Pipe> stdin_pipe;
+			if (this->options.stdin_ == Stream::PIPE)
+			{
+				stdin_pipe.reset(new Pipe);
+				::SetHandleInformation(stdin_pipe->source().handle(),
+				                       HANDLE_FLAG_INHERIT,
+				                       HANDLE_FLAG_INHERIT);
+				startup_info.hStdInput = stdin_pipe->source().handle();
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+				inherit_handles = true;
+				this->stdin_sink = stdin_pipe->sink();
+			}
+			else if (this->options.stdin_ == Stream::DEVNULL)
+			{
+				startup_info.hStdInput = INVALID_HANDLE_VALUE;
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+			}
+
+			std::unique_ptr<Pipe> stdout_pipe;
+			if (this->options.stdout_ == Stream::PIPE)
+			{
+				stdout_pipe.reset(new Pipe);
+				::SetHandleInformation(stdout_pipe->sink().handle(),
+				                       HANDLE_FLAG_INHERIT,
+				                       HANDLE_FLAG_INHERIT);
+				startup_info.hStdOutput = stdout_pipe->sink().handle();
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+				inherit_handles = true;
+				this->stdout_source = stdout_pipe->source();
+			}
+			else if (this->options.stdout_ == Stream::DEVNULL)
+			{
+				startup_info.hStdOutput = INVALID_HANDLE_VALUE;
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+			}
+
+			std::unique_ptr<Pipe> stderr_pipe;
+			if (this->options.stderr_ == Stream::PIPE)
+			{
+				stderr_pipe.reset(new Pipe);
+				::SetHandleInformation(stderr_pipe->sink().handle(),
+				                       HANDLE_FLAG_INHERIT,
+				                       HANDLE_FLAG_INHERIT);
+				startup_info.hStdError = stderr_pipe->sink().handle();
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+				inherit_handles = true;
+				this->stderr_source = stderr_pipe->source();
+			}
+			else if (this->options.stderr_ == Stream::DEVNULL)
+			{
+				startup_info.hStdError = INVALID_HANDLE_VALUE;
+				startup_info.dwFlags |= STARTF_USESTDHANDLES;
+			}
+
+			PROCESS_INFORMATION proc_info;
+			auto ret = ::CreateProcess(
+			  cmd[0].c_str(), quote<CommandParser::windows_shell>(cmd).c_str(),
+			  proc_attrs, thread_attrs, inherit_handles, creation_flags, env,
+			  work_dir, &startup_info, &proc_info);
+			if (!ret)
+				throw std::runtime_error("CreateProcess() error");
+			return Child(proc_info);
+		}
+#endif // !BOOST_WINDOWS_API

 		Command _prepare_command(Command cmd)
 		{
@@ -182,12 +337,38 @@
 	{
 		if (!_this->exit_code)
 		{
+#ifdef BOOST_WINDOWS_API
+			int ret = ::WaitForSingleObject(_this->child.process_handle(), 0);
+			switch (ret)
+			{
+			case WAIT_FAILED:
+				throw std::runtime_error("WaitForSingleObject() failed");
+			case WAIT_ABANDONED:
+				log::warning(
+				  "Wait on child", _this->child, "has been abandoned");
+				break;
+			case WAIT_TIMEOUT:
+				log::debug("The child", _this->child, "is still alive");
+				break;
+			case WAIT_OBJECT_0:
+			{
+				DWORD exit_code;
+				if (!::GetExitCodeProcess(
+				      _this->child.process_handle(), &exit_code))
+					throw std::runtime_error("GetExitCodeProcess() failed");
+				log::debug("The child", _this->child,
+				           "exited with status code", exit_code);
+				_this->exit_code = exit_code;
+			}
+			}
+#else
 			pid_t ret;
 			int status;
 			do
 			{
 				log::debug("Checking exit status of child", _this->child);
-				ret = ::waitpid(_this->child, &status, WNOHANG);
+				ret =
+				  ::waitpid(_this->child.process_handle(), &status, WNOHANG);
 			} while (ret == -1 && errno == EINTR);
 			if (ret == -1)
 				throw std::runtime_error("Waitpid failed");
@@ -199,6 +380,7 @@
 			}
 			else
 				log::debug("The child", _this->child, "is still alive");
+#endif
 		}
 		return _this->exit_code;
 	}


Use Q_EMIT in tracker results

Use Q_EMIT in tracker results

--- src/sparql/drivers/tracker/qsparql_tracker.cpp
+++ src/sparql/drivers/tracker/qsparql_tracker.cpp
@@ -220,7 +220,7 @@
         }

         q->setLastError(error);
-        emit q->finished();
+        Q_EMIT q->finished();
         qWarning() << "QTrackerResult:" << q->lastError() << q->query();
         return;
     }
@@ -238,7 +238,7 @@
             q->setBoolValue(boolValue.toBool());
         }

-        emit q->dataReady(data.size());
+        Q_EMIT q->dataReady(data.size());
         break;
     }
     default:


Whops C5G_dummy

Whops C5G_dummy

--- src/C5G/C5G_dummy.cpp
+++ src/C5G/C5G_dummy.cpp
@@ -13,8 +13,8 @@
     std::cout << "Global movement to (" << p.x << ", " << p.y << ", " << p.z << ")\nOrientation: (" << p.alpha << ", " << p.beta << ", " << p.gamma << "\n";
   }

-  void C5G::init(){
-    std::cout << "Initing the system..\n";
+  void C5G::init(const std::string& ip, const std::string& sysID){
+    std::cout << "Initing the system..\nConnecting to IP address: " << ip << "\nSystem ID: " << sysID << "\n";
     boost::this_thread::sleep_for(boost::chrono::seconds(3));
     std::cout << "Done.\n";
   }
@@ -40,4 +40,8 @@
     setGripping(g.force);
     moveCartesian(g.approach);
   }
+  C5G::~C5G(){
+    standby();
+  }
 }
+


Initialise d_resourceProvider.

Initialise d_resourceProvider.

--- src/CEGUIRenderer.cpp
+++ src/CEGUIRenderer.cpp
@@ -51,6 +51,7 @@
 	Constructor
 *************************************************************************/
 Renderer::Renderer(void)
+    : d_resourceProvider(0)
 {
 	// setup standard events available
 	addEvent(EventDisplaySizeChanged);


fixed bug #29.

fixed bug #29.

--- AlembicLicensing.cpp
+++ AlembicLicensing.cpp
@@ -31,13 +31,13 @@

 	if( isWriterLicense ) {
 		if( isForceReader ) {
-			ESS_LOG_ERROR( "Environment variable EXOCORTEX_ALEMBIC_FORCE_READER defined, forcing usage of read-only license." );
+			ESS_LOG_WARNING( "Environment variable EXOCORTEX_ALEMBIC_FORCE_READER defined, forcing usage of read-only license." );
 			isWriterLicense = false;
 		}
 	}
 	if( ! isWriterLicense ) {
 		if( isForceWriter ) {
-			ESS_LOG_ERROR( "Environment variable EXOCORTEX_ALEMBIC_FORCE_WRITER defined, forcing usage of write-capable license." );
+			ESS_LOG_WARNING( "Environment variable EXOCORTEX_ALEMBIC_FORCE_WRITER defined, forcing usage of write-capable license." );
 			isWriterLicense = true;
 		}
 	}


Add check if name is empty

Add check if name is empty

--- src/CaptureDevice.cpp
+++ src/CaptureDevice.cpp
@@ -90,6 +90,11 @@

 Property* CaptureDevice::get_property_by_name (const std::string& name)
 {
+    if (name.empty())
+    {
+        return nullptr;
+    }
+
     auto properties = get_available_properties();

     for (auto& p :  properties)