Complete test, failing.

Complete test, failing.

--- physics/ephemeris_test.cpp
+++ physics/ephemeris_test.cpp
@@ -204,6 +204,7 @@
 // and an acceleration which exactly compensates gravitational attraction.  Both
 // bodies move in straight lines.
 TEST_F(EphemerisTest, EarthProbe) {
+  Position<EarthMoonOrbitPlane> const reference_position;
   Length const kDistance = 1E9 * Metre;
   std::vector<not_null<std::unique_ptr<MassiveBody const>>> bodies;
   std::vector<DegreesOfFreedom<EarthMoonOrbitPlane>> initial_state;
@@ -251,47 +252,57 @@
                      Position<EarthMoonOrbitPlane>>(),
                  t0_ + period);

-  //Length const q1 = (trajectory1_->last().degrees_of_freedom().position() -
-  //                   reference_position).coordinates().y;
-  //Speed const v1 =
-  //    trajectory1_->last().degrees_of_freedom().velocity().coordinates().x;
-  //std::vector<Vector<Length, EarthMoonOrbitPlane>> const positions1 =
-  //    ValuesOf(trajectory1_->Positions(), reference_position);
-  //LOG(INFO) << ToMathematicaString(positions1);
-  //EXPECT_THAT(positions1.size(), Eq(101));
-  //EXPECT_THAT(positions1[25].coordinates().x,
-  //            AlmostEquals(0.25 * period_ * v1, 1));
-  //EXPECT_THAT(positions1[25].coordinates().y, Eq(q1));
-  //EXPECT_THAT(positions1[50].coordinates().x,
-  //            AlmostEquals(0.50 * period_ * v1, 1));
-  //EXPECT_THAT(positions1[50].coordinates().y, Eq(q1));
-  //EXPECT_THAT(positions1[75].coordinates().x,
-  //            AlmostEquals(0.75 * period_ * v1, 1, 2));
-  //EXPECT_THAT(positions1[75].coordinates().y, Eq(q1));
-  //EXPECT_THAT(positions1[100].coordinates().x,
-  //            AlmostEquals(1.00 * period_ * v1, 1));
-  //EXPECT_THAT(positions1[100].coordinates().y, Eq(q1));
-
-  //Length const q3 = (trajectory3_->last().degrees_of_freedom().position() -
-  //                   reference_position).coordinates().y;
-  //Speed const v3 =
-  //    trajectory3_->last().degrees_of_freedom().velocity().coordinates().x;
-  //std::vector<Vector<Length, EarthMoonOrbitPlane>> const positions3 =
-  //    ValuesOf(trajectory3_->Positions(), reference_position);
-  //LOG(INFO) << ToMathematicaString(positions3);
-  //EXPECT_THAT(positions3.size(), Eq(101));
-  //EXPECT_THAT(positions3[25].coordinates().x,
-  //            AlmostEquals(0.25 * period_ * v3, 1));
-  //EXPECT_THAT(positions3[25].coordinates().y, AlmostEquals(q3, 2));
-  //EXPECT_THAT(positions3[50].coordinates().x,
-  //            AlmostEquals(0.50 * period_ * v3, 1));
-  //EXPECT_THAT(positions3[50].coordinates().y, AlmostEquals(q3, 2));
-  //EXPECT_THAT(positions3[75].coordinates().x,
-  //            AlmostEquals(0.75 * period_ * v3, 1, 2));
-  //EXPECT_THAT(positions3[75].coordinates().y, AlmostEquals(q3, 1));
-  //EXPECT_THAT(positions3[100].coordinates().x,
-  //            AlmostEquals(1.00 * period_ * v3, 1));
-  //EXPECT_THAT(positions3[100].coordinates().y, Eq(q3));
+  ContinuousTrajectory<EarthMoonOrbitPlane> const& earth_trajectory =
+      ephemeris.trajectory(earth);
+
+  ContinuousTrajectory<EarthMoonOrbitPlane>::Hint hint;
+  DegreesOfFreedom<EarthMoonOrbitPlane> const earth_degrees_of_freedom =
+      earth_trajectory.EvaluateDegreesOfFreedom(t0_ + period, &hint);
+  Length const q_earth = (earth_degrees_of_freedom.position() -
+                          reference_position).coordinates().y;
+  Speed const v_earth = earth_degrees_of_freedom.velocity().coordinates().x;
+  std::vector<Displacement<EarthMoonOrbitPlane>> earth_positions;
+  for (int i = 0; i <= 100; ++i) {
+    earth_positions.push_back(
+        earth_trajectory.EvaluatePosition(t0_ + i * period / 100, &hint) -
+            reference_position);
+  }
+
+  EXPECT_THAT(earth_positions.size(), Eq(101));
+  EXPECT_THAT(earth_positions[25].coordinates().x,
+              AlmostEquals(0.25 * period * v_earth, 10));
+  EXPECT_THAT(earth_positions[25].coordinates().y, Eq(q_earth));
+  EXPECT_THAT(earth_positions[50].coordinates().x,
+              AlmostEquals(0.50 * period * v_earth, 11));
+  EXPECT_THAT(earth_positions[50].coordinates().y, Eq(q_earth));
+  EXPECT_THAT(earth_positions[75].coordinates().x,
+              AlmostEquals(0.75 * period * v_earth, 6));
+  EXPECT_THAT(earth_positions[75].coordinates().y, Eq(q_earth));
+  EXPECT_THAT(earth_positions[100].coordinates().x,
+              AlmostEquals(1.00 * period * v_earth, 9));
+  EXPECT_THAT(earth_positions[100].coordinates().y, Eq(q_earth));
+
+  Length const q_probe = (trajectory.last().degrees_of_freedom().position() -
+                     reference_position).coordinates().y;
+  Speed const v_probe =
+      trajectory.last().degrees_of_freedom().velocity().coordinates().x;
+  std::vector<Displacement<EarthMoonOrbitPlane>> probe_positions;
+  for (auto const it : trajectory.Positions()) {
+    probe_positions.push_back(it.second - reference_position);
+  }
+  EXPECT_THAT(probe_positions.size(), Eq(101));
+  EXPECT_THAT(probe_positions[25].coordinates().x,
+              AlmostEquals(0.25 * period * v_probe, 1));
+  EXPECT_THAT(probe_positions[25].coordinates().y, AlmostEquals(q_probe, 0));
+  EXPECT_THAT(probe_positions[50].coordinates().x,
+              AlmostEquals(0.50 * period * v_probe, 1));
+  EXPECT_THAT(probe_positions[50].coordinates().y, AlmostEquals(q_probe, 0));
+  EXPECT_THAT(probe_positions[75].coordinates().x,
+              AlmostEquals(0.75 * period * v_probe, 1, 2));
+  EXPECT_THAT(probe_positions[75].coordinates().y, AlmostEquals(q_probe, 0));
+  EXPECT_THAT(probe_positions[100].coordinates().x,
+              AlmostEquals(1.00 * period * v_probe, 1));
+  EXPECT_THAT(probe_positions[100].coordinates().y, Eq(q_probe));
 }

 TEST_F(EphemerisTest, Sputnik1ToSputnik2) {


Elephant.

Elephant.

--- physics/ephemeris_test.cpp
+++ physics/ephemeris_test.cpp
@@ -10,6 +10,8 @@
 #include "gtest/gtest.h"
 #include "integrators/embedded_explicit_runge_kutta_nyström_integrator.hpp"
 #include "integrators/symplectic_runge_kutta_nyström_integrator.hpp"
+#include "physics/massive_body.hpp"
+#include "physics/oblate_body.hpp"
 #include "quantities/astronomy.hpp"
 #include "quantities/constants.hpp"
 #include "quantities/elementary_functions.hpp"
@@ -49,6 +51,13 @@
 using ::testing::Lt;

 namespace physics {
+
+namespace {
+
+Length const kEarthPolarRadius = 6356.8 * Kilo(Metre);
+double const kEarthJ2 = 0.00108262545;
+
+}  // namespace

 class EphemerisTest : public testing::Test {
  protected:
@@ -762,18 +771,26 @@
 // The gravitational acceleration on at elephant located at the pole.
 TEST_F(EphemerisTest, ComputeGravitationalAccelerationMasslessBody) {
   Position<EarthMoonOrbitPlane> const reference_position;
-  Length const kDistance = 6356.8 * Kilo(Metre);
   Time const kDuration = 1 * Second;
   std::vector<not_null<std::unique_ptr<MassiveBody const>>> bodies;
   std::vector<DegreesOfFreedom<EarthMoonOrbitPlane>> initial_state;
-  Position<EarthMoonOrbitPlane> centre_of_mass;
-  Time period;
-  SetUpEarthMoonSystem(&bodies, &initial_state, &centre_of_mass, &period);
-
-  bodies.erase(bodies.begin() + 1);
-  initial_state.erase(initial_state.begin() + 1);
-
-  MassiveBody const* const earth = bodies[0].get();
+
+  auto* earth = new OblateBody<EarthMoonOrbitPlane>(
+                        5.9721986E24 * Kilogram,
+                        kEarthJ2,
+                        kEarthPolarRadius,
+                        Vector<double, EarthMoonOrbitPlane>({0, 0, 1}));
+  Velocity<EarthMoonOrbitPlane> const v({0 * SIUnit<Speed>(),
+                                         0 * SIUnit<Speed>(),
+                                         0 * SIUnit<Speed>()});
+  Position<EarthMoonOrbitPlane> const q(
+      Vector<Length, EarthMoonOrbitPlane>({0 * AstronomicalUnit,
+                                           0 * AstronomicalUnit,
+                                           0 * AstronomicalUnit}));
+
+  bodies.push_back(std::unique_ptr<MassiveBody const>(earth));
+  initial_state.emplace_back(q, v);
+
   Position<EarthMoonOrbitPlane> const earth_position =
       initial_state[0].position();
   Velocity<EarthMoonOrbitPlane> const earth_velocity =
@@ -793,7 +810,7 @@
   trajectory.Append(t0_,
                     DegreesOfFreedom<EarthMoonOrbitPlane>(
                         earth_position + Vector<Length, EarthMoonOrbitPlane>(
-                            {0 * Metre, kDistance, 0 * Metre}),
+                            {0 * Metre, 0 * Metre, kEarthPolarRadius}),
                         earth_velocity));

   ephemeris.FlowWithAdaptiveStep(&trajectory,
@@ -812,8 +829,8 @@
   EXPECT_THAT(elephant_positions.size(), Eq(8));
   EXPECT_THAT(elephant_positions.back().coordinates().x,
               AlmostEquals(kDuration * v_elephant, 0));
-  EXPECT_LT(RelativeError(elephant_positions.back().coordinates().y,
-                          kDistance), 8E-7);
+  EXPECT_LT(RelativeError(elephant_positions.back().coordinates().z,
+                          kEarthPolarRadius), 8E-7);

   std::vector<Vector<Acceleration, EarthMoonOrbitPlane>> elephant_accelerations;
   for (auto const& t : trajectory.Times()) {
@@ -823,12 +840,11 @@
   EXPECT_THAT(elephant_accelerations.size(), Eq(8));
   EXPECT_THAT(elephant_accelerations.back().coordinates().x,
               AlmostEquals(0 * SIUnit<Acceleration>(), 0));
-  // 9.832 m/s^2 is the nominal acceleration at the pole, but this elephant is
-  // very heavy so it gets 9.864 m/s^2.
-  EXPECT_LT(RelativeError(elephant_accelerations.back().coordinates().y,
-                          -9.832 * SIUnit<Acceleration>()), 3.2E-3);
-  EXPECT_THAT(elephant_accelerations.back().coordinates().z,
+  EXPECT_THAT(elephant_accelerations.back().coordinates().y,
               AlmostEquals(0 * SIUnit<Acceleration>(), 0));
+  LOG(ERROR)<<elephant_accelerations.back().coordinates().z;
+  EXPECT_LT(RelativeError(elephant_accelerations.back().coordinates().z,
+                          -9.832 * SIUnit<Acceleration>()), 4.9E-5);
 }

 TEST_F(EphemerisTest, ComputeGravitationalAccelerationMassiveBody) {


fix ApplyTerrain issues

fix ApplyTerrain issues

--- Source/UnrealSandboxTerrain/Private/TerrainZoneComponent.cpp
+++ Source/UnrealSandboxTerrain/Private/TerrainZoneComponent.cpp
@@ -73,31 +73,22 @@
 	MeshDataSection& MeshDataSection = mesh_data->MeshDataSectionLOD[0];
 	FProcMeshSection& MeshSection = MeshDataSection.MainMesh;

-	if (MeshSection.ProcVertexBuffer.Num() == 0) {
-		//return;
-	}
-
-	const int section = 0;
-
 	MainTerrainMesh->SetMobility(EComponentMobility::Movable);
+
 	MainTerrainMesh->AddLocalRotation(FRotator(0.0f, 0.01, 0.0f));  // workaround
 	MainTerrainMesh->AddLocalRotation(FRotator(0.0f, -0.01, 0.0f)); // workaround

 	MainTerrainMesh->SetMeshData(mesh_data_ptr);

 	MainTerrainMesh->SetMobility(EComponentMobility::Stationary);
-	MainTerrainMesh->SetVisibility(false);
+
 	MainTerrainMesh->SetCastShadow(true);
 	MainTerrainMesh->bCastHiddenShadow = true;
 	MainTerrainMesh->SetMaterial(0, GetTerrainController()->TerrainMaterial);
+	MainTerrainMesh->SetVisibility(true);

 	CollisionMesh->SetMeshData(mesh_data_ptr);
-
-
-	MainTerrainMesh->SetVisibility(true);
-	MainTerrainMesh->SetCollisionProfileName(TEXT("BlockAll"));
-
-
+	CollisionMesh->SetCollisionProfileName(TEXT("BlockAll"));

 	double end = FPlatformTime::Seconds();
 	double time = (end - start) * 1000;


fixing in delta stability verification

fixing in delta stability verification

--- dsverifier.cpp
+++ dsverifier.cpp
@@ -307,7 +307,6 @@
 		std::cout << std::endl << "No remaining elements in polynomial vector";
 		throw std::runtime_error ("tla");
 	}
-	return 2;

 	Eigen::VectorXd coefficients(coefficients_vector.size());


modification

modification

--- sharefile/Server/main.cpp
+++ sharefile/Server/main.cpp
@@ -82,7 +82,7 @@
 {
 	if ( argc < 2 )
 	{
-		std::cerr << "用法：" << argv[0] << "<端口号>" << std::endl ;
+		std::cerr << "Guide:" << argv[0] << "<Port Number>" << std::endl ;
 		return - 1;
 	}
 	// prepare to listen socket


reduce the sizeof fast_variant when it contains only elements smaller than int

--- silicium/fast_variant.hpp
+++ silicium/fast_variant.hpp
@@ -8,6 +8,7 @@
 #include <boost/variant/static_visitor.hpp>
 #include <boost/mpl/find.hpp>
 #include <boost/mpl/vector.hpp>
+#include <boost/integer.hpp>
 #include <boost/optional.hpp>

 namespace Si
@@ -40,6 +41,49 @@
 		template <>
 		struct union_<>
 		{
+		};
+
+		template <class Which, std::size_t Size>
+		struct combined_storage
+		{
+			using which_type = Which;
+
+			combined_storage() BOOST_NOEXCEPT
+			{
+				which(0);
+			}
+
+			which_type which() const BOOST_NOEXCEPT
+			{
+				return *reinterpret_cast<which_type const *>(bytes.data() + which_offset);
+			}
+
+			void which(which_type value) BOOST_NOEXCEPT
+			{
+				*reinterpret_cast<which_type *>(bytes.data() + which_offset) = value;
+			}
+
+			char &storage() BOOST_NOEXCEPT
+			{
+				return *bytes.data();
+			}
+
+			char const &storage() const BOOST_NOEXCEPT
+			{
+				return *bytes.data();
+			}
+
+		private:
+
+			using alignment_unit = unsigned;
+			enum
+			{
+				which_offset = (Size + sizeof(which_type) - 1) / sizeof(which_type) * sizeof(which_type),
+				used_size = which_offset + sizeof(which_type),
+				padding = sizeof(alignment_unit),
+				padded_size = (used_size + padding - 1) / padding * padding
+			};
+			std::array<char, padded_size> bytes;
 		};

 		template <class T>
@@ -158,31 +202,31 @@
 			fast_variant_base() BOOST_NOEXCEPT
 			{
 				using constructed = typename first<T...>::type;
-				new (reinterpret_cast<constructed *>(&storage)) constructed();
+				new (reinterpret_cast<constructed *>(&storage.storage())) constructed();
 			}

 			~fast_variant_base() BOOST_NOEXCEPT
 			{
-				destroy_storage(which_, storage);
+				destroy_storage(storage.which(), storage.storage());
 			}

 			fast_variant_base(fast_variant_base &&other) BOOST_NOEXCEPT
-				: which_(other.which_)
-			{
-				move_construct_storage(which_, storage, other.storage);
+			{
+				storage.which(other.storage.which());
+				move_construct_storage(storage.which(), storage.storage(), other.storage.storage());
 			}

 			fast_variant_base &operator = (fast_variant_base &&other) BOOST_NOEXCEPT
 			{
-				if (which_ == other.which_)
+				if (storage.which() == other.which())
 				{
-					move_storage(which_, storage, other.storage);
+					move_storage(storage.which(), storage.storage(), other.storage.storage());
 				}
 				else
 				{
-					destroy_storage(which_, storage);
-					move_construct_storage(other.which_, storage, other.storage);
-					which_ = other.which_;
+					destroy_storage(storage.which(), storage.storage());
+					move_construct_storage(other.storage.which(), storage.storage(), other.storage.storage());
+					storage.which(other.storage.which());
 				}
 				return *this;
 			}
@@ -204,14 +248,14 @@
 					void
 				>::type>
 			fast_variant_base(U &&value)
-				: which_(Index)
-			{
-				new (&storage) CleanU(std::forward<U>(value));
+			{
+				storage.which(Index);
+				new (&storage.storage()) CleanU(std::forward<U>(value));
 			}

 			which_type which() const BOOST_NOEXCEPT
 			{
-				return which_;
+				return storage.which();
 			}

 			template <class Visitor>
@@ -222,7 +266,7 @@
 				{{
 					&apply_visitor_impl<Visitor, T, result>...
 				}};
-				return f[which_](std::forward<Visitor>(visitor), &storage);
+				return f[storage.which()](std::forward<Visitor>(visitor), &storage.storage());
 			}

 			template <class Visitor>
@@ -233,12 +277,12 @@
 				{{
 					&apply_visitor_const_impl<Visitor, T, result>...
 				}};
-				return f[which_](std::forward<Visitor>(visitor), &storage);
+				return f[storage.which()](std::forward<Visitor>(visitor), &storage.storage());
 			}

 			bool operator == (fast_variant_base const &other) const
 			{
-				if (which_ != other.which_)
+				if (storage.which() != other.storage.which())
 				{
 					return false;
 				}
@@ -246,16 +290,16 @@
 				{{
 					&equals<T>...
 				}};
-				return f[which_](&storage, &other.storage);
+				return f[storage.which()](&storage.storage(), &other.storage.storage());
 			}

 			bool operator < (fast_variant_base const &other) const
 			{
-				if (which_ > other.which_)
+				if (storage.which() > other.storage.which())
 				{
 					return false;
 				}
-				if (which_ < other.which_)
+				if (storage.which() < other.storage.which())
 				{
 					return true;
 				}
@@ -263,17 +307,17 @@
 				{{
 					&less<T>...
 				}};
-				return f[which_](&storage, &other.storage);
+				return f[storage.which()](&storage.storage(), &other.storage.storage());
 			}

 		protected: //TODO: make private somehow

-			using storage_type = std::array<char, sizeof(union_<T...>)>; //TODO: ensure proper alignment
-
-			which_type which_ = 0;
+			using internal_which_type = typename boost::uint_value_t<sizeof...(T)>::least;
+			using storage_type = combined_storage<internal_which_type, sizeof(union_<T...>)>; //TODO: ensure proper alignment
+
 			storage_type storage;

-			static void copy_construct_storage(which_type which, storage_type &destination, storage_type const &source)
+			static void copy_construct_storage(which_type which, char &destination, char const &source)
 			{
 				std::array<void (*)(void *, void const *), sizeof...(T)> const f =
 				{{
@@ -282,7 +326,7 @@
 				f[which](&destination, &source);
 			}

-			static void move_construct_storage(which_type which, storage_type &destination, storage_type &source) BOOST_NOEXCEPT
+			static void move_construct_storage(which_type which, char &destination, char &source) BOOST_NOEXCEPT
 			{
 				std::array<void (*)(void *, void *), sizeof...(T)> const f =
 				{{
@@ -291,7 +335,7 @@
 				f[which](&destination, &source);
 			}

-			static void destroy_storage(which_type which, storage_type &destroyed) BOOST_NOEXCEPT
+			static void destroy_storage(which_type which, char &destroyed) BOOST_NOEXCEPT
 			{
 				std::array<void (*)(void *), sizeof...(T)> const f =
 				{{
@@ -300,7 +344,7 @@
 				f[which](&destroyed);
 			}

-			static void copy_storage(which_type which, storage_type &destination, storage_type const &source)
+			static void copy_storage(which_type which, char &destination, char const &source)
 			{
 				std::array<void (*)(void *, void const *), sizeof...(T)> const f =
 				{{
@@ -309,7 +353,7 @@
 				f[which](&destination, &source);
 			}

-			static void move_storage(which_type which, storage_type &destination, storage_type &source) BOOST_NOEXCEPT
+			static void move_storage(which_type which, char &destination, char &source) BOOST_NOEXCEPT
 			{
 				std::array<void (*)(void *, void *), sizeof...(T)> const f =
 				{{
@@ -357,8 +401,8 @@
 			fast_variant_base(fast_variant_base const &other)
 				: base()
 			{
-				this->which_ = other.which();
-				base::copy_construct_storage(this->which_, this->storage, other.storage);
+				this->storage.which(other.storage.which());
+				base::copy_construct_storage(this->storage.which(), this->storage.storage(), other.storage.storage());
 			}

 			fast_variant_base &operator = (fast_variant_base &&other) BOOST_NOEXCEPT
@@ -369,17 +413,17 @@

 			fast_variant_base &operator = (fast_variant_base const &other)
 			{
-				if (this->which_ == other.which_)
+				if (this->storage.which() == other.storage.which())
 				{
-					base::copy_storage(this->which_, this->storage, other.storage);
+					base::copy_storage(this->storage.which(), this->storage.storage(), other.storage.storage());
 				}
 				else
 				{
 					typename base::storage_type temporary;
-					base::copy_construct_storage(other.which_, temporary, other.storage);
-					base::destroy_storage(this->which_, this->storage);
-					base::move_construct_storage(other.which_, this->storage, temporary);
-					this->which_ = other.which_;
+					base::copy_construct_storage(other.storage.which(), temporary.storage(), other.storage.storage());
+					base::destroy_storage(this->storage.which(), this->storage.storage());
+					base::move_construct_storage(other.storage.which(), this->storage.storage(), temporary.storage());
+					this->storage.which(other.storage.which());
 				}
 				return *this;
 			}
@@ -603,7 +647,12 @@
 	};
 }

-BOOST_STATIC_ASSERT(sizeof(Si::fast_variant<int>) == 8);
-BOOST_STATIC_ASSERT(sizeof(Si::fast_variant<int *>) == (4 + sizeof(int *)));
+//TODO: which is always 0, so this can be made as small as sizeof(int)
+BOOST_STATIC_ASSERT(sizeof(Si::fast_variant<int>) == (2 * sizeof(int)));
+
+//TODO: which is always 0, so this can be made as small as sizeof(int *)
+BOOST_STATIC_ASSERT(sizeof(Si::fast_variant<int *>) == (sizeof(int) + sizeof(int *)));
+
+BOOST_STATIC_ASSERT(sizeof(Si::fast_variant<std::hash<Si::fast_variant<int>>>) == sizeof(int));

 #endif


Don't crash in strutils::trim() with empty strings

--- simgear/misc/strutils.cxx
+++ simgear/misc/strutils.cxx
@@ -131,10 +131,9 @@
 	static string
 	do_strip( const string& s, int striptype )
 	{
-	    //     if (s.empty())
-	    //      return s;
-
 	    string::size_type len = s.length();
+	    if( len == 0 ) // empty string is trivial
+		return s;
 	    string::size_type i = 0;
 	    if (striptype != RIGHTSTRIP)
 	    {


ADD: Implement Direct3D9Texture::saveToMemory (backported impl from default)

--HG--
branch : v0-7

--- cegui/src/RendererModules/Direct3D9/CEGUIDirect3D9Texture.cpp
+++ cegui/src/RendererModules/Direct3D9/CEGUIDirect3D9Texture.cpp
@@ -36,6 +36,209 @@
 namespace CEGUI
 {
 //----------------------------------------------------------------------------//
+// Internal helper class to wrap the internal handling needed to copy from a
+// D3D9 texture.
+class D3DSurfaceBlitter
+{
+public:
+    //------------------------------------------------------------------------//
+    D3DSurfaceBlitter(LPDIRECT3DDEVICE9 d3d_device, LPDIRECT3DTEXTURE9 tex) :
+        d_device(d3d_device),
+        d_texture(tex),
+        d_renderTarget(0),
+        d_offscreen(0)
+    {
+        populateTextureSurfaceDescription();
+    }
+
+    //------------------------------------------------------------------------//
+    ~D3DSurfaceBlitter()
+    {
+        cleanupSurfaces();
+    }
+
+    //------------------------------------------------------------------------//
+    void blitToMemory(uint32* dest)
+    {
+        if (!d_texture)
+            return;
+
+        lockRect(0, true);
+
+        blitD3DCOLORSurfaceToRGBA(
+            static_cast<uint32*>(d_lockedRect.pBits), dest,
+            Size(static_cast<float>(d_surfDesc.Width),
+                 static_cast<float>(d_surfDesc.Height)),
+            d_lockedRect.Pitch);
+
+        unlockRect();
+    }
+
+    //------------------------------------------------------------------------//
+    bool isRenderTarget() const
+    {
+        return d_surfDesc.Usage == D3DUSAGE_RENDERTARGET;
+    }
+
+    //------------------------------------------------------------------------//
+
+private:
+    LPDIRECT3DDEVICE9 d_device;
+    LPDIRECT3DTEXTURE9 d_texture;
+    LPDIRECT3DSURFACE9 d_renderTarget;
+    LPDIRECT3DSURFACE9 d_offscreen;
+    D3DSURFACE_DESC d_surfDesc;
+    D3DLOCKED_RECT d_lockedRect;
+    RECT d_fullArea;
+
+    //------------------------------------------------------------------------//
+    void initialiseSurfaces()
+    {
+        if (!d_offscreen)
+            createOffscreenSurface();
+
+        if (!d_renderTarget)
+            getTextureSurface();
+    }
+
+    //------------------------------------------------------------------------//
+    void cleanupSurfaces()
+    {
+        if (d_renderTarget)
+        {
+            d_renderTarget->Release();
+            d_renderTarget = 0;
+        }
+
+        if (d_offscreen)
+        {
+            d_offscreen->Release();
+            d_offscreen = 0;
+        }
+    }
+
+    //------------------------------------------------------------------------//
+    void lockRect(RECT* area = 0, bool for_reading = false)
+    {
+        if (isRenderTarget())
+        {
+            initialiseSurfaces();
+
+            if (for_reading)
+                getRenderTargetData();
+
+            lockSurfaceRect(area);
+        }
+        else
+        {
+            lockTextureRect(area);
+        }
+    }
+
+    //------------------------------------------------------------------------//
+    void unlockRect(RECT* area = 0, bool needs_update = false)
+    {
+        if (isRenderTarget())
+        {
+            d_offscreen->UnlockRect();
+
+            if (needs_update)
+                updateRenderTarget(area);
+        }
+        else
+            d_texture->UnlockRect(0);
+    }
+
+    //------------------------------------------------------------------------//
+    void populateTextureSurfaceDescription()
+    {
+        if (FAILED(d_texture->GetLevelDesc(0, &d_surfDesc)))
+            CEGUI_THROW(RendererException(
+                "IDirect3DTexture9::GetLevelDesc failed."));
+
+        d_fullArea.left = 0;
+        d_fullArea.top = 0;
+        d_fullArea.right = d_surfDesc.Width;
+        d_fullArea.bottom = d_surfDesc.Height;
+    }
+
+    //------------------------------------------------------------------------//
+    void createOffscreenSurface()
+    {
+        if (FAILED(d_device->CreateOffscreenPlainSurface(
+            d_surfDesc.Width, d_surfDesc.Height, d_surfDesc.Format,
+            D3DPOOL_SYSTEMMEM, &d_offscreen, 0)))
+        {
+            CEGUI_THROW(RendererException(
+                "IDirect3DDevice9::CreateOffscreenPlainSurface failed."));
+        }
+    }
+
+    //------------------------------------------------------------------------//
+    void getTextureSurface()
+    {
+        if (FAILED(d_texture->GetSurfaceLevel(0, &d_renderTarget)))
+            CEGUI_THROW(RendererException(
+                "IDirect3DTexture9::GetSurfaceLevel failed."));
+    }
+
+    //------------------------------------------------------------------------//
+    void lockSurfaceRect(RECT* area)
+    {
+        if (FAILED(d_offscreen->LockRect(&d_lockedRect, area, 0)))
+            CEGUI_THROW(RendererException(
+                "IDirect3DSurface9::LockRect failed."));
+    }
+
+    //------------------------------------------------------------------------//
+    void lockTextureRect(RECT* area)
+    {
+        if (FAILED(d_texture->LockRect(0, &d_lockedRect, area, 0)))
+            CEGUI_THROW(RendererException(
+                "IDirect3DTexture9::LockRect failed."));
+    }
+
+    //------------------------------------------------------------------------//
+    void updateRenderTarget(RECT* area)
+    {
+        POINT pt = {area ? area->left : 0, area ? area->top : 0};
+        if (FAILED(d_device->UpdateSurface(d_offscreen,
+                                           area ? area : &d_fullArea,
+                                           d_renderTarget, &pt)))
+        {
+            CEGUI_THROW(RendererException(
+                "IDirect3DDevice9::UpdateSurface failed."));
+        }
+    }
+
+    //------------------------------------------------------------------------//
+    void getRenderTargetData()
+    {
+        if (FAILED(d_device->GetRenderTargetData(d_renderTarget, d_offscreen)))
+            CEGUI_THROW(RendererException(
+                "IDirect3DDevice9::GetRenderTargetData failed."));
+    }
+
+    //------------------------------------------------------------------------//
+    static void blitD3DCOLORSurfaceToRGBA(const uint32* src, uint32* dst,
+                                          const Size& sz, size_t source_pitch)
+    {
+        for (uint i = 0; i < sz.d_height; ++i)
+        {
+            for (uint j = 0; j < sz.d_width; ++j)
+            {
+                const uint32 pixel = src[j];
+                const uint32 tmp = pixel & 0x00FF00FF;
+                dst[j] = pixel & 0xFF00FF00 | (tmp << 16) | (tmp >> 16);
+            }
+
+            src += source_pitch / sizeof(uint32);
+            dst += static_cast<uint32>(sz.d_width);
+        }
+    }
+};
+
+//----------------------------------------------------------------------------//
 Direct3D9Texture::Direct3D9Texture(Direct3D9Renderer& owner) :
     d_owner(owner),
     d_texture(0),
@@ -277,9 +480,8 @@
 //----------------------------------------------------------------------------//
 void Direct3D9Texture::saveToMemory(void* buffer)
 {
-    // TODO:
-    CEGUI_THROW(RendererException(
-        "Direct3D9Texture::saveToMemory - Unimplemented!"));
+    D3DSurfaceBlitter blitter(d_owner.getDevice(), d_texture);
+    blitter.blitToMemory(static_cast<uint32*>(buffer));
 }

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


Updated handling of build/latest/.libs directory in library path.

--- driver/bi/build/Driver.cpp
+++ driver/bi/build/Driver.cpp
@@ -230,7 +230,8 @@
   /* lib dirs */
   auto local = workDir / "build" / "latest" / ".libs";
   if (fs::exists(local)) {
-    libDirs.push_back(local);
+    libDirs.push_back(fs::canonical(local));
+    // ^ use canonical here as "latest" symlink may be updated before use
   }
   if (BIRCH_LIBRARY_PATH) {
     std::stringstream birch_library_path(BIRCH_LIBRARY_PATH);


Demo: Minor tweaks.

Demo: Minor tweaks.

--- imgui_demo.cpp
+++ imgui_demo.cpp
@@ -413,7 +413,7 @@
                     {
                         ImGui::Text("blah blah");
                         ImGui::SameLine();
-                        if (ImGui::SmallButton("print")) printf("Child %d pressed", i);
+                        if (ImGui::SmallButton("button")) { };
                         ImGui::TreePop();
                     }
                 ImGui::TreePop();
@@ -807,14 +807,14 @@
         {
             static ImVec4 color = ImColor(114, 144, 154, 200);

-            static bool hdr = false;
             static bool alpha_preview = true;
             static bool alpha_half_preview = false;
             static bool options_menu = true;
-            ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
+            static bool hdr = false;
             ImGui::Checkbox("With Alpha Preview", &alpha_preview);
             ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
             ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options.");
+            ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
             int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);

             ImGui::Text("Color widget:");


Added assert/comment about using MergeMode (#1100)

--- imgui_draw.cpp
+++ imgui_draw.cpp
@@ -1142,6 +1142,10 @@
         ImFont* font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont));
         IM_PLACEMENT_NEW(font) ImFont();
         Fonts.push_back(font);
+    }
+    else
+    {
+        IM_ASSERT(!Fonts.empty()); // When using MergeMode make sure that a font has already been added before. You can use ImGui::AddFontDefault() to add the default imgui font.
     }

     ConfigData.push_back(*font_cfg);


cosmetics

cosmetics

--- cvmfs/monitor.cc
+++ cvmfs/monitor.cc
@@ -128,6 +128,7 @@
   // SIGQUIT (watchdog process will raise SIGQUIT)
   (void) sigaction(SIGQUIT, &old_signal_handlers_[sig], NULL);

+  // inform the watchdog that CernVM-FS crashed
   if (! pipe_watchdog_.Write(ControlFlow::kProduceStacktrace)) {
     _exit(1);
   }


Fixes to make it work with MakerWare 2.4.1.35 which outputs A or B feed values rather than E feed differences for a single extrusion during the G1 command. I was able to DualExtrude Emmet's mini-gears with this script.

--- DualExtrude.cpp
+++ DualExtrude.cpp
@@ -285,7 +285,7 @@
 			{ // Got one!
 				// The following is derived from "Dual Extrude Both Extruders at Once for Replicator"
 				// from user thorstadg on thingiverse.com
-				if ('E' == Token[0])  // Check for 'E'
+				if ('E' == Token[0] || 'A' == Token[0] || 'B' == Token[0])  // Check for 'E', 'A' or 'B'
 				{
 					if (strlen(Token) > 15)  // Check for parameter that fits in buffer
 					{
@@ -314,18 +314,18 @@
 						NewE = ((CurrentE - FirstE) * Ratio) + FirstE;

 						// Round to the nearest .001
-						NewE = floor((NewE * 1000.0) + 0.5);
-						NewE = NewE / 1000.0;
+						NewE = floor((NewE * 100000.0) + 0.5);
+						NewE = NewE / 100000.0;

 						if (RightUsed)  // Check witch one is the new one
 						{
 							// Replace with A/B
-							sprintf(buf+strlen(buf)," A%s B%.3f", Token+1, NewE);
+							sprintf(buf+strlen(buf)," B%.5f A%s", NewE, Token+1);
 						}
 						else
 						{
 							// Replace with A/B
-							sprintf(buf+strlen(buf)," A%.3f B%s", NewE, Token+1);
+							sprintf(buf+strlen(buf)," A%.5f B%s", NewE, Token+1);
 						}
 					}
 					else


INTEGRATION: CWS changefileheader (1.18.14); FILE MERGED 2008/04/01 16:02:44 thb 1.18.14.3: #i85898# Stripping all external header guards 2008/04/01 12:58:42 thb 1.18.14.2: #i85898# Stripping all external header guards 2008/03/31 15:31:27 rt 1.18.14.1: #i87441# Change license header to LPGL v3.

--- ucbhelper/inc/ucbhelper/content.hxx
+++ ucbhelper/inc/ucbhelper/content.hxx
@@ -1,61 +1,42 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: content.hxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.18 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: obo $ $Date: 2008-01-07 08:42:30 $
+ * $RCSfile: content.hxx,v $
+ * $Revision: 1.19 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/
 #ifndef _UCBHELPER_CONTENT_HXX
 #define _UCBHELPER_CONTENT_HXX

 #include "rtl/ref.hxx"
-
-#ifndef _COM_SUN_STAR_UCB_CONTENTCREATIONEXCEPTION_HPP_
 #include <com/sun/star/ucb/ContentCreationException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_COMMANDABORTEDEXCEPTION_HPP_
 #include <com/sun/star/ucb/CommandAbortedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_
 #include <com/sun/star/io/XStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
 #include <com/sun/star/uno/Reference.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
 #include <com/sun/star/uno/Sequence.hxx>
-#endif
-
-#ifndef INCLUDED_UCBHELPERDLLAPI_H
 #include "ucbhelper/ucbhelperdllapi.h"
-#endif

 namespace com { namespace sun { namespace star { namespace beans {
     class XPropertySetInfo;


Removed: Wrong asserts from isFolder() and isDocument().

--- ucbhelper/source/client/content.cxx
+++ ucbhelper/source/client/content.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: content.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: kso $ $Date: 2000-10-30 10:08:43 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: kso $ $Date: 2000-11-01 08:06:56 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -1007,7 +1007,6 @@
         >>= bFolder )
         return bFolder;

-    VOS_ENSURE( sal_False, "Content::isFolder - Got no property value!" );
     throw CommandAbortedException();
 }

@@ -1020,7 +1019,6 @@
         >>= bDoc )
         return bDoc;

-    VOS_ENSURE( sal_False, "Content::isDocument - Got no property value!" );
     throw CommandAbortedException();
 }


[Ozone-Dri] Show the cursor when warping to a new display

Do not rely on the caller to show the cursor when moving between
displays.

BUG=449249
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#311936}
(cherry picked from commit 2ff0a58f8b6cd55286428cd183035df54dc5b6a0)

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

Cr-Commit-Position: 665a5787e4610f1ec55d3a4e2f02ab0724e38987@{#45}
Cr-Branched-From: 4cd5f18d847990599feba509541d8a7b9a16883a@{#310958}

--- ui/ozone/platform/dri/dri_cursor.cc
+++ ui/ozone/platform/dri/dri_cursor.cc
@@ -58,7 +58,12 @@

 void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget,
                              const gfx::PointF& location) {
-  if (widget != cursor_window_ && cursor_window_ != gfx::kNullAcceleratedWidget)
+  // When moving between windows hide the cursor on the current window then show
+  // it on the new window.
+  bool changing_window =
+      widget != cursor_window_ && cursor_window_ != gfx::kNullAcceleratedWidget;
+
+  if (changing_window)
     HideCursor();

   DriWindow* window = window_manager_->GetWindow(widget);
@@ -72,8 +77,12 @@
   // Right and bottom edges are exclusive.
   cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1));

-  if (cursor_.get())
-    sender_->MoveHardwareCursor(cursor_window_, bitmap_location());
+  if (cursor_.get()) {
+    if (changing_window)
+      ShowCursor();
+    else
+      sender_->MoveHardwareCursor(cursor_window_, bitmap_location());
+  }
 }

 void DriCursor::MoveCursorTo(const gfx::PointF& location) {


Use comphelper::SequenceAsHashMap

Use comphelper::SequenceAsHashMap

Change-Id: I7d644980172c479191ecfab2e6dfcb60c11afc3f


first steps for the ability to run in unicorn even when some (unused) registers are symbolic

--- simuvex_c/sim_unicorn.cpp
+++ simuvex_c/sim_unicorn.cpp
@@ -37,6 +37,7 @@
 typedef std::map<uint64_t, std::pair<char *, uint64_t>> PageCache;
 std::map<uint64_t, PageCache*> global_cache;

+typedef std::unordered_set<uint64_t> RegisterSet;

 typedef struct mem_access {
 	uint64_t address;
@@ -68,6 +69,8 @@
 	std::vector<mem_access_t> mem_writes;
 	std::map<uint64_t, taint_t *> active_pages;
 	std::unordered_set<uint64_t> stop_points;
+
+	std::unordered_set(uint64_t> symbolic_registers; // tracking of symbolic registers

 public:
 	std::vector<uint64_t> bbl_addrs;
@@ -434,6 +437,195 @@
 		return page_cache->find(address) != page_cache->end();
 	}

+	//
+	// Feasibility checks for unicorn
+	//
+
+	// check if we can safely handle this IRExpr
+	inline bool check_expr(IRExpr *e)
+	{
+		if (e == NULL) return true;
+		switch (e->tag)
+		{
+			case Iex_Binder:
+				break;
+			case Iex_VECRET:
+				break;
+			case Iex_BBPTR:
+				break;
+			case Iex_GetI:
+				// we can't handle this for the same reasons as PutI (see below)
+				return false;
+				break;
+			case Iex_RdTmp:
+				break;
+			case Iex_Get:
+				if (e->Iex.Get.ty == Ity_I1)
+				{
+					LOG_W("seeing a 1-bit get from a register");
+					return false;
+				}
+
+				int expr_size = sizeofIRType(e->Iex.Get.ty);
+				if (!this->check_register_read(e->Iex.Get.offset, expr_size)) return false;
+				break;
+			case Iex_Qop:
+				if (!this->check_expr(e->Iex.Qop.details.arg1)) return false;
+				if (!this->check_expr(e->Iex.Qop.details.arg2)) return false;
+				if (!this->check_expr(e->Iex.Qop.details.arg3)) return false;
+				if (!this->check_expr(e->Iex.Qop.details.arg4)) return false;
+				break;
+			case Iex_Triop:
+				if (!this->check_expr(e->Iex.Triop.details.arg1)) return false;
+				if (!this->check_expr(e->Iex.Triop.details.arg2)) return false;
+				if (!this->check_expr(e->Iex.Triop.details.arg3)) return false;
+				break;
+			case Iex_Binop:
+				if (!this->check_expr(e->Iex.Binop.arg1)) return false;
+				if (!this->check_expr(e->Iex.Binop.arg2)) return false;
+				break;
+			case Iex_Unop:
+				if (!this->check_expr(e->Iex.Unop.arg)) return false;
+				break;
+			case Iex_Load:
+				if (!this->check_expr(e->Iex.Load.addr)) return false;
+				break;
+			case Iex_Const:
+				break;
+			case Iex_ITE:
+				if (!this->check_expr(e->Iex.ITE.cond)) return false;
+				if (!this->check_expr(e->Iex.ITE.iffalse)) return false;
+				if (!this->check_expr(e->Iex.ITE.iftrue)) return false;
+				break;
+			case Iex_CCall:
+				for (int i = 0; i < 20; i++)
+				{
+					if (!this->check_expr(s->Iex.CCall.args[i])) return false;
+				}
+				break;
+		}
+
+		return true;
+	}
+
+	// mark the register as safe
+	inline void mark_register_safe(uint64_t offset, int size)
+	{
+		for (int i = 0; i < size; i++)
+			this->symbolic_registers->erase(offset+i);
+	}
+
+	// check register access
+	inline bool check_register_read(uint64_t offset, int size)
+	{
+		for (int i = 0; i < size; i++)
+		{
+			if (this->symbolic_registers->find(offset + i) != this->symbolic_registers->end())
+				return false;
+		}
+	}
+
+	// check if we can safely handle this IRStmt
+	inline void check_stmt(IRStmt *s)
+	{
+		switch (s->tag)
+		{
+			case Ist_Put:
+				if (!this->check_expr(s->Ist.Put.data)) return false;
+				IRType expr_type = typeOfIRTemp(s->Ist.Put.data);
+				if (expr_type == Ity_I1)
+				{
+					LOG_W("seeing a 1-bit write to a register");
+					return false;
+				}
+
+				int expr_size = sizeofIRType(expr_type);
+				this->mark_register_safe(s->Ist.Put.offset, expr_size);
+				break;
+			case Ist_PutI:
+				// we cannot handle the PutI because:
+				// 1. in the case of symbolic registers, we need to have a good
+				//    handle on what registers need to be synced back to angr.
+				// 2. this requires us to track all the writes
+				// 3. a PutI represents an indirect write into the registerfile,
+				//    and we can't figure out where it's writing to ahead of time
+				// 4. unicorn provides no way to hook register writes (and that'd
+				//    probably be prohibitively slow anyways)
+				// 5. so we're screwed
+				return false;
+				break;
+			case Ist_WrTmp:
+				if (!this->check_expr(s->Ist.WrTmp.data)) return false;
+				break;
+			case Ist_Store:
+				if (!this->check_expr(s->Ist.Store.addr)) return false;
+				if (!this->check_expr(s->Ist.Store.data)) return false;
+				break;
+			case Ist_CAS:
+				if (!this->check_expr(s->Ist.CAS.details.addr)) return false;
+				if (!this->check_expr(s->Ist.CAS.details.dataLo)) return false;
+				if (!this->check_expr(s->Ist.CAS.details.dataHi)) return false;
+				if (!this->check_expr(s->Ist.CAS.details.expdLo)) return false;
+				if (!this->check_expr(s->Ist.CAS.details.expdHi)) return false;
+				break;
+			case Ist_LLSC:
+				if (!this->check_expr(s->Ist.LLSC.addr)) return false;
+				if (!this->check_expr(s->Ist.LLSC.storedata)) return false;
+				break;
+			case Ist_Dirty:
+				if (!this->check_expr(s->Ist.Dirty.details.guard)) return false;
+				if (!this->check_expr(s->Ist.Dirty.details.mAddr)) return false;
+				for (int i = 0; i < 20; i++)
+				{
+					if (!this->check_expr(s->Ist.Dirty.details.args[i])) return false;
+				}
+				break;
+			case Ist_Exit:
+				if (!this->check_expr(s->Ist.Exit.guard)) return false;
+				if (!this->check_expr(s->Ist.Exit.dst)) return false;
+				break;
+			case Ist_LoadG:
+				if (!this->check_expr(s->Ist.LoadG.addr)) return false;
+				if (!this->check_expr(s->Ist.LoadG.alt)) return false;
+				if (!this->check_expr(s->Ist.LoadG.guard)) return false;
+				break;
+			case Ist_StoreG:
+				if (!this->check_expr(s->Ist.StoreG.addr)) return false;
+				if (!this->check_expr(s->Ist.StoreG.data)) return false;
+				if (!this->check_expr(s->Ist.StoreG.guard)) return false;
+				break;
+			case Ist_NoOp:
+			case Ist_IMark:
+			case Ist_AbiHint:
+			case Ist_MBE:
+				// no-ops for our purposes
+				break;
+			default:
+				LOG_W("Encountered unknown VEX statement -- can't determine safety.")
+				return false;
+		}
+
+		return true;
+	}
+
+	// check if the block is feasible
+	bool check_block(address, size)
+	{
+		// if there are no symbolic registers we're ok
+		if (state->symbolic_registers->size() == 0) return true;
+
+		void *instructions = malloc(size);
+		uc_mem_read(this->uc, address, instructions, size);
+		IRSB *the_block = vex_block_bytes(TODO, TODO, instructions, address, size, 0);
+
+		for (int i = 0; i < the_block->stmts_used; i++)
+		{
+			if (!this->check_stmt(the_block->stmts[i])) return false;
+		}
+		if (!this->check_expr(the_block->next)) return false;
+		return true;
+	}
+
 };

 static void hook_mem_read(uc_engine *uc, uc_mem_type type, uint64_t address, int size, int64_t value, void *user_data) {
@@ -553,7 +745,10 @@
 }

 static void hook_block(uc_engine *uc, uint64_t address, int32_t size, void *user_data) {
-	State *state = (State *)user_data;
+	LOG_I("block [%#lx, %#lx]", address, address + size);
+
+	if (!state->check_block(the_block)) return false;
+
 	if (state->ignore_next_block) {
 		state->ignore_next_block = false;
 		state->ignore_next_selfmod = true;
@@ -664,6 +859,15 @@
 	// LOG_D("activate [%#lx, %#lx]", address, address + length);
 	for (uint64_t offset = 0; offset < length; offset += 0x1000)
 		state->page_activate(address + offset, taint, offset);
+}
+
+extern "C"
+void symbolic_register_data(State *state, uint64_t count, uint64_t offsets*)
+{
+	for (int i = 0; i < count; i++)
+	{
+		state->symbolic_registers.insert(offsets[i]);
+	}
 }

 /*


database: fix open db from JS

database: fix open db from JS

--- platform/shared/db/DBAdapter.cpp
+++ platform/shared/db/DBAdapter.cpp
@@ -1408,7 +1408,11 @@
 void CRubyMutex::create()
 {
     if ( !m_bIgnore && !m_valMutex)
-        m_valMutex = rho_ruby_create_mutex();
+    {
+        unsigned long curThread = rho_ruby_current_thread();
+        if ( curThread != null )
+            m_valMutex = rho_ruby_create_mutex();
+    }
 }

 CRubyMutex::~CRubyMutex()


Change a place to addMajors

Change a place to addMajors

--- data-student.cpp
+++ data-student.cpp
@@ -5,7 +5,7 @@
 	name = n;
 	startingYear = s;
 	gradutationYear = g;
-	parseMajors(m);
+	addMajors(m);
 }

 Student::Student() {


new modulayy

new modulayy

--- plugins/modulay/gen_exported.cpp
+++ plugins/modulay/gen_exported.cpp
@@ -97,8 +97,8 @@
 		while ((__n--)) {
 			const double in1 = (*(__in1++));
 			double tap_190 = m_delay_3.read_linear(mstosamps_191);
-			double mix_196 = (m_y_1 + (clamp_173 * (tap_190 - m_y_1)));
-			double mix_170 = mix_196;
+			double mix_200 = (m_y_1 + (clamp_173 * (tap_190 - m_y_1)));
+			double mix_170 = mix_200;
 			double mul_187 = (mix_170 * mul_168);
 			m_cycle_14.freq(m_rate_4);
 			double cycle_176 = m_cycle_14(__sinedata);


Fixed a bug when image array in SPTracer::UpdateImage() would not be filled with color data

--- SPTracer/src/SPTracer.cpp
+++ SPTracer/src/SPTracer.cpp
@@ -208,7 +208,7 @@
 		double num = static_cast<double>(completedSamplesCount_ * waveLengthCount_);
 		std::vector<Vec3> xyzColor;
 		xyzColor.reserve(pixels_.size() / 3);
-		for (size_t i = 0; i < xyzColor.size(); i++)
+		for (size_t i = 0; i < (pixels_.size() / 3); i++)
 		{
 			xyzColor.push_back(Vec3{
 				static_cast<float>(pixels_[i * 3] / num),


alpha: fix shutdown crashes

alpha: fix shutdown crashes

--- plugins/single_plugins/alpha.cpp
+++ plugins/single_plugins/alpha.cpp
@@ -132,11 +132,14 @@

     void fini() override
     {
-        for (auto& view : output->workspace->get_views_in_layer(wf::ALL_LAYERS))
+        for (auto& view : wf::get_core().get_all_views())
         {
-            if (view->get_transformer("alpha"))
+            if (!view->get_output() || (view->get_output() == output))
             {
-                view->pop_transformer("alpha");
+                if (view->get_transformer("alpha"))
+                {
+                    view->pop_transformer("alpha");
+                }
             }
         }


Capstone header compatibility for older plugins

--- Lilu/Headers/kern_disasm.hpp
+++ Lilu/Headers/kern_disasm.hpp
@@ -7,6 +7,10 @@

 #ifndef kern_disasm_hpp
 #define kern_disasm_hpp
+
+#ifndef CAPSTONE_HAS_OSXKERNEL
+#define CAPSTONE_HAS_OSXKERNEL 1
+#endif

 #include <Headers/kern_config.hpp>
 #include <Headers/kern_util.hpp>


made system includes instead of project includes ( <> vs. "" )
now "make dep" shuts up about missing zlib.h and libmng.h

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@12218 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- plugins/video/loader/jng/jng.cpp
+++ plugins/video/loader/jng/jng.cpp
@@ -49,10 +49,10 @@

 #define MNG_NO_CMS
 #define MNG_USE_DLL
-#include "libmng.h"
+#include <libmng.h>

 #include "jng.h"
-#include "zlib.h"
+#include <zlib.h>

 CS_IMPLEMENT_PLUGIN


Applied HARMONY-3297 and HARMONY-3381 VM shutdown fixes

svn path=/harmony/; revision=517777

--- enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
+++ enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
@@ -84,33 +84,7 @@
 }

 static void vm_shutdown_callback() {
-    hythread_t   self_native;
-    jthread      self_java;
-    VM_thread *  self_vm;
-    JNIEnv     * jni_env;
-    Global_Env * vm_env;
-
-    self_native = hythread_self();
-    self_java = jthread_get_java_thread(self_native);
-    self_vm = get_vm_thread(self_native);
-
-    // Make sure the thread is still attached to the VM.
-    if (self_java == NULL || self_vm == NULL) {
-        return;
-    }
-
-    jni_env = jthread_get_JNI_env(self_java);
-    vm_env = jni_get_vm_env(jni_env);
-
-    // We need to be in suspend disabled state to be able to throw an exception.
-    assert(!hythread_is_suspend_enabled());
-
-    //hythread_suspend_disable();
-
-    // Raise an exception. In shutdown stage it should cause entire stack unwinding.
-    jthread_throw_exception_object(vm_env->java_lang_ThreadDeath);
-
-    //hythread_suspend_enable();
+    hythread_exit(NULL);
 }

 /**
@@ -124,66 +98,50 @@
     hythread_t * running_threads;
     hythread_t native_thread;
     hythread_iterator_t it;
-    VM_thread * vm_thread;
-    int size;
-    bool changed;
-    int left;
-    int prev;
+    VM_thread *vm_thread;

     self = hythread_self();

     // Collect running java threads.
-    size = 0;
+    // Set callbacks to let threads exit
+    TRACE2("shutdown", "stopping threads, self " << self);
     it = hythread_iterator_create(NULL);
     running_threads = (hythread_t *)apr_palloc(vm_env->mem_pool,
         hythread_iterator_size(it) * sizeof(hythread_t));
+    int size = 0;
     while(native_thread = hythread_iterator_next(&it)) {
-        vm_thread = get_vm_thread(native_thread);
-        if (vm_thread != NULL && native_thread != self) {
+    vm_thread = get_vm_thread(native_thread);
+        if (native_thread != self && vm_thread != NULL) {
+            hythread_set_safepoint_callback(native_thread, vm_shutdown_callback);
             running_threads[size] = native_thread;
             ++size;
         }
     }
     hythread_iterator_release(&it);

-    // Interrupt running threads.
+    TRACE2("shutdown", "joining threads");
+    // join running threads
+    // blocked and waiting threads won't be joined
     for (int i = 0; i < size; i++) {
-        hythread_interrupt(running_threads[i]);
-    }
-
-    left = size;
-    prev = -1;
-    // Spin until there is no running threads.
-    while (left > 0) {
-        do {
-            left = 0;
-            changed = false;
-            // Join or Interrupt.
-            for (int i = 0; i < size; i++) {
-                if (running_threads[i] == NULL) continue;
-                if (hythread_join_timed(running_threads[i], 100, 0) == TM_ERROR_NONE) {
-                    changed = true;
-                    running_threads[i] = NULL;
-                } else {
-                    hythread_interrupt(running_threads[i]);
-                    ++left;
-                }
-            }
-        } while(left > 0 && changed);
-
-        // We are stuck :-( Need to throw asynchronous exception.
-        if (left > 0) {
-            for (int i = 0; i < size; i++) {
-                if (running_threads[i] == NULL) continue;
-                if (left > 1 && i == prev) {
-                    continue;
-                } else {
-                    prev = i;
-                    hythread_set_safepoint_callback(running_threads[i], vm_shutdown_callback);
-                }
-            }
+        hythread_join_timed(running_threads[i], 100/size + 1, 0);
+    }
+
+    TRACE2("shutdown", "cancelling threads");
+    // forcedly kill remaining threads
+    // There is a small chance that some of these threads are not in the point
+    // safe for killing, e.g. in malloc()
+    it = hythread_iterator_create(NULL);
+    while(native_thread = hythread_iterator_next(&it)) {
+    vm_thread = get_vm_thread(native_thread);
+    // we should not cancel self and
+    // non-java threads (i.e. vm_thread == NULL)
+        if (native_thread != self && vm_thread != NULL) {
+            hythread_cancel(native_thread);
+            TRACE2("shutdown", "cancelling " << native_thread);
         }
-    }
+    }
+    hythread_iterator_release(&it);
+    TRACE2("shutdown", "shutting down threads complete");
 }

 /**
@@ -224,16 +182,25 @@
     status = exec_shutdown_sequence(jni_env);
     if (status != JNI_OK) return status;

-    // Send VM_Death event and switch to VM_Death phase.
-    // This should be the last event sent by VM.
-    // This event should be sent before Agent_OnUnload called.
-    jvmti_send_vm_death_event();
-
     // Raise uncaught exception to current thread.
     // It will be properly processed in jthread_detach().
     if (uncaught_exception) {
         exn_raise_object(uncaught_exception);
     }
+
+    // Stop all (except current) java and native threads
+    // before destroying VM-wide data.
+
+    // Stop java threads
+    vm_shutdown_stop_java_threads(java_vm->vm_env);
+
+    // TODO: ups we don't stop native threads as well :-((
+    // We are lucky! Currently, there are no such threads.
+
+    // Send VM_Death event and switch to DEAD phase.
+    // This should be the last event sent by VM.
+    // This event should be sent before Agent_OnUnload called.
+    jvmti_send_vm_death_event();

     // Detach current thread.
     status = jthread_detach(java_thread);
@@ -251,15 +218,7 @@
     assert(java_vm->vm_env->vm_state == Global_Env::VM_RUNNING);
     java_vm->vm_env->vm_state = Global_Env::VM_SHUTDOWNING;

-    // Stop all (except current) java and native threads
-    // before destroying VM-wide data.
-
-    // Stop java threads
-    vm_shutdown_stop_java_threads(java_vm->vm_env);
-
-    // TODO: ups we don't stop native threads as well :-((
-    // We are lucky! Currently, there are no such threads.
-
+    TRACE2("shutdown", "vm_destroy complete");
     return JNI_OK;
 }


Some fixes to make the KF macro working (was very old)

--- STEER/AliKFParticleTest.C
+++ STEER/AliKFParticleTest.C
@@ -154,6 +154,7 @@

   for (Int_t iTr=0; iTr<nESDTracks; iTr++)
     {
+      Printf("tracj %d", iTr);
       TESDTrackInfo &info = ESDTrackInfo[iTr];
       info.fOK = 0;
       info.fPrimUsedFlag = 0;
@@ -255,7 +256,7 @@

       //* Check chi^2 for a case

-      if( TMath::Sqrt( TMath::Abs(V0.GetChi2()/V0.GetNDF()) >3. )) continue;
+      if( TMath::Sqrt( TMath::Abs(V0.GetChi2()/V0.GetNDF())) >3. ) continue;

       //* Get V0 decay length with estimated error

@@ -292,7 +293,8 @@

-Int_t AliKFParticleTest(Int_t n1=0,Int_t n2=1000,char *dire="/d/alice10/sma/my_v4-05-Release/pp/"){
+//Int_t AliKFParticleTest(Int_t n1=0,Int_t n2=1000,char *dire="/d/alice10/sma/my_v4-05-Release/pp/"){
+Int_t AliKFParticleTest(Int_t n1=993,Int_t n2=999,char *dire="~/SOFT/AliRoot_git/AliRoot_20140223/test/genkine/TestKF/Events/"){
   //* Main macro

   //  LOOP  OVER  SERIES  OF  DIRECTORIES
@@ -306,6 +308,10 @@

     cout <<"  Opening "<<filename<<"\nand ESD "<<esdfile<<endl;

+    TFile* ftemp = TFile::Open(filename);
+    Printf("ftemp = %p", ftemp);
+    if (!ftemp) continue;
+
     if (gAlice) {
       delete AliRunLoader::Instance();
       delete gAlice;
@@ -328,8 +334,6 @@
       continue;
     }
     rl->LoadKinematics();
-    AliTracker::SetFieldMap(gAlice->Field(),1);
-    AliKFParticle::SetField( AliTracker::GetBz() );

     //---------------------------------------//
     //                                       //
@@ -344,7 +348,7 @@
     if (!ef || !ef->IsOpen()) {cerr<<"Error open AliESDs.root !\n"; continue ;}

     //create event object
-    AliESD *event = new AliESDEvent;
+    AliESDEvent *event = new AliESDEvent;

     //Set pointer to the esd tree in the file
     TTree* tree = (TTree*) ef->Get("esdTree");
@@ -353,7 +357,7 @@
     if (!tree) {cerr<<"no ESD tree found\n"; continue;};

     //Set pointer to the esd object in the tree
-    event->ReadFromTree(event);
+    event->ReadFromTree(tree);

     //Number of events
     Int_t nevents=tree->GetEntriesFast();
@@ -363,6 +367,7 @@
     for (Int_t iev=0; iev<nevents; iev++){
       tree->GetEvent(iev);
       rl->GetEvent(iev);
+      AliKFParticle::SetField(event->GetMagneticField());
       RunV0(event);
     }
     EndV0();


COMP: warnings

COMP: warnings

--- Testing/Code/BasicFilters/itkPolylineMaskImageFilterTest.cxx
+++ Testing/Code/BasicFilters/itkPolylineMaskImageFilterTest.cxx
@@ -27,7 +27,7 @@
 #include <itkImageFileWriter.h>
 #include <iostream>

-int itkPolylineMaskImageFilterTest(int argc, char * argv[] )
+int itkPolylineMaskImageFilterTest(int , char * [] )
 {
   /*
   if(argc < 3)


fix of unitialized pointer in old format of tracklet->track references

--- STEER/AliMultiplicity.cxx
+++ STEER/AliMultiplicity.cxx
@@ -391,7 +391,10 @@
   fDeltTh[id]  = tlet[3];
   fLabels[id]   = Int_t(tlet[4]);
   fLabelsL2[id] = Int_t(tlet[5]);
-  if (!GetMultTrackRefs()) fUsedClusT[id] = (((ULong64_t)trSPD2)<<32) + trSPD1;
+  if (!GetMultTrackRefs()) {
+    if (!fUsedClusT) {fUsedClusT = new ULong64_t[fNtracks]; memset(fUsedClusT,0,fNtracks*sizeof(ULong64_t));}
+    fUsedClusT[id] = (((ULong64_t)trSPD2)<<32) + trSPD1;
+  }
   //
 }

@@ -403,7 +406,10 @@
   fThsingle[id]  = scl[0];
   fPhisingle[id] = scl[1];
   fLabelssingle[id] = Int_t(scl[2]);
-  if (!GetMultTrackRefs()) fUsedClusS[id] = tr;
+  if (!GetMultTrackRefs()) {
+    if (!fUsedClusS) {fUsedClusS = new UInt_t[fNsingle]; memset(fUsedClusS,0,fNsingle*sizeof(UInt_t));}
+    fUsedClusS[id] = tr;
+  }
   //
 }

@@ -546,8 +552,8 @@
 	 fNtracks,fNsingle,GetMultTrackRefs() ? "ON":"OFF",
 	 fDPhiShift,fDPhiWindow2,fDThetaWindow2,fNStdDev,GetScaleDThetaBySin2T() ? "ON":"OFF");
   TString opts = opt; opts.ToLower();
-  int t0spd1=-1,t1spd1=-1,t0spd2=-1,t1spd2=-1;
-  UInt_t t[2][2][10],nt[2][2];
+  int t0spd1=-1,t1spd1=-1,t0spd2=-1,t1spd2=-1,nt[2][2]={{0}};
+  UInt_t t[2][2][10]={{{0}}};
   //
   if (opts.Contains("t")) {
     for (int i=0;i<fNtracks;i++) {


ATO-300 - AliESDtrack::GetTPCClusterInfo - adding type 3 and 4 to define findable cluster only in case cluster before AND after exist, similar as used in TPC dEdx calculation. Default type value is kept OR as before.

--- STEER/ESD/AliESDtrack.cxx
+++ STEER/ESD/AliESDtrack.cxx
@@ -2096,6 +2096,8 @@
   // type 0: get fraction of found/findable clusters with neighbourhood definition
   //      1: findable clusters with neighbourhood definition
   //      2: found clusters
+  //      3: get fraction of found/findable clusters with neighbourhood definition - requiring before and after row
+  //      4: findable clusters with neighbourhood definition - before and after row
   // bitType:
   //      0 - all cluster used
   //      1 - clusters  used for the kalman update
@@ -2110,9 +2112,36 @@
   Int_t findable=0;
   Int_t last=-nNeighbours;
   const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
+

   Int_t upperBound=clusterMap.GetNbits();
   if (upperBound>row1) upperBound=row1;
+  if (type>=3){ // requires cluster before and after
+    for (Int_t i=row0; i<upperBound; ++i){
+      Int_t beforeAfter=0;
+      if (clusterMap[i]) {
+	last=i;
+	++found;
+	++findable;
+	continue;
+      }
+      if ((i-last)<=nNeighbours) {
+	++beforeAfter;
+      }
+      //look to nNeighbours after
+      for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
+	if (clusterMap[j]){
+	  ++beforeAfter;
+	  break;
+	}
+      }
+      if (beforeAfter>1) ++findable;
+    }
+    if (type==3) return Float_t(found)/Float_t(TMath::Max(findable,1));
+    if (type==4) return findable;
+    return 0;
+  }
+
   for (Int_t i=row0; i<upperBound; ++i){
     //look to current row
     if (clusterMap[i]) {


start form saved potential

start form saved potential

--- apps/dft_loop/dft_loop.cpp
+++ apps/dft_loop/dft_loop.cpp
@@ -61,18 +61,16 @@
         Density* density = new Density(parameters);
         density->allocate();

-        //if (Utils::file_exists(storage_file_name))
-        //{
-        //    density->load();
-        //    potential->load();
-        //}
-        //else
-        //{
-        //    density->initial_density();
-        //}
+        if (Utils::file_exists(storage_file_name))
+        {
+            density->load();
+            potential->load();
+        }
+        else
+        {
+            density->initial_density();
+        }

-        density->initial_density();
-
         DFT_ground_state dft(parameters, potential, density, &ks);
         double potential_tol = parser["potential_tol"].get(1e-4);
         double energy_tol = parser["energy_tol"].get(1e-4);


ebrogold: changed default threshold

ebrogold: changed default threshold

--- apps/ebrogold/ebrogold.cpp
+++ apps/ebrogold/ebrogold.cpp
@@ -69,7 +69,7 @@

 static int print_verbose = 0;
 static const char *prefixes[NGRIDS] = { NULL, NULL };
-static unsigned long threshold = 20000;
+static unsigned long threshold = 10000;
 // window radius in nanometers
 static RNScalar window_radius = 600;


Fix some scheduling bugs.

Fix some scheduling bugs.

--- apps/fft/fft_generator.cpp
+++ apps/fft/fft_generator.cpp
@@ -146,10 +146,17 @@

         output.dim(0).set_stride(output_comps)
               .dim(2).set_min(0).set_extent(output_comps).set_stride(1);
+
+	if (output_comps != 1) {
+  	    output.reorder(c, x, y).unroll(c);
+	}

         if (real_result.defined()) {
-            real_result.compute_at(output, y);
-        }
+  	    real_result.compute_at(output, Var::outermost());
+        } else {
+	    assert(complex_result.defined());
+	    complex_result.compute_at(output, Var::outermost());
+	}
     }
 private:
     Var x{"x"}, y{"y"}, c{"c"};


Elimated the assignments within conditional expression wanings under MSVC.

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@9393 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- apps/perftest/perftest.cpp
+++ apps/perftest/perftest.cpp
@@ -239,7 +239,8 @@
   const char *val;
   iCommandLineParser* cmdline = CS_QUERY_REGISTRY (object_reg,
   	iCommandLineParser);
-  if ((val = cmdline->GetOption ("2d")))
+  val = cmdline->GetOption ("2d");
+  if (val)
   {
     current_tester = new StringTester ();
     draw_3d = false;
@@ -247,7 +248,8 @@
   else
     current_tester = new SinglePolygonTester ();

-  if ((val = cmdline->GetOption ("3d")))
+  val = cmdline->GetOption ("3d");
+  if (val)
     draw_2d = false;
   cmdline->DecRef ();


making the default output more closely match what Visual Studio expects

--- xUnit++/DefaultReporter.cpp
+++ xUnit++/DefaultReporter.cpp
@@ -1,4 +1,5 @@
 #include "DefaultReporter.h"
+#include <cstdio>
 #include <iostream>
 #include "TestDetails.h"

@@ -13,8 +14,8 @@

     void ReportFailure(const TestDetails &testDetails, const std::string &msg)
     {
-        std::cout << (testDetails.Filename + ":" + std::to_string(testDetails.Line) +
-            " error: Test [" + testDetails.Name + "] failed with: " + msg + "\n");
+        std::cerr << (testDetails.Filename + "(" + std::to_string(testDetails.Line) +
+            "): error " + testDetails.Name + ": " + msg + "\n");
     }

     void ReportFinish(const TestDetails &, std::chrono::milliseconds)


Changed cout to ROS_INFO() to get time-stamps

--- dronemis/src/OpenCv/QR.cpp
+++ dronemis/src/OpenCv/QR.cpp
@@ -110,9 +110,9 @@
     int i = 0;
     ifstream file ( "../workspaces/dronemis_ws/src/dronemis/src/OpenCv/WallCoordinates.csv" );
     if (!file.good())
-        cout << "Unable to read QR csv file" << endl;
+        ROS_INFO("Unable to read QR csv file");
+
     getline(file, value);
-
     while (!file.eof()) {
         getline ( file, value, ';' );
         QRWallCode[i].name = value;
@@ -123,7 +123,7 @@
         i++;
     }

-    cout << i << " QR codes initialized" << endl;
+    ROS_INFO("%d QR codes initialized", i);

     distanceToQR[38] = 310;
     distanceToQR[39] = 298;


Cleanup precursor patch #1: Reorder a few bits and eliminate a pointless (redundant) test.

BUG=54274
TEST=none
Review URL: http://codereview.chromium.org/4741002

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

--- chrome/browser/google/google_url_tracker_unittest.cc
+++ chrome/browser/google/google_url_tracker_unittest.cc
@@ -37,14 +37,14 @@
   bool notified_;
 };

-class TestInfoBar : public InfoBarDelegate {
+class TestInfoBarDelegate : public InfoBarDelegate {
  public:
-  TestInfoBar(GoogleURLTracker* google_url_tracker,
-              const GURL& new_google_url)
+  TestInfoBarDelegate(GoogleURLTracker* google_url_tracker,
+                      const GURL& new_google_url)
       : InfoBarDelegate(NULL),
         google_url_tracker_(google_url_tracker),
         new_google_url_(new_google_url) {}
-  virtual ~TestInfoBar() {}
+  virtual ~TestInfoBarDelegate() {}
   GoogleURLTracker* google_url_tracker() const { return google_url_tracker_; }
   const GURL& new_google_url() const { return new_google_url_; }

@@ -61,7 +61,7 @@
   virtual InfoBarDelegate* CreateInfoBar(TabContents* tab_contents,
                                          GoogleURLTracker* google_url_tracker,
                                          const GURL& new_google_url) {
-    return new TestInfoBar(google_url_tracker, new_google_url);
+    return new TestInfoBarDelegate(google_url_tracker, new_google_url);
   }
 };

@@ -190,13 +190,13 @@
   }

   GURL GetInfoBarShowingURL() {
-    TestInfoBar* infobar = static_cast<TestInfoBar*>(
+    TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>(
         g_browser_process->google_url_tracker()->infobar_);
     return infobar->new_google_url();
   }

   void AcceptGoogleURL() {
-    TestInfoBar* infobar = static_cast<TestInfoBar*>(
+    TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>(
         g_browser_process->google_url_tracker()->infobar_);
     ASSERT_TRUE(infobar);
     ASSERT_TRUE(infobar->google_url_tracker());
@@ -204,7 +204,7 @@
   }

   void CancelGoogleURL() {
-    TestInfoBar* infobar = static_cast<TestInfoBar*>(
+    TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>(
         g_browser_process->google_url_tracker()->infobar_);
     ASSERT_TRUE(infobar);
     ASSERT_TRUE(infobar->google_url_tracker());
@@ -212,7 +212,7 @@
   }

   void InfoBarClosed() {
-    TestInfoBar* infobar = static_cast<TestInfoBar*>(
+    TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>(
         g_browser_process->google_url_tracker()->infobar_);
     ASSERT_TRUE(infobar);
     ASSERT_TRUE(infobar->google_url_tracker());
@@ -239,6 +239,17 @@
   URLRequestContextGetter* original_default_request_context_;
 };

+TEST_F(GoogleURLTrackerTest, StartupSleepFinishNoObserver) {
+  CreateRequestContext();
+
+  ExpectDefaultURLs();
+
+  FinishSleep();
+  EXPECT_FALSE(GetFetcherByID(0));
+
+  ExpectDefaultURLs();
+}
+
 TEST_F(GoogleURLTrackerTest, StartupSleepFinish) {
   CreateRequestContext();

@@ -271,15 +282,26 @@
             GoogleURLTracker::GoogleURL());
 }

-TEST_F(GoogleURLTrackerTest, StartupSleepFinishNoObserver) {
-  CreateRequestContext();
-
-  ExpectDefaultURLs();
-
-  FinishSleep();
-  EXPECT_FALSE(GetFetcherByID(0));
-
-  ExpectDefaultURLs();
+TEST_F(GoogleURLTrackerTest, UpdatePromptedURLWhenBack) {
+  CreateRequestContext();
+  SetLastPromptedGoogleURL(GURL("http://www.google.co.jp/"));
+  SetGoogleURL(GURL("http://www.google.co.uk/"));
+
+  RequestServerCheck();
+  FinishSleep();
+  MockSearchDomainCheckResponse(0, ".google.co.uk");
+
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
+
+  SearchCommitted(GURL("http://www.google.co.uk/search?q=test"));
+  NavEntryCommitted();
+
+  EXPECT_FALSE(InfoBarIsShown());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
 }

 TEST_F(GoogleURLTrackerTest, MonitorNetworkChange) {
@@ -334,17 +356,29 @@
   EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
 }

-TEST_F(GoogleURLTrackerTest, NoSearchCommitedAndPromptedNotChanged) {
-  CreateRequestContext();
-  SetLastPromptedGoogleURL(GURL("http://www.google.co.uk/"));
-  RequestServerCheck();
-  EXPECT_FALSE(GetFetcherByID(0));
-  ExpectDefaultURLs();
-
-  FinishSleep();
-  MockSearchDomainCheckResponse(0, ".google.co.jp");
-
-  EXPECT_EQ(GURL("http://www.google.co.jp/"), GetFetchedGoogleURL());
+TEST_F(GoogleURLTrackerTest, InitialUpdate) {
+  CreateRequestContext();
+  ExpectDefaultURLs();
+  EXPECT_EQ(GURL(), GetLastPromptedGoogleURL());
+
+  RequestServerCheck();
+  EXPECT_FALSE(GetFetcherByID(0));
+  ExpectDefaultURLs();
+  EXPECT_EQ(GURL(), GetLastPromptedGoogleURL());
+
+  FinishSleep();
+  MockSearchDomainCheckResponse(0, ".google.co.uk");
+
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
+
+  SearchCommitted(GURL("http://www.google.co.uk/search?q=test"));
+  NavEntryCommitted();
+
+  EXPECT_FALSE(InfoBarIsShown());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
+  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
   EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
 }

@@ -456,51 +490,3 @@
   EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL());
   EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL());
 }
-
-TEST_F(GoogleURLTrackerTest, InitialUpdate) {
-  CreateRequestContext();
-  ExpectDefaultURLs();
-  EXPECT_EQ(GURL(), GetLastPromptedGoogleURL());
-
-  RequestServerCheck();
-  EXPECT_FALSE(GetFetcherByID(0));
-  ExpectDefaultURLs();
-  EXPECT_EQ(GURL(), GetLastPromptedGoogleURL());
-
-  FinishSleep();
-  MockSearchDomainCheckResponse(0, ".google.co.uk");
-
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
-
-  SearchCommitted(GURL("http://www.google.co.uk/search?q=test"));
-  NavEntryCommitted();
-
-  EXPECT_FALSE(InfoBarIsShown());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
-}
-
-TEST_F(GoogleURLTrackerTest, UpdatePromptedURLWhenBack) {
-  CreateRequestContext();
-  SetLastPromptedGoogleURL(GURL("http://www.google.co.jp/"));
-  SetGoogleURL(GURL("http://www.google.co.uk/"));
-
-  RequestServerCheck();
-  FinishSleep();
-  MockSearchDomainCheckResponse(0, ".google.co.uk");
-
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
-
-  SearchCommitted(GURL("http://www.google.co.uk/search?q=test"));
-  NavEntryCommitted();
-
-  EXPECT_FALSE(InfoBarIsShown());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
-  EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
-}


Disable it for real this time.

Disable it for real this time.

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

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

Former-commit-id: 1c420f8eeb87e7d330e930696229a821f43e2f07


Coverity: Remove DCHECK failure handler in MalwareDOMDetails::ExtractResources.

CID=14981
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6673005

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

--- chrome/renderer/safe_browsing/malware_dom_details.cc
+++ chrome/renderer/safe_browsing/malware_dom_details.cc
@@ -57,8 +57,6 @@
   for (; cur_frame;
        cur_frame = cur_frame->traverseNext(false /* don't wrap around */)) {
     DCHECK(cur_frame);
-    if (!cur_frame)
-      break;
     ViewHostMsg_MalwareDOMDetails_Node frame_node;
     frame_node.url = GURL(cur_frame->url());
     WebKit::WebDocument doc = cur_frame->document();


Fix missing include

Fix missing include

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

--- chrome/renderer/safe_browsing/phishing_classifier.cc
+++ chrome/renderer/safe_browsing/phishing_classifier.cc
@@ -9,6 +9,7 @@
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/logging.h"
+#include "base/message_loop.h"
 #include "base/string_util.h"
 #include "chrome/common/safe_browsing/csd.pb.h"
 #include "chrome/common/url_constants.h"


Add test name to OOP timeout log message so the log parser knows which one timed out.

BUG=34764
TEST=buildbot waterfall reports don't show "did not complete" when test times out
Review URL: http://codereview.chromium.org/2342002

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

Former-commit-id: b0143904bcf1adcc4cc09d896ce1901a4b8260b5

--- chrome/test/test_launcher/out_of_proc_test_runner.cc
+++ chrome/test/test_launcher/out_of_proc_test_runner.cc
@@ -77,7 +77,7 @@
     if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code,
                                           test_terminate_timeout_ms)) {
       LOG(ERROR) << "Test timeout (" << test_terminate_timeout_ms
-                 << " ms) exceeded!";
+                 << " ms) exceeded for " << test_name;

       exit_code = -1;  // Set a non-zero exit code to signal a failure.


renamed Create to From

renamed Create to From

--- Enumeration.hpp
+++ Enumeration.hpp
@@ -3,6 +3,21 @@

 namespace Linqpp
 {
+	template <class Iterator>
+	class Enumeration;
+
+	template <class Iterator>
+	auto From(Iterator first, Iterator last)
+	{
+		return Enumerable<Iterator>(first, last);
+	}
+
+	template <class Container>
+	auto From(Container&& container)
+	{
+		return From(std::begin(std::forward<Container>(container)), std::end(std::forward<Container>(container)));
+	}
+
 	template <class Iterator>
 	class Enumeration
 	{
@@ -33,22 +48,10 @@

 		size_t Count() const { return std::distance(_first, _last); }

-		auto Skip(size_t n) const { return Create(std::next(_first, n), _last); }
+		auto Skip(size_t n) const { return From(std::next(_first, n), _last); }

-		auto Take(size_t n) const { return Create(_first, std::next(_first, n)); }
+		auto Take(size_t n) const { return From(_first, std::next(_first, n)); }

 		auto ToVector() const { return std::vector<value_type>(_first, _last); }
 	};
-
-	template <class Iterator>
-	auto From(Iterator first, Iterator last)
-	{
-		return Enumerable<Iterator>(first, last);
-	}
-
-	template <class Container>
-	auto From(Container&& container)
-	{
-		return From(std::begin(std::forward<Container>(container)), std::end(std::forward<Container>(container)));
-	}
 }


Update SampleCode.cpp

Update SampleCode.cpp

--- test/SampleCode.cpp
+++ test/SampleCode.cpp
@@ -1,5 +1,5 @@
 // This file (SampleCode.cpp) was converted from SampleCode.Bas
-// with uCalc Transform 2.5 on 2/24/2014 3:28:33 PM using the Open Source
+// with uCalc Transform 2.5 on 2/25/2014 7:51:19 AM using the Open Source
 // PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

 #include <math.h>
@@ -49,6 +49,7 @@
    unsigned char Blue : 1;
    unsigned char Green : 1;
    double Other;
+   long double xyz;
 };

 int MyFunc(int x)
@@ -191,7 +192,7 @@
 float MyValue;
 string Label;
 Currency Price;
-double ExtVal;
+long double ExtVal;
 __int64 qNum;

 int TestFunc(int& a, unsigned char& b, int& c, short& i, String& s, float& n)
@@ -231,7 +232,7 @@
 extern __declspec(dllimport) int SetCursorPos(int x, int y);
 extern __declspec(dllimport) void SetLastError(unsigned int dwErrCode);

-void DoSomething(int Arg1, string& txt, double& Number, Optional unsigned int *xyz)
+void DoSomething(int Arg1, string& txt, long double& Number, Optional unsigned int *xyz)
 {
    SetCursorPos(10, Arg1 + 5);
    if (Arg1 == 15) {
@@ -241,8 +242,8 @@

 float main()
 {
-   double x;
-   double pi;
+   long double x;
+   long double pi;
    string MyString;
    DoSomething(Len("Test")+5, "Hello " + "world!", Sin(x+1)*pi, &x-4) //  Comment

@@ -318,7 +319,7 @@
    PB_REPLACE(MyText, "abc", "xyz");
    PB_REPLACE_ANY(MyText, "abc", "xyz");
    if (PB_MID(MyText, 3, 5) == y) {
-      PB_MID_REPLACE(MyText, "Test" + to_string(i*15), 20, FULL_STRING);
+      PB_MID_REPLACE(MyText, "Test" + to_string((long double)i*15), 20, FULL_STRING);
    }
    PB_MID_REPLACE(x, y, 25, stold(y) +1);
    PB_MID_REPLACE(MyString, PB_MID(y, stold(x), 7), 25, 5);


Update SampleCode.cpp

Update SampleCode.cpp

--- test/SampleCode.cpp
+++ test/SampleCode.cpp
@@ -1,5 +1,5 @@
 // This file (SampleCode.cpp) was converted from SampleCode.Bas
-// with uCalc Transform 2.95 on 4/11/2014 3:02:25 PM using the Open Source
+// with uCalc Transform 2.95 on 4/14/2014 5:48:27 PM using the Open Source
 // PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

 #include "pbOS.h"
@@ -45,16 +45,41 @@
    int y;
 };

-struct MyBits {
+struct TestType {
+   int a;
+   int *b;
+   point c;
+   point *d;
+};
+
+struct OtherType {
+   int First;
+   int *Second;
+   TestType *Third;
+};
+
+struct MyBits { // A comment goes here
    unsigned int Year : 7;
    unsigned int Month : 5;
    unsigned int DayOfMonth : 4;
    unsigned int DayOfWeek : 3;
-   unsigned char Red : 1;
-   unsigned char Blue : 1;
+   unsigned char Red : 1; // A comment here
+   unsigned char Blue : 1; // A comment there
    unsigned char Green : 1;
    double Other;
    long double xyz;
+};
+
+union MyUnion {
+   int x;
+   unsigned int y;
+   float z;
+};
+
+union OtherUinion { // A comment goes here
+   int xx;
+   unsigned int yy;
+   float zz;
 };

 int MyFunc(int x)
@@ -109,13 +134,11 @@
    z = (Number.size()-1);

    if (x == 0) { // If Then
-
       ProgStatus = 10;
       y = x + 1;
       z = y+x;
       Other[x] = x+1;
    } else if (x == -1) { // Test for ElseIf
-
       while (x < 10) {
          y = MyFunction(x, *Test);
          Test = &x;
@@ -135,7 +158,6 @@
    } else if (x == 1) {
       PB_SLEEP(2+y);
    } else { // Test for Else
-
       ProgStatus = 25;
       if (x == 2) {
          y = x * 25;
@@ -144,6 +166,26 @@
          Other[1] = x+1;
       }
    }
+
+   OtherType t1;
+   OtherType *t2;
+
+   i = t1.First;
+   i = *t1.Second;
+   i = t1.Third;
+   i = t1.Third->a;
+   i = t1.Third->b;
+   i = *t1.Third->b;
+   i = t1.Third->x->x;
+
+   i = t2->First;
+   i = *t2->Second;
+   i = t2->Third;
+   i = t2->Third->a;
+   i = t2->Third->b;
+   i = *t2->Third->b;
+   i = t2->Third->x->x;
+   i = *t1.Second + t1.Third->b + t2->First + *t2->Second + t2->Third->a + *t2->Third->b + t2->Third->x->x;
 }

 void TestCertainOperators(int x, /* ' This line is broken up using a _ (underscore) */
@@ -158,7 +200,7 @@
    Point *pp;
    int n;

-   for (x=1; x<=10; x += 1) {
+   for (x=1; x<=10; x += 1) { // Just a test {comment}.
       n = y == z // This works differently in PB than in C++
       MyArray[x] = x*2;
       if (x == 5) {
@@ -204,7 +246,7 @@
       pp = &p;
       MyPoint.x = MyPoint.y+1;
       n = MyPoint.x == MyPoint.y;
-      *pp.x = *pp.y == *pp.x+1;
+      pp->x = pp->y == pp->x+1;
    }
 }

@@ -227,6 +269,7 @@
    cout << endl;

    Label = "Missing quote at the end of this line is added by Refactor.uc";
+   return b + c;
 }

 string Report(string& LastName, int x, double& NewPrice, float& n, short i, float& nValue, __int64& qValue)
@@ -386,8 +429,13 @@
    i = PB_INSTR_ANY(1, MyString, "aeiou");
    i = PB_INSTR(i+10, "This is a test", "is");
    i = PB_INSTR_ANY(1, "This is a test", "aeiou");
-   i = PB_ASC("This is a test", 1);
-   i = PB_ASC("This is a test", 10);
+   i = PB_ASC(MyText, 1);
+   i = PB_ASC(MyText, 5);
+   i = 'T';
+   i = 'a';
+   i = PB_ASC("This is a test", 10+i);
+   i = 'A' + 32;
+   i = 's';
    y = PB_UCASE(MyString) + PB_LCASE(MyString);
    x = string(25, ' ') + string(10, '*') + string(10, 65);
    x = PB_TRIM_ANY(x, " ")+PB_LTRIM_ANY(x, " ")+PB_RTRIM_ANY(x, " ")+PB_TRIM_ANY(x, ".,! ")+PB_LTRIM_ANY(x, ".,! ")+PB_RTRIM_ANY(x, ".,! ");
@@ -429,6 +477,25 @@

 extern "C" __declspec(dllexport) void __stdcall MyExportSub(int a, unsigned char b) {
    DoSomething(1, "xyz", 2, 3);
+    {
+      auto CASE_VAR = StringTest("abc", q);
+      if (CASE_VAR == "a" || CASE_VAR == "b" || CASE_VAR == "c") {
+         cout << "Test" << endl;
+      } else if (CASE_VAR == "x") {
+
+      } else if (CASE_VAR == q) {
+          {
+            auto CASE_VAR = (rand() % (10) + (1));
+            if (CASE_VAR == 1) {
+               cout << 1+1 << endl;
+            } else if (CASE_VAR == 2) {
+               cout << "Do some thing" << endl;
+            } else {
+               cout << "Whatever" << endl;
+            }
+         }
+      }
+   }
 }

 // Math test


Update SampleCode.cpp

Update SampleCode.cpp

--- test/SampleCode.cpp
+++ test/SampleCode.cpp
@@ -1,13 +1,16 @@
 // This file (SampleCode.cpp) was converted from SampleCode.Bas
-// with uCalc Transform 2.95 on 05/01/14 using the Open Source
+// with uCalc Transform 2.96 on 05/05/14 using the Open Source
 // PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

+#include "stdafx.h"
 #include "pbOS.h"
 #include "pbMisc.h"
+#include <vector>
 #include <cstdarg>
 #include <cmath>
 #include <cstdlib>
 #include <iostream>
+#include <iomanip>
 #include <fstream>
 #include <algorithm>
 #include <string>
@@ -62,26 +65,26 @@
 };

 struct MyBits { // A comment goes here
-   unsigned int Year : 7;
-   unsigned int Month : 5;
-   unsigned int DayOfMonth : 4;
-   unsigned int DayOfWeek : 3;
-   unsigned char Red : 1; // A comment here
-   unsigned char Blue : 1; // A comment there
-   unsigned char Green : 1;
+   unsigned Year : 7;
+   unsigned Month : 5;
+   unsigned DayOfMonth : 4;
+   unsigned DayOfWeek : 3;
+   UCHAR Red : 1; // A comment here
+   UCHAR Blue : 1; // A comment there
+   UCHAR Green : 1;
    double Other;
-   long double xyz;
+   EXTENDED xyz;
 };

 union MyUnion {
    int x;
-   unsigned int y;
+   unsigned y;
    float z;
 };

 union OtherUinion { // A comment goes here
    int xx;
-   unsigned int yy;
+   unsigned yy;
    float zz;
 };

@@ -91,7 +94,7 @@
    int y;
    union {
       int x;
-      unsigned int y;
+      unsigned y;
       float z;
    };
 };
@@ -108,7 +111,7 @@
    int y;
    union {
       int x;
-      unsigned int y;
+      unsigned y;
       float z;
    };

@@ -155,7 +158,7 @@
    }
 }

-void MySub(int x, double dArray[])
+void MySub(int x, std::vector<double>& dArray)
 {
    short i; // Implicit

@@ -296,12 +299,12 @@
 float MyValue;
 string Label;
 Currency Price;
-long double ExtVal;
+EXTENDED ExtVal;
 __int64 qNum;
 std::vector<int> gArray;
 std::vector<float> gArray2;

-int TestFunc(int& a, unsigned char& b, int& c, short& i, string& s, float& n)
+int TestFunc(int& a, UCHAR& b, int& c, short& i, string& s, float& n)
 {
    double PriceB; // Implicit

@@ -316,7 +319,7 @@
 string Report(string& LastName, int x, double& NewPrice, float& n, short i, float& nValue, __int64& qValue)
 {
    string FirstName;
-   unsigned char Age;
+   UCHAR Age;
    double Total;
    static int Index;

@@ -330,7 +333,8 @@
    return txt + " friend!";
 }

-unsigned char  Bye() {
+UCHAR Bye()
+{
    cout << "Bye" << endl;
 }

@@ -339,11 +343,11 @@
 // without parentheses.  The converter adds them.

 //#Include "Win32API.inc"
-extern __declspec(dllimport) unsigned int ShellExecute(unsigned int hwnd, lpOperation As LPCSTR, lpFile As LPCSTR, lpParameters As LPCSTR, lpDirectory As LPCSTR, int nShowCmd);
+extern __declspec(dllimport) unsigned ShellExecute(unsigned hwnd, lpOperation As LPCSTR, lpFile As LPCSTR, lpParameters As LPCSTR, lpDirectory As LPCSTR, int nShowCmd);
 extern __declspec(dllimport) int SetCursorPos(int x, int y);
-extern __declspec(dllimport) void SetLastError(unsigned int dwErrCode);
-
-void DoSomething(int Arg1, string& txt, long double& Number, Optional unsigned int *xyz)
+extern __declspec(dllimport) void SetLastError(unsigned dwErrCode);
+
+void DoSomething(int Arg1, string& txt, EXTENDED& Number, Optional unsigned *xyz)
 {
    SetCursorPos(10, Arg1 + 5);
    if (Arg1 == 15) {
@@ -360,13 +364,13 @@
    short i; // Implicit
    short InFile; // Implicit

-   long double x;
-   long double pi;
+   EXTENDED x;
+   EXTENDED pi;
    string MyString;
    string FileInfo;
    std::vector<string> MyFile[50+1];
    int n;
-   unsigned int dwTest;
+   unsigned dwTest;
    string Num;
    std::vector<double> mArray[10+1];

@@ -464,7 +468,7 @@
    int Auto_Renamed;
    int Break_Renamed;
    double Float_Renamed;
-   unsigned char char_Renamed;
+   UCHAR char_Renamed;
    int This_Renamed;

    Break_Renamed = False_Renamed;
@@ -544,7 +548,7 @@
    StringTest("abc", "xyz");
 }

-extern "C" __declspec(dllexport) void __stdcall MyExportSub(int a, unsigned char b) {
+extern "C" __declspec(dllexport) void __stdcall MyExportSub(int a, UCHAR b) {
    __int64 q; // Implicit

    DoSomething(1, "xyz", 2, 3);
@@ -573,7 +577,7 @@
 // If x Mod 2 > Cint(Sqr(x^2 + y^2)) Then Incr q Else Decr q
 double DoMath()
 {
-   long double MyVar; // Implicit
+   EXTENDED MyVar; // Implicit
    float n; // Implicit
    __int64 q; // Implicit
    float x; // Implicit
@@ -627,7 +631,7 @@
 void PrintTest()
 {
    int a; // Implicit
-   unsigned char b; // Implicit
+   UCHAR b; // Implicit
    int c; // Implicit
    int d; // Implicit
    int e; // Implicit
@@ -660,12 +664,12 @@
    __int64 b1; // Implicit
    int b2; // Implicit
    short b3; // Implicit
-   unsigned char b4; // Implicit
-   unsigned short b5; // Implicit
-   unsigned int b6; // Implicit
+   UCHAR b4; // Implicit
+   USHORT b5; // Implicit
+   unsigned b6; // Implicit
    float b7; // Implicit
    double B8; // Implicit
-   long double B9; // Implicit
+   EXTENDED B9; // Implicit
    short i; // Implicit
    int LastNum; // Implicit
    float OtherValue; // Implicit


Grouping algorithm is working now, with bug sometime, debugging

--- test/basic_trie.cpp
+++ test/basic_trie.cpp
@@ -279,8 +279,6 @@
    * Grouping algorithm
    * Use the is_cross_pattern function to check the grouping number
   */
-
-
   vector<uint32_t> groupVector;

   for (int i = 0; i < pingRulesTable.size(); i++) {
@@ -317,16 +315,11 @@
       continue;
     }
   }
-
+  /*
   for (int j = 0; j < groupVector.size(); j++) {
    cout << bigArray[j].size() << " " << groupVector[j] + 1 << " " << "check is the same or not" << endl;
   }
-
-  // Start to calculate the rearrangement configure time
-  // including the delta vector time
-
-  //auto start_1 = get_time::now();
-
+  */

   // Start to build the newRules in each group
   /*
@@ -348,7 +341,10 @@
   uint64_t sum_trie_expand_count = 0;
   uint64_t sum_trie_count = 0;
   uint64_t sum_trie_node_count = 0;
-
+  uint64_t sum_rule_rearrange_time = 0;
+  uint64_t sum_rule_insertion_time = 0;
+  uint64_t sum_key_rearrange_time = 0;
+  uint64_t sum_key_search_time = 0;
   //get time1
   auto start = get_time::now(); // use auto keyword to minimize typing strokes :)

@@ -358,9 +354,22 @@
     // Initilize a trie
     // Each group is a seperate trie
     Trie trie;
+    auto start1 = get_time::now();
     vector<int> delta_need = generate_delta(bigArray[j]);
     vector<Rule> newSumRuleTable = rules_rearrange(bigArray[j], delta_need);
+    auto end1 = get_time::now();
+    auto diff1 = end1 - start1;
+    //cout << "Rules rearrange configure time is:" << chrono::duration_cast<ns>(diff1).count() << " ns " << endl;
+    sum_rule_rearrange_time += chrono::duration_cast<ns>(diff1).count();
+    /*
+     * Checked the num of groups: new rules
+    for (int k = 0; k < newSumRuleTable.size(); k++) {
+      cout << newSumRuleTable[k].value << " " << newSumRuleTable[k].mask
+           << " " << newSumRuleTable[k].priority << endl;
+    }
+    */
     // Doing the rule insertion
+    auto start2 = get_time::now();
     for (int k = 0; k < newSumRuleTable.size(); k++) {
       if ( is_prefix(newSumRuleTable.at(k)) ) {
         trie.insert_prefix_rule_priority(newSumRuleTable.at(k));
@@ -378,20 +387,35 @@
         continue;
       }
     }
+    auto end2 = get_time::now();
+    auto diff2 = end2 - start2;
+    //cout << "Rules insertion configure time is:" << chrono::duration_cast<ns>(diff2).count() << " ns " << endl;
+    sum_rule_insertion_time += chrono::duration_cast<ns>(diff2).count();
     // Finished the rearranged rule insertion for each subtrie
     // Doing the rule searching
     char output[][32] = {"Not present in rulesTable", "Present in rulesTable"};

     // Search the rules
+    /*
     cout << "Begin test (keys=" << keyTable.size() <<
-            ", rules=" << pingRulesTable.size() << "):" << endl;
-
+            ", sub rules=" << newSumRuleTable.size() << "):" << endl;
+    */
     for (int i = 0; i < keyTable.size(); i++) {
       // Check each key
-      keys_rearrange(keyTable[i], delta_need);
-      uint64_t priority = trie.LPM1_search_rule(keyTable[i]);
+      auto start3 = get_time::now();
+      uint64_t newGenKey = keys_rearrange(keyTable[i], delta_need);
+      auto end3 = get_time::now();
+      auto diff3 = end3 - start3;
+      sum_key_rearrange_time += chrono::duration_cast<ns>(diff3).count();
+      auto start4 = get_time::now();
+      uint64_t priority = trie.LPM1_search_rule(newGenKey);
+      auto end4 = get_time::now();
+      auto diff4 = end4 - start4;
+      sum_key_search_time += chrono::duration_cast<ns>(diff4).count();
       match += (priority != 0); // when priority == 0, which means no matching
       if (priority == 0) {
+        // not matching
+        // Go to check the next keys through this current group of rules
         continue;
       }
       else {
@@ -400,6 +424,9 @@
         // Avoid the duplication searching
         // Delete the element keyTable[i]
         keyTable.erase(keyTable.begin() + i);
+        // Make sure the index is correct
+        // Because we delete one key, so need to decrease index too
+        i = i - 1;
         continue;
       }
     }
@@ -412,16 +439,10 @@
   auto end = get_time::now();
   auto diff = end - start;

-
-
-  //auto end_1 = get_time::now();
-  //auto diff_1 = end_1 - start_1;
-  //cout<<"Rules rearrangement configure time is:  "<< chrono::duration_cast<ns>(diff_1).count()<<" ns "<<endl;
-
-
-  // auto end_3 = get_time::now();
-  //auto diff_3 = end_3 - start_3;
-  //cout<<"Rules insertion configure time is:  "<< chrono::duration_cast<ns>(diff_3).count()<<" ns "<<endl;
+  cout << "Total rules rearrange configure time is:" << sum_rule_rearrange_time << " ns " << endl;
+  cout << "Total rules insertion configure time is:" << sum_rule_insertion_time << " ns " << endl;
+  cout << "Total keys rearrange configure time is:" << sum_key_rearrange_time << " ns " << endl;
+  cout << "Total keys search time is:" << sum_key_search_time << " ns " << endl;
   cout << "Total expanded count is:" << " " << sum_trie_expand_count << endl;
   cout << "Expand rule num is:" << " " << expandRule_num << endl;
   cout << "Insert rule num is:" << " " << insertRule_num << endl;
@@ -430,7 +451,7 @@
   cout << "Total insert trie_node count is:" << " " << sum_trie_node_count << endl;
   cout << "Checksum: " << checksum << endl;
   cout << "Total matches: " << match << endl;
-  cout <<"Search time is: "<< chrono::duration_cast<ns>(diff).count()<<" ns "<<endl;
+  cout << "Total runtime is: "<< chrono::duration_cast<ns>(diff).count()<<" ns "<<endl;

   return 0;
 }


fix: media_managet_test fails if EXTENDED_MEDIA_MODE is enabled

--- src/components/media_manager/test/media_manager_impl_test.cc
+++ src/components/media_manager/test/media_manager_impl_test.cc
@@ -123,10 +123,12 @@
         .WillOnce(Return(mock_app_));
     EXPECT_CALL(mock_media_manager_settings_, app_storage_folder())
         .WillOnce(ReturnRef(kStorageFolder));
+#ifndef EXTENDED_MEDIA_MODE
     EXPECT_CALL(mock_media_manager_settings_, app_resource_folder())
         .WillOnce(ReturnRef(kResourceFolder));
     EXPECT_CALL(mock_media_manager_settings_, recording_file_source())
         .WillOnce(ReturnRef(kRecordingFileSource));
+#endif
   }

   void InitMediaManagerPrecondition(const std::string& server_type) {


MinDifference

MinDifference

--- polkovnikov.ph/MinDifference.cpp
+++ polkovnikov.ph/MinDifference.cpp
@@ -48,14 +48,13 @@

 struct MinDifference {
 	int closestElements(int A0, int X, int Y, int M, int n) {
-		int p = A0;
+		vector<int> v(A0);
 		int mn = big;
 		for (int i = 1; i <= n - 1; ++i) {
-			int n = (p * X + Y) % M;
-			if (i < 10) cout << n << endl;
-			mn = min(mn, abs(n - p));
-			p = n;
+			v.push_back((v.back() * X + Y + M) % M);
 		}
+		sr(v);
+		ei(a, v) if (ai > 0) mn = min(mn, abs(a - v[ai - 1]));
 		return mn;
 	}
 };


changed: base rebuilds

changed: base rebuilds

git-svn-id: 6c7e10cdde2c115f53707ba8ec4efe535f92d362@2203 4683daeb-ad0f-0410-a623-93161e962ae5

--- Source/System/Image/OSGGeoReferenceAttachmentBase.cpp
+++ Source/System/Image/OSGGeoReferenceAttachmentBase.cpp
@@ -114,8 +114,8 @@
         DatumFieldId, DatumFieldMask,
         false,
         Field::SFDefaultFlags,
-        static_cast<FieldEditMethodSig>(&GeoReferenceAttachmentBase::editHandleDatum),
-        static_cast<FieldGetMethodSig >(&GeoReferenceAttachmentBase::getHandleDatum));
+        static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleDatum),
+        static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleDatum));

     oType.addInitialDesc(pDesc);

@@ -126,8 +126,8 @@
         EllipsoidAxisFieldId, EllipsoidAxisFieldMask,
         false,
         Field::SFDefaultFlags,
-        static_cast<FieldEditMethodSig>(&GeoReferenceAttachmentBase::editHandleEllipsoidAxis),
-        static_cast<FieldGetMethodSig >(&GeoReferenceAttachmentBase::getHandleEllipsoidAxis));
+        static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleEllipsoidAxis),
+        static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleEllipsoidAxis));

     oType.addInitialDesc(pDesc);

@@ -138,8 +138,8 @@
         OriginFieldId, OriginFieldMask,
         false,
         Field::SFDefaultFlags,
-        static_cast<FieldEditMethodSig>(&GeoReferenceAttachmentBase::editHandleOrigin),
-        static_cast<FieldGetMethodSig >(&GeoReferenceAttachmentBase::getHandleOrigin));
+        static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleOrigin),
+        static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleOrigin));

     oType.addInitialDesc(pDesc);

@@ -150,8 +150,8 @@
         PixelSizeFieldId, PixelSizeFieldMask,
         false,
         Field::SFDefaultFlags,
-        static_cast<FieldEditMethodSig>(&GeoReferenceAttachmentBase::editHandlePixelSize),
-        static_cast<FieldGetMethodSig >(&GeoReferenceAttachmentBase::getHandlePixelSize));
+        static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandlePixelSize),
+        static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandlePixelSize));

     oType.addInitialDesc(pDesc);

@@ -162,8 +162,8 @@
         NoDataValueFieldId, NoDataValueFieldMask,
         false,
         Field::SFDefaultFlags,
-        static_cast<FieldEditMethodSig>(&GeoReferenceAttachmentBase::editHandleNoDataValue),
-        static_cast<FieldGetMethodSig >(&GeoReferenceAttachmentBase::getHandleNoDataValue));
+        static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleNoDataValue),
+        static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleNoDataValue));

     oType.addInitialDesc(pDesc);
 }
@@ -174,10 +174,10 @@
     Inherited::getClassname(),
     "GeoReferenceAttachment",
     0,
-    (PrototypeCreateF) &GeoReferenceAttachmentBase::createEmptyLocal,
+    reinterpret_cast<PrototypeCreateF>(&GeoReferenceAttachmentBase::createEmptyLocal),
     GeoReferenceAttachment::initMethod,
     GeoReferenceAttachment::exitMethod,
-    (InitalInsertDescFunc) &GeoReferenceAttachmentBase::classDescInserter,
+    reinterpret_cast<InitalInsertDescFunc>(&GeoReferenceAttachmentBase::classDescInserter),
     false,
     0,
     "<?xml version=\"1.0\"?>\n"


поправил отображение картинки "участника"

--- usecasediagram/diagramactoritem.cpp
+++ usecasediagram/diagramactoritem.cpp
@@ -19,7 +19,29 @@
 }
 void DiagramActorItem::focusOutEvent(QFocusEvent *event)
 {
+    QString str;
     setTextInteractionFlags(Qt::NoTextInteraction);
+    str=this->toPlainText();
+    int i=0;
+    int pos=0;
+    bool imgFlag=false;
+    while(i<str.size()&&imgFlag!=true)
+    {
+        if(str.at(i).unicode()>256)
+        {
+            imgFlag=true;
+            pos=i;
+        }
+        i++;
+    }
+    if(imgFlag==false)
+    {
+        this->setHtml(QString("")+"
"+str+"
");
+    }
+    if(imgFlag==true&&(pos-1)!=0)
+    {
+        this->setHtml(QString("")+"
"+str.right(str.size()-2-pos+1)+"
");
+    }
     emit lostFocus(this);
     QGraphicsTextItem::focusOutEvent(event);
 }