Fixed default openniDepthMode initialization. Minor fixes

--- src/zed_wrapper_nodelet.cpp
+++ src/zed_wrapper_nodelet.cpp
@@ -648,41 +648,6 @@
             nh_ns.param<std::string>("camera_frame", camera_frame_id, "camera_frame");
             nh_ns.param<std::string>("depth_frame", depth_frame_id, "depth_frame");

-            // Publish odometry tf
-            nh_ns.param<bool>("publish_tf", publish_tf, true);
-
-            std::string img_topic = "image_rect_color";
-            std::string img_raw_topic = "image_raw_color";
-
-            // Set the default topic names
-            string left_topic = "left/" + img_topic;
-            string left_raw_topic = "left/" + img_raw_topic;
-            string left_cam_info_topic = "left/camera_info";
-            left_frame_id = camera_frame_id;
-
-            string right_topic = "right/" + img_topic;
-            string right_raw_topic = "right/" + img_raw_topic;
-            string right_cam_info_topic = "right/camera_info";
-            right_frame_id = camera_frame_id;
-
-            string rgb_topic = "rgb/" + img_topic;
-            string rgb_raw_topic = "rgb/" + img_raw_topic;
-            string rgb_cam_info_topic = "rgb/camera_info";
-            rgb_frame_id = depth_frame_id;
-
-            string depth_topic = "depth/";
-            if (openniDepthMode)
-                depth_topic += "depth_raw_registered";
-            else
-                depth_topic += "depth_registered";
-
-            string depth_cam_info_topic = "depth/camera_info";
-
-            string point_cloud_topic = "point_cloud/cloud_registered";
-            cloud_frame_id = camera_frame_id;
-
-            string odometry_topic = "odom";
-
             // Get parameters from launch file
             nh_ns.getParam("resolution", resolution);
             nh_ns.getParam("quality", quality);
@@ -694,8 +659,50 @@
             nh_ns.getParam("zed_id", zed_id);
             nh_ns.getParam("depth_stabilization", depth_stabilization);

-            if (openniDepthMode)
+            // Publish odometry tf
+            nh_ns.param<bool>("publish_tf", publish_tf, true);
+
+            // Print order frames
+            ROS_INFO_STREAM("odometry_frame: " << odometry_frame_id);
+            ROS_INFO_STREAM("base_frame: "     << base_frame_id);
+            ROS_INFO_STREAM("camera_frame: "   << camera_frame_id);
+            ROS_INFO_STREAM("depth_frame: "    << depth_frame_id);
+            // Status of odometry TF
+            ROS_INFO_STREAM("Publish " << odometry_frame_id << " [" << (publish_tf ? "TRUE" : "FALSE") << "]");
+
+            std::string img_topic = "image_rect_color";
+            std::string img_raw_topic = "image_raw_color";
+
+            // Set the default topic names
+            string left_topic = "left/" + img_topic;
+            string left_raw_topic = "left/" + img_raw_topic;
+            string left_cam_info_topic = "left/camera_info";
+            left_frame_id = camera_frame_id;
+
+            string right_topic = "right/" + img_topic;
+            string right_raw_topic = "right/" + img_raw_topic;
+            string right_cam_info_topic = "right/camera_info";
+            right_frame_id = camera_frame_id;
+
+            string rgb_topic = "rgb/" + img_topic;
+            string rgb_raw_topic = "rgb/" + img_raw_topic;
+            string rgb_cam_info_topic = "rgb/camera_info";
+            rgb_frame_id = depth_frame_id;
+
+            string depth_topic = "depth/";
+            if (openniDepthMode) {
                 NODELET_INFO_STREAM("Openni depth mode activated");
+                depth_topic += "depth_raw_registered";
+            } else {
+                depth_topic += "depth_registered";
+            }
+
+            string depth_cam_info_topic = "depth/camera_info";
+
+            string point_cloud_topic = "point_cloud/cloud_registered";
+            cloud_frame_id = camera_frame_id;
+
+            string odometry_topic = "odom";

             nh_ns.getParam("rgb_topic", rgb_topic);
             nh_ns.getParam("rgb_raw_topic", rgb_raw_topic);
@@ -718,10 +725,6 @@

             nh_ns.param<std::string>("svo_filepath", svo_filepath, std::string());

-            // Print order frames
-            ROS_INFO_STREAM("Order: odometry_frame[" << odometry_frame_id << "]->base_frame[" << base_frame_id << "]->camera_frame[" << camera_frame_id << "]");
-            // Status of odometry TF
-            ROS_INFO_STREAM("Publish odometry_frame[" << odometry_frame_id << "] = " << (publish_tf ? "true" : "false"));

             // Initialization transformation listener
             tfBuffer.reset( new tf2_ros::Buffer );


We don't need to document every click

We don't need to document every click

--- actiondb.cc
+++ actiondb.cc
@@ -317,10 +317,8 @@
 			}
 		}
 	}
-	if (!r.action && s->trivial()) {
-		r.action = RAction(new Click);
-		r.name = _("click (default)");
-	}
+	if (!r.action && s->trivial())
+		return RAction(new Click);
 	if (r.action) {
 		if (verbosity >= 1)
 			printf("Executing Action %s\n", r.name.c_str());


activity.cc: Avoid signed integer overflow undefined behavior warning.

--- activity.cc
+++ activity.cc
@@ -36,7 +36,7 @@

 void WasteCpu::DoActivity() {
   iteration_count_++;
-  int sum = 0;
+  unsigned int sum = 0;
   std::srand(time(0));
   std::generate(rand_array.begin(), rand_array.end(), std::rand);
   std::sort(rand_array.begin(), rand_array.end());


change identifier for exported property names and use right namespace on it

--- svtools/source/config/historyoptions.cxx
+++ svtools/source/config/historyoptions.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: historyoptions.cxx,v $
  *
- *  $Revision: 1.3 $
- *
- *  last change: $Author: as $ $Date: 2000-11-02 07:22:19 $
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: as $ $Date: 2000-11-07 11:42:53 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -115,10 +115,10 @@
 #define PROPERTYNAME_HISTORYSIZE                OUString(RTL_CONSTASCII_USTRINGPARAM("Size"                     ))
 #define PROPERTYNAME_PICKLIST                   OUString(RTL_CONSTASCII_USTRINGPARAM("PickList/"                ))
 #define PROPERTYNAME_HISTORY                    OUString(RTL_CONSTASCII_USTRINGPARAM("List/"                    ))
-#define PROPERTYNAME_HISTORYITEM_URL            PROPERTYNAME_URL+PATHDELIMITER
-#define PROPERTYNAME_HISTORYITEM_FILTER         PROPERTYNAME_FILTER+PATHDELIMITER
-#define PROPERTYNAME_HISTORYITEM_TITLE          PROPERTYNAME_TITLE+PATHDELIMITER
-#define PROPERTYNAME_HISTORYITEM_PASSWORD       PROPERTYNAME_PASSWORD+PATHDELIMITER
+#define PROPERTYNAME_HISTORYITEM_URL            HISTORY_PROPERTYNAME_URL+PATHDELIMITER
+#define PROPERTYNAME_HISTORYITEM_FILTER         HISTORY_PROPERTYNAME_FILTER+PATHDELIMITER
+#define PROPERTYNAME_HISTORYITEM_TITLE          HISTORY_PROPERTYNAME_TITLE+PATHDELIMITER
+#define PROPERTYNAME_HISTORYITEM_PASSWORD       HISTORY_PROPERTYNAME_PASSWORD+PATHDELIMITER
 #define OFFSET_URL                              0
 #define OFFSET_FILTER                           1
 #define OFFSET_TITLE                            2
@@ -658,14 +658,14 @@
     // Copy items from given to return list.
     for( sal_Int32 nItem=0; nItem<nCount; ++nItem )
     {
-        seqProperties[OFFSET_URL        ].Name  =   PROPERTYNAME_URL        ;
-        seqProperties[OFFSET_FILTER     ].Name  =   PROPERTYNAME_FILTER     ;
-        seqProperties[OFFSET_TITLE      ].Name  =   PROPERTYNAME_TITLE      ;
-        seqProperties[OFFSET_PASSWORD   ].Name  =   PROPERTYNAME_PASSWORD   ;
-        seqProperties[OFFSET_URL        ].Value <<= aList[nItem].sURL       ;
-        seqProperties[OFFSET_FILTER     ].Value <<= aList[nItem].sFilter    ;
-        seqProperties[OFFSET_TITLE      ].Value <<= aList[nItem].sTitle     ;
-        seqProperties[OFFSET_PASSWORD   ].Value <<= aList[nItem].sPassword  ;
+        seqProperties[OFFSET_URL        ].Name  =   HISTORY_PROPERTYNAME_URL        ;
+        seqProperties[OFFSET_FILTER     ].Name  =   HISTORY_PROPERTYNAME_FILTER     ;
+        seqProperties[OFFSET_TITLE      ].Name  =   HISTORY_PROPERTYNAME_TITLE      ;
+        seqProperties[OFFSET_PASSWORD   ].Name  =   HISTORY_PROPERTYNAME_PASSWORD   ;
+        seqProperties[OFFSET_URL        ].Value <<= aList[nItem].sURL               ;
+        seqProperties[OFFSET_FILTER     ].Value <<= aList[nItem].sFilter            ;
+        seqProperties[OFFSET_TITLE      ].Value <<= aList[nItem].sTitle             ;
+        seqProperties[OFFSET_PASSWORD   ].Value <<= aList[nItem].sPassword          ;
         seqResult[nItem] = seqProperties;
     }
     return seqResult;


INTEGRATION: CWS vgbugs07 (1.32.160); FILE MERGED 2007/06/04 13:31:37 vg 1.32.160.1: #i76605# Remove -I .../inc/module hack introduced by hedaburemove01

--- svtools/source/filter.vcl/wmf/winmtf.hxx
+++ svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: winmtf.hxx,v $
  *
- *  $Revision: 1.32 $
- *
- *  last change: $Author: ihi $ $Date: 2006-11-14 15:42:37 $
+ *  $Revision: 1.33 $
+ *
+ *  last change: $Author: hr $ $Date: 2007-06-27 21:36:54 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -78,7 +78,7 @@
 #include <vcl/lineinfo.hxx>
 #endif
 #ifndef _FLTCALL_HXX
-#include <fltcall.hxx>
+#include <svtools/fltcall.hxx>
 #endif

 #define ERROR                   0


slidecopy: KeyInput: call the base class only when not having handled the key input myself. Otherwise, it will be tempted to send a Notify event, which in turn might lead to our focus being lost, which will corrupt our internal state

--- svtools/source/toolpanel/paneltabbar.cxx
+++ svtools/source/toolpanel/paneltabbar.cxx
@@ -1136,9 +1136,37 @@
     }

     //------------------------------------------------------------------------------------------------------------------
+    class KeyInputHandler
+    {
+    public:
+        KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent )
+            :m_rControl( i_rControl )
+            ,m_rKeyEvent( i_rKeyEvent )
+            ,m_bHandled( false )
+        {
+        }
+
+        ~KeyInputHandler()
+        {
+            if ( !m_bHandled )
+                m_rControl.Control::KeyInput( m_rKeyEvent );
+        }
+
+        void   setHandled()
+        {
+            m_bHandled = true;
+        }
+
+    private:
+        Control&        m_rControl;
+        const KeyEvent& m_rKeyEvent;
+        bool            m_bHandled;
+    };
+
+    //------------------------------------------------------------------------------------------------------------------
     void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent )
     {
-        Control::KeyInput( i_rKeyEvent );
+        KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent );

         const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() );
         if ( rKeyCode.GetModifier() != 0 )
@@ -1191,6 +1219,9 @@
             m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount );
         }
         m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+
+        // don't delegate to base class
+        aKeyInputHandler.setHandled();
     }

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


WaE: ‘isNumber’ [-Werror=maybe-uninitialized]

Change-Id: I17ea9518e862b8c97c4c3f4564caedf9d045b7b3

--- sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -57,7 +57,7 @@
 protected:
     bool CjkNumberedListTestHelper(sal_Int16 &nValue)
     {
-        bool isNumber;
+        bool isNumber = false;
         uno::Reference<text::XTextRange> xPara(getParagraph(1));
         uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY);
         properties->getPropertyValue("NumberingIsNumber") >>= isNumber;


WaE: this decimal constant is unsigned only in ISO C90

Change-Id: Ica3bf96289d142be2ef19d3a0bb3a4006ef5317d

--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -782,7 +782,7 @@
     Graphic aGraphic(xGraphic);
     // If this changes later, feel free to update it, but make sure it's not
     // the checksum of a white/transparent placeholder rectangle.
-    CPPUNIT_ASSERT_EQUAL(sal_uLong(2404338915), aGraphic.GetChecksum());
+    CPPUNIT_ASSERT_EQUAL(sal_uLong(2404338915U), aGraphic.GetChecksum());
 }

 CPPUNIT_TEST_SUITE_REGISTRATION(Test);


Virtual texture (and virtual page) class for doing partial resident allocations

--- texturesparseresidency/texturesparseresidency.cpp
+++ texturesparseresidency/texturesparseresidency.cpp
@@ -20,6 +20,7 @@
 #include <assert.h>
 #include <vector>
 #include <algorithm>
+#include <random>

 #define GLM_FORCE_RADIANS
 #define GLM_FORCE_DEPTH_ZERO_TO_ONE
@@ -41,13 +42,151 @@
 	float normal[3];
 };

+// Virtual texture page as a part of the partially resident texture
+// Contains memory bindings, offsets and status information
+struct VirtualTexturePage
+{
+	VkOffset3D offset;
+	VkExtent3D extent;
+	VkSparseImageMemoryBind imageMemoryBind;							// Sparse image memory bind for this page
+	VkDeviceSize size;													// Page (memory) size in bytes
+	uint32_t mipLevel;													// Mip level that this page belongs to
+	uint32_t layer;														// Array layer that this page belongs to
+	uint32_t index;
+
+	VirtualTexturePage()
+	{
+		imageMemoryBind.memory = VK_NULL_HANDLE;						// Page initially not backed up by memory
+	}
+
+	// Allocate Vulkan memory for the virtual page
+	void allocate(VkDevice device, uint32_t memoryTypeIndex)
+	{
+		if (imageMemoryBind.memory != VK_NULL_HANDLE)
+		{
+			//std::cout << "Page " << index << " already allocated" << std::endl;
+			return;
+		};
+
+		imageMemoryBind = {};
+
+		VkMemoryAllocateInfo allocInfo = vkTools::initializers::memoryAllocateInfo();
+		allocInfo.allocationSize = size;
+		allocInfo.memoryTypeIndex = memoryTypeIndex;
+		VK_CHECK_RESULT(vkAllocateMemory(device, &allocInfo, nullptr, &imageMemoryBind.memory));
+
+		VkImageSubresource subResource{};
+		subResource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+		subResource.mipLevel = mipLevel;
+		subResource.arrayLayer = layer;
+
+		// Sparse image memory binding
+		imageMemoryBind.subresource = subResource;
+		imageMemoryBind.extent = extent;
+		imageMemoryBind.offset = offset;
+	}
+
+	// Release Vulkan memory allocated for this page
+	void release(VkDevice device)
+	{
+		if (imageMemoryBind.memory != VK_NULL_HANDLE)
+		{
+			vkFreeMemory(device, imageMemoryBind.memory, nullptr);
+			imageMemoryBind.memory = VK_NULL_HANDLE;
+			//std::cout << "Page " << index << " released" << std::endl;
+		}
+	}
+};
+
+// Virtual texture object containing all pages
+struct VirtualTexture
+{
+	VkDevice device;
+	VkImage image;														// Texture image handle
+	VkBindSparseInfo bindSparseInfo;									// Sparse queue binding information
+	std::vector<VirtualTexturePage> pages;								// Contains all virtual pages of the texture
+	std::vector<VkSparseImageMemoryBind> sparseImageMemoryBinds;		// Sparse image memory bindings of all memory-backed virtual tables
+	std::vector<VkSparseMemoryBind>	opaqueMemoryBinds;					// Sparse paque memory bindings for the mip tail (if present)
+	VkSparseImageMemoryBindInfo imageMemoryBindInfo;					// Sparse image memory bind info
+	VkSparseImageOpaqueMemoryBindInfo opaqueMemoryBindInfo;				// Sparse image opaque memory bind info (mip tail)
+
+	VirtualTexturePage* addPage(VkOffset3D offset, VkExtent3D extent, const VkDeviceSize size, const uint32_t mipLevel, uint32_t layer)
+	{
+		VirtualTexturePage newPage;
+		newPage.offset = offset;
+		newPage.extent = extent;
+		newPage.size = size;
+		newPage.mipLevel = mipLevel;
+		newPage.layer = layer;
+		newPage.index = static_cast<uint32_t>(pages.size());
+		newPage.imageMemoryBind.offset = offset;
+		newPage.imageMemoryBind.extent = extent;
+		pages.push_back(newPage);
+		return &pages.back();
+	}
+
+	// Call before sparse binding to update memory bind list etc.
+	void updateSparseBindInfo()
+	{
+		// Update list of memory-backed sparse image memory binds
+		sparseImageMemoryBinds.clear();
+		for (auto page : pages)
+		{
+			sparseImageMemoryBinds.push_back(page.imageMemoryBind);
+		}
+		// Update sparse bind info
+		bindSparseInfo = vkTools::initializers::bindSparseInfo();
+		// todo: Semaphore for queue submission
+		// bindSparseInfo.signalSemaphoreCount = 1;
+		// bindSparseInfo.pSignalSemaphores = &bindSparseSemaphore;
+
+		// Image memory binds
+		imageMemoryBindInfo.image = image;
+		imageMemoryBindInfo.bindCount = static_cast<uint32_t>(sparseImageMemoryBinds.size());
+		imageMemoryBindInfo.pBinds = sparseImageMemoryBinds.data();
+		bindSparseInfo.imageBindCount = (imageMemoryBindInfo.bindCount > 0) ? 1 : 0;
+		bindSparseInfo.pImageBinds = &imageMemoryBindInfo;
+
+		// Opaque image memory binds (mip tail)
+		opaqueMemoryBindInfo.image = image;
+		opaqueMemoryBindInfo.bindCount = static_cast<uint32_t>(opaqueMemoryBinds.size());
+		opaqueMemoryBindInfo.pBinds = opaqueMemoryBinds.data();
+		bindSparseInfo.imageOpaqueBindCount = (opaqueMemoryBindInfo.bindCount > 0) ? 1 : 0;
+		bindSparseInfo.pImageOpaqueBinds = &opaqueMemoryBindInfo;
+
+		uint32_t memBackedPages(0);
+		for (auto page : pages)
+		{
+			if (page.imageMemoryBind.memory != VK_NULL_HANDLE)
+			{
+				memBackedPages++;
+			}
+		}
+		std::cout << "Bound " << memBackedPages << " memory backed virtual pages " << std::endl;
+	}
+
+	// Release all Vulkan resources
+	void destroy()
+	{
+		for (auto page : pages)
+		{
+			page.release(device);
+		}
+		for (auto bind : opaqueMemoryBinds)
+		{
+			vkFreeMemory(device, bind.memory, nullptr);
+		}
+	}
+};
+
+uint32_t memoryTypeIndex;
+
 class VulkanExample : public VulkanExampleBase
 {
 public:
 	//todo: comments
-	struct SparseTexture {
+	struct SparseTexture : VirtualTexture {
 		VkSampler sampler;
-		VkImage image;
 		VkImageLayout imageLayout;
 		VkImageView view;
 		VkDescriptorImageInfo descriptor;
@@ -55,10 +194,6 @@
 		uint32_t width, height;
 		uint32_t mipLevels;
 		uint32_t layerCount;
-		std::vector<VkSparseImageMemoryBind> residencyMemoryBinds;		// Sparse image mempory bindings for the resident part of the image
-		std::vector<VkSparseMemoryBind>	opaqueMemoryBinds;				// Sparse memory bindings for the mip tail (if present)
-		VkSparseImageMemoryBindInfo imageMemoryBindInfo;				// Bind info for queue
-		VkSparseImageOpaqueMemoryBindInfo opaqueMemoryBindInfo;			// Opaque bind info for queue
 	} texture;

 	struct {
@@ -89,7 +224,6 @@
 	VkDescriptorSetLayout descriptorSetLayout;

 	//todo: comment
-	VkBindSparseInfo bindSparseInfo;
 	VkSemaphore bindSparseSemaphore = VK_NULL_HANDLE;

 	// Device features to be enabled for this example
@@ -129,74 +263,6 @@
 		uniformBufferVS.destroy();
 	}

-	// Create an image memory barrier for changing the layout of
-	// an image and put it into an active command buffer
-	void setImageLayout(VkCommandBuffer cmdBuffer, VkImage image, VkImageAspectFlags aspectMask, VkImageLayout oldImageLayout, VkImageLayout newImageLayout, VkImageSubresourceRange subresourceRange)
-	{
-		// Create an image barrier object
-		VkImageMemoryBarrier imageMemoryBarrier = vkTools::initializers::imageMemoryBarrier();;
-		imageMemoryBarrier.oldLayout = oldImageLayout;
-		imageMemoryBarrier.newLayout = newImageLayout;
-		imageMemoryBarrier.image = image;
-		imageMemoryBarrier.subresourceRange = subresourceRange;
-
-		// Only sets masks for layouts used in this example
-		// For a more complete version that can be used with other layouts see vkTools::setImageLayout
-
-		// Source layouts (old)
-		switch (oldImageLayout)
-		{
-		case VK_IMAGE_LAYOUT_UNDEFINED:
-			// Only valid as initial layout, memory contents are not preserved
-			// Can be accessed directly, no source dependency required
-			imageMemoryBarrier.srcAccessMask = 0;
-			break;
-		case VK_IMAGE_LAYOUT_PREINITIALIZED:
-			// Only valid as initial layout for linear images, preserves memory contents
-			// Make sure host writes to the image have been finished
-			imageMemoryBarrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
-			break;
-		case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL:
-			// Old layout is transfer destination
-			// Make sure any writes to the image have been finished
-			imageMemoryBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
-			break;
-		}
-
-		// Target layouts (new)
-		switch (newImageLayout)
-		{
-		case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL:
-			// Transfer source (copy, blit)
-			// Make sure any reads from the image have been finished
-			imageMemoryBarrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
-			break;
-		case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL:
-			// Transfer destination (copy, blit)
-			// Make sure any writes to the image have been finished
-			imageMemoryBarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
-			break;
-		case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
-			// Shader read (sampler, input attachment)
-			imageMemoryBarrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
-			break;
-		}
-
-		// Put barrier on top of pipeline
-		VkPipelineStageFlags srcStageFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
-		VkPipelineStageFlags destStageFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
-
-		// Put barrier inside setup command buffer
-		vkCmdPipelineBarrier(
-			cmdBuffer,
-			srcStageFlags,
-			destStageFlags,
-			VK_FLAGS_NONE,
-			0, nullptr,
-			0, nullptr,
-			1, &imageMemoryBarrier);
-	}
-
 	glm::uvec3 alignedDivision(const VkExtent3D& extent, const VkExtent3D& granularity)
 	{
 		glm::uvec3 res;
@@ -208,6 +274,7 @@

 	void prepareSparseTexture(uint32_t width, uint32_t height, uint32_t layerCount, VkFormat format)
 	{
+		texture.device = vulkanDevice->logicalDevice;
 		texture.width = width;
 		texture.height = height;
 		texture.mipLevels = floor(log2(std::max(width, height))) + 1; //todo
@@ -323,7 +390,7 @@
 		// todo:
 		// Calculate number of required sparse memory bindings by alignment
 		assert((sparseImageMemoryReqs.size % sparseImageMemoryReqs.alignment) == 0);
-		uint32_t memoryTypeIndex = vulkanDevice->getMemoryType(sparseImageMemoryReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+		memoryTypeIndex = vulkanDevice->getMemoryType(sparseImageMemoryReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);

 		// Get sparse bindings
 		uint32_t sparseBindsCount = static_cast<uint32_t>(sparseImageMemoryReqs.size / sparseImageMemoryReqs.alignment);
@@ -365,36 +432,28 @@
 					{
 						for (uint32_t x = 0; x < sparseBindCounts.x; x++)
 						{
-
-							if ((x % 2 == 1) || (y % 2 == 1))
-								continue;
-
+							// Offset
 							VkOffset3D offset;
 							offset.x = x * imageGranularity.width;
 							offset.y = y * imageGranularity.height;
 							offset.z = z * imageGranularity.depth;
-
+							// Size of the page
 							VkExtent3D extent;
 							extent.width = (x == sparseBindCounts.x - 1) ? lastBlockExtent.x : imageGranularity.width;
 							extent.height = (y == sparseBindCounts.y - 1) ? lastBlockExtent.y : imageGranularity.height;
 							extent.depth = (z == sparseBindCounts.z - 1) ? lastBlockExtent.z : imageGranularity.depth;

-							// Allocate memory for this sparse block
-							VkMemoryAllocateInfo allocInfo = vkTools::initializers::memoryAllocateInfo();
-							allocInfo.allocationSize = sparseImageMemoryReqs.alignment;
-							allocInfo.memoryTypeIndex = memoryTypeIndex;
-
-							VkDeviceMemory deviceMemory;
-							VK_CHECK_RESULT(vkAllocateMemory(device, &allocInfo, nullptr, &deviceMemory));
-
-							// Sparse image memory binding
-							VkSparseImageMemoryBind sparseImageMemoryBind{};
-							sparseImageMemoryBind.subresource = subResource;
-							sparseImageMemoryBind.extent = extent;
-							sparseImageMemoryBind.offset = offset;
-							sparseImageMemoryBind.memory = deviceMemory;
-
-							texture.residencyMemoryBinds.push_back(sparseImageMemoryBind);
+							// Add new virtual page
+							VirtualTexturePage *newPage = texture.addPage(offset, extent, sparseImageMemoryReqs.alignment, mipLevel, layer);
+							newPage->imageMemoryBind.subresource = subResource;
+
+							if ((x % 2 == 1) || (y % 2 == 1))
+							{
+								// Allocate memory for this virtual page
+								newPage->allocate(device, memoryTypeIndex);
+							}
+
+							index++;
 						}
 					}
 				}
@@ -421,6 +480,10 @@
 			}
 		} // end layers and mips

+		std::cout << "Texture info:" << std::endl;
+		std::cout << "\tDim: " << texture.width << " x " << texture.height << std::endl;
+		std::cout << "\tVirtual pages: " << texture.pages.size() << std::endl;
+
 		// Check if format has one mip tail for all layers
 		if ((sparseMemoryReq.formatProperties.flags & VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT) && (sparseMemoryReq.imageMipTailFirstLod < texture.mipLevels))
 		{
@@ -446,31 +509,11 @@
 		VK_CHECK_RESULT(vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &bindSparseSemaphore));

 		// Prepare bind sparse info for reuse in queue submission
-		bindSparseInfo = vkTools::initializers::bindSparseInfo();
-		//bindSparseInfo.signalSemaphoreCount = 1;
-		//bindSparseInfo.pSignalSemaphores = &bindSparseSemaphore;
-
-		if (texture.residencyMemoryBinds.size() > 0)
-		{
-			texture.imageMemoryBindInfo.image = texture.image;
-			texture.imageMemoryBindInfo.bindCount = static_cast<uint32_t>(texture.residencyMemoryBinds.size());
-			texture.imageMemoryBindInfo.pBinds = texture.residencyMemoryBinds.data();
-			bindSparseInfo.imageBindCount = 1;
-			bindSparseInfo.pImageBinds = &texture.imageMemoryBindInfo;
-		}
-
-		if (texture.opaqueMemoryBinds.size() > 0)
-		{
-			texture.opaqueMemoryBindInfo.image = texture.image;
-			texture.opaqueMemoryBindInfo.bindCount = static_cast<uint32_t>(texture.opaqueMemoryBinds.size());
-			texture.opaqueMemoryBindInfo.pBinds = texture.opaqueMemoryBinds.data();
-			bindSparseInfo.imageOpaqueBindCount = 1;
-			bindSparseInfo.pImageOpaqueBinds = &texture.opaqueMemoryBindInfo;
-		}
+		texture.updateSparseBindInfo();

 		// Bind to queue
 		// todo: in draw?
-		vkQueueBindSparse(queue, 1, &bindSparseInfo, VK_NULL_HANDLE);
+		vkQueueBindSparse(queue, 1, &texture.bindSparseInfo, VK_NULL_HANDLE);
 		//todo: use sparse bind semaphore
 		vkQueueWaitIdle(queue);

@@ -517,16 +560,7 @@
 		vkDestroyImageView(device, texture.view, nullptr);
 		vkDestroyImage(device, texture.image, nullptr);
 		vkDestroySampler(device, texture.sampler, nullptr);
-		// Release sparse image memory
-		for (auto residencyBind : texture.residencyMemoryBinds)
-		{
-			vkFreeMemory(device, residencyBind.memory, nullptr);
-		}
-		// Release sparse opqaue memory (mip tail)
-		for (auto opaqueBind : texture.opaqueMemoryBinds)
-		{
-			vkFreeMemory(device, opaqueBind.memory, nullptr);
-		}
+		texture.destroy();
 	}

 	void buildCommandBuffers()
@@ -897,6 +931,41 @@
 		updateTextOverlay();
 	}

+	// Clear all pages of the virtual texture
+	// todo: just for testing
+	void flushVirtualTexture()
+	{
+		vkDeviceWaitIdle(device);
+		for (auto& page : texture.pages)
+		{
+			page.release(device);
+		}
+		texture.updateSparseBindInfo();
+		vkQueueBindSparse(queue, 1, &texture.bindSparseInfo, VK_NULL_HANDLE);
+		//todo: use sparse bind semaphore
+		vkQueueWaitIdle(queue);
+	}
+
+	// Randomly fill pages
+	// todo: just for testing
+	void fillVirtualTexture()
+	{
+		vkDeviceWaitIdle(device);
+		std::default_random_engine rndEngine(std::random_device{}());
+		std::uniform_real_distribution<float> rndDist(0.0f, 1.0f);
+		for (auto& page : texture.pages)
+		{
+			if (rndDist(rndEngine) < 0.5f)
+			{
+				page.allocate(device, memoryTypeIndex);
+			}
+		}
+		texture.updateSparseBindInfo();
+		vkQueueBindSparse(queue, 1, &texture.bindSparseInfo, VK_NULL_HANDLE);
+		//todo: use sparse bind semaphore
+		vkQueueWaitIdle(queue);
+	}
+
 	virtual void keyPressed(uint32_t keyCode)
 	{
 		switch (keyCode)
@@ -909,6 +978,12 @@
 		case GAMEPAD_BUTTON_L1:
 			changeLodBias(-0.1f);
 			break;
+		case KEY_F:
+			flushVirtualTexture();
+			break;
+		case KEY_N:
+			fillVirtualTexture();
+			break;
 		}
 	}


INTEGRATION: CWS fme02 (1.16.8.2.6.5.2.1.46); FILE MERGED 2003/03/21 20:24:26 dvo 1.16.8.2.6.5.2.1.46.6: #105712# change PrinterIndependentLayout property from boolean to const-set 2003/03/15 12:47:08 fme 1.16.8.2.6.5.2.1.46.5: RESYNC: (1.16.8.2.6.5.2.1-1.16.8.2.6.5.2.2); FILE MERGED 2003/03/15 10:48:57 fme 1.16.8.2.6.5.2.1.46.4: #105712# Feature - Printer independent formatting 2003/03/11 10:12:39 fme 1.16.8.2.6.5.2.1.46.3: #105712# Printer independent text formatting 2003/03/06 14:42:43 dvo 1.16.8.2.6.5.2.1.46.2: #105712# add DeviceIndependentLayout property to document settings 2003/03/03 11:17:02 fme 1.16.8.2.6.5.2.1.46.1: #105712# Feature - Printer independent text formatting

--- sw/source/ui/uno/SwXDocumentSettings.cxx
+++ sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: SwXDocumentSettings.cxx,v $
  *
- *  $Revision: 1.22 $
- *
- *  last change: $Author: hr $ $Date: 2003-03-27 15:44:54 $
+ *  $Revision: 1.23 $
+ *
+ *  last change: $Author: vg $ $Date: 2003-04-01 10:14:02 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -81,6 +81,9 @@
 #endif
 #ifndef _COM_SUN_STAR_I18N_XFORBIDDENCHARACTERS_HPP_
 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_PRINTERINDEPENDENTLAYOUT_HPP_
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #endif
 #ifndef _DOC_HXX
 #include <doc.hxx>
@@ -164,7 +167,8 @@
     HANDLE_HORIZONTAL_GRID_SUBDIVISION,
     HANDLE_VERTICAL_GRID_RESOLUTION,
     HANDLE_VERTICAL_GRID_SUBDIVISION,
-    HANDLE_UPDATE_FROM_TEMPLATE
+    HANDLE_UPDATE_FROM_TEMPLATE,
+    HANDLE_PRINTER_INDEPENDENT_LAYOUT
 };

 MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -189,6 +193,8 @@
         { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE,   CPPUTYPE_INT32,             0,   0},
         { RTL_CONSTASCII_STRINGPARAM("SaveVersionOnClose"),         HANDLE_SAVE_VERSION_ON_CLOSE,           CPPUTYPE_BOOLEAN,           0,   0},
         { RTL_CONSTASCII_STRINGPARAM("UpdateFromTemplate"),         HANDLE_UPDATE_FROM_TEMPLATE,            CPPUTYPE_BOOLEAN,           0,   0},
+
+        { RTL_CONSTASCII_STRINGPARAM("PrinterIndependentLayout"),   HANDLE_PRINTER_INDEPENDENT_LAYOUT,      CPPUTYPE_INT16,             0,   0},
 /*
  * As OS said, we don't have a view when we need to set this, so I have to
  * find another solution before adding them to this property set - MTG
@@ -375,9 +381,7 @@
             {
                 if( sPrinterName.getLength() > 0 )
                 {
-                    SfxPrinter *pPrinter = mpDoc->GetPrt();
-                    if ( !pPrinter )
-                        pPrinter = mpDoc->GetPrt ( sal_True );
+                    SfxPrinter* pPrinter = mpDoc->GetPrt( sal_True );
                     if ( OUString ( pPrinter->GetName()) != sPrinterName )
                     {
                         SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
@@ -421,15 +425,6 @@
                     // set printer only once; in _postSetValues
                     delete mpPrinter;
                     mpPrinter = pPrinter;
-
-                    if ( !pPrinter->IsOriginal() )
-                    {
-                        mpDocSh->UpdateFontList();
-                        SdrModel * pDrawModel = mpDoc->GetDrawModel();
-                        if ( pDrawModel )
-                            pDrawModel->SetRefDevice( pPrinter );
-                        mpDoc->SetOLEPrtNotifyPending();
-                    }
                 }
             }
             else
@@ -506,6 +501,18 @@
         {
             sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
             mpDocSh->GetDocInfo().SetQueryLoadTemplate( bTmp );
+        }
+        break;
+        case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+        {
+            sal_Int16 nTmp;
+            rValue >>= nTmp;
+            if( (nTmp == document::PrinterIndependentLayout::ENABLED ) ||
+                (nTmp == document::PrinterIndependentLayout::DISABLED ) )
+                mpDoc->SetUseVirtualDevice(
+                    nTmp == document::PrinterIndependentLayout::ENABLED  );
+            else
+                throw IllegalArgumentException();
         }
         break;
         default:
@@ -663,6 +670,14 @@
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
+        case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+        {
+            sal_Int16 nTmp = mpDoc->IsUseVirtualDevice()
+                ? document::PrinterIndependentLayout::ENABLED
+                : document::PrinterIndependentLayout::DISABLED;
+            rValue <<= nTmp;
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }


Fix return opcode handling

Fix return opcode handling

--- thinglang/runtime/containers/MethodDefinition.cpp
+++ thinglang/runtime/containers/MethodDefinition.cpp
@@ -11,14 +11,16 @@
         Program::frame()[i] = Program::pop();
     }

-    for (int counter = 0; counter < symbols.size();) {
+    auto counter_end = symbols.size();
+
+    for (auto counter = 0; counter < counter_end;) {
         auto symbol = symbols[counter];

         std::cerr << "[" << counter << "] Executing symbol " << describe(symbol.opcode) << ": " << symbol.target << ", "
                   << symbol.secondary << " -> [";
         std::for_each(Program::frame().begin(), Program::frame().end(),
                       [](const PThingInstance &thing) { std::cerr << (thing ? thing->text() : "?") << ","; });
-        std::cerr << "] -> ";
+        std::cerr << "] -> [";
         std::for_each(Program::static_data.begin(), Program::static_data.end(),
                       [](const PThingInstance &thing) { std::cerr << (thing ? thing->text() : "?") << ","; });
         std::cerr << "]" << std::endl;
@@ -82,8 +84,8 @@
             }

             case Opcode::RETURN: {
-                Program::pop_frame();
-                break;
+                counter = counter_end;
+                continue;
             }

             case Opcode::JUMP: {


- Fix translation vector join.

- Fix translation vector join.

--- tdv/src/vectorize.cpp
+++ tdv/src/vectorize.cpp
@@ -1088,9 +1088,10 @@
     try
     {
         std::ifstream ifile(meaningFilename);
+        ifile.exceptions(std::ifstream::eofbit | std::ifstream::failbit | std::ifstream::badbit);
         ifile >> meaningList;
     }
-    catch (std::ifstream::failure)
+    catch (std::system_error& e)
     {
         std::cerr << "Error opening meaning file: " << meaningFilename << ". Preloading vectors from DB." << std::endl;
         preloadVectors();
@@ -1298,7 +1299,7 @@

                         if (translMeaning.descr == meaning.term ||
                             translMeaning.descr == meaning.descr ||
-                            (translDescr.size() > 1 && translDescr[1] == meaning.term))
+                            (translDescr.size() > 1 && (translDescr[0].find(meaning.term) != string::npos || translDescr[1].find(meaning.term) != string::npos)))
                         {
                             translationVectorJoin(vecIt->first, meaning, translMeaning);
                         }


Made some improvements to tail_drop_map

Made some improvements to tail_drop_map

--- time_steward_under_construction/tail_drop_map.hpp
+++ time_steward_under_construction/tail_drop_map.hpp
@@ -30,25 +30,28 @@
 void insert (key, value), which inserts an element into the map, and
 tail_drop (key), which removes and returns all elements with keys after key, not necessarily in order.

-Inserting at the end is O(1) worst case.
-Inserting elsewhere is O(1), but incurs a debt of up to O(log n) which will be paid off later by tail_drop.
+Inserting at the end is O(1) amortized.
+Inserting elsewhere is O(1), but incurs a debt of O(log n) which will be paid off later by tail_drop.
 tail_drop is merely O(number of things returned), plus paying off the debt.

 Since the results of tail_drop don't actually need to be sorted,
 we delay all or part of the O(log n) cost of sorting for as long as we can,
 in the hopes of never having to pay it at all.

-There is also discard_head (key), which can be used to save memory by assuring the tail_drop_map that you won't query before key, so it can discard some data that it knows will never be used. However, it does not guarantee that all data before key will be discarded.
+There is also discard_head (key), which can be used to save memory
+by assuring the tail_drop_map that you won't query before key,
+so it can discard some data that it knows will never be used.
+However, it does not guarantee that all data before key will be discarded.

 */

 template <typename key_type, typename mapped_type>
 class tail_drop_map {
 private:
+  typedef std:: pair <key_type, mapped_type> value_type;
   //the "bucket" type is used only for collecting unsorted elements
   //1 at a time, then eventually iterating them and dumping them all out.
-  typedef std:: vector bucket;
-  typedef std:: pair <key_type, mapped_type> value_type;
+  typedef std:: vector <value_type> bucket;

   struct sorted_element {
     sorted_element (value_type const & value): value (value) {}


Revert 112937 - Suppress unitialized use of memory for random_number_ seed

I'm going to TBR this, since it causes a bunch of redness
on the tree, and is really a supression.

tbr=rtenneti,mk
bug=106326
Review URL: http://codereview.chromium.org/8792005

TBR=jar@chromium.org
Review URL: http://codereview.chromium.org/8796005

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

--- base/tracked_objects.cc
+++ base/tracked_objects.cc
@@ -9,7 +9,6 @@
 #include "base/format_macros.h"
 #include "base/message_loop.h"
 #include "base/stringprintf.h"
-#include "base/third_party/valgrind/memcheck.h"
 #include "base/threading/thread_restrictions.h"
 #include "build/build_config.h"
 #include "base/port.h"
@@ -219,8 +218,6 @@
 ThreadData::~ThreadData() {}

 void ThreadData::PushToHeadOfList() {
-  VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_,
-                                           sizeof(random_number_));
   // Toss in a hint of randomness (atop the uniniitalized value).
   random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0));
   random_number_ ^= (Now() - TrackedTime()).InMilliseconds();


added integers spec test

added integers spec test

--- tst/EvalSpec.cpp
+++ tst/EvalSpec.cpp
@@ -10,6 +10,24 @@

 namespace
 {
+  TEST(EvalSpec, PositiveIntegerExp)
+  {
+    std::stringstream code("123");
+
+    pExp exp = eval(read(code));
+    EXPECT_EQ(exp->WhoAmI(), "ValueExp");
+    EXPECT_EQ("123", print(exp));
+  }
+
+  TEST(EvalSpec, NegativeIntegerExp)
+  {
+    std::stringstream code("-456");
+
+    pExp exp = eval(read(code));
+    EXPECT_EQ(exp->WhoAmI(), "ValueExp");
+    EXPECT_EQ("-456", print(exp));
+  }
+
   TEST(EvalSpec, EmptyListExp)
   {
     std::stringstream code("()");


have main() return 0; (bug #718941)

have main() return 0; (bug #718941)

--- tests/testmain.cpp
+++ tests/testmain.cpp
@@ -97,4 +97,6 @@
 			log4cpp::NDC::pop();
 		}
 	}
+
+	return 0;
 }


Protect the script in case the canvas is deleted while the script is running.

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

--- tutorials/anim.C
+++ tutorials/anim.C
@@ -22,6 +22,7 @@
 }
 void Animate()
 {
+   if (!gROOT->GetListOfCanvases()->FindObject("c1")) return; //just in case the canvas has been deleted
    t += 0.05*pi;
    f2->SetParameter(0,TMath::Cos(t));
    phi += 2;


rename sNames -> StmtClassInfo.  Make lookups constant time.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@41390 91177308-0d34-0410-b5e6-96231b3b80d8

--- AST/Stmt.cpp
+++ AST/Stmt.cpp
@@ -18,54 +18,63 @@
 using namespace clang;

 static struct StmtClassNameTable {
-  int enumValue;
-  const char *className;
-  unsigned counter;
-  unsigned size;
-} sNames[] = {
-#define STMT(N, CLASS, PARENT) { N, #CLASS, 0, sizeof(CLASS) },
+  const char *Name;
+  unsigned Counter;
+  unsigned Size;
+} StmtClassInfo[Stmt::lastExprConstant];
+
+static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
+  static bool Initialized = false;
+  if (Initialized)
+    return StmtClassInfo[E];
+
+  // Intialize the table on the first use.
+  Initialized = true;
+#define STMT(N, CLASS, PARENT) \
+  StmtClassInfo[N].Name = #CLASS; \
+  StmtClassInfo[N].Size = sizeof(CLASS);
 #include "clang/AST/StmtNodes.def"
-  { 0, 0, 0, 0 }
-};

+  return StmtClassInfo[E];
+}
+
 const char *Stmt::getStmtClassName() const {
-  for (int i = 0; sNames[i].className; i++) {
-    if (sClass == sNames[i].enumValue)
-      return sNames[i].className;
-  }
-  return 0; // should never happen....
+  return getStmtInfoTableEntry(sClass).Name;
 }

 void Stmt::PrintStats() {
+  // Ensure the table is primed.
+  getStmtInfoTableEntry(Stmt::NullStmtClass);
+
   unsigned sum = 0;
   fprintf(stderr, "*** Stmt/Expr Stats:\n");
-  for (int i = 0; sNames[i].className; i++) {
-    sum += sNames[i].counter;
+  for (int i = 0; i != Stmt::lastExprConstant; i++) {
+    if (StmtClassInfo[i].Name == 0) continue;
+    sum += StmtClassInfo[i].Counter;
   }
   fprintf(stderr, "  %d stmts/exprs total.\n", sum);
   sum = 0;
-  for (int i = 0; sNames[i].className; i++) {
+  for (int i = 0; i != Stmt::lastExprConstant; i++) {
+    if (StmtClassInfo[i].Name == 0) continue;
     fprintf(stderr, "    %d %s, %d each (%d bytes)\n",
-      sNames[i].counter, sNames[i].className, sNames[i].size, sNames[i].counter*sNames[i].size);
-    sum += sNames[i].counter*sNames[i].size;
+            StmtClassInfo[i].Counter, StmtClassInfo[i].Name,
+            StmtClassInfo[i].Size,
+            StmtClassInfo[i].Counter*StmtClassInfo[i].Size);
+    sum += StmtClassInfo[i].Counter*StmtClassInfo[i].Size;
   }
   fprintf(stderr, "Total bytes = %d\n", sum);
 }

 void Stmt::addStmtClass(StmtClass s) {
-  for (int i = 0; sNames[i].className; i++) {
-    if (s == sNames[i].enumValue)
-      sNames[i].counter++;
-  }
+  ++getStmtInfoTableEntry(s).Counter;
 }

 static bool StatSwitch = false;

 bool Stmt::CollectingStats(bool enable) {
   if (enable) StatSwitch = true;
-	return StatSwitch;
+  return StatSwitch;
 }
-

 const char *LabelStmt::getName() const {


Working on basic cactus stack

Working on basic cactus stack

--- test/cactus-basic.cpp
+++ test/cactus-basic.cpp
@@ -22,6 +22,7 @@
     class frame {
     public:
       int v;
+      parent_link_type plt;
     };

     /* Frame */
@@ -44,7 +45,7 @@
     };

     bool is_marked(frame& f) {
-      return f.s.plt == Parent_link_async;
+      return f.plt == Parent_link_async;
     }

     fork_result_type fork_mark(reference_stack_type& s) {
@@ -84,35 +85,35 @@
       trace_tag_type tag;
       struct {
         frame f;
-        std::unique_ptr<struct trace_struct> k;
+        std::shared_ptr<struct trace_struct> k;
       } push_back;
       struct {
-        std::unique_ptr<struct trace_struct> k;
+        std::shared_ptr<struct trace_struct> k;
       } pop_back;
       struct fork_mark_struct {
-        std::unique_ptr<struct trace_struct> k1;
-        std::unique_ptr<struct trace_struct> k2;
+        std::shared_ptr<struct trace_struct> k1;
+        std::shared_ptr<struct trace_struct> k2;
       } fork_mark;
     };

     using trace_type = struct trace_struct;

-    trace_type mk_push_back(frame f) {
-      trace_type t;
-      t.tag = Trace_push_back;
-      t.push_back.f = f;
+    trace_type* mk_push_back(frame f) {
+      trace_type* t = new trace_type;
+      t->tag = Trace_push_back;
+      t->push_back.f = f;
       return t;
     }

-    trace_type mk_pop_back() {
-      trace_type t;
-      t.tag = Trace_pop_back;
+    trace_type* mk_pop_back() {
+      trace_type* t = new trace_type;
+      t->tag = Trace_pop_back;
       return t;
     }

-    trace_type mk_fork_mark() {
-      trace_type t;
-      t.tag = Trace_fork_mark;
+    trace_type* mk_fork_mark() {
+      trace_type* t = new trace_type;
+      t->tag = Trace_fork_mark;
       return t;
     }

@@ -129,19 +130,116 @@
     using machine_config_type = struct machine_config_struct {
       machine_tag_type tag;
       struct {
-        std::unique_ptr<struct machine_config_struct> m1;
-        std::unique_ptr<struct machine_config_struct> m2;
+        std::shared_ptr<struct machine_config_struct> m1;
+        std::shared_ptr<struct machine_config_struct> m2;
       } fork_mark;
       thread_config_type thread;
     };

+    template <class Coin_flip>
+    machine_config_type step(const Coin_flip& coin_flip, machine_config_type& m) {
+      machine_config_type n;
+      n.tag = Machine_stuck;
+      switch (m.tag) {
+        case Machine_fork_mark: {
+          n.tag = Machine_fork_mark;
+          if (coin_flip()) {
+            *n.fork_mark.m1 = step(coin_flip, *m.fork_mark.m1);
+            n.fork_mark.m2.swap(m.fork_mark.m2);
+          } else {
+            n.fork_mark.m1.swap(m.fork_mark.m1);
+            *n.fork_mark.m2 = step(coin_flip, *m.fork_mark.m2);
+          }
+          break;
+        }
+        case Machine_thread: {
+          thread_config_type& tc_m = m.thread;
+          thread_config_type& tc_n = n.thread;
+          switch (tc_m.t.tag) {
+            case Trace_fork_mark: {
+              n.tag = Machine_fork_mark;
+              auto mp = fork_mark(tc_m.ms);
+              auto rp = fork_mark(tc_m.rs);
+              reference_stack_type rs1, rs2;
+              if (rp.tag == Fork_result_some) {
+                rs1 = rp.s1;
+                rs1.push_back(rp.f1);
+                rs2 = rp.s2;
+                rs2.push_back(rp.f2);
+              } else {
+                rs1 = tc_m.rs;
+              }
+              n.fork_mark.m1.reset(new machine_config_type);
+              n.fork_mark.m2.reset(new machine_config_type);
+              machine_config_type& m1 = *n.fork_mark.m1;
+              machine_config_type& m2 = *n.fork_mark.m2;
+              m1.tag = Machine_thread;
+              m1.thread.t = std::move(*tc_m.t.fork_mark.k1);
+              m1.thread.ms = mp.first;
+              m1.thread.rs = rs1;
+              m2.tag = Machine_thread;
+              m2.thread.t = std::move(*tc_m.t.fork_mark.k2);
+              m2.thread.ms = mp.second;
+              m2.thread.rs = rs2;
+              break;
+            }
+            case Trace_push_back: {
+              frame f = tc_m.t.push_back.f;
+              n.tag = Machine_thread;
+              tc_n.rs = tc_m.rs;
+              tc_n.rs.push_back(f);
+              auto init_fn = [&] (char* p) {
+                new ((frame*)p) frame(f);
+              };
+              tc_n.ms = push_back<sizeof(frame),decltype(init_fn)>(tc_m.ms, f.plt, init_fn);
+              break;
+            }
+            case Trace_pop_back: {
+              n.tag = Machine_thread;
+              tc_n.rs = tc_m.rs;
+              tc_n.rs.pop_back();
+              auto destr_fn = [&] (char* p) {
+                ((frame*)(p))->~frame();
+              };
+              tc_n.ms = pop_back(tc_m.ms, destr_fn);
+              break;
+            }
+            default: {
+              assert(false); // todo
+            }
+          }
+          break;
+        }
+        case Machine_stuck: {
+          break;
+        }
+        default: {
+          break;
+        }
+      }
+      return n;
+    }
+
     /* Trace */
     /*------------------------------*/
+
+    void ex1() {
+      frame f;
+      f.v = 123;
+      auto t2 = mk_push_back(f);
+      t2->push_back.k.reset(mk_pop_back());
+      machine_config_type m;
+      step([&] {
+        return rand() % 2 == 0;
+      }, m);
+    }

   } // end namespace
 } // end namespace

 int main(int argc, const char * argv[]) {
-  std::cout << "Hello, World!\n";
+  std::cout << "starting\n";
+  cactus_stack::basic::ex1();
+  std::cout << "finished\n";
   return 0;
 }


Removed some extra stuff in the comment/newline in flow map tests, which really should be illegal (since implicit keys can't span multiple lines). It would be impossible to fix if we keep the immediate-output we're doing now - the only way to prevent it would be to hold on to a key's text until we got to the value token to make sure it could be an implicit key

--- test/emittertests.cpp
+++ test/emittertests.cpp
@@ -545,12 +545,12 @@
 		void CommentInFlowMap(YAML::Emitter& out, std::string& desiredOutput)
 		{
 			out << YAML::Flow << YAML::BeginMap;
-			out << YAML::Key << "foo" << YAML::Comment("foo!") << YAML::Value << "foo value";
+			out << YAML::Key << "foo" << YAML::Value << "foo value";
 			out << YAML::Key << "bar" << YAML::Value << "bar value" << YAML::Comment("bar!");
-			out << YAML::Key << "baz" << YAML::Comment("baz!") << YAML::Value << "baz value" << YAML::Comment("baz!");
-			out << YAML::EndMap;
-
-			desiredOutput = "{foo  # foo!\n: foo value, bar: bar value  # bar!\n, baz  # baz!\n: baz value  # baz!\n}";
+			out << YAML::Key << "baz" << YAML::Value << "baz value" << YAML::Comment("baz!");
+			out << YAML::EndMap;
+
+			desiredOutput = "{foo: foo value, bar: bar value  # bar!\n, baz: baz value  # baz!\n}";
 		}

 		void Indentation(YAML::Emitter& out, std::string& desiredOutput)
@@ -737,9 +737,9 @@
 		{
 			out << YAML::Flow << YAML::BeginMap;
 			out << YAML::Key << "a" << YAML::Value << "foo" << YAML::Newline;
-			out << YAML::Key << "b" << YAML::Newline << YAML::Value << "bar";
-			out << YAML::EndMap;
-			desiredOutput = "{a: foo\n, b\n: bar}";
+			out << YAML::Key << "b" << YAML::Value << "bar";
+			out << YAML::EndMap;
+			desiredOutput = "{a: foo\n, b: bar}";
 		}

 		void LotsOfNewlines(YAML::Emitter& out, std::string& desiredOutput)


Fixed some tests with the new compact long keys

--- test/emittertests.cpp
+++ test/emittertests.cpp
@@ -191,7 +191,7 @@
 			out << YAML::Value << "demon";
 			out << YAML::EndMap;

-			desiredOutput = "?\n  - 1\n  - 3\n: monster\n? [2, 0]\n: demon";
+			desiredOutput = "? - 1\n  - 3\n: monster\n? [2, 0]\n: demon";
 		}

 		void AutoLongKey(YAML::Emitter& out, std::string& desiredOutput)
@@ -205,7 +205,7 @@
 			out << YAML::Value << "angel";
 			out << YAML::EndMap;

-			desiredOutput = "?\n  - 1\n  - 3\n: monster\n? [2, 0]\n: demon\nthe origin: angel";
+			desiredOutput = "? - 1\n  - 3\n: monster\n? [2, 0]\n: demon\nthe origin: angel";
 		}

 		void ScalarFormat(YAML::Emitter& out, std::string& desiredOutput)
@@ -257,7 +257,7 @@
 			out << "total value";
 			out << YAML::EndMap;

-			desiredOutput = "?\n  key: value\n  next key: next value\n: total value";
+			desiredOutput = "? key: value\n  next key: next value\n: total value";
 		}

 		void AliasAndAnchor(YAML::Emitter& out, std::string& desiredOutput)


Test for shuffle

Test for shuffle

--- test/src/unit_dbn.cpp
+++ test/src/unit_dbn.cpp
@@ -332,3 +332,41 @@

     dbn->pretrain_denoising(noisy, dataset.training_images, 50);
 }
+
+//Batch mode and shuffle
+TEST_CASE("unit/dbn/mnist/11", "[dbn][unit]") {
+    typedef dll::dbn_desc<
+        dll::dbn_layers<
+            dll::rbm_desc<28 * 28, 150, dll::momentum, dll::batch_size<25>, dll::init_weights>::layer_t,
+            dll::rbm_desc<150, 200, dll::momentum, dll::batch_size<25>>::layer_t,
+            dll::rbm_desc<200, 10, dll::momentum, dll::batch_size<25>, dll::hidden<dll::unit_type::SOFTMAX>>::layer_t>,
+        dll::batch_mode, dll::momentum, dll::trainer<dll::sgd_trainer>, dll::batch_size<25>, dll::shuffle>::dbn_t dbn_t;
+
+    auto dataset = mnist::read_dataset_direct<std::vector, etl::dyn_matrix<float, 1>>(250);
+
+    REQUIRE(!dataset.training_images.empty());
+
+    mnist::binarize_dataset(dataset);
+
+    auto dbn = std::make_unique<dbn_t>();
+
+    REQUIRE(dbn->batch_mode());
+
+    dbn->learning_rate = 0.05;
+
+    dbn->pretrain(dataset.training_images, 20);
+
+    auto error = dbn->fine_tune(
+        dataset.training_images.begin(), dataset.training_images.end(),
+        dataset.training_labels.begin(), dataset.training_labels.end(),
+        50);
+
+    REQUIRE(error < 5e-2);
+
+    auto test_error = dll::test_set(dbn, dataset.test_images, dataset.test_labels, dll::predictor());
+    REQUIRE(test_error < 0.25);
+
+    //Mostly here to ensure compilation
+    auto out = dbn->prepare_one_output<etl::dyn_matrix<float, 1>>();
+    REQUIRE(out.size() > 0);
+}


Add test of experimental ftoa_left

Add test of experimental ftoa_left

--- test/test_convert.cpp
+++ test/test_convert.cpp
@@ -726,3 +726,246 @@
     BOOST_CHECK_EQUAL("0xABCDEF1234",      (itoa_bits<uint64_t,false,2>(0xabcdef1234ul)));
     BOOST_CHECK_EQUAL("0xABCDEF1234",      (itoa_bits<uint64_t,false,7>(0xabcdef1234ul)));
 }
+
+
+/* For internal use by sys_double_to_chars_fast() */
+static char* find_first_trailing_zero(char* p)
+{
+    for (; *(p-1) == '0'; --p);
+    if (*(p-1) == '.') ++p;
+    return p;
+}
+
+/* Convert float to string
+ *   decimals must be >= 0
+ *   if compact != 0, the trailing 0's will be truncated
+ */
+int
+sys_double_to_chars_fast(double f, char *buffer, int buffer_size, int decimals,
+			 int compact)
+{
+    static const double pow10v[] = {
+        1e0,  1e1,  1e2,  1e3,  1e4,  1e5,  1e6,  1e7,  1e8, 1e9,
+        1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18
+    };
+
+    static constexpr const int    FRAC_SIZE    = 52;
+    static constexpr const size_t MAX_DECIMALS = (sizeof(pow10v) / sizeof(pow10v[0]));
+    static constexpr const size_t MAX_FLOAT    = ((size_t)1 << (FRAC_SIZE+1));
+
+    double af;
+    size_t int_part, frac_part;
+    int neg;
+    char *p = buffer;
+
+    if (decimals < 0)
+        return -1;
+
+    if (f < 0) {
+        neg = 1;
+        af = -f;
+    }
+    else {
+        neg = 0;
+        af = f;
+    }
+
+    /* Don't bother with optimizing too large numbers or too large precision */
+    if (af > MAX_FLOAT || decimals >= long(MAX_DECIMALS)) {
+        int len = snprintf(buffer, buffer_size, "%.*f", decimals, f);
+        char* p = buffer + len;
+        if (len >= buffer_size)
+            return -1;
+        /* Delete trailing zeroes */
+        if (compact)
+            p = find_first_trailing_zero(p);
+        *p = '\0';
+        return p - buffer;
+    }
+
+    if (decimals) {
+        double int_f = floor(af);
+        double frac_f = round((af - int_f) * pow10v[decimals]);
+
+        int_part = (size_t)int_f;
+        frac_part = (size_t)frac_f;
+
+        if (frac_f >= pow10v[decimals]) {
+            /* rounding overflow carry into int_part */
+            int_part++;
+            frac_part = 0;
+        }
+
+        do {
+            if (!frac_part) {
+                do {
+                    *p++ = '0';
+                } while (--decimals);
+                break;
+            }
+            *p++ = (char)((frac_part % 10) + '0');
+            frac_part /= 10;
+        } while (--decimals);
+
+        *p++ = '.';
+    }
+    else
+        int_part = (size_t)lround(af);
+
+    if (!int_part) {
+        *p++ = '0';
+    } else {
+        do {
+            *p++ = (char)((int_part % 10) + '0');
+            int_part /= 10;
+        }while (int_part);
+    }
+    if (neg)
+        *p++ = '-';
+
+    {/* Reverse string */
+        int i = 0;
+        int j = p - buffer - 1;
+        for ( ; i < j; i++, j--) {
+            char tmp = buffer[i];
+            buffer[i] = buffer[j];
+            buffer[j] = tmp;
+        }
+    }
+
+    /* Delete trailing zeroes */
+    if (compact)
+        p = find_first_trailing_zero(p);
+    *p = '\0';
+    return p - buffer;
+}
+
+BOOST_AUTO_TEST_CASE( test_convert_ftoa2 )
+{
+    char buf[32];
+    int n = sys_double_to_chars_fast(0.6, buf, sizeof(buf), 3, false);
+    BOOST_CHECK_EQUAL("0.600", buf);
+    BOOST_CHECK_EQUAL(5, n);
+
+    n = sys_double_to_chars_fast(123.19, buf, sizeof(buf), 3, true);
+    BOOST_CHECK_EQUAL("123.19", buf);
+    BOOST_CHECK_EQUAL(6, n);
+
+    n = sys_double_to_chars_fast(0.999, buf, sizeof(buf), 2, false);
+    BOOST_CHECK_EQUAL("1.00", buf);
+    BOOST_CHECK_EQUAL(4, n);
+
+    // Note that 1.005 is really 1.0049999999...
+    n = sys_double_to_chars_fast(1.005, buf, sizeof(buf), 2, false);
+    BOOST_CHECK_EQUAL("1.00", buf);
+    BOOST_CHECK_EQUAL(4, n);
+
+    // Note that 1.005 is really 1.0049999999...
+    n = sys_double_to_chars_fast(1.005, buf, sizeof(buf), 2, true);
+    BOOST_CHECK_EQUAL("1.0", buf);
+    BOOST_CHECK_EQUAL(3, n);
+
+    n = sys_double_to_chars_fast(-1.005, buf, sizeof(buf), 2, false);
+    BOOST_CHECK_EQUAL("-1.00", buf);
+    BOOST_CHECK_EQUAL(5, n);
+
+    n = sys_double_to_chars_fast(-1.005, buf, sizeof(buf), 2, true);
+    BOOST_CHECK_EQUAL("-1.0", buf);
+    BOOST_CHECK_EQUAL(4, n);
+
+    n = sys_double_to_chars_fast(0.145, buf, sizeof(buf), 1, true);
+    BOOST_CHECK_EQUAL("0.1", buf);
+    BOOST_CHECK_EQUAL(3, n);
+
+    n = sys_double_to_chars_fast(-1.0, buf, sizeof(buf), 20, false);
+    BOOST_CHECK_EQUAL("-1.00000000000000000000", buf);
+    BOOST_CHECK_EQUAL(23, n);
+
+    union {double d; int64_t i;} f;
+    f.i = 0x7ff0000000000000ll;
+    n = sys_double_to_chars_fast(f.d, buf, sizeof(buf), 29, true);
+    BOOST_CHECK_EQUAL("inf", buf);
+    BOOST_CHECK_EQUAL(3, n);
+
+    f.i = 0xfff0000000000000ll;
+    n = sys_double_to_chars_fast(f.d, buf, sizeof(buf), 29, true);
+    BOOST_CHECK_EQUAL("-inf", buf);
+    BOOST_CHECK_EQUAL(4, n);
+
+    f.i = 0x7ff0000000000001ll;
+    n = sys_double_to_chars_fast(f.d, buf, sizeof(buf), 29, true);
+    BOOST_CHECK_EQUAL("nan", buf);
+    BOOST_CHECK_EQUAL(3, n);
+
+    f.i = 0xfff0000000000001ll;
+    n = sys_double_to_chars_fast(f.d, buf, sizeof(buf), 29, true);
+    BOOST_CHECK_EQUAL("-nan", buf);
+    BOOST_CHECK_EQUAL(4, n);
+
+    n = sys_double_to_chars_fast(1.0, buf, sizeof(buf), 29, true);
+    BOOST_CHECK_EQUAL("1.0", buf);
+    BOOST_CHECK_EQUAL(3, n);
+
+    n = sys_double_to_chars_fast(1.0, buf, sizeof(buf), 30, true);
+    BOOST_CHECK_EQUAL(-1, n);
+
+    using boost::timer::cpu_timer;
+    using boost::timer::cpu_times;
+    using boost::timer::nanosecond_type;
+
+    const long ITERATIONS = getenv("ITERATIONS") ? atoi(getenv("ITERATIONS")) : 1000000;
+    {
+        std::vector<double> data;
+        char buf1[256], buf2[256], buf3[256];
+
+        for (int i=0; i < 100000; ++i)
+            data.push_back(double(rand()) / (double(RAND_MAX)/100000));
+
+        {
+            cpu_timer t;
+            for (int i=0, j=-1; i < ITERATIONS; i++) {
+                if (++j == data.size()) j = 0;
+                auto n1 = sys_double_to_chars_fast(data[j], buf1, sizeof(buf1), 10, true);
+            }
+            cpu_times elapsed_times(t.elapsed());
+            nanosecond_type t1 = elapsed_times.system + elapsed_times.user;
+
+            std::stringstream s;
+            s << boost::format("         new: %.3fs (%.3fus/call)")
+                % ((double)t1 / 1000000000.0) % ((double)t1 / ITERATIONS / 1000.0);
+            BOOST_TEST_MESSAGE(s.str());
+        }
+        {
+            cpu_timer t;
+            for (int i=0, j=-1; i < ITERATIONS; i++) {
+                if (++j == data.size()) j = 0;
+                auto n1 = ftoa_left(data[j], buf2, sizeof(buf2), 10, true);
+            }
+            cpu_times elapsed_times(t.elapsed());
+            nanosecond_type t1 = elapsed_times.system + elapsed_times.user;
+
+            std::stringstream s;
+            s << boost::format("         old: %.3fs (%.3fus/call)")
+                % ((double)t1 / 1000000000.0) % ((double)t1 / ITERATIONS / 1000.0);
+            BOOST_TEST_MESSAGE(s.str());
+        }
+        {
+            cpu_timer t;
+            for (int i=0, j=-1; i < ITERATIONS; i++) {
+                if (++j == data.size()) j = 0;
+                auto n1 = snprintf(buf3, sizeof(buf3), "%.*f", 10, data[j]);
+            }
+            cpu_times elapsed_times(t.elapsed());
+            nanosecond_type t1 = elapsed_times.system + elapsed_times.user;
+
+            std::stringstream s;
+            s << boost::format("         prn: %.3fs (%.3fus/call)")
+                % ((double)t1 / 1000000000.0) % ((double)t1 / ITERATIONS / 1000.0);
+            BOOST_TEST_MESSAGE(s.str());
+        }
+
+        BOOST_CHECK_EQUAL(buf1, buf2);
+        BOOST_CHECK_EQUAL(buf1, buf3);
+        BOOST_CHECK_EQUAL(buf2, buf3);
+    }
+}


wasn't me :)

wasn't me :)

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@1034 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- test/test_feature.cpp
+++ test/test_feature.cpp
@@ -587,7 +587,6 @@
   pfh.setInputCloud (cloud.makeShared ());
   pfh.setIndices (indicesptr);
   pfh.setSearchMethod (tree);
-  pfh.setNrSubdivisions (3);
   pfh.setKSearch (indices.size ());

   // estimate


added test to `void buffer::reserve(std::size_t)`

--- tests/buffer_test.cpp
+++ tests/buffer_test.cpp
@@ -96,6 +96,12 @@
 	// test reserve()
 	void reserve()
 	{
+		x0::buffer buf;
+
+		buf.reserve(1);
+
+		CPPUNIT_ASSERT(buf.size() == 0);
+		CPPUNIT_ASSERT(buf.capacity() == x0::buffer::CHUNK_SIZE);
 	}

 	void clear()


MB-19204: ep_testsuite: Don't release the item while we're using it

Fixes a number of issues detected by ThreadSanitizer.

Change-Id: I6ab6c9fee2497d0843af47647f33bcce73111f76
Reviewed-on: http://review.couchbase.org/62909
Well-Formed: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Will Gardner <cbd6f5d9092d9ef7d5c0510d53bba134b22c02f2@couchbase.com>

--- tests/ep_testsuite.cc
+++ tests/ep_testsuite.cc
@@ -1069,12 +1069,12 @@

     check(h1->get(h, NULL, &i, key1, strlen(key1), 0) == ENGINE_SUCCESS,
             "Unable to get stored item");
-    h1->release(h, NULL, i);
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 1, "Expected JSON");
     check(info.datatype == PROTOCOL_BINARY_DATATYPE_JSON, "Invalid datatype");
+    h1->release(h, NULL, i);

     check(storeCasVb11(h, h1, NULL, OPERATION_APPEND, key1,
                        value2, strlen(value2), 82758, &i, 0, 0)
@@ -1086,11 +1086,11 @@
             "Unable to get stored item");
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
-    h1->release(h, NULL, i);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 0, "Expected Binary");
     check(info.datatype == PROTOCOL_BINARY_RAW_BYTES,
                 "Invalid datatype after append");
+    h1->release(h, NULL, i);

     // PREPEND
     check(storeCasVb11(h, h1, NULL, OPERATION_SET, key2,
@@ -1103,10 +1103,10 @@
             "Unable to get stored item");
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
-    h1->release(h, NULL, i);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 1, "Expected JSON");
     check(info.datatype == PROTOCOL_BINARY_DATATYPE_JSON, "Invalid datatype");
+    h1->release(h, NULL, i);

     check(storeCasVb11(h, h1, NULL, OPERATION_PREPEND, key2,
                        value2, strlen(value2), 82758, &i, 0, 0)
@@ -1116,13 +1116,13 @@

     check(h1->get(h, NULL, &i, key2, strlen(key2), 0) == ENGINE_SUCCESS,
             "Unable to get stored item");
-    h1->release(h, NULL, i);
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 0, "Expected Binary");
     check(info.datatype == PROTOCOL_BINARY_RAW_BYTES,
                 "Invalid datatype after prepend");
+    h1->release(h, NULL, i);

     return SUCCESS;
 }


preprocessor: fix remove variable for objective function

The preprocessor removes too many function elements from the objective
function. This is due to std::find_if and objective.elements.erase(it,
std::end(...)).

--- lib/src/preprocessor.cpp
+++ lib/src/preprocessor.cpp
@@ -125,9 +125,9 @@
 // * factor` to the constant of the objective function.
 //
 static void
-remove_variable(baryonyx::objective_function& obj,
-                int variable_id,
-                int variable_value)
+remove_variable_from_objective(baryonyx::objective_function& obj,
+                               int variable_id,
+                               int variable_value)
 {
     auto it = std::find_if(obj.elements.begin(),
                            obj.elements.end(),
@@ -137,7 +137,7 @@

     if (it != obj.elements.end()) {
         obj.value += (it->factor * variable_value);
-        obj.elements.erase(it, obj.elements.end());
+        obj.elements.erase(it);
     }

     assert(std::find_if(obj.elements.begin(),
@@ -153,7 +153,7 @@

 //
 // Remove the variable from the constraint and add the `factor * value`  to the
-// value of the constaints.
+// value of the constraints.
 //
 static void
 remove_variable(baryonyx::constraint& cst, int variable_id, int variable_value)
@@ -187,12 +187,13 @@
 static void
 remove_variable(baryonyx::problem& pb, int variable_id, int variable_value)
 {
+    printf("remove variable %d value %d\n", variable_id, variable_value);
     pb.affected_vars.push_back(pb.vars.names[variable_id], variable_value);

     pb.vars.names.erase(pb.vars.names.begin() + variable_id);
     pb.vars.values.erase(pb.vars.values.begin() + variable_id);

-    remove_variable(pb.objective, variable_id, variable_value);
+    remove_variable_from_objective(pb.objective, variable_id, variable_value);

     for (auto& elem : pb.equal_constraints)
         remove_variable(elem, variable_id, variable_value);
@@ -221,8 +222,7 @@
                        int index_)
       : hash(hash_constraint(elems))
       , index(index_)
-    {
-    }
+    {}

     std::size_t hash;
     int index;
@@ -493,11 +493,12 @@
 }

 static bool
-try_remove_assigned_variables_101(const std::shared_ptr<baryonyx::context>& ctx,
-                                  baryonyx::problem& pb,
-                                  const baryonyx::constraint& cst,
-                                  baryonyx::operator_type type,
-                                  int& variable)
+try_remove_assigned_variables_101(
+  const std::shared_ptr<baryonyx::context>& ctx,
+  baryonyx::problem& pb,
+  const baryonyx::constraint& cst,
+  baryonyx::operator_type type,
+  int& variable)
 {
     int min = 0, max = 0;
     for (const auto& elem : cst.elements)
@@ -792,7 +793,8 @@
 namespace baryonyx_private {

 void
-preprocess(const std::shared_ptr<baryonyx::context>& ctx, baryonyx::problem& pb)
+preprocess(const std::shared_ptr<baryonyx::context>& ctx,
+           baryonyx::problem& pb)
 {
     ctx->info("preprocessing:\n");


more checks

more checks

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@3955 0785d39b-7218-0410-832d-ea1e28bc413d

--- tests/fe/internals.cc
+++ tests/fe/internals.cc
@@ -27,14 +27,14 @@
   DoFHandler<dim> dof (tr);
   dof.distribute_dofs (finel);

+  cout << name << '<' << dim << '>' << " cell support points" << endl;
+
   vector<Point<dim> > cell_points (finel.dofs_per_cell);
   vector<Point<dim> > face_points (finel.dofs_per_face);

   DoFHandler<dim>::active_cell_iterator cell = dof.begin_active();
   finel.get_support_points (cell, cell_points);

-  cout << name << '<' << dim << '>' << " cell support points" << endl;
-
   for (unsigned int k=0;k<cell_points.size();++k)
     cout << setprecision(3) << cell_points[k] << endl;

@@ -66,31 +66,24 @@
 }

-#define CHECK_S(EL,dim) FE ## EL<dim> EL; check_support(EL, #EL);
-#define CHECK_M(EL,dim) FE ## EL<dim> EL; check_matrices(EL, #EL);
-#define CHECK_ALL(EL,dim) FE ## EL<dim> EL; check_support(EL, #EL); check_matrices(EL,#EL)
+#define CHECK_S(EL,dim) { FE ## EL<dim> EL; check_support(EL, #EL); }
+#define CHECK_M(EL,dim) { FE ## EL<dim> EL; check_matrices(EL, #EL); }
+#define CHECK_ALL(EL,dim) { FE ## EL<dim> EL; check_support(EL, #EL); check_matrices(EL,#EL); }

 int
 main()
 {
-  if (true)
-    {
-      CHECK_ALL(Q1,2);
-      CHECK_ALL(Q2,2);
-      CHECK_ALL(Q3,2);
-      CHECK_ALL(Q4,2);
-      CHECK_ALL(DG_Q0,2);
-      CHECK_ALL(DG_Q1,2);
-      CHECK_ALL(DG_Q2,2);
-      CHECK_ALL(DG_Q3,2);
-    }
-  if (true)
-    {
-      CHECK_ALL(Q1,3);
-      CHECK_ALL(Q2,3);
-      CHECK_ALL(DG_Q0,3);
-      CHECK_ALL(DG_Q1,3);
-    }
-
+  CHECK_M(DG_Q0,2);
+  CHECK_M(DG_Q1,2);
+  CHECK_M(DG_Q2,2);
+  CHECK_M(DG_Q3,2);
+  CHECK_ALL(Q1,2);
+  CHECK_ALL(Q2,2);
+  CHECK_ALL(Q3,2);
+  CHECK_ALL(Q4,2);
+  CHECK_ALL(Q1,3);
+  CHECK_ALL(Q2,3);
+  CHECK_M(DG_Q0,3);
+  CHECK_M(DG_Q1,3);
   return 0;
 }


Review fixes.

Review fixes.

--- storage/storage_helpers.cpp
+++ storage/storage_helpers.cpp
@@ -22,7 +22,9 @@

 bool IsEnoughSpaceForDownload(TMwmSize mwmSize)
 {
-  return GetPlatform().GetWritableStorageStatus(mwmSize) ==
+  // Additional size which is necessary to have on flash card to download file of mwmSize bytes.
+  TMwmSize constexpr kExtraSizeBytes = 10 * 1024 * 1024;
+  return GetPlatform().GetWritableStorageStatus(mwmSize + kExtraSizeBytes) ==
          Platform::TStorageStatus::STORAGE_OK;
 }


[t:3212], fix race condition

[t:3212], fix race condition

git-svn-id: 8b8be7c0f04bb5f9b05983138f06f6333a27d72d@27537 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -6585,6 +6585,7 @@
     lc.ha = this;
     loader_error = 0;
     bool rw_lock_taken = false;
+    bool modified_DBs = false;
     for (u_int32_t i = 0; i < MAX_KEY+1; i++) {
         mult_put_flags[i] = DB_YESOVERWRITE;
         mult_dbt_flags[i] = DB_DBT_REALLOC;
@@ -6634,7 +6635,15 @@
     // they go to the end of share->key_file
     //
     creating_hot_index = use_hot_index && num_of_keys == 1 && (key_info[0].flags & HA_NOSAME) == 0;
+    if (use_hot_index && (share->num_DBs > curr_num_DBs)) {
+        //
+        // already have hot index in progress, get out
+        //
+        error = HA_ERR_INTERNAL_ERROR;
+        goto cleanup;
+    }
     curr_index = curr_num_DBs;
+    modified_DBs = true;
     for (uint i = 0; i < num_of_keys; i++, curr_index++) {
         if (key_info[i].flags & HA_CLUSTERING) {
             set_key_filter(
@@ -6673,14 +6682,6 @@
     }

     if (creating_hot_index) {
-        if (share->num_DBs > curr_num_DBs) {
-            //
-            // already have hot index in progress, get out
-            //
-            error = HA_ERR_INTERNAL_ERROR;
-            rw_unlock(&share->num_DBs_lock);
-            goto cleanup;
-        }
         share->num_DBs++;
         incremented_numDBs = true;
         error = db_env->create_indexer(
@@ -6847,11 +6848,6 @@
         thd_proc_info(thd, status_msg);
         indexer->abort(indexer);
     }
-    if (error) { // 3144
-        curr_index = curr_num_DBs;
-        for (uint i = 0; i < num_of_keys; i++, curr_index++)
-            reset_key_and_col_info(&share->kc_info, curr_index);
-    }
     if (txn) {
         if (error) {
             //
@@ -6862,15 +6858,21 @@
                 rw_wrlock(&share->num_DBs_lock);
                 share->num_DBs--;
             }
-            curr_index = curr_num_DBs;
-            for (uint i = 0; i < num_of_keys; i++, curr_index++) {
-                if (share->key_file[curr_index]) {
-                    int r = share->key_file[curr_index]->close(
-                        share->key_file[curr_index],
-                        0
-                        );
-                    assert(r==0);
-                    share->key_file[curr_index] = NULL;
+            if (modified_DBs) {
+                curr_index = curr_num_DBs; //3144
+                for (uint i = 0; i < num_of_keys; i++, curr_index++) {
+                    reset_key_and_col_info(&share->kc_info, curr_index);
+                }
+                curr_index = curr_num_DBs;
+                for (uint i = 0; i < num_of_keys; i++, curr_index++) {
+                    if (share->key_file[curr_index]) {
+                        int r = share->key_file[curr_index]->close(
+                            share->key_file[curr_index],
+                            0
+                            );
+                        assert(r==0);
+                        share->key_file[curr_index] = NULL;
+                    }
                 }
             }
             abort_txn(txn);


addresses #814
curly braces around if clause

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@4927 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -1755,8 +1755,9 @@
             fn_format(name_buff, newname, "", 0, MY_UNPACK_FILENAME);
             uint open_mode = (((table->db_stat & HA_READ_ONLY) ? DB_RDONLY : 0)
                               | DB_THREAD);
-            if (tokudb_debug & TOKUDB_DEBUG_OPEN)
+            if (tokudb_debug & TOKUDB_DEBUG_OPEN) {
                 TOKUDB_TRACE("open:%s\n", newname);
+            }
             if (!db_create(&share->status_block, db_env, 0)) {
                 if (share->status_block->open(share->status_block, NULL, name_buff, NULL, DB_BTREE, open_mode, 0)) {
                     share->status_block->close(share->status_block, 0);


addresses #873
no need to disable shortcut sorts with blobs

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@4461 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -722,14 +722,6 @@
 ulong ha_tokudb::index_flags(uint idx, uint part, bool all_parts) const {
     TOKUDB_DBUG_ENTER("ha_tokudb::index_flags");
     ulong flags = (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE);
-    for (uint i = all_parts ? 0 : part; i <= part; i++) {
-        KEY_PART_INFO *key_part = table_share->key_info[idx].key_part + i;
-        if (key_part->field->type() == FIELD_TYPE_BLOB) {
-            /* We can't use BLOBS to shortcut sorts */
-            flags &= ~(HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE);
-            break;
-        }
-    }
     DBUG_RETURN(flags);
 }


[t:2927], fix issue

[t:2927], fix issue

git-svn-id: 8b8be7c0f04bb5f9b05983138f06f6333a27d72d@23783 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -4152,6 +4152,9 @@
 int ha_tokudb::handle_cursor_error(int error, int err_to_return, uint keynr) {
     TOKUDB_DBUG_ENTER("ha_tokudb::handle_cursor_error");
     if (error) {
+        if (error == DB_LOCK_NOTGRANTED) {
+            error = HA_ERR_LOCK_WAIT_TIMEOUT;
+        }
         last_cursor_error = error;
         table->status = STATUS_NOT_FOUND;
         int r = cursor->c_close(cursor);
@@ -4302,6 +4305,9 @@
         lockretry_wait;
     }
     if (error) {
+        if (error == DB_LOCK_NOTGRANTED) {
+            error = HA_ERR_LOCK_WAIT_TIMEOUT;
+        }
         table->status = STATUS_NOT_FOUND;
         TOKUDB_DBUG_RETURN(error == DB_NOTFOUND ? HA_ERR_CRASHED : error);
     }


addresses #1068
use right transaction param

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@5612 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -4456,29 +4456,24 @@
 // flatten all DB's in this table, to do so, just do a full scan on every DB
 //
 int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
+    TOKUDB_DBUG_ENTER("ha_tokudb::optimize");
     int error;
-    DB_TXN* txn = NULL;
     DBC* tmp_cursor = NULL;
     uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
-    error = db_env->txn_begin(db_env, 0, &txn, 0);
+    //
+    // prelock so each scan goes faster
+    //
+    error = acquire_table_lock(transaction,lock_read);
     if (error) {
         goto cleanup;
     }

     //
-    // prelock so each scan goes faster
-    //
-    error = acquire_table_lock(txn,lock_read);
-    if (error) {
-        goto cleanup;
-    }
-
-    //
     // for each DB, scan through entire table and do nothing
     //
     for (uint i = 0; i < curr_num_DBs; i++) {
         error = 0;
-        if ((error = share->file->cursor(share->file, txn, &tmp_cursor, 0))) {
+        if ((error = share->file->cursor(share->file, transaction, &tmp_cursor, 0))) {
             tmp_cursor = NULL;
             goto cleanup;
         }
@@ -4493,10 +4488,7 @@

     error = 0;
 cleanup:
-    if (txn) {
-        txn->commit(txn, 0);
-    }
-    return error;
+    TOKUDB_DBUG_RETURN(error);
 }

 ulong ha_tokudb::field_offset(Field *field) {


Implemented timing mechanism with chrono

--- AlarmClockSpeedTest.cpp
+++ AlarmClockSpeedTest.cpp
@@ -11,6 +11,7 @@
 #include <AlarmClock.h>
 #include <chrono>
 using namespace std;
+using namespace std::chrono;
 typedef std::chrono::microseconds microseconds;
 typedef std::chrono::milliseconds milliseconds;
 typedef std::chrono::seconds seconds;
@@ -21,8 +22,6 @@
 }

 int main(int, const char**) {
-   clock_t start;
-   clock_t end;
    unsigned int us = 389;

    cout << "Creating Alarm Clock" << endl;
@@ -30,10 +29,10 @@
    // Give some time for the countdown to start
    this_thread::sleep_for(chrono::microseconds(20));
    cout << "Starting clock and resetting" << endl;
-   start = clock();
+   high_resolution_clock::time_point start = high_resolution_clock::now();
    alerter.Reset();
-   end = clock();
-   clock_t reset_time = (end - start) / (double) (CLOCKS_PER_SEC);
+   high_resolution_clock::time_point end = high_resolution_clock::now();
+   auto reset_time = duration_cast<microseconds>(end - start).count();
    cout << "Start: " << start << ", End: " << end << endl;
    cout << "Waiting for the clock to expire" << endl;
    WaitForAlarmClockToExpire(alerter);


addresses #1391
make the transaction that estimates the number of rows be a
DB_READ_UNCOMMITTED transaction

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@8810 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -1003,7 +1003,7 @@
     bzero((void *)&data, sizeof(data));

     if (transaction == NULL) {
-        error = db_env->txn_begin(db_env, 0, &transaction, 0);
+        error = db_env->txn_begin(db_env, 0, &transaction, DB_READ_UNCOMMITTED);
         if (error) goto cleanup;
         do_commit = true;
     }


fixup progress tracking refs[t:2082]

fixup progress tracking refs[t:2082]

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@15063 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -3990,22 +3990,26 @@
             bool first = true;
             int r;
             if (trx->stmt_progress.queried) {
-                r = sprintf(next_status, "Queried about %llu rows", trx->stmt_progress.queried); assert(r >= 0);
+                r = sprintf(next_status, "Queried about %llu row%s", trx->stmt_progress.queried, trx->stmt_progress.queried == 1 ? "" : "s");
+                assert(r >= 0);
                 next_status += r;
                 first = false;
             }
             if (trx->stmt_progress.inserted) {
-                r = sprintf(next_status, "%sInserted about %llu rows", first ? "" : ", ", trx->stmt_progress.inserted); assert(r >= 0);
+                r = sprintf(next_status, "%sInserted about %llu row%s", first ? "" : ", ", trx->stmt_progress.inserted, trx->stmt_progress.inserted == 1 ? "" : "s");
+                assert(r >= 0);
                 next_status += r;
                 first = false;
             }
             if (trx->stmt_progress.updated) {
-                r = sprintf(next_status, "%sUpdated about %llu rows", first ? "" : ", ", trx->stmt_progress.updated); assert(r >= 0);
+                r = sprintf(next_status, "%sUpdated about %llu row%s", first ? "" : ", ", trx->stmt_progress.updated, trx->stmt_progress.updated == 1 ? "" : "s");
+                assert(r >= 0);
                 next_status += r;
                 first = false;
             }
             if (trx->stmt_progress.deleted) {
-                r = sprintf(next_status, "%sDeleted about %llu rows", first ? "" : ", ", trx->stmt_progress.deleted); assert(r >= 0);
+                r = sprintf(next_status, "%sDeleted about %llu row%s", first ? "" : ", ", trx->stmt_progress.deleted, trx->stmt_progress.deleted == 1 ? "" : "s");
+                assert(r >= 0);
                 next_status += r;
                 first = false;
             }


#3114 compile ha_tokudb.cc without warnings refs[t:3114]

git-svn-id: 8b8be7c0f04bb5f9b05983138f06f6333a27d72d@26383 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -5095,7 +5095,8 @@
         stats.deleted = 0;
         if (!(flag & HA_STATUS_NO_LOCK)) {
             u_int64_t num_rows = 0;
-            TOKU_DB_FRAGMENTATION_S frag_info = {0};
+            TOKU_DB_FRAGMENTATION_S frag_info;
+            memset(&frag_info, 0, sizeof frag_info);

             error = db_env->txn_begin(db_env, NULL, &txn, DB_READ_UNCOMMITTED);
             if (error) { goto cleanup; }
@@ -6501,7 +6502,8 @@
     u_int32_t mult_put_flags[MAX_KEY + 1];
     u_int32_t mult_dbt_flags[MAX_KEY + 1];
     bool incremented_numDBs = false;
-    struct loader_context lc = {0};
+    struct loader_context lc;
+    memset(&lc, 0, sizeof lc);
     lc.thd = thd;
     lc.ha = this;
     loader_error = 0;


fixed the double/float param input for the BLR source

--- AnalyticNSIE/source.cpp
+++ AnalyticNSIE/source.cpp
@@ -183,12 +183,13 @@
 	  int id[9];
 	  int i, n;
 	  float myfloat;
+	  double mydouble;
 	  int flag;

 	  n = 0;

 	  addr[n] = &zsource;
-	  id[n] = 0;
+	  id[n] = 1;
 	  label[n++] = "z_source";

 	  addr[n] = &source_BHmass;
@@ -241,14 +242,22 @@

 		  flag = 1;

-		  for(i = 0; i < 9; i++){
+		  for(i = 0; i < n; i++){
 			  if(rlabel == label[i]){

 				  flag = 0;
 				  ss << rvalue;
-				  ss >> myfloat;
-
-				  *((float *)addr[i]) = myfloat;
+
+				  switch(id[i]){
+				  case 0:
+					  ss >> myfloat;
+					  *((float *)addr[i]) = myfloat;
+					  break;
+				  case 1:
+					  ss >> mydouble;
+					  *((double *)addr[i]) = mydouble;
+					  break;
+				  }

 				  ss.clear();
 				  ss.str(string());


fine tune the sql cmd status refs[t:2082]

git-svn-id: 23085e0e586dca4533ed85b8cd2f5c0e6f637f4f@15051 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -3986,7 +3986,30 @@
             (tokudb_read_status_frequency && (trx->stmt_progress.queried % tokudb_read_status_frequency) == 1) ||
             (tokudb_write_status_frequency && (num_written) % tokudb_write_status_frequency == 1);
         if (update_status) {
-            sprintf(
+            char *next_status = write_status_msg;
+            bool first = true;
+            int r;
+            if (trx->stmt_progress.queried) {
+                r = sprintf(next_status, "Queried about %llu rows", trx->stmt_progress.queried); assert(r >= 0);
+                next_status += r;
+                first = false;
+            }
+            if (trx->stmt_progress.inserted) {
+                r = sprintf(next_status, "%sInserted about %llu rows", first ? "" : ", ", trx->stmt_progress.inserted); assert(r >= 0);
+                next_status += r;
+                first = false;
+            }
+            if (trx->stmt_progress.updated) {
+                r = sprintf(next_status, "%sUpdated about %llu rows", first ? "" : ", ", trx->stmt_progress.updated); assert(r >= 0);
+                next_status += r;
+                first = false;
+            }
+            if (trx->stmt_progress.deleted) {
+                r = sprintf(next_status, "%sDeleted about %llu rows", first ? "" : ", ", trx->stmt_progress.deleted); assert(r >= 0);
+                next_status += r;
+                first = false;
+            }
+            if (first) sprintf(
                 write_status_msg,
                 "Queried about %llu rows, inserted about %llu rows, updated about %llu rows, deleted about %llu rows",
                 trx->stmt_progress.queried,


#4625 remove info messages when doing a quick check table refs[t:4625]

git-svn-id: 8b8be7c0f04bb5f9b05983138f06f6333a27d72d@40997 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -9813,8 +9813,8 @@
         time_t now;
         char timebuf[32];
         snprintf(write_status_msg, sizeof write_status_msg, "%s primary=%d num=%d", share->table_name, primary_key, num_DBs);
-        ha_tokudb_check_info(thd, table, write_status_msg);
         if (verbose) {
+            ha_tokudb_check_info(thd, table, write_status_msg);
             now = time(0);
             fprintf(stderr, "%.24s ha_tokudb::check %s\n", ctime_r(&now, timebuf), write_status_msg);
         }
@@ -9826,8 +9826,8 @@
                 kname = "primary"; // hidden primary key does not set name
             snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u", share->table_name, kname, i);
             thd_proc_info(thd, write_status_msg);
-            ha_tokudb_check_info(thd, table, write_status_msg);
             if (verbose) {
+                ha_tokudb_check_info(thd, table, write_status_msg);
                 now = time(0);
                 fprintf(stderr, "%.24s ha_tokudb::check %s\n", ctime_r(&now, timebuf), write_status_msg);
             }
@@ -9835,13 +9835,16 @@
             r = db->verify_with_progress(db, ha_tokudb_check_progress, &check_context, verbose, keep_going);
             snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u result=%d", share->table_name, kname, i, r);
             thd_proc_info(thd, write_status_msg);
-            ha_tokudb_check_info(thd, table, write_status_msg);
             if (verbose) {
+                ha_tokudb_check_info(thd, table, write_status_msg);
                 now = time(0);
                 fprintf(stderr, "%.24s ha_tokudb::check %s\n", ctime_r(&now, timebuf), write_status_msg);
             }
-            if (result == HA_ADMIN_OK && r != 0)
+            if (result == HA_ADMIN_OK && r != 0) {
                 result = HA_ADMIN_CORRUPT;
+                if (!keep_going)
+                    break;
+            }
         }
     }
     thd_proc_info(thd, old_proc_info);


Added UtH Debug

Added UtH Debug

--- android/jni/main.cpp
+++ android/jni/main.cpp
@@ -19,6 +19,7 @@
 #include <android_native_app_glue.h>

 #include "UtH/Platform/OpenGL.hpp"
+#include "UtH/Platform/Debug.hpp"

 #ifndef MATH_H_UMATH
 namespace umath
@@ -80,7 +81,7 @@

 	if(eglMakeCurrent(androidengine->display, androidengine->surface, androidengine->surface, androidengine->context) == false)
 	{
-		//WriteLog("eglMakeCurrent failed");
+		WriteLog("eglMakeCurrent failed");
 		return -1;
 	}


[t:3406], fix issue on main line

[t:3406], fix issue on main line

git-svn-id: 8b8be7c0f04bb5f9b05983138f06f6333a27d72d@30362 c7de825b-a66e-492c-adef-691d508d4ae1

--- storage/tokudb/ha_tokudb.cc
+++ storage/tokudb/ha_tokudb.cc
@@ -3639,6 +3639,8 @@
     )
 {
     u_int32_t old_prelock_flags = (*put_flags)&(DB_PRELOCKED_FILE_READ);
+    uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+    bool in_hot_index = share->num_DBs > curr_num_DBs;
     //
     // optimization for "REPLACE INTO..." (and "INSERT IGNORE") command
     // if the command is "REPLACE INTO" and the only table
@@ -3661,13 +3663,13 @@
         *put_flags = DB_YESOVERWRITE|old_prelock_flags;
     }
     else if (do_ignore_flag_optimization(thd,table,share->replace_into_fast) &&
-        is_replace_into(thd)
+        is_replace_into(thd)  && !in_hot_index
         )
     {
         *put_flags = DB_YESOVERWRITE|old_prelock_flags;
     }
     else if (do_ignore_flag_optimization(thd,table,share->replace_into_fast) &&
-        is_insert_ignore(thd) && no_overwrite_no_error_allowed
+        is_insert_ignore(thd) && no_overwrite_no_error_allowed && !in_hot_index
         )
     {
         *put_flags = DB_NOOVERWRITE_NO_ERROR|old_prelock_flags;


Enable downscale of very large images when uploading on IO thread (#5011)

--- lib/ui/painting/codec.cc
+++ lib/ui/painting/codec.cc
@@ -63,7 +63,7 @@
     // This indicates that we do not want a "linear blending" decode.
     sk_sp<SkColorSpace> dstColorSpace = nullptr;
     return SkImage::MakeCrossContextFromEncoded(
-        context.get(), std::move(buffer), false, dstColorSpace.get());
+        context.get(), std::move(buffer), false, dstColorSpace.get(), true);
   } else {
     // Defer decoding until time of draw later on the GPU thread. Can happen
     // when GL operations are currently forbidden such as in the background


Increase maxTcpConnectionPerServer so that the new menutest doesnt run out

--- Berlin/server/server.cc
+++ Berlin/server/server.cc
@@ -186,6 +186,7 @@
   /*
    * ...then start the ORB...
    */
+  omniORB::maxTcpConnectionPerServer = 10;
   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
   PortableServer::POA_var poa = resolve_init<PortableServer::POA>(orb, "RootPOA");
   PortableServer::POAManager_var pman = poa->the_POAManager();


simplified some methods

simplified some methods

--- lib/util/NumericUtil.cpp
+++ lib/util/NumericUtil.cpp
@@ -92,9 +92,8 @@
      * The implementation for integers et al. where the == operator
      * does make sense and no comparison to EPS is necessary.
      */
-    bool retVal = ( ZERO==value ? true : false );
-
-    return retVal;
+
+    return ( ZERO==value ? true : false );
 }

@@ -112,9 +111,7 @@
 template<> \
 bool math::NumericUtil<FDL>::isZero(const FDL& value) \
 { \
-    bool retVal = false; \
-    retVal = ( value>-EPS && value<EPS ? true : false ); \
-    return retVal; \
+    return ( value>-EPS && value<EPS ? true : false ); \
 }
 // end of #define

@@ -142,10 +139,8 @@
 template<> \
 bool math::NumericUtil<std::complex<FDL> >::isZero(const std::complex<FDL>& value) \
 { \
-    bool retVal = false; \
     const FDL eps = math::NumericUtil<FDL>::getEPS(); \
-    retVal = ( std::norm(value)<=eps*eps ? true : false ); \
-    return retVal; \
+    return ( std::norm(value)<=eps*eps ? true : false ); \
 }
 // end of #define


streaming: Add stream_session::add_stream_request

--- streaming/stream_session.hh
+++ streaming/stream_session.hh
@@ -31,8 +31,10 @@
 #include "streaming/stream_receive_task.hh"
 #include "streaming/stream_request.hh"
 #include "sstables/sstables.hh"
+#include "query-request.hh"
+#include "dht/i_partitioner.hh"
 #include <map>
-#include <set>
+#include <vector>

 namespace streaming {

@@ -110,6 +112,7 @@
     using application_state = gms::application_state;
     using versioned_value = gms::versioned_value;
     using UUID = utils::UUID;
+    using token = dht::token;
     net::messaging_service& ms() {
         return net::get_local_messaging_service();
     }
@@ -138,7 +141,7 @@
     //private StreamResultFuture streamResult;

     // stream requests to send to the peer
-    std::set<stream_request> _requests;
+    std::vector<stream_request> _requests;
     // streaming tasks are created and managed per ColumnFamily ID
     std::map<UUID, stream_transfer_task> _transfers;
     // data receivers, filled after receiving prepare message
@@ -232,6 +235,7 @@
         assert factory != null;
         return factory.createConnection(connecting);
     }
+#endif

     /**
      * Request data fetch task to this session.
@@ -240,11 +244,11 @@
      * @param ranges Ranges to retrieve data
      * @param columnFamilies ColumnFamily names. Can be empty if requesting all CF under the keyspace.
      */
-    public void addStreamRequest(String keyspace, Collection<Range<Token>> ranges, Collection<String> columnFamilies, long repairedAt)
-    {
-        requests.add(new StreamRequest(keyspace, ranges, columnFamilies, repairedAt));
-    }
-
+    void add_stream_request(sstring keyspace, std::vector<query::range<token>> ranges, std::vector<sstring> column_families, long repaired_at) {
+        _requests.emplace_back(std::move(keyspace), std::move(ranges), std::move(column_families), repaired_at);
+    }
+
+#if 0
     /**
      * Set up transfer for specific keyspace/ranges/CFs
      *


Update 4-keys-keyboard.cpp

Update 4-keys-keyboard.cpp

--- C++/4-keys-keyboard.cpp
+++ C++/4-keys-keyboard.cpp
@@ -7,7 +7,7 @@
         if (N < 7) {
             return N;
         }
-        if (N == 10) {  // the following rule doesn't hold in N = 10
+        if (N == 10) {  // the following rule doesn't hold when N = 10
             return 20;
         }
         auto n = N / 5 + 1;  // n3 + n4 increases one every 5 keys


Changed simple test-receiver to apply counterintutive prefer-labels in response to receiving fg/bg messages, just for testing the prefer-labels.  Result: preference successfully applied.

--- libcmm_test_receiver.cpp
+++ libcmm_test_receiver.cpp
@@ -7,6 +7,7 @@
 #include <netinet/in.h>
 #include "libcmm.h"
 #include "libcmm_test.h"
+#include "libcmm_net_preference.h"
 #include "common.h"
 #include <errno.h>
 #include "timeops.h"
@@ -63,6 +64,16 @@
 #else
         u_long sender_labels = 0;
         int rc = cmm_read(sock, &ch, sizeof(ch), &sender_labels);
+
+        if (sender_labels & CMM_LABEL_ONDEMAND) {
+            sender_labels &= (~CMM_LABEL_WIFI_PREFERRED);
+            sender_labels |= CMM_LABEL_THREEG_PREFERRED;
+            dbgprintf_always("Got FG request: sending prefer-3G response (for testing)\n");
+        } else if (sender_labels & CMM_LABEL_BACKGROUND) {
+            sender_labels &= (~CMM_LABEL_THREEG_PREFERRED);
+            sender_labels |= CMM_LABEL_WIFI_PREFERRED;
+            dbgprintf_always("Got BG request: sending prefer-wifi response (for testing)\n");
+        }
 #endif
         TIME(end);
         if (rc != sizeof(ch)) {


Handle the special case that the ioslave could not be started and show 'Unknown error n' if KIO::buildErrorString() returns an empty string.

svn path=/trunk/KDE/kdepim/; revision=656526

--- libkdepim/servertest.cpp
+++ libkdepim/servertest.cpp
@@ -164,9 +164,21 @@
   if ( error )
   {
     mJob = 0;
-    KMessageBox::error( qApp->activeWindow(),
-        KIO::buildErrorString( error, errorText ),
-        i18n("Error") );
+    QString errorMessage;
+    if ( error == 1 )
+    {
+      // handle the special case that the slave could not be started
+      errorMessage = i18n( "Starting the ioslave for protocol %1 failed.",
+                           mSSL ? mProtocol + 's' : mProtocol );
+    }
+    else
+    {
+      errorMessage = KIO::buildErrorString( error, errorText );
+      if ( errorMessage.isEmpty() ) {
+        errorMessage = i18n( "Unknown error %1.", error );
+      }
+    }
+    KMessageBox::error( qApp->activeWindow(), errorMessage, i18n("Error") );
     emit capabilities( mListNormal, mListSSL );
     emit capabilities( mListNormal, mListSSL, mAuthNone, mAuthSSL, mAuthTLS );
     return;


Formatting.

Formatting.

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

--- libs/csutil/csobject.cpp
+++ libs/csutil/csobject.cpp
@@ -113,7 +113,8 @@
   csObject (NULL);

   iObjectIterator *it = o.GetIterator ();
-  while (!it->IsFinished ()) {
+  while (!it->IsFinished ())
+  {
     ObjAdd (it->GetObject ());
     it->Next ();
   }
@@ -257,7 +258,8 @@
   int i;
   for (i = 0; i < Children->Length (); i++)
   {
-    if (Name) {
+    if (Name)
+    {
       const char *OtherName = Children->Get (i)->GetName ();
       if (!OtherName) continue;
       if (strcmp(OtherName, Name)) continue;


loplugin:cstylecast: deal with those that are (technically) const_cast

Change-Id: I5862e1b0492f51b679a47ec8a08e1ca392a0a1fa

--- svl/source/items/poolio.cxx
+++ svl/source/items/poolio.cxx
@@ -427,7 +427,7 @@
                 {
                     // Loaded Item
                     SfxPoolItem *&rpNewItem =
-                        (SfxPoolItem*&)(*ppArr)->operator[](nNew);
+                        (*ppArr)->operator[](nNew);

                     // Unused surrogate?
                     if ( !rpNewItem )
@@ -450,7 +450,7 @@
                 if ( !bFound )
                 {
                     if ( nFree != SAL_MAX_UINT32 )
-                        (SfxPoolItem*&)(*ppArr)->operator[](nFree) = pOldItem;
+                        (*ppArr)->operator[](nFree) = pOldItem;
                     else
                         (*ppArr)->push_back( pOldItem );
                 }