Attributes CKA_VALUE_BITS and CKA_PRIME_BITS are unsigned long values not binary strings. Introduce additional test with CKA_ID and CKA_SUBJECT attributes to test with binary strings.

--- src/lib/object_store/test/DBObjectTests.cpp
+++ src/lib/object_store/test/DBObjectTests.cpp
@@ -244,7 +244,7 @@
 {
 	ByteString value1 = "010203040506070809";
 	ByteString value2 = "ABABABABABABABABABABABABABABABABAB";
-	ByteString value3 = "BDEBDBEDBBDBEBDEBE792759537328";
+	unsigned long value3 = 0xBDED;
 	ByteString value4 = "98A7E5D798A7E5D798A7E5D798A7E5D798A7E5D798A7E5D7";
 	ByteString value5 = "ABCDABCDABCDABCDABCDABCDABCDABCD";

@@ -282,13 +282,13 @@

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_MODULUS)->isByteStringAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_COEFFICIENT)->isByteStringAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PUBLIC_EXPONENT)->isByteStringAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->isByteStringAttribute());

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_MODULUS)->getByteStringValue() == value1);
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_COEFFICIENT)->getByteStringValue() == value2);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PUBLIC_EXPONENT)->getByteStringValue() == value4);
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->getByteStringValue() == value5);

@@ -303,16 +303,15 @@

 void test_a_dbobject_with_an_object::should_store_mixed_attributes()
 {
-	ByteString value3 = "BDEBDBEDBBDBEBDEBE792759537328";
+	bool value1 = true;
+	unsigned long value2 = 0x87654321;
+	unsigned long value3 = 0xBDEBDBED;

 	// Create the test object
 	{
 		DBObject testObject(connection);
 		CPPUNIT_ASSERT(testObject.find(1));
 		CPPUNIT_ASSERT(testObject.isValid());
-
-		bool value1 = true;
-		unsigned long value2 = 0x87654321;

 		OSAttribute attr1(value1);
 		OSAttribute attr2(value2);
@@ -336,27 +335,29 @@

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue());
-		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), (unsigned long)0x87654321);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
+		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), value2);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
 	}
 }

 void test_a_dbobject_with_an_object::should_store_double_attributes()
 {
-	ByteString value3 = "BDEBDBEDBBDBEBDEBE792759537328";
-	ByteString value3a = "466487346943785684957634";
+
+	bool value1 = true;
+	bool value1a = false;
+	unsigned long value2 = 0x87654321;
+	unsigned long value2a = 0x76767676;
+	unsigned long value3 = 0xBDEBDBED;
+	unsigned long value3a = 0x46648734;

 	// Create the test object
 	{
 		DBObject testObject(connection);
 		CPPUNIT_ASSERT(testObject.find(1));
 		CPPUNIT_ASSERT(testObject.isValid());
-
-		bool value1 = true;
-		unsigned long value2 = 0x87654321;

 		OSAttribute attr1(value1);
 		OSAttribute attr2(value2);
@@ -380,17 +381,14 @@

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue());
-		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), (unsigned long)0x87654321);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
-
-		bool value1 = false;
-		unsigned long value2 = 0x76767676;
-
-		OSAttribute attr1(value1);
-		OSAttribute attr2(value2);
+		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), value2);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
+
+		OSAttribute attr1(value1a);
+		OSAttribute attr2(value2a);
 		OSAttribute attr3(value3a);

 		// Change the attributes
@@ -403,11 +401,11 @@
 		// Check the attributes
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
 	}

 	// Now re-read back the object
@@ -423,30 +421,30 @@

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-		bool value1 = false;
-		unsigned long value2 = 0x76767676;
-
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
 	}
 }

 void test_a_dbobject_with_an_object::can_refresh_attributes()
 {
+	bool value1 = true;
+	bool value1a = false;
+	unsigned long value2 = 0x87654321;
+	unsigned long value2a = 0x76767676;
+	unsigned long value2b = 0x89898989;
 	ByteString value3 = "BDEBDBEDBBDBEBDEBE792759537328";
 	ByteString value3a = "466487346943785684957634";
+	ByteString value4 = "0102010201020102010201020102010201020102";

 	// Create the test object
 	{
 		DBObject testObject(connection);
 		CPPUNIT_ASSERT(testObject.find(1));
 		CPPUNIT_ASSERT(testObject.isValid());
-
-		bool value1 = true;
-		unsigned long value2 = 0x87654321;

 		OSAttribute attr1(value1);
 		OSAttribute attr2(value2);
@@ -454,7 +452,7 @@

 		CPPUNIT_ASSERT(testObject.setAttribute(CKA_TOKEN, attr1));
 		CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2));
-		CPPUNIT_ASSERT(testObject.setAttribute(CKA_VALUE_BITS, attr3));
+		CPPUNIT_ASSERT(testObject.setAttribute(CKA_SUBJECT, attr3));
 	}

 	// Now read back the object
@@ -465,22 +463,19 @@

 		CPPUNIT_ASSERT(testObject.attributeExists(CKA_TOKEN));
 		CPPUNIT_ASSERT(testObject.attributeExists(CKA_PRIME_BITS));
-		CPPUNIT_ASSERT(testObject.attributeExists(CKA_VALUE_BITS));
+		CPPUNIT_ASSERT(testObject.attributeExists(CKA_SUBJECT));
 		CPPUNIT_ASSERT(!testObject.attributeExists(CKA_ID));

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->isByteStringAttribute());

 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue());
-		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), (unsigned long)0x87654321);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
-
-		bool value1 = false;
-		unsigned long value2 = 0x76767676;
-
-		OSAttribute attr1(value1);
-		OSAttribute attr2(value2);
+		CPPUNIT_ASSERT_EQUAL(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue(), value2);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->getByteStringValue() == value3);
+
+		OSAttribute attr1(value1a);
+		OSAttribute attr2(value2a);
 		OSAttribute attr3(value3a);

 		// Change the attributes
@@ -488,16 +483,16 @@

 		CPPUNIT_ASSERT(testObject.setAttribute(CKA_TOKEN, attr1));
 		CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2));
-		CPPUNIT_ASSERT(testObject.setAttribute(CKA_VALUE_BITS, attr3));
+		CPPUNIT_ASSERT(testObject.setAttribute(CKA_SUBJECT, attr3));

 		// Check the attributes
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->isByteStringAttribute());
+
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_SUBJECT)->getByteStringValue() == value3a);

 		// Open the object a second time
 		DBObject testObject2(connection);
@@ -507,43 +502,43 @@
 		// Check the attributes on the second instance
 		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_SUBJECT)->isByteStringAttribute());
+
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_SUBJECT)->getByteStringValue() == value3a);

 		// Add an attribute on the second object
-		ByteString id = "0102010201020102010201020102010201020102";
-
-		OSAttribute attr4(id);
+		OSAttribute attr4(value4);

 		CPPUNIT_ASSERT(testObject.setAttribute(CKA_ID, attr4));

 		// Check the attribute
 		CPPUNIT_ASSERT(testObject2.attributeExists(CKA_ID));
 		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->isByteStringAttribute());
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->getByteStringValue() == id);
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->getByteStringValue() == value4);

 		// Now check that the first instance also knows about it
 		CPPUNIT_ASSERT(testObject.attributeExists(CKA_ID));
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->isByteStringAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->getByteStringValue() == id);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->getByteStringValue() == value4);

 		// Now change another attribute
-		unsigned long value2a = 0x89898989;
-
-		OSAttribute attr2a(value2a);
-
-		CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2a));
+		OSAttribute attr2b(value2b);
+
+		CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2b));

 		// Check the attribute
 		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+		CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2b);

 		// Now check that the second instance also knows about the change
 		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+
+		// Note that the CKA_PRIME_BITS attribute cannot officially be modified.
+		// We optimize inside DBObject to only propagate to the database modifiable attributes.
+		// Therefore we don't expect changes to CKA_PRIME_BITS to propagate to testObject2.
+		CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() != value2b);
 	}
 }

@@ -562,44 +557,52 @@
 {
 	DBObject testObject(connection);
 	CPPUNIT_ASSERT(testObject.find(1));
-
 	CPPUNIT_ASSERT(testObject.isValid());

 	bool value1 = true;
 	unsigned long value2 = 0x87654321;
-	ByteString value3 = "BDEBDBEDBBDBEBDEBE792759537328";
+	unsigned long value3 = 0xBDEBDBED;
+	ByteString value4 = "AAAAAAAAAAAAAAAFFFFFFFFFFFFFFF";

 	OSAttribute attr1(value1);
 	OSAttribute attr2(value2);
 	OSAttribute attr3(value3);
+	OSAttribute attr4(value4);

 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_TOKEN, attr1));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_VALUE_BITS, attr3));
-
-	// Create secondary instance for the same object
+	CPPUNIT_ASSERT(testObject.setAttribute(CKA_ID, attr4));
+
+	// Create secondary instance for the same object.
+	// This needs to have a different connection to the database to simulate
+	// another process accessing the data.
 	DBObject testObject2(connection2);
 	CPPUNIT_ASSERT(testObject2.find(1));
-
 	CPPUNIT_ASSERT(testObject2.isValid());

 	// Check that it has the same attributes
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->isByteStringAttribute());
+
+	// Check that the attributes have the same values as set on testObject.
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->getByteStringValue() == value4);

 	// New values
 	bool value1a = false;
 	unsigned long value2a = 0x12345678;
-	ByteString value3a = "ABABABABABABABABABABABABABABAB";
+	unsigned long value3a = 0xABABABAB;
+	ByteString value4a = "EDEDEDEDEDEDEDEDEDEDEDEDEDEDED";

 	OSAttribute attr1a(value1a);
 	OSAttribute attr2a(value2a);
 	OSAttribute attr3a(value3a);
+	OSAttribute attr4a(value4a);

 	// Start transaction on object
 	CPPUNIT_ASSERT(testObject.startTransaction(DBObject::ReadWrite));
@@ -608,37 +611,48 @@
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_TOKEN, attr1a));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2a));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_VALUE_BITS, attr3a));
+	CPPUNIT_ASSERT(testObject.setAttribute(CKA_ID, attr4a));

 	// Verify that the attributes were set
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->isByteStringAttribute());

 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->getByteStringValue() == value4a);

 	// Verify that they are unchanged on the other instance
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->isByteStringAttribute());

 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
-
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->getByteStringValue() == value4);
+
 	// Commit the transaction
 	CPPUNIT_ASSERT(testObject.commitTransaction());

-	// Verify that they have now changed on the other instance
+	// Verify that non-modifiable attributes did not propagate but modifiable attributes
+	// have now changed on the other instance
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
-
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->isByteStringAttribute());
+
+	// NOTE: 3 attributes below cannot be modified after creation and therefore are not required to propagate.
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() != value1a);
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() != value2a);
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() != value3a);
+
+	// CKA_ID attribute can be modified after creation and therefore should have propagated.
+	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_ID)->getByteStringValue() == value4a);
+
 	// Start transaction on object
 	CPPUNIT_ASSERT(testObject.startTransaction(DBObject::ReadWrite));

@@ -646,44 +660,63 @@
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_TOKEN, attr1));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_PRIME_BITS, attr2));
 	CPPUNIT_ASSERT(testObject.setAttribute(CKA_VALUE_BITS, attr3));
-
+	CPPUNIT_ASSERT(testObject.setAttribute(CKA_ID, attr4));
+
 	// Verify that the attributes were set
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->isByteStringAttribute());

 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1);
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2);
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3);
-
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3);
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->getByteStringValue() == value4);
+
+	// Create a fresh third instance for the same object to force the data to be retrieved from the database.
+	DBObject testObject3(connection2);
+	CPPUNIT_ASSERT(testObject3.find(1));
+	CPPUNIT_ASSERT(testObject3.isValid());
+
 	// Verify that they are unchanged on the other instance, while the transaction is still in progress.
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_TOKEN)->isBooleanAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_ID)->isByteStringAttribute());
+
+	// Verify that the attributes from the database are still hodling the same value as when the transaction started.
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_ID)->getByteStringValue() == value4a);

 	// Abort the transaction
 	CPPUNIT_ASSERT(testObject.abortTransaction());

-	// Verify that they are unchanged on both instances
+	// Verify that after aborting the transaction the values in testObject have reverted back to their
+	// original state.
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->isBooleanAttribute());
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->isByteStringAttribute());
+
+	// After aborting a transaction the testObject should be back to pre transaction state.
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
 	CPPUNIT_ASSERT(testObject.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
-	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
-
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->isBooleanAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->isByteStringAttribute());
-
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
-	CPPUNIT_ASSERT(testObject2.getAttribute(CKA_VALUE_BITS)->getByteStringValue() == value3a);
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
+	CPPUNIT_ASSERT(testObject.getAttribute(CKA_ID)->getByteStringValue() == value4a);
+
+	// Verify that testObject3 still has the original values.
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_TOKEN)->isBooleanAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_PRIME_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_VALUE_BITS)->isUnsignedLongAttribute());
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_ID)->isByteStringAttribute());
+
+	// Verify that testObject3 still has the original values.
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_TOKEN)->getBooleanValue() == value1a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_PRIME_BITS)->getUnsignedLongValue() == value2a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_VALUE_BITS)->getUnsignedLongValue() == value3a);
+	CPPUNIT_ASSERT(testObject3.getAttribute(CKA_ID)->getByteStringValue() == value4a);
 }

 void test_a_dbobject_with_an_object::should_fail_to_delete()


Vulkan:Clean up best practices exceptions

Assign new bug ID for clean-up work. It appears that the
UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset
error was already fixed.

Bug: b/166641492
Change-Id: I536017e0386cf5f57bb53bcba32d5df048050343
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380510
Reviewed-by: Tim Van Patten <c7814369a8d3d5671c484acc7b3215f1bf4221be@google.com>
Reviewed-by: Courtney Goeltzenleuchter <aa371ec5c940a0ded89f7ed95bce84faebcf51df@google.com>
Commit-Queue: Tobin Ehlis <c15ba1c6ec8841cd136fafb26b333b1f76c86fb4@google.com>

--- src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -141,8 +141,7 @@
     // http://anglebug.com/4975
     "VUID-vkCmdDraw-None-02687",
     "VUID-vkCmdDrawIndexed-None-02687",
-    // Best Practices Skips issuetracker.google.com/156661359
-    "UNASSIGNED-BestPractices-vkCreateCommandPool-command-buffer-reset",
+    // Best Practices Skips issuetracker.google.com/166641492
     "UNASSIGNED-BestPractices-pipeline-stage-flags",
     "UNASSIGNED-BestPractices-Error-Result",
     "UNASSIGNED-BestPractices-vkAllocateMemory-small-allocation",


Tweak format of option docstrings

Tweak format of option docstrings

--- src/option_manager.hh
+++ src/option_manager.hh
@@ -224,7 +224,9 @@
                 return **it;
             throw runtime_error(format("option '{}' already declared with different type or flags", name));
         }
-        m_descs.emplace_back(new OptionDesc{name.str(), format("({}): {}", option_type_name<T>::name(), docstring), flags});
+        String doc =  docstring.empty() ? format("[{}]", option_type_name<T>::name())
+                                        : format("[{}] - {}", option_type_name<T>::name(), docstring);
+        m_descs.emplace_back(new OptionDesc{name.str(), std::move(doc), flags});
         opts.emplace_back(new TypedCheckedOption<T, validator>{m_global_manager, *m_descs.back(), value});
         return *opts.back();
     }


filejournal: fix type punning warning, drop unneeded cast

Signed-off-by: Sage Weil <c5b6ff1fd4f0bde10db63d7a3e07166cf6c4229f@dreamhost.com>

--- src/os/FileJournal.cc
+++ src/os/FileJournal.cc
@@ -299,7 +299,7 @@

 int FileJournal::create()
 {
-  char *buf = 0;
+  void *buf = 0;
   int64_t needed_space;
   int ret;
   buffer::ptr bp;
@@ -331,7 +331,7 @@
   }

   // zero first little bit, too.
-  ret = posix_memalign((void**)&buf, block_size, block_size);
+  ret = posix_memalign(&buf, block_size, block_size);
   if (ret) {
     derr << "FileJournal::create: failed to allocate " << block_size
 	 << " bytes of memory: " << cpp_strerror(ret) << dendl;


From Romano J M Silva, changed osg::Texture2D::copyTexImage2D so that it uses the
_internalFormat for the texture format to read rather than default to GL_RGBA.

From Robert Osfield, changed the osg::Texture2D::copyTexImage2D and copyTexSubImage
code so that it set the _internalFormat to GL_RGBA if is is zero.

--- src/osg/Texture2D.cpp
+++ src/osg/Texture2D.cpp
@@ -214,6 +214,8 @@
 void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height )
 {
     const unsigned int contextID = state.getContextID();
+
+    if (_internalFormat==0) _internalFormat=GL_RGBA;

     // get the globj for the current contextID.
     TextureObject* textureObject = getTextureObject(contextID);
@@ -252,7 +254,7 @@
     textureObject->bind();

     applyTexParameters(GL_TEXTURE_2D,state);
-    glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, width, height, 0 );
+    glCopyTexImage2D( GL_TEXTURE_2D, 0, _internalFormat, x, y, width, height, 0 );

     _textureWidth = width;
     _textureHeight = height;
@@ -269,6 +271,8 @@
 {
     const unsigned int contextID = state.getContextID();

+    if (_internalFormat==0) _internalFormat=GL_RGBA;
+
     // get the texture object for the current contextID.
     TextureObject* textureObject = getTextureObject(contextID);


patternlayout.cxx: Implement %X{name} conversion pattern specifier.

--- src/patternlayout.cxx
+++ src/patternlayout.cxx
@@ -221,6 +221,23 @@
 };

+/**
+ * This PatternConverter is used to format the MDC field found in
+ * the InternalLoggingEvent object, optionally limited to
+ * \c k Mapped diagnostic context key.
+ */
+class MDCPatternConverter
+    : public PatternConverter
+{
+public:
+    MDCPatternConverter(const FormattingInfo& info, tstring const & k);
+    virtual void convert(tstring & result,
+        const spi::InternalLoggingEvent& event);
+
+private:
+    tstring key;
+};
+

 /**
  * This PatternConverter is used to format the NDC field found in
@@ -520,6 +537,25 @@
     result = hostname_;
 }

+
+
+////////////////////////////////////////////////
+// MDCPatternConverter methods:
+////////////////////////////////////////////////
+
+log4cplus::pattern::MDCPatternConverter::MDCPatternConverter (
+    const FormattingInfo& info, tstring const & k)
+    : PatternConverter(info)
+    , key (k)
+{ }
+
+
+void
+log4cplus::pattern::MDCPatternConverter::convert (tstring & result,
+    const spi::InternalLoggingEvent& event)
+{
+    result = event.getMDC (key);
+}

 ////////////////////////////////////////////////
@@ -832,10 +868,10 @@
             //getLogLog().debug("NDC converter.");
             break;

-        // 'X' is MDC in log4j.
-        // Not implemented.
         case LOG4CPLUS_TEXT('X'):
-            goto not_implemented;
+            pc = new MDCPatternConverter (formattingInfo, extractOption ());
+            //getLogLog().debug("MDC converter.");
+            break;

 not_implemented:;
         default:


fix warnings about possibly-uninitialized-variables

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@1208 2bbb7eff-a529-9590-31e7-b0007b416f81

--- src/pdf/SkPDFFont.cpp
+++ src/pdf/SkPDFFont.cpp
@@ -715,7 +715,9 @@

     switch (fFontInfo->fType) {
         case SkAdvancedTypefaceMetrics::kType1_Font: {
-            size_t header, data, trailer;
+            size_t header SK_INIT_TO_AVOID_WARNING;
+            size_t data SK_INIT_TO_AVOID_WARNING;
+            size_t trailer SK_INIT_TO_AVOID_WARNING;
             SkRefPtr<SkStream> rawFontData =
                 SkFontHost::OpenStream(SkTypeface::UniqueID(fTypeface.get()));
             rawFontData->unref();  // SkRefPtr and OpenStream both took a ref.


Fix tests on ARM simulator.

Fix tests on ARM simulator.

TBR=sgjesse@chromium.org

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

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

--- src/platform-linux.cc
+++ src/platform-linux.cc
@@ -177,7 +177,7 @@
 #endif

 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
-#ifdef V8_TARGET_ARCH_ARM
+#if defined(V8_TARGET_ARCH_ARM) && defined(__arm__)  // don't use on a simulator
   pLinuxKernelMemoryBarrier();
 #else
   __asm__ __volatile__("" : : : "memory");


Fixed mem leak in callFromThread.

Fixed mem leak in callFromThread.

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

--- src/player/Player.cpp
+++ src/player/Player.cpp
@@ -1625,6 +1625,7 @@
         Py_END_ALLOW_THREADS;
         for (it = tempAsyncCalls.begin(); it != tempAsyncCalls.end(); ++it) {
             (*it)->fire(getFrameTime());
+            delete *it;
         }
     }
 }


Some minor cleaning up [ci skip].

Some minor cleaning up [ci skip].

--- src/pluginswindow.cpp
+++ src/pluginswindow.cpp
@@ -540,11 +540,6 @@
     disconnect(mModel, SIGNAL(itemChanged(QStandardItem *)),
                this, SLOT(updatePluginsSelectedState(QStandardItem *)));

-    // Prevent the list view from being updated, since we may end up changing
-    // quite a bit of its visual contents
-
-    mGui->pluginsTreeView->setUpdatesEnabled(false);
-
     // In case we un/select a category, then go through its selectable plugins
     // and un/select them accordingly

@@ -613,10 +608,6 @@
         }
     }

-    // Re-enable the updating of the list view
-
-    mGui->pluginsTreeView->setUpdatesEnabled(true);
-
     // Check whether the OK and apply buttons should be enabled

     if (pInitializing) {


set user db version to 0.6

set user db version to 0.6

--- src/proxy/user_db.cpp
+++ src/proxy/user_db.cpp
@@ -54,7 +54,7 @@

   /*- user_db -*/
   std::string user_db::_db_version_key = "db-version";
-  double user_db::_db_version = 0.5;
+  double user_db::_db_version = 0.6;

   user_db::user_db(const bool &local,
                    const std::string &haddr,


change the hotkey button for the shares menu item

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -340,7 +340,7 @@
     file->addSeparator();
     file->addAction(quitAction);

-    sharesMenu = appMenuBar->addMenu(tr("S&hares"));
+    sharesMenu = appMenuBar->addMenu(tr("Sh&ares"));
     sharesMenu->addAction(exportPeercoinKeysAction);
     sharesMenu->addAction(distributeDividendsAction);


Fix Up to date QT-Status
The status in the QT client was using a Bitcoin value of 90 minutes.

This should be more realistic as in the Paycoin world blocks are much faster, and happen every minute.

Dividing the amount of blocks behind by 10 (Bitcoin block time) gets us 9 minutes, which I consider an appropriate amount of time to be behind on blocks for Paycoin, although this is up for discussion.

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -603,7 +603,7 @@
     }

     // Set icon state: spinning if catching up, tick otherwise
-    if(secs < 90*60 && count >= nTotalBlocks)
+    if(secs < 9*60 && count >= nTotalBlocks)
     {
         tooltip = tr("Up to date") + QString(".<br>") + tooltip;
         labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));


Update bitcoingui.cpp

Update bitcoingui.cpp

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -408,6 +408,21 @@
     else
     {
     #endif
+    #ifdef USE_NATIVE_I2P
+    }
+
+        if (clientModel->isI2PAddressGenerated())
+        {
+            labelI2PGenerated->setText("DYN");
+            labelI2PGenerated->setToolTip(tr("Wallet is running with a random generated I2P-address"));
+        }
+        else
+        {
+            labelI2PGenerated->setText("STA");
+            labelI2PGenerated->setToolTip(tr("Wallet is running with a static I2P-address"));
+        }
+    #endif
+    }
 #ifndef Q_OS_MAC
             qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
             setWindowIcon(QIcon(":icons/bitcoin_testnet"));


Update string for Show/Hide in the tray

Update string for Show/Hide in the tray

- be clear we don't "Show/Hide Bitcoins", but just the client window
- remove the tooltip for toggleHideAction as this is not shown anyway
- update a comment to be more general

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -273,8 +273,7 @@
     optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
     optionsAction->setToolTip(tr("Modify configuration options for Bitcoin"));
     optionsAction->setMenuRole(QAction::PreferencesRole);
-    toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &Bitcoin"), this);
-    toggleHideAction->setToolTip(tr("Show or hide the Bitcoin window"));
+    toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
     exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
     exportAction->setToolTip(tr("Export the data in the current tab to a file"));
     encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
@@ -463,7 +462,7 @@
 {
     if(reason == QSystemTrayIcon::Trigger)
     {
-        // Click on system tray icon triggers "show/hide Bitcoin"
+        // Click on system tray icon triggers show/hide of the main window
         toggleHideAction->trigger();
     }
 }


Namecoin / Qt: Clarify "Receive" tooltip

Fixes https://github.com/namecoin/namecoin-core/issues/398

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -267,7 +267,7 @@
     sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());

     receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this);
-    receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and namecoin: URIs)"));
+    receiveCoinsAction->setStatusTip(tr("Request payments and name transfers (generates QR codes and namecoin: URIs)"));
     receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
     receiveCoinsAction->setCheckable(true);
     receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));


another attempt at getting windows release build to talk to sgminer

Signed-off-by: justin <0ce7911e6479995d6c346d6f03eb723b5135309e@ziftr.com>

--- src/qt/miningpage.cpp
+++ src/qt/miningpage.cpp
@@ -245,6 +245,7 @@
             program = "sgminer";

         gpuMinerProcess->start(program, args);
+        cpuMinerProcess->waitForStarted(-1);
     }

     /**
@@ -496,10 +497,15 @@

 void MiningPage::readGPUMiningOutput()
 {
+    gpuMinerProcess->reset();
+
     QByteArray outputBytes;
-    outputBytes = gpuMinerProcess->readAllStandardOutput();
-
-    QString outputString(outputBytes);
+    //outputBytes = gpuMinerProcess->readAllStandardOutput();
+    outputBytes = gpuMinerProcess->readAll();
+
+    //QString outputString(outputBytes);
+
+    this->AddListItem(outputString);

     if (!outputString.isEmpty())
     {


[Qt] Console: add security warning

[Qt] Console: add security warning

--- src/qt/rpcconsole.cpp
+++ src/qt/rpcconsole.cpp
@@ -650,13 +650,18 @@
                 "td.message { font-family: %1; font-size: %2; white-space:pre-wrap; } "
                 "td.cmd-request { color: #006060; } "
                 "td.cmd-error { color: red; } "
+                ".secwarning { color: red; }"
                 "b { color: #006060; } "
             ).arg(fixedFontInfo.family(), QString("%1pt").arg(consoleFontSize))
         );

     message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(tr(PACKAGE_NAME)) + "
" +
                         tr("Use up and down arrows to navigate history, and Ctrl-L to clear screen.") + "
" +
-                        tr("Type help for an overview of available commands.")), true);
+                        tr("Type help for an overview of available commands.")) +
+                        "
" +
+                        tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramification of a command.") +
+                        "",
+                        true);
 }

 void RPCConsole::keyPressEvent(QKeyEvent *event)


Match my code in Bitcoin

Match my code in Bitcoin

--- src/qt/rpcconsole.cpp
+++ src/qt/rpcconsole.cpp
@@ -574,13 +574,13 @@
         );

 #ifdef Q_OS_MAC
-    QString clsKey = "⌘cmd-L";
+    QString clsKey = "(⌘)-L";
 #else
     QString clsKey = "Ctrl-L";
 #endif

     message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(tr(PACKAGE_NAME)) + "
" +
-                        tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg(clsKey) + "
" +
+                        tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg(""+clsKey+"") + "
" +
                         tr("Type help for an overview of available commands.")) +
                         "
" +
                         tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramification of a command.") +


fix shutdownreq

fix shutdownreq

Former-commit-id: a0162504f223315062b68b173a0c48611c1b69a6

--- src/qt/syscoingui.cpp
+++ src/qt/syscoingui.cpp
@@ -1522,7 +1522,7 @@
 /** Get restart command-line parameters and request restart */
 void SyscoinGUI::handleRestart(QStringList args)
 {
-    if (!ShutdownRequested())
+    if (!m_node.shutdownRequested())
         Q_EMIT requestedRestart(args);
 }


Only show proposals with remaining payments > 0

--- src/qt/thronelist.cpp
+++ src/qt/thronelist.cpp
@@ -443,7 +443,7 @@
             ExtractDestination(pbudgetProposal->GetPayee(), address1);
             CBitcoinAddress address2(address1);

-            if(!pbudgetProposal->fValid || (int64_t)pbudgetProposal->GetRemainingPaymentCount() > 0) continue;
+            if(!pbudgetProposal->fValid || (int64_t)pbudgetProposal->GetRemainingPaymentCount() <= 0) continue;
             // populate list
             QTableWidgetItem *nameItem = new QTableWidgetItem(QString::fromStdString(pbudgetProposal->GetName()));
             QTableWidgetItem *urlItem = new QTableWidgetItem(QString::fromStdString(pbudgetProposal->GetURL()));


Fixed condition which asks to create a systemnode

--- src/qt/walletview.cpp
+++ src/qt/walletview.cpp
@@ -199,12 +199,12 @@
     qint64 credit = ttm->index(start, TransactionTableModel::AmountCredit, parent).data(Qt::EditRole).toULongLong();
     int typeEnum = ttm->index(start, TransactionTableModel::TypeEnum, parent).data(Qt::EditRole).toInt();

-    if (typeEnum == TransactionRecord::SendToSelf)
+    if (typeEnum == TransactionRecord::SendToSelf && (credit == SYSTEMNODE_COLLATERAL * COIN || credit == MASTERNODE_COLLATERAL * COIN))
     {
         AvailableCoinsType coin_type = ONLY_500;
         QString title = tr("Payment to yourself - ") +
             BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), credit);
-        QString body = tr("Do you wat to create a new ");
+        QString body = tr("Do you want to create a new ");
         if (credit == SYSTEMNODE_COLLATERAL * COIN)
         {
             body += "Systemnode?";


Delay 1.5 second to read DHT22

Delay 1.5 second to read DHT22

DHT22 should wait 1 second after power up for stabilization, as its
datasheet said.

I used to add 2 milliseconds before each read, I thought the sensor need
some magic stable 2 milliseconds before each read...

--- src/read_temp_hum.cpp
+++ src/read_temp_hum.cpp
@@ -11,7 +11,6 @@

 // Return false if read failed.
 bool doReadDHT22() {
-  delay(2);  // TODO: it seems DHT not stable without this delay
   int chk = DHT.read22(DHT22_PIN);

   switch (chk) {
@@ -76,6 +75,15 @@
   setTempe(tempeSum / TEMPE_HISTORY);
 }

+void readDHT22() {
+  if (!doReadDHT22()) {
+    return;
+  }
+
+  updateTemperature(DHT.temperature);
+  updateHumidity(DHT.humidity);
+}
+
 void readTempeHumiFirstTime() {
   int16_t tempe = getTempeSetpoint();
   uint16_t humi = 500;
@@ -92,15 +100,8 @@

   updateTemperature(tempe);
   updateHumidity(humi);
-}

-void readDHT22() {
-  if (!doReadDHT22()) {
-    return;
-  }
-
-  updateTemperature(DHT.temperature);
-  updateHumidity(DHT.humidity);
+  clock::interval(DHT22_SAMPLE_RATE, readDHT22);
 }

 void setupThemeHumi(void) {
@@ -109,9 +110,8 @@

   setTempe(getTempeSetpoint());

-  clock::interval(DHT22_SAMPLE_RATE, readDHT22);
-
   // At this time, no other modules hooks idTempe & idHumi,
   // delays inital read, to trigger interested modules.
-  clock::delay(1, readTempeHumiFirstTime);
+  // DHT22 datasheet said, should not read DHT22 in first second after power up.
+  clock::delay(1500, readTempeHumiFirstTime);
 }


fix: file iterator was failing on empty files

Fixes #1

--- src/reader/reader.cpp
+++ src/reader/reader.cpp
@@ -19,7 +19,10 @@
     {
         stream.seekg(0, ios_base::end);
         file_size = stream.tellg();
-        fill();
+        if (file_size)
+            fill();
+        else
+            stream = NULL;
     }

     theresnoescapefromthisiterator &operator++()


Fixes commit f732a598e345d67d624aa837a41ec23edaa62f59

Fixes #1

--- src/reader/reader.cpp
+++ src/reader/reader.cpp
@@ -22,7 +22,7 @@
         if (file_size)
             fill();
         else
-            stream = NULL;
+            this->stream = NULL;
     }

     theresnoescapefromthisiterator &operator++()


AOV color comp fixes

AOV color comp fixes

--- src/ri/stochastic.cpp
+++ src/ri/stochastic.cpp
@@ -468,7 +468,7 @@
 						const int matteMode		= CRenderer::compChannelOrder[es*3+2];
 						if (matteMode) {
 							float *ESD				= ES + sampleOffset;
-							const float *ESS		= sampleDefaults + sampleOffset;
+							const float *ESS		= CRenderer::sampleDefaults + sampleOffset;
 							for(int ess=numSamples;ess>0;ess--) *ESD++ = *ESS++;
 						} else {
 							float *ESD				= ES + sampleOffset;


Remove unnecessary LOCK(cs_main) in getrawpmempool (#1452)

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -266,8 +266,6 @@
             + HelpExampleCli("getrawmempool", "true")
             + HelpExampleRpc("getrawmempool", "true")
         );
-
-    LOCK(cs_main);

     bool fVerbose = false;
     if (params.size() > 0)


Remove "harddriveserial" RPC command.

Remove "harddriveserial" RPC command.

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -23,7 +23,6 @@
 using namespace std;
 extern std::string YesNo(bool bin);
 bool BackupConfigFile(const string& strDest);
-std::string getHardDriveSerial();
 int64_t GetRSAWeightByCPIDWithRA(std::string cpid);
 extern double DoubleFromAmount(int64_t amount);
 std::string PubKeyToAddress(const CScript& scriptPubKey);
@@ -5101,13 +5100,6 @@
             results = MagnitudeReport(msPrimaryCPID);
             return results;
     }
-    else if (sitem == "harddriveserial")
-    {
-        Object entry;
-        std::string response = getHardDriveSerial();
-        entry.push_back(Pair("Serial",response));
-        results.push_back(entry);
-    }
     else if (sitem == "memorypool")
     {
         Object entry;


Remove one more instance of "..."

Remove one more instance of "..."

Former-commit-id: 0c8577b5d5b025cd4bc80024fca4918e638f1c31

--- src/runtime/cache.cpp
+++ src/runtime/cache.cpp
@@ -443,7 +443,7 @@
 }

 #if 0
-WEAK void halide_memoization_cache_release(void *user_context, const uint8_t *cache_key, int32_t size, buffer_t *computed_bounds, int32_t tuple_count, ...) {
+WEAK void halide_memoization_cache_release(void *user_context, const uint8_t *cache_key, int32_t size, buffer_t *computed_bounds, int32_t tuple_count, buffer_t **) {
 }
 #endif


[c-import] initialize Clang builtins

[c-import] initialize Clang builtins

To avoid errors like this:

> /usr/local/lib/clang/3.9.0/include/mmintrin.h:64:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
>     return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A big thanks to this commit (https://github.com/Meinersbur/pet/commit/1af9b3eb920b8c2608baddf74931b8559c08e55b)
for the way to do this properly.

Also, the line "ci.getPreprocessorOpts().UsePredefines = false;" did
nothing because it was called _after_ createPreprocessor() so this
commit also removes that.

--- src/sema/c-import.cpp
+++ src/sema/c-import.cpp
@@ -122,7 +122,8 @@
     }

     ci.createPreprocessor(clang::TU_Complete);
-    ci.getPreprocessorOpts().UsePredefines = false;
+    auto& pp = ci.getPreprocessor();
+    pp.getBuiltinInfo().initializeBuiltins(pp.getIdentifierTable(), pp.getLangOpts());

     ci.setASTConsumer(llvm::make_unique<CToDeltaConverter>());
     ci.createASTContext();


Fixed server's processPendingClients to not crash if a client disconnects while pending.

--- src/server/Server.cpp
+++ src/server/Server.cpp
@@ -109,7 +109,9 @@
     std::set<uint32>::iterator i = pendingClients.begin();

     while (i != pendingClients.end()) {
-        if (pNetData->getUser(*i)->initialized) {
+        if (!pNetData->getUser(*i)) {
+            pendingClients.erase(i++);      // The user disconnected before finishing connection
+        } else if (pNetData->getUser(*i)->initialized) {
             createNewConnection(*i, pNetData);
             NetMessage connectMessage("!!! "+pNetData->getUser(*i)->nick+" has joined the game !!!");
             pNetData->sendMessage(connectMessage);


Fixing retries for sleep when talking to KDS server Its 10 seconds, divided by 4 seconds + 1 = 3 retries. So that should be (0,1,2)*4=12 which should be enough time,  but this seems to work. I'm sure we'll touch this code again

--- src/sevcore_linux.cpp
+++ src/sevcore_linux.cpp
@@ -538,7 +538,8 @@
         bool cert_found = false;
         int sec_to_sleep = 4;
         int retries = 0;
-        while(!cert_found && retries < (int)((10/sec_to_sleep)+1)) {
+        int max_retries = (int)((10/sec_to_sleep)+1);
+        while(!cert_found && retries <= max_retries) {
             if(!sev::execute_system_command(cmd, &output)) {
                 printf("Error: pipe not opened for system command\n");
                 cmd_ret = SEV_RET_UNSUPPORTED;


little old todo note cleanup

little old todo note cleanup

--- PythonScriptModule/PythonScriptModule.cpp
+++ PythonScriptModule/PythonScriptModule.cpp
@@ -19,7 +19,6 @@
 18:05 < sempuki> Stinkfist: yes
 18:05 < antont> yep was thinking of that too, there'd be some session service
                 thing or something by the new module
-18:06 < antont> ok i copy-paste this to a note in the source so can perhaps remove the rexlogic dep at some point

 rexlogic_->GetInventory()->GetFirstChildFolderByName("Trash");
 18:16 < antont> ah it's world_stream_->GetInfo().inventory


COMP: fix typo in my last commit

COMP: fix typo in my last commit

--- Rendering/Testing/Cxx/TestScenePicker.cxx
+++ Rendering/Testing/Cxx/TestScenePicker.cxx
@@ -112,7 +112,7 @@
     int e[2];
     iren->GetEventPosition(e);
     cout << "DisplayPosition : (" << e[0] << "," << e[1] << ")"
-         << " Prop: "     << m_ActorDescription[m_Picker->GetViewProp(e)].c_str();
+         << " Prop: "     << m_ActorDescription[m_Picker->GetViewProp(e)].c_str()
          << " CellId: "   << m_Picker->GetCellId(e)
          << " VertexId: " << m_Picker->GetVertexId(e)
          << endl;


Stable again! Reverted simpleFile to use old String class.

--- BrotBoxEngine/SimpleFile.cpp
+++ BrotBoxEngine/SimpleFile.cpp
@@ -13,8 +13,29 @@
 		std::cout << filepath.getRaw()[i] << std::endl;
 	}

-	std::cout << "Reading File: " << filepath << std::endl;
-	std::ifstream file(filepath.getRaw(), std::ios::binary | std::ios::ate);
+	wchar_t path_w[1024];
+	char path[1024];
+	memset(path_w, 0, 1024*sizeof(wchar_t));
+
+	std::cout << "OLA!" << std::endl;
+	if(filepath.getLength() >= sizeof(path) - 1)
+	{
+		throw std::runtime_error("Path too long!");
+	}
+	for(std::size_t i = 0; i<filepath.getLength(); i++)
+	{
+		std::cout << "OLA!" << std::endl;
+		path_w[i] = filepath.getRaw()[i];
+	}
+
+	std::cout << "OLA!" << std::endl;
+	std::size_t length = wcstombs(path, path_w, sizeof(path));
+	if(length >= sizeof(path) - 1)
+	{
+		throw std::runtime_error("Path too long!");
+	}
+	std::cout << "Reading File: " << path << std::endl;
+	std::ifstream file(path, std::ios::binary | std::ios::ate);

 	if (file)
 	{
@@ -34,7 +55,13 @@

 void bbe::simpleFile::writeFloatArrToFile(const bbe::String & filePath, float * arr, size_t size)
 {
-	std::ofstream file(filePath.getRaw());
+	char path[1024];
+	std::size_t length = wcstombs(path, filePath.getRaw(), sizeof(path));
+	if(length >= sizeof(path) - 1)
+	{
+		throw std::runtime_error("Path too long!");
+	}
+	std::ofstream file(path);
 	for (std::size_t i = 0; i < size; i++)
 	{
 		file << arr[i] << "\n";


Use tsbs rather than spaces

Use tsbs rather than spaces

--- C/common/config_category.cpp
+++ C/common/config_category.cpp
@@ -911,23 +911,23 @@
 ConfigCategory::CategoryItem::CategoryItem(const CategoryItem& rhs)
 {
 	m_name = rhs.m_name;
-	m_displayName = rhs.m_displayName;
-        m_type = rhs.m_type;
-        m_default = rhs.m_default;
-        m_value = rhs.m_value;
-        m_description = rhs.m_description;
-        m_order = rhs.m_order;
-        m_readonly = rhs.m_readonly;
-        m_deprecated = rhs.m_deprecated;
-        m_minimum = rhs.m_minimum;
-        m_maximum = rhs.m_maximum;
-        m_filename = rhs.m_filename;
+	m_displayName = rhs.m_displayName
+	m_type = rhs.m_type;
+	m_default = rhs.m_default;
+	m_value = rhs.m_value;
+	m_description = rhs.m_description;
+       	m_order = rhs.m_order;
+       	m_readonly = rhs.m_readonly;
+       	m_deprecated = rhs.m_deprecated;
+       	m_minimum = rhs.m_minimum;
+       	m_maximum = rhs.m_maximum;
+       	m_filename = rhs.m_filename;
 	for (auto it = rhs.m_options.cbegin(); it != rhs.m_options.cend(); it++)
 	{
 		m_options.push_back(*it);
 	}
-        m_file = rhs.m_file;
-        m_itemType = rhs.m_itemType;
+       	m_file = rhs.m_file;
+       	m_itemType = rhs.m_itemType;
 }

 /**


No need to sanitize free() input for NULL

--- Core/Contents/Source/PolyImage.cpp
+++ Core/Contents/Source/PolyImage.cpp
@@ -91,8 +91,7 @@
 }

 Image::~Image() {
-	if(imageData != NULL)
-		free(imageData);
+	free(imageData);
 }

 char *Image::getPixels() {
@@ -115,8 +114,7 @@
 }

 void Image::createEmpty(unsigned int width, unsigned int height) {
-	if(imageData != NULL)
-		free(imageData);
+	free(imageData);

 	imageData = (char*)malloc(width*height*pixelSize);
 	this->width = width;


Fixes test cucumber --tags @basic:63 and issue #105

--- Descriptors/DescriptionFactory.cpp
+++ Descriptors/DescriptionFactory.cpp
@@ -95,26 +95,31 @@
             indexOfSegmentBegin = i;
         }
     }
+//    INFO("#segs: " << pathDescription.size());

     //Post-processing to remove empty or nearly empty path segments
-    if(0. == startPhantom.ratio || 0 == pathDescription[0].length) {
-        if(pathDescription.size() > 2)
+    if(0 == pathDescription.back().length) {
+//        INFO("#segs: " << pathDescription.size() << ", last ratio: " << targetPhantom.ratio << ", length: " << pathDescription.back().length);
+        if(pathDescription.size() > 2){
+            pathDescription.pop_back();
+            pathDescription.back().necessary = true;
+            pathDescription.back().turnInstruction = TurnInstructions.NoTurn;
+            targetPhantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID;
+//            INFO("Deleting last turn instruction");
+        }
+    } else {
+        pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio);
+    }
+    if(0 == pathDescription[0].length) {
+        if(pathDescription.size() > 2) {
             pathDescription.erase(pathDescription.begin());
-        pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
-        pathDescription[0].necessary = true;
-        startPhantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
+            pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
+            pathDescription[0].necessary = true;
+            startPhantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
+//            INFO("Deleting first turn instruction, ratio: " << startPhantom.ratio << ", length: " << pathDescription[0].length);
+        }
     } else {
         pathDescription[0].duration *= startPhantom.ratio;
-    }
-    if(1. == targetPhantom.ratio || 0 == pathDescription.back().length) {
-        if(pathDescription.size() > 2)
-            pathDescription.pop_back();
-        pathDescription.back().necessary = true;
-        pathDescription.back().turnInstruction = TurnInstructions.NoTurn;
-        targetPhantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID;
-//        INFO("Deleting last turn instruction");
-    } else {
-        pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio);
     }

     //Generalize poly line


Fix a wrong log formatting

Fix a wrong log formatting

Summary:
I experienced weird segfault because of this mismatch of type in log formatting. Fix it.
Closes https://github.com/facebook/rocksdb/pull/3345

Differential Revision: D6687224

Pulled By: siying

fbshipit-source-id: c51fb1c008b7ebc3efdc353a4adad3e8f5b3e9de

--- db/compaction_job.cc
+++ db/compaction_job.cc
@@ -625,8 +625,8 @@
       "[%s] compacted to: %s, MB/sec: %.1f rd, %.1f wr, level %d, "
       "files in(%d, %d) out(%d) "
       "MB in(%.1f, %.1f) out(%.1f), read-write-amplify(%.1f) "
-      "write-amplify(%.1f) %s, records in: %d, records dropped: %d "
-      "output_compression: %s\n",
+      "write-amplify(%.1f) %s, records in: %" PRIu64
+      ", records dropped: %" PRIu64 " output_compression: %s\n",
       cfd->GetName().c_str(), vstorage->LevelSummary(&tmp), bytes_read_per_sec,
       bytes_written_per_sec, compact_->compaction->output_level(),
       stats.num_input_files_in_non_output_levels,


fixed case on include

fixed case on include

--- TerrainSDK/vtlib/core/TextureUnitManager.cpp
+++ TerrainSDK/vtlib/core/TextureUnitManager.cpp
@@ -8,7 +8,7 @@
 //

 #include "vtlib/vtlib.h"
-#include "textureunitmanager.h"
+#include "TextureUnitManager.h"

 //
 // RJ's warning: NONE OF THIS IS THREAD SAFE!!!


Fix potential buf overflow in sm-tx-log.

--- dbcore/sm-tx-log.cpp
+++ dbcore/sm-tx-log.cpp
@@ -47,12 +47,12 @@
 void
 sm_tx_log::log_fid(FID f, const std::string &name)
 {
-    auto size = align_up(name.length()) + 1;
+    auto size = align_up(name.length() + 1);
     auto size_code = encode_size_aligned(size);
     char *buf = (char *)malloc(size);
     memset(buf, '\0', size);
-    memcpy(buf, (char *)name.c_str(), size-1);
-    ASSERT(buf[size-1] == '\0');
+    memcpy(buf, (char *)name.c_str(), name.length());
+    ASSERT(buf[name.length()] == '\0');
     // only use the logrec's fid field, payload is name
     get_log_impl(this)->add_payload_request(LOG_FID, f, 0,
                             fat_ptr::make(buf, size_code),


Fix permissions bit that accidentally got +x.

BUG=none
TEST=check_perms

Review URL: https://chromiumcodereview.appspot.com/10700147

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


inserted cleaning of structures at the beginning of the run method in dynbetweenness

--- networkit/cpp/centrality/DynBetweenness.cpp
+++ networkit/cpp/centrality/DynBetweenness.cpp
@@ -36,9 +36,9 @@
     scoreData.clear();
     scoreData.resize(z);
     npaths.clear();
-    nPaths.resize(z);
+    npaths.resize(z);
     distances.clear();
-    distance.resize(z);
+    distances.resize(z);
     dependencies.clear();
     dependencies.resize(z);
     if (storePreds) {


Remove unnecessary parameter in call to getRawStream

--- package/source/zippackage/ZipPackageFolder.cxx
+++ package/source/zippackage/ZipPackageFolder.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ZipPackageFolder.cxx,v $
  *
- *  $Revision: 1.40 $
- *
- *  last change: $Author: mtg $ $Date: 2001-05-08 14:04:49 $
+ *  $Revision: 1.41 $
+ *
+ *  last change: $Author: mtg $ $Date: 2001-05-15 13:04:04 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -410,7 +410,7 @@
             {
                 try
                 {
-                    Reference < XInputStream > xStream = pStream->getRawStream( pStream->aEntry );
+                    Reference < XInputStream > xStream = pStream->getRawStream();
                     try
                     {
                         rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), bToBeEncrypted);


sdfloader cylinder added

sdfloader cylinder added

--- framework/sdfloader.cpp
+++ framework/sdfloader.cpp
@@ -138,7 +138,26 @@

 					else if (word == "cylinder")
 					{
-
+						std::string cylname;
+						glm::vec3 center;
+						float r;
+						float height;
+						std::string matname;
+
+						stream >> cylname;
+
+						stream >> center.x;
+						stream >> center.y;
+						stream >> center.z;
+
+						stream >> r;
+						stream >> height;
+
+						stream >> matname;
+
+						std::shared_ptr<Material> material = (scene.materials_.find(matname)->second);
+						std::shared_ptr<Shape> cyl = std::make_shared<Cylinder>(center, r, height, material, cylname);
+						tempshapesmap.insert(std::pair<std::string, std::shared_ptr<Shape>>(cylname, cyl));
 					}

 					else if (word == "triangle")


[vtests] Disable a stencil shadow test that crashes on Windows

--- Tests/VisualTests/VTests/src/VTestPlugin.cpp
+++ Tests/VisualTests/VTests/src/VTestPlugin.cpp
@@ -40,7 +40,7 @@
     // add the playpen tests
     addSample(new CubeMappingTest()); // no bg on Win
     addSample(new ParticleTest());
-    addSample(new StencilShadowTest()); // should show ogre head, barrel, taurus
+    // addSample(new StencilShadowTest()); // crashes on Windows; should show ogre head, barrel, taurus
     addSample(new TextureEffectsTest());
     addSample(new TransparencyTest());
 }


fixing compilation errors

fixing compilation errors

--- ThreadPoolExecutor/TestThreadPoolExecutor.cc
+++ ThreadPoolExecutor/TestThreadPoolExecutor.cc
@@ -20,7 +20,7 @@
 void print_task(void *par)
 {
         sleep_sec(sec);
-        cout << "work done: " << (int)par << endl;
+        cout << "work done: " << (long int)par << endl;
 }

 struct para {
@@ -525,7 +525,7 @@
         auto unlimited = ThreadPoolExecutor::NewCachedThreadPool();
         auto task =
                 [] (void *pa) {
-                long int num = reinterpret_cast<int>(pa);
+                long int num = reinterpret_cast<long int>(pa);
                 sleep_sec(1);
                 cout << num << endl;
                 return;
@@ -558,7 +558,7 @@
         auto unlimited = ThreadPoolExecutor::NewCachedThreadPool();
         auto task =
                 [] (void *pa) {
-                long int num = reinterpret_cast<int>(pa);
+                long int num = reinterpret_cast<long int>(pa);
                 sleep_sec(1);
                 cout << num << endl;
                 return;


Stabilize tst_IrcConnection::testSasl()

Stabilize tst_IrcConnection::testSasl()

--- tests/auto/ircconnection/tst_ircconnection.cpp
+++ tests/auto/ircconnection/tst_ircconnection.cpp
@@ -378,22 +378,37 @@
     if (!serverSocket)
         Q4SKIP("The address is not available");

-    IrcProtocol* protocol = static_cast<FriendlyConnection*>(connection.data())->protocol();
-    QVERIFY(protocol);
-
     QVERIFY(!IrcConnection::supportedSaslMechanisms().contains("UNKNOWN"));
     QTest::ignoreMessage(QtWarningMsg, "IrcConnection::setSaslMechanism(): unsupported mechanism: 'UNKNOWN'");
     connection->setSaslMechanism("UNKNOWN");
     QVERIFY(connection->saslMechanism().isEmpty());

+    connection->close();
+    IrcProtocol* protocol = static_cast<FriendlyConnection*>(connection.data())->protocol();
+    QVERIFY(protocol);
+
     QVERIFY(IrcConnection::supportedSaslMechanisms().contains("PLAIN"));
     connection->setSaslMechanism("PLAIN");
     QCOMPARE(connection->saslMechanism(), QString("PLAIN"));

+    connection->open();
+    waitForOpened();
+    QVERIFY(clientSocket->waitForBytesWritten());
+    QVERIFY(serverSocket->waitForReadyRead());
+    QByteArray written = serverSocket->readAll();
+    QVERIFY(written.contains("CAP LS"));
+    QVERIFY(written.contains("NICK nick"));
+    QVERIFY(!written.contains("PASS secret"));
+    QVERIFY(!written.contains("CAP REQ :sasl"));
+
     waitForWritten(":irc.freenode.net CAP * LS :sasl\r\n");
     QVERIFY(clientSocket->waitForBytesWritten());
-    serverSocket->waitForReadyRead();
-    QVERIFY(serverSocket->readAll().contains("CAP REQ :sasl"));
+    QVERIFY(serverSocket->waitForReadyRead());
+    written = serverSocket->readAll();
+    QVERIFY(!written.contains("CAP LS"));
+    QVERIFY(!written.contains("NICK nick"));
+    QVERIFY(!written.contains("PASS secret"));
+    QVERIFY(written.contains("CAP REQ :sasl"));

     // do not resume handshake too early
     QCoreApplication::sendPostedEvents(protocol, QEvent::MetaCall);


Nicer output makes it easier to see the shapes.

--- game_of_life/board.cpp
+++ game_of_life/board.cpp
@@ -79,7 +79,10 @@
 void Board::print() {
     for (int y=0; y<BOARD_HEIGHT; ++y) {
         for (int x=0; x<BOARD_WIDTH; ++x) {
-            std::cout << _cells[x][y];
+            if (_cells[x][y]==1)
+                std::cout<< "*";
+            else
+                std::cout<< " ";
         }
         std::cout << std::endl;
     }


Updated the debug output.

Updated the debug output.

--- tests/auto/qmimedatabase/tst_qmimedatabase.cpp
+++ tests/auto/qmimedatabase/tst_qmimedatabase.cpp
@@ -80,14 +80,17 @@
     QFETCH(QString, mimeType);
     QFETCH(QString, xFail);

+    //qDebug() << Q_FUNC_INFO << filePath;
+
     const QString resultMimeTypeName = database.findByName(filePath).name();
+    //qDebug() << Q_FUNC_INFO << "findByName() returned" << resultMimeTypeName;

     // Results are ambiguous when multiple MIME types have the same glob
     // -> accept the current result if the found MIME type actually
     // matches the file's extension.
     const QMimeType foundMimeType = database.mimeTypeForName(resultMimeTypeName);
     const QString extension = QFileInfo(filePath).suffix();
-    //qDebug() << foundMimeType.globPatterns() << "extension=*." << extension;
+    //qDebug() << Q_FUNC_INFO << "globPatterns:" << foundMimeType.globPatterns() << "- extension:" << QString() + "*." + extension;
     if (foundMimeType.globPatterns().contains("*." + extension))
         return;

@@ -116,11 +119,13 @@
     QByteArray data = f.readAll();

     const QString resultMimeTypeName = database.findByData(data).name();
-    if (xFail.length() >= 2 && xFail.at(1) == QLatin1Char('x'))
+    if (xFail.length() >= 2 && xFail.at(1) == QLatin1Char('x')) {
         // Expected to fail
         QVERIFY2(resultMimeTypeName != mimeType, qPrintable(resultMimeTypeName));
-    else
+    }
+    else {
         QCOMPARE(resultMimeTypeName, mimeType);
+    }
 }

 void tst_QMimeType::findByFile_data()
@@ -135,11 +140,14 @@
     QFETCH(QString, xFail);

     const QString resultMimeTypeName = database.findByFile(QFileInfo(filePath)).name();
-    if (xFail.length() >= 3 && xFail.at(2) == QLatin1Char('x'))
+    //qDebug() << Q_FUNC_INFO << filePath << "->" << resultMimeTypeName;
+    if (xFail.length() >= 3 && xFail.at(2) == QLatin1Char('x')) {
         // Expected to fail
         QVERIFY2(resultMimeTypeName != mimeType, qPrintable(resultMimeTypeName));
-    else
+    }
+    else {
         QCOMPARE(resultMimeTypeName, mimeType);
+    }
 }

 QTEST_APPLESS_MAIN(tst_QMimeType)


Fix tst_qquicktext::hover()

Fix tst_qquicktext::hover()

Task-number: QTBUG-36938
Change-Id: I28da25235ae7b8805ebc474777a5edd43ceef941
Reviewed-by: Jan Arve Sæther <781b533117cd4e86bcc65e6d7bba551952271382@digia.com>

--- tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -3823,6 +3823,8 @@

     QQuickWindow *window = qobject_cast<QQuickWindow *>(object.data());
     QVERIFY(window);
+    window->show();
+    QVERIFY(QTest::qWaitForWindowExposed(window));

     QQuickMouseArea *mouseArea = window->property("mouseArea").value<QQuickMouseArea *>();
     QVERIFY(mouseArea);


Use different name_scope for different conv type, test=develop (#29355)

--- paddle/fluid/framework/ir/conv_bn_fuse_pass.cc
+++ paddle/fluid/framework/ir/conv_bn_fuse_pass.cc
@@ -171,7 +171,7 @@

     // Create eltwise_y (conv bias) variable
     VarDesc eltwise_y_in_desc(
-        patterns::PDNodeName(name_scope_, "eltwise_y_in"));
+        patterns::PDNodeName("fuse_conv_bn", conv_type() + "_eltwise_y_in"));
     eltwise_y_in_desc.SetShape(framework::vectorize(bn_bias_tensor->dims()));
     eltwise_y_in_desc.SetDataType(bn_bias_tensor->type());
     eltwise_y_in_desc.SetLoDLevel(bn_bias->Var()->GetLoDLevel());


Add lock

Add lock

--- paddle/fluid/operators/nccl/nccl_gpu_common.cc
+++ paddle/fluid/operators/nccl/nccl_gpu_common.cc
@@ -23,13 +23,18 @@
 std::unique_ptr<std::unordered_map<int, int>> comm_id_map;
 bool inited = false;
 size_t last_num_gpus = -1;
+// TODO(panyx0718): Need to decide whether Paddle supports parallel
+// runs with different number GPUs. If true, current solution is not enough.
+std::mutex comm_mu;
 }

 int Communicator::GetCommId(int device_id) const {
+  std::lock_guard<std::mutex> guard(comm_mu);
   return comm_id_map->at(device_id);
 }

 void Communicator::InitAll(const std::vector<int>& gpus) {
+  std::lock_guard<std::mutex> guard(comm_mu);
   if (inited && last_num_gpus == gpus.size()) {
     return;
   }
@@ -52,6 +57,7 @@
 }

 const std::vector<ncclComm_t>& Communicator::comms() const {
+  std::lock_guard<std::mutex> guard(comm_mu);
   return *global_comms;
 }


stuff

stuff

--- src/svgren/render.cpp
+++ src/svgren/render.cpp
@@ -116,8 +116,6 @@
 		CairoMatrixPush cairoMatrixPush(this->cr);

 		this->applyTransformations(e);
-
-		cairo_set_source_rgb(cr, 1.0, 0, 0);

 //		const svgdom::PathElement::Step* prev = nullptr;
 		for(auto& s : e.path){
@@ -213,9 +211,40 @@
 			}
 //			prev = &s;
 		}
-
-		cairo_set_line_width (cr, 1);
-		cairo_stroke (cr);
+
+		auto fill = e.getStyleProperty(svgdom::EStyleProperty::FILL);
+		auto stroke = e.getStyleProperty(svgdom::EStyleProperty::STROKE);
+
+		if(fill && fill->effective){
+			svgdom::real opacity;
+			if(auto fillOpacity = e.getStyleProperty(svgdom::EStyleProperty::FILL_OPACITY)){
+				opacity = fillOpacity->floating;
+			}else{
+				opacity = 1;
+			}
+
+			auto fillRgb = fill->getRgb();
+
+			cairo_set_source_rgba(this->cr, fillRgb.r, fillRgb.g, fillRgb.b, opacity);
+			if(stroke && stroke->effective){
+				cairo_fill_preserve(this->cr);
+			}else{
+				cairo_fill(this->cr);
+			}
+		}
+
+		if(stroke && stroke->effective){
+			if(auto strokeWidth = e.getStyleProperty(svgdom::EStyleProperty::STROKE_WIDTH)){
+				cairo_set_line_width(cr, strokeWidth->length.value);
+			}else{
+				cairo_set_line_width(cr, 1);
+			}
+
+			auto rgb = stroke->getRgb();
+
+			cairo_set_source_rgb(this->cr, rgb.r, rgb.g, rgb.b);
+			cairo_stroke(this->cr);
+		}
 	}
 };

@@ -230,6 +259,10 @@
 	TRACE(<< "width = " << width << " stride = " << stride / 4 << std::endl)

 	std::vector<std::uint32_t> ret((stride / sizeof(std::uint32_t)) * height);
+
+	for(auto& c : ret){
+		c = 0xffffffff;//TODO: fill 0
+	}

 	cairo_surface_t* surface = cairo_image_surface_create_for_data(
 			reinterpret_cast<unsigned char*>(&*ret.begin()),


Fix for dof_id_type != unsigned int

Fix for dof_id_type != unsigned int

--- src/mesh/mesh_communication_global_indices.C
+++ src/mesh/mesh_communication_global_indices.C
@@ -792,7 +792,7 @@
 					     const MeshTools::BoundingBox &,
 					     const ForwardIterator &begin,
 					     const ForwardIterator &end,
-					     std::vector<unsigned int> &index_map) const
+					     std::vector<dof_id_type> &index_map) const
 {
   index_map.clear();
   index_map.reserve(std::distance (begin, end));


:floppy_disk: λcommon v1.6.2: Missing include file >.<

--- src/system/system.cpp
+++ src/system/system.cpp
@@ -14,6 +14,7 @@

 #  define INFO_BUFFER_SIZE 32767

+#include <windows.h>
 #include <intrin.h>
 #include <ShlObj.h>


high precision test for scalar now running: tolerance set to 5e-12

--- tests/examples/scalar/test_scalar_highprec.cpp
+++ tests/examples/scalar/test_scalar_highprec.cpp
@@ -24,20 +24,38 @@
   protected:
     pfasst::QuadratureType nodetype; // parameter

-    complex<double> lambda;
-    double Tend = 0.5;
-    size_t nsteps = 1;
-    size_t niters = 30;
-    size_t nnodes = 8;
+    const complex<double> lambda = complex<double>(-1.0,1.0);
+    const double dt = 0.2; // = Tend for single step
+    const size_t nsteps = 1;
+    const size_t niters = 30;
+    const size_t nnodes = 8;
     size_t nnodes_in_call;
+    double err;

     void set_parameters()
     {
       switch (this->nodetype)
       {
         case pfasst::QuadratureType::GaussLobatto:
+          this->nnodes_in_call = this->nnodes;
+          break;
+
+        case pfasst::QuadratureType::GaussLegendre:
+          this->nnodes_in_call = this->nnodes + 2;
           break;

+        case pfasst::QuadratureType::GaussRadau:
+          this->nnodes_in_call = this->nnodes + 1;
+          break;
+
+        case pfasst::QuadratureType::ClenshawCurtis:
+          this->nnodes_in_call = this->nnodes + 1;
+          break;
+
+        case pfasst::QuadratureType::Uniform:
+          this->nnodes_in_call = this->nnodes + 1;
+          break;
+
         default:
           break;
       }
@@ -49,6 +67,8 @@
     {
       this->nodetype = GetParam();
       this->set_parameters();
+      this->err = run_scalar_sdc(this->nsteps, this->dt, this->nnodes_in_call,
+                                 this->niters, this->lambda, this->nodetype);
     }

     virtual void TearDown()
@@ -57,6 +77,7 @@

 TEST_P(HighPrecisionTest, AllNodes)
 {
+  EXPECT_THAT(err, Le<double>(5e-12)) << "Failed to bring relative error below 5e-12";
 }

 INSTANTIATE_TEST_CASE_P(ScalarSDC, HighPrecisionTest,


Execute original ooo callback first on recovery mode

--- src/tcp_ip/stream.cpp
+++ src/tcp_ip/stream.cpp
@@ -325,13 +325,13 @@
                                           const payload_type& payload,
                                           uint32_t recovery_sequence_number_end,
                                           const stream_packet_callback_type& original_callback) {
+    if (original_callback) {
+        original_callback(stream, sequence_number, payload);
+    }
     if (!recovery_mode_handler(stream.client_flow(), sequence_number,
                                recovery_sequence_number_end)) {
+        stream.directions_recovery_mode_enabled_--;
         stream.client_out_of_order_callback(original_callback);
-        stream.directions_recovery_mode_enabled_--;
-    }
-    if (original_callback) {
-        original_callback(stream, sequence_number, payload);
     }
 }

@@ -339,13 +339,13 @@
                                           const payload_type& payload,
                                           uint32_t recovery_sequence_number_end,
                                           const stream_packet_callback_type& original_callback) {
+    if (original_callback) {
+        original_callback(stream, sequence_number, payload);
+    }
     if (!recovery_mode_handler(stream.server_flow(), sequence_number,
                                recovery_sequence_number_end)) {
+        stream.directions_recovery_mode_enabled_--;
         stream.server_out_of_order_callback(original_callback);
-        stream.directions_recovery_mode_enabled_--;
-    }
-    if (original_callback) {
-        original_callback(stream, sequence_number, payload);
     }
 }


ssl handle must be released with SSL_free instead of SSL_clear

--- src/tcpsocketimpl.cpp
+++ src/tcpsocketimpl.cpp
@@ -316,7 +316,7 @@

 #ifdef WITH_SSL
     if (_ssl)
-        SSL_clear(_ssl);
+        SSL_free(_ssl);
     if (_sslCtx)
         SSL_CTX_free(_sslCtx);
 #endif


Dont's set Graphicscene parent to avoid warning message, fix display of images 	modified:   kdenlivetitle_wrapper.cpp

--- src/modules/qimage/kdenlivetitle_wrapper.cpp
+++ src/modules/qimage/kdenlivetitle_wrapper.cpp
@@ -133,6 +133,7 @@
 	    int originalHeight = doc.documentElement().attribute("height").toInt();
 	    mlt_properties_set_int( producer_props, "_original_height", originalHeight );
 	}
+
 	if ( titles.size() )
 	{

@@ -178,9 +179,7 @@
 					{
 						text = text.replace( "%s", replacementText );
 					}
-					QGraphicsTextItem *txt = new QGraphicsTextItem( text );
-					txt->setFont(font);
-					scene->addItem(txt);
+					QGraphicsTextItem *txt = scene->addText(text, font);
 					txt->setDefaultTextColor( col );
 					if ( txtProperties.namedItem( "alignment" ).isNull() == false )
 					{
@@ -221,7 +220,6 @@
 					QImage img( url );
 					ImageItem *rec = new ImageItem(img);
 					scene->addItem( rec );
-					rec->setData( Qt::UserRole, url );
 					gitem = rec;
 				}
 				else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsSvgItem" )
@@ -328,7 +326,7 @@
 			else {
 				app=new QApplication( argc,argv ); //, QApplication::Tty );
 			}
-			scene = new QGraphicsScene( app );
+			scene = new QGraphicsScene();
 			loadFromXml( producer, scene, mlt_properties_get( producer_props, "xmldata" ), mlt_properties_get( producer_props, "templatetext" ), width, height );
 			mlt_properties_set_data( producer_props, "qscene", scene, 0, ( mlt_destructor )qscene_delete, NULL );
 		}
@@ -389,12 +387,6 @@
 		mlt_properties_set_data( producer_props, "cached_image", self->current_image, size, mlt_pool_release, NULL );
 		self->current_width = width;
 		self->current_height = height;
-
-		if ( end.isNull() )
-		{
-			// Clear scene, we don't need it anymore
-			mlt_properties_set_data( producer_props, "qscene", NULL, 0, NULL, NULL );
-		}
 	}

 	pthread_mutex_unlock( &self->mutex );


call to SSL_use_certifcate_chain_file was wrong - fixed

--- src/tcpsocketimpl.cpp
+++ src/tcpsocketimpl.cpp
@@ -1001,7 +1001,7 @@
 {
     log_debug("load ssl certificate file \"" << certFile << '"');
     initSsl();
-    int ret = SSL_use_certificate_chain_file(_ssl, certFile.c_str(), SSL_FILETYPE_PEM);
+    int ret = SSL_use_certificate_chain_file(_ssl, certFile.c_str());
     if (ret != 1)
         checkSslOperation(ret, "SSL_use_certificate_chain_file", _pfd);


voted_sensors_update: set priority properly in case of late mag subscriptions or sensors enabled param changes

--- src/modules/sensors/voted_sensors_update.cpp
+++ src/modules/sensors/voted_sensors_update.cpp
@@ -260,6 +260,8 @@

 			/* if the calibration is for this device, apply it */
 			if ((uint32_t)device_id == driver_device_id) {
+				if (!_gyro.enabled[driver_index]) { _gyro.priority[driver_index] = 0; }
+
 				struct gyro_calibration_s gscale = {};
 				(void)sprintf(str, "CAL_GYRO%u_XOFF", i);
 				failed = failed || (OK != param_get(param_find(str), &gscale.x_offset));
@@ -348,6 +350,8 @@

 			/* if the calibration is for this device, apply it */
 			if ((uint32_t)device_id == driver_device_id) {
+				if (!_accel.enabled[driver_index]) { _accel.priority[driver_index] = 0; }
+
 				struct accel_calibration_s ascale = {};
 				(void)sprintf(str, "CAL_ACC%u_XOFF", i);
 				failed = failed || (OK != param_get(param_find(str), &ascale.x_offset));
@@ -460,6 +464,10 @@

 			/* if the calibration is for this device, apply it */
 			if ((uint32_t)device_id == _mag_device_id[topic_instance]) {
+				// the mags that were published after the initial parameterUpdate
+				// would be given the priority even if disabled. Reset it to 0 in this case
+				if (!_mag.enabled[topic_instance]) { _mag.priority[topic_instance] = 0; }
+
 				struct mag_calibration_s mscale = {};
 				(void)sprintf(str, "CAL_MAG%u_XOFF", i);
 				failed = failed || (OK != param_get(param_find(str), &mscale.x_offset));
@@ -768,6 +776,15 @@

 				/* force a scale and offset update the first time we get data */
 				parametersUpdate();
+
+				if (!_mag.enabled[uorb_index]) {
+					/* in case the data on the mag topic comes after the initial parameterUpdate(), we would get here since the sensor
+					 * is enabled by default. The latest parameterUpdate() call would set enabled to false and reset priority to zero
+					 * for disabled sensors, and we shouldn't cal voter.put() in that case
+					 */
+					continue;
+				}
+
 			}

 			Vector3f vect(mag_report.x, mag_report.y, mag_report.z);


escape percent signs so wprintw won't replace them with random things

--- src/musikcube/app/window/TransportWindow.cpp
+++ src/musikcube/app/window/TransportWindow.cpp
@@ -304,6 +304,14 @@
             }
         }

+        /* any % in the value string might be parsed by wprintw, so replace it */
+        std::size_t percentSignIndex = value.find("%");
+        while (percentSignIndex != std::string::npos) {
+            value.replace(percentSignIndex, 1, "%%");
+            /* we replaced one % with 2 of them, so we need to skip ahead 2 chars */
+            percentSignIndex = value.find("%", percentSignIndex + 2);
+        }
+
         ON(w, attr);
         checked_wprintw(w, value.c_str());
         OFF(w, attr);
@@ -732,4 +740,4 @@
     OFF(c, repeatAttrs);

     this->Invalidate();
-}+}


Include custom name in appearance

Include custom name in appearance

--- src/netinterface/protocol/ServerCommands.cpp
+++ src/netinterface/protocol/ServerCommands.cpp
@@ -241,15 +241,17 @@
         if (receivingPlayer->knows(player)) {
             addStringToBuffer(player->getName());
         } else {
-            std::string german = "Jemand";
-            std::string english = "Someone";
-            addStringToBuffer(receivingPlayer->nls(german, english));
+            addStringToBuffer("");
         }
+
+        addStringToBuffer(receivingPlayer->getCustomNameOf(player));
     } else if (cc->getType() == Character::monster) {
         Monster *monster = dynamic_cast<Monster *>(cc);
         addStringToBuffer(receivingPlayer->nls(monster->nameDe, monster->getName()));
+        addStringToBuffer("");
     } else {
         addStringToBuffer(cc->getName());
+        addStringToBuffer("");
     }

     addShortIntToBuffer(cc->getRace());


Remove unused statement

Remove unused statement

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


From Ilka:
- all number entry widgets are connected to the
ReturnPressed() signal. This allows users to change a number entry value
using the keyboard and this value is accepted by the editor after
Return/Enter is pressed.
Some layout hints are changed for better look of the axis editor.

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

--- ged/src/TAxisEditor.cxx
+++ ged/src/TAxisEditor.cxx
@@ -1,4 +1,4 @@
-// @(#)root/ged:$Name:  $:$Id: TAxisEditor.cxx,v 1.4 2004/07/02 15:43:56 brun Exp $
+// @(#)root/ged:$Name:  $:$Id: TAxisEditor.cxx,v 1.5 2004/07/05 06:42:05 brun Exp $
 // Author: Ilka Antcheva   11/05/04

 /*************************************************************************
@@ -140,7 +140,7 @@
                                        TGNumberFormat::kNELLimitMinMax, 0, 99);
    fDiv1->GetNumberEntry()->SetToolTipText("Primary axis divisions");
    f5->AddFrame(fDiv1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1));
-   AddFrame(f5, new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0));
+   AddFrame(f5, new TGLayoutHints(kLHintsLeft, 1, 1, 4, 4));
    fTicksFlag = 1;

    MakeTitle("Title");
@@ -188,7 +188,7 @@
                                         TGNumberFormat::kNELLimitMinMax, 0.1, 10.);
    fTitleOffset->GetNumberEntry()->SetToolTipText("Set title offset");
    f8->AddFrame(fTitleOffset, new TGLayoutHints(kLHintsLeft, 6, 1, 0, 0));
-   AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
+   AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));

    MakeTitle("Labels");

@@ -261,25 +261,33 @@

    fAxisColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoAxisColor(Pixel_t)");
    fTickLength->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTickLength()");
+   (fTickLength->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTickLength()");
    fTicksBoth->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTicks()");
    fOptimize->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDivisions()");
    fLogAxis->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoLogAxis()");
    fMoreLog->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoMoreLog()");
    fDiv3->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
+   (fDiv3->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
    fDiv2->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
+   (fDiv2->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
    fDiv1->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
+   (fDiv1->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
    fTitle->Connect("TextChanged(const char *)", "TAxisEditor", this, "DoTitle(const char *)");;
    fTitleColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoTitleColor(Pixel_t)");
    fTitleSize->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTitleSize()");
+   (fTitleSize->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTitleSize()");
    fTitleFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoTitleFont(Int_t)");
    fCentered->Connect("Toggled(Bool_t)","TAxisEditor",this, "DoTitleCentered()");
    fRotated->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTitleRotated()");
    fTitleOffset->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoTitleOffset()");
+   (fTitleOffset->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoTitleOffset()");
    fLabelColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoLabelColor(Pixel_t)");
    fLabelSize->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoLabelSize()");
+   (fLabelSize->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoLabelSize()");
    fNoExponent->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoNoExponent()");
    fDecimal->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDecimal(Bool_t)");
    fLabelOffset->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoLabelOffset()");
+   (fLabelOffset->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoLabelOffset()");
    fLabelFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoLabelFont(Int_t)");
    fInit = kFALSE;
 }


From Ilka:
- all number entry widgets are connected to the
ReturnPressed() signal. This allows users to change a number entry value
using the keyboard and this value is accepted by the editor after
Return/Enter is pressed.
Some layout hints are changed for better look of the axis editor.

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


REMOVED intersectionTesting call

REMOVED intersectionTesting call

--- SSPSolution/physicsDLL/PhysicsHandler.cpp
+++ SSPSolution/physicsDLL/PhysicsHandler.cpp
@@ -575,7 +575,6 @@

 bool PhysicsHandler::Initialize()
 {
-	this->IntersectionTesting();
 	return true;
 }


fix warning in printf, use %ul for unsigned long and not %d.

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

--- geom/src/TGeoCache.cxx
+++ geom/src/TGeoCache.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCache.cxx,v 1.28 2004/04/23 12:42:06 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCache.cxx,v 1.29 2004/05/26 15:11:13 brun Exp $
 // Author: Andrei Gheata   18/03/02

 /*************************************************************************
@@ -185,7 +185,7 @@
    Int_t nnodes = gGeoManager->GetNNodes();
    //if (nnodes>3E7) return;
    if (fNodeIdArray) delete [] fNodeIdArray;
-   printf("--- node ID tracking enabled, size=%d Bytes\n", (2*nnodes+1)*sizeof(Int_t));
+   printf("--- node ID tracking enabled, size=%lu Bytes\n", (2*nnodes+1)*sizeof(Int_t));
    fNodeIdArray = new Int_t[2*nnodes+1];
    fNodeIdArray[0] = 0;
    Int_t ifree  = 1;
@@ -1631,7 +1631,7 @@
       if (current == last) continue;
       *fMatrixBranch[i] = current;
       last = current;
-   }
+   }
    fOverlapping = ovlp;
    if (point) memcpy(fPoint, point, 3*sizeof(Double_t));
 }
@@ -1654,7 +1654,7 @@
       if (current == last) continue;
       *current = fMatrixBranch[i];
       last = current;
-   }
+   }
    if (point) memcpy(point, fPoint, 3*sizeof(Double_t));
    return fOverlapping;
 }


Shader Sample applied linux bug fix found by dermont - Knot.mesh renamed to knot.mesh for linux.

--- Samples/ShaderSystem/src/ShaderSystem.cpp
+++ Samples/ShaderSystem/src/ShaderSystem.cpp
@@ -19,7 +19,7 @@
 const String MESH_ARRAY[MESH_ARRAY_SIZE] =
 {
 	MAIN_ENTITY_MESH,
-	"Knot.mesh"
+	"knot.mesh"
 };

 SamplePlugin* sp;
@@ -250,14 +250,14 @@
 	childNode->attachObject(entity);

 	// Create secondary entities that will be using custom RT Shader materials.
-	entity = mSceneMgr->createEntity("PerPixelEntity", "Knot.mesh");
+	entity = mSceneMgr->createEntity("PerPixelEntity", "knot.mesh");
 	entity->setMaterialName("RTSS/PerPixel_SinglePass");
 	childNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
 	childNode->setPosition(300.0, 100.0, -100.0);
 	childNode->attachObject(entity);

 	// Create secondary entities that will be using custom RT Shader materials.
-	entity = mSceneMgr->createEntity("NormalMapEntity", "Knot.mesh");
+	entity = mSceneMgr->createEntity("NormalMapEntity", "knot.mesh");
 	entity->setMaterialName("RTSS/NormalMapping_SinglePass");
 	childNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
 	childNode->setPosition(-300.0, 100.0, -100.0);


Add spin on node base interface inside start

--- 7.1/src/myworkcell_core/src/myworkcell_node.cpp
+++ 7.1/src/myworkcell_core/src/myworkcell_node.cpp
@@ -51,8 +51,8 @@

     auto future = vision_client_->async_send_request(request, response_received_callback);

-    //auto larry = rclcpp::Node::get_node_base_interface();
-    rclcpp::spin(rclcpp::Node::get_node_base_interface()); //this needs to be tested
+    // Make sure node doesn't exit using the node interface to spin
+    rclcpp::spin(rclcpp::Node::get_node_base_interface());
     }

@@ -82,8 +82,6 @@

   // Call the vision client's LocalizePart service using base_frame as a parameter
   app->start(base_frame);
-  // Spin on the node so we don't exit the program
-  rclcpp::spin(app);
   rclcpp::shutdown();
   return 0;
 }


o remove usage of obsolte kTOFpid bit for TPC+TOF histograms

--- ANALYSIS/ANALYSISalice/AliAnalysisTaskPIDqa.cxx
+++ ANALYSIS/ANALYSISalice/AliAnalysisTaskPIDqa.cxx
@@ -1555,7 +1555,7 @@
         !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||
 //         !( (status & AliVTrack::kTPCpid  ) == AliVTrack::kTPCpid ) || //removes light nuclei, so it is out for the moment
         !((status & AliVTrack::kTOFout  ) == AliVTrack::kTOFout  ) ||
-        !((status & AliVTrack::kTOFpid  ) == AliVTrack::kTOFpid  ) ||
+        //!((status & AliVTrack::kTOFpid  ) == AliVTrack::kTOFpid  ) || // not valid any longer with new TOF structure
         !((status & AliVTrack::kTIME    ) == AliVTrack::kTIME    ) ) continue;

     Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);


xml: Include posting-specific payee in output

In `ledger xml` export, include the `<posting>`-specific payee (from the
`Payee:` tag) as `<payee>`. This data is already included under
`<metadata>` as `<value key="Payee">`, but that is more specific to
Ledger's implementation; if in the future there is another way to set
the payee (or perhaps an option to have the Payee tag in one's own
language), that field wouldn't be a reliable method of getting this
info.

Example:

    2022-01-01 Transaction-level payee
        a                                             10
        b  ; Payee: Posting-level payee

Relevant XML output:

    <transaction>
      <date>2022-01-01</date>
      <payee>Transaction-level payee</payee>
      <postings>
        <posting>
          <account ref="0000558defd6f260">
            <name>a</name>
          </account>
          <post-amount>
            <amount>
              <quantity>10</quantity>
            </amount>
          </post-amount>
          <total>
            <amount>
              <quantity>10</quantity>
            </amount>
          </total>
        </posting>
        <posting>
          <payee>Posting-level payee</payee>
          <account ref="0000558defd6f960">
            <name>b</name>
          </account>
          <post-amount>
            <amount>
              <quantity>-10</quantity>
            </amount>
          </post-amount>
          <note> Payee: Posting-level payee</note>
          <metadata>
            <value key="Payee">
              <string>Posting-level payee</string>
            </value>
          </metadata>
          <total>
            <amount>
              <quantity>0</quantity>
            </amount>
          </total>
        </posting>
      </postings>
    </transaction>

--- src/post.cc
+++ src/post.cc
@@ -723,6 +723,9 @@
   if (post._date_aux)
     put_date(st.put("aux-date", ""), *post._date_aux);

+  if (post.payee_from_tag() != "")
+    st.put("payee", post.payee_from_tag());
+
   if (post.account) {
     property_tree::ptree& t(st.put("account", ""));


webm_info: Remove some dead code.

webm_info: Remove some dead code.

read_frame_length() is not used.

Change-Id: I46ae0a6d50d54190d512c6615b788f7c44d5f5b6

--- webm_info/webm_info.cc
+++ webm_info/webm_info.cc
@@ -499,27 +499,6 @@
   return true;
 }

-// This function reads the length of the first frame from a set of packed
-// frames. It works its way backward from the last frame by reading the lengths
-// of each frame and subtracting it till the first frame is reached.
-void read_frame_length(const unsigned char* data, int size, int* frame_length,
-                       int* size_length) {
-  int value = 0;
-  *size_length = 0;
-  do {
-    int index;
-    size -= value + *size_length;
-    index = size - 1;
-    value = 0;
-    do {
-      value <<= 7;
-      value |= (data[index] & 0x7F);
-    } while (!(data[index--] >> 7));
-    *size_length = size - 1 - index;
-  } while (value + *size_length < size);
-  *frame_length = value;
-}
-
 // libvpx reference: vp9/vp9_dx_iface.c
 void ParseSuperframeIndex(const uint8* data, size_t data_sz,
                           uint32 sizes[8], int* count) {


const operator[] for grid_objects

const operator[] for grid_objects

--- gftools/grid_object.hpp
+++ gftools/grid_object.hpp
@@ -130,6 +130,7 @@
 // Access operators
     /// Returns element number i, which corresponds to (*_grid)[i].
     auto operator[](size_t i)->decltype(data_[i]) { return data_[i]; };
+    auto operator[](size_t i) const -> const decltype(data_[i]) { return data_[i]; };
     //template <size_t M> value_type& operator[](const std::array<size_t,M>& in);
     /// Returns tail_(in).
     value_type tail_eval(const arg_tuple& in) const { return tuple_tools::unfold_tuple(tail_, in); }