sql_select.cc:   Fix for crashes on 64bit platforms after fixing bug#23417.

--- sql/sql_select.cc
+++ sql/sql_select.cc
@@ -13416,10 +13416,12 @@
   param->quick_group=1;
   while ((field=li++))
   {
-    Item::Type type=field->real_item()->type();
-    if (type == Item::FIELD_ITEM)
+    Item::Type type=field->type();
+    Item::Type real_type= field->real_item()->type();
+    if (type == Item::FIELD_ITEM || (real_type == Item::FIELD_ITEM &&
+        (type != Item::REF_ITEM || !((Item_ref *) field)->depended_from)))
       param->field_count++;
-    else if (type == Item::SUM_FUNC_ITEM)
+    else if (real_type == Item::SUM_FUNC_ITEM)
     {
       if (! field->const_item())
       {


Qt: Try GLES 3.0 if using GLES

Qt: Try GLES 3.0 if using GLES

--- src/platform/qt/Display.cpp
+++ src/platform/qt/Display.cpp
@@ -26,7 +26,11 @@
 	switch (s_driver) {
 #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
 	case Driver::OPENGL:
-		format.setVersion(3, 2);
+		if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
+			format.setVersion(3, 0);
+		} else {
+			format.setVersion(3, 2);
+		}
 		format.setProfile(QSurfaceFormat::CoreProfile);
 		return new DisplayGL(format, parent);
 #endif


Remove store_Av option from lgmres

Remove store_Av option from lgmres

The option is broken with right preconditioning.

See #37, KratosMultiphysics/Kratos#3066

--- amgcl/solver/lgmres.hpp
+++ amgcl/solver/lgmres.hpp
@@ -125,9 +125,6 @@
              */
             bool always_reset;

-            /// Whether LGMRES should store also A*v in addition to vectors `v`.
-            bool store_Av;
-
             /// Preconditioning kind (left/right).
             preconditioner::side::type pside;

@@ -141,7 +138,7 @@
             scalar_type abstol;

             params()
-                : M(30), K(3), always_reset(true), store_Av(true),
+                : M(30), K(3), always_reset(true),
                   pside(preconditioner::side::right), maxiter(100), tol(1e-8),
                   abstol(std::numeric_limits<scalar_type>::min())
             { }
@@ -151,20 +148,18 @@
                 : AMGCL_PARAMS_IMPORT_VALUE(p, M),
                   AMGCL_PARAMS_IMPORT_VALUE(p, K),
                   AMGCL_PARAMS_IMPORT_VALUE(p, always_reset),
-                  AMGCL_PARAMS_IMPORT_VALUE(p, store_Av),
                   AMGCL_PARAMS_IMPORT_VALUE(p, pside),
                   AMGCL_PARAMS_IMPORT_VALUE(p, maxiter),
                   AMGCL_PARAMS_IMPORT_VALUE(p, tol),
                   AMGCL_PARAMS_IMPORT_VALUE(p, abstol)
             {
-                check_params(p, {"pside", "M", "K", "always_reset", "store_Av", "maxiter", "tol", "abstol"});
+                check_params(p, {"pside", "M", "K", "always_reset", "maxiter", "tol", "abstol"});
             }

             void get(boost::property_tree::ptree &p, const std::string &path) const {
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, M);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, K);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, always_reset);
-                AMGCL_PARAMS_EXPORT_VALUE(p, path, store_Av);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, pside);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, maxiter);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, tol);
@@ -185,19 +180,12 @@
               H0(prm.M + 1, prm.M),
               s(prm.M + 1), cs(prm.M + 1), sn(prm.M + 1),
               r( Backend::create_vector(n, bprm) ),
-              ws(prm.M + prm.K), outer_v(prm.K), outer_Av(prm.K),
+              ws(prm.M + prm.K), outer_v(prm.K),
               inner_product(inner_product)
         {
             outer_v_data.reserve(prm.K);
             for(unsigned i = 0; i < prm.K; ++i)
                 outer_v_data.push_back(Backend::create_vector(n, bprm));
-
-            if (prm.store_Av) {
-                y.resize(prm.M + prm.K + 1);
-                outer_Av_data.reserve(prm.K);
-                for(unsigned i = 0; i < prm.K; ++i)
-                    outer_Av_data.push_back(Backend::create_vector(n, bprm));
-            }

             vs.reserve(prm.M + prm.K + 1);
             for(unsigned i = 0; i <= prm.M + prm.K; ++i)
@@ -231,7 +219,6 @@

             if (prm.always_reset) {
                 outer_v.clear();
-                outer_Av.clear();
             }

             scalar_type norm_rhs = norm(rhs);
@@ -307,11 +294,7 @@

                     ws[j] = z;

-                    if (j < outer_Av.size()) {
-                        backend::copy(*outer_Av[j], v_new);
-                    } else {
-                        preconditioner::spmv(prm.pside, P, A, *z, v_new, *r);
-                    }
+                    preconditioner::spmv(prm.pside, P, A, *z, v_new, *r);

                     for(unsigned k = 0; k <= j; ++k) {
                         H0(k, j) = H(k, j) = inner_product(v_new, *vs[k]);
@@ -365,19 +348,6 @@
                     norm_dx = math::inverse(norm_dx);
                     backend::axpby(norm_dx, dx, zero, *outer_v_data[outer_slot]);
                     outer_v.push_back(outer_v_data[outer_slot]);
-
-                    if (prm.store_Av) {
-                        // y = H0 * s, AW = Vy
-                        for(unsigned k = 0; k <= j; ++k) {
-                            coef_type sum = math::zero<coef_type>();
-                            for(unsigned i = k ? k-1 : 0; i < j; ++i)
-                                sum += H0(k, i) * s[i];
-                            y[k] = sum * norm_dx;
-                        }
-
-                        backend::lin_comb(j+1, y, vs, zero, *outer_Av_data[outer_slot]);
-                        outer_Av.push_back(outer_Av_data[outer_slot]);
-                    }
                 }
             }

@@ -410,14 +380,12 @@
             b += backend::bytes(s);
             b += backend::bytes(cs);
             b += backend::bytes(sn);
-            b += backend::bytes(y);

             b += backend::bytes(*r);

             for(const auto &v : vs) b += backend::bytes(*v);

             for(const auto &v : outer_v_data)  b += backend::bytes(*v);
-            for(const auto &v : outer_Av_data) b += backend::bytes(*v);

             return b;
         }
@@ -433,12 +401,11 @@
         size_t n;

         mutable multi_array<coef_type, 2> H, H0;
-        mutable std::vector<coef_type> s, cs, sn, y;
+        mutable std::vector<coef_type> s, cs, sn;
         std::shared_ptr<vector> r;
         mutable std::vector< std::shared_ptr<vector> > vs, ws;
-        mutable std::vector< std::shared_ptr<vector> > outer_v_data, outer_Av_data;
+        mutable std::vector< std::shared_ptr<vector> > outer_v_data;
         mutable circular_buffer< std::shared_ptr<vector> > outer_v;
-        mutable circular_buffer< std::shared_ptr<vector> > outer_Av;

         InnerProduct inner_product;


some fixes

some fixes

--- vector.hpp
+++ vector.hpp
@@ -957,7 +957,6 @@
 }

 #if defined(__SSE4_1__)
-
 template <typename T, unsigned N, ::std::size_t ...Is>
 constexpr inline typename ::vxl::vector_traits<T, N>::int_vector_type
 all_ones_or_mask(::std::index_sequence<Is...> const) noexcept
@@ -966,6 +965,18 @@
   return typename ::vxl::vector_traits<T, N>::int_vector_type{
     (
       Is < N ? 0 : ~0
+    )...
+  };
+}
+
+template <typename T, unsigned N, ::std::size_t ...Is>
+constexpr inline typename ::vxl::vector_traits<T, N>::int_vector_type
+all_zeros_and_mask(::std::index_sequence<Is...> const) noexcept
+{
+  // generate mask for each Is
+  return typename ::vxl::vector_traits<T, N>::int_vector_type{
+    (
+      Is < N ? ~0 : 0
     )...
   };
 }
@@ -977,12 +988,11 @@
 all_ones(typename vector_traits<T, N>::int_vector_type const v,
   ::std::index_sequence<Is...> const) noexcept
 {
-  return _mm_test_all_ones(
-    _mm_or_si128(__m128i(v),
-      __m128i(
-        all_ones_or_mask<T, N>(
-          ::std::make_index_sequence<sizeof(v) / sizeof(T)>()
-        )
+  return _mm_test_all_zeros(
+    ~__m128i(v),
+    __m128i(
+      all_zeros_and_mask<T, N>(
+        ::std::make_index_sequence<sizeof(v) / sizeof(T)>()
       )
     )
   );
@@ -1013,18 +1023,6 @@
     )...
   },
   v[0];
-}
-
-template <typename T, unsigned N, ::std::size_t ...Is>
-constexpr inline typename ::vxl::vector_traits<T, N>::int_vector_type
-all_zeros_and_mask(::std::index_sequence<Is...> const) noexcept
-{
-  // generate mask for each Is
-  return typename ::vxl::vector_traits<T, N>::int_vector_type{
-    (
-      Is < N ? ~0 : 0
-    )...
-  };
 }

 template <typename T, unsigned N, ::std::size_t ...Is>
@@ -1268,6 +1266,22 @@
   },
   v[0];
 }
+
+template <typename T, unsigned N, ::std::size_t ...Is>
+constexpr inline bool all_zeros(
+  typename vector_traits<T, N>::int_vector_type v,
+  ::std::index_sequence<Is...> const) noexcept
+{
+  return swallow{
+    (
+      v |= pow2_shuffler<typename vector_traits<T, N>::int_value_type, N, Is>(
+        v,
+        ::std::make_index_sequence<sizeof(v) / sizeof(T)>()
+      )
+    )...
+  },
+  !v[0];
+}
 #endif

 template <typename T, unsigned N, ::std::size_t ...Is>
@@ -1296,17 +1310,9 @@
 constexpr inline bool operator==(
   vector<T, N> const& l, vector<T, N> const& r) noexcept
 {
-#if defined(__SSE4_1__)
-  return detail::vector::all_zeros<T, N>(
-    typename vector_traits<T, N>::int_vector_type(l.data_) ^
-    typename vector_traits<T, N>::int_vector_type(r.data_),
-    ::std::make_index_sequence<detail::vector::log2(N)>()
-  );
-#else
   return detail::vector::all_ones<T, N>(l.data_ == r.data_,
     ::std::make_index_sequence<detail::vector::log2(N)>()
   );
-#endif
 }

 // the only reason for the existance of comparison operators are the


Fixes: NB#143963 - some duiapplicationservice if methods should not cause application to launch

RevBy: Max Waterman

Details: Here we check if the dbus connection to the remote
application is up and connected before attempting to send
the exit() call. This way the application is not autolaunched
only to receive the exit() method call and exit immediately again.

--- src/corelib/core/mapplicationifproxy.cpp
+++ src/corelib/core/mapplicationifproxy.cpp
@@ -37,7 +37,17 @@

 QDBusPendingReply<> MApplicationIfProxy::exit()
 {
-    return asyncCall(QLatin1String("exit"));
+    // here we only do the dbus call, when the interface is valid,
+    // i.e. there is a program listening "on the other side" of the
+    // dbus connection.
+    if ( isValid() )
+    {
+        return asyncCall(QLatin1String("exit"));
+    }
+    else
+    {
+        return QDBusPendingReply<>();
+    }
 }

 QDBusPendingReply<> MApplicationIfProxy::launch()


Don't access freed memory

Don't access freed memory

The deletion of DirectReadNode implies the deletion of the
DirectReadSlot

--- src/transfer.cpp
+++ src/transfer.cpp
@@ -680,7 +680,6 @@
             {
                 // app-requested abort
                 delete dr;
-                dr = NULL;
                 return true;
             }
         }
@@ -691,7 +690,6 @@

             // remove and delete completed read request, then remove slot
             delete dr;
-            dr = NULL;
             return true;
         }
     }


Improved TEST (PCL, LZF), by checking the return code of reader.read<>() calls.

Added TEST (PCL, LZFInMem), to exercise new functionality for reading & writing std::iostreams.

--- test/io/test_io.cpp
+++ test/io/test_io.cpp
@@ -1207,7 +1207,8 @@
   EXPECT_EQ (res, 0);

   PCDReader reader;
-  reader.read<PointXYZ> ("test_pcl_io_compressed.pcd", cloud2);
+  res = reader.read<PointXYZ> ("test_pcl_io_compressed.pcd", cloud2);
+  EXPECT_EQ (res, 0);

   EXPECT_EQ (cloud2.width, cloud.width);
   EXPECT_EQ (cloud2.height, cloud.height);
@@ -1272,8 +1273,77 @@
   EXPECT_EQ (res, 0);

   PCDReader reader;
-  reader.read<PointXYZRGBNormal> ("test_pcl_io_compressed.pcd", cloud2);
-
+  res = reader.read<PointXYZRGBNormal> ("test_pcl_io_compressed.pcd", cloud2);
+  EXPECT_EQ (res, 0);
+
+  EXPECT_EQ (cloud2.width, blob.width);
+  EXPECT_EQ (cloud2.height, blob.height);
+  EXPECT_EQ (cloud2.is_dense, cloud.is_dense);
+  EXPECT_EQ (cloud2.points.size (), cloud.points.size ());
+
+  for (size_t i = 0; i < cloud2.points.size (); ++i)
+  {
+    EXPECT_EQ (cloud2.points[i].x, cloud.points[i].x);
+    EXPECT_EQ (cloud2.points[i].y, cloud.points[i].y);
+    EXPECT_EQ (cloud2.points[i].z, cloud.points[i].z);
+    EXPECT_EQ (cloud2.points[i].normal_x, cloud.points[i].normal_x);
+    EXPECT_EQ (cloud2.points[i].normal_y, cloud.points[i].normal_y);
+    EXPECT_EQ (cloud2.points[i].normal_z, cloud.points[i].normal_z);
+    EXPECT_EQ (cloud2.points[i].rgb, cloud.points[i].rgb);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+TEST (PCL, LZFInMem)
+{
+  PointCloud<PointXYZRGBNormal> cloud;
+  cloud.width  = 640;
+  cloud.height = 480;
+  cloud.points.resize (cloud.width * cloud.height);
+  cloud.is_dense = true;
+
+  srand (static_cast<unsigned int> (time (NULL)));
+  size_t nr_p = cloud.points.size ();
+  // Randomly create a new point cloud
+  for (size_t i = 0; i < nr_p; ++i)
+  {
+    cloud.points[i].x = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].y = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].z = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].normal_x = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].normal_y = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].normal_z = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+    cloud.points[i].rgb = static_cast<float> (1024 * rand () / (RAND_MAX + 1.0));
+  }
+
+  pcl::PCLPointCloud2 blob;
+  pcl::toPCLPointCloud2 (cloud, blob);
+
+  std::ostringstream oss;
+  PCDWriter writer;
+  int res = writer.writeBinaryCompressed (oss, blob);
+  EXPECT_EQ (res, 0);
+  std::string pcd_str = oss.str ();
+
+  Eigen::Vector4f origin;
+  Eigen::Quaternionf orientation;
+  int pcd_version = -1;
+  int data_type = -1;
+  unsigned int data_idx = 0;
+  std::istringstream iss (pcd_str, std::ios::binary);
+  PCDReader reader;
+  pcl::PCLPointCloud2 blob2;
+  res = reader.readHeader (iss, blob2, origin, orientation, pcd_version, data_type, data_idx);
+  EXPECT_EQ (res, 0);
+  EXPECT_EQ (blob2.width, blob.width);
+  EXPECT_EQ (blob2.height, blob.height);
+  EXPECT_EQ (data_type, 2); // since it was written by writeBinaryCompressed(), it should be compressed.
+
+  const unsigned char *data = reinterpret_cast<const unsigned char *> (pcd_str.data ());
+  res = reader.readBodyBinary (data, blob2, pcd_version, data_type == 2, data_idx);
+  PointCloud<PointXYZRGBNormal> cloud2;
+  pcl::fromPCLPointCloud2 (blob2, cloud2);
+  EXPECT_EQ (res, 0);
   EXPECT_EQ (cloud2.width, blob.width);
   EXPECT_EQ (cloud2.height, blob.height);
   EXPECT_EQ (cloud2.is_dense, cloud.is_dense);


INTEGRATION: CWS ooo19126 (1.6.170); FILE MERGED 2005/09/05 13:14:03 rt 1.6.170.1: #i54170# Change license header: remove SISSL

--- ucbhelper/source/provider/simpleioerrorrequest.cxx
+++ ucbhelper/source/provider/simpleioerrorrequest.cxx
@@ -1,61 +1,35 @@
 /*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
  *
  *  $RCSfile: simpleioerrorrequest.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.7 $
  *
- *  last change: $Author: kso $ $Date: 2001-06-19 09:18:27 $
+ *  last change: $Author: rt $ $Date: 2005-09-09 16:42:09 $
  *
- *  The Contents of this file are made available subject to the terms of
- *  either of the following licenses
- *
- *         - GNU Lesser General Public License Version 2.1
- *         - Sun Industry Standards Source License Version 1.1
- *
- *  Sun Microsystems Inc., October, 2000
- *
- *  GNU Lesser General Public License Version 2.1
- *  =============================================
- *  Copyright 2000 by Sun Microsystems, Inc.
- *  901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *  MA  02111-1307  USA
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
  *
  *
- *  Sun Industry Standards Source License Version 1.1
- *  =================================================
- *  The contents of this file are subject to the Sun Industry Standards
- *  Source License Version 1.1 (the "License"); You may not use this file
- *  except in compliance with the License. You may obtain a copy of the
- *  License at http://www.openoffice.org/license.html.
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
  *
- *  Software provided under this License is provided on an "AS IS" basis,
- *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- *  See the License for the specific provisions governing your rights and
- *  obligations concerning the Software.
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
  *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
  *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
  *
  ************************************************************************/


change "const Int_t" to "Int_t" in Connect(), "const" makes no sense
for arguments passed by value. Header was already correct.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@10087 27541ba8-7e3a-0410-8455-c3a389f83636

--- netx/src/TXNetConn.cxx
+++ netx/src/TXNetConn.cxx
@@ -1,4 +1,4 @@
-// @(#)root/netx:$Name:  $:$Id: TXNetConn.cxx,v 1.4 2004/09/08 10:21:40 brun Exp $
+// @(#)root/netx:$Name:  $:$Id: TXNetConn.cxx,v 1.5 2004/09/15 17:09:51 rdm Exp $
 // Author: Alvise Dorigo, Fabrizio Furano

 /*************************************************************************
@@ -115,7 +115,7 @@
 }

 //_____________________________________________________________________________
-Short_t TXNetConn::Connect(TString Host, const Int_t Port, Int_t netopt)
+Short_t TXNetConn::Connect(TString Host, Int_t Port, Int_t netopt)
 {
    // Connect method (called the first time when TXNetFile is first created,
    // and used for each redirection). The global static connection manager
@@ -1155,7 +1155,7 @@
 Bool_t TXNetConn::DoAuthentication(const char *username, char *plist)
 {
    // Negotiate authentication with the remote server. Tries in turn
-   // all available protocols proposed by the server (in plist),
+   // all available protocols proposed by the server (in plist),
    // starting from the first.

    if (!plist || !strlen(plist))
@@ -1165,7 +1165,7 @@
       Info("DoAuthentication", "remote host: %s,"
            " list of available protocols: %s (%d)",
            fUrl.GetHost(), plist, strlen(plist));
-
+
    // Prepare host/IP information of the remote xrootd. This is required
    // for the authentication.
    //
@@ -1178,7 +1178,7 @@
    UInt_t addr = htonl(iaddr);
    memcpy((void *)&netaddr.sin_addr.s_addr, &addr,
           sizeof(netaddr.sin_addr.s_addr));
-
+
    // Variables for negotiation
    XrdSecParameters   secToken;
    XrdSecProtocol    *protocol;
@@ -1187,11 +1187,11 @@
    // Prepare tokenization
    //
    TString inPString((const char *)plist);
-   TObjArray *inPList = inPString.Tokenize(" ");
+   TObjArray *inPList = inPString.Tokenize(" ");

    // Make sure that we got at least one token
    //
-   if (inPList->GetEntries() < 1) {
+   if (inPList->GetEntries() < 1) {
       if (DebugLevel() >= TXDebug::kHIDEBUG)
          Warning("DoAuthentication", "Protocol list empty");
       return kFALSE;
@@ -1215,11 +1215,11 @@
          Error("DoAuthentication", "can't locate %s",seclib.Data());
          return kFALSE;
       }
-      //
+      //
       // Locate XrdSecGetProtocolClient
       Func_t f = gSystem->DynFindSymbol(seclib,"XrdSecGetProtocolClient");
       if (f) {
-         getp = (XrdSecProtocol *(*)(const struct sockaddr &,
+         getp = (XrdSecProtocol *(*)(const struct sockaddr &,
                                      const XrdSecParameters &,
                                      XrdOucErrInfo*))(f);
       } else {
@@ -1239,17 +1239,17 @@

       // Assign the security token that we have received at the login request
       //
-      secToken.buffer = (char *)(token.Data());
+      secToken.buffer = (char *)(token.Data());
       secToken.size   = token.Length();
-
+
       // Retrieve the security protocol context from the xrootd server
       //
       if (getp) {

          protocol = (*getp)((const struct sockaddr &)netaddr,secToken, 0);
-         if (!protocol) {
+         if (!protocol) {
             if (DebugLevel() >= TXDebug::kHIDEBUG)
-               Info("DoAuthentication",
+               Info("DoAuthentication",
                     "Unable to get protocol object (token: %s)",token.Data());
             continue;
          }
@@ -1469,7 +1469,7 @@
 	    Error("HandleServerError",
 		  "Redirection to a server out-of-domain disallowed.");
             Error("HandleServerError", "New host: %s ", newhost.Data());
-            Error("HandleServerError",
+            Error("HandleServerError",
                   "(list of allowed domains: %s) ", fClientHostDomain.Data());
             Error("HandleServerError", "Abort.");
 	    gSystem->Abort();


Fixed bug #34830: mixed table and field names in Item_ref
                  and Item_direct_ref constructor calls.

Order of ref->field_name and ref->table_name arguments
is of Item_ref and Item_direct_ref in the fix_inner_refs
function is inverted.

sql/sql_select.cc:
  Fixed bug #34830: mixed table and field names in Item_ref
                    and Item_direct_ref constructor calls.

  Order of ref->field_name and ref->table_name arguments
  is of Item_ref and Item_direct_ref in the fix_inner_refs
  function is inverted. See definitions:

    Item_ref(Name_resolution_context *context_arg, Item **item,
             const char *table_name_arg, const char *field_name_arg,
             bool alias_name_used_arg= FALSE)
    and

    Item_direct_ref(Name_resolution_context *context_arg, Item **item,
                    const char *table_name_arg,
                    const char *field_name_arg,
                    bool alias_name_used_arg= FALSE)

--- sql/sql_select.cc
+++ sql/sql_select.cc
@@ -360,10 +360,10 @@
       }
     }
     new_ref= direct_ref ?
-              new Item_direct_ref(ref->context, item_ref, ref->field_name,
-                          ref->table_name, ref->alias_name_used) :
-              new Item_ref(ref->context, item_ref, ref->field_name,
-                          ref->table_name, ref->alias_name_used);
+              new Item_direct_ref(ref->context, item_ref, ref->table_name,
+                          ref->field_name, ref->alias_name_used) :
+              new Item_ref(ref->context, item_ref, ref->table_name,
+                          ref->field_name, ref->alias_name_used);
     if (!new_ref)
       return TRUE;
     ref->outer_ref= new_ref;


x86: Remove optnone from IDT/__cpu_exception

--- src/platform/x86_pc/idt.cpp
+++ src/platform/x86_pc/idt.cpp
@@ -298,7 +298,7 @@
 }

 extern "C"
-__attribute__((noreturn optnone, weak))
+__attribute__((noreturn, weak))
 void __cpu_exception(uintptr_t* regs, int error, uint32_t code)
 {
   cpu_enable_panicking();


some fixes

some fixes

--- vector.hpp
+++ vector.hpp
@@ -960,30 +960,6 @@
   (e | v)[0];
 }

-template <typename T, unsigned N, ::std::size_t ...Is>
-constexpr inline typename ::vxl::vector_traits<T, N>::int_vector_type
-ptest_and_mask(::std::index_sequence<Is...> const) noexcept
-{
-  // generate mask for each Is
-  return typename ::vxl::vector_traits<T, N>::int_vector_type{
-    (
-      Is < N ? ~0 : 0
-    )...
-  };
-}
-
-template <typename T, unsigned N, ::std::size_t ...Is>
-constexpr inline typename ::vxl::vector_traits<T, N>::int_vector_type
-ptest_or_mask(::std::index_sequence<Is...> const) noexcept
-{
-  // generate mask for each Is
-  return typename ::vxl::vector_traits<T, N>::int_vector_type{
-    (
-      Is < N ? 0 : ~0
-    )...
-  };
-}
-
 #if defined(__SSE__)
 template <typename T, unsigned N, ::std::size_t ...Is>
 constexpr inline typename ::std::enable_if<


Added explicit arguments to tgHillyGround constructor call

--- src/dev/steve/Escape_T6/AppEscape_T6.cpp
+++ src/dev/steve/Escape_T6/AppEscape_T6.cpp
@@ -62,8 +62,8 @@
     tgWorld *world = createWorld();

     // Second create the view
-    //tgSimViewGraphics *view = createGraphicsView(world); // For visual experimenting on one tensegrity
-    tgSimView       *view = createView(world);         // For running multiple episodes
+    tgSimViewGraphics *view = createGraphicsView(world); // For visual experimenting on one tensegrity
+    //tgSimView       *view = createView(world);         // For running multiple episodes

     // Third create the simulation
     tgSimulation *simulation = new tgSimulation(*view);
@@ -90,7 +90,19 @@
     const double yaw = 0.0;
     const double pitch = 0.0;
     const double roll = 0.0;
-    const tgHillyGround::Config groundConfig(btVector3(yaw, pitch, roll));
+    const btVector3 eulerAngles = btVector3(yaw, pitch, roll);  // Default: (0.0, 0.0, 0.0)
+    const double friction = 0.5; // Default: 0.5
+    const double restitution = 0.0;  // Default: 0.0
+    const btVector3 size = btVector3(500.0, 1.5, 500.0); // Default: (500.0, 1.5, 500.0)
+    const btVector3 origin = btVector3(0.0, 0.0, 0.0); // Default: (0.0, 0.0, 0.0)
+    const size_t nx = 50; // Default: 50
+    const size_t ny = 50; // Default: 50
+    const double margin = 0.5; // Default: 0.5
+    const double triangleSize = 5.0; // Default: 5.0
+    const double waveHeight = 2.0; // Default: 5.0
+    const double offset = 0.5; // Default: 0.5
+    const tgHillyGround::Config groundConfig(eulerAngles, friction, restitution, size, origin,
+                                             nx, ny, margin, triangleSize, waveHeight, offset);
     // the world will delete this
     return new tgHillyGround(groundConfig);
 }


SensorServlet -> SensorPushServlet

SensorServlet -> SensorPushServlet

--- metricd.cc
+++ metricd.cc
@@ -80,7 +80,7 @@
   http_server.stats()->exportStats("/metricd/http");

   sensord::SensorSampleFeed sensor_feed;
-  metricdb::SensorServlet sensor_servlet(&sensor_feed);
+  metricdb::SensorPushServlet sensor_servlet(&sensor_feed);
   http_router.addRouteByPrefixMatch("/sensors", &sensor_servlet);

   //stats::StatsHTTPServlet stats_servlet;


Added #ifdef clauses around mce related issues.

Signed-off-by: Timo Rongas <96847b929f37460bcb46f0112d060a361b760670@nokia.com>

--- core/sensormanager.cpp
+++ core/sensormanager.cpp
@@ -33,8 +33,9 @@
 #include "loader.h"
 #include "idutils.h"
 #include "logging.h"
+#ifdef SENSORFW_MCE_WATCHER
 #include "mcewatcher.h"
-
+#endif // SENSORFW_MCE_WATCHER
 #include <QSocketNotifier>
 #include <errno.h>
 #include "sockethandler.h"
@@ -642,10 +643,13 @@
     if (displayState) {
         /// Emit signal to make background calibration resume from sleep
         emit displayOn();
+#ifdef SENSORFW_MCE_WATCHER
         if (!mceWatcher_->PSMEnabled())
+#endif // SENSORFW_MCE_WATCHER
         {
             emit resumeCalibration();
         }
+
     }

     foreach (const DeviceAdaptorInstanceEntry& adaptor, deviceAdaptorInstanceMap_) {
@@ -780,10 +784,12 @@
     return it.value().cnt_;
 }

+#ifdef SENSORFW_MCE_WATCHER
 MceWatcher* SensorManager::MCEWatcher() const
 {
     return mceWatcher_;
 }
+#endif // SENSORFW_MCE_WATCHER

 #ifdef SM_PRINT
 void SensorManager::print() const


Add more convolution tests (#1221)

Add more convolution tests (#1221)

* Add more convolution tests

* Adjust

--- plaidml/op/op_test.cc
+++ plaidml/op/op_test.cc
@@ -11,39 +11,32 @@

 using ::testing::Eq;

+using namespace plaidml;        // NOLINT
 using namespace plaidml::edsl;  // NOLINT
-
-namespace plaidml::op {
-namespace {

 class OpTest : public TestFixture {};

 TEST_F(OpTest, Abs) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
-  auto abs = op::abs(I);
-  auto program = makeProgram("abs", {abs});
-  IVLOG(1, program);
+  auto program = makeProgram("abs", {op::abs(I)});
   runProgram(program);
 }

 TEST_F(OpTest, All) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
   auto program = makeProgram("all", {op::all(I)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Any) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
   auto program = makeProgram("any", {op::any(I)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Argmax) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
   auto program = makeProgram("argmax", {op::argmax(I)});
-  IVLOG(1, "\n" << program);
   runProgram(program);
 }

@@ -51,7 +44,6 @@
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto O = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "O");
   auto program = makeProgram("binary_crossentropy", {op::binary_crossentropy(I, O, 0.0)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -59,7 +51,7 @@
   auto A = Placeholder(DType::FLOAT32, {3});
   std::vector<int> rshape = {3};
   std::vector<int> bdims = {0};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_nop", {C});

   std::vector<float> A_input = {0, 1, 2};
@@ -70,7 +62,7 @@
   auto A = Placeholder(DType::FLOAT32, {});
   std::vector<int> rshape = {3, 4};
   std::vector<int> bdims = {};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_scalar", {C});

   std::vector<float> A_input = {3};
@@ -84,7 +76,7 @@
   auto A = Placeholder(DType::FLOAT32, {3, 4});
   std::vector<int> rshape = {3, 4};
   std::vector<int> bdims = {0, 1};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_nop_large", {C});

   std::vector<float> A_input = {0, 1, 2, 3,  //
@@ -97,7 +89,7 @@
   auto A = Placeholder(DType::FLOAT32, {1, 3, 3});
   std::vector<int> rshape = {1, 4, 3, 3};
   std::vector<int> bdims = {0, 2, 3};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_numpy", {C});

   std::vector<float> A_input = {0, 1, 2,  //
@@ -122,7 +114,7 @@
   auto A = Placeholder(DType::FLOAT32, {3, 1});
   std::vector<int> rshape = {3, 4};
   std::vector<int> bdims = {0, 1};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_numpy_2", {C});

   std::vector<float> A_input = {0, 1, 2};
@@ -136,7 +128,7 @@
   auto A = Placeholder(DType::FLOAT32, {3});
   std::vector<int> rshape = {4, 3};
   std::vector<int> bdims = {1};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_numpy_3", {C});

   std::vector<float> A_input = {0, 1, 2};
@@ -151,7 +143,7 @@
   auto A = Placeholder(DType::FLOAT32, {3});
   std::vector<int> rshape = {3, 4};
   std::vector<int> bdims = {0};
-  auto C = broadcast(A, rshape, bdims);
+  auto C = op::broadcast(A, rshape, bdims);
   auto program = makeProgram("broadcast_non_numpy", {C});

   std::vector<float> A_input = {0, 1, 2};
@@ -166,7 +158,6 @@
   std::vector<int> result_shape = {1, 224, 224, 3};
   std::vector<int> bcast_axes = {0, 1, 2};
   auto program = makeProgram("broadcast", {op::broadcast(I, result_shape, bcast_axes)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -175,7 +166,6 @@
   auto raw_min = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "raw_min");
   auto raw_max = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "raw_max");
   auto program = makeProgram("clip", {op::clip(I, raw_min, raw_max)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -183,39 +173,68 @@
   auto A = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "A");
   auto B = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "B");
   auto program = makeProgram("concatenate", {op::concatenate({A, B}, 2)});
-  IVLOG(1, program);
-  runProgram(program);
-}
-
-TEST_F(OpTest, Convolution) {
-  auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
-  auto K = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "K");
-  auto O = op::convolution(I, K).strides({2, 2}).autopad_mode(AutoPadMode::EXPLICIT).manual_padding({2, 2});
-  auto program = makeProgram("convolution", {O});
-  IVLOG(1, program);
-  runProgram(program);
-}
-
-TEST_F(OpTest, Convolution_Padding3) {
-  auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
-  auto K = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "K");
-  auto O = op::convolution(I, K).strides({2, 2}).autopad_mode(AutoPadMode::EXPLICIT).manual_padding({3, 3});
-  auto program = makeProgram("convolution", {O});
-  IVLOG(1, program);
-  runProgram(program);
-}
+  runProgram(program);
+}
+
+struct ConvolutionParams {
+  DType dType;
+  std::vector<int64_t> I_dims;
+  std::vector<int64_t> K_dims;
+  std::function<void(op::convolution&)> builder;
+};
+
+struct ConvolutionTest : public OpTest, public ::testing::WithParamInterface<ConvolutionParams> {};
+
+TEST_P(ConvolutionTest, Basic) {
+  const auto& params = GetParam();
+  auto I = Placeholder(params.dType, params.I_dims);
+  auto K = Placeholder(params.dType, params.K_dims);
+  auto conv = op::convolution(I, K);
+  params.builder(conv);
+  auto program = makeProgram("convolution", {conv});
+  runProgram(program);
+}
+
+ConvolutionParams convParams[] = {
+    {
+        DType::FLOAT32,
+        {1, 224, 224, 3},
+        {7, 7, 3, 64},
+        [](op::convolution& conv) {
+          conv.strides({2, 2}).autopad_mode(op::AutoPadMode::EXPLICIT).manual_padding({2, 2});
+        },
+    },
+    {
+        // resnet/conv1
+        DType::FLOAT32,
+        {1, 224, 224, 3},
+        {7, 7, 3, 64},
+        [](op::convolution& conv) {
+          conv.name("conv1").strides({2, 2}).autopad_mode(op::AutoPadMode::EXPLICIT).manual_padding({3, 3});
+        },
+    },
+    {
+        // resnet/res2a_branch1
+        DType::FLOAT32,
+        {1, 56, 56, 64},
+        {1, 1, 64, 256},
+        [](op::convolution& conv) {
+          conv.name("res2a_branch1").strides({1, 1}).autopad_mode(op::AutoPadMode::VALID);
+        },
+    },
+};
+
+INSTANTIATE_TEST_CASE_P(Suite, ConvolutionTest, ::testing::ValuesIn(convParams));

 TEST_F(OpTest, CumProd) {
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto program = makeProgram("cumprod", {op::cumprod(I, 2)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, CumSum) {
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto program = makeProgram("cumsum", {op::cumsum(I, 2)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -223,43 +242,37 @@
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto K = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "K");
   auto program = makeProgram("dot", {op::dot(I, K)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Elu) {
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto program = makeProgram("elu", {op::elu(I, 0.1)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Flip) {
   auto I = Placeholder(DType::FLOAT32, {7, 7, 3, 64}, "I");
   auto program = makeProgram("flip", {op::flip(I, 2)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, HardSigmoid) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("hard_sigmoid", {op::hard_sigmoid(A, 0.05)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, ImageResize) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
-  auto image_resize = op::image_resize(I, std::vector<int>{5, 4}, InterpolationMode::BILINEAR, TensorLayout::NXC);
-  auto program = makeProgram("image_resize", {image_resize});
-  IVLOG(1, program);
+  auto O = op::image_resize(I, std::vector<int>{5, 4}, op::InterpolationMode::BILINEAR, op::TensorLayout::NXC);
+  auto program = makeProgram("image_resize", {O});
   runProgram(program);
 }

 TEST_F(OpTest, Max) {
   auto I = Placeholder(DType::FLOAT32, {1, 224, 224, 3}, "I");
   auto program = makeProgram("max", {op::max(I)});  // NOLINT(build/include_what_you_use)
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -267,21 +280,18 @@
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto B = Placeholder(DType::FLOAT32, {10, 20}, "B");
   auto program = makeProgram("maximum", {op::maximum(A, B)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Mean) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("mean", {op::mean(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Min) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("min", {op::min(A)});  // NOLINT(build/include_what_you_use)
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -289,29 +299,25 @@
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto B = Placeholder(DType::FLOAT32, {10, 20}, "B");
   auto program = makeProgram("minimum", {op::minimum(A, B)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, L2Norm) {
   auto I = Placeholder(DType::FLOAT32, {10, 20}, "I");
-  auto program = makeProgram("l2norm", {op::l2norm(I, {1}).epsilon(0.01).eps_mode(EpsMode::ADD)});
-  IVLOG(1, program);
+  auto program = makeProgram("l2norm", {op::l2norm(I, {1}).epsilon(0.01).eps_mode(op::EpsMode::ADD)});
   runProgram(program);
 }

 TEST_F(OpTest, Pool) {
   auto I = Placeholder(DType::FLOAT32, {10, 20, 30, 40, 50}, "I");
-  auto program = makeProgram("pool", {op::pool(I, PoolMode::SUM, {1, 2, 3}, {1, 2, 3}, AutoPadMode::NONE, {1, 2},
-                                               TensorLayout::NXC, true, true)});
-  IVLOG(1, program);
+  auto program = makeProgram("pool", {op::pool(I, op::PoolMode::SUM, {1, 2, 3}, {1, 2, 3}, op::AutoPadMode::NONE,
+                                               {1, 2}, op::TensorLayout::NXC, true, true)});
   runProgram(program);
 }

 TEST_F(OpTest, Prod) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("prod", {op::prod(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -415,12 +421,8 @@

 TEST_F(OpTest, Repeat) {
   auto A = Placeholder(DType::FLOAT32, {32, 1, 4, 1}, "A");
-  auto X = op::repeat(  //
-      A,                // tensor to repeat
-      3,                // number of repeats
-      2);               // axis to repeat
+  auto X = op::repeat(A, 3, 2);
   auto program = makeProgram("repeat", {X});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -429,14 +431,12 @@
   TensorDim I, J;
   A.bind_dims(I, J);
   auto program = makeProgram("reshape", {op::reshape(A, make_tuple(J, I))});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Sigmoid) {
   auto A = Placeholder(DType::FLOAT32, {10}, "A");
   auto program = makeProgram("sigmoid", {op::sigmoid(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -445,7 +445,6 @@
   auto X = op::slice(A)  //
                .add_dims({2, 10});
   auto program = makeProgram("slice", {X});
-  IVLOG(1, program);
   runProgram(program);
 }

@@ -455,50 +454,38 @@
                .add_dim(/*start=*/0, /*stop=*/2)
                .add_dim(/*start=*/2, /*stop=*/8, /*step=*/2);
   auto program = makeProgram("slice", {X});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Softmax) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("softmax", {op::softmax(A, 1)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, SpatialPadding) {
   auto A = Placeholder(DType::FLOAT32, {64, 4, 32, 32}, "A");
-  auto X = op::spatial_padding(  //
-      A,                         // tensor to perform spatial padding on
-      {1, 3},                    // low pads
-      {3, 3},                    // high pads
-      TensorLayout::NXC);        // data layout
+  auto X = op::spatial_padding(A, {1, 3}, {3, 3}, op::TensorLayout::NXC);
   auto program = makeProgram("spatial_padding", {X});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Square) {
   auto A = Placeholder(DType::FLOAT32, {10}, "A");
   auto program = makeProgram("square", {op::square(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Sum) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("sum", {op::sum(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Squeeze) {
   auto A = Placeholder(DType::UINT64, {3, 1, 4, 1}, "A");
-  auto C = op::squeeze(  //
-      A,                 // tensor to squeeze
-      {1, 3});           // axes to squeeze
+  auto C = op::squeeze(A, {1, 3});
   auto program = makeProgram("squeeze", {C});
-  IVLOG(1, program);

   std::vector<uint64_t> A_input = {0, 1, 2,  3,  //
                                    4, 5, 6,  7,  //
@@ -508,29 +495,21 @@

 TEST_F(OpTest, Tile) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
-  auto X = op::tile(  //
-      A,              // tensor to tile
-      {5, 4});        // tiling factors
+  auto X = op::tile(A, {5, 4});
   auto program = makeProgram("tile", {X});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Transpose) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("transpose", {op::transpose(A)});
-  IVLOG(1, program);
   runProgram(program);
 }

 TEST_F(OpTest, Unsqueeze) {
   auto A = Placeholder(DType::UINT64, {3, 4}, "A");
-  auto C = op::unsqueeze(  //
-      A,                   // tensor to squeeze
-      {0});                // axes to squeeze
+  auto C = op::unsqueeze(A, {0});
   auto program = makeProgram("unsqueeze", {C});
-  IVLOG(1, program);
-
   std::vector<uint64_t> A_input = {0, 1, 2,  3,  //
                                    4, 5, 6,  7,  //
                                    8, 9, 10, 11};
@@ -540,9 +519,5 @@
 TEST_F(OpTest, Variance) {
   auto A = Placeholder(DType::FLOAT32, {10, 20}, "A");
   auto program = makeProgram("variance", {op::variance(A)});
-  IVLOG(1, program);
-  runProgram(program);
-}
-
-}  // namespace
-}  // namespace plaidml::op
+  runProgram(program);
+}


hotfix, don't assert when seeing no active hmds farms while getting data

--- src/tws_meta.cpp
+++ src/tws_meta.cpp
@@ -2053,7 +2053,11 @@
 		it++;
 	}
 	if( sl.size() <= 0 ) {
-		assert(false); // assuming at least one farm must be active
+		/* FIXME this is a race, TWS tells us a farm is broken before sending
+		   the last data. If this race happens in the other cases then we would
+		   learn a wrong farm. The final fix would be to handle wrongly learned
+		   farms when we notice it */
+		DEBUG_PRINTF( "Warning, can't learn hmds while no farm is active.");
 	} else if( sl.size() == 1 ) {
 		if( hLearn.find(lazyC) != hLearn.end() ) {
 			assert( hLearn.find( lazyC )->second == sl.front() );


FIXING INCLUDES FOR EMSCRIPTEN

FIXING INCLUDES FOR EMSCRIPTEN

--- core/src/path/ASPC.cpp
+++ core/src/path/ASPC.cpp
@@ -1,4 +1,6 @@
 #include "path/ASPC.h"
+
+#include <cstdlib>

 using namespace std;


Add a comment about the sources of inspiration for diff algorithm

Change-Id: I34123d6d9398bcb3afaa5bf8d043c3fd296f5f4d
Reviewed-by: hjk <f81b91af79013637d070c18d38a75b90eaae8ba3@nokiamail.com>

--- src/plugins/diffeditor/differ.cpp
+++ src/plugins/diffeditor/differ.cpp
@@ -27,6 +27,14 @@
 **
 ****************************************************************************/

+/*
+The main algorithm "diffMyers()" is based on "An O(ND) Difference Algorithm
+and Its Variations" by Eugene W. Myers: http://www.xmailserver.org/diff2.pdf
+
+Preprocessing and postprocessing functions inspired by "Diff Strategies"
+publication by Neil Fraser: http://neil.fraser.name/writing/diff/
+*/
+
 #include "differ.h"

 #include <QList>


Fix build.

Fix build.

TBR=joi
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/9456012

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

--- ui/views/focus/accelerator_handler_gtk_unittest.cc
+++ ui/views/focus/accelerator_handler_gtk_unittest.cc
@@ -30,8 +30,10 @@
     window_ = Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 500, 500));
     window_->Show();
     FocusManager* focus_manager = window_->GetFocusManager();
-    focus_manager->RegisterAccelerator(kMenuAccelerator, this);
-    focus_manager->RegisterAccelerator(kHomepageAccelerator, this);
+    focus_manager->RegisterAccelerator(
+        kMenuAccelerator, ui::AcceleratorManager::kNormalPriority, this);
+    focus_manager->RegisterAccelerator(
+        kHomepageAccelerator, ui::AcceleratorManager::kNormalPriority, this);
     menu_pressed_ = false;
     home_pressed_ = false;
   }


Fix zoom value clamping

Fix zoom value clamping

--- core/src/view/view.cpp
+++ core/src/view/view.cpp
@@ -70,9 +70,7 @@
 void View::setZoom(int _z) {

     // ensure zoom value is allowed
-    glm::clamp(_z, 0, s_maxZoom);
-
-    m_zoom = _z;
+    m_zoom = glm::clamp(_z, 0, s_maxZoom);

     // find dimensions of tiles in world space at new zoom level
     float tileSize = 2 * MapProjection::HALF_CIRCUMFERENCE * pow(2, -m_zoom);


Worked on documentation of sqloxx::Handle<T>.

git-svn-id: 0231d2b9506727b8389b50bfeac72ec1f38c13c1@713 ac3cbfda-f6ac-4daa-b570-d46c5f00fc98

--- sqloxx/handle.hpp
+++ sqloxx/handle.hpp
@@ -62,12 +62,24 @@
 	Handle(Handle const& rhs);

 	/**
-	 * @todo Testing and documentation.
+	 * @throws sqloxx::OverflowException in the extremely unlikely
+	 * event that the number of Handle instances pointing to the
+	 * underlying instance of T is too large to be safely counted
+	 * by the type PersistentObject<T, Connection>::HandleCounter.
+	 *
+	 * Exception safety: strong guarantee.
+	 *
+	 * @todo Testing.
 	 */
 	Handle& operator=(Handle const& rhs);

 	/**
-	 * @todo Testing and documentation.
+	 * @return \e true if this Handle<T> is bound to some instance
+	 * of T; otherwise returns \e false.
+	 *
+	 * Exception safety: nothrow guarantee.
+	 *
+	 * @todo Testing.
 	 */
 	operator bool() const;

@@ -90,29 +102,19 @@
 Handle<T>::Handle(T* p_pointer):
 	m_pointer(p_pointer)
 {
-	// Strong guarantee. Might throw OverflowException, though this
-	// is extremely unlikely.
 	p_pointer->notify_handle_construction();
 }

 template <typename T>
 Handle<T>::~Handle()
 {
-	// Nothrow provided preconditions met, viz. object must have
-	// been handled throughout its life via Handle<T>, with the
-	// Handle having been copied from another Handle<T>, or else
-	// provided by IdentityMap via a call to provide_handle(...).
-	// Also, the destructor of T must never throw.
 	m_pointer->notify_handle_destruction();
 }

 template <typename T>
 Handle<T>::Handle(Handle const& rhs)
 {
-	m_pointer = rhs.m_pointer;  // nothrow
-
-	// Strong guarantee. Might throw OverflowException, though this
-	// is extremely unlikely.
+	m_pointer = rhs.m_pointer;
 	m_pointer->notify_handle_copy_construction();
 }


Fix 38fe616d857234845b9169576433c28aa54fee89

Obviously it helps to add the search term even if it does
not contain special characters.

Change-Id: If32e3e0b8b64fde99a3247dd6eee29928995591f
Reviewed-by: Eike Ziller <c142da16c73a95a82d35191bcc55b22835617128@nokia.com>

--- src/plugins/help/searchwidget.cpp
+++ src/plugins/help/searchwidget.cpp
@@ -174,8 +174,8 @@
             if (word.contains(regExp)) {
                 foreach (const QString &charToEscape, charsToEscapeList)
                     word.replace(charToEscape, escapeChar + charToEscape);
-                escapedQuery.wordList.append(word);
             }
+            escapedQuery.wordList.append(word);
         }
         escapedQueries.append(escapedQuery);
     }


Fix unused variable bug in r7444.

Fix unused variable bug in r7444.

BUG=
TEST=

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

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@7445 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- src/type-info.cc
+++ src/type-info.cc
@@ -358,6 +358,8 @@
 void TypeFeedbackOracle::SetInfo(int position, Object* target) {
   MaybeObject* maybe_result = dictionary_->AtNumberPut(position, target);
   Object* result;
+  USE(maybe_result);
+  USE(result);
   // Dictionary has been allocated with sufficient size for all elements.
   ASSERT(maybe_result->ToObject(&result));
   ASSERT(*dictionary_ == result);


improved stack cleanup for tailcalls

improved stack cleanup for tailcalls

--- squirrel/sqvm.cpp
+++ squirrel/sqvm.cpp
@@ -726,9 +726,13 @@
                 if (type(t) == OT_CLOSURE
                     && (!_closure(t)->_function->_bgenerator)){
                     SQObjectPtr clo = t;
+					SQInteger last_top = _top;
                     if(_openouters) CloseOuters(&(_stack._vals[_stackbase]));
                     for (SQInteger i = 0; i < arg3; i++) STK(i) = STK(arg2 + i);
                     _GUARD(StartCall(_closure(clo), ci->_target, arg3, _stackbase, true));
+					if (last_top >= _top) {
+						_top = last_top;
+					}
                     continue;
                 }
                               }


fully revert bdls_filesystemutil.t.cpp

fully revert bdls_filesystemutil.t.cpp

--- groups/bdl/bdls/bdls_filesystemutil.t.cpp
+++ groups/bdl/bdls/bdls_filesystemutil.t.cpp
@@ -5401,69 +5401,23 @@

         bsl::string foo = tempFileName(20);
         Obj::remove(foo);
-        Obj::FileDescriptor fd =
-            Obj::open(foo, Obj::e_OPEN_OR_CREATE, Obj::e_READ_WRITE);
-        bsl::size_t pageSize    = bdls::MemoryUtil::pageSize();
-        bsl::size_t intsPerPage = pageSize / INT_SIZEOF(int);
-
+        Obj::FileDescriptor fd = Obj::open(foo,
+                                           Obj::e_OPEN_OR_CREATE,
+                                           Obj::e_READ_WRITE);
+        int pageSize = bdls::MemoryUtil::pageSize();
         Obj::growFile(fd, pageSize, true);
-
-        int *fileBase;
-
-        const int ITER_COUNT = 10000;
-
-        const bsl::size_t MAPPED_SIZE = pageSize * ITER_COUNT;
-
-        ASSERT(0 == Obj::map(fd, (void**)&fileBase, 0, MAPPED_SIZE,
+        int *p;
+        ASSERT(0 == Obj::map(fd, (void**)&p, 0, pageSize,
                                    bdls::MemoryUtil::k_ACCESS_READ_WRITE));
-
-        ASSERT(0 == Obj::seek(fd, 0, Obj::e_SEEK_FROM_BEGINNING));
-        *fileBase = 1234;
-        int buf;
-        ASSERT(INT_SIZEOF(int) == Obj::read(fd, &buf, INT_SIZEOF(int)));
-        ASSERT(1234 == buf);
-        ASSERT(1234 == *fileBase);
-
-        bsl::size_t fileSize    = pageSize;
-
-        bool printSizes = false;
-
-        for (int i = 1; i < ITER_COUNT; ++i) {
-          if (veryVerbose) {
-              P(i);
-          }
-          int rc = Obj::growFile(fd, fileSize + pageSize, true);
-          ASSERTV(i, fileSize, pageSize, 0 == rc);
-          fileSize += pageSize;
-
-          if (rc != 0) {
-              printSizes = true;
-          }
-
-          if (printSizes) {
-              P_(L_); T_; P_(i); T_; P(Obj::getFileSize(foo));
-          }
-
-          int *p = fileBase + (i * intsPerPage);
-
+        printf("mapped at %p\n", p);
+        for (int i = 0; i < 10000; ++i) {
+          ASSERT(0 == Obj::seek(fd, 0, Obj::e_SEEK_FROM_BEGINNING));
+          int buf;
           *p = i;
-
-          rc = Obj::seek(fd,
-                         i * intsPerPage * INT_SIZEOF(int),
-                         Obj::e_SEEK_FROM_BEGINNING);
-          ASSERTV(i,
-                  fileSize,
-                  intsPerPage,
-                  i * intsPerPage * INT_SIZEOF(int),
-                  rc,
-                  i * intsPerPage * INT_SIZEOF(int) == rc);
-
-          int buf;
-          ASSERTV(i, INT_SIZEOF(int) == Obj::read(fd, &buf, INT_SIZEOF(int)));
-          ASSERTV(i, i == buf);
-          ASSERTV(i, i == *p);
-        }
-        ASSERT(0 == Obj::unmap(fileBase, MAPPED_SIZE));
+          ASSERT(INT_SIZEOF(int) == Obj::read(fd, &buf, INT_SIZEOF(int)));
+          ASSERT(i == buf);
+        }
+        ASSERT(0 == Obj::unmap(p, pageSize));

 #if 0
         Obj::FileDescriptor fd =  // /bb/data is Bloomberg-specific


Fixed DFB camera RGB flip.

Fixed DFB camera RGB flip.

svn path=/trunk/libavg/; revision=1218

--- src/AVGCamera.cpp
+++ src/AVGCamera.cpp
@@ -17,7 +17,7 @@
 #include <paintlib/plpngenc.h>
 #include <paintlib/planybmp.h>
 #include <paintlib/Filter/plfilterfill.h>
-
+#include <paintlib/Filter/plfilterfliprgb.h>

 #include <nsMemory.h>
 #include <xpcom/nsComponentManagerUtils.h>
@@ -273,10 +273,27 @@
             case MODE_640x480_RGB:
                 {
                     PLBYTE ** ppLines = pBmp->GetLineArray();
-                    for (int y = 0; y < pBmp->GetHeight(); y++) {
-                        memcpy(ppLines[int(y+Vpt.tl.y)]+int(Vpt.tl.x*3),
-                                (PLBYTE*)(m_Camera.capture_buffer)+y*pBmp->GetWidth()*3,
-                                pBmp->GetWidth()*3);
+                    int YOffs = int(Vpt.tl.y+0.5);
+                    int XOffs = int(Vpt.tl.x+0.5)*3;
+                    int WidthBytes = pBmp->GetWidth()*3;
+                    if (getEngine()->hasRGBOrdering()) {
+                        for (int y = 0; y < pBmp->GetHeight(); y++) {
+                            memcpy(ppLines[y+YOffs]+XOffs,
+                                    (PLBYTE*)(m_Camera.capture_buffer)+
+                                        y*WidthBytes,
+                                    WidthBytes);
+                        }
+                    } else {
+                        for (int y = 0; y < pBmp->GetHeight(); y++) {
+                            PLBYTE * pDestLine = ppLines[y+YOffs]+XOffs;
+                            PLBYTE * pSrcLine = (PLBYTE*)
+                                    m_Camera.capture_buffer+y*WidthBytes;
+                            for (int x = 0; x < WidthBytes; x+=3) {
+                                pDestLine[x] = pSrcLine[x+2];
+                                pDestLine[x+1] = pSrcLine[x+1];
+                                pDestLine[x+2] = pSrcLine[x];
+                            }
+                        }
                     }
                 }
                 break;
@@ -304,7 +321,7 @@

 inline void YUVtoBGR24Pixel(PLPixel24* pDest, PLBYTE y, PLBYTE u, PLBYTE v)
 {
-    pDest->Set(y,y,y);
+//    pDest->Set(y,y,y);
     // u = Cb, v = Cr
 /*    y -= 16;
     u -= 128;
@@ -313,7 +330,6 @@
     int g = (298 * y - 100 * u - 208 * v) >> 8;
     int r = (298 * y           + 409 * v) >> 8;
 */
-/*
     int ycomp = y2colTable[y];
     int b = ((ycomp+u2bTable[u])>>8);
     int g = ((ycomp+u2gTable[u]+v2gTable[v])>>8);
@@ -326,7 +342,6 @@
     if (r<0) r = 0;
     if (r>255) r= 255;
     pDest->Set(b,g,r);
-*/
 /*
     asm volatile ("sub %%eax, %%eax;         \n\t"
                   "mov %1, %%al;             \n\t"


ios Adjust bridge - call onResume() after appDidLaunch

--- src/Adjust2dx.cpp
+++ src/Adjust2dx.cpp
@@ -31,6 +31,7 @@
     cocos2d::JniHelper::getEnv()->DeleteGlobalRef(adjustConfig.getConfig());
 #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
     ADJAdjust2dx::appDidLaunch(adjustConfig.getConfig());
+    onResume();
 #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
     WRTAdjust::ApplicationLaunching(adjustConfig.getConfig());
 #endif


Fixed trigger values

Fixed trigger values

--- src/Atm_servo.cpp
+++ src/Atm_servo.cpp
@@ -92,11 +92,11 @@

 Atm_servo& Atm_servo::trigger( int event ) {
   switch ( event ) {
-    case EVT_MVUP:
+    case EVT_UP:
       servo_dest += step_size;
       if ( servo_dest > 180 ) servo_dest = 180;
       break;
-    case EVT_MVDN:
+    case EVT_DOWN:
       servo_dest -= step_size;
       if ( servo_dest < 0 ) servo_dest = 0;
       break;


WINTERMUTE: Make BViewPort independent of dcgf

--- src/BViewport.cpp
+++ src/BViewport.cpp
@@ -23,7 +23,8 @@
 THE SOFTWARE.
 */

-#include "dcgf.h"
+#include "BGame.h"
+#include "PlatformSDL.h"
 #include "BViewport.h"

 namespace WinterMute {


Added missing call.

Added missing call.

--- cpp/lib/src/Archive.cc
+++ cpp/lib/src/Archive.cc
@@ -224,6 +224,7 @@
     else
         LOG_ERROR("unsupported entry type: " + std::to_string(static_cast<int>(entry_type)) + "!");
     ::archive_entry_set_perm(archive_entry_, mode);
+    ::archive_write_header(archive_handle_, archive_entry_);
 }


Cosmetic.

Cosmetic.

--- cpp/lib/src/BSZUtil.cc
+++ cpp/lib/src/BSZUtil.cc
@@ -3,7 +3,7 @@
  *  \author Dr. Johannes Ruscheinski (johannes.ruscheinski@uni-tuebingen.de)
  *  \author Oliver Obenland (oliver.obenland@uni-tuebingen.de)
  *
- *  \copyright 2017 Universitätsbibliothek Tübingen.  All rights reserved.
+ *  \copyright 2017,2018 Universitätsbibliothek Tübingen.  All rights reserved.
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU Affero General Public License as
@@ -48,6 +48,7 @@
 const size_t PPN_START_INDEX(12);
 const size_t SEPARATOR_INDEX(PPN_START_INDEX - 1);

+
 void ExtractDeletionIds(File * const deletion_list, std::unordered_set <std::string> * const delete_full_record_ids,
                         std::unordered_set <std::string> * const local_deletion_ids)
 {


set the requested clock frequency on zynq boards

--- cpp/platformMemory.cpp
+++ cpp/platformMemory.cpp
@@ -113,8 +113,8 @@
     hostMemServerIndication = new MemServerIndication(hostMemServerRequest, PlatformIfcNames_MemServerIndicationH2S, PLATFORM_TILE);
     mmuIndication = new MMUIndication(dma, PlatformIfcNames_MMUIndicationH2S, PLATFORM_TILE);

-#ifdef FPGA0_CLOCK_FREQ
-    long req_freq = FPGA0_CLOCK_FREQ;
+#ifdef MainClockPeriod
+    long req_freq = (long)(1e9 / MainClockPeriod);
     long freq = 0;
     setClockFrequency(0, req_freq, &freq);
     fprintf(stderr, "Requested FCLK[0]=%ld actually %ld\n", req_freq, freq);


INTEGRATION: CWS bunoidmap (1.33.8); FILE MERGED 2006/11/08 14:32:14 kr 1.33.8.1: fixed: i71307 - SAL_IMPLEMENT_MAIN does not compile warning free

--- cppu/test/testcppu.cxx
+++ cppu/test/testcppu.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: testcppu.cxx,v $
  *
- *  $Revision: 1.33 $
+ *  $Revision: 1.34 $
  *
- *  last change: $Author: rt $ $Date: 2006-10-27 12:16:19 $
+ *  last change: $Author: rt $ $Date: 2006-12-01 17:27:07 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1182,7 +1182,7 @@
 /*
  * main.
  */
-SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, /*argv*/)
+SAL_IMPLEMENT_MAIN()
 {
     rtl::OUString const cppName(
         RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );


Fixed x repetition in surfplot

Fixed x repetition in surfplot

--- plot/src/surfPlot.cpp
+++ plot/src/surfPlot.cpp
@@ -63,7 +63,7 @@
 {
     mStream << "X=[";

-    for ( auto &Y : y.GetData() )
+    for ( auto &Z : z )
     {
         mStream << this->ToArray( x ) << ",";
     }


Clean up pysrc/intersection.cpp

Clean up pysrc/intersection.cpp

--- pysrc/intersection.cpp
+++ pysrc/intersection.cpp
@@ -6,12 +6,10 @@
 namespace jtrace {
     void pyExportIntersection(py::module &m) {
         py::class_<Intersection>(m, "Intersection")
+            .def_readonly("t", &Intersection::t)
             .def_readonly("point", &Intersection::point)
             .def_readonly("surfaceNormal", &Intersection::surfaceNormal)
             .def("__repr__", &Intersection::repr)
-            .def_readonly("t", &Intersection::t)
-            .def_readonly("point", &Intersection::point)
-            .def_readonly("surfaceNormal", &Intersection::surfaceNormal)
             .def("reflectedRay", &Intersection::reflectedRay);
     }
 }


Add a check against possible null pointer (coverity)

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

--- gui/guibuilder/src/TGuiBldDragManager.cxx
+++ gui/guibuilder/src/TGuiBldDragManager.cxx
@@ -2952,46 +2952,48 @@
    h = y - y0;

    if (fLassoDrawn || fromGrab) {
-      TIter next(comp->GetList());
-      TGFrameElement *el;
-
-      while ((el = (TGFrameElement*)next())) {
-         TGFrame *fr = el->fFrame;
-
-         if ((fr->GetX() >= x0) && (fr->GetY() >= y0) &&
-             (fr->GetX() + (Int_t)fr->GetWidth() <= x) &&
-             (fr->GetY() + (Int_t)fr->GetHeight() <= y)) {
-            if (!crop) {
-               DeleteFrame(fr);
+      if (comp) {
+         TIter next(comp->GetList());
+         TGFrameElement *el;
+
+         while ((el = (TGFrameElement*)next())) {
+            TGFrame *fr = el->fFrame;
+
+            if ((fr->GetX() >= x0) && (fr->GetY() >= y0) &&
+                (fr->GetX() + (Int_t)fr->GetWidth() <= x) &&
+                (fr->GetY() + (Int_t)fr->GetHeight() <= y)) {
+               if (!crop) {
+                  DeleteFrame(fr);
+               } else {
+                  fr->Move(fr->GetX() - x0, fr->GetY() - y0);
+               }
             } else {
-               fr->Move(fr->GetX() - x0, fr->GetY() - y0);
-            }
-         } else {
-            if (crop) {
-               DeleteFrame(fr);
+               if (crop) {
+                  DeleteFrame(fr);
+               }
             }
          }
-      }
-      if (crop && comp) {
-         gVirtualX->TranslateCoordinates(comp->GetId(), comp->GetParent()->GetId(),
-                                          x0, y0, xx, yy, c);
-
-         comp->MoveResize(xx, yy, w, h);
-
-         if (comp->GetParent()->InheritsFrom(TGMdiDecorFrame::Class())) {
-            TGMdiDecorFrame *decor = (TGMdiDecorFrame *)comp->GetParent();
-
-
-            gVirtualX->TranslateCoordinates(decor->GetId(), decor->GetParent()->GetId(),
-                                            xx, yy, xx, yy, c);
-
-            Int_t b = 2 * decor->GetBorderWidth();
-            decor->MoveResize(xx, yy, comp->GetWidth() + b,
-                              comp->GetHeight() + b + decor->GetTitleBar()->GetDefaultHeight());
+         if (crop && comp) {
+            gVirtualX->TranslateCoordinates(comp->GetId(), comp->GetParent()->GetId(),
+                                             x0, y0, xx, yy, c);
+
+            comp->MoveResize(xx, yy, w, h);
+
+            if (comp->GetParent()->InheritsFrom(TGMdiDecorFrame::Class())) {
+               TGMdiDecorFrame *decor = (TGMdiDecorFrame *)comp->GetParent();
+
+               gVirtualX->TranslateCoordinates(decor->GetId(), decor->GetParent()->GetId(),
+                                               xx, yy, xx, yy, c);
+
+               Int_t b = 2 * decor->GetBorderWidth();
+               decor->MoveResize(xx, yy, comp->GetWidth() + b,
+                                 comp->GetHeight() + b + decor->GetTitleBar()->GetDefaultHeight());
+            }
          }
       }
    } else { //  no lasso drawn -> delete selected frame
-      DeleteFrame(frame);
+      if (frame)
+         DeleteFrame(frame);
       UngrabFrame();
       ChangeSelected(0);   //update editors
    }


Fix savannah bug #98532: TGuiBuilder: crash when changing text of a field (https://savannah.cern.ch/bugs/?98532)

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

--- gui/guibuilder/src/TGuiBldDragManager.cxx
+++ gui/guibuilder/src/TGuiBldDragManager.cxx
@@ -315,11 +315,12 @@
    while ((argument = (TMethodArg *) next())) {
       // Do not input argument for self object
       if (selfobjpos != argpos) {
-         const char *argname    = CreateArgumentTitle(argument).Data();
-         const char *type       = argument->GetTypeName();
-         TDataType  *datatype   = gROOT->GetType(type);
-         const char *charstar   = "char*";
-         char        basictype[32];
+         TString arg_name = CreateArgumentTitle(argument);
+         const char *argname = arg_name.Data();
+         const char *type = argument->GetTypeName();
+         TDataType  *datatype = gROOT->GetType(type);
+         const char *charstar = "char*";
+         char basictype[32];

          if (datatype) {
             strlcpy(basictype, datatype->GetTypeName(), sizeof(basictype));


Add comments re: RunGen macro tricks

Add comments re: RunGen macro tricks

--- src/CodeGen_C.cpp
+++ src/CodeGen_C.cpp
@@ -1587,6 +1587,13 @@
     if (is_header() && f.linkage == LoweredFunc::ExternalPlusMetadata) {
         // C syntax for function-that-returns-function-pointer is fun.
         const string getter = R"INLINE_CODE(
+
+// This allows the includer of this file to get the argv/metadata entry points
+// for this file without needing to know the specific function names;
+// if HALIDE_GET_STANDARD_ARGV_FUNCTION is defined before this file is
+// included, an inline function with that name is provided that return
+// a function pointer to the _argv() entry point (similarly,
+// HALIDE_GET_STANDARD_METADATA_FUNCTION -> _metadata() entry point).
 #ifdef HALIDE_GET_STANDARD_ARGV_FUNCTION
 inline int (*HALIDE_GET_STANDARD_ARGV_FUNCTION())(void**) {
     return $NAME$_argv;


Remove sources of undefined order of evaluation in CodeGen_C

Fixes #239

Former-commit-id: 2c6aaeb99ccdb95ed1a8d45d07ad7cd910df6d31

--- src/CodeGen_C.cpp
+++ src/CodeGen_C.cpp
@@ -512,7 +512,9 @@
 }

 void CodeGen_C::visit_binop(Type t, Expr a, Expr b, const char * op) {
-    print_assignment(t, print_expr(a) + " " + op + " " + print_expr(b));
+    string sa = print_expr(a);
+    string sb = print_expr(b);
+    print_assignment(t, sa + " " + op + " " + sb);
 }

 void CodeGen_C::visit(const Add *op) {
@@ -676,13 +678,19 @@
             rhs << ")";
         } else if (op->name == Call::bitwise_and) {
             assert(op->args.size() == 2);
-            rhs << print_expr(op->args[0]) << " & " << print_expr(op->args[1]);
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << a0 << " & " << a1;
         } else if (op->name == Call::bitwise_xor) {
             assert(op->args.size() == 2);
-            rhs << print_expr(op->args[0]) << " ^ " << print_expr(op->args[1]);
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << a0 << " ^ " << a1;
         } else if (op->name == Call::bitwise_or) {
             assert(op->args.size() == 2);
-            rhs << print_expr(op->args[0]) << " | " << print_expr(op->args[1]);
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << a0 << " | " << a1;
         } else if (op->name == Call::bitwise_not) {
             assert(op->args.size() == 1);
             rhs << "~" << print_expr(op->args[0]);
@@ -691,10 +699,14 @@
             rhs << print_reinterpret(op->type, op->args[0]);
         } else if (op->name == Call::shift_left) {
             assert(op->args.size() == 2);
-            rhs << print_expr(op->args[0]) << " << " << print_expr(op->args[1]);
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << a0 << " << " << a1;
         } else if (op->name == Call::shift_right) {
             assert(op->args.size() == 2);
-            rhs << print_expr(op->args[0]) << " >> " << print_expr(op->args[1]);
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << a0 << " >> " << a1;
         } else if (op->name == Call::rewrite_buffer) {
             int dims = ((int)(op->args.size())-2)/3;
             assert((int)(op->args.size()) == dims*3 + 2);
@@ -793,10 +805,14 @@
             rhs << "(&" + buf_id + ")";
         } else if (op->name == Call::extract_buffer_extent) {
             assert(op->args.size() == 2);
-            rhs << "((buffer_t *)(" << print_expr(op->args[0]) << "))->extent[" << print_expr(op->args[1]) << "];\n";
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << "((buffer_t *)(" << a0 << "))->extent[" << a1 << "];\n";
         } else if (op->name == Call::extract_buffer_min) {
             assert(op->args.size() == 2);
-            rhs << "((buffer_t *)(" << print_expr(op->args[0]) << "))->min[" << print_expr(op->args[1]) << "];\n";
+            string a0 = print_expr(op->args[0]);
+            string a1 = print_expr(op->args[1]);
+            rhs << "((buffer_t *)(" << a0 << "))->min[" << a1 << "];\n";
         } else {
           // TODO: other intrinsics
           std::cerr << "Unhandled intrinsic: " << op->name << '\n';
@@ -881,10 +897,13 @@

 void CodeGen_C::visit(const Select *op) {
     ostringstream rhs;
+    string true_val = print_expr(op->true_value);
+    string false_val = print_expr(op->false_value);
+    string cond = print_expr(op->condition);
     rhs << "(" << print_type(op->type) << ")"
-        << "(" << print_expr(op->condition)
-        << " ? " << print_expr(op->true_value)
-        << " : " << print_expr(op->false_value)
+        << "(" << cond
+        << " ? " << true_val
+        << " : " << false_val
         << ")";
     print_assignment(op->type, rhs.str());
 }


Fix AOT-CPP output for user_context (Issue #2081)

--- src/CodeGen_C.cpp
+++ src/CodeGen_C.cpp
@@ -585,6 +585,15 @@
         stream << ") HALIDE_FUNCTION_ATTRS {\n";
         indent += 1;

+        // Emit a local user_context we can pass in all cases, either
+        // aliasing __user_context or nullptr.
+        if (!is_header()) {
+            do_indent();
+            stream << "void * const __ucon = "
+                   << (have_user_context ? "(void *) __user_context" : "nullptr")
+                   << ";\n";
+        }
+
         // Emit the body
         print(f.body);

@@ -888,11 +897,10 @@
         string typecode = print_expr(op->args[1]);
         string buffer = print_name(print_expr(op->args[2]));

-        rhs << "halide_debug_to_file(";
-        rhs << (have_user_context ? "__user_context_" : "nullptr");
-        rhs << ", \"" + filename + "\", " + typecode;
-        rhs << ", (struct halide_buffer_t *)" << buffer;
-        rhs << ")";
+        rhs << "halide_debug_to_file(__ucon, "
+            << "\"" << filename << "\", "
+            << typecode
+            << ", (struct halide_buffer_t *)" << buffer << ")";
     } else if (op->is_intrinsic(Call::bitwise_and)) {
         internal_assert(op->args.size() == 2);
         string a0 = print_expr(op->args[0]);
@@ -1068,10 +1076,7 @@
         internal_assert(fn);
         string arg = print_expr(op->args[1]);

-        string call =
-            fn->value + "(" +
-            (have_user_context ? "__user_context_, " : "nullptr, ")
-            + "arg);";
+        string call = fn->value + "(__ucon, arg);";

         do_indent();
         // Make a struct on the stack that calls the given function as a destructor
@@ -1112,11 +1117,15 @@
         vector<string> args(op->args.size());
         for (size_t i = 0; i < op->args.size(); i++) {
             args[i] = print_expr(op->args[i]);
+            // This substitution ensures const correctness for all calls
+            if (args[i] == "__user_context") {
+                args[i] = "__ucon";
+            }
         }
         rhs << op->name << "(";

         if (function_takes_user_context(op->name)) {
-            rhs << (have_user_context ? "__user_context_, " : "nullptr, ");
+            rhs << "__ucon, ";
         }

         for (size_t i = 0; i < op->args.size(); i++) {
@@ -1343,10 +1352,8 @@
               " * sizeof(" << print_type(op->type) << ")) > ((int64_t(1) << 31) - 1)))\n";
             open_scope();
             do_indent();
-            stream << "halide_error("
-                   << (have_user_context ? "__user_context_" : "nullptr")
-                   << ", \"32-bit signed overflow computing size of allocation "
-                   << op->name << "\\n\");\n";
+            stream << "halide_error(__ucon, "
+                   << "\"32-bit signed overflow computing size of allocation " << op->name << "\\n\");\n";
             do_indent();
             stream << "return -1;\n";
             close_scope("overflow test " + op->name);
@@ -1379,9 +1386,7 @@
                    << print_name(op->name)
                    << " = ("
                    << print_type(op->type)
-                   << " *)halide_malloc("
-                   << (have_user_context ? "__user_context_" : "nullptr")
-                   << ", sizeof("
+                   << " *)halide_malloc(__ucon, sizeof("
                    << print_type(op->type)
                    << ")*" << size_id << ");\n";
             heap_allocations.push(op->name, 0);
@@ -1404,8 +1409,7 @@
         }

         do_indent();
-        stream << free_function << "("
-               << (have_user_context ? "__user_context_, " : "nullptr, ")
+        stream << free_function << "(__ucon, "
                << print_name(op->name)
                << ");\n";
         heap_allocations.pop(op->name);
@@ -1493,6 +1497,7 @@
 #endif

 int test1(struct halide_buffer_t *_buf_buffer, float _alpha, int32_t _beta, void const *__user_context) HALIDE_FUNCTION_ATTRS {
+ void * const __ucon = (void *) __user_context;
  void *_0 = _halide_buffer_get_host(_buf_buffer);
  void * _buf = _0;
  {
@@ -1500,11 +1505,11 @@
   int64_t _2 = _1 * _beta;
   if ((_2 > ((int64_t(1) << 31) - 1)) || ((_2 * sizeof(int32_t)) > ((int64_t(1) << 31) - 1)))
   {
-   halide_error(__user_context_, "32-bit signed overflow computing size of allocation tmp.heap\n");
+   halide_error(__ucon, "32-bit signed overflow computing size of allocation tmp.heap\n");
    return -1;
   } // overflow test tmp.heap
   int64_t _3 = _2;
-  int32_t *_tmp_heap = (int32_t *)halide_malloc(__user_context_, sizeof(int32_t)*_3);
+  int32_t *_tmp_heap = (int32_t *)halide_malloc(__ucon, sizeof(int32_t)*_3);
   {
    int32_t _tmp_stack[127];
    int32_t _4 = _beta + 1;
@@ -1515,7 +1520,7 @@
     char b0[1024];
     snprintf(b0, 1024, "%lld%s", (long long)(3), "\n");
     char const *_7 = b0;
-    int32_t _8 = halide_print(__user_context_, _7);
+    int32_t _8 = halide_print(__ucon, _7);
     int32_t _9 = (_8, 3);
     _5 = _9;
    } // if _6
@@ -1528,7 +1533,7 @@
    int32_t _12 = (int32_t)(_11 ? _10 : 2);
    ((int32_t *)_buf)[_4] = _12;
   } // alloc _tmp_stack
-  halide_free(__user_context_, _tmp_heap);
+  halide_free(__ucon, _tmp_heap);
  } // alloc _tmp_heap
  return 0;
 }


Diagnostics for exclude vars debugging

Diagnostics for exclude vars debugging

--- src/ComputeGD.cpp
+++ src/ComputeGD.cpp
@@ -494,7 +494,10 @@
 	size_t numParam = fc->varGroup->vars.size();
 	if (excludeVars.size()) {
 		fc->profiledOut.assign(fc->numParam, false);
-		for (auto vx : excludeVars) fc->profiledOut[vx] = true;
+		for (auto vx : excludeVars) {
+			fc->profiledOut[vx] = true;
+			if (OMX_DEBUG + verbose >= 1) mxLog("excludeVar %s", fc->varGroup->vars[vx]->name);
+		}
 	}
 	if (fc->profiledOut.size()) {
 		if (fc->profiledOut.size() != fc->numParam) Rf_error("Fail");


Fixed some compilation errors due to variable scope.

--- src/Exporters.cxx
+++ src/Exporters.cxx
@@ -1199,7 +1199,7 @@
 	static char buf[10];
 	int i = 0;
 	do {
-		buf[i++] = 'a' + (style % CHARZ);
+		buf[i++] = static_cast<char>('a' + (style % CHARZ));
 		style /= CHARZ;
 	} while ( style > 0 );
 	buf[i] = 0;
@@ -1247,10 +1247,11 @@

 	//int titleFullPath = props.GetInt("export.html.title.fullpath",0);

-	for (int i = 0; i <= STYLE_MAX; i++) {
+	int i;
+	for (i = 0; i <= STYLE_MAX; i++) {
 		styleIsUsed[i] = false;
 	}
-	for (int i = 0; i < lengthDoc; i++) {	// check the used styles
+	for (i = 0; i < lengthDoc; i++) {	// check the used styles
 		styleIsUsed[acc.StyleAt(i)] = true;
 	}
 	styleIsUsed[STYLE_DEFAULT] = true;
@@ -1262,7 +1263,7 @@
 		fputs("\\usepackage{alltt}\n", fp);
 		fputs("\\usepackage{times}\n", fp);

-		for (int i = 0; i < STYLE_MAX; i++) {      // get keys
+		for (i = 0; i < STYLE_MAX; i++) {      // get keys
 			// initialize style (don't keep previous one)
 			style.italics = false;
 			style.bold = false;
@@ -1288,8 +1289,9 @@

 		fprintf(fp, "\\scite%s{", texStyle(styleCurrent));

-		for (int i = 0; i < lengthDoc; i++) { //here process each character of the document
+		for (i = 0; i < lengthDoc; i++) { //here process each character of the document
 			char ch = acc[i];
+			int x;
 			int style = acc.StyleAt(i);

 			if (style != styleCurrent) { //new style?
@@ -1299,7 +1301,7 @@

 			switch ( ch ) { //write out current character.
 			case '\t':
-				for (int x = 0; x < tabSize; x++)
+				for (x = 0; x < tabSize; x++)
 					fputc(' ', fp);
 				break;
 			case '\\':


Fixed buffer overflow in Utils::Md5::hexdigest()

Found via failed test (auditlog.json) on Alpine Linux 3.8.2.

--- src/utils/md5.cc
+++ src/utils/md5.cc
@@ -13,7 +13,7 @@
     mbedtls_md5(reinterpret_cast<const unsigned char *>(input.c_str()),
         input.size(), digest);

-    char buf[32];
+    char buf[33];
     for (int i = 0; i < 16; i++) {
         sprintf(buf+i*2, "%02x", digest[i]);
     }


This adds RJ's potential solution to teh multiple-property tree bug related to support for child FDMs

--- src/FGFDMExec.cpp
+++ src/FGFDMExec.cpp
@@ -69,7 +69,7 @@

 namespace JSBSim {

-static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.62 2009/06/26 12:00:55 ehofman Exp $";
+static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.63 2009/06/26 12:26:48 jberndt Exp $";
 static const char *IdHdr = ID_FDMEXEC;

 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -132,7 +132,7 @@
   Terminate = false;

   IdFDM = FDMctr; // The main (parent) JSBSim instance is always the "zeroth"
-                  // instance. "child" instances are loaded last.
+  FDMctr++;       // instance. "child" instances are loaded last.

   try {
     char* num = getenv("JSBSIM_DEBUG");
@@ -145,9 +145,6 @@
     if (master == 0)
       master = new FGPropertyManager;
     Root = master;
-
-    // JSBSim Standalone, multiple childs are allowed
-    FDMctr++;
   }

   instance = Root->GetNode("/fdm/jsbsim",IdFDM,true);
@@ -188,6 +185,8 @@
   ChildFDMList.clear();

   PropertyCatalog.clear();
+
+  FDMctr--;

   Debug(1);
 }


* Minor cleanup.

* Minor cleanup.

--- src/libstore/store.cc
+++ src/libstore/store.cc
@@ -707,14 +707,12 @@

     if (!readOnlyMode) addTempRoot(dstPath);

-    if (!readOnlyMode && !isValidPath(dstPath)) {
+    if (!readOnlyMode && !isValidPath(dstPath)) {

         /* The first check above is an optimisation to prevent
            unnecessary lock acquisition. */

-        PathSet lockPaths;
-        lockPaths.insert(dstPath);
-        PathLocks outputLock(lockPaths);
+        PathLocks outputLock(singleton<PathSet, Path>(dstPath));

         if (!isValidPath(dstPath)) {

@@ -764,9 +762,7 @@

     if (!readOnlyMode && !isValidPath(dstPath)) {

-        PathSet lockPaths;
-        lockPaths.insert(dstPath);
-        PathLocks outputLock(lockPaths);
+        PathLocks outputLock(singleton<PathSet, Path>(dstPath));

         if (!isValidPath(dstPath)) {


removed use of polar site from segment.cc

--- src/libxtp/segment.cc
+++ src/libxtp/segment.cc
@@ -20,7 +20,6 @@
 #include <vector>
 #include <string>

-#include <votca/xtp/polarsite.h>
 #include <votca/xtp/apolarsite.h>
 #include <votca/xtp/atom.h>
 #include <votca/xtp/fragment.h>
@@ -87,7 +86,7 @@
   _atoms.clear();

   _eMpoles.clear();
-  _polarSites.clear();
+  _apolarSites.clear();
 }

 void Segment::TranslateBy(const vec &shift) {
@@ -303,12 +302,6 @@
   atom->setSegment(this);
 }

-void Segment::AddPolarSite(PolarSite *pole) {
-
-  _polarSites.push_back(pole);
-  pole->setSegment(this);
-}
-
 void Segment::AddAPolarSite(APolarSite *pole) {

   _apolarSites.push_back(pole);


Add m library by default for unix.

Add m library by default for unix.

--- src/printers/cmake.cpp
+++ src/printers/cmake.cpp
@@ -1768,21 +1768,24 @@
 target_link_libraries()" + cppan_helpers_target + R"(
     INTERFACE Ws2_32
 )
-else()
-    find_library(pthread pthread)
-    if (NOT ${pthread} STREQUAL "pthread-NOTFOUND")
-        target_link_libraries()" + cppan_helpers_target + R"(
-            INTERFACE pthread
-        )
-    endif()
-    find_library(rt rt)
-    if (NOT ${rt} STREQUAL "rt-NOTFOUND")
-        target_link_libraries()" + cppan_helpers_target + R"(
-            INTERFACE rt
-        )
-    endif()
-endif()
-)");
+else())");
+        ctx.increaseIndent();
+        auto add_unix_lib = [&ctx](const String &s)
+        {
+            ctx.addLine("find_library(" + s + " " + s + ")");
+            ctx.addLine("if (NOT ${" + s + "} STREQUAL \"" + s + "-NOTFOUND\")");
+            ctx.increaseIndent();
+            ctx.addLine("target_link_libraries(" + cppan_helpers_target + "");
+            ctx.addLine("    INTERFACE " + s + "");
+            ctx.addLine(")");
+            ctx.decreaseIndent();
+            ctx.addLine("endif()");
+        };
+        add_unix_lib("m");
+        add_unix_lib("pthread");
+        add_unix_lib("rt");
+        ctx.decreaseIndent();
+        ctx.addLine("endif()");
         ctx.addLine();

         // Do not use APPEND here. It's the first file that will clear cppan.cmake.


Reorder header includes as per comment

Reorder header includes as per comment

--- src/uvw/loop.hpp
+++ src/uvw/loop.hpp
@@ -1,5 +1,8 @@
 #pragma once

+#ifdef _WIN32
+#include <ciso646>
+#endif
 #include <new>
 #include <memory>
 #include <utility>
@@ -7,10 +10,6 @@
 #include <chrono>
 #include <uv.h>
 #include "emitter.hpp"
-
-#ifdef _WIN32
-#include <ciso646>
-#endif

 namespace uvw {


Faster popcount algorithm (Harley-Seal 4th iteration)

--- src/primesieve/popcount.cpp
+++ src/primesieve/popcount.cpp
@@ -1,8 +1,9 @@
 ///
 /// @file   popcount.cpp
-/// @brief  Fast algorithm to count the number of 1 bits in an array.
+/// @brief  Fast algorithm to count the number of 1 bits in an array
+///         using only integer operations.
 ///
-/// Copyright (C) 2013 Kim Walisch, <kim.walisch@gmail.com>
+/// Copyright (C) 2015 Kim Walisch, <kim.walisch@gmail.com>
 ///
 /// This file is distributed under the BSD License. See the COPYING
 /// file in the top level directory.
@@ -14,70 +15,90 @@

 #include <stdint.h>

-namespace primesieve {
+namespace {

-/// This algorithm counts the number of 1 bits (population count) in
-/// an array using 64-bit tree merging. To the best of my knowledge
-/// this is the fastest integer arithmetic bit population count
-/// algorithm, it uses only 8 operations for 8 bytes on 64-bit CPUs.
-/// The 64-bit tree merging popcount algorithm is due to
-/// Cdric Lauradoux, it is described in his paper:
-/// http://perso.citi.insa-lyon.fr/claurado/ham/overview.pdf
-/// http://perso.citi.insa-lyon.fr/claurado/hamming.html
+/// This uses fewer arithmetic operations than any other known
+/// implementation on machines with fast multiplication.
+/// It uses 12 arithmetic operations, one of which is a multiply.
+/// http://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation
 ///
-uint64_t popcount(const uint64_t* array, uint64_t size)
+uint64_t popcount_mul(uint64_t x)
 {
   const uint64_t m1  = UINT64_C(0x5555555555555555);
   const uint64_t m2  = UINT64_C(0x3333333333333333);
   const uint64_t m4  = UINT64_C(0x0F0F0F0F0F0F0F0F);
-  const uint64_t m8  = UINT64_C(0x00FF00FF00FF00FF);
   const uint64_t h01 = UINT64_C(0x0101010101010101);

-  uint64_t limit30 = size - size % 30;
-  uint64_t i, j;
-  uint64_t count1, count2, half1, half2, acc;
-  uint64_t bit_count = 0;
-  uint64_t x;
+  x -=            (x >> 1)  & m1;
+  x = (x & m2) + ((x >> 2)  & m2);
+  x = (x +        (x >> 4)) & m4;
+  return (x * h01) >> 56;
+}

-  if (array == 0)
-    return 0;
+/// Carry-save adder (CSA).
+/// @see Chapter 5 in "Hacker's Delight".
+///
+void CSA(uint64_t& h, uint64_t& l, uint64_t a, uint64_t b, uint64_t c)
+{
+  uint64_t u = a ^ b;
+  h = (a & b) | (u & c);
+  l = u ^ c;
+}

-  // 64-bit tree merging (merging3)
-  for (i = 0; i < limit30; i += 30, array += 30) {
-    acc = 0;
-    for (j = 0; j < 30; j += 3) {
-      count1  =  array[j];
-      count2  =  array[j+1];
-      half1   =  array[j+2];
-      half2   =  array[j+2];
-      half1  &=  m1;
-      half2   = (half2  >> 1) & m1;
-      count1 -= (count1 >> 1) & m1;
-      count2 -= (count2 >> 1) & m1;
-      count1 +=  half1;
-      count2 +=  half2;
-      count1  = (count1 & m2) + ((count1 >> 2) & m2);
-      count1 += (count2 & m2) + ((count2 >> 2) & m2);
-      acc    += (count1 & m4) + ((count1 >> 4) & m4);
-    }
-    acc = (acc & m8) + ((acc >>  8) & m8);
-    acc = (acc       +  (acc >> 16));
-    acc = (acc       +  (acc >> 32));
-    bit_count += acc & 0xffff;
+/// Harley-Seal popcount (4th iteration).
+/// The Harley-Seal popcount algorithm is one of the fastest algorithms
+/// for counting 1 bits in an array using only integer operations.
+/// This implementation uses only 5.69 instructions per 64-bit word.
+/// @see Chapter 5 in "Hacker's Delight" 2nd edition.
+///
+uint64_t popcount_hs4(const uint64_t* array, uint64_t size)
+{
+  uint64_t total = 0;
+  uint64_t ones = 0, twos = 0, fours = 0, eights = 0, sixteens = 0;
+  uint64_t twosA, twosB, foursA, foursB, eightsA, eightsB;
+  uint64_t limit = size - size % 16;
+  uint64_t i = 0;
+
+  for(; i < limit; i += 16)
+  {
+    CSA(twosA, ones, ones, array[i+0], array[i+1]);
+    CSA(twosB, ones, ones, array[i+2], array[i+3]);
+    CSA(foursA, twos, twos, twosA, twosB);
+    CSA(twosA, ones, ones, array[i+4], array[i+5]);
+    CSA(twosB, ones, ones, array[i+6], array[i+7]);
+    CSA(foursB, twos, twos, twosA, twosB);
+    CSA(eightsA,fours, fours, foursA, foursB);
+    CSA(twosA, ones, ones, array[i+8], array[i+9]);
+    CSA(twosB, ones, ones, array[i+10], array[i+11]);
+    CSA(foursA, twos, twos, twosA, twosB);
+    CSA(twosA, ones, ones, array[i+12], array[i+13]);
+    CSA(twosB, ones, ones, array[i+14], array[i+15]);
+    CSA(foursB, twos, twos, twosA, twosB);
+    CSA(eightsB, fours, fours, foursA, foursB);
+    CSA(sixteens, eights, eights, eightsA, eightsB);
+
+    total += popcount_mul(sixteens);
   }

-  // Count the bits of the remaining bytes (max 29*8 = 232)
-  // http://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation
-  for (i = 0; i < size - limit30; i++) {
-    x = array[i];
-    x =  x       - ((x >> 1)  & m1);
-    x = (x & m2) + ((x >> 2)  & m2);
-    x = (x       +  (x >> 4)) & m4;
-    x = (x * h01) >> 56;
-    bit_count += x;
-  }
+  total *= 16;
+  total += 8 * popcount_mul(eights);
+  total += 4 * popcount_mul(fours);
+  total += 2 * popcount_mul(twos);
+  total += 1 * popcount_mul(ones);

-  return bit_count;
+  for(; i < size; i++)
+    total += popcount_mul(array[i]);
+
+  return total;
+}
+
+} // namespace
+
+namespace primesieve {
+
+uint64_t popcount(const uint64_t* array, uint64_t size)
+{
+  return popcount_hs4(array, size);
 }

 } // namespace primesieve


proj_transform: fix strided coordinate array transform

--- src/proj_transform.cpp
+++ src/proj_transform.cpp
@@ -195,11 +195,11 @@

     if (wgs84_to_merc_)
     {
-        return lonlat2merc(x,y,point_count);
+        return lonlat2merc(x, y, point_count, offset);
     }
     else if (merc_to_wgs84_)
     {
-        return merc2lonlat(x,y,point_count);
+        return merc2lonlat(x, y, point_count, offset);
     }

 #ifdef MAPNIK_USE_PROJ4
@@ -244,11 +244,11 @@

     if (wgs84_to_merc_)
     {
-        return merc2lonlat(x,y,point_count);
+        return merc2lonlat(x, y, point_count, offset);
     }
     else if (merc_to_wgs84_)
     {
-        return lonlat2merc(x,y,point_count);
+        return lonlat2merc(x, y, point_count, offset);
     }

 #ifdef MAPNIK_USE_PROJ4


adjust_ge unit test

adjust_ge unit test

--- test/test_array.cpp
+++ test/test_array.cpp
@@ -1495,4 +1495,35 @@
     }
 }

+TEST(Array_AdjustGEFuzzy)
+{
+    for (int iter = 0; iter < 100 + 100000 * TEST_DURATION; iter++)
+    {
+        Array c(Allocator::get_default());
+        c.create(Array::type_Normal);
+        std::vector<int64_t> v;
+
+        for (size_t t = 0; t < 2; t++) {
+            int64_t r = fastrand(18) - 9;
+            c.add(r);
+            v.push_back(r);
+        }
+
+        int64_t limit = fastrand(18) - 9;
+        int64_t diff = fastrand(18) - 9;
+
+        c.adjust_ge(limit, diff);
+        for (size_t t = 0; t < 2; t++) {
+            if (v[t] >= limit)
+                v[t] += diff;
+        }
+
+        for (size_t t = 0; t < 2; t++) {
+            CHECK_EQUAL(v[t], c.get(t));
+        }
+
+        c.destroy();
+
+    }
+}
 #endif // TEST_ARRAY


camera now also opens if no camera_name was written into it

--- src/pylon_camera/pylon_camera.cpp
+++ src/pylon_camera/pylon_camera.cpp
@@ -126,8 +126,11 @@

                 camera_array[i].Close();

-                if (device_user_id.compare(name) == 0 ||
-                    device_user_id.compare(device_user_id.length() - name.length(), name.length(), name))
+//                std::cout << "device_user_id " << device_user_id << std::endl;
+//                std::cout << "length " << device_user_id.size() << std::endl;
+
+                if (device_user_id.compare(name) == 0) // ||
+//                    device_user_id.compare(device_user_id.length() - name.length(), name.length(), name))
                 {
                     found_desired_device = true;
                     cam_pos = i;


Fix a small bug in conversion to SInt32

Fix a small bug in conversion to SInt32

If the truncation from double returned out of bounds,
the code was not generating the right call to the fallback
method on 64 bit.

Change-Id: I6a126dd013c5b6373762beef0c1459fae1c26ef2
Reviewed-by: Simon Hausmann <a975102812d593b3191088e3d0aeaeb6f11dbcf5@digia.com>

--- src/qml/compiler/qv4isel_masm.cpp
+++ src/qml/compiler/qv4isel_masm.cpp
@@ -1612,9 +1612,6 @@
         Assembler::Jump success =
                 _as->branchTruncateDoubleToInt32(Assembler::FPGpr0, Assembler::ReturnValueRegister,
                                                  Assembler::BranchIfTruncateSuccessful);
-        generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_double_to_int32,
-                             Assembler::PointerToValue(source));
-        Assembler::Jump converted = _as->jump();

         // not an int:
         fallback.link(_as);
@@ -1623,12 +1620,7 @@

         isInt.link(_as);
         success.link(_as);
-        converted.link(_as);
         if (target->kind == V4IR::Temp::StackSlot) {
-//            _as->move(Assembler::TrustedImm32(QV4::Value::_Integer_Type), Assembler::ScratchRegister);
-//            _as->lshift64(Assembler::TrustedImm32(32), Assembler::ScratchRegister);
-//            _as->or64(Assembler::ScratchRegister, Assembler::ReturnValueRegister, Assembler::ScratchRegister);
-//            _as->store64(Assembler::ScratchRegister, target);
             Assembler::Pointer targetAddr = _as->stackSlotPointer(target);
             _as->store32(Assembler::ReturnValueRegister, targetAddr);
             targetAddr.offset += 4;


Disable the stack slot allocator

Disable the stack slot allocator

The allocator doesn't work correctly and sometimes assigns
temps with overlapping ranges to the same stack slot.

This fixes crypto.js and qt quick controls autotests running
with the interpreter.

Change-Id: If3d0f90edfac669f89da5174cd58eb345d48f2b8
Reviewed-by: Simon Hausmann <a975102812d593b3191088e3d0aeaeb6f11dbcf5@digia.com>

--- src/qml/compiler/qv4isel_moth.cpp
+++ src/qml/compiler/qv4isel_moth.cpp
@@ -249,7 +249,7 @@
     opt.run();
     StackSlotAllocator *stackSlotAllocator = 0;
     if (opt.isInSSA()) {
-        stackSlotAllocator = new StackSlotAllocator(opt.lifeRanges(), _function->tempCount);
+        //stackSlotAllocator = new StackSlotAllocator(opt.lifeRanges(), _function->tempCount);
         opt.convertOutOfSSA();
     }


Use for_each to simplify the management of Value

--- src/Functions.cpp
+++ src/Functions.cpp
@@ -6,6 +6,7 @@
 //=======================================================================

 #include <iostream>
+#include <algorithm>

 #include "AssemblyFileWriter.hpp"
 #include "Functions.hpp"
@@ -63,12 +64,7 @@
 }

 void FunctionCall::write(AssemblyFileWriter& writer){
-    std::vector<std::shared_ptr<Value>>::reverse_iterator it = m_values.rbegin();
-    std::vector<std::shared_ptr<Value>>::reverse_iterator end = m_values.rend();
-
-    for( ; it != end; ++it){
-        (*it)->write(writer);
-    }
+    for_each(m_values.rbegin(), m_values.rend(), [&](std::shared_ptr<Value> v){ v->write(writer); });

     writer.stream() << "call " << m_function_mangled << endl;
 }