changed screen out of bounds detection from contains() to intersects()

--- src/singletons/WindowManager.cpp
+++ src/singletons/WindowManager.cpp
@@ -325,7 +325,7 @@
             auto screens = qApp->screens();
             bool outOfBounds = std::none_of(
                 screens.begin(), screens.end(), [&](QScreen *screen) {
-                    return screen->geometry().contains(geometry);
+                    return screen->availableGeometry().intersects(geometry);
                 });

             // ask if move into bounds


CWS-TOOLING: integrate CWS fwk95 2009-01-15 13:24:14 +0100 cd  r266366 : #i96390# Change method name to use UNO AWT style for mnemonics 2009-01-15 13:23:30 +0100 cd  r266365 : #i96390# Change method name to use UNO AWT style for mnemonics 2009-01-12 17:25:13 +0100 cd  r266174 : #i97983# Check pointer returned by dynamic_cast 2009-01-12 15:31:40 +0100 cd  r266162 : #i97983# Create toolkit popup menus via service manager instead of implementation class 2008-12-11 15:04:34 +0100 cd  r265305 : #i95863# Remove user defined properties 2008-12-11 14:56:45 +0100 cd  r265302 : #i95606# Update documentation for textfields 2008-12-11 10:06:20 +0100 cd  r265250 : #i96390# Fix warning on Solaris compiler 2008-12-09 17:27:32 +0100 cd  r265119 : CWS-TOOLING: rebase CWS fwk95 to trunk@264807 (milestone: DEV300:m37) 2008-12-01 13:29:43 +0100 cd  r264597 : #i96390# New interfaces and structures for complete UNO AWT menu API 2008-12-01 13:25:22 +0100 cd  r264596 : #i96390# Added implementation of the new UNO AWT interfaces and structures for menus 2008-11-28 13:55:19 +0100 cd  r264553 : #i96640# Fixed wrong property type for MenuBarCloser 2008-11-28 13:53:56 +0100 cd  r264552 : #i96621# Fixed ambiguous usage of && and || 2008-11-18 16:05:45 +0100 cd  r263781 : #i95316# Initialize SvtTabAppearanceCfg to enable system settings changed notiifcation code 2008-11-18 16:05:43 +0100 cd  r263780 : #i96155# Fix wrong statement to check for enabled argument 2008-10-20 16:54:37 +0200 cd  r262328 : #i10000# migrate CWS fwk95 to SVN.

--- chart2/source/controller/main/ChartController_Window.cxx
+++ chart2/source/controller/main/ChartController_Window.cxx
@@ -823,7 +823,9 @@
             impl_notifySelectionChangeListeners();

         // todo: the context menu should be specified by an xml file in uiconfig
-        uno::Reference< awt::XPopupMenu > xPopupMenu( new VCLXPopupMenu());
+        uno::Reference< awt::XPopupMenu > xPopupMenu(
+            m_xCC->getServiceManager()->createInstanceWithContext(
+                C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
         uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY );
         if( xPopupMenu.is() && xMenuEx.is())
         {
@@ -831,7 +833,9 @@
             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramObjects"));
             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog"));
             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow"));
-            uno::Reference< awt::XPopupMenu > xArrangePopupMenu( new VCLXPopupMenu());
+            uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
+                m_xCC->getServiceManager()->createInstanceWithContext(
+                    C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
             uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY );
             if( xArrangePopupMenu.is() && xArrangeMenuEx.is())
             {


Adds data processing of F1RC1x-7x attributes

Change-Id: I84d3e87d3699d75500ccd8b576833d2158a5c63b
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/108164
Tested-by: Jenkins Server <8e3f934e4c44875bc48d33da3ea13d93ba9a233f@us.ibm.com>
Tested-by: FSP CI Jenkins <aa9e4d9ac7cd25905e9c0dd36d4150516e73dd86@us.ibm.com>
Dev-Ready: STEPHEN GLANCY <7301c4b00f53e5772c2576cd0c5f485155c2ece1@us.ibm.com>
Reviewed-by: Mark Pizzutillo <e025966b648907ad559ec0f11afd8614ca18d62d@ibm.com>
Reviewed-by: Louis Stermole <a2bef96d502debd02962600aef4d81d949c35039@us.ibm.com>
Tested-by: Hostboot CI <52521565bd8ea18a2b112942dce4f4220a97c2c8@us.ibm.com>
Reviewed-by: NAREN A DEVAIAH <22a8cd2230f5dbddc95d6aa25fc3c45a9218ca57@in.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/108165
Tested-by: Jenkins OP Build CI <e610bd72261d3c0a48f1e8ae36832ab00774d426@us.ibm.com>
Tested-by: Jenkins Combined Simics CI <8312af3886dfc9bb930f549023677220805b137e@us.ibm.com>
Tested-by: Jenkins OP HW <0eb0fff262f74a65a832afbcc7b153e391c9a3fd@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <fb8db48116bc8a69e29dd8cdb037246f232f4af5@us.ibm.com>

--- src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_efd_processing.C
+++ src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_efd_processing.C
@@ -371,6 +371,174 @@
 }

 ///
+/// @brief Processes F1RC1x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc1x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc1x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc1x(i_target, l_f1rc1x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc1x(l_f1rc1x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc1x(i_target, l_f1rc1x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC2x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc2x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc2x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc2x(i_target, l_f1rc2x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc2x(l_f1rc2x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc2x(i_target, l_f1rc2x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC3x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc3x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc3x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc3x(i_target, l_f1rc3x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc3x(l_f1rc3x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc3x(i_target, l_f1rc3x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC4x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc4x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc4x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc4x(i_target, l_f1rc4x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc4x(l_f1rc4x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc4x(i_target, l_f1rc4x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC5x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc5x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc5x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc5x(i_target, l_f1rc5x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc5x(l_f1rc5x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc5x(i_target, l_f1rc5x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC6x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc6x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc6x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc6x(i_target, l_f1rc6x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc6x(l_f1rc6x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc6x(i_target, l_f1rc6x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
+/// @brief Processes F1RC7x
+/// @param[in] i_target the target on which to operate
+/// @param[in] i_efd_data the EFD data to process
+/// @return fapi2::FAPI2_RC_SUCCESS iff function completes successfully
+///
+fapi2::ReturnCode dimm_ddr4_f1rc7x(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+                                   const std::shared_ptr<mss::efd::base_decoder>& i_efd_data)
+{
+    // Get the data
+    uint8_t l_f1rc7x = 0;
+
+    FAPI_TRY(mss::attr::get_ddr4_f1rc7x(i_target, l_f1rc7x));
+
+    // Update the values
+    FAPI_TRY(i_efd_data->dimm_ddr4_f1rc7x(l_f1rc7x));
+
+    // Set the attribute
+    FAPI_TRY(mss::attr::set_ddr4_f1rc7x(i_target, l_f1rc7x));
+
+fapi_try_exit:
+    return fapi2::current_err;
+}
+
+///
 /// @brief Process the EFD data and set attributes
 /// @param[in] i_target DIMM target on which to operate
 /// @param[in] i_efd_data the EFD data to process
@@ -385,6 +553,13 @@
     FAPI_TRY(rcd_voltage_ctrl(i_target, i_efd_data));
     FAPI_TRY(dimm_ddr4_f0rc7x(i_target, i_efd_data));
     FAPI_TRY(dimm_ddr4_f1rc00(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc1x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc2x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc3x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc4x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc5x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc6x(i_target, i_efd_data));
+    FAPI_TRY(dimm_ddr4_f1rc7x(i_target, i_efd_data));
     FAPI_TRY(rcd_slew_rate(i_target, i_efd_data));
     FAPI_TRY(cs_cmd_latency(i_target, i_efd_data));
     FAPI_TRY(ca_parity_latency(i_target, i_efd_data));


Subobject_field values can now be evaluated. Tracker item 1776, https://tracker.physiomeproject.org/show_bug.cgi?id=1776

--- source/computed_field/computed_field_subobject_group.hpp
+++ source/computed_field/computed_field_subobject_group.hpp
@@ -495,7 +495,31 @@

 		int evaluate_cache_at_location(Field_location* location)
 		{
-			USE_PARAMETER(location);
+			if (field && location)
+			{
+				if (dynamic_cast<Field_element_xi_location*>(location))
+				{
+		 			Field_element_xi_location *element_xi_location =
+		 				reinterpret_cast<Field_element_xi_location *>(location);
+		 			Cmiss_element_id element = element_xi_location->get_element();
+		 			if (dimension == Cmiss_element_get_dimension(element))
+		 			{
+		 				field->values[0] = containsObject(element);
+		 			}
+		 			else
+		 			{
+		 				field->values[0] = 0;
+		 			}
+				}
+				else
+				{
+					field->values[0] = 0;
+				}
+			}
+			else
+			{
+				return 0;
+			}
 			return 1;
 		};

@@ -667,9 +691,26 @@

 		int evaluate_cache_at_location(Field_location* location)
 		{
-			USE_PARAMETER(location);
-			return 1;
-		};
+			if (field && location)
+			{
+				if (dynamic_cast<Field_node_location*> (location))
+				{
+					Field_node_location *node_location =
+						reinterpret_cast<Field_node_location *> (location);
+					Cmiss_node_id node = node_location->get_node();
+	 				field->values[0] = containsObject(node);
+				}
+				else
+				{
+					field->values[0] = 0;
+				}
+			}
+			else
+			{
+				return 0;
+			}
+			return 1;
+		}

 		int list()
 		{


Eliminate precarious use of const_cast<wchar*>(wstring.get())
Review URL: http://codereview.chromium.org/42617

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

Former-commit-id: 02a2270a92883cd01c107b448ed5f6e9a49348d1


Reworked pull request Centering model on bed, using bed shape from config (if available). #2424 thanks @luketaverne

--- src/PrusaSlicer.cpp
+++ src/PrusaSlicer.cpp
@@ -167,6 +167,7 @@
 //    sla_print_config.apply(m_print_config, true);

     // Loop through transform options.
+    bool user_center_specified = false;
     for (auto const &opt_key : m_transforms) {
         if (opt_key == "merge") {
             Model m;
@@ -209,6 +210,7 @@
             for (auto &model : m_models)
                 model.duplicate_objects_grid(x, y, (distance > 0) ? distance : 6);  // TODO: this is not the right place for setting a default
         } else if (opt_key == "center") {
+        	user_center_specified = true;
             for (auto &model : m_models) {
                 model.add_default_instances();
                 // this affects instances:
@@ -403,7 +405,9 @@
                 if (! m_config.opt_bool("dont_arrange")) {
                     //FIXME make the min_object_distance configurable.
                     model.arrange_objects(fff_print.config().min_object_distance());
-                    model.center_instances_around_point(m_config.option<ConfigOptionPoint>("center")->value);
+                    model.center_instances_around_point((! user_center_specified && m_print_config.has("bed_shape")) ?
+                    	BoundingBoxf(m_print_config.opt<ConfigOptionPoints>("bed_shape")->values).center() :
+                    	m_config.option<ConfigOptionPoint>("center")->value);
                 }
                 if (printer_technology == ptFFF) {
                     for (auto* mo : model.objects)


mesa: fix dispatch sanity with GL_OES_texture_storage_multisample_2d_array

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91785
Signed-off-by: Ilia Mirkin <bcbbb7aa705ec3a5fc5824c01a845186c3d62fca@alum.mit.edu>
Acked-by: Matt Turner <789b315743a28dd066a4ba1459c35951c291d8a6@gmail.com>

--- src/mesa/main/tests/dispatch_sanity.cpp
+++ src/mesa/main/tests/dispatch_sanity.cpp
@@ -2480,5 +2480,8 @@
    { "glVertexAttribBinding", 31, -1 },
    { "glVertexBindingDivisor", 31, -1 },

+   /* GL_OES_texture_storage_multisample_2d_array */
+   { "glTexStorage3DMultisampleOES", 31, -1 },
+
    { NULL, 0, -1 },
  };


INTEGRATION: CWS aw024 (1.19.10); FILE MERGED 2006/09/22 04:01:48 aw 1.19.10.6: RESYNC: (1.20-1.21); FILE MERGED 2006/07/07 16:07:08 aw 1.19.10.5: adaptions after resync SRC680m171->SRC680m174 2005/09/19 14:17:18 aw 1.19.10.4: RESYNC: (1.19-1.20); FILE MERGED 2005/05/12 16:41:37 aw 1.19.10.3: #i39529# 2005/04/26 14:50:13 aw 1.19.10.2: #i39528# 2004/12/27 09:50:16 aw 1.19.10.1: #i39525

--- chart2/source/controller/main/ChartController_Window.cxx
+++ chart2/source/controller/main/ChartController_Window.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ChartController_Window.cxx,v $
  *
- *  $Revision: 1.21 $
- *
- *  last change: $Author: obo $ $Date: 2006-09-17 13:05:45 $
+ *  $Revision: 1.22 $
+ *
+ *  last change: $Author: ihi $ $Date: 2006-11-14 15:31:43 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -108,6 +108,10 @@
 #ifndef _XOUTX_HXX
 #include <svx/xoutx.hxx>
 #endif
+// header for class ::basegfx::B3DPolygon
+#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
+#include <basegfx/polygon/b3dpolygon.hxx>
+#endif

 #define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)

@@ -442,10 +446,10 @@
         double              m_fXAngleDegree;
         double              m_fYAngleDegree;
         double              m_fZAngleDegree;
-        Matrix4D            m_aParentTransform;
-
-        Matrix4D            m_aCurrentTransform;
-        Polygon3D           m_aWireframePoly;
+        ::basegfx::B3DHomMatrix     m_aParentTransform;
+
+        ::basegfx::B3DHomMatrix     m_aCurrentTransform;
+        ::basegfx::B3DPolygon       m_aWireframePoly;
 };

 RotateDiagramDragMethod::RotateDiagramDragMethod( DrawViewWrapper& rDrawViewWrapper )
@@ -465,20 +469,17 @@
     if(pObj)
     {
         m_aReferenceRect = pObj->GetLogicRect();
-        m_aWireframePoly.SetPointCount(0);
+        m_aWireframePoly.clear();
         if(pObj->ISA(E3dObject))
         {
             E3dObject* pE3dObject = (E3dObject*)pObj;
-
-//BFS03         pE3dObject->CreateWireframe(m_aWireframePoly, NULL, E3DDETAIL_DEFAULT ); //E3DDETAIL_ONEBOX, E3DDETAIL_ALLBOXES, E3DDETAIL_ALLLINES
             pE3dObject->CreateWireframe(m_aWireframePoly, NULL );
-
             m_pScene = pE3dObject->GetScene();

             //get pure rotation matrix
-            Matrix4D aPureRotateMatrix = m_pScene->GetTransform();
-            Matrix4D aTranslateM4Inverse;
-            aTranslateM4Inverse.Translate(FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
+            ::basegfx::B3DHomMatrix aPureRotateMatrix = m_pScene->GetTransform();
+            ::basegfx::B3DHomMatrix aTranslateM4Inverse;
+            aTranslateM4Inverse.translate(FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
             aPureRotateMatrix = aPureRotateMatrix*aTranslateM4Inverse;

             //get euler angles from pure rotation matrix
@@ -493,8 +494,8 @@
                 m_aParentTransform = pParent->GetTransform();
             }

-            Matrix4D aTranslateM4;
-            aTranslateM4.Translate(-FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
+            ::basegfx::B3DHomMatrix aTranslateM4;
+            aTranslateM4.translate(-FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
             m_aParentTransform = aTranslateM4*m_aParentTransform;

             m_aCurrentTransform = aPureRotateMatrix*m_aParentTransform;
@@ -526,7 +527,7 @@
         //get new transformation matrix from euler angles
         drawing::Direction3D aAxis; double fAngle;
         Rotation::getAxisAngleFromEulerRepresentation( aAxis, fAngle, m_fXAngleDegree+fHAngle, m_fYAngleDegree+fWAngle, m_fZAngleDegree );
-        Matrix4D aRotateM4 = Rotation::getRotationMatrixFromAxisAngleRepresentation( aAxis, fAngle );
+        ::basegfx::B3DHomMatrix aRotateM4 = Rotation::getRotationMatrixFromAxisAngleRepresentation( aAxis, fAngle );

         //use new matrix
         Hide();
@@ -552,24 +553,24 @@
 void RotateDiagramDragMethod::DrawXor(XOutputDevice& rXOut, FASTBOOL bFull) const
 {
     //rXOut.SetOffset(pPV->GetOffset());
-    UINT16 nPntCnt = m_aWireframePoly.GetPointCount();
-    if(nPntCnt > 1 && m_pScene)
+    const sal_uInt32 nPntCnt(m_aWireframePoly.count());
+    if(nPntCnt > 1L && m_pScene)
     {
         B3dCamera& rCameraSet = m_pScene->GetCameraSet();
-        XPolygon aLine(2);
-        for(UINT16 b=0;b < nPntCnt;b += 2)
-        {
-            Vector3D aPnt1 = m_aCurrentTransform * m_aWireframePoly[b];
+
+        for(sal_uInt32 b(0L); b < nPntCnt; b += 2L)
+        {
+            ::basegfx::B2DPolygon aLine;
+
+            ::basegfx::B3DPoint aPnt1(m_aCurrentTransform * m_aWireframePoly.getB3DPoint(b));
             aPnt1 = rCameraSet.WorldToViewCoor(aPnt1);
-            aLine[0].X() = (long)(aPnt1.X() + 0.5);
-            aLine[0].Y() = (long)(aPnt1.Y() + 0.5);
-
-            Vector3D aPnt2 = m_aCurrentTransform * m_aWireframePoly[b+1];
+            aLine.append(::basegfx::B2DPoint(aPnt1.getX(), aPnt1.getY()));
+
+            ::basegfx::B3DPoint aPnt2(m_aCurrentTransform * m_aWireframePoly.getB3DPoint(b + 1L));
             aPnt2 = rCameraSet.WorldToViewCoor(aPnt2);
-            aLine[1].X() = (long)(aPnt2.X() + 0.5);
-            aLine[1].Y() = (long)(aPnt2.Y() + 0.5);
-
-            rXOut.DrawXPolyLine(aLine);
+            aLine.append(::basegfx::B2DPoint(aPnt2.getX(), aPnt2.getY()));
+
+            rXOut.DrawPolyLine(aLine);
         }
     }
 }
@@ -625,7 +626,7 @@
     SdrHdl* pHitSelectionHdl = 0;
     //switch from move to resize if handle is hit on a resizeable object
     if( lcl_isResizeableObject( m_aSelectedObjectCID ) )
-        pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos, *pWindow );
+        pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos );
     bool bClickedTwiceOnDragableObject = SelectionHelper::isDragableObjectHitTwice( aMPos, m_aSelectedObjectCID, *pDrawViewWrapper );
     //do not change selection if clicked twice on a dragable object
     //or if selection handles are hit
@@ -653,7 +654,7 @@
             E3dScene* pScene = pE3dObject->GetScene();
             pDrawViewWrapper->UnmarkAll();
             pDrawViewWrapper->MarkObject(pScene);
-            pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos, *pWindow );//get new handle as selection has changed
+            pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos );//get new handle as selection has changed

             SdrDragMode eDragMode = pDrawViewWrapper->GetDragMode();
             if( SDRDRAG_ROTATE==eDragMode )
@@ -719,9 +720,10 @@
                 {
                     if(pObj->ISA(E3dObject))
                     {
-                        Matrix4D aSceneMatrix(((E3dObject*)pObj)->GetScene()->GetFullTransform());
-                        Matrix4D aTranslateM4Inverse;
-                        aTranslateM4Inverse.Translate(FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
+//                        Matrix4D aSceneMatrix(((E3dObject*)pObj)->GetScene()->GetFullTransform());
+                        ::basegfx::B3DHomMatrix aSceneMatrix(((E3dObject*)pObj)->GetScene()->GetFullTransform());
+                        ::basegfx::B3DHomMatrix aTranslateM4Inverse;
+                        aTranslateM4Inverse.translate(FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, 0.0);
                         aSceneMatrix = aSceneMatrix*aTranslateM4Inverse;

                         SceneDescriptor aSceneDescriptor;


Adding better support when the VBA is from a non-english version of office

--- fileid/oless/vbahelper.hpp
+++ fileid/oless/vbahelper.hpp
@@ -8,6 +8,8 @@
 #include <sstream>
 #include <algorithm>
 #include <iterator>
+#include <locale>
+#include <codecvt>
 #include "pole.h"
 #include "../common.hpp"
 #include "OleCommon.hpp"
@@ -115,6 +117,8 @@
 		struct ProjectModule {
 			std::string Name;
 			std::string StreamName;
+			std::string StreamNamePole;
+			std::wstring StreamNameW;
 			unsigned int Offset;
 			std::string Code;
 			bool isPrivate;
@@ -318,7 +322,7 @@
 			}

 			static std::pair<unsigned int, std::string> ReadString(unsigned char* buffer, unsigned int bufferLen, unsigned int startIndex) {
-
+
 				if (startIndex + 4 > bufferLen)
 					throw std::runtime_error("Attempted to read past end of buffer");
 				unsigned int len = common::helper::GetItem4Byte(buffer, startIndex);
@@ -328,11 +332,40 @@
 				return std::make_pair(startIndex + len + 4, str);
 			}

-
-			static std::pair<unsigned int, std::wstring> ReadStringW(unsigned char* buffer, unsigned int startIndex) {
+			static std::wstring s2ws(const std::string& str)
+			{
+				typedef std::codecvt_utf8<wchar_t> convert_typeX;
+				std::wstring_convert<convert_typeX, wchar_t> converterX;
+
+				return converterX.from_bytes(str);
+			}
+
+			static std::string ws2s(const std::wstring& wstr)
+			{
+				typedef std::codecvt_utf8<wchar_t> convert_typeX;
+				std::wstring_convert<convert_typeX, wchar_t> converterX;
+
+				return converterX.to_bytes(wstr);
+			}
+
+			static std::tuple<unsigned int, std::string, std::wstring> ReadStringW(unsigned char* buffer, unsigned int bufferLen, unsigned int startIndex) {
+
+				if (startIndex + 4 > bufferLen)
+					throw std::runtime_error("Attempted to read past end of buffer");
 				unsigned int len = common::helper::GetItem4Byte(buffer, startIndex);
-				std::wstring  str = common::helper::GetItemStringW(buffer, startIndex + 4, len);
-				return std::make_pair(startIndex + len + 4, str);
+				if (startIndex + 4 + len > bufferLen)
+					throw std::runtime_error("Attempted to read past end of buffer");
+
+				std::string str;
+				for (unsigned int i = startIndex + 4; i < (startIndex + 4 + len); i+=2) {
+					str.append(1, buffer[i]);
+				}
+				wchar_t* wc = reinterpret_cast<wchar_t*>(&buffer[startIndex + 4]);
+				std::wstring ws(wc, static_cast<size_t>(len / sizeof(wchar_t)));
+
+				return std::make_tuple(startIndex + len + 4, str, ws);
+			/*	std::string str = ws2s(ws);
+				return std::make_pair(startIndex + len + 4, str);*/
 			}

 			static std::string GetCode(POLE::Storage* storage, std::string fullname, unsigned int offset) {
@@ -444,7 +477,9 @@
 							std::tie(index, tmpStr) = ReadString(buffer, len, index);
 							mod->StreamName = tmpStr;
 							index += 2;
-							std::tie(index, tmpStr) = ReadString(buffer, len, index);
+							std::tie(index, tmpStr, tmpwStr) = ReadStringW(buffer, len, index);
+							mod->StreamNamePole = tmpStr;
+							mod->StreamNameW = tmpwStr;
 							break;
 						case 0x1C: //ModuleDocString
 							std::tie(index, tmpStr) = ReadString(buffer, len, index);
@@ -478,10 +513,10 @@
 					}
 					index += 4;
 					if (!(mod->StreamName.empty())) {
-						std::string newStreamName = fullname + "/VBA/" + (std::string)(mod->StreamName);
+						std::string newStreamName = fullname + "/VBA/" + (std::string)(mod->StreamNamePole);
 						mod->Code = GetCode(vbaStorage, newStreamName, (unsigned int)(mod->Offset));
 						ans->Modules.push_back(mod);
-					}
+					}
 				}
 				return ans;
 			}


* only establish outgoing S2S if we are listening for S2S * when a client disconnects, fake the reception of an unavailable QXmppPresence instead of dispatching it manually

--- src/QXmppServer.cpp
+++ src/QXmppServer.cpp
@@ -411,7 +411,7 @@

         // if we did not find an outgoing server,
         // we need to establish the S2S connection
-        if (found.isEmpty())
+        if (found.isEmpty() && d->serverForServers->isListening())
             found << connectToDomain(toDomain);
     }
     return found;
@@ -701,17 +701,15 @@
     QXmppIncomingClient *stream = qobject_cast<QXmppIncomingClient *>(sender());
     if (stream && d->incomingClients.contains(stream))
     {
-        // notify subscribed peers of disconnection
+        // synthesis a received unavailable presence
         if (!stream->jid().isEmpty())
         {
-            foreach (QString subscriber, subscribers(stream->jid()))
-            {
-                QXmppPresence presence;
-                presence.setFrom(stream->jid());
-                presence.setTo(subscriber);
-                presence.setType(QXmppPresence::Unavailable);
-                sendPacket(presence);
-            }
+            QDomElement presence;
+            presence.setTagName("presence");
+            presence.setAttribute("from", stream->jid());
+            presence.setAttribute("to", d->domain);
+            presence.setAttribute("type", "unavailable");
+            handleStanza(stream, presence);
         }

         // remove stream


Main: SceneManager - fireRenderSingleObject *after* updating light lists

--- OgreMain/src/OgreSceneManager.cpp
+++ OgreMain/src/OgreSceneManager.cpp
@@ -2017,6 +2017,8 @@
     if (pLightListToUse && (pass->isProgrammable() || pass->getLightingEnabled()))
         useLights(*pLightListToUse, pass->getMaxSimultaneousLights(), fixedFunction);

+    fireRenderSingleObject(rend, pass, mAutoParamDataSource.get(), pLightListToUse, false);
+
     // optional light scissoring & clipping
     ClipResult scissored = CLIPPED_NONE;
     ClipResult clipped = CLIPPED_NONE;
@@ -2152,7 +2154,6 @@
             (manualLightList && (manualLightList->size() != 1 ||
                                  manualLightList->front()->getType() == pass->getOnlyLightType())))
         {
-            fireRenderSingleObject(rend, pass, mAutoParamDataSource.get(), manualLightList, false);
             issueRenderWithLights(rend, pass, manualLightList, passLightParams, lightScissoringClipping);
         }

@@ -2299,7 +2300,6 @@
             lightsLeft = 0;
         }

-        fireRenderSingleObject(rend, pass, mAutoParamDataSource.get(), pLightListToUse, false);
         // issue the render op

         // We might need to update the depth bias each iteration


Do not hide the popup |frame_| when a mouse is pressed.

In the following scenario, it seems that the popup window does not release mouse/keyboard grab even after it gets hidden.

1. create a popup window by:

views::Widget::CreatePopupWidget(
      views::Widget::NotTransparent,
      views::Widget::AcceptEvents,
      views::Widget::DeleteOnDestroy,
      views::Widget::MirrorOriginInRTL)

2. press a mouse button on the window.
3. before releasing the mouse button, Hide() the window.
4. release the button.

We have to submit this change before submitting http://codereview.chromium.org/6259019/ because if we embed IME candidate window into Chrome, the window sometimes gets hidden before mouse button is released for unknown reasons (I'll file a separate bug for the issue.)

BUG=chromium-os:11191
TEST=manually checked that Chrome can receive keyboard/mouse events after clicking IME candidate window. Did the test both on Omnibox and web content area.

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

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

--- chrome/browser/chromeos/input_method/candidate_window.cc
+++ chrome/browser/chromeos/input_method/candidate_window.cc
@@ -347,6 +347,9 @@
   // Commits the candidate currently being selected.
   void CommitCandidate();

+  // Hides the lookup table.
+  void HideLookupTable();
+
   // Hides the auxiliary text.
   void HideAuxiliaryText();

@@ -402,6 +405,13 @@
   //
   // Returns 0 if no candidate is present.
   int GetHorizontalOffset();
+
+  // A function to be called when one of the |candidate_views_| receives a mouse
+  // press event.
+  void OnMousePressed();
+  // A function to be called when one of the |candidate_views_| receives a mouse
+  // release event.
+  void OnMouseReleased();

   void set_cursor_location(const gfx::Rect& cursor_location) {
     cursor_location_ = cursor_location;
@@ -475,6 +485,9 @@

   // The last cursor location.
   gfx::Rect cursor_location_;
+
+  // true if a mouse button is pressed, and is not yet released.
+  bool mouse_is_pressed_;
 };

 // CandidateRow renderes a row of a candidate.
@@ -704,6 +717,7 @@
 }

 bool CandidateView::OnMousePressed(const views::MouseEvent& event) {
+  parent_candidate_window_->OnMousePressed();
   // Select the candidate. We'll commit the candidate when the mouse
   // button is released.
   parent_candidate_window_->SelectCandidateAt(index_in_page_);
@@ -727,6 +741,7 @@
   if (!canceled) {
     parent_candidate_window_->CommitCandidate();
   }
+  parent_candidate_window_->OnMouseReleased();
 }

 CandidateWindowView::CandidateWindowView(
@@ -740,8 +755,8 @@
       footer_label_(NULL),
       previous_shortcut_column_width_(0),
       previous_candidate_column_width_(0),
-      previous_annotation_column_width_(0) {
-
+      previous_annotation_column_width_(0),
+      mouse_is_pressed_(false) {
   SetNotifyWhenVisibleBoundsInRootChanges(true);
 }

@@ -776,6 +791,57 @@
   // Add the footer area.
   layout->StartRow(0, 0);
   layout->AddView(footer_area_);  // |footer_area_| is owned by |this|.
+}
+
+void CandidateWindowView::HideLookupTable() {
+  if (!mouse_is_pressed_) {
+    parent_frame_->Hide();
+    return;
+  }
+
+  // We should not hide the |frame_| when a mouse is pressed, so we don't run
+  // into issues below.
+  //
+  // First, in the following scenario, it seems that the Views popup window does
+  // not release mouse/keyboard grab even after it gets hidden.
+  //
+  // 1. create a popup window by views::Widget::CreatePopupWidget() with the
+  //    views::Widget::AcceptEvents flag.
+  // 2. press a mouse button on the window.
+  // 3. before releasing the mouse button, Hide() the window.
+  // 4. release the button.
+  //
+  // And if we embed IME candidate window into Chrome, the window sometimes
+  // receives an extra 'hide-lookup-table' event before mouse button is
+  // released:
+  //
+  // 1. the candidate window is clicked.
+  // 2. The mouse click handler in this file, OnMousePressed() in CandidateView,
+  //    is called, and the handler consumes the event by returning true.
+  // 3. HOWEVER, if the candidate window is embedded into Chrome, the event is
+  //    also sent to Chrome! (problem #1)
+  // 4. im-ibus.so in Chrome sends 'focus-out' event to ibus-daemon.
+  // 5. ibus-daemon sends 'hide-lookup-table' event to the candidate window.
+  // 6. the window is hidden, but the window does not release mouse/keyboard
+  //    grab! (problem #2)
+  // 7. mouse button is released.
+  // 8. now all mouse/keyboard events are consumed by the hidden popup, and are
+  //    not sent to Chrome.
+  //
+  // TODO(yusukes): investigate why the click event is sent to both candidate
+  // window and Chrome. http://crosbug.com/11423
+  // TODO(yusukes): investigate if we could fix Views so it always releases grab
+  // when a popup window gets hidden. http://crosbug.com/11422
+  //
+  LOG(WARNING) << "Can't hide the table since a mouse button is not released.";
+}
+
+void CandidateWindowView::OnMousePressed() {
+  mouse_is_pressed_ = true;
+}
+
+void CandidateWindowView::OnMouseReleased() {
+  mouse_is_pressed_ = false;
 }

 void CandidateWindowView::HideAuxiliaryText() {
@@ -1267,7 +1333,7 @@
   CandidateWindowController::Impl* controller =
       static_cast<CandidateWindowController::Impl*>(input_method_library);

-  controller->frame_->Hide();
+  controller->candidate_window_->HideLookupTable();
 }

 void CandidateWindowController::Impl::OnSetCursorLocation(
@@ -1321,7 +1387,7 @@

   // If it's not visible, hide the window and return.
   if (!lookup_table.visible) {
-    controller->frame_->Hide();
+    controller->candidate_window_->HideLookupTable();
     return;
   }


Move the candidate window to right position, if size or visibility of candidate window is changed

BUG=chromium-os:9950
TEST=manual

Review URL: http://codereview.chromium.org/5582004
Patch from Peng Huang <penghuang@chromium.org>.

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

--- chrome/browser/chromeos/input_method/candidate_window.cc
+++ chrome/browser/chromeos/input_method/candidate_window.cc
@@ -403,10 +403,18 @@
   // Returns 0 if no candidate is present.
   int GetHorizontalOffset();

-  const gfx::Rect& cursor_location() const { return cursor_location_; }
   void set_cursor_location(const gfx::Rect& cursor_location) {
     cursor_location_ = cursor_location;
   }
+
+  const gfx::Rect& cursor_location() const { return cursor_location_; }
+
+ protected:
+  // Override View::VisibilityChanged()
+  virtual void VisibilityChanged(View* starting_from, bool is_visible);
+
+  // Override View::VisibleBoundsInRootChanged()
+  virtual void VisibleBoundsInRootChanged();

  private:
   // Initializes the candidate views if needed.
@@ -733,6 +741,8 @@
       previous_shortcut_column_width_(0),
       previous_candidate_column_width_(0),
       previous_annotation_column_width_(0) {
+
+  SetNotifyWhenVisibleBoundsInRootChanges(true);
 }

 void CandidateWindowView::Init() {
@@ -789,9 +799,12 @@
       lookup_table_.orientation == InputMethodLookupTable::kHorizontal ?
       header_area_contents_.get() :
       footer_area_contents_.get());
-  // Put contents to the target display area.
-  target_area->RemoveAllChildViews(false);  // Don't delete child views.
-  target_area->AddChildView(target_contents);
+
+  if (!target_area->HasChildView(target_contents)) {
+    // If contents not in display area, put it in.
+    target_area->RemoveAllChildViews(false);  // Don't delete child views.
+    target_area->AddChildView(target_contents);
+  }
 }

 void CandidateWindowView::UpdateAuxiliaryText(const std::string& utf8_text) {
@@ -1164,6 +1177,20 @@
   return 0;
 }

+void CandidateWindowView::VisibilityChanged(View* starting_from,
+                                            bool is_visible) {
+  if (is_visible) {
+    // If the visibility of candidate window is changed,
+    // we should move the frame to the right position.
+    MoveParentFrame();
+  }
+}
+
+void CandidateWindowView::VisibleBoundsInRootChanged() {
+  // If the bounds(size) of candidate window is changed,
+  // we should move the frame to the right position.
+  MoveParentFrame();
+}

 bool CandidateWindowController::Impl::Init() {
   // Initialize the input method UI status connection.
@@ -1232,7 +1259,7 @@
       static_cast<CandidateWindowController::Impl*>(input_method_library);

   controller->candidate_window_->HideAuxiliaryText();
-  controller->candidate_window_->ResizeAndMoveParentFrame();
+  controller->candidate_window_->ResizeParentFrame();
 }

 void CandidateWindowController::Impl::OnHideLookupTable(
@@ -1283,7 +1310,7 @@
   }
   controller->candidate_window_->UpdateAuxiliaryText(utf8_text);
   controller->candidate_window_->ShowAuxiliaryText();
-  controller->candidate_window_->ResizeAndMoveParentFrame();
+  controller->candidate_window_->ResizeParentFrame();
 }

 void CandidateWindowController::Impl::OnUpdateLookupTable(
@@ -1299,11 +1326,8 @@
   }

   controller->candidate_window_->UpdateCandidates(lookup_table);
+  controller->candidate_window_->ResizeParentFrame();
   controller->frame_->Show();
-  // We should move the candidate window after controller->frame_->Show(),
-  // as GetHorizontalOffset() returns a valid value only after the Show()
-  // method is called.
-  controller->candidate_window_->ResizeAndMoveParentFrame();
 }

 void CandidateWindowController::Impl::OnCandidateCommitted(int index,


[OGRE-99]: isLateMaterialResolving fallback to the first pass if the pass index is greater than the lateTech pass count

--- OgreMain/src/OgreSceneManager.cpp
+++ OgreMain/src/OgreSceneManager.cpp
@@ -933,7 +933,11 @@
 		if (lateTech->getNumPasses() > pass->getIndex())
 		{
 			pass = lateTech->getPass(pass->getIndex());
-		}
+		}
+		else
+        {
+            pass = lateTech->getPass(0);
+        }
 		//Should we warn or throw an exception if an illegal state was achieved?
 	}


Disable DiagnosticsModelTest.RunAll.

Disable DiagnosticsModelTest.RunAll.

It's crashing the builder but we don't know why. However, we don't want to be
blinded by it in the mean time.

TBR=jar

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

--- chrome/browser/diagnostics/diagnostics_model_unittest.cc
+++ chrome/browser/diagnostics/diagnostics_model_unittest.cc
@@ -95,7 +95,8 @@

 // Run all the tests, verify that the basic callbacks are run and that the
 // final state is correct.
-TEST_F(DiagnosticsModelTest, RunAll) {
+// DISABLED by agl because it's crashing the builder.
+TEST_F(DiagnosticsModelTest, DISABLED_RunAll) {
   UTObserver observer;
   EXPECT_FALSE(observer.done());
   model_->RunAll(&observer);


Fix line widths.

Fix line widths.

--- src/mlpack/core/util/sfinae_utility.hpp
+++ src/mlpack/core/util/sfinae_utility.hpp
@@ -19,10 +19,10 @@
  * This macro generates a template struct that is useful for enabling/disabling
  * a method if the template class passed in contains a member function matching
  * a given signature with a specified name.
- *
+ *
  * The generated struct should be used in conjunction with boost::disable_if and
  * boost::enable_if. Here is an example usage:
- *
+ *
  * For general references, see:
  * http://stackoverflow.com/a/264088/391618
  *
@@ -32,15 +32,15 @@
  * @param NAME the name of the struct to construct. For example: HasToString
  * @param FUNC the name of the function to check for. For example: ToString
  */
-#define HAS_MEM_FUNC(FUNC, NAME)                                                \
-template<typename T, typename sig>                                              \
-struct NAME {                                                                   \
-  typedef char yes[1];                                                          \
-  typedef char no [2];                                                          \
-  template<typename U, U> struct type_check;                                    \
-  template<typename _1> static yes &chk(type_check<sig, &_1::FUNC> *);          \
-  template<typename   > static no  &chk(...);                                   \
-  static bool const value = sizeof(chk<T>(0)) == sizeof(yes);                   \
+#define HAS_MEM_FUNC(FUNC, NAME)                                               \
+template<typename T, typename sig>                                             \
+struct NAME {                                                                  \
+  typedef char yes[1];                                                         \
+  typedef char no [2];                                                         \
+  template<typename U, U> struct type_check;                                   \
+  template<typename _1> static yes &chk(type_check<sig, &_1::FUNC> *);         \
+  template<typename   > static no  &chk(...);                                  \
+  static bool const value = sizeof(chk<T>(0)) == sizeof(yes);                  \
 };

 #endif


included missing cassert header in actions.hpp

--- flexcore/range/actions.hpp
+++ flexcore/range/actions.hpp
@@ -3,6 +3,7 @@

 #include <numeric>
 #include <algorithm>
+#include <cassert>

 namespace fc
 {


fixed error in homography formula

fixed error in homography formula

--- kinect2_viewer/src/viewer.cpp
+++ kinect2_viewer/src/viewer.cpp
@@ -384,10 +384,7 @@
         circle( detframe, eye_center, 3.5, Scalar(255,255,255), CV_FILLED, 8, 0);

         int eye_x = eye_center.x;
-        int eye_y = eye_center.y;
-
-      /*  cout << "(eyex, eyey): " << " (" << eye_x <<
-            " , "  << eye_y << ")" << endl;  */
+        int eye_y = eye_center.y;

         char textx[255], texty[255];
         sprintf(textx, "eye center, x (mm): %d", eye_x);
@@ -403,11 +400,12 @@
   cv::Mat distortion      = cv::Mat::zeros(5, 1, CV_64F);
   cv::Mat rotation        = cv::Mat::eye(3, 3, CV_64F);
   cv::Mat translation     = cv::Mat::zeros(3, 1, CV_64F);
-  cv::Mat projection      = cv::Mat::zeros(3, 4, CV_64F);
-  cv::Mat homography      = cv::Mat::zeros(3, 3, CV_64F);
-  cv::Mat KM              = cv::Mat::zeros(3, 4, CV_64F);
-  cv::Mat pixelpts    = cv::Mat::ones(3,1, CV_64F); //x=y=1
-  cv::Mat worldcoordinates = cv::Mat::ones(3,1, CV_64F);
+  cv::Mat projection      = cv::Mat::zeros(3, 4, CV_64F);     //[r1, r2, r3, t]
+  cv::Mat homocat         = cv::Mat::zeros(3, 3, CV_64F);     //[r1 , r2, t]
+  cv::Mat homographyraw   = cv::Mat::zeros(3, 3, CV_64F);     //K * [r1, r2, t]
+  cv::Mat homography      = cv::Mat::zeros(3, 3, CV_64F);     //K * [r1, r2, t]/t
+  cv::Mat pixelpts        = cv::Mat::ones(3,1, CV_64F);
+  cv::Mat reconstructed   = cv::Mat::ones(3,1, CV_64F);
   double s;
   int xprime, yprime;

@@ -446,17 +444,21 @@
     translation.at<double >(1, 0) = 9.878938204711128e-05;
     translation.at<double >(2, 0) = 0.005470134429191416;

-    homography.at<double >(0, 0) = rotation.at<double >(0, 0);
-    homography.at<double >(0, 1) = rotation.at<double >(0, 1);
-    homography.at<double >(0, 2) = translation.at<double >(0, 0);
-    homography.at<double >(1, 0) = rotation.at<double >(1, 0);
-    homography.at<double >(1, 1) = rotation.at<double >(1, 1);
-    homography.at<double >(1, 2) = translation.at<double >(1, 0);
-    homography.at<double >(2, 0) = rotation.at<double >(2, 0);
-    homography.at<double >(2, 1) = rotation.at<double >(2, 1);
-    homography.at<double >(2, 2) = translation.at<double >(2, 0);
-
-    const float r       = pow( (eye_x - cx), 2) + pow( (eye_y -cy), 2) ;   // radial distance from center
+    //8.1, p.196, Zisserman and Hartley
+    homocat.at<double >(0, 0) = rotation.at<double >(0, 0);
+    homocat.at<double >(0, 1) = rotation.at<double >(0, 1);
+    homocat.at<double >(0, 2) = translation.at<double >(0, 0);
+    homocat.at<double >(1, 0) = rotation.at<double >(1, 0);
+    homocat.at<double >(1, 1) = rotation.at<double >(1, 1);
+    homocat.at<double >(1, 2) = translation.at<double >(1, 0);
+    homocat.at<double >(2, 0) = rotation.at<double >(2, 0);
+    homocat.at<double >(2, 1) = rotation.at<double >(2, 1);
+    homocat.at<double >(2, 2) = translation.at<double >(2, 0);
+
+    homographyraw             = cameraMatrixColor * homocat;
+    homography                = homographyraw / translation.at<double>(2, 0);
+
+    const float r       = pow( (eye_x - cx), 2) + pow( (eye_y -cy), 2) ;            // radial distance from center
     const float inner   = 1               + (k1 * r)           + (k2 * pow(r,2))  + (k3 * pow(r, 3));
     const float xprime  = (eye_x * inner) + (2 * p1 * eye_x * eye_y) + p2 * (r + 2 * pow(eye_x, 2) );   //xprime is my x''
     const float yprime  = (eye_y * inner) + (2 * p2 * eye_x * eye_y) + p1 * (r + 2 * pow(eye_y, 2) );   //yprime is my y''
@@ -471,16 +473,14 @@
     //These are the values after accounting for radial distortion and tangential distortion
     pixelpts.at<int>(0,0) = u;
     pixelpts.at<int>(1,0) = v;
+    cout << "pixelpts: " << pixelpts << endl;

     //project ::http://stackoverflow.com/questions/7836134/get-3d-coord-from-2d-image-pixel-if-we-know-extrinsic-and-intrinsic-parameters/10750648#10750648
-    pixelpts = homography * pixelpts;
-
-    //normalize
-    //pixelpts /=
-
-    cout <<"world coordinates = " << pixelpts << endl;
-  }
-
+    reconstructed = homography * pixelpts;
+
+    cout <<"world coordinates = " << reconstructed << endl;
+  }
+
   void cloudViewer()
   {
     cv::Mat color, depth;


Disable PluginLoadUnload while I look into the failure.

BUG=40588

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

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

--- chrome/browser/extensions/extension_browsertests_misc.cc
+++ chrome/browser/extensions/extension_browsertests_misc.cc
@@ -677,7 +677,8 @@
 // TODO(mpcomplete): http://crbug.com/29900 need cross platform plugin support.
 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload
 #else
-#define MAYBE_PluginLoadUnload PluginLoadUnload
+// TODO(mpcomplete): http://crbug.com/40588 reenable after fixing.
+#define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload
 #endif

 // Tests that a renderer's plugin list is properly updated when we load and


Add test case for empty cubes.

Add test case for empty cubes.

--- src/mlpack/tests/serialization_test.cpp
+++ src/mlpack/tests/serialization_test.cpp
@@ -50,12 +50,25 @@

 BOOST_AUTO_TEST_SUITE(SerializationTest);

+/**
+ * Serialize a random cube.
+ */
 BOOST_AUTO_TEST_CASE(CubeSerializeXMLTest)
 {
   arma::cube m;
   m.randu(2, 50, 50);
   TestAllArmadilloSerialization(m);
 }
+
+/**
+ * Serialize an empty cube.
+ */
+BOOST_AUTO_TEST_CASE(EmptyCubeSerializeTest)
+{
+  arma::cube c;
+  TestAllArmadilloSerialization(c);
+}
+

 /**
  * Can we load and save an Armadillo matrix?


I just found a core file in my ~ saying len == 0

svn path=/branches/KDE/3.5/kdepim/; revision=534960

--- kioslaves/imap4/imapparser.cc
+++ kioslaves/imap4/imapparser.cc
@@ -729,7 +729,7 @@
   lastStatus = imapInfo ();

   parseLiteralC(inWords);       // swallow the box
-  if (inWords[0] != '(')
+  if (inWords.isEmpty() || inWords[0] != '(')
     return;

   inWords.pos++;


Fix possible deadlock on exit where the ROSOut appender would lock up joining its publish thread

--- core/roscpp/src/libros/rosout_appender.cpp
+++ core/roscpp/src/libros/rosout_appender.cpp
@@ -58,7 +58,11 @@
 ROSOutAppender::~ROSOutAppender()
 {
   shutting_down_ = true;
-  queue_condition_.notify_all();
+
+  {
+    boost::mutex::scoped_lock lock(queue_mutex_);
+    queue_condition_.notify_all();
+  }

   publish_thread_.join();
 }
@@ -119,6 +123,11 @@
     {
       boost::mutex::scoped_lock lock(queue_mutex_);

+      if (shutting_down_)
+      {
+        return;
+      }
+
       queue_condition_.wait(lock);

       if (shutting_down_)


Mission transfer: Fix retry logic

Mission transfer: Fix retry logic

Previously the retry would not actually have been sent if nothing had been received in time.

--- src/modules/mavlink/mavlink_mission.cpp
+++ src/modules/mavlink/mavlink_mission.cpp
@@ -388,24 +388,13 @@
 	}

 	/* check for timed-out operations */
-	if (_state != MAVLINK_WPM_STATE_IDLE && hrt_elapsed_time(&_time_last_recv) > _action_timeout) {
-		_mavlink->send_statustext_critical("Operation timeout");
-
-		if (_verbose) { warnx("WPM: Last operation (state=%u) timed out, changing state to MAVLINK_WPM_STATE_IDLE", _state); }
-
-		_state = MAVLINK_WPM_STATE_IDLE;
-
-		// since we are giving up, reset this state also, so another request can be started.
-		_transfer_in_progress = false;
-
-	} else if (_state == MAVLINK_WPM_STATE_GETLIST && hrt_elapsed_time(&_time_last_sent) > _retry_timeout) {
-		/* try to request item again after timeout,
-		 * toggle int32 or float protocol variant to try both */
-		_int_mode = !_int_mode;
-
+	if (_state == MAVLINK_WPM_STATE_GETLIST && (_time_last_sent > 0)
+	    && hrt_elapsed_time(&_time_last_sent) > _retry_timeout) {
+		// try to request item again after timeout
 		send_mission_request(_transfer_partner_sysid, _transfer_partner_compid, _transfer_seq);

-	} else if (_state == MAVLINK_WPM_STATE_SENDLIST && hrt_elapsed_time(&_time_last_sent) > _retry_timeout) {
+	} else if (_state == MAVLINK_WPM_STATE_SENDLIST && (_time_last_sent > 0)
+		   && hrt_elapsed_time(&_time_last_sent) > _retry_timeout) {
 		if (_transfer_seq == 0) {
 			/* try to send items count again after timeout */
 			send_mission_count(_transfer_partner_sysid, _transfer_partner_compid, _transfer_count);
@@ -414,6 +403,22 @@
 			/* try to send item again after timeout */
 			send_mission_item(_transfer_partner_sysid, _transfer_partner_compid, _transfer_seq - 1);
 		}
+
+	} else if (_state != MAVLINK_WPM_STATE_IDLE && (_time_last_recv > 0)
+		   && hrt_elapsed_time(&_time_last_recv) > _action_timeout) {
+		_mavlink->send_statustext_critical("Operation timeout");
+
+		if (_verbose) { warnx("WPM: Last operation (state=%u) timed out, changing state to MAVLINK_WPM_STATE_IDLE", _state); }
+
+		_state = MAVLINK_WPM_STATE_IDLE;
+
+		// since we are giving up, reset this state also, so another request can be started.
+		_transfer_in_progress = false;
+
+	} else if (_state == MAVLINK_WPM_STATE_IDLE) {
+		// reset flags
+		_time_last_sent = 0;
+		_time_last_recv = 0;
 	}
 }

@@ -716,7 +721,10 @@
 				/* looks like our MISSION_REQUEST was lost, try again */
 				if (_verbose) { warnx("WPM: MISSION_COUNT %u from ID %u (again)", wpc.count, msg->sysid); }

-				_mavlink->send_statustext_info("WP CMD OK TRY AGAIN");
+				// If the counterpart tries this, its an indication int mode might not be supported
+				if (_int_mode) {
+					_int_mode = false;
+				}

 			} else {
 				if (_verbose) { warnx("WPM: MISSION_COUNT ERROR: busy, already receiving seq %u", _transfer_seq); }
@@ -887,7 +895,15 @@
 		struct mission_item_s *mission_item)
 {
 	if (mavlink_mission_item->frame == MAV_FRAME_GLOBAL ||
-	    mavlink_mission_item->frame == MAV_FRAME_GLOBAL_RELATIVE_ALT) {
+	    mavlink_mission_item->frame == MAV_FRAME_GLOBAL_RELATIVE_ALT ||
+	    (_int_mode && (mavlink_mission_item->frame == MAV_FRAME_GLOBAL_INT ||
+			   mavlink_mission_item->frame == MAV_FRAME_GLOBAL_RELATIVE_ALT_INT))) {
+
+		// Switch to int mode if that is what we are receiving
+		if ((mavlink_mission_item->frame == MAV_FRAME_GLOBAL_INT ||
+		     mavlink_mission_item->frame == MAV_FRAME_GLOBAL_RELATIVE_ALT_INT)) {
+			_int_mode = true;
+		}

 		if (_int_mode) {
 			/* The argument is actually a mavlink_mission_item_int_t in int_mode.
@@ -967,6 +983,11 @@

 		default:
 			mission_item->nav_cmd = NAV_CMD_INVALID;
+
+			if (_verbose) {
+				PX4_ERR("Unsupported command %d", mavlink_mission_item->command);
+			}
+
 			return MAV_MISSION_UNSUPPORTED;
 		}

@@ -1011,12 +1032,21 @@

 		default:
 			mission_item->nav_cmd = NAV_CMD_INVALID;
+
+			if (_verbose) {
+				PX4_ERR("Unsupported command %d", mavlink_mission_item->command);
+			}
+
 			return MAV_MISSION_UNSUPPORTED;
 		}

 		mission_item->frame = MAV_FRAME_MISSION;

 	} else {
+		if (_verbose) {
+			PX4_ERR("Unsupported frame %d", mavlink_mission_item->frame);
+		}
+
 		return MAV_MISSION_UNSUPPORTED_FRAME;
 	}


fix in LiveFunctionsDataView: use GVisibleFunctionsMap instead of GSelectedFunctionsMap

--- OrbitGl/LiveFunctionsDataView.cpp
+++ OrbitGl/LiveFunctionsDataView.cpp
@@ -302,16 +302,16 @@

 //-----------------------------------------------------------------------------
 void LiveFunctionsDataView::OnDataChanged() {
-  size_t numFunctions = Capture::GFunctionCountMap.size();
+  size_t numFunctions = Capture::GVisibleFunctionsMap.size();
   m_Indices.resize(numFunctions);
   for (size_t i = 0; i < numFunctions; ++i) {
     m_Indices[i] = i;
   }

   m_Functions.clear();
-  for (auto& pair : Capture::GFunctionCountMap) {
+  for (auto& pair : Capture::GVisibleFunctionsMap) {
     const ULONG64& address = pair.first;
-    FunctionInfo* func = Capture::GSelectedFunctionsMap[address];
+    FunctionInfo* func = Capture::GVisibleFunctionsMap[address];
     m_Functions.push_back(func);
   }


Transform to NOP instead of removing

Transform to NOP instead of removing

--- src/mtac/loop_invariant_code_motion.cpp
+++ src/mtac/loop_invariant_code_motion.cpp
@@ -104,11 +104,7 @@
     auto usage = compute_write_usage(loop);

     for(auto& bb : loop){
-        auto it = iterate(bb->statements);
-
-        while(it.has_next()){
-            auto& statement = *it;
-
+        for(auto& statement : bb->statements){
             if(is_invariant(statement, usage)){
                 if(is_valid_invariant(bb, statement, loop)){
                     //Create the preheader if necessary
@@ -119,15 +115,11 @@
                     function.context->global()->stats().inc_counter("invariant_moved");

                     pre_header->statements.push_back(std::move(statement));
-                    it.erase();
+                    mtac::transform_to_nop(statement);

                     optimized = true;
-
-                    continue;
                 }
             }
-
-            ++it;
         }
     }


cc: Remove static from leaf invalidation perf test

Make DidCommitAndDraw always change the value of the layer's opacity to
force commits and draws rather than depending on a static bool.

LayerTreeHostPerfTestLeafInvalidates had a static bool for whether to
flip a layer to 1.0 or 0.5 opacity.  The leaf layer happens to start at
opacity 1.0.  So, on the first run, the tree would draw once,
DidCommitAndDraw would get called, and opacity would be set to the same
value.  This would cause no damage, so the tree would never draw again.
Because it would never draw again, DidCommitAndDraw wouldn't get called
again, and the opacity would never change again.  The tree kept
committing (because of the test harness) but would never draw again.

The second test would do the same thing, draw once, and then encounter
this static boolean (now false).  It would flip the opacity to zero (an
actual change), and would then keep alternating back and forth because
each draw would succeed.

Therefore, any test that was fast would always be followed by a slow
test, and any slow test would have a 50% chance of being followed by a
fast or a slow test.

This was exposed by r291451 because it made perf tests use the
scheduler (and would then early out of drawing for single-threaded).
The threaded version always had this bug.

*** Note: unsurprisingly, this will "regress" the performance of
LayerTreeHostPerfTestLeafInvalidates.TenTenSingleThread because it's
now doing something real.

R=danakj@chromium.org
BUG=407117

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

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

--- cc/trees/layer_tree_host_perftest.cc
+++ cc/trees/layer_tree_host_perftest.cc
@@ -193,9 +193,8 @@
     if (TestEnded())
       return;

-    static bool flip = true;
-    layer_to_invalidate_->SetOpacity(flip ? 1.f : 0.5f);
-    flip = !flip;
+    layer_to_invalidate_->SetOpacity(
+        layer_to_invalidate_->opacity() != 1.f ? 1.f : 0.5f);
   }

  protected:


Fixed LastTarget macro.

Fixed LastTarget macro.

--- OrionUO/Managers/MacroManager.cpp
+++ OrionUO/Managers/MacroManager.cpp
@@ -968,7 +968,10 @@

 			if (g_Target.IsTargeting())
 			{
-				g_Target.SendLastTarget();
+				if (g_Target.Type)
+					g_Target.SendLastTarget();
+				else
+					g_Target.SendTargetObject(g_LastTargetObject);

 				m_WaitForTargetTimer = 0;
 			}


Backport:
Fallback to home if documentPath doesn't exist on current account

svn path=/branches/KDE/4.4/kdepim/; revision=1137053

--- kmail/archivefolderdialog.cpp
+++ kmail/archivefolderdialog.cpp
@@ -38,7 +38,11 @@

 static QString standardArchivePath( const QString &folderName )
 {
-  return KGlobalSettings::documentPath() + '/' +
+  QString currentPath = KGlobalSettings::documentPath();
+  QDir dir( currentPath );
+  if( !dir.exists() )
+    currentPath = QDir::homePath();
+  return currentPath + '/' +
     i18nc( "Start of the filename for a mail archive file" , "Archive" ) + '_' + folderName + '_' + QDate::currentDate().toString( Qt::ISODate ) + ".zip";
 }


cc: Add debugging information to failures of LayerTreeHostTestAtomicCommitWithPartialUpdate

TBR=enne
BUG=240757

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

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

--- cc/trees/layer_tree_host_unittest.cc
+++ cc/trees/layer_tree_host_unittest.cc
@@ -1304,10 +1304,12 @@

     // Number of textures used for drawing should one per layer except for
     // frame 3 where the viewport only contains one layer.
-    if (impl->active_tree()->source_frame_number() == 3)
+    if (impl->active_tree()->source_frame_number() == 3) {
       EXPECT_EQ(1u, context->NumUsedTextures());
-    else
-      EXPECT_EQ(4u, context->NumUsedTextures());
+    } else {
+      EXPECT_EQ(4u, context->NumUsedTextures()) <<
+          "For frame " << impl->active_tree()->source_frame_number();
+    }

     context->ResetUsedTextures();
   }


Renamed ks::make_object to ks::MakeObject

--- ks/shared/KsCallbackTimer.cpp
+++ ks/shared/KsCallbackTimer.cpp
@@ -23,7 +23,7 @@
                                  Milliseconds interval_ms,
                                  std::function<void()> callback) :
         ks::Object(key,evloop),
-        m_timer(make_object<Timer>(evloop)),
+        m_timer(MakeObject<Timer>(evloop)),
         m_active(false),
         m_interval_ms(interval_ms),
         m_repeating(true),


Overlay: BorderPanelOverlayElement - fix crash on device lost

--- Components/Overlay/src/OgreBorderPanelOverlayElement.cpp
+++ Components/Overlay/src/OgreBorderPanelOverlayElement.cpp
@@ -257,10 +257,7 @@
         if(!mInitialised)
             return;

-        VertexBufferBinding* bind = mRenderOp2.vertexData->vertexBufferBinding;
-        bind->unsetBinding(POSITION_BINDING);
-        bind->unsetBinding(TEXCOORD_BINDING);
-
+        mRenderOp2.vertexData->vertexBufferBinding->unsetAllBindings();
         mRenderOp2.indexData->indexBuffer.reset();

         PanelOverlayElement::_releaseManualHardwareResources();


AliMCSpectraWeights: added y selection for p-Pb; added mult-cent mapping for p-Pb, Pb-Pb and Xe-Xe

--- PWG/Tools/AliMCSpectraWeights.cxx
+++ PWG/Tools/AliMCSpectraWeights.cxx
@@ -1105,6 +1105,8 @@
         return;
     }

+    bool const ispPbCollision = fstCollisionSystem.find("ppb")!=std::string::npos;
+
     for (int iParticle = 0; iParticle < MCStack->GetNtrack(); ++iParticle) {
         TParticle* mcGenParticle = MCStack->Particle(iParticle);
         if (!mcGenParticle) {
@@ -1122,8 +1124,15 @@
         float partY = mcGenParticle->Y();
         float _maxY = 0.5; // hard coded max eta; in all papers 0.5

-        if (TMath::Abs(partY) > _maxY)
-            continue; // apply same acceptance as in published spectra
+        //for p-Pb this is 0 < y_cms < 0.5 with y_traf = -0.465
+        //-->
+        if(ispPbCollision){
+            if( partY < 0.465 || partY > 0.965)
+                continue;
+        } else { // symmetric collision systems
+            if (TMath::Abs(partY) > _maxY)
+                continue; // apply same acceptance as in published spectra
+        }
         int particleType =
         AliMCSpectraWeights::IdentifyMCParticle(mcGenParticle);
         if (particleType < 0)
@@ -1380,7 +1389,8 @@
  *  @return
  */
 float const AliMCSpectraWeights::GetCentFromMult(float const dMult) const {
-    if (fstCollisionSystem.find("pp") != std::string::npos) {
+    if (fstCollisionSystem.find("pp") != std::string::npos && fstCollisionSystem.find("ppb") == std::string::npos) {
+/* pp7TeV
         if (dMult > 18)
             return 0;
         if (dMult > 14.5)
@@ -1401,31 +1411,84 @@
             return 8;
         if (dMult > 0)
             return 9;
+*/
+// pp13TeV
+        if (dMult > 23.02)
+            return 0;
+        if (dMult > 18.09)
+            return 1;
+        if (dMult > 14.97)
+            return 2;
+        if (dMult > 12.91)
+            return 3;
+        if (dMult > 11.03)
+            return 4;
+        if (dMult > 8.99)
+            return 5;
+        if (dMult > 7.14)
+            return 6;
+        if (dMult > 5.41)
+            return 7;
+        if (dMult > 3.53)
+            return 8;
+        if (dMult > 0)
+            return 9;
     } else if (fstCollisionSystem.find("ppb") !=
-               std::string::npos) // TODO: include other systems
+               std::string::npos)
     {
-        //        switch (dMult) {
-        //            case 0:
-        //                return 45.0;
-        //            case 1:
-        //                return 36.2;
-        //            case 2:
-        //                return 30.5;
-        //            case 3:
-        //                return 23.2;
-        //            case 4:
-        //                return 16.1;
-        //            case 5:
-        //                return 9.8;
-        //            case 6:
-        //                return 4.4;
-        //            default:
-        //                return -2.0;
-        //        }
-
+        if (dMult > 40.6)
+            return 0;
+        if (dMult > 33.35)
+            return 1;
+        if (dMult > 26.85)
+            return 2;
+        if (dMult > 19.65)
+            return 3;
+        if (dMult > 12.9)
+            return 4;
+        if (dMult > 7.1)
+            return 5;
+        if (dMult > 0)
+            return 6;
     } else if (fstCollisionSystem.find("pbpb") != std::string::npos) {
-
+        if (dMult > 1447)
+            return 0;
+        if (dMult > 1130)
+            return 1;
+        if (dMult > 807)
+            return 2;
+        if (dMult > 537)
+            return 3;
+        if (dMult > 343)
+            return 4;
+        if (dMult > 205)
+            return 5;
+        if (dMult > 112)
+            return 6;
+        if (dMult > 55)
+            return 7;
+        if (dMult > 0)
+            return 8;
     } else if (fstCollisionSystem.find("xexe") != std::string::npos) {
+
+        if (dMult > 1053)
+            return 0;
+        if (dMult > 822)
+            return 1;
+        if (dMult > 592)
+            return 2;
+        if (dMult > 396)
+            return 3;
+        if (dMult > 256)
+            return 4;
+        if (dMult > 158)
+            return 5;
+        if (dMult > 91.2)
+            return 6;
+        if (dMult > 48.3)
+            return 7;
+        if (dMult > 0)
+            return 8;
     }

     return -1;


Postfactor: remove dead code

Postfactor: remove dead code

--- main/main.cpp
+++ main/main.cpp
@@ -52,90 +52,6 @@
 //	r = (r + 3) % 256;
 //}

-/*
- * Timer group0 ISR handler
- *
- * Note:
- * We don't call the timer API here because they are not declared with IRAM_ATTR.
- * If we're okay with the timer irq not being serviced while SPI flash cache is disabled,
- * we can allocate this interrupt without the ESP_INTR_FLAG_IRAM flag and use the normal API.
- */
-void IRAM_ATTR timer_group0_isr(void *para)
-{
-    int timer_idx = (int) para;
-
-    /* Retrieve the interrupt status and the counter value
-       from the timer that reported the interrupt */
-    uint32_t intr_status = TIMERG0.int_st_timers.val;
-    TIMERG0.hw_timer[timer_idx].update = 1;
-    uint64_t timer_counter_value =
-        ((uint64_t) TIMERG0.hw_timer[timer_idx].cnt_high) << 32
-        | TIMERG0.hw_timer[timer_idx].cnt_low;
-
-    /* Prepare basic event data
-       that will be then sent back to the main program task */
-//    timer_event_t evt;
-//    evt.timer_group = 0;
-//    evt.timer_idx = timer_idx;
-//    evt.timer_counter_value = timer_counter_value;
-
-    /* Clear the interrupt
-       and update the alarm time for the timer with without reload */
-    if ((intr_status & BIT(timer_idx)) && timer_idx == TIMER_0) {
-//        evt.type = TEST_WITHOUT_RELOAD;
-        TIMERG0.int_clr_timers.t0 = 1;
-        timer_counter_value += (uint64_t) (TIMER_INTERVAL0_SEC * TIMER_SCALE);
-        TIMERG0.hw_timer[timer_idx].alarm_high = (uint32_t) (timer_counter_value >> 32);
-        TIMERG0.hw_timer[timer_idx].alarm_low = (uint32_t) timer_counter_value;
-    } else if ((intr_status & BIT(timer_idx)) && timer_idx == TIMER_1) {
-//        evt.type = TEST_WITH_RELOAD;
-        TIMERG0.int_clr_timers.t1 = 1;
-    } else {
-//        evt.type = -1; // not supported even type
-    }
-
-    /* After the alarm has been triggered
-      we need enable it again, so it is triggered the next time */
-    TIMERG0.hw_timer[timer_idx].config.alarm_en = TIMER_ALARM_EN;
-
-    /* Now just send the event data back to the main program task */
-//    xQueueSendFromISR(timer_queue, &evt, NULL);
-    Animation *a = &animation;
-    a->drawFrame();
-}
-
-/*
- * Initialize selected timer of the timer group 0
- *
- * timer_idx - the timer number to initialize
- * auto_reload - should the timer auto reload on alarm?
- * timer_interval_sec - the interval of alarm to set
- */
-static void example_tg0_timer_init(timer_idx_t timer_idx,
-    bool auto_reload, double timer_interval_sec)
-{
-    /* Select and initialize basic parameters of the timer */
-    timer_config_t config;
-    config.divider = TIMER_DIVIDER;
-    config.counter_dir = TIMER_COUNT_UP;
-    config.counter_en = TIMER_PAUSE;
-    config.alarm_en = TIMER_ALARM_EN;
-    config.intr_type = TIMER_INTR_LEVEL;
-    config.auto_reload = auto_reload;
-    timer_init(TIMER_GROUP_0, timer_idx, &config);
-
-    /* Timer's counter will initially start from value below.
-       Also, if auto_reload is set, this value will be automatically reload on alarm */
-    timer_set_counter_value(TIMER_GROUP_0, timer_idx, 0x00000000ULL);
-
-    /* Configure the alarm value and the interrupt on alarm. */
-    timer_set_alarm_value(TIMER_GROUP_0, timer_idx, timer_interval_sec * TIMER_SCALE);
-    timer_enable_intr(TIMER_GROUP_0, timer_idx);
-    timer_isr_register(TIMER_GROUP_0, timer_idx, timer_group0_isr,
-        (void *) timer_idx, ESP_INTR_FLAG_IRAM, NULL);
-
-    timer_start(TIMER_GROUP_0, timer_idx);
-}

 void main_led_task(void *args) {


mostly completes file dialog for windows

--- src/native_window/native_window_win.cpp
+++ src/native_window/native_window_win.cpp
@@ -4,6 +4,7 @@
 #define min(left,right) std::min(left,right)
 #define max(left,right) std::max(left,right)
 #include <gdiplus.h>
+#include <shlobj.h>
 #include "appjs.h"
 #include "includes/cef.h"
 #include "includes/util.h"
@@ -544,83 +545,131 @@
 }

+
+int CALLBACK DirectorySelectHook(HWND hwnd, UINT msg, LPARAM lParam, LPARAM data) {
+  switch (msg) {
+    case BFFM_INITIALIZED:
+      HWND parent = GetParent(hwnd);
+      RECT r;
+      GetWindowRect(parent, &r);
+      r.right = r.right - r.left + 200;
+      r.bottom = r.bottom - r.top + 200;
+      r.left = (NativeWindow::ScreenWidth() - r.right) / 2 | 0;
+      r.top = (NativeWindow::ScreenHeight() - r.bottom) / 2 | 0;
+      SetWindowPos(parent, NULL, r.left, r.top, r.right, r.bottom, SWP_NOZORDER);
+      SendMessage(hwnd, BFFM_SETSELECTION, true, data);
+      break;
+  }
+  return 0;
+}
+
 void NativeWindow::OpenFileDialog(uv_work_t* req) {
   AppjsDialogSettings* settings = (AppjsDialogSettings*)req->data;
   std::string       acceptTypes = settings->reserveString1;
-  std::string        initialDir = settings->initialValue;
   bool              multiSelect = settings->reserveBool1;
   bool                dirSelect = settings->reserveBool2;

-  Cef::Pause();
-  //NW_DIALOGTYPE_FILE_SAVE  NW_DIALOGTYPE_FILE_OPEN,
-
-  if (settings->type == NW_DIALOGTYPE_FILE_OPEN) {
-    OPENFILENAMEA ofn = {0};
-    ofn.lStructSize = sizeof(ofn);
-    ofn.hwndOwner = static_cast<HWND>(settings->me->handle_);
-    ofn.lpstrInitialDir = initialDir.c_str();
+  //Cef::Pause();
+
+  settings->result = NULL;
+  char filename[MAX_PATH+1];
+  strcpy(filename, settings->initialValue.c_str());
+  filename[settings->initialValue.size()] = 0;
+  filename[MAX_PATH] = 0;
+
+  if (dirSelect) {
+    LPMALLOC pMalloc = NULL;
+    SHGetMalloc(&pMalloc);
+
+    BROWSEINFO bi;
+    bi.hwndOwner = NULL;
+    bi.pidlRoot = NULL;
+    bi.pszDisplayName = filename;
+    bi.lpszTitle = settings->title.c_str();
+    bi.ulFlags = BIF_USENEWUI | BIF_BROWSEFILEJUNCTIONS | BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS;
+    bi.lParam = (LPARAM)ToWChar(settings->initialValue);
+    bi.iImage = -1;
+    bi.lpfn = DirectorySelectHook;
+
+    LPITEMIDLIST item;
+    if (item = SHBrowseForFolder(&bi)) {
+      char dir[MAX_PATH];
+      if (SHGetPathFromIDList(item, dir)) {
+        std::vector<char*> paths;
+        paths.push_back(dir);
+        settings->result = &paths;
+        CoTaskMemFree(item);
+      }
+      pMalloc->Free(item);
+    }
+  } else {
+    std::replace(acceptTypes.begin(), acceptTypes.end(), ',', '\0');
+    std::replace(acceptTypes.begin(), acceptTypes.end(), ';', '\0');
+
+    OPENFILENAME ofn = {0};
+    ofn.hwndOwner = NULL;
+    ofn.hInstance = 0;
+    ofn.lStructSize = sizeof(OPENFILENAME);
     ofn.lpstrTitle = settings->title.c_str();
-    ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR | OFN_FORCESHOWHIDDEN | OFN_EXPLORER;
+    ofn.Flags = OFN_NOCHANGEDIR | OFN_FORCESHOWHIDDEN;
+    ofn.lpstrFile = filename;
+    ofn.nMaxFile = MAX_PATH;
+    ofn.nFileOffset = settings->initialValue.size();
     ofn.lpstrFilter = acceptTypes.c_str();
-
-    if (multiSelect) {
-      ofn.Flags |= OFN_ALLOWMULTISELECT | OFN_EXPLORER;
-
-      if (!!GetOpenFileName(&ofn)) {
-        std::vector<std::string> files;
-        const char* selection = ofn.lpstrFile;
-        while (*selection) {
-          files.push_back(selection);
-          selection += files.back().length() + 1;
-        }
-
-        if (files.empty()) {
-          settings->result = NULL;
-        } else if (files.size() == 1) {
-          settings->result = &files;
-        } else {
-          std::vector<std::string> paths;
-          std::vector<std::string>::iterator path = files.begin();
-          for (std::vector<std::string>::iterator file = path + 1; file != files.end(); ++file) {
-            paths.push_back((*path).append(*file));
-          }
-          settings->result = &paths;
-        }
-      }
-    } else {
-      char filename[MAX_PATH];
-      ofn.lpstrFile = filename;
-
-      if (!!GetOpenFileName(&ofn)) {
-        std::vector<std::string> file(1);
-        file.push_back(ofn.lpstrFile);
-        settings->result = &file;
-      }
-    }
-  }
-
-
-  Cef::Run();
-}
-
-
+    if (!settings->initialValue.size()) {
+      ofn.lpstrInitialDir = settings->initialValue.c_str();
+    }
+
+    BOOL result;
+    if (settings->type == NW_DIALOGTYPE_FILE_SAVE) {
+      multiSelect = false;
+      result = GetSaveFileName(&ofn);
+    } else if (settings->type == NW_DIALOGTYPE_FILE_OPEN) {
+      if (multiSelect) {
+        ofn.Flags |= OFN_ALLOWMULTISELECT | OFN_EXPLORER;
+      }
+      result = GetOpenFileName(&ofn);
+    }
+
+    if (result) {
+      char* offset;
+      std::vector<char*> paths;
+
+      paths.push_back(ofn.lpstrFile);
+      offset = ofn.lpstrFile + ofn.nFileOffset;
+
+      if (!multiSelect || ofn.nFileExtension != 0){
+        ofn.lpstrFile[ofn.nFileOffset - 1] = 0;
+      }
+
+      do {
+         paths.push_back(offset);
+         offset += strlen(offset) + 1;
+      } while (multiSelect && *offset != '\0');
+
+      settings->result = &paths;
+    }
+  }
+
+  //Cef::Run();
+}

 void NativeWindow::ProcessFileDialog(uv_work_t* req) {
   AppjsDialogSettings* settings = (AppjsDialogSettings*)req->data;
+  Persistent<Function> cb = settings->cb;
   void* result = settings->result;
-  Persistent<Function> cb = settings->cb;

   if (result != NULL) {
-    std::vector<std::string> filenames = *(std::vector<std::string>*)result;
-    Local<Array> files = Array::New(filenames.size());
+    std::vector<char*>* filenames = (std::vector<char*>*)result;
+    Local<Array> files = Array::New(filenames->size());
     Handle<Value> error = Undefined();
     int index = 0;

-    std::vector<std::string>::iterator file = filenames.begin();
-
-    for (; file != filenames.end(); ++file) {
-      files->Set(index, String::New((*file).c_str()));
+    std::vector<char*>::iterator file = filenames->begin();
+
+    for (; file != filenames->end(); ++file) {
+      files->Set(index, String::New(*file));
       index++;
     }

@@ -635,6 +684,9 @@
   NativeWindow::DialogClosed();
 }

+
+
+
 void NativeWindow::OpenColorDialog(uv_work_t* req) {
 }


add zero clear for unreachable variable grad

--- src/nbla/computation_graph/variable.cpp
+++ src/nbla/computation_graph/variable.cpp
@@ -760,12 +760,31 @@
   // Scoped context.
   // Set flags used during backward of this variable to avoid clearing
   // buffer. Also, set the grad array passed as an argument.
-  NdArrayPtr bak_grad = this->variable()->grad();
-  DestructorCallback at_scope_exit(
-      [&]() { this->variable()->set_grad(bak_grad); });
-  if (grad) {
-    this->variable()->set_grad(grad);
-    activate_clear_initial_grad = clear_initial_grad;
+  std::vector<NdArrayPtr> bak_grads;
+  std::vector<NdArrayPtr> dummy_zero_grads;
+  for (auto var : parent_->outputs()) {
+    bak_grads.push_back(var->variable()->grad());
+    NdArrayPtr dummpy_grad = NdArray::create(var->variable()->shape());
+    dummpy_grad->zero();
+    dummy_zero_grads.push_back(dummpy_grad);
+  }
+
+  DestructorCallback at_scope_exit([&]() {
+    for (std::size_t i = 0; i < parent_->outputs().size(); i++) {
+      parent_->outputs()[i]->variable()->set_grad(bak_grads[i]);
+    }
+  });
+
+  for (std::size_t i = 0; i < parent_->outputs().size(); i++) {
+    auto var = parent_->outputs()[i];
+    if (var.get() == this) {
+      if (grad) {
+        this->variable()->set_grad(grad);
+        activate_clear_initial_grad = clear_initial_grad;
+      }
+    } else {
+      var->variable()->set_grad(dummy_zero_grads[i]);
+    }
   }

   // Create callback


open pipes in overlapped mode also on the client side

otherwise PeekNamedPipe() may block in threaded environments.

Reviewed-by: thiago

--- src/network/socket/qlocalsocket_win.cpp
+++ src/network/socket/qlocalsocket_win.cpp
@@ -144,7 +144,7 @@
                        0,              // no sharing
                        NULL,           // default security attributes
                        OPEN_EXISTING,  // opens existing pipe
-                       0,              // default attributes
+                       FILE_FLAG_OVERLAPPED,
                        NULL);          // no template file
         }, {
         localSocket = CreateFileA(
@@ -153,7 +153,7 @@
                        0,              // no sharing
                        NULL,           // default security attributes
                        OPEN_EXISTING,  // opens existing pipe
-                       0,              // default attributes
+                       FILE_FLAG_OVERLAPPED,
                        NULL);          // no template file
         });
         if (localSocket != INVALID_HANDLE_VALUE)


Enable two AutomationUITestBase tests on the Mac, and add a bug annotation for one

BUG=45882
TEST=AutomationUITestBase FindInPage and IncognitoWindow run on the Mac.

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

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

--- chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -12,12 +12,9 @@
 #include "net/base/net_util.h"

 #if defined(OS_MACOSX)
-// The window pops up, but doesn't close.
-#define MAYBE_IncognitoWindow DISABLED_IncognitoWindow
-// FindBarTesting not implemented on mac.
-#define MAYBE_FindInPage DISABLED_FindInPage
+// http://crbug.com/45882
+#define MAYBE_FindInPage FAILS_FindInPage
 #else  // !defined(OS_MACOSX)
-#define MAYBE_IncognitoWindow IncognitoWindow
 #define MAYBE_FindInPage FindInPage
 #endif

@@ -213,7 +210,7 @@
   ASSERT_FALSE(CloseActiveWindow());
 }

-TEST_F(AutomatedUITestBase, MAYBE_IncognitoWindow) {
+TEST_F(AutomatedUITestBase, IncognitoWindow) {
   int num_browser_windows;
   int num_normal_browser_windows;
   ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows));


Disable crashing mac ui test

Disable crashing mac ui test

TBR=aa
BUG=33451
TEST=mac ui test

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

Former-commit-id: 946012bbc638ef1b96a00bcaa077f751404850c9

--- chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -108,6 +108,8 @@
 }

 // http://code.google.com/p/chromium/issues/detail?id=14774
+// TODO(aa): http://crbug.com/33451
+#if !defined(OS_MACOSX)
 TEST_F(AutomatedUITestBase, FLAKY_CloseTab) {
   int num_browser_windows;
   int tab_count;
@@ -151,6 +153,7 @@
   active_browser()->GetTabCount(&tab_count);
   ASSERT_EQ(1, tab_count);
 }
+#endif

 TEST_F(AutomatedUITestBase, OpenBrowserWindow) {
   int num_browser_windows;


Update to newer path fill-type API in Skia (#14070)

--- lib/ui/painting/path.cc
+++ lib/ui/painting/path.cc
@@ -71,11 +71,11 @@
 CanvasPath::~CanvasPath() {}

 int CanvasPath::getFillType() {
-  return path_.getFillType();
+  return static_cast<int>(path_.getFillType());
 }

 void CanvasPath::setFillType(int fill_type) {
-  path_.setFillType(static_cast<SkPath::FillType>(fill_type));
+  path_.setFillType(static_cast<SkPathFillType>(fill_type));
 }

 void CanvasPath::moveTo(float x, float y) {


WIP: save work.

WIP: save work.

--- cpp/examples/Core/save_to_hdf5_example.cpp
+++ cpp/examples/Core/save_to_hdf5_example.cpp
@@ -2,26 +2,113 @@

 #include <hdf5/serial/H5Cpp.h>

+#include <array>
+
+
+constexpr auto filepath = "matrix.h5";
+constexpr auto dataset_name = "single_matrix";
+constexpr auto rank = 2;
+constexpr auto M = 5;
+constexpr auto N = 6;
+
+
+void write_data()
+{
+  auto file = H5::H5File{filepath, H5F_ACC_TRUNC};
+  auto dims = std::array<hsize_t, rank>{M, N};
+
+  const auto dataspace = H5::DataSpace{rank, dims.data()};
+  const auto datatype = H5::PredType::NATIVE_DOUBLE;
+  datatype.setOrder(H5T_ORDER_LE);
+
+  const auto dataset =
+      file.createDataSet(dataset_name, datatype, dataspace);
+
+  auto m = DO::Sara::MatrixXd{M, N};
+  for (int i = 0; i < M; ++i)
+    for (int j = 0; j < N; ++j)
+      m(i, j) = i * N + j;
+  std::cout << m << std::endl;
+
+  dataset.write(m.data(), H5::PredType::NATIVE_DOUBLE);
+}
+
+void read_data()
+{
+  auto m = DO::Sara::MatrixXd(M, N);
+
+  H5::Exception::dontPrint();
+
+  auto file = H5::H5File{filepath, H5F_ACC_RDONLY};
+  auto dataset = file.openDataSet(dataset_name);
+
+  // Retrieve the data types (int, float, double...)?
+  auto type_class = dataset.getTypeClass();
+  //if (type_class != H5T_NATIVE_DOUBLE)
+  //  throw std::runtime_error{"Data type must be double!"};
+  auto float_type = dataset.getFloatType();
+
+  // Retrieve the data endianness.
+  auto order_string = H5std_string{};
+  auto order = float_type.getOrder(order_string);
+  std::cout << order_string << std::endl;
+
+  // Number of elements.
+  auto size = float_type.getSize();
+  std::cout << "data size = " << size << std::endl;
+
+  // Dataspace.
+  auto dataspace = dataset.getSpace();
+  auto rank = dataspace.getSimpleExtentNdims();
+
+  auto dims_out = std::array<hsize_t, 2>{};
+  auto ndims = dataspace.getSimpleExtentDims(dims_out.data(), nullptr);
+  std::cout << "rank " << rank << ", dimensions "
+            << static_cast<unsigned long>(dims_out[0]) << " x "
+            << static_cast<unsigned long>(dims_out[1]) << std::endl;
+
+  // Source data.
+  auto offset = std::array<hsize_t, 2>{1, 2};
+  auto count = std::array<hsize_t, 2>{2, 3};
+  dataspace.selectHyperslab(H5S_SELECT_SET, count.data(), offset.data());
+
+  // Destination data.
+  auto dimsm = std::array<hsize_t, 2>{M, N};
+  auto memspace = H5::DataSpace{2, dimsm.data()};
+  memspace.selectHyperslab(H5S_SELECT_SET, count.data(), offset.data());
+
+  dataset.read(m.data(), H5::PredType::NATIVE_DOUBLE, memspace, dataspace);
+
+  std::cout << "single_matrix = " << std::endl << m << std::endl;
+}

 int main()
 {
-  const auto filepath = "matrix.h5";
-  const auto data_set_name = "single_matrix";
-  const auto M = 5;
-  const auto N = 6;
-
-  auto file = H5::H5File{filepath, H5F_ACC_TRUNC};
-  hsize_t dims[] = {M, N};
-
-  const auto data_space = H5::DataSpace{2, dims};
-  const auto data_set = file.createDataSet(data_set_name, H5::PredType::NATIVE_DOUBLE,
-                                          data_space);
-
-
-  auto m = DO::Sara::MatrixXd{M, N};
-  std::iota(m.data(), m.data() + m.size(), 0.);
-
-  data_set.write(m.data(), H5::PredType::NATIVE_DOUBLE);
+  try
+  {
+    write_data();
+    read_data();
+  }
+  catch (H5::FileIException& e)
+  {
+    e.printError();
+    return -1;
+  }
+  catch (H5::DataSetIException& e)
+  {
+    e.printError();
+    return -1;
+  }
+  catch (H5::DataSpaceIException& e)
+  {
+    e.printError();
+    return -1;
+  }
+  catch (H5::DataTypeIException& e)
+  {
+    e.printError();
+    return -1;
+  }

   return 0;
 }


Can now also delete PPN's.

Can now also delete PPN's.

--- cpp/pipelines/patch_up_ppns_for_k10plus.cc
+++ cpp/pipelines/patch_up_ppns_for_k10plus.cc
@@ -27,6 +27,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <kchashdb.h>
+#include "BSZUtil.h"
 #include "Compiler.h"
 #include "DbConnection.h"
 #include "DbResultSet.h"
@@ -45,8 +46,9 @@

 [[noreturn]] void Usage() {
-    ::Usage("[--store-only] marc_input1 [marc_input2 .. marc_inputN]"
-            "If --store-only has been specified, no swapping will be performed and only the persistent map file will be overwritten.");
+    ::Usage("[--store-only] marc_input1 [marc_input2 .. marc_inputN] [-- deletion_list1 deletion_list2 .. deletion_listN]\n"
+            "If --store-only has been specified, no swapping will be performed and only the persistent map file will be overwritten.\n"
+            "If deletion lists should be processed, they need to be spcified after a double-hyhen to indicate the end of the MARC files.");
 }

@@ -109,6 +111,30 @@
 }

+void DeleteFromTable(DbConnection * const db_connection, const std::string &table, const std::string &column,
+                     const std::unordered_set<std::string> &deletion_ppns)
+{
+    const unsigned MAX_BATCH_SIZE(100);
+
+    db_connection->queryOrDie("BEGIN");
+
+    unsigned deletion_count(0), batch_size(0);
+    for (const auto &deletion_ppn : deletion_ppns) {
+        ++batch_size;
+        db_connection->queryOrDie("DELETE FROM " + table + + "' WHERE " + column + "='" + deletion_ppn + "'");
+        deletion_count += db_connection->getNoOfAffectedRows();
+        if (batch_size >= MAX_BATCH_SIZE) {
+            db_connection->queryOrDie("COMMIT");
+            db_connection->queryOrDie("BEGIN");
+        }
+    }
+
+    db_connection->queryOrDie("COMMIT");
+
+    LOG_INFO("Deleted " + std::to_string(deletion_count) + " rows from " + table + ".");
+}
+
+
 void PatchNotifiedDB(const std::string &user_type, const std::vector<PPNsAndSigil> &old_ppns_sigils_and_new_ppns) {
     const std::string DB_FILENAME(UBTools::GetTuelibPath() + user_type + "_notified.db");
     std::unique_ptr<kyotocabinet::HashDB> db(new kyotocabinet::HashDB());
@@ -133,6 +159,24 @@
 }

+void DeleteFromNotifiedDB(const std::string &user_type, const std::unordered_set<std::string> &deletion_ppns) {
+    const std::string DB_FILENAME(UBTools::GetTuelibPath() + user_type + "_notified.db");
+    std::unique_ptr<kyotocabinet::HashDB> db(new kyotocabinet::HashDB());
+    if (not (db->open(DB_FILENAME, kyotocabinet::HashDB::OWRITER | kyotocabinet::HashDB::OREADER))) {
+        LOG_INFO("\"" + DB_FILENAME + "\" not found!");
+        return;
+    }
+
+    unsigned deletion_count(0);
+    for (const auto &deletion_ppn : deletion_ppns) {
+        if (db->remove(deletion_ppn))
+            ++deletion_count;
+    }
+
+    LOG_INFO("Deleted " + std::to_string(deletion_count) + " entries from \"" + DB_FILENAME + "\".");
+}
+
+
 bool HaveAllPermissions(DbConnection * const db_connection, const std::string &database) {
     const std::string QUERY("SHOW GRANTS FOR '" + db_connection->getUser() + "'@'" + db_connection->getHost() + "'");
     if (not db_connection->query(QUERY)) {
@@ -170,6 +214,27 @@
 }

+template<class SetOrMap, typename ProcessNotifieldDBFunc, typename ProcessTableFunc>
+void ProcessAllDatabases(DbConnection * const db_connection, const SetOrMap &set_or_map, const ProcessNotifieldDBFunc notified_db_func,
+                         const ProcessTableFunc table_func)
+{
+    notified_db_func("ixtheo", set_or_map);
+    notified_db_func("relbib", set_or_map);
+
+    table_func(db_connection, "vufind.resource", "record_id", set_or_map);
+    table_func(db_connection, "vufind.record", "record_id", set_or_map);
+    table_func(db_connection, "vufind.change_tracker", "id", set_or_map);
+    if (VuFind::GetTueFindFlavour() == "ixtheo") {
+        table_func(db_connection, "ixtheo.keyword_translations", "ppn", set_or_map);
+        table_func(db_connection, "vufind.ixtheo_journal_subscriptions", "journal_control_number_or_bundle_name",
+                   set_or_map);
+        table_func(db_connection, "vufind.ixtheo_pda_subscriptions", "book_ppn", set_or_map);
+        table_func(db_connection, "vufind.relbib_ids", "record_id", set_or_map);
+        table_func(db_connection, "vufind.bibstudies_ids", "record_id", set_or_map);
+    }
+}
+
+
 } // unnamed namespace

@@ -199,14 +264,27 @@
         MapUtil::DeserialiseMap(ALREADY_SWAPPED_PPNS_MAP_FILE, &already_processed_ppns_and_sigils);

     std::vector<PPNsAndSigil> old_ppns_sigils_and_new_ppns;
-    for (int arg_no(1); arg_no < argc; ++arg_no) {
+    int arg_no(1);
+    for (/* Intentionally empty! */; arg_no < argc; ++arg_no) {
+        if (__builtin_strcmp(argv[arg_no], "--"))
+            break;
         const auto marc_reader(MARC::Reader::Factory(argv[arg_no]));
         LoadMapping(marc_reader.get(), already_processed_ppns_and_sigils, &old_ppns_sigils_and_new_ppns);
     }
-    if (old_ppns_sigils_and_new_ppns.empty()) {
+
+    std::unordered_set <std::string> title_deletion_ppns;
+    for (/* Intentionally empty! */; arg_no < argc; ++arg_no) {
+        const auto input(FileUtil::OpenInputFileOrDie(argv[arg_no]));
+        std::unordered_set <std::string> local_deletion_ids;
+        BSZUtil::ExtractDeletionIds(input.get(), &title_deletion_ppns, &local_deletion_ids);
+    }
+
+    if (old_ppns_sigils_and_new_ppns.empty() and title_deletion_ppns.empty()) {
         LOG_INFO("nothing to do!");
         return EXIT_SUCCESS;
     }
+    if (old_ppns_sigils_and_new_ppns.empty())
+        goto clean_up_deleted_ppns;

     if (store_only) {
         AddPPNsAndSigilsToMultiMap(old_ppns_sigils_and_new_ppns, &already_processed_ppns_and_sigils);
@@ -214,23 +292,12 @@
         return EXIT_SUCCESS;
     }

-    PatchNotifiedDB("ixtheo", old_ppns_sigils_and_new_ppns);
-    PatchNotifiedDB("relbib", old_ppns_sigils_and_new_ppns);
-
-    PatchTable(&db_connection, "vufind.resource", "record_id", old_ppns_sigils_and_new_ppns);
-    PatchTable(&db_connection, "vufind.record", "record_id", old_ppns_sigils_and_new_ppns);
-    PatchTable(&db_connection, "vufind.change_tracker", "id", old_ppns_sigils_and_new_ppns);
-    if (VuFind::GetTueFindFlavour() == "ixtheo") {
-        PatchTable(&db_connection, "ixtheo.keyword_translations", "ppn", old_ppns_sigils_and_new_ppns);
-        PatchTable(&db_connection, "vufind.ixtheo_journal_subscriptions", "journal_control_number_or_bundle_name",
-                   old_ppns_sigils_and_new_ppns);
-        PatchTable(&db_connection, "vufind.ixtheo_pda_subscriptions", "book_ppn", old_ppns_sigils_and_new_ppns);
-        PatchTable(&db_connection, "vufind.relbib_ids", "record_id", old_ppns_sigils_and_new_ppns);
-        PatchTable(&db_connection, "vufind.bibstudies_ids", "record_id", old_ppns_sigils_and_new_ppns);
-    }
-
+    ProcessAllDatabases(&db_connection, old_ppns_sigils_and_new_ppns, PatchNotifiedDB, PatchTable);
     AddPPNsAndSigilsToMultiMap(old_ppns_sigils_and_new_ppns, &already_processed_ppns_and_sigils);
     MapUtil::SerialiseMap(ALREADY_SWAPPED_PPNS_MAP_FILE, already_processed_ppns_and_sigils);

+clean_up_deleted_ppns:
+    ProcessAllDatabases(&db_connection, title_deletion_ppns, DeleteFromNotifiedDB, DeleteFromTable);
+
     return EXIT_SUCCESS;
 }


[C++,Test] Mqtt unit tests MessageRouter

Change-Id: Id58806c078946cbc240d576d5f16c75844ff1328

--- cpp/tests/unit-tests/MessageRouterTest.cpp
+++ cpp/tests/unit-tests/MessageRouterTest.cpp
@@ -1,7 +1,7 @@
 /*
  * #%L
  * %%
- * Copyright (C) 2011 - 2013 BMW Car IT GmbH
+ * Copyright (C) 2011 - 2016 BMW Car IT GmbH
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,17 +28,20 @@
 #include <chrono>
 #include <cstdint>

+using ::testing::AllOf;
+using ::testing::Property;
+using ::testing::Return;
+using ::testing::WhenDynamicCastTo;
 using namespace joynr;

 class MessageRouterTest : public ::testing::Test {
 public:
     MessageRouterTest() :
-        settingsFileName("MessageRouterTest.settings"),
-        settings(settingsFileName),
+        settings(),
         messagingSettings(settings),
         messagingStubFactory(new MockMessagingStubFactory()),
         messageQueue(new MessageQueue()),
-        messageRouter(new MessageRouter(new MessagingStubFactory(), nullptr, 6, messageQueue)),
+        messageRouter(new MessageRouter(messagingStubFactory, nullptr, 6, messageQueue)),
         joynrMessage()
     {
         // provision global capabilities directory
@@ -59,6 +62,7 @@

     ~MessageRouterTest() {
         std::remove(settingsFileName.c_str());
+        delete messagingStubFactory;
     }

     void SetUp(){
@@ -74,6 +78,9 @@
     MessageQueue* messageQueue;
     MessageRouter* messageRouter;
     JoynrMessage joynrMessage;
+    void routeMessageToAddress(
+            const std::string& destinationParticipantId,
+            std::shared_ptr<system::RoutingTypes::Address> address);
 private:
     DISALLOW_COPY_AND_ASSIGN(MessageRouterTest);
 };
@@ -97,25 +104,48 @@
 }

 TEST_F(MessageRouterTest, doNotAddMessageToQueue){
+    const std::string testHttp = "TEST_HTTP";
+    const std::string testMqtt = "TEST_MQTT";
     // this message should be added because no destination header set
     messageRouter->route(joynrMessage);
     EXPECT_EQ(messageQueue->getQueueLength(), 1);

+    // add destination address -> message should be routed
+    auto httpAddress = std::make_shared<system::RoutingTypes::ChannelAddress>(testHttp);
+    messageRouter->addNextHop(testHttp, httpAddress);
     // the message now has a known destination and should be directly routed
-    joynrMessage.setHeaderTo(messagingSettings.getCapabilitiesDirectoryParticipantId());
+    joynrMessage.setHeaderTo(testHttp);
+    messageRouter->route(joynrMessage);
+    EXPECT_EQ(messageQueue->getQueueLength(), 1);
+
+    // add destination address -> message should be routed
+    auto mqttAddress = std::make_shared<system::RoutingTypes::MqttAddress>(testMqtt);
+    messageRouter->addNextHop(testMqtt, mqttAddress);
+    // the message now has a known destination and should be directly routed
+    joynrMessage.setHeaderTo(testMqtt);
     messageRouter->route(joynrMessage);
     EXPECT_EQ(messageQueue->getQueueLength(), 1);
 }

 TEST_F(MessageRouterTest, resendMessageWhenDestinationAddressIsAdded){
-    // this message should be added because no destination header set
-    joynrMessage.setHeaderTo("TEST");
+    const std::string testHttp = "TEST_HTTP";
+    const std::string testMqtt = "TEST_MQTT";
+    // this message should be added because destination is unknown
+    joynrMessage.setHeaderTo(testHttp);
     messageRouter->route(joynrMessage);
     EXPECT_EQ(messageQueue->getQueueLength(), 1);

     // add destination address -> message should be routed
-    std::shared_ptr<system::RoutingTypes::ChannelAddress> address(new system::RoutingTypes::ChannelAddress("TEST"));
-    messageRouter->addNextHop("TEST", address);
+    auto httpAddress = std::make_shared<system::RoutingTypes::ChannelAddress>(testHttp);
+    messageRouter->addNextHop(testHttp, httpAddress);
+    EXPECT_EQ(messageQueue->getQueueLength(), 0);
+
+    joynrMessage.setHeaderTo(testMqtt);
+    messageRouter->route(joynrMessage);
+    EXPECT_EQ(messageQueue->getQueueLength(), 1);
+
+    auto mqttAddress = std::make_shared<system::RoutingTypes::MqttAddress>(testMqtt);
+    messageRouter->addNextHop(testMqtt, mqttAddress);
     EXPECT_EQ(messageQueue->getQueueLength(), 0);
 }

@@ -127,3 +157,42 @@
     std::this_thread::sleep_for(std::chrono::milliseconds(1200));
     EXPECT_EQ(messageQueue->getQueueLength(), 0);
 }
+
+void MessageRouterTest::routeMessageToAddress(
+        const std::string& destinationParticipantId,
+        std::shared_ptr<system::RoutingTypes::Address> address) {
+    messageRouter->addNextHop(destinationParticipantId, address);
+    joynrMessage.setHeaderTo(destinationParticipantId);
+    ON_CALL(*messagingStubFactory, create(_)).WillByDefault(Return(nullptr));
+    messageRouter->route(joynrMessage);
+}
+
+TEST_F(MessageRouterTest, routeMessageToHttpAddress) {
+    const std::string destinationParticipantId = "TEST_routeMessageToHttpAddress";
+    const std::string destinationChannelId = "TEST_routeMessageToHttpAddress_channelId";
+    auto address = std::make_shared<system::RoutingTypes::ChannelAddress>(destinationChannelId);
+    EXPECT_CALL(*messagingStubFactory,
+            create(AllOf(
+                    A<const joynr::system::RoutingTypes::Address&>(),
+                    WhenDynamicCastTo<const system::RoutingTypes::ChannelAddress&>(
+                            Property(&system::RoutingTypes::ChannelAddress::getChannelId, Eq(destinationChannelId))
+                            )
+                    ))
+            ).Times(1);
+    routeMessageToAddress(destinationParticipantId, address);
+}
+
+TEST_F(MessageRouterTest, routeMessageToMqttAddress) {
+    const std::string destinationParticipantId = "TEST_routeMessageToMqttAddress";
+    const std::string destinationChannelId = "TEST_routeMessageToMqttAddress_channelId";
+    auto address = std::make_shared<system::RoutingTypes::MqttAddress>(destinationChannelId);
+    EXPECT_CALL(*messagingStubFactory,
+            create(AllOf(
+                    A<const joynr::system::RoutingTypes::Address&>(),
+                    WhenDynamicCastTo<const system::RoutingTypes::MqttAddress&>(
+                            Property(&system::RoutingTypes::MqttAddress::getChannelId, Eq(destinationChannelId))
+                            )
+                    ))
+            ).Times(1);
+    routeMessageToAddress(destinationParticipantId, address);
+}


Fix uninitialized variable warning

Fix uninitialized variable warning

We don't actually use its initial value, but that might understandably
be too hard (impossible?) for clang 11 to prove.

--- src/apps/meshtool.C
+++ src/apps/meshtool.C
@@ -120,7 +120,7 @@
   // Number of refinements
   if (command_line.search(1, "-r"))
     {
-      int tmp;
+      int tmp = 0;
       tmp = command_line.next(tmp);
       n_rsteps = cast_int<unsigned int>(tmp);
     }
@@ -128,7 +128,7 @@
   // Number of subdomains for partitioning
   if (command_line.search(1, "-p"))
     {
-      int tmp;
+      int tmp = 0;
       tmp = command_line.next(tmp);
       n_subdomains = cast_int<unsigned int>(tmp);
     }