Fix build errors on Linux.
Review URL: http://codereview.chromium.org/6047

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

--- chrome/tools/test/image_diff/image_diff.cc
+++ chrome/tools/test/image_diff/image_diff.cc
@@ -10,6 +10,8 @@

 #include <algorithm>
 #include <vector>
+#include <string>
+#include <iostream>

 #include "base/basictypes.h"
 #include "base/command_line.h"
@@ -18,6 +20,7 @@
 #include "base/logging.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
+#include "base/string_util.h"

 // Causes the app to remain open, waiting for pairs of filenames on stdin.
 // The caller is then responsible for terminating this app.
@@ -47,8 +50,8 @@

   // Creates the image from stdin with the given data length. On success, it
   // will return true. On failure, no other methods should be accessed.
-  bool CreateFromStdin(int byte_length) {
-    if (byte_length <= 0)
+  bool CreateFromStdin(size_t byte_length) {
+    if (byte_length == 0)
       return false;

     scoped_array<unsigned char> source(new unsigned char[byte_length]);
@@ -234,26 +237,24 @@
   CommandLine parsed_command_line;
   if (parsed_command_line.HasSwitch(kOptionPollStdin)) {
     // Watch stdin for filenames.
-    char stdin_buffer[2048];
-    char filename1_buffer[2048];
+    std::string stdin_buffer;
+    std::string filename1_buffer;
     bool have_filename1 = false;
-    while (fgets(stdin_buffer, sizeof(stdin_buffer), stdin)) {
-      char *newLine = strchr(stdin_buffer, '\n');
-      if (newLine)
-        *newLine = '\0';
-      if (!*stdin_buffer)
+    while (std::getline(std::cin, stdin_buffer)) {
+      if (stdin_buffer.empty())
         continue;

       if (have_filename1) {
         // CompareImages writes results to stdout unless an error occurred.
-        if (CompareImages(filename1_buffer, stdin_buffer) == kStatusError)
+        if (CompareImages(filename1_buffer.c_str(), stdin_buffer.c_str()) ==
+            kStatusError)
           printf("error\n");
         fflush(stdout);
         have_filename1 = false;
       } else {
         // Save the first filename in another buffer and wait for the second
         // filename to arrive via stdin.
-        strcpy_s(filename1_buffer, sizeof(filename1_buffer), stdin_buffer);
+        filename1_buffer = stdin_buffer;
         have_filename1 = true;
       }
     }
@@ -267,4 +268,3 @@
   PrintHelp();
   return kStatusError;
 }
-


mark text_file functions as inline

mark text_file functions as inline

--- include/toolbox/text_file.hpp
+++ include/toolbox/text_file.hpp
@@ -8,7 +8,7 @@
 namespace toolbox::text_file
 {

-std::string load(std::ifstream &file)
+inline std::string load(std::ifstream &file)
 {
     std::string result;

@@ -21,18 +21,18 @@
     return result;
 }

-std::string load(toolbox::fs::path path)
+inline std::string load(toolbox::fs::path path)
 {
     std::ifstream ifs{path};
     return load(ifs);
 }

-void save(std::ofstream &file, const std::string &str)
+inline void save(std::ofstream &file, const std::string &str)
 {
     file.write(str.data(), str.size());
 }

-void save(fs::path path, const std::string &str)
+inline void save(fs::path path, const std::string &str)
 {
     std::ofstream ofs{path};
     save(ofs, str);


Disable the following net tests for ChromeFrame as they rely on functionality provided by Chrome's network stack
like the ability to override a proxy for a URL request, etc.

1. URLRequestTestHTTP.ProxyTunnelRedirectTest
2.URLRequestTestHTTP.UnexpectedServerAuthTest.

TBR=amit

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

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

--- chrome_frame/test/net/fake_external_tab.cc
+++ chrome_frame/test/net/fake_external_tab.cc
@@ -440,6 +440,11 @@
     "URLRequestTest.DoNotSendCookies_ViaPolicy_Async",
     "URLRequestTest.CancelTest_During_OnGetCookiesBlocked",
     "URLRequestTest.CancelTest_During_OnSetCookieBlocked",
+
+    // These tests are disabled as the rely on functionality provided by
+    // Chrome's HTTP stack like the ability to set the proxy for a URL, etc.
+    "URLRequestTestHTTP.ProxyTunnelRedirectTest",
+    "URLRequestTestHTTP.UnexpectedServerAuthTest",
   };

   std::string filter("-");  // All following filters will be negative.


Add def.hpp include to tudocomp.hpp

Add def.hpp include to tudocomp.hpp

--- include/tudocomp/tudocomp.hpp
+++ include/tudocomp/tudocomp.hpp
@@ -64,6 +64,7 @@
 #include <glog/logging.h>
 #include <sdsl/int_vector.hpp>

+#include <tudocomp/def.hpp>
 #include <tudocomp/io.hpp>
 #include <tudocomp/util.hpp>


updated MultiArrayView documentation

updated MultiArrayView documentation

--- include/vigra/multi_array.hxx
+++ include/vigra/multi_array.hxx
@@ -617,8 +617,13 @@

 This class implements the interface of both MultiArray and
 MultiArrayView.  By default, MultiArrayViews are tagged as
-unstrided. If necessary, strided arrays are constructed automatically
-by calls to a variant of the bind...() function.
+strided (using <tt>StridedArrayTag</tt> as third template parameter).
+This means that the array elements need not be consecutive in memory,
+making the view flexible to represent all kinds of subarrays and slices.
+In certain cases (which have become rare due to improvements of
+optimizer and processor technology), an array may be tagged with
+<tt>UnstridedArrayTag</tt> which indicates that the first array dimension
+is guaranteed to be unstrided, i.e. has consecutive elements in memory.

 In addition to the member functions described here, <tt>MultiArrayView</tt>
 and its subclasses support arithmetic and algebraic functions via the
@@ -640,7 +645,7 @@
        memory location, strided if there is an offset in between (e.g.
        when a view is created that skips every other array element).
        The compiler can generate faster code for unstrided arrays.
-       Possible values: UnstridedArrayTag (default), StridedArrayTag
+       Possible values: StridedArrayTag (default), UnstridedArrayTag
 \endcode

 \#include \<vigra/multi_array.hxx\>


move operators to tbbext namespace

move operators to tbbext namespace

--- include/vsmc/tbb/operator.hpp
+++ include/vsmc/tbb/operator.hpp
@@ -260,12 +260,14 @@

 namespace vsmc {

+namespace tbbext {
+
 namespace internal {

-template <typename T> inline const T &tbb_max_fn (const T &a, const T &b)
+template <typename T> inline const T &max_fn (const T &a, const T &b)
 {return std::max VSMC_MNE (a, b);}

-template <typename T> inline const T &tbb_min_fn (const T &a, const T &b)
+template <typename T> inline const T &min_fn (const T &a, const T &b)
 {return std::min VSMC_MNE (a, b);}

 template <typename T> struct positive_infinity_trait
@@ -304,20 +306,20 @@
 template <typename T> struct one_trait
 {static T value () {return static_cast<T>(1);}};

-} // namespace vsmc::internal
+} // namespace vsmc::tbbext::internal

 /// \brief Summation of squares
 /// \ingroup TBBOp
 template <typename T>
-class TBBSquareSum
+class SquareSum
 {
     public :

-    TBBSquareSum (const T *data) :
+    SquareSum (const T *data) :
         data_(data), result_(internal::zero_trait<T>::value()) {}

     template <typename Split>
-    TBBSquareSum (const TBBSquareSum<T> &other, Split) :
+    SquareSum (const SquareSum<T> &other, Split) :
         data_(other.data_), result_(internal::zero_trait<T>::value()) {}

     template <typename Range>
@@ -331,7 +333,7 @@
         result_ = result;
     }

-    void join (const TBBSquareSum<T> &other)
+    void join (const SquareSum<T> &other)
     {result_ = result_ + other.result_;}

     T result () const {return result_;}
@@ -340,116 +342,118 @@

     const T *const data_;
     T result_;
-}; // class TBBSquareSum
+}; // class SquareSum

 /// \brief Negation
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_OPERATOR(TBBNegate, -)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_OPERATOR(Negate, -)

 /// \brief Plus
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(TBBPlus, +)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(Plus, +)

 /// \brief Minus
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(TBBMinus, -)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(Minus, -)

 /// \brief Multiple
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(TBBMultiplies, *)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(Multiplies, *)

 /// \brief Division
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(TBBDivides, /)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(Divides, /)

 /// \brief Modulo
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(TBBModulus, %)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_BINARY_OPERATOR(Modulus, %)

 /// \brief Absolute value
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBAbs, std::abs)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Abs, std::abs)

 /// \brief Exponential
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBExp, std::exp)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Exp, std::exp)

 /// \brief Logarithm
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBLog, std::log)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Log, std::log)

 /// \brief Logarithm of 10
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBLog10, std::log10)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Log10, std::log10)

 /// \brief Square root
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBSqrt, std::sqrt)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Sqrt, std::sqrt)

 /// \brief Sine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBSin, std::sin)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Sin, std::sin)

 /// \brief Cosine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBCos, std::cos)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Cos, std::cos)

 /// \brief Tangent
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBTan, std::tan)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Tan, std::tan)

 /// \brief arc sine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBAsin, std::asin)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Asin, std::asin)

 /// \brief Arc cosine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBAcos, std::acos)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Acos, std::acos)

 /// \brief Arc tangent
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBAtan, std::atan)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Atan, std::atan)

 /// \brief Hyperbolic sine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBSinh, std::sinh)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Sinh, std::sinh)

 /// \brief Hyperbolic cosine
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBCosh, std::cosh)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Cosh, std::cosh)

 /// \brief Hyperbolic tangent
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBTanh, std::tanh)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Tanh, std::tanh)

 /// \brief Ceil
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBCeil, std::ceil)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Ceil, std::ceil)

 /// \brief Floor
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(TBBFloor, std::floor)
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_FOR_UNARY_FUNCTION(Floor, std::floor)

 /// \brief Maximum
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_FUNCTION(TBBMaximum, max_fn,
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_FUNCTION(Maximum, max_fn,
         internal::negative_infinity_trait<T>::value())

 /// \brief Minimum
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_FUNCTION(TBBMinimum, min_fn,
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_FUNCTION(Minimum, min_fn,
         internal::positive_infinity_trait<T>::value())

 /// \brief Summation
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_OPERATOR(TBBSummation, +,
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_OPERATOR(Summation, +,
         internal::zero_trait<T>::value())

 /// \brief Product
 /// \ingroup TBBOp
-VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_OPERATOR(TBBProduct, *,
+VSMC_DEFINE_TBB_UTILITY_OPERATOR_REDUCE_BINARY_OPERATOR(Product, *,
         internal::one_trait<T>::value())

+} // namespace vsmc::tbbext
+
 } // namespace vsmc

 #endif // VSMC_TBB_UTILITY_OPERATOR_HPP


Remove ifdef 32-bit clause in json tests.  ints are 32-bit everywhere.

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

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

--- base/json_reader_unittest.cc
+++ base/json_reader_unittest.cc
@@ -72,30 +72,16 @@
   root.reset(JSONReader().JsonToValue("2147483648", false, false));
   ASSERT_TRUE(root.get());
   double real_val;
-#ifdef ARCH_CPU_32_BITS
   ASSERT_TRUE(root->IsType(Value::TYPE_REAL));
   real_val = 0.0;
   ASSERT_TRUE(root->GetAsReal(&real_val));
   ASSERT_DOUBLE_EQ(2147483648.0, real_val);
-#else
-  ASSERT_TRUE(root->IsType(Value::TYPE_INTEGER));
-  int_val = 0;
-  ASSERT_TRUE(root->GetAsInteger(&int_val));
-  ASSERT_EQ(2147483648, int_val);
-#endif
   root.reset(JSONReader().JsonToValue("-2147483649", false, false));
   ASSERT_TRUE(root.get());
-#ifdef ARCH_CPU_32_BITS
   ASSERT_TRUE(root->IsType(Value::TYPE_REAL));
   real_val = 0.0;
   ASSERT_TRUE(root->GetAsReal(&real_val));
   ASSERT_DOUBLE_EQ(-2147483649.0, real_val);
-#else
-  ASSERT_TRUE(root->IsType(Value::TYPE_INTEGER));
-  int_val = 0;
-  ASSERT_TRUE(root->GetAsInteger(&int_val));
-  ASSERT_EQ(-2147483649, int_val);
-#endif

   // Parse a double
   root.reset(JSONReader().JsonToValue("43.1", false, false));


compute horizontal frustum

compute horizontal frustum

vertical frustum isn't working correctly yet...

--- empires/game.cpp
+++ empires/game.cpp
@@ -379,6 +379,7 @@

 void Game::draw() {
 	// draw terrain
+	int tleft, ttop, tright, tbottom;
 	int ty, tx, th, tw, y, x;
 	const AnimationTexture &bkg = cache->get(DRS_TERRAIN_DESERT);
 	const uint8_t *data = map.map.get();
@@ -392,20 +393,53 @@
 	x+ axis is going from top to right corner
 	*/

+	// TODO compute frustum
 	th = map.h; tw = map.w;

-	y = th * TILE_HEIGHT / 2;
-	x = y = 0;
-
-	for (ty = 0; ty < th; ++ty) {
+	// FIXME properly compute offsets
+	int tlo = 2; // -1
+	int tbo = 2;
+	int tro = -4;
+
+	// TODO compute frustum
+	tleft = (state.view_x + tlo * TILE_WIDTH) / TILE_WIDTH;
+	tright = tleft + this->w / TILE_WIDTH + tro;
+	if (tleft < 0)
+		tleft = 0;
+	if (tright > tw)
+		tright = tw;
+
+	// TODO compute bottom and top frustum
+	// dit is lastiger omdat we per rij tekenen...
+	tbottom = 0;
+	ttop = (-state.view_y + tbo * TILE_HEIGHT) / TILE_HEIGHT;
+
+	if (ttop < 0)
+		ttop = 0;
+	if (ttop > th)
+		ttop = th;
+
+	int ttp = ttop - 1;
+
+	x = tleft * TILE_WIDTH;
+	y = tleft * TILE_HEIGHT;
+
+	for (ty = tbottom; ty < ttop; ++ty) {
 		int xp = x, yp = y;
-		for (tx = 0; tx < tw; ++tx) {
+		for (tx = tleft; tx < tright; ++tx) {
 			bkg.draw(x, y, data[ty * tw + tx]);
 			x += TILE_WIDTH;
 			y += TILE_HEIGHT;
 		}
 		x = xp + TILE_WIDTH;
 		y = yp - TILE_HEIGHT;
+		if (tleft > 0) {
+			--tleft;
+			x -= TILE_WIDTH;
+			y -= TILE_WIDTH / 2;
+		}
+		if (tleft <= tlo)
+			--tright;
 	}

 	std::vector<std::shared_ptr<Unit>> objects;


Fix a new[] / delete mismatch in a unittest.

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

Former-commit-id: 6396f14a4bc73e67bc6c34beccbd918b2b312e00

--- base/string_util_unittest.cc
+++ base/string_util_unittest.cc
@@ -1066,7 +1066,7 @@
 #endif

   EXPECT_STREQ(ref, out.c_str());
-  delete ref;
+  delete[] ref;
 }

 // Test the boundary condition for the size of the string_util's


INTEGRATION: CWS basmgr02 (1.3.10); FILE MERGED 2007/02/12 09:32:48 fs 1.3.10.5: RESYNC: (1.3-1.4); FILE MERGED 2007/01/15 08:30:00 fs 1.3.10.4: #i73329# some refactoring of the library container API 2007/01/11 09:50:46 fs 1.3.10.3: #i73329# XServiceInfo support 2007/01/11 08:15:23 fs 1.3.10.2: #i10000# 2007/01/10 14:02:45 fs 1.3.10.1: #i73329# library containers expose a pure UNO API now, in particular XPersistentLibraryContainer

--- basic/source/uno/dlgcont.cxx
+++ basic/source/uno/dlgcont.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: dlgcont.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: rt $ $Date: 2007-01-29 16:27:31 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: obo $ $Date: 2007-03-15 15:39:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -103,6 +103,7 @@
 namespace basic
 {

+using namespace com::sun::star::document;
 using namespace com::sun::star::container;
 using namespace com::sun::star::io;
 using namespace com::sun::star::uno;
@@ -119,17 +120,10 @@
 //============================================================================
 // Implementation class SfxDialogLibraryContainer

-sal_Bool SfxDialogLibraryContainer::init( const OUString& aInitialisationParam,
-    const uno::Reference< embed::XStorage >& xStorage )
-{
-    return SfxLibraryContainer::init(
-          aInitialisationParam,
-          OUString ( RTL_CONSTASCII_USTRINGPARAM("dialog") ),
-          OUString ( RTL_CONSTASCII_USTRINGPARAM("dialogs") ),
-          OUString ( RTL_CONSTASCII_USTRINGPARAM("xdl") ),
-          OUString ( RTL_CONSTASCII_USTRINGPARAM("Dialogs") ),
-          xStorage );
-}
+const sal_Char* SAL_CALL SfxDialogLibraryContainer::getInfoFileName() const { return "dialog"; }
+const sal_Char* SAL_CALL SfxDialogLibraryContainer::getOldInfoFileName() const { return "dialogs"; }
+const sal_Char* SAL_CALL SfxDialogLibraryContainer::getLibElementFileExtension() const { return "xdl"; }
+const sal_Char* SAL_CALL SfxDialogLibraryContainer::getLibrariesDir() const { return "Dialogs"; }

 // Ctor for service
 SfxDialogLibraryContainer::SfxDialogLibraryContainer( void )
@@ -140,14 +134,13 @@

 SfxDialogLibraryContainer::SfxDialogLibraryContainer( const uno::Reference< embed::XStorage >& xStorage )
 {
-    OUString aInitialisationParam;
-    init( aInitialisationParam, xStorage );
+    init( OUString(), xStorage );
 }

 // Methods to get library instances of the correct type
 SfxLibrary* SfxDialogLibraryContainer::implCreateLibrary( const ::rtl::OUString& aName )
 {
-    SfxLibrary* pRet = (SfxLibrary*) new SfxDialogLibrary( aName, mxMSF, mxSFI, this );
+    SfxLibrary* pRet = new SfxDialogLibrary( maModifiable, aName, mxMSF, mxSFI, this );
     return pRet;
 }

@@ -155,9 +148,8 @@
     ( const ::rtl::OUString& aName, const OUString& aLibInfoFileURL,
       const OUString& StorageURL, sal_Bool ReadOnly )
 {
-    SfxLibrary* pRet =
-        (SfxLibrary*) new SfxDialogLibrary
-            ( aName, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly, this );
+    SfxLibrary* pRet = new SfxDialogLibrary
+            ( maModifiable, aName, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly, this );
     return pRet;
 }

@@ -278,8 +270,9 @@
     xInput->closeInput();
 }

-void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage )
-{
+void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage ) throw ( RuntimeException )
+{
+    LibraryContainerMethodGuard aGuard( *this );
     mbOasis2OOoFormat = sal_False;

     if ( mxStorage.is() && xStorage.is() )
@@ -392,27 +385,6 @@
     return new SfxDialogLibraryContainer();
 }

-
-//============================================================================
-// Methods XInitialization
-void SAL_CALL SfxDialogLibraryContainer::initialize( const Sequence< Any >& aArguments )
-    throw (::com::sun::star::uno::Exception,
-           ::com::sun::star::uno::RuntimeException)
-{
-    sal_Int32 nArgCount = aArguments.getLength();
-    OSL_ENSURE( nArgCount, "SfxDialogLibraryContainer::initialize() called with no arguments\n" );
-
-    OUString aInitialisationParam;
-    if( nArgCount )
-    {
-        const Any* pArgs = aArguments.getConstArray();
-        pArgs[0] >>= aInitialisationParam;
-        OSL_ENSURE( aInitialisationParam.getLength(),
-            "SfxDialogLibraryContainer::initialize() called with empty url\n" );
-    }
-
-    init( aInitialisationParam );
-}

 static OUString aResourceFileNameBase = OUString::createFromAscii( "DialogStrings" );
 static OUString aResourceFileCommentBase = OUString::createFromAscii( "# Strings for Dialog Library " );
@@ -557,19 +529,23 @@
     static OAutoRegistration< SfxDialogLibraryContainer > aAutoRegistration;
 }

+::rtl::OUString SAL_CALL SfxDialogLibraryContainer::getImplementationName( ) throw (RuntimeException)
+{
+    return getImplementationName_static();
+}
+
+Sequence< ::rtl::OUString > SAL_CALL SfxDialogLibraryContainer::getSupportedServiceNames( ) throw (RuntimeException)
+{
+    return getSupportedServiceNames_static();
+}
+
 Sequence< OUString > SfxDialogLibraryContainer::getSupportedServiceNames_static()
 {
-    static Sequence< OUString > seqServiceNames( 1 );
-    static sal_Bool bNeedsInit = sal_True;
-
-    MutexGuard aGuard( Mutex::getGlobalMutex() );
-    if( bNeedsInit )
-    {
-        OUString* pSeq = seqServiceNames.getArray();
-        pSeq[0] = OUString::createFromAscii( "com.sun.star.script.DialogLibraryContainer" );
-        bNeedsInit = sal_False;
-    }
-    return seqServiceNames;
+    Sequence< OUString > aServiceNames( 2 );
+    aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.DocumentDialogLibraryContainer" );
+    // plus, for compatibility:
+    aServiceNames[1] = OUString::createFromAscii( "com.sun.star.script.DialogLibraryContainer" );
+    return aServiceNames;
 }

 OUString SfxDialogLibraryContainer::getImplementationName_static()
@@ -598,29 +574,34 @@
 // Implementation class SfxDialogLibrary

 // Ctor
-SfxDialogLibrary::SfxDialogLibrary( const ::rtl::OUString& aName,
-                                    Reference< XMultiServiceFactory > xMSF,
-                                    Reference< XSimpleFileAccess > xSFI,
+SfxDialogLibrary::SfxDialogLibrary( ModifiableHelper& _rModifiable,
+                                    const ::rtl::OUString& aName,
+                                    const Reference< XMultiServiceFactory >& xMSF,
+                                    const Reference< XSimpleFileAccess >& xSFI,
                                     SfxDialogLibraryContainer* pParent )
-    : SfxDialogLibrary_BASE( getCppuType( (const Reference< XInputStreamProvider > *)0 ), xMSF, xSFI )
+    : SfxLibrary( _rModifiable, getCppuType( (const Reference< XInputStreamProvider > *)0 ), xMSF, xSFI )
     , m_pParent( pParent )
     , m_aName( aName )
 {
 }

-SfxDialogLibrary::SfxDialogLibrary( const ::rtl::OUString& aName,
-                                    Reference< XMultiServiceFactory > xMSF,
-                                    Reference< XSimpleFileAccess > xSFI,
+SfxDialogLibrary::SfxDialogLibrary( ModifiableHelper& _rModifiable,
+                                    const ::rtl::OUString& aName,
+                                    const Reference< XMultiServiceFactory >& xMSF,
+                                    const Reference< XSimpleFileAccess >& xSFI,
                                     const OUString& aLibInfoFileURL,
                                     const OUString& aStorageURL,
                                     sal_Bool ReadOnly,
                                     SfxDialogLibraryContainer* pParent )
-    : SfxDialogLibrary_BASE( getCppuType( (const Reference< XInputStreamProvider > *)0 ),
+    : SfxLibrary( _rModifiable, getCppuType( (const Reference< XInputStreamProvider > *)0 ),
                        xMSF, xSFI, aLibInfoFileURL, aStorageURL, ReadOnly)
     , m_pParent( pParent )
     , m_aName( aName )
 {
 }
+
+IMPLEMENT_FORWARD_XINTERFACE2( SfxDialogLibrary, SfxLibrary, SfxDialogLibrary_BASE );
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxDialogLibrary, SfxLibrary, SfxDialogLibrary_BASE );

 // Provide modify state including resources
 sal_Bool SfxDialogLibrary::isModified( void )


gah, dos2unix this file

gah, dos2unix this file

--- indra/newview/llworldview.cpp
+++ indra/newview/llworldview.cpp
@@ -1,41 +1,41 @@
-/**
- * @file llworldview.cpp
- * @brief LLWorldView class implementation
- *
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- *
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- *
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- *
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llworldview.h"
-
-#include "llviewercontrol.h"
-#include "llsidetray.h"
+/**
+ * @file llworldview.cpp
+ * @brief LLWorldView class implementation
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llworldview.h"
+
+#include "llviewercontrol.h"
+#include "llsidetray.h"
 /////////////////////////////////////////////////////
 // LLFloaterView


Cache the username, because apparently it's expensive to get.

--- Caprica/papyrus/PapyrusScript.cpp
+++ Caprica/papyrus/PapyrusScript.cpp
@@ -18,19 +18,25 @@
   pex->compilationTime = time(nullptr);
   pex->sourceFileName = sourceFileName;

-  char compNameBuf[MAX_COMPUTERNAME_LENGTH + 1];
-  DWORD compNameBufLength = sizeof(compNameBuf);
-  if (!GetComputerNameA(compNameBuf, &compNameBufLength))
-    CapricaError::logicalFatal("Failed to get the computer name!");
-  pex->computerName = std::string(compNameBuf, compNameBufLength);
+  static std::string computerName = []() -> std::string {
+    char compNameBuf[MAX_COMPUTERNAME_LENGTH + 1];
+    DWORD compNameBufLength = sizeof(compNameBuf);
+    if (!GetComputerNameA(compNameBuf, &compNameBufLength))
+      CapricaError::logicalFatal("Failed to get the computer name!");
+    return std::string(compNameBuf, compNameBufLength);
+  }();
+  pex->computerName = computerName;

-  char userNameBuf[UNLEN + 1];
-  DWORD userNameBufLength = sizeof(userNameBuf);
-  if (!GetUserNameA(userNameBuf, &userNameBufLength))
-    CapricaError::logicalFatal("Failed to get the user name!");
-  if (userNameBufLength > 0)
-    userNameBufLength--;
-  pex->userName = std::string(userNameBuf, userNameBufLength);
+  static std::string userName = []() -> std::string {
+    char userNameBuf[UNLEN + 1];
+    DWORD userNameBufLength = sizeof(userNameBuf);
+    if (!GetUserNameA(userNameBuf, &userNameBufLength))
+      CapricaError::logicalFatal("Failed to get the user name!");
+    if (userNameBufLength > 0)
+      userNameBufLength--;
+    return std::string(userNameBuf, userNameBufLength);
+  }();
+  pex->userName = userName;

   for (auto o : objects)
     o->buildPex(pex);


[assembler.multiscale.coupling] changed argument order

--- dune/detailed/discretizations/assembler/multiscale/coupling.hh
+++ dune/detailed/discretizations/assembler/multiscale/coupling.hh
@@ -76,8 +76,8 @@

   template <class LocalAssemblerType, class MatrixBackendType>
   void assembleMatrices(const LocalAssemblerType& localAssembler, MatrixBackendType& innerInnerMatrix,
-                        MatrixBackendType& outerOuterMatrix, MatrixBackendType& innerOuterMatrix,
-                        MatrixBackendType& outerInnerMatrix) const
+                        MatrixBackendType& innerOuterMatrix, MatrixBackendType& outerInnerMatrix,
+                        MatrixBackendType& outerOuterMatrix) const
   {
     // preparations
     typedef typename CouplingGridPartType::template Codim<0>::EntityType EntityType;


ENH: fix bug in DocStrucutre when no example parameter is given

--- Code/ApplicationEngine/otbWrapperDocExampleStructure.cxx
+++ Code/ApplicationEngine/otbWrapperDocExampleStructure.cxx
@@ -29,7 +29,6 @@
 DocExampleStructure::DocExampleStructure() : m_ParameterList(), m_ApplicationName(""), m_ExampleCommentList(), m_NbOfExamples(1)
 {
   m_ExampleCommentList.push_back("");
-  m_ParameterList.push_back(ParametersVectorType());
 }

 DocExampleStructure::~DocExampleStructure()
@@ -39,8 +38,14 @@
 void
 DocExampleStructure::AddParameter( const std::string key, const std::string value, unsigned int exId)
 {
-
-
+  if( m_ParameterList.size() < exId+1 )
+    {
+    while( m_ParameterList.size()<exId+1)
+      {
+      m_ParameterList.push_back(ParametersVectorType());
+      }
+    }
+
   m_ParameterList.at(exId).push_back(std::make_pair(key, value));
 }


Use the minimum of lightmap and dynamic shadow, not the product of the two

--- Components/Terrain/src/OgreTerrainMaterialGeneratorA.cpp
+++ Components/Terrain/src/OgreTerrainMaterialGeneratorA.cpp
@@ -1393,7 +1393,7 @@
 		}

 		outStream <<
-			"	shadow *= rtshadow;\n";
+			"	shadow = min(shadow, rtshadow);\n";

 	}
 	//---------------------------------------------------------------------


Each execution lost 32MB of memory. Added two fflas_delete()'s.

--- benchmarks/benchmark-fsyrk.C
+++ benchmarks/benchmark-fsyrk.C
@@ -87,6 +87,8 @@

 		time+=chrono.usertime();
 		FFLAS::fflas_delete( A);
+		FFLAS::fflas_delete( C);
+		FFLAS::fflas_delete( D);
 	}

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


bugfix: reverted a change I applyied a couple revisions ago (the joint rotation is applied to mothers rotation)

--- Framework/NaoTH-Commons/Source/Tools/Kinematics/Link.cpp
+++ Framework/NaoTH-Commons/Source/Tools/Kinematics/Link.cpp
@@ -98,7 +98,14 @@
   if (NULL != mother)
   {
     p = mother->R * b + mother->p;
-    if (NULL != q)// joint rotation
+    R = mother->R;
+//    w = mother->w;
+//    v = mother->v;
+//    dw = mother->dw;
+//    dv = mother->dv;
+
+    // update by joint if there is one
+    if (NULL != q)
     {
       R *= Rodrigues(A, A2, *q);
       // senity check if R is still a kind of a rotation matrix...
@@ -117,15 +124,7 @@
 //      dw += dsw * (*dq) + sw * (*ddq);
 //      dv += dsv * (*dq) + sv * (*ddq);
     }
-    else
-    {
-      R = mother->R;
-//    w = mother->w;
-//    v = mother->v;
-//    dw = mother->dw;
-//    dv = mother->dv;
-    }
-  }
+  }//end if NULL != mother
 }//end updateAllFromMother


fixing monoscopic renderer

fixing monoscopic renderer

Seems it broke recently.  Seems to need a native predictAndSetRotation()
    method now.  adding it.

--- GVRf/Framework/jni/objects/components/camera_rig_jni.cpp
+++ GVRf/Framework/jni/objects/components/camera_rig_jni.cpp
@@ -115,6 +115,9 @@
 JNIEXPORT void JNICALL
 Java_org_gearvrf_NativeCameraRig_predict(JNIEnv * env,
         jobject obj, jlong jcamera_rig, jfloat time);
+JNIEXPORT void JNICALL
+Java_org_gearvrf_NativeCameraRig_predictAndSetRotation(JNIEnv * env,
+        jobject obj, jlong jcamera_rig, jfloat time);
 JNIEXPORT jfloatArray JNICALL
 Java_org_gearvrf_NativeCameraRig_getLookAt(JNIEnv * env,
         jobject obj, jlong jcamera_rig);
@@ -340,6 +343,13 @@
         jobject obj, jlong jcamera_rig, jfloat time) {
     CameraRig* camera_rig = reinterpret_cast<CameraRig*>(jcamera_rig);
     camera_rig->predict(time);
+}
+
+JNIEXPORT void JNICALL
+Java_org_gearvrf_NativeCameraRig_predictAndSetRotation(JNIEnv * env,
+        jobject obj, jlong jcamera_rig, jfloat time) {
+    CameraRig* camera_rig = reinterpret_cast<CameraRig*>(jcamera_rig);
+    camera_rig->predictAndSetRotation(time);
 }

 JNIEXPORT jfloatArray JNICALL


BUG: avoid RangeError due to float/double conversion between histogram and widget

--- Code/Common/mvdHistogramModel.cxx
+++ Code/Common/mvdHistogramModel.cxx
@@ -80,6 +80,16 @@
   // Contruct 1D measurement vector.
   Histogram::MeasurementVectorType measurement( 1 );
   measurement[ 0 ] = intensity;
+
+  // Due to float/double conversion, it can happen
+  // that the minimum or maximum value go slightly outside the histogram
+  // Clamping the value solves the issue and avoid RangeError
+  measurement[0] =
+    itk::NumericTraits<MeasurementType>::Clamp(
+      measurement[0],
+      histogram->GetBinMin(0, 0),
+      histogram->GetBinMax(0, histogram->GetSize(0) - 1)
+      );

   // Get the index of measurement in 1D-histogram.
   Histogram::IndexType index;


BUG: Fixed typo in sitkPixelIDValues.cxx

--- Code/Common/sitkPixelIDValues.cxx
+++ Code/Common/sitkPixelIDValues.cxx
@@ -57,7 +57,7 @@
     }
   else if ( type == sitkComplexFloat32 )
     {
-    return "conplex of 32-bit float";
+    return "complex of 32-bit float";
     }
   else if ( type == sitkComplexFloat64 )
     {


BUG: deal with Mac line end conventions in TXT transforms

--- Code/Review/itkTxtTransformIO.cxx
+++ Code/Review/itkTxtTransformIO.cxx
@@ -122,11 +122,21 @@
   TmpFixedParameterArray.clear();
   bool haveFixedParameters = false;
   bool haveParameters = false;
-
+  //
+  // check for line end convention
+  std::string line_end("\n");
+  if(data.find('\n') == std::string::npos)
+    {
+    if(data.find('\r') == std::string::npos)
+      {
+      itkExceptionMacro ( "No line ending character found, not a valid ITK Transform TXT file" );
+      }
+    line_end = "\r";
+    }
   while ( position < data.size() )
     {
     // Find the next string
-    std::string::size_type end = data.find ( "\n", position );
+    std::string::size_type end = data.find ( line_end, position );
     std::string line = trim ( data.substr ( position, end - position ) );
     position = end+1;
     itkDebugMacro ("Found line: \"" << line << "\"" );


Visual debug: fix opencv color

Visual debug: fix opencv color

--- src/cctag/visualDebug.cpp
+++ src/cctag/visualDebug.cpp
@@ -106,7 +106,7 @@
   if (p.x() >= 1 && p.x() < _backImage.cols-1 &&
           p.y() >= 1 && p.y() < _backImage.rows-1)
   {
-    cv::rectangle(_backImage, cvPoint(p.x()-1.0,p.y()-1.0), cvPoint(p.x()+1.0,p.y()+1.0), cv::Scalar(color[0], color[1], color[2]));
+    cv::rectangle(_backImage, cvPoint(p.x()-1.0,p.y()-1.0), cvPoint(p.x()+1.0,p.y()+1.0), cv::Scalar(255*color[0], 255*color[1], 255*color[2]),0);
   }
 #endif
 }


Extended the phred table to support a wider range of scores \(0-100\)


Fix logic for handling partial buffers.

Fix logic for handling partial buffers.

--- apps/systemlib/mixer/mixer_group.cpp
+++ apps/systemlib/mixer/mixer_group.cpp
@@ -125,39 +125,58 @@
 	int ret = -1;
 	const char *end = buf + buflen;

-	/* loop until we have consumed the buffer */
+	/*
+	 * Loop until either we have emptied the buffer, or we have failed to
+	 * allocate something when we expected to.
+	 */
 	while (buflen > 0) {
 		Mixer *m = nullptr;
 		const char *p = end - buflen;
+		unsigned resid = buflen;

-		/* use the next character as a hint to decide which mixer class to construct */
+		/*
+		 * Use the next character as a hint to decide which mixer class to construct.
+		 */
 		switch (*p) {
 		case 'Z':
-			m = NullMixer::from_text(p, buflen);
+			m = NullMixer::from_text(p, resid);
 			break;

 		case 'M':
-			m = SimpleMixer::from_text(_control_cb, _cb_handle, p, buflen);
+			m = SimpleMixer::from_text(_control_cb, _cb_handle, p, resid);
 			break;

 		case 'R':
-			m = MultirotorMixer::from_text(_control_cb, _cb_handle, p, buflen);
+			m = MultirotorMixer::from_text(_control_cb, _cb_handle, p, resid);
 			break;

 		default:
-			/* it's probably junk or whitespace */
-			break;
+			/* it's probably junk or whitespace, skip a byte and retry */
+			buflen--;
+			continue;
 		}

+		/*
+		 * If we constructed something, add it to the group.
+		 */
 		if (m != nullptr) {
 			add_mixer(m);
+
+			/* we constructed something */
 			ret = 0;

+			/* only adjust buflen if parsing was successful */
+			buflen = resid;
 		} else {
-			/* skip whitespace or junk in the buffer */
-			buflen--;
+
+			/*
+			 * There is data in the buffer that we expected to parse, but it didn't,
+			 * so give up for now.
+			 */
+			break;
 		}
 	}

+	/* nothing more in the buffer for us now */
 	return ret;
 }


Fixed reconnect

Fixed reconnect

--- agent/agent.cpp
+++ agent/agent.cpp
@@ -247,7 +247,7 @@
     for (dataItemAssoc = dataItems.begin(); dataItemAssoc != dataItems.end(); ++dataItemAssoc)
     {
       DataItem *dataItem = (*dataItemAssoc).second;
-      if (dataItem->getDataSource() == anAdapter)
+      if (dataItem != NULL && dataItem->getDataSource() == anAdapter)
       {
 	const string *value = NULL;
 	if (dataItem->isCondition()) {


Fix use of non-standard "uint" type

Fix use of non-standard "uint" type

Change-Id: I474e5e40550d61f873fd930fe33b0e1e9f9992cc
Signed-off-by: Rob Hughes <3be7ff6f70e31aa390087d7c66897beeb25aa6c5@arm.com>

--- src/backends/backendsCommon/test/MemoryManagerTests.cpp
+++ src/backends/backendsCommon/test/MemoryManagerTests.cpp
@@ -66,7 +66,7 @@
     std::vector<size_t> offsets(numTensors);
     std::iota(std::begin(offsets), std::end(offsets), 0);

-    for (uint idx = 0; idx < tensorMemoryPointerVector.size(); ++idx)
+    for (uint32_t idx = 0; idx < tensorMemoryPointerVector.size(); ++idx)
     {
         tensorMemoryVector.emplace_back(TensorMemory{offsets[idx], nullptr, 0});
         tensorMemoryPointerVector[idx] = &tensorMemoryVector[idx];
@@ -90,7 +90,7 @@
     CHECK(customAllocator.m_CounterAllocate == bufferStorageVector.size());
     for (const auto& bufferStorage : bufferStorageVector)
     {
-        uint idx = 0;
+        uint32_t idx = 0;
         for (auto tensorMemory : bufferStorage.m_TensorMemoryVector)
         {
             auto value = reinterpret_cast<uint8_t *>(tensorMemory->m_Data);


use atomicload / store for freelist in MallocGuard to avoid false posatives

--- Library/Sources/Stroika/Foundation/Debug/MallocGuard.cpp
+++ Library/Sources/Stroika/Foundation/Debug/MallocGuard.cpp
@@ -3,6 +3,7 @@
  */
 #include    "../StroikaPreComp.h"

+#include    <atomic>
 #include    <exception>
 #include    <malloc.h>

@@ -68,6 +69,7 @@

     bool    IsDeadMansLand_ (const Byte* s, const Byte* e)
     {
+        // NYI cuz not clear if/how/where to use...
         return false;
     }
     void    SetDeadMansLand_ (Byte* s, Byte* e)
@@ -91,11 +93,15 @@

     /*
-     *  not 100% threadsafe, but OK.
+     *  Not 100% threadsafe, but probably OK.
+     *
+     *  If we add something and it doesn't really get added, we just miss the opporuntity to detect a bug, but we don't create one.
+     *
+     *  Assure we flush any entries CLEARED with ClearFromFreeList_ (why we use atomic_store_explicit)
      *
      *  Also FreeList alway uses BackendPtr - not ExternalPtr
      */
-    void*   sFreeList_[100];
+    volatile    void*   sFreeList_[100];
     void**  sFreeList_NextFreeI_    =   &sFreeList_[0];
     void    Add2FreeList_ (void* p)
     {
@@ -109,16 +115,16 @@
     void    ClearFromFreeList_ (void* p)
     {
         // not a race because you cannot free and allocate the same pointer at the same time
+        for (volatile void** i = begin (sFreeList_); i != end (sFreeList_); ++i) {
+            if (std::atomic_load_explicit (i, memory_order_acquire) == p) {
+                std::atomic_store_explicit (i, nullptr, memory_order_release);
+            }
+        }
+    }
+    bool    IsInFreeList_ (const void* p)
+    {
         for (void** i = begin (sFreeList_); i != end (sFreeList_); ++i) {
-            if (*i == p) {
-                *i = nullptr;
-            }
-        }
-    }
-    bool    IsInFreeList_ (const void* p)
-    {
-        for (void** i = begin (sFreeList_); i != end (sFreeList_); ++i) {
-            if (*i == p) {
+            if (std::atomic_load_explicit (i, memory_order_acquire) == p) {
                 return true;
             }
         }


IO/Network/Socket - fixed DTOR for ConnectionOrientedSocket_IMPL_ to call close

--- Library/Sources/Stroika/Foundation/IO/Network/Socket.cpp
+++ Library/Sources/Stroika/Foundation/IO/Network/Socket.cpp
@@ -313,12 +313,19 @@
                 : inherited (sd)
             {
             }
+            ~Rep_ ()
+            {
+                // need DTOR cuz one in base class wont call this override of Close
+                if (fSD_ != kINVALID_NATIVE_HANDLE_) {
+                    Close ();
+                }
+            }
             virtual void Close () override
             {
                 if (fSD_ != kINVALID_NATIVE_HANDLE_ and fAutomaticTCPDisconnectOnClose_) {
                     Shutdown (ShutdownTarget::eWrites);
-                    Time::DurationSecondsType timeOutAt = Time::GetTickCount () + 2.0;
-                    Execution::WaitForIOReady ioReady{Traversal::Iterable<Execution::WaitForIOReady::FileDescriptorType>{fSD_}};
+                    Time::DurationSecondsType timeOutAt = Time::GetTickCount () + *fAutomaticTCPDisconnectOnClose_;
+                    Execution::WaitForIOReady ioReady{fSD_};
                     try {
                     again:
                         ioReady.WaitUntil (timeOutAt);
@@ -330,7 +337,7 @@
                         int nb    = ::recv (fSD_, data, NEltsOf (data), flags);
 #endif
                         if (nb > 0) {
-                            DbgTrace (L"Warning: %d unread bytes to be read on socket", nb); // SHOULD READ ZERO AFTER SHUTDOWN to indicate client other side of connection handled the close
+                            DbgTrace (L"Warning: %d unread bytes to be read on socket when it was closed.", nb); // SHOULD READ ZERO AFTER SHUTDOWN to indicate client other side of connection handled the close
                             goto again;
                         }
                     }


changed variable type to match function call type

--- src/bin/clients/tools/alg_to_mongo/src/alg_handling.cpp
+++ src/bin/clients/tools/alg_to_mongo/src/alg_handling.cpp
@@ -51,7 +51,7 @@
     size_t off = 0;
     bson * bson_ptr = documents[item_count];
     char * physID;
-    size_t len;
+    uint64_t len;

     /* initialize BSON object for this vertex */
     bson_init (bson_ptr);


Don't update cache timestamp, if reading XML from cache

--- Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp
+++ Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp
@@ -151,10 +151,13 @@

   bool fromCache = false;
   qint64 newTimeStamp = 0;
+  qint64 cacheTimeStamp = 0;
   if (d->ModuleCache)
   {
     newTimeStamp = backend->timeStamp(location);
-    if (d->ModuleCache->timeStamp(location) < newTimeStamp)
+    cacheTimeStamp = d->ModuleCache->timeStamp(location);
+    if (cacheTimeStamp < 0                // i.e. timestamp is invalid
+        || cacheTimeStamp < newTimeStamp) // i.e. timestamp is genuinely out of date
     {
       // newly fetch the XML description
       try
@@ -221,7 +224,7 @@
     }
     else
     {
-      if (d->ModuleCache && newTimeStamp > 0)
+      if (d->ModuleCache && newTimeStamp > 0 && !fromCache)
       {
         // successfully validated the xml, cache it
         d->ModuleCache->cacheXmlDescription(location, newTimeStamp, xml);


(unstable) [fixed] merge error

(unstable) [fixed] merge error

git-svn-id: e4cf3396f21da4a5d638eecf7e3b4dd52b27f938@5679 c3d1530f-68f5-4bd0-87dc-8ef779617e40

--- MMOCoreORB/src/server/chat/ChatManagerImplementation.cpp
+++ MMOCoreORB/src/server/chat/ChatManagerImplementation.cpp
@@ -467,15 +467,6 @@
 	//Locker zoneLocker(zone);
 	//zone->rlock();

-<<<<<<< .working
-	//	bool readlock = !zone->isLockedByCurrentThread();
-=======
-//	bool readlock = !zone->isLockedByCurrentThread();
->>>>>>> .merge-right.r5676
-
-	//zone->rlock(readlock);
-
-<<<<<<< .working
 	CloseObjectsVector* closeObjects = (CloseObjectsVector*) player->getCloseObjects();

 	SortedVector<ManagedReference<QuadTreeEntry*> > closeEntryObjects(200, 50);
@@ -520,15 +511,6 @@

 	*/

-	try {
-		for (int i = 0; i < closeEntryObjects.size(); ++i) {
-			SceneObject* object = cast<SceneObject*>(closeEntryObjects.get(i).get());
-
-			if (object->isPlayerCreature()) {
-				CreatureObject* creature = cast<CreatureObject*>(object);
->>>>>>> .merge-right.r5676
-
-	 */

 	try {
 		for (int i = 0; i < closeEntryObjects.size(); ++i) {
@@ -583,12 +565,6 @@

 		throw;
 	}
-
-<<<<<<< .working
-	//	zone->runlock(readlock);
-=======
-//	zone->runlock(readlock);
->>>>>>> .merge-right.r5676

 	//zone->runlock();


dumpcov: remove unused arg_string function

--- src/cdumpcov/cdumpcov.cpp
+++ src/cdumpcov/cdumpcov.cpp
@@ -33,11 +33,6 @@
     uint16_t arg_uint16(size_t index)
     {
         return data[index].fixnum;
-    }
-
-    std::string arg_string(size_t index)
-    {
-        return data[index].string;
     }
 };


Fix a bug where the vtkStreamingWorker wasn't caching HighLow computation.

We only need to compute the HighLow lookup the first time we run.

--- dax/vtkStreamingWorker.cxx
+++ dax/vtkStreamingWorker.cxx
@@ -111,8 +111,6 @@
   template<typename Functor, typename ValueType>
   void run(Functor functor, double v, ValueType)
   {
-  std::size_t numCells=0;
-
   dax::cont::Timer<> timer;
   const std::size_t totalSubGrids = this->Volume.numSubGrids();
   vtkSmartPointer< vtkPolyData> output;
@@ -123,7 +121,6 @@
     if(this->ContinueWorking && this->Volume.isValidSubGrid(i, v))
       {
       output = functor(v, i, ValueType(), this->Logger );
-      numCells += output->GetNumberOfCells();

         //lock while we add to the appender
         {
@@ -148,7 +145,7 @@
     haveMoreData = false;
     }

-  this->Logger << "algorithm time: " << timer.GetElapsedTime() << " num cells " << numCells << std::endl;
+  this->Logger << "algorithm time: " << timer.GetElapsedTime() << std::endl;
   this->FinishedWorkingOnData = true;
   }
 };
@@ -167,6 +164,7 @@
     Thread(),
     ContinueWorking(false),
     FinishedWorkingOnData(false),
+    CurrentRenderDataFinished(false),
     Volume(),
     ComputedData(),
     CurrentRenderData(),
@@ -206,7 +204,7 @@
     //I think the best way is to track that GetFinishedPieces() has been
     //called AFTER the algorithm is finished, only than are we really 'finished'

-    return false;
+    return this->CurrentRenderDataFinished;
   }

   //----------------------------------------------------------------------------
@@ -231,17 +229,21 @@
     //and make it run the code
     this->ContinueWorking = true;
     this->FinishedWorkingOnData = false;
+    this->CurrentRenderDataFinished = false;

     //clear the appender
     this->ComputedData = vtkSmartPointer<vtkAppendPolyData>::New();

-    logger << "CreateSearchStructure" << std::endl;
-    this->Volume = TEM::accel::SubdividedVolume( this->NumSubGridsPerDim,
-                                                 input,
-                                                 logger );
-
-    logger << "ComputeHighLows" << std::endl;
-    this->Volume.ComputeHighLows( begin, end, logger );
+    if(this->Volume.numSubGrids() == 0)
+      {
+      logger << "CreateSearchStructure" << std::endl;
+      this->Volume = TEM::accel::SubdividedVolume( this->NumSubGridsPerDim,
+                                                   input,
+                                                   logger );
+
+      logger << "ComputeHighLows" << std::endl;
+      this->Volume.ComputeHighLows( begin, end, logger );
+      }

     //now give the thread the volume to contour
@@ -266,6 +268,8 @@
     {
     CurrentRenderData->ShallowCopy(ComputedData->GetOutputDataObject(0));
     }
+  this->CurrentRenderDataFinished = this->FinishedWorkingOnData;
+
   return this->CurrentRenderData;
 }

@@ -273,6 +277,7 @@
   tbb::tbb_thread Thread;
   bool ContinueWorking;
   bool FinishedWorkingOnData;
+  bool CurrentRenderDataFinished;

   TEM::accel::SubdividedVolume Volume;
   vtkSmartPointer<vtkAppendPolyData> ComputedData;


BUG : fix mantis 1508 on extractROI fit mode with shapefile

--- Modules/Applications/AppImageUtils/app/otbExtractROI.cxx
+++ Modules/Applications/AppImageUtils/app/otbExtractROI.cxx
@@ -252,6 +252,7 @@
     if ( HasValue("in") )
       {
       ImageType* inImage = GetParameterImage("in");
+      inImage->UpdateOutputInformation();
       ImageType::RegionType  largestRegion = inImage->GetLargestPossibleRegion();

       bool userExtent = !HasUserValue( "mode.extent.ulx" ) \
@@ -385,7 +386,9 @@
     region.SetIndex(1, GetParameterInt("starty"));
     if ( HasValue("in") )
       {
-      if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion()))
+      ImageType* inImage = GetParameterImage("in");
+      inImage->UpdateOutputInformation();
+      if (region.Crop(inImage->GetLargestPossibleRegion()))
         {
         SetParameterInt("sizex",region.GetSize(0), HasUserValue("sizex"));
         SetParameterInt("sizey",region.GetSize(1), HasUserValue("sizey"));
@@ -426,19 +429,15 @@

       ImageType * inImage = GetParameterImage("in");
       FloatVectorImageType::IndexType uli , lri;
-      bool startin = inImage->TransformPhysicalPointToIndex(ulp,uli);
-      bool sizein = inImage->TransformPhysicalPointToIndex(lrp,lri);
-      if ( startin )
-        {
-        SetParameterInt( "startx", uli[0] , true );
-        SetParameterInt( "starty", uli[1] , true );
-        }
-
-      if( startin && sizein )
-        {
-        SetParameterInt( "sizex", lri[0] - uli[0] + 1, true );
-        SetParameterInt( "sizey", lri[1] - uli[1] + 1, true );
-        }
+      inImage->TransformPhysicalPointToIndex(ulp,uli);
+      inImage->TransformPhysicalPointToIndex(lrp,lri);
+
+      SetParameterInt( "startx", uli[0] , true );
+      SetParameterInt( "starty", uli[1] , true );
+
+      SetParameterInt( "sizex", lri[0] - uli[0] + 1, true );
+      SetParameterInt( "sizey", lri[1] - uli[1] + 1, true );
+
       }
     else if( GetParameterString( "mode.extent.unit" ) == "lonlat" )
       {
@@ -456,21 +455,16 @@
       lrp_out = rsTransform->TransformPoint(lrp_in);

       FloatVectorImageType::IndexType uli_out , lri_out;
-      bool startin = inImage->TransformPhysicalPointToIndex(ulp_out,uli_out);
-      bool sizein = inImage->TransformPhysicalPointToIndex(lrp_out,lri_out);
-
-      if ( startin )
-        {
-        SetParameterInt( "startx", uli_out[0] , true );
-        SetParameterInt( "starty", uli_out[1] , true );
-        }
-
-      if( startin && sizein )
-        {
-        SetParameterInt( "sizex", lri_out[0] - uli_out[0] + 1, true );
-        SetParameterInt( "sizey", lri_out[1] - uli_out[1] + 1, true );
-        }
-      }
+      inImage->TransformPhysicalPointToIndex(ulp_out,uli_out);
+      inImage->TransformPhysicalPointToIndex(lrp_out,lri_out);
+
+      SetParameterInt( "startx", uli_out[0] , true );
+      SetParameterInt( "starty", uli_out[1] , true );
+
+      SetParameterInt( "sizex", lri_out[0] - uli_out[0] + 1, true );
+      SetParameterInt( "sizey", lri_out[1] - uli_out[1] + 1, true );
+      }
+      this->CropRegionOfInterest();
   }

   void
@@ -685,10 +679,10 @@
     ImageType* inImage = GetParameterImage("in");
     inImage->UpdateOutputInformation();

-    if ( HasValue( "mode.fit.vect" ) && GetParameterString("mode") == "fit" )
+    if ( HasValue( "mode.fit.vect" ) && GetParameterString("mode") == "fit")
       {
       otb::ogr::DataSource::Pointer ogrDS;
-      ogrDS = otb::ogr::DataSource::New(GetParameterString("in") ,
+      ogrDS = otb::ogr::DataSource::New(GetParameterString("mode.fit.vect") ,
                                         otb::ogr::DataSource::Modes::Read);
       double ulx, uly, lrx, lry;
       bool extentAvailable = true;
@@ -724,40 +718,50 @@
       if (extentAvailable)
         {
         RSTransformType::Pointer rsTransform = RSTransformType::New();
-        rsTransform->SetInputProjectionRef(inputProjectionRef);
+        rsTransform->SetInputProjectionRef( inputProjectionRef );
         rsTransform->SetOutputKeywordList( inImage->GetImageKeywordlist() );
         rsTransform->SetOutputProjectionRef( inImage->GetProjectionRef() );
         rsTransform->InstantiateTransform();
-
-        itk::Point<float, 2> ulp_in,  lrp_in , ulp_out , lrp_out;
+        itk::Point<float, 2> ulp_in , urp_in , llp_in , lrp_in ,
+          ulp_out , urp_out , llp_out , lrp_out;
         ulp_in[ 0 ] = ulx ;
         ulp_in[ 1 ] = uly ;
+        urp_in[ 0 ] = ulx ;
+        urp_in[ 1 ] = lry ;
+        llp_in[ 0 ] = lrx ;
+        llp_in[ 1 ] = ulx ;
         lrp_in[ 0 ] = lrx ;
         lrp_in[ 1 ] = lry ;
         ulp_out = rsTransform->TransformPoint(ulp_in);
+        urp_out = rsTransform->TransformPoint(urp_in);
+        llp_out = rsTransform->TransformPoint(llp_in);
         lrp_out = rsTransform->TransformPoint(lrp_in);
-
-        FloatVectorImageType::IndexType uli_out , lri_out;
-        bool startin , sizein ;
-        startin = inImage->TransformPhysicalPointToIndex(ulp_out,uli_out);
-        sizein = inImage->TransformPhysicalPointToIndex(lrp_out,lri_out);
-
-        if ( startin )
-            {
-            SetParameterInt( "startx", uli_out[0] , false );
-            SetParameterInt( "starty", uli_out[1] , false );
-            }
-
-        if( startin && sizein )
-            {
-            SetParameterInt( "sizey", lri_out[1] - uli_out[1] + 1 , false );
-            SetParameterInt( "sizex", lri_out[0] - uli_out[0] + 1 , false );
-            }
-        }
+        FloatVectorImageType::IndexType uli_out , uri_out , lli_out , lri_out;
+
+        inImage->TransformPhysicalPointToIndex(ulp_out,uli_out);
+        inImage->TransformPhysicalPointToIndex(urp_out,uri_out);
+        inImage->TransformPhysicalPointToIndex(llp_out,lli_out);
+        inImage->TransformPhysicalPointToIndex(lrp_out,lri_out);

-      }
-
-    if( HasValue( "mode.fit.im" ) && GetParameterString( "mode" ) == "fit" )
+        FloatVectorImageType::IndexType uli, lri;
+
+        uli[0] = std::min( std::min( uli_out[0] , uri_out[0] ) ,
+                           std::min( lli_out[0] , lri_out[0] ) );
+        uli[1] = std::min( std::min( uli_out[1] , uri_out[1] ) ,
+                           std::min( lli_out[1] , lri_out[1] ) );
+
+        lri[0] = std::max( std::max( uli_out[0] , uri_out[0] ) ,
+                           std::max( lli_out[0] , lri_out[0] ) );
+        lri[1] = std::max( std::max( uli_out[1] , uri_out[1] ) ,
+                           std::max( lli_out[1] , lri_out[1] ) );
+
+        SetParameterInt( "startx", uli[0] , false );
+        SetParameterInt( "starty", uli[1] , false );
+        SetParameterInt( "sizex", lri[0] - uli[0] , false );
+        SetParameterInt( "sizey", lri[1] - uli[1] , false );
+        }
+      }
+    else if( HasValue( "mode.fit.im" ) && GetParameterString( "mode" ) == "fit" )
       {
       // Setup the DEM Handler
       otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
@@ -820,9 +824,9 @@
       SetParameterInt("sizex",lri[0]-uli[0]);
       SetParameterInt("sizey",lri[1]-uli[1]);

-      this->CropRegionOfInterest();
-      }
-
+      }
+
+    this->CropRegionOfInterest();

     m_ExtractROIFilter = ExtractROIFilterType::New();
     m_ExtractROIFilter->SetInput(inImage);


Fixed number of progress steps in plane suggestion in 3D-interpolation.

Signed-off-by: KuznetsovAlexander <61389d627fc49b4cf505715d839d79055a6c4d39@rambler.ru>

--- Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.cpp
+++ Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.cpp
@@ -885,7 +885,7 @@
 void ::QmitkSlicesInterpolator::RunPlaneSuggestion()
 {
   if (m_FirstRun)
-    mitk::ProgressBar::GetInstance()->AddStepsToDo(8);
+    mitk::ProgressBar::GetInstance()->AddStepsToDo(7);
   else
     mitk::ProgressBar::GetInstance()->AddStepsToDo(3);


Fixed clipping function bug and added depth value as parameter

--- src/Camera.cpp
+++ src/Camera.cpp
@@ -14,9 +14,7 @@
 }

 const bool Camera::insideFrustrum(const Point2D& point_raster, const float depth) const {
-  const float half_w = m_image_width / 2;
-  const float half_h = m_image_height / 2;
-  return (point_raster.x < half_w && point_raster.x > -half_w &&
-    point_raster.y < half_h && point_raster.y > -half_h &&
-    depth > m_near && depth < m_far);
+  return (point_raster.x < m_image_width && point_raster.x >= 0 &&
+    point_raster.y < m_image_height && point_raster.y >= 0 &&
+    depth >= m_near && depth <= m_far);
 }


Missing <cstring> to use std::strcmp()

Missing <cstring> to use std::strcmp()

--- app/app.cpp
+++ app/app.cpp
@@ -14,6 +14,8 @@
 #include "doc_view.h"
 #include "lua.h"
 #include "view.h"
+
+#include <cstring>

 App::App(int argc, char* argv[])
   : m_lua(new Lua)


Do not delete lock file on shutdown when not being the primary instance

--- src/Common.cpp
+++ src/Common.cpp
@@ -288,12 +288,14 @@
         closesocket(mSocket);
     }
 #else
-    if (mIsPrimaryInstance && mLockFileDescriptor != -1) {
-        close(mLockFileDescriptor);
-    }
-
-    // Delete the lock file if it exists.
-    unlink(mLockFile.c_str());
+    if (mIsPrimaryInstance) {
+        if (mLockFileDescriptor != -1) {
+            close(mLockFileDescriptor);
+        }
+
+        // Delete the lock file if it exists.
+        unlink(mLockFile.c_str());
+    }

     if (mSocket != INVALID_SOCKET) {
         close(mSocket);


XXX comment

XXX comment

--- src/Common.hpp
+++ src/Common.hpp
@@ -34,6 +34,8 @@
 // External libraries
 // XXX: UGLY!
 #include <json/json.h>
+
+// XXX: Some of the CMake stuff includes library (singular, this is bad. It hsould include plurarl!

 // Boost headers
 #include <boost/optional.hpp>


break out first and last to their own requests that get no replies

--- examples/ring/testring.cpp
+++ examples/ring/testring.cpp
@@ -189,10 +189,13 @@
   sem_wait(&setresult_sem);
   ring->set(ringid, REG_END, size);      // bufferend
   sem_wait(&setresult_sem);
-  ring->set(ringid, REG_FIRST, 0);         // bufferfirst
-  sem_wait(&setresult_sem);
-  ring->set(ringid, REG_LAST, 0);         // bufferlast
-  sem_wait(&setresult_sem);
+  if (ringid == 0) {
+    ring->setCmdFirst(0);         // bufferfirst
+    ring->setCmdLast(0);
+  } else {
+    ring->setStatusnFirst(0);         // bufferfirst
+    ring->setStatusLast(0);
+  }
   ring->set(ringid, REG_MASK, size - 1);  // buffermask
   sem_wait(&setresult_sem);
   ring->set(ringid, REG_HANDLE, ref);       // memhandle
@@ -218,8 +221,11 @@
   r->last = last;
   /* update hardware version of r->last every 1/4 way around the ring */
   if ((r->last % (r->size >> 2)) == 0) {
-    ring->set(r->ringid, REG_LAST, r->last);         // bufferlast
-    sem_wait(&setresult_sem);
+    if (ring->ringid == 0) {
+      ring->setCmdLast(r->last);         // bufferlast
+    } else {
+      ring->setStatusLast(r->last);         // bufferlast
+    }
   }
 }

@@ -253,7 +259,11 @@
   if (next_first == r->size) next_first = 0;
   r->first = next_first;
   r->cached_space -= 64;
-  ring->set(r->ringid, REG_FIRST, r->first);         // bufferfirst
+  if (r->ringid == 0) {
+    ring->setCmdFirst(r->first);         // bufferfirst
+  } else {
+    ring->setStatusFirst(r->first);         // bufferfirst
+  }
   sem_wait(&setresult_sem);
   pthread_mutex_unlock(&cmd_lock);
 }


Python API: User can now open the default device.

--- bindings/python/PyDevice.cpp
+++ bindings/python/PyDevice.cpp
@@ -48,14 +48,14 @@
 	Device* self;

 	static const char* kwlist[] = {"type", "rate", "channels", "format", "buffer_size", "name", nullptr};
-	const char* device;
+	const char* device = nullptr;
 	double rate = RATE_44100;
 	int channels = CHANNELS_STEREO;
 	int format = FORMAT_FLOAT32;
 	int buffersize = AUD_DEFAULT_BUFFER_SIZE;
 	const char* name = "";

-	if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|diiis:Device", const_cast<char**>(kwlist),
+	if(!PyArg_ParseTupleAndKeywords(args, kwds, "|sdiiis:Device", const_cast<char**>(kwlist),
 									&device, &rate, &channels, &format, &buffersize, &name))
 		return nullptr;

@@ -78,14 +78,31 @@

 		try
 		{
-			auto factory = DeviceManager::getDeviceFactory(device);
-
-			if(factory)
+			if(!device)
 			{
-				factory->setName(name);
-				factory->setSpecs(specs);
-				factory->setBufferSize(buffersize);
-				self->device = new std::shared_ptr<IDevice>(factory->openDevice());
+				auto dev = DeviceManager::getDevice();
+				if(!dev)
+				{
+					DeviceManager::openDefaultDevice();
+					dev = DeviceManager::getDevice();
+				}
+				self->device = new std::shared_ptr<IDevice>(dev);
+			}
+			else
+			{
+				std::shared_ptr<IDeviceFactory> factory;
+				if(!*device)
+					factory = DeviceManager::getDefaultDeviceFactory();
+				else
+					factory = DeviceManager::getDeviceFactory(device);
+
+				if(factory)
+				{
+					factory->setName(name);
+					factory->setSpecs(specs);
+					factory->setBufferSize(buffersize);
+					self->device = new std::shared_ptr<IDevice>(factory->openDevice());
+				}
 			}
 		}
 		catch(Exception& e)


metaeditor plugin build and load on linux fixed

--- plugins/metaEditor/metaEditorSupport/editorGenerator.cpp
+++ plugins/metaEditor/metaEditorSupport/editorGenerator.cpp
@@ -127,6 +127,8 @@
 	if (pluginDir.absoluteFilePath().count() > 2 && pluginDir.absoluteFilePath()[1] == ':') {
 		// Remove drive letter on Windows.
 		result += pluginDir.absoluteFilePath().remove(0, 2);
+	} else {
+		result += pluginDir.absoluteFilePath();
 	}

 	return result;


Implemented Collisionable interface for Circle and Walls.

--- demo/demo_BasicPhysics.cpp
+++ demo/demo_BasicPhysics.cpp
@@ -42,15 +42,23 @@
         }

         return v;
+    }

-    }
+    virtual int getXMin() { return xMin; }
+
+    virtual int getYMin() { return yMin; }
+
+    virtual int getXMax() { return xMax; }
+
+    virtual int getYMax() { return yMax; }
+
+

 protected:
     /* do not react when force applied */
     virtual void applyForce(const sf::Vector2f & f) {}

 };
-

 ////////////////////////////////////////////////////////////////////////

@@ -64,24 +72,33 @@

 public:
     Circle(const float& rad = 32,
-            const sf::Color& c = sf::Color::White)
-      : TestBody(), m_radius(rad){
-      m_sprite = new sf::CircleShape(m_radius);
-      m_sprite->setRadius(m_radius);
+           const sf::Color& c = sf::Color::White)
+        : TestBody(), m_radius(rad){
+        m_sprite = new sf::CircleShape(m_radius);
+        m_sprite->setRadius(m_radius);
         m_sprite->setFillColor(c);
-        addComponent(new render::RenderingComponent(new sf::CircleShape(m_radius) ) );
+        addComponent
+            (new render::RenderingComponent
+             (new sf::CircleShape(m_radius) ) );
     };
+
     virtual ~Circle();
-  virtual sf::Vector2f getNormal(int x, int y) {
-    int tx = getTransform().getPosition().x;
-    int ty = getTransform().getPosition().y;
-    float _x = x - tx;
-    float _y = y - ty;
-    float len = sqrt(pow(_x, 2) + pow(_y, 2));
+
+    virtual sf::Vector2f getNormal(int x, int y) {
+        float _x = x - getTransform().getPosition().x;;
+        float _y = y - getTransform().getPosition().y;
+        float len = sqrt(pow(_x, 2) + pow(_y, 2));

-    return sf::Vector2f ( _x / len, _y / len);
-
+        return sf::Vector2f ( _x / len, _y / len);
     }
+
+    virtual int getXMin() { return getTransform().getPosition().x - radius; }
+
+    virtual int getYMin() { return getTransform().getPosition().y - radius; }
+
+    virtual int getXMax() { return getTransform().getPosition().x + radius; }
+
+    virtual int getYMax() { return getTransform().getPosition().y + radius; }

 };


added short note

added short note

--- framework/SDFLoader.cpp
+++ framework/SDFLoader.cpp
@@ -30,7 +30,7 @@
     ifstream file(scenefile);
     //file.open(scenefile, ios::in);
     if (file.is_open()) {
-
+        //stringStream benutzen
         while (getline (file,line)){
             if (line.substr(0,15)=="define material"){
                 //extract name


use truncation by default in Radish

use truncation by default in Radish

--- raco/language/cbase_templates/materialized_tuple_ref.cpp
+++ raco/language/cbase_templates/materialized_tuple_ref.cpp
@@ -99,7 +99,8 @@
                {
                std::string _temp;
                std::getline(ss, _temp, delim);
-               _ret.f{{i}} = to_array<MAX_STR_LEN, std::string>(_temp);
+               // beware; truncate= true, so unckecked truncation for stringlen >= MAX_STR_LEN!
+               _ret.f{{i}} = to_array<MAX_STR_LEN, std::string, true>(_temp);
                }
             {% else %}
                {


Fix State Space warnings.

Fix State Space warnings.

git-svn-id: b6c97393e82be3812a607970066d172a5388f86f@3012 df83fd30-4cca-4c36-ab9d-e8b5583ccbd1

--- src/omxStateSpaceExpectation.cpp
+++ src/omxStateSpaceExpectation.cpp
@@ -137,7 +137,7 @@
 	if(OMX_DEBUG_ALGEBRA) {omxPrintMatrix(C, "....State Space: C"); }
 	omxMatrix* D = ose->D;
 	if(OMX_DEBUG_ALGEBRA) {omxPrintMatrix(D, "....State Space: D"); }
-	omxMatrix* R = ose->R; //unused
+	// omxMatrix* R = ose->R; //unused
 	omxMatrix* r = ose->r;
 	omxMatrix* s = ose->s;
 	omxMatrix* u = ose->u;
@@ -146,11 +146,11 @@
 	if(OMX_DEBUG_ALGEBRA) {omxPrintMatrix(x, "....State Space: x"); }
 	omxMatrix* y = ose->y;
 	if(OMX_DEBUG_ALGEBRA) {omxPrintMatrix(y, "....State Space: y"); }
-	omxMatrix* K = ose->K;
+	// omxMatrix* K = ose->K; //unused
 	omxMatrix* P = ose->P;
-	omxMatrix* S = ose->S; //unused
-	omxMatrix* Y = ose->Y; //unused
-	omxMatrix* Cov = ose->cov;
+	omxMatrix* S = ose->S;
+	// omxMatrix* Y = ose->Y; //unused
+	// omxMatrix* Cov = ose->cov; //unused
 	omxMatrix* Means = ose->means;
 	omxMatrix* Det = ose->det;
 	*Det->data = 0.0; // the value pointed to by Det->data is assigned to be zero


remove warnings

remove warnings

--- src/condor_c++_util/condor_credential.C
+++ src/condor_c++_util/condor_credential.C
@@ -138,8 +138,8 @@
     strncpy(userid_, userid, strlen(userid));
 }

-Condor_Credential_M :: Condor_Credential_M(const char   * userid,
-					   ReliSock     * sock)
+Condor_Credential_M :: Condor_Credential_M(const char   *  /*userid*/,
+					   ReliSock     *  /*sock*/)
   : userid_ (NULL),
     credMap_(new Condor_Cred_Map())


Updated Arduino test suite for PIC32

Updated Arduino test suite for PIC32

Former-commit-id: 3239cab768fec3e26030c5e6605b0fa81e8c02c0

--- pic32/libraries/ArduinoTestSuite/ArduinoTestSuite.cpp
+++ pic32/libraries/ArduinoTestSuite/ArduinoTestSuite.cpp
@@ -16,11 +16,12 @@
 //*	Aug 31,	2010	<MLS> Started on TestArduino
 //*	Oct 18,	2010	<MLS> Added memory testing
 //************************************************************************
-
-#include	<avr/pgmspace.h>
-#include	<avr/io.h>
-#include	<avr/eeprom.h>
-
+3
+#if defined(__AVR__)
+	#include	<avr/pgmspace.h>
+	#include	<avr/io.h>
+	#include	<avr/eeprom.h>
+#endif

 #include	"ArduinoTestSuite.h"


Print out more debug info to log on a error from select().

--- src/condor_daemon_core.V6/daemon_core.C
+++ src/condor_daemon_core.V6/daemon_core.C
@@ -2800,6 +2800,10 @@

 		if ( selector.failed() ) {
 			// not just interrupted by a signal...
+				dprintf(D_ALWAYS,"Socket Table:\n");
+        		DumpSocketTable( D_ALWAYS );
+				dprintf(D_ALWAYS,"State of selector:\n");
+				selector.display();
 				EXCEPT("DaemonCore: select() returned an unexpected error: %d (%s)",tmpErrno,strerror(tmpErrno));
 		}
 #else


Actually pass the plugin along.

Actually pass the plugin along.

--- addons/snippets/katesnippets.cpp
+++ addons/snippets/katesnippets.cpp
@@ -58,7 +58,7 @@
     setXMLFile(QStringLiteral("ui.rc"));

     // Toolview for snippets
-    m_toolView = mainWindow->createToolView(0, QStringLiteral("kate_private_plugin_katesnippetsplugin"),
+    m_toolView = mainWindow->createToolView(plugin, QStringLiteral("kate_private_plugin_katesnippetsplugin"),
                      KTextEditor::MainWindow::Right,
                      QIcon::fromTheme(QStringLiteral("document-new")),
                      i18n("Snippets"));


New template doc-strings

New template doc-strings

--- src/chemreac_template.cpp
+++ src/chemreac_template.cpp
@@ -1,8 +1,9 @@
 ## -*- coding: utf-8 -*-
-// This is a templated source file. (Make sure you're editing the
-// template)
+// ${_warning_in_the_generated_file_not_to_edit}
+<%doc>
+// This is a templated source file.
 // Render template using Mako (Python templating engine)
-
+</%doc>
 #include <algorithm> // count
 #include <vector>
 #include "chemreac.h"


Fixed angularAccelerationTest in PredictSensorsMeasurementsUnitTest

--- src/model_io/urdf/tests/PredictSensorsMeasurementUnitTest.cpp
+++ src/model_io/urdf/tests/PredictSensorsMeasurementUnitTest.cpp
@@ -131,7 +131,7 @@
                 ASSERT_EQUAL_DOUBLE(gyro1(1),0);
                 ASSERT_EQUAL_DOUBLE(gyro1(2),0);
                 ASSERT_EQUAL_DOUBLE(accl2(0),0);
-                ASSERT_EQUAL_DOUBLE(accl2(1),-0.1*acclTestVal);
+                ASSERT_EQUAL_DOUBLE(accl2(1),0.1*acclTestVal);
                 ASSERT_EQUAL_DOUBLE(accl2(2),0);
                 break;
     }


The DependencyThreadPool works with cu::Slice arguments now.

This makes the call to executing functions more generic.

--- dependency_thread_pool.hpp
+++ dependency_thread_pool.hpp
@@ -4,6 +4,7 @@
 #pragma once

 #include "scope_guard.hpp"
+#include "slice.hpp"
 #include "task_queue_thread_pool.hpp"

 #include <algorithm>
@@ -12,7 +13,6 @@
 #include <map>
 #include <type_traits>
 #include <unordered_map>
-#include <vector>

 namespace cu
 {
@@ -39,32 +39,34 @@
 };

+/// A threadpool for tasks that depend upon each other.
+///
+/// The threadpool will only start the execution of a task, if all the tasks
+/// it depends on have been finished.
+/// When the client issues a task, then an @c std::future<T> and a task id
+/// will be returned in a @c DependencyThreadPoolBase::Result<T> structure.
+/// The returned id can be used as dependency for other subsequent tasks.
+/// Therefore cyclic dependencies are impossible by design.
+///
+/// The template type arguments are the arguments that will be passed to the
+/// tasks and are data elements of the threadpool just as in
+/// @c TaskQueueThreadPool.
 template <typename ...Args>
 class DependencyThreadPool
     : public DependencyThreadPoolBase
 {
 public:
+  /// Schedules a task.
+  ///
+  /// The task will be executed only after all tasks it depends upon have
+  /// been finished.
+  /// @param dependencyIds specifies the tasks upon which the new task depends.
+  /// @returns A struct with a member @c future which designates the
+  /// asynchroneous result and a member @c id which identifies the task with a
+  /// unique id. This id can be used as dependency id for new tasks.
   template <typename F>
-  decltype(auto) operator()(
-      const std::initializer_list<Id> & dependencyIds,
-      F && f )
-  {
-    return run( dependencyIds, std::forward<F>(f) );
-  }
-
-  template <typename F>
-  decltype(auto) operator()(
-      const std::vector<Id> & dependencyIds,
-      F && f )
-  {
-    return run( dependencyIds, std::forward<F>(f) );
-  }
-
-private:
-  template <typename F,
-            typename IdContainer>
-  Result<typename std::result_of<F(Args...)>::type> run(
-      const IdContainer & dependencyIds,
+  Result<typename std::result_of<F(Args...)>::type> operator()(
+      const cu::Slice<const Id> dependencyIds,
       F && f )
   {
     auto pt = std::packaged_task<std::result_of_t<F(Args...)>(Args&&...)>(
@@ -85,6 +87,7 @@
     return { std::move(future), id };
   }

+private:
   struct Node
   {
     Node(
@@ -106,9 +109,8 @@
     Id idCounter = 0;
     std::map<Id,Node> nodes;

-    template <typename IdContainer>
     std::size_t updateDependencies(
-        const IdContainer & dependencies,
+        const cu::Slice<const Id>  dependencies,
         Id id )
     {
       std::size_t nDependencies = 0;


Updates from review by DanB #712

Updates from review by DanB #712

--- src/condor_negotiator.V6/matchmaker.cpp
+++ src/condor_negotiator.V6/matchmaker.cpp
@@ -1111,7 +1111,7 @@
 			scheddAds.Open();
 			int numrunning=0;
 			int numidle=0;
-			int totaljobs=0;
+
 			numsubmits[groupArrayLen]=0;
 			int totalsubmits=0;
 			float schedusagetotal=0;
@@ -1133,9 +1133,9 @@
 			groupArray[groupArrayLen].maxAllowed = unclaimedquota;
 			groupArray[groupArrayLen].usage = schedusagetotal;
 			groupArray[groupArrayLen].prio = 100;
-			if( totaljobs==0 ){
+			if(numsubmits[groupArrayLen] ==0 ){
 		 		  unusedslots=unusedslots+(int)groupArray[groupArrayLen].maxAllowed;
-		   	} else if(totaljobs<(int)groupArray[groupArrayLen].maxAllowed ) {
+		   	} else if(numsubmits[groupArrayLen]<(int)groupArray[groupArrayLen].maxAllowed ) {
 			 	unusedslots=unusedslots+(int)groupArray[groupArrayLen].maxAllowed-numsubmits[groupArrayLen];
 			}
 			groupArrayLen=groupArrayLen+1;


Eagerly initialize NSS and OCSP on IOThread.

IOThread and the sync thread race to initialize OCSP (lazily done by SSLClientSocketNSS), but OCSP is only allowed to be initialized on the IOThread.  So we eagerly initialize it to prevent the race.  Hopefully this doesn't regress startup time!

BUG=36740
TEST=none

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

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


From Olaf Flebbe, change from powf to ldexp.

--- src/osgPlugins/hdr/hdrloader.cpp
+++ src/osgPlugins/hdr/hdrloader.cpp
@@ -138,9 +138,7 @@

 float convertComponent(int _expo, int _val)
 {
-    float v = _val / 256.0f;
-    float d = powf(2.0f, (float)_expo);
-    return v * d;
+    return ldexp( (float)_val / 256.0f, _expo);
 }

 void workOnRGBE(RGBE *_scan, int _len, float *_cols)


In Docker uni, make /tmp 01777 so all users can write #7459

Especially important in docker-allows-root mode

--- src/condor_starter.V6.1/docker_proc.cpp
+++ src/condor_starter.V6.1/docker_proc.cpp
@@ -815,12 +815,15 @@
 			const char * hostDir = dirscat(workingDir.c_str(), scratchName, hostdirbuf);
 			std::string volumePath;
 			volumePath.append(hostDir).append(":").append(scratchName);
-			if (mkdir_and_parents_if_needed( hostDir, S_IRWXU, PRIV_USER )) {
+
+			mode_t old_mask = umask(000);
+			if (mkdir_and_parents_if_needed( hostDir, 01777, PRIV_USER )) {
 				extras.push_back(volumePath);
 				dprintf(D_ALWAYS, "Adding %s as a docker volume to mount under scratch\n", volumePath.c_str());
 			} else {
 				dprintf(D_ALWAYS, "Failed to create scratch directory %s\n", hostDir);
 			}
+			umask(old_mask);
 		}
 	}


[ox/std] Fix placement new declaration to use stdlib declaration if available

--- deps/ox/src/ox/std/new.hpp
+++ deps/ox/src/ox/std/new.hpp
@@ -22,7 +22,11 @@
 #endif

+#if __has_include(<new>)
+#include <new>
+#else
 void *operator new(std::size_t, void*) noexcept;
+#endif

 /**


BugFix: missing spotIndex to match wins in post auction loop

Fix the following messages that arise in the pal from using the http
bidder interface:
what:   Unknown spot index: : false at ./rtbkit/common/bids.cc:201 in RTBKIT::Bid& RTBKIT::Bids::bidForSpot(int)

--- rtbkit/plugins/bidder_interface/http_bidder_interface.cc
+++ rtbkit/plugins/bidder_interface/http_bidder_interface.cc
@@ -334,6 +334,7 @@
                              }

                              auto &bidInfo = bidsToSubmit[agent];
+                             theBid.spotIndex = spotIndex;
                              bidInfo.bids.bidForSpot(spotIndex) = theBid;
                          }
                      }


Fix rows initialization of accum matrix

Fix rows initialization of accum matrix

--- bs_bos_core/src/jacobian.cpp
+++ bs_bos_core/src/jacobian.cpp
@@ -162,12 +162,15 @@
     t_long *accum_cols = accum->get_cols_ind ()->data ();
     t_double *accum_vals = accum->get_values ()->data ();
     // OPENMP
+    for (t_long i = 0; i < elements + 1; ++i)
+      {
+        accum_rows[i] = i;
+      }
     for (t_long i = 0; i < elements; ++i)
       {
-        accum_rows[i] = i;
         accum_cols[i] = i;
       }
-    for (t_long i = 0; i < elements * phases; ++i)
+    for (t_long i = 0; i < elements * phases * phases; ++i)
       {
         accum_vals[i] = 0;
       }


Fix a new RunConfig incompatibility

Fix a new RunConfig incompatibility

--- src/classes/RunConfig.cxx
+++ src/classes/RunConfig.cxx
@@ -196,6 +196,9 @@
    }
    if (recordSpin == true && spinMeasFreq == 0.0) {
       throw runtime_error("Incompatible options in RunConfig: Check RecordSpin and SpinMeasFreq");
+   }
+   if (recordField == true && magField == false) {
+      throw runtime_error("Incompatible options in RunConfig: Check RecordField and MagField");
    }
    if (recordField == true && fieldMeasInterval == 0.0) {
       throw runtime_error("Incompatible options in RunConfig: Check RecordField and FieldMeasFreq");


Fixing compile error

Fixing compile error

--- src/classpath-android.cpp
+++ src/classpath-android.cpp
@@ -66,6 +66,7 @@
   just ignore this request. */
   if (strcmp(RUNTIME_ARRAY_BODY(n), "conscrypt_jni") != 0) {
     loadLibrary(t, "", RUNTIME_ARRAY_BODY(n), true, true);
+  }
 }

 void JNICALL


tolerate missing classes in interceptFileOperations

If we fail to resolve a given class (e.g. due to ProGuard obfuscating
or eliminating it), just move on to the next one rather than return
immediately.  Otherwise, we may miss intercepting methods of classes
we can resolve.

--- src/classpath-openjdk.cpp
+++ src/classpath-openjdk.cpp
@@ -1691,156 +1691,174 @@
   MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);

   { object fileClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/io/File");
-    if (fileClass == 0) return;
-
-    object filePathField = findFieldInClass2
-      (t, fileClass, "path", "Ljava/lang/String;");
-    if (filePathField == 0) return;
-
-    cp->filePathField = fieldOffset(t, filePathField);
+      (t, root(t, Machine::BootLoader), "java/io/File", false);
+
+    if (fileClass) {
+      object filePathField = findFieldInClass2
+        (t, fileClass, "path", "Ljava/lang/String;");
+
+      if (filePathField) {
+        cp->filePathField = fieldOffset(t, filePathField);
+      }
+    }
   }

   { object fileDescriptorClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/io/FileDescriptor");
-    if (fileDescriptorClass == 0) return;
-
-    object fileDescriptorFdField = findFieldInClass2
-      (t, fileDescriptorClass, "fd", "I");
-    if (fileDescriptorFdField == 0) return;
-
-    cp->fileDescriptorFdField = fieldOffset(t, fileDescriptorFdField);
+      (t, root(t, Machine::BootLoader), "java/io/FileDescriptor", false);
+
+    if (fileDescriptorClass) {
+      object fileDescriptorFdField = findFieldInClass2
+        (t, fileDescriptorClass, "fd", "I");
+
+      if (fileDescriptorFdField) {
+        cp->fileDescriptorFdField = fieldOffset(t, fileDescriptorFdField);
+      }
+    }
   }

   { object fileInputStreamClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/io/FileInputStream");
-    if (fileInputStreamClass == 0) return;
-
-    PROTECT(t, fileInputStreamClass);
-
-    object fileInputStreamFdField = findFieldInClass2
-      (t, fileInputStreamClass, "fd", "Ljava/io/FileDescriptor;");
-    if (fileInputStreamFdField == 0) return;
-
-    cp->fileInputStreamFdField = fieldOffset(t, fileInputStreamFdField);
-
-    intercept(t, fileInputStreamClass, "open", "(Ljava/lang/String;)V",
-              voidPointer(openFile));
+      (t, root(t, Machine::BootLoader), "java/io/FileInputStream", false);
+
+    if (fileInputStreamClass) {
+      PROTECT(t, fileInputStreamClass);
+
+      object fileInputStreamFdField = findFieldInClass2
+        (t, fileInputStreamClass, "fd", "Ljava/io/FileDescriptor;");
+
+      if (fileInputStreamFdField) {
+        cp->fileInputStreamFdField = fieldOffset(t, fileInputStreamFdField);
+
+        intercept(t, fileInputStreamClass, "open", "(Ljava/lang/String;)V",
+                  voidPointer(openFile));

-    intercept(t, fileInputStreamClass, "read", "()I",
-              voidPointer(readByteFromFile));
+        intercept(t, fileInputStreamClass, "read", "()I",
+                  voidPointer(readByteFromFile));

-    intercept(t, fileInputStreamClass, "readBytes", "([BII)I",
-              voidPointer(readBytesFromFile));
+        intercept(t, fileInputStreamClass, "readBytes", "([BII)I",
+                  voidPointer(readBytesFromFile));

-    intercept(t, fileInputStreamClass, "skip", "(J)J",
-              voidPointer(skipBytesInFile));
+        intercept(t, fileInputStreamClass, "skip", "(J)J",
+                  voidPointer(skipBytesInFile));

-    intercept(t, fileInputStreamClass, "available", "()I",
-              voidPointer(availableBytesInFile));
+        intercept(t, fileInputStreamClass, "available", "()I",
+                  voidPointer(availableBytesInFile));

-    intercept(t, fileInputStreamClass, "close0", "()V",
-              voidPointer(closeFile));
+        intercept(t, fileInputStreamClass, "close0", "()V",
+                  voidPointer(closeFile));
+      }
+    }
   }

   { object zipEntryClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/util/zip/ZipEntry");
-    if (zipEntryClass == 0) return;
-
-    PROTECT(t, zipEntryClass);
-
-    object zipEntryNameField = findFieldInClass2
-      (t, zipEntryClass, "name", "Ljava/lang/String;");
-    if (zipEntryNameField == 0) return;
-
-    cp->zipEntryNameField = fieldOffset(t, zipEntryNameField);
-
-    object zipEntryTimeField = findFieldInClass2
-      (t, zipEntryClass, "time", "J");
-    if (zipEntryTimeField == 0) return;
-
-    cp->zipEntryTimeField = fieldOffset(t, zipEntryTimeField);
-
-    object zipEntryCrcField = findFieldInClass2
-      (t, zipEntryClass, "crc", "J");
-    if (zipEntryCrcField == 0) return;
-
-    cp->zipEntryCrcField = fieldOffset(t, zipEntryCrcField);
-
-    object zipEntrySizeField = findFieldInClass2
-      (t, zipEntryClass, "size", "J");
-    if (zipEntrySizeField == 0) return;
-
-    cp->zipEntrySizeField = fieldOffset(t, zipEntrySizeField);
-
-    object zipEntryCsizeField = findFieldInClass2
-      (t, zipEntryClass, "csize", "J");
-    if (zipEntryCsizeField == 0) return;
-
-    cp->zipEntryCsizeField = fieldOffset(t, zipEntryCsizeField);
-
-    object zipEntryMethodField = findFieldInClass2
-      (t, zipEntryClass, "method", "I");
-    if (zipEntryMethodField == 0) return;
-
-    cp->zipEntryMethodField = fieldOffset(t, zipEntryMethodField);
-
-    intercept(t, zipEntryClass, "initFields", "(J)V",
-              voidPointer(initializeZipEntryFields));
+      (t, root(t, Machine::BootLoader), "java/util/zip/ZipEntry", false);
+
+    if (zipEntryClass) {
+      PROTECT(t, zipEntryClass);
+
+      object zipEntryNameField = findFieldInClass2
+        (t, zipEntryClass, "name", "Ljava/lang/String;");
+
+      if (zipEntryNameField) {
+        cp->zipEntryNameField = fieldOffset(t, zipEntryNameField);
+
+        object zipEntryTimeField = findFieldInClass2
+          (t, zipEntryClass, "time", "J");
+
+        if (zipEntryTimeField) {
+          cp->zipEntryTimeField = fieldOffset(t, zipEntryTimeField);
+
+          object zipEntryCrcField = findFieldInClass2
+            (t, zipEntryClass, "crc", "J");
+
+          if (zipEntryCrcField) {
+            cp->zipEntryCrcField = fieldOffset(t, zipEntryCrcField);
+
+            object zipEntrySizeField = findFieldInClass2
+              (t, zipEntryClass, "size", "J");
+
+            if (zipEntrySizeField) {
+              cp->zipEntrySizeField = fieldOffset(t, zipEntrySizeField);
+
+              object zipEntryCsizeField = findFieldInClass2
+                (t, zipEntryClass, "csize", "J");
+
+              if (zipEntryCsizeField) {
+                cp->zipEntryCsizeField = fieldOffset(t, zipEntryCsizeField);
+
+                object zipEntryMethodField = findFieldInClass2
+                  (t, zipEntryClass, "method", "I");
+
+                if (zipEntryMethodField) {
+                  cp->zipEntryMethodField = fieldOffset
+                    (t, zipEntryMethodField);
+
+                  intercept(t, zipEntryClass, "initFields", "(J)V",
+                            voidPointer(initializeZipEntryFields));
+                }
+              }
+            }
+          }
+        }
+      }
+    }
   }

   { object zipFileClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/util/zip/ZipFile");
-    if (zipFileClass == 0) return;
-
-    PROTECT(t, zipFileClass);
-
-    object zipFileJzfileField = findFieldInClass2
-      (t, zipFileClass, "jzfile", "J");
-    if (zipFileJzfileField == 0) return;
-
-    cp->zipFileJzfileField = fieldOffset(t, zipFileJzfileField);
-
-    intercept(t, zipFileClass, "open", "(Ljava/lang/String;IJ)J",
-              voidPointer(openZipFile));
-
-    intercept(t, zipFileClass, "getTotal", "(J)I",
-              voidPointer(getZipFileEntryCount));
-
-    intercept(t, zipFileClass, "getEntry", "(JLjava/lang/String;Z)J",
-              voidPointer(getZipFileEntry));
-
-    intercept(t, zipFileClass, "getNextEntry", "(JI)J",
-              voidPointer(getNextZipFileEntry));
-
-    intercept(t, zipFileClass, "getMethod", "(J)I",
-              voidPointer(getZipFileEntryMethod));
-
-    intercept(t, zipFileClass, "freeEntry", "(JJ)V",
-              voidPointer(freeZipFileEntry));
-
-    intercept(t, zipFileClass, "read", "(JJJ[BII)I",
-              voidPointer(readZipFileEntry));
-
-    intercept(t, zipFileClass, "getCSize", "(J)J",
-              voidPointer(getZipFileEntryCompressedSize));
-
-    intercept(t, zipFileClass, "getSize", "(J)J",
-              voidPointer(getZipFileEntryUncompressedSize));
-
-    intercept(t, zipFileClass, "getZipMessage", "(J)Ljava/lang/String;",
-              voidPointer(getZipMessage));
-
-    intercept(t, zipFileClass, "close", "(J)V",
-              voidPointer(closeZipFile));
+      (t, root(t, Machine::BootLoader), "java/util/zip/ZipFile", false);
+
+    if (zipFileClass) {
+      PROTECT(t, zipFileClass);
+
+      object zipFileJzfileField = findFieldInClass2
+        (t, zipFileClass, "jzfile", "J");
+
+      if (zipFileJzfileField) {
+        cp->zipFileJzfileField = fieldOffset(t, zipFileJzfileField);
+
+        intercept(t, zipFileClass, "open", "(Ljava/lang/String;IJ)J",
+                  voidPointer(openZipFile));
+
+        intercept(t, zipFileClass, "getTotal", "(J)I",
+                  voidPointer(getZipFileEntryCount));
+
+        intercept(t, zipFileClass, "getEntry", "(JLjava/lang/String;Z)J",
+                  voidPointer(getZipFileEntry));
+
+        intercept(t, zipFileClass, "getNextEntry", "(JI)J",
+                  voidPointer(getNextZipFileEntry));
+
+        intercept(t, zipFileClass, "getMethod", "(J)I",
+                  voidPointer(getZipFileEntryMethod));
+
+        intercept(t, zipFileClass, "freeEntry", "(JJ)V",
+                  voidPointer(freeZipFileEntry));
+
+        intercept(t, zipFileClass, "read", "(JJJ[BII)I",
+                  voidPointer(readZipFileEntry));
+
+        intercept(t, zipFileClass, "getCSize", "(J)J",
+                  voidPointer(getZipFileEntryCompressedSize));
+
+        intercept(t, zipFileClass, "getSize", "(J)J",
+                  voidPointer(getZipFileEntryUncompressedSize));
+
+        intercept(t, zipFileClass, "getZipMessage", "(J)Ljava/lang/String;",
+                  voidPointer(getZipMessage));
+
+        intercept(t, zipFileClass, "close", "(J)V",
+                  voidPointer(closeZipFile));
+      }
+    }
   }

   { object jarFileClass = resolveClass
-      (t, root(t, Machine::BootLoader), "java/util/jar/JarFile");
-    if (jarFileClass == 0) return;
-
-    intercept(t, jarFileClass, "getMetaInfEntryNames", "()[Ljava/lang/String;",
-              voidPointer(getJarFileMetaInfEntryNames));
+      (t, root(t, Machine::BootLoader), "java/util/jar/JarFile", false);
+
+    if (jarFileClass) {
+      intercept(t, jarFileClass, "getMetaInfEntryNames",
+                "()[Ljava/lang/String;",
+                voidPointer(getJarFileMetaInfEntryNames));
+    }
   }

   {
@@ -1854,18 +1872,19 @@

     object fsClass = resolveClass
       (t, root(t, Machine::BootLoader), fsClassName, false);
-    if (fsClass == 0) return;
-
-    PROTECT(t, fsClass);
-
-    intercept(t, fsClass, gbaMethodName, "(Ljava/io/File;)I",
-              voidPointer(getFileAttributes));
-
-    intercept(t, fsClass, "checkAccess", "(Ljava/io/File;I)Z",
-              voidPointer(checkFileAccess));
+
+    if (fsClass) {
+      PROTECT(t, fsClass);
+
+      intercept(t, fsClass, gbaMethodName, "(Ljava/io/File;)I",
+                voidPointer(getFileAttributes));
+
+      intercept(t, fsClass, "checkAccess", "(Ljava/io/File;I)Z",
+                voidPointer(checkFileAccess));

-    intercept(t, fsClass, "getLength", "(Ljava/io/File;)J",
-              voidPointer(getFileLength));
+      intercept(t, fsClass, "getLength", "(Ljava/io/File;)J",
+                voidPointer(getFileLength));
+    }
   }

   intercept(t, type(t, Machine::ClassLoaderType), "loadLibrary",


Added a launch file that only launches the arm control node.

Added a script that changes permissions to access the arm.

--- jaco_driver/src/jaco_comm.cpp
+++ jaco_driver/src/jaco_comm.cpp
@@ -65,6 +65,10 @@

 	api_result = (API->InitAPI());

+	ROS_INFO("api_result: %d", api_result);
+
+	ROS_INFO("Step 1");
+
 	/*
 	A common result that may be returned is "1014", which means communications
 	could not be established with the arm.  This often means the arm is not turned on,
@@ -75,8 +79,12 @@
 	// On a cold boot the arm may not respond to commands from the API right away.
 	// This kick-starts the Control API so that it's ready to go.
 	API->StartControlAPI();
+	ROS_INFO("Step 1.5");
+
 	ros::Duration(3.0).sleep();
 	API->StopControlAPI();
+
+	ROS_INFO("Step 2");

 	if (api_result != 1)
 	{