[TRAFODION-2754] Get statistics cores sqlci or mxosrvr at str_sprintf()

Fix for executor/TEST130 failure in daily build

--- core/sql/clitest/blobtest.cpp
+++ core/sql/clitest/blobtest.cpp
@@ -44,7 +44,7 @@
   char lobLengthResult[200];
   str_cpy_all(lobLengthResult," ",200);
   Int32 lobLengthResultLen = 0;
-  str_sprintf(query,"extract loblength (lob '%s') LENGTH %ld ",lobHandle, lengthOfLob);
+  sprintf(query,"extract loblength (lob '%s') LOCATION %lu ",lobHandle, (unsigned long)&lengthOfLob);
   retcode = cliInterface.executeImmediate(query,lobLengthResult,&lobLengthResultLen,FALSE);

   delete query;
@@ -59,7 +59,7 @@
   ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL);
   char * query = new char[4096];
   Int32 lobHandleLen = 0;
-  str_sprintf(query,"select %s from %s",lobColumnName,tableName);
+  sprintf(query,"select %s from %s",lobColumnName,tableName);

   retcode = cliInterface.executeImmediate(query,lobHandle,&lobHandleLen,FALSE);

@@ -84,7 +84,7 @@
   Int64 lobExtractLen = 10000;
   char *lobDataBuf = new char[lobExtractLen];

-  str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %ld, SIZE %ld) ", lobHandle, (Int64)lobDataBuf, lobExtractLen);
+  sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %lu, SIZE %ld) ", lobHandle, (unsigned long)lobDataBuf, lobExtractLen);

   retcode = cliInterface.executeImmediatePrepare(query);
@@ -107,7 +107,7 @@

       fclose(lobFileId);
     }
-  str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %ld, SIZE 0) ", lobHandle, (Int64)lobDataBuf);
+  sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %lu, SIZE 0) ", lobHandle, (unsigned long)lobDataBuf);

   cliInterface.clearExecFetchClose(NULL,NULL,statusBuf, &statusBufLen);
   delete  lobFinalBuf;
@@ -135,7 +135,7 @@
   char *lobDataBuf = new char[lobExtractLen];
   Int64 *inputOutputAddr = &lobExtractLen;

-  str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %ld, SIZE %ld) ", lobHandle, (Int64)lobDataBuf, lobExtractLen);
+  sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %lu, SIZE %lu) ", lobHandle, (unsigned long)lobDataBuf, (unsigned long)inputOutputAddr);

   retcode = cliInterface.executeImmediatePrepare(query);
@@ -152,7 +152,7 @@
 	}
     }
   lobExtractLen = 0;
-  str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %ld, SIZE %ld) ", lobHandle, (Int64)lobDataBuf, lobExtractLen);
+  sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %lu, SIZE %ld) ", lobHandle, (unsigned long)lobDataBuf, (unsigned long)inputOutputAddr);
   retcode = cliInterface.executeImmediatePrepare(query);
   cliInterface.clearExecFetchClose(NULL,NULL,statusBuf, &statusBufLen);

@@ -181,7 +181,7 @@
   Int64 lobInsertLen = 10;
   char *lobDataBuf = new char[lobInsertLen];
   memcpy(lobDataBuf, "xxxxxyyyyy",10);
-  str_sprintf(query,"insert into %s values (1, buffertolob (LOCATION %ld, SIZE %ld))", tableName,(Int64)lobDataBuf, lobInsertLen);
+  sprintf(query,"insert into %s values (1, buffertolob (LOCATION %lu, SIZE %ld))", tableName, (unsigned long)lobDataBuf, lobInsertLen);

   retcode = cliInterface.executeImmediate(query);
@@ -217,7 +217,7 @@
   Int64 lobUpdateLen = 20;
   char *lobDataBuf = new char[lobUpdateLen];
   memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
-  str_sprintf(query,"update %s set %s= buffertolob(LOCATION %ld, SIZE %ld)", tableName,columnName, (Int64)lobDataBuf, lobUpdateLen);
+  sprintf(query,"update %s set %s= buffertolob(LOCATION %lu, SIZE %ld)", tableName,columnName, (unsigned long)lobDataBuf, lobUpdateLen);

   retcode = cliInterface.executeImmediate(query);
@@ -253,7 +253,7 @@
   Int64 lobUpdateLen = 15;
   char *lobDataBuf = new char[lobUpdateLen];
   memcpy(lobDataBuf, "aaaaabbbbbccccc",15);
-  str_sprintf(query,"update %s set %s=buffertolob (LOCATION %ld, SIZE %ld,append)", tableName, columnName,(Int64)lobDataBuf, lobUpdateLen);
+  sprintf(query,"update %s set %s=buffertolob (LOCATION %lu, SIZE %ld,append)", tableName, columnName, (unsigned long)lobDataBuf, lobUpdateLen);

   retcode = cliInterface.executeImmediate(query);
@@ -288,7 +288,7 @@
   Int64 lobUpdateLen = 20;
   char *lobDataBuf = new char[lobUpdateLen];
   memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
-  str_sprintf(query,"update lob (LOB '%s' , LOCATION %ld, SIZE %ld)", handle, (Int64)lobDataBuf, lobUpdateLen);
+  sprintf(query,"update lob (LOB '%s' , LOCATION %lu, SIZE %ld)", handle, (unsigned long)lobDataBuf, lobUpdateLen);

   retcode = cliInterface.executeImmediate(query);
@@ -321,7 +321,7 @@
   Int32 statusBufLen = 0;
   char *lobDataBuf = new char[lobUpdateLen];
   memcpy(lobDataBuf, (char *)sourceAddress,lobUpdateLen);
-  str_sprintf(query,"update lob (LOB '%s' , LOCATION %ld, SIZE %ld,append )", handle, (Int64)lobDataBuf, lobUpdateLen);
+  sprintf(query,"update lob (LOB '%s' , LOCATION %lu, SIZE %ld,append )", handle, (unsigned long)lobDataBuf, lobUpdateLen);

   retcode = cliInterface.executeImmediate(query);
@@ -356,23 +356,23 @@
   Int64 lobUpdateLen = 20;
   char *lobDataBuf = new char[lobUpdateLen];
   memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
-  str_sprintf(query,"update lob (LOB '%s' , empty_blob())", handle);
-
-
-  retcode = cliInterface.executeImmediate(query);
-  if (retcode <0)
-    {
-      cliInterface.executeImmediate("rollback work");
-      delete query;
-      delete lobDataBuf;
-      return retcode;
-    }
-
-  retcode = cliInterface.executeImmediate("commit work");
-  delete query;
-  delete lobDataBuf;
-
-
-  return retcode;
-
-}
+  sprintf(query,"update lob (LOB '%s' , empty_blob())", handle);
+
+
+  retcode = cliInterface.executeImmediate(query);
+  if (retcode <0)
+    {
+      cliInterface.executeImmediate("rollback work");
+      delete query;
+      delete lobDataBuf;
+      return retcode;
+    }
+
+  retcode = cliInterface.executeImmediate("commit work");
+  delete query;
+  delete lobDataBuf;
+
+
+  return retcode;
+
+}


StackTrace() is not supported on iOS.

StackTrace() is not supported on iOS.

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

--- core/unix/src/TUnixSystem.cxx
+++ core/unix/src/TUnixSystem.cxx
@@ -429,7 +429,9 @@
          if (!gSystem->Getenv("ROOTSYS"))
             ::SysError("TUnixSystem::DylibAdded", "error getting realpath of %s", gSystem->BaseName(lib));
       } else {
-         gSystem->Setenv("ROOTSYS", gSystem->DirName(respath));
+         TString rs = gSystem->DirName(respath);
+         rs.ReplaceAll(" ", "\\ ");
+         gSystem->Setenv("ROOTSYS", rs);
       }
    }
 #else
@@ -2061,6 +2063,13 @@
    if (!gEnv->GetValue("Root.Stacktrace", 1))
       return;

+#if defined(R__MACOSX)
+   if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) {
+      fprintf(stderr, "Info in <TUnixSystem::StackTrace> function not supported on iOS\n");
+      return;
+   }
+#endif
+
    TString gdbscript = gEnv->GetValue("Root.StacktraceScript", "");
    gdbscript = gdbscript.Strip();
    if (gdbscript != "") {
@@ -2073,10 +2082,15 @@
    }
    if (gdbscript == "") {
 #ifdef ROOTETCDIR
-      gdbscript.Form("%s/gdb-backtrace.sh ", ROOTETCDIR);
-#else
-      gdbscript.Form("%s/etc/gdb-backtrace.sh ", gSystem->Getenv("ROOTSYS"));
-#endif
+      gdbscript.Form("%s/gdb-backtrace.sh", ROOTETCDIR);
+#else
+      gdbscript.Form("%s/etc/gdb-backtrace.sh", gSystem->Getenv("ROOTSYS"));
+#endif
+      if (AccessPathName(gdbscript, kReadPermission)) {
+         fprintf(stderr, "Error in <TUnixSystem::StackTrace> script %s is missing\n", gdbscript.Data());
+         return;
+      }
+      gdbscript += " ";
    }

    TString gdbmess = gEnv->GetValue("Root.StacktraceMessage", "");


split out message and block fragment serialize functions

--- yojimbo_channel.cpp
+++ yojimbo_channel.cpp
@@ -60,6 +60,148 @@
         }
     }

+    template <typename Stream> bool SerializeOrderedMessages( Stream & stream, MessageFactory & messageFactory, int & numMessages, Message ** & messages, int maxMessagesPerPacket )
+    {
+        const int maxMessageType = messageFactory.GetNumTypes() - 1;
+
+        bool hasMessages = Stream::IsWriting && numMessages != 0;
+
+        serialize_bool( stream, hasMessages );
+
+        if ( hasMessages )
+        {
+            serialize_int( stream, numMessages, 1, maxMessagesPerPacket );
+
+            int * messageTypes = (int*) alloca( sizeof( int ) * numMessages );
+
+            uint16_t * messageIds = (uint16_t*) alloca( sizeof( uint16_t ) * numMessages );
+
+            memset( messageTypes, 0, sizeof( int ) * numMessages );
+            memset( messageIds, 0, sizeof( uint16_t ) * numMessages );
+
+            if ( Stream::IsWriting )
+            {
+                assert( messages );
+
+                for ( int i = 0; i < numMessages; ++i )
+                {
+                    assert( messages[i] );
+                    messageTypes[i] = messages[i]->GetType();
+                    messageIds[i] = messages[i]->GetId();
+                }
+            }
+            else
+            {
+                Allocator & allocator = messageFactory.GetAllocator();
+
+                messages = (Message**) allocator.Allocate( sizeof( Message* ) * numMessages );
+            }
+
+            serialize_bits( stream, messageIds[0], 16 );
+
+            for ( int i = 1; i < numMessages; ++i )
+                serialize_sequence_relative( stream, messageIds[i-1], messageIds[i] );
+
+            for ( int i = 0; i < numMessages; ++i )
+            {
+                if ( maxMessageType > 0 )
+                {
+                    serialize_int( stream, messageTypes[i], 0, maxMessageType );
+                }
+                else
+                {
+                    messageTypes[i] = 0;
+                }
+
+                if ( Stream::IsReading )
+                {
+                    messages[i] = messageFactory.Create( messageTypes[i] );
+
+                    if ( !messages[i] )
+                        return false;
+
+                    messages[i]->AssignId( messageIds[i] );
+                }
+
+                assert( messages[i] );
+
+                if ( !messages[i]->SerializeInternal( stream ) )
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    template <typename Stream> bool SerializeUnorderedMessages( Stream & stream, MessageFactory & messageFactory, int & numMessages, Message ** messages, int maxMessagesPerPacket )
+    {
+        (void)stream;
+        (void)messageFactory;
+        (void)numMessages;
+        (void)messages;
+        (void)maxMessagesPerPacket;
+        return true;
+    }
+
+    template <typename Stream> bool SerializeBlockFragment( Stream & stream, MessageFactory & messageFactory, ChannelPacketData::BlockData & block, const ChannelConfig & channelConfig )
+    {
+        const int maxMessageType = messageFactory.GetNumTypes() - 1;
+
+        serialize_bits( stream, block.messageId, 16 );
+
+        serialize_int( stream, block.numFragments, 1, channelConfig.GetMaxFragmentsPerBlock() );
+
+        if ( block.numFragments > 1 )
+        {
+            serialize_int( stream, block.fragmentId, 0, block.numFragments - 1 );
+        }
+        else
+        {
+            block.fragmentId = 0;
+        }
+
+        serialize_int( stream, block.fragmentSize, 1, channelConfig.fragmentSize );
+
+        if ( Stream::IsReading )
+        {
+            block.fragmentData = (uint8_t*) messageFactory.GetAllocator().Allocate( block.fragmentSize );
+
+            if ( !block.fragmentData )
+                return false;
+        }
+
+        serialize_bytes( stream, block.fragmentData, block.fragmentSize );
+
+        if ( block.fragmentId == 0 )
+        {
+            // block message
+
+            serialize_int( stream, block.messageType, 0, maxMessageType );
+
+            if ( Stream::IsReading )
+            {
+                Message * msg = messageFactory.Create( block.messageType );
+
+                if ( !msg || !msg->IsBlockMessage() )
+                    return false;
+
+                block.message = (BlockMessage*) msg;
+            }
+
+            assert( block.message );
+
+            if ( !block.message->SerializeInternal( stream ) )
+                return false;
+        }
+        else
+        {
+            if ( Stream::IsReading )
+                block.message = NULL;
+        }
+
+        return true;
+    }
+
     template <typename Stream> bool ChannelPacketData::Serialize( Stream & stream, MessageFactory & messageFactory, const ChannelConfig * channelConfigs, int numChannels )
     {
 #if YOJIMBO_VALIDATE_PACKET_BUDGET
@@ -73,79 +215,12 @@

         const ChannelConfig & channelConfig = channelConfigs[channelId];

-        const int maxMessageType = messageFactory.GetNumTypes() - 1;
-
         serialize_bool( stream, blockMessage );

         if ( !blockMessage )
         {
-            // serialize messages
-
-            bool hasMessages = Stream::IsWriting && message.numMessages != 0;
-
-            serialize_bool( stream, hasMessages );
-
-            if ( hasMessages )
-            {
-                serialize_int( stream, message.numMessages, 1, channelConfig.maxMessagesPerPacket );
-
-                int * messageTypes = (int*) alloca( sizeof( int ) * message.numMessages );
-
-                uint16_t * messageIds = (uint16_t*) alloca( sizeof( uint16_t ) * message.numMessages );
-
-                memset( messageTypes, 0, sizeof( int ) * message.numMessages );
-                memset( messageIds, 0, sizeof( uint16_t ) * message.numMessages );
-
-                if ( Stream::IsWriting )
-                {
-                    assert( message.messages );
-
-                    for ( int i = 0; i < message.numMessages; ++i )
-                    {
-                        assert( message.messages[i] );
-                        messageTypes[i] = message.messages[i]->GetType();
-                        messageIds[i] = message.messages[i]->GetId();
-                    }
-                }
-                else
-                {
-                    Allocator & allocator = messageFactory.GetAllocator();
-
-                    message.messages = (Message**) allocator.Allocate( sizeof( Message* ) * message.numMessages );
-                }
-
-                serialize_bits( stream, messageIds[0], 16 );
-
-                for ( int i = 1; i < message.numMessages; ++i )
-                    serialize_sequence_relative( stream, messageIds[i-1], messageIds[i] );
-
-                for ( int i = 0; i < message.numMessages; ++i )
-                {
-                    if ( maxMessageType > 0 )
-                    {
-                        serialize_int( stream, messageTypes[i], 0, maxMessageType );
-                    }
-                    else
-                    {
-                        messageTypes[i] = 0;
-                    }
-
-                    if ( Stream::IsReading )
-                    {
-                        message.messages[i] = messageFactory.Create( messageTypes[i] );
-
-                        if ( !message.messages[i] )
-                            return false;
-
-                        message.messages[i]->AssignId( messageIds[i] );
-                    }
-
-                    assert( message.messages[i] );
-
-                    if ( !message.messages[i]->SerializeInternal( stream ) )
-                        return false;
-                }
-            }
+            if ( !SerializeOrderedMessages( stream, messageFactory, message.numMessages, message.messages, channelConfig.maxMessagesPerPacket ) )
+                return false;

 #if YOJIMBO_VALIDATE_PACKET_BUDGET
             if ( channelConfig.messagePacketBudget > 0 )
@@ -156,62 +231,11 @@
         }
         else
         {
-            // block message
-
             if ( channelConfig.disableBlocks )
                 return false;

-            serialize_bits( stream, block.messageId, 16 );
-
-            serialize_int( stream, block.numFragments, 1, channelConfig.GetMaxFragmentsPerBlock() );
-
-            if ( block.numFragments > 1 )
-            {
-                serialize_int( stream, block.fragmentId, 0, block.numFragments - 1 );
-            }
-            else
-            {
-                block.fragmentId = 0;
-            }
-
-            serialize_int( stream, block.fragmentSize, 1, channelConfig.fragmentSize );
-
-            if ( Stream::IsReading )
-            {
-                block.fragmentData = (uint8_t*) messageFactory.GetAllocator().Allocate( block.fragmentSize );
-
-                if ( !block.fragmentData )
-                    return false;
-            }
-
-            serialize_bytes( stream, block.fragmentData, block.fragmentSize );
-
-            if ( block.fragmentId == 0 )
-            {
-                // block message
-
-                serialize_int( stream, block.messageType, 0, maxMessageType );
-
-                if ( Stream::IsReading )
-                {
-                    Message * msg = messageFactory.Create( block.messageType );
-
-                    if ( !msg || !msg->IsBlockMessage() )
-                        return false;
-
-                    block.message = (BlockMessage*) msg;
-                }
-
-                assert( block.message );
-
-                if ( !block.message->SerializeInternal( stream ) )
-                    return false;
-            }
-            else
-            {
-                if ( Stream::IsReading )
-                    block.message = NULL;
-            }
+            if ( !SerializeBlockFragment( stream, messageFactory, block, channelConfig ) )
+                return false;
         }

         return true;


Could be NULL (Coverity)

Could be NULL (Coverity)

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

--- cint/cint/src/pause.cxx
+++ cint/cint/src/pause.cxx
@@ -1305,7 +1305,11 @@
          if (isspace(*redirectin)) {
             *psin = G__sin;
 #ifndef G__WIN32
-            if (!strlen(stdinsav)) G__strlcpy(stdinsav, ttyname(STDIN_FILENO),sizeof(stdinsav));
+            if (!strlen(stdinsav) && ttyname(STDIN_FILENO)) {
+               G__strlcpy(stdinsav, ttyname(STDIN_FILENO), sizeof(stdinsav));
+            } else {
+               stdinsav[0] = 0;
+            }
 #endif
             G__sin = freopen(filename, "r", G__sin);
             if (!G__sin) {


add RGB565 for Mesa, assert that RGB565 is available

--- src/PrimitiveRenderer.cpp
+++ src/PrimitiveRenderer.cpp
@@ -121,11 +121,13 @@
       }
       has_rgb565 = true;
     } else if (parts.size() >= 2 && parts[1] == "Mesa") {
-
+      has_rgb565 = true;
     } else {
       assert(0);
     }
   }
+
+  assert(has_rgb565);

   int ii;
   glGetIntegerv(GL_MAX_TEXTURE_SIZE, &ii);


added quit

added quit

--- inbuilt.cc
+++ inbuilt.cc
@@ -403,6 +403,11 @@
     sta LSB,x
     rts ;code)";

+static const char quit[] = R"(:code quit
+    ldx #$ff
+    txs
+    rts ;code)";
+
 // -----

 const char* getDefinition(const char* wordName) {
@@ -411,6 +416,7 @@
         const char* definition;
     };
     static const Pair defs[] = {
+        { "quit", quit },
         { "invert", invert },
         { ">r", tor },
         { "emit", emit },


add #include for Linux

add #include for Linux

--- html_generator/main.cpp
+++ html_generator/main.cpp
@@ -12,6 +12,7 @@
 #include <beast/http/write.hpp>
 #include <beast/core/streambuf.hpp>
 #include <ventura/read_file.hpp>
+#include <boost/asio/ip/tcp.hpp>

 namespace
 {


Make Catch2 and MSVC play nice together

Make Catch2 and MSVC play nice together

--- turner/msturn.test.cpp
+++ turner/msturn.test.cpp
@@ -12,41 +12,41 @@
 {
 	SECTION("method registry")
 	{
-		CHECK(turner::msturn::allocate == 0x0003);
-		CHECK(turner::msturn::allocate_success == 0x0103);
-		CHECK(turner::msturn::allocate_error == 0x0113);
-		CHECK(turner::msturn::send_request == 0x0004);
-		CHECK(turner::msturn::data_indication == 0x0115);
-		CHECK(turner::msturn::set_active_destination == 0x0006);
-		CHECK(turner::msturn::set_active_destination_success == 0x0106);
-		CHECK(turner::msturn::set_active_destination_error == 0x0116);
+		CHECK(turner::msturn::allocate == 0x0003_u16);
+		CHECK(turner::msturn::allocate_success == 0x0103_u16);
+		CHECK(turner::msturn::allocate_error == 0x0113_u16);
+		CHECK(turner::msturn::send_request == 0x0004_u16);
+		CHECK(turner::msturn::data_indication == 0x0115_u16);
+		CHECK(turner::msturn::set_active_destination == 0x0006_u16);
+		CHECK(turner::msturn::set_active_destination_success == 0x0106_u16);
+		CHECK(turner::msturn::set_active_destination_error == 0x0116_u16);
 	}

 	SECTION("attribute registry")
 	{
-		CHECK(turner::msturn::mapped_address == 0x0001);
-		CHECK(turner::msturn::username == 0x0006);
-		CHECK(turner::msturn::message_integrity == 0x0008);
-		CHECK(turner::msturn::error_code == 0x0009);
-		CHECK(turner::msturn::unknown_attributes == 0x000a);
-		CHECK(turner::msturn::lifetime == 0x000d);
-		CHECK(turner::msturn::alternate_server == 0x000e);
-		CHECK(turner::msturn::bandwidth == 0x0010);
-		CHECK(turner::msturn::destination_address == 0x0011);
-		CHECK(turner::msturn::remote_address == 0x0012);
-		CHECK(turner::msturn::data == 0x0013);
-		CHECK(turner::msturn::nonce == 0x0014);
-		CHECK(turner::msturn::realm == 0x0015);
-		CHECK(turner::msturn::requested_address_family == 0x0017);
-		CHECK(turner::msturn::ms_version == 0x8008);
-		CHECK(turner::msturn::xor_mapped_address == 0x8020);
-		CHECK(turner::msturn::ms_alternate_host_name == 0x8032);
-		CHECK(turner::msturn::app_id == 0x8037);
-		CHECK(turner::msturn::secure_tag == 0x8039);
-		CHECK(turner::msturn::ms_sequence_number == 0x8050);
-		CHECK(turner::msturn::ms_service_quality == 0x8055);
-		CHECK(turner::msturn::ms_alternate_mapped_address == 0x8090);
-		CHECK(turner::msturn::multiplexed_session_id == 0x8095);
+		CHECK(turner::msturn::mapped_address == 0x0001_u16);
+		CHECK(turner::msturn::username == 0x0006_u16);
+		CHECK(turner::msturn::message_integrity == 0x0008_u16);
+		CHECK(turner::msturn::error_code == 0x0009_u16);
+		CHECK(turner::msturn::unknown_attributes == 0x000a_u16);
+		CHECK(turner::msturn::lifetime == 0x000d_u16);
+		CHECK(turner::msturn::alternate_server == 0x000e_u16);
+		CHECK(turner::msturn::bandwidth == 0x0010_u16);
+		CHECK(turner::msturn::destination_address == 0x0011_u16);
+		CHECK(turner::msturn::remote_address == 0x0012_u16);
+		CHECK(turner::msturn::data == 0x0013_u16);
+		CHECK(turner::msturn::nonce == 0x0014_u16);
+		CHECK(turner::msturn::realm == 0x0015_u16);
+		CHECK(turner::msturn::requested_address_family == 0x0017_u16);
+		CHECK(turner::msturn::ms_version == 0x8008_u16);
+		CHECK(turner::msturn::xor_mapped_address == 0x8020_u16);
+		CHECK(turner::msturn::ms_alternate_host_name == 0x8032_u16);
+		CHECK(turner::msturn::app_id == 0x8037_u16);
+		CHECK(turner::msturn::secure_tag == 0x8039_u16);
+		CHECK(turner::msturn::ms_sequence_number == 0x8050_u16);
+		CHECK(turner::msturn::ms_service_quality == 0x8055_u16);
+		CHECK(turner::msturn::ms_alternate_mapped_address == 0x8090_u16);
+		CHECK(turner::msturn::multiplexed_session_id == 0x8095_u16);
 	}
 }


Linux Build Fix

Linux Build Fix

--- engine/core/Package.cpp
+++ engine/core/Package.cpp
@@ -16,6 +16,7 @@

 #include <cstring>
 #include <cstdio>
+#include <cstdlib>
 #include <cassert>
 #include "zlib.h"
 #include "aeongames/Package.h"


[NFC][clangd] Remove unused lambda capture

Avoid this warning:

llvm/clang-tools-extra/clangd/ClangdServer.cpp:365:23: warning: lambda
capture 'this' is not used [-Wunused-lambda-capture]

  auto Action = [Sel, this](decltype(CB) CB, std::string File,
                    ~~^~~~
1 warning generated.

git-svn-id: a34e9779ed74578ad5922b3306b3d80a0c825546@353760 91177308-0d34-0410-b5e6-96231b3b80d8

--- clangd/ClangdServer.cpp
+++ clangd/ClangdServer.cpp
@@ -362,7 +362,7 @@

 void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
                               Callback<tooling::Replacements> CB) {
-  auto Action = [Sel, this](decltype(CB) CB, std::string File,
+  auto Action = [Sel](decltype(CB) CB, std::string File,
                             std::string TweakID,
                             Expected<InputsAndAST> InpAST) {
     if (!InpAST)


Add listen and send threads.

Add listen and send threads.

--- experiment/cbclient.cpp
+++ experiment/cbclient.cpp
@@ -15,7 +15,7 @@
 //
 //	Caution when building Boost 1.55 under MinGW on XP. You SHOULD convert the build.bat
 //	from Unix line endings to DOS line endings and you MUST ensure that the TMP and
-//	TEMP user variables do not point to directories names that have spaces in them.
+//	TEMP user variables do not point to directory names that have spaces in them.
 //
 //	Usage:
 //		cbclient <chatterbox-host> [<chatterbox-port>]
@@ -29,6 +29,7 @@
 #include <boost/thread.hpp>
 #include <boost/asio.hpp>

+using std::ostream;
 using std::cout;
 using std::cin;
 using std::cerr;
@@ -41,7 +42,18 @@
 bool get_cmdline_args(int argc, char* argv[], string &host, string &port);
 string socket_gets(tcp::socket& socket);
 void socket_puts(tcp::socket& socket, const string& msg);
-
+void do_listen(tcp::socket& socket);
+void do_talk(tcp::socket& socket);
+string chomp(const string& s);
+void put_to_stream(ostream& o, const string& s);
+
+//	Ugh, I know, global variables, but this will change. We're experimenting
+//		for now.
+bool done_chatting = false;
+boost::mutex done_chatting_mtx;
+boost::mutex output_mtx;
+bool get_done_chatting();
+void set_done_chatting();

 int main(int argc, char* argv[]) {

@@ -70,19 +82,81 @@
 		//	Let user enter an id
 		string user_id;
 		getline(cin, user_id);
+		user_id += '\n';

 		//	Send the user ID
 		socket_puts(socket, user_id);

-		//	Say goodbye
-		socket_puts(socket, "bye");
+		cout << done_chatting << endl;
+
+		boost::thread listen_thread(do_listen, boost::ref(socket));
+		boost::thread talk_thread(do_talk, boost::ref(socket));
+
+		listen_thread.join();
+		talk_thread.join();
 	}
 	catch (std::exception& e) {
 		cerr << e.what() << endl;
 	}

-	//boost::thread t;
 	return 0;
+}
+
+void do_listen(tcp::socket& socket) {
+	cout << "In do_listen()" << endl;
+	while(!get_done_chatting()) {
+		string msg_received = socket_gets(socket);
+		cout << '<' << chomp(msg_received) << '>' << endl;
+
+		if(msg_received == "bye") {
+			set_done_chatting();
+		}
+	}
+}
+
+void do_talk(tcp::socket& socket) {
+	cout << "In do_talk()" << endl;
+	while(!get_done_chatting()) {
+		string msg_to_send;
+		getline(cin, msg_to_send);
+		msg_to_send += '\n';
+
+		socket_puts(socket, msg_to_send);
+
+		if(chomp(msg_to_send) == "bye") {
+			set_done_chatting();
+		}
+	}
+}
+
+void put_to_stream(ostream& o, const string& s) {
+	boost::lock_guard<boost::mutex> guard(output_mtx);
+	o << s;
+}
+
+
+string chomp(const string& s) {
+
+	const std::string whitespaces (" \t\f\v\n\r");
+	string chomped = s;
+
+	std::size_t found = chomped.find_last_not_of(whitespaces);
+	if (found != std::string::npos)
+		chomped.erase(found+1);
+	else
+		chomped.clear();
+
+	return chomped;
+}
+
+bool get_done_chatting() {
+	boost::lock_guard<boost::mutex> guard(done_chatting_mtx);
+	return done_chatting;
+}
+
+void set_done_chatting() {
+	boost::lock_guard<boost::mutex> guard(done_chatting_mtx);
+	done_chatting = true;
 }


enabled downcasting only on base classes

git-svn-id: 798ddaf8a6378b58a8fe2f38b191889029e27a7f@67 ea8d5007-eb21-0410-b261-ccb3ea6e24a9

--- src/PythonQtClassInfo.cpp
+++ src/PythonQtClassInfo.cpp
@@ -695,7 +695,19 @@
 void* PythonQtClassInfo::castDownIfPossible(void* ptr, PythonQtClassInfo** resultClassInfo)
 {
   char* className;
-  void* resultPtr = recursiveCastDownIfPossible(ptr, &className);
+  // this would do downcasting recursively...
+  // void* resultPtr = recursiveCastDownIfPossible(ptr, &className);
+
+  // we only do downcasting on the base object, not on the whole inheritance tree...
+  void* resultPtr = NULL;
+  if (!_polymorphicHandlers.isEmpty()) {
+    foreach(PythonQtPolymorphicHandlerCB* cb, _polymorphicHandlers) {
+      resultPtr = (*cb)(ptr, &className);
+      if (resultPtr) {
+        break;
+      }
+    }
+  }
   if (resultPtr) {
     *resultClassInfo = PythonQt::priv()->getClassInfo(className);
   } else {


temporary remove progress

temporary remove progress

--- cpp/hdfs_wfx/src/hdfs_wfx.cpp
+++ cpp/hdfs_wfx/src/hdfs_wfx.cpp
@@ -143,7 +143,7 @@
 int FsGetFile(char* RemoteName, char* LocalName, int CopyFlags, RemoteInfoStruct* ri)
 {
     LOGGING("FsGetFile from %s to %s wiht copy flags %d", RemoteName, LocalName, CopyFlags);
-    ProgressInfo* progressInfo = new ProgressInfo(RemoteName, LocalName, gProgressProc, gPluginNo);
+    ProgressInfo* progressInfo = NULL;//new ProgressInfo(RemoteName, LocalName, gProgressProc, gPluginNo);
     bool success = HDFSAccessor::instance()->getFile(RemoteName, LocalName, progressInfo);
     delete progressInfo;
     return success ? FS_FILE_OK : FS_FILE_READERROR;
@@ -154,7 +154,7 @@
 int FsPutFile(char* LocalName, char* RemoteName, int CopyFlags)
 {
     LOGGING("FsPutFile Local path %s in HDFS path %s with flags %d", LocalName, RemoteName, CopyFlags);
-    ProgressInfo* progressInfo = new ProgressInfo(LocalName, RemoteName, gProgressProc, gPluginNo);
+    ProgressInfo* progressInfo = NULL;//new ProgressInfo(LocalName, RemoteName, gProgressProc, gPluginNo);
     bool success = HDFSAccessor::instance()->putFile(LocalName, RemoteName, true, progressInfo);
     delete progressInfo;
     return success ? FS_FILE_OK : FS_FILE_WRITEERROR;


Apparently there are no PDA subscriptions on KimDok systems.

--- cpp/merge_print_and_online.cc
+++ cpp/merge_print_and_online.cc
@@ -1147,9 +1147,10 @@
         std::shared_ptr<DbConnection> db_connection(VuFind::GetDbConnection());

         const auto tue_find_flavour(VuFind::GetTueFindFlavour());
-        if (tue_find_flavour == "ixtheo")
+        if (tue_find_flavour == "ixtheo") {
             PatchSerialSubscriptions(db_connection.get(), ppn_to_canonical_ppn_map);
-        PatchPDASubscriptions(db_connection.get(), ppn_to_canonical_ppn_map);
+            PatchPDASubscriptions(db_connection.get(), ppn_to_canonical_ppn_map);
+        }
         PatchResourceTable(db_connection.get(), ppn_to_canonical_ppn_map);
     }


pick random victim

pick random victim

--- cpp/src/lib/manifest_cache.cc
+++ cpp/src/lib/manifest_cache.cc
@@ -69,6 +69,10 @@

     if (manifest_cache.size() > _manifest_cache_capacity) {
       auto it_victim = manifest_cache.begin();
+      int size = manifest_cache.size();
+      if (size > 0) {
+        std::advance(it_victim, rand() % size); // O(size) :(
+      }
       auto victim = it_victim->first;
       using namespace alba::stuff;
       ALBA_LOG(DEBUG, "cache '" << namespace_ << "' full("


sparse branch: Add tracing of for_sparse_jac and for_sparse_hes values.

--- cppad/local/for_hes_sweep.hpp
+++ cppad/local/for_hes_sweep.hpp
@@ -119,14 +119,15 @@
 	size_t             i, j, k;

 	// check numvar argument
+	size_t limit = n+1;
 	CPPAD_ASSERT_UNKNOWN( play->num_var_rec()    == numvar );
 	CPPAD_ASSERT_UNKNOWN( for_jac_sparse.n_set() == numvar );
-	CPPAD_ASSERT_UNKNOWN( for_hes_sparse.n_set() == n+1 );
+	CPPAD_ASSERT_UNKNOWN( for_hes_sparse.n_set() == limit );
 	CPPAD_ASSERT_UNKNOWN( numvar > 0 );

 	// upper limit exclusive for set elements
-	size_t limit   = for_hes_sparse.end();
 	CPPAD_ASSERT_UNKNOWN( for_jac_sparse.end() == limit );
+	CPPAD_ASSERT_UNKNOWN( for_hes_sparse.end() == limit );

 	// vecad_sparsity contains a sparsity pattern for each VecAD object.
 	// vecad_ind maps a VecAD index (beginning of the VecAD object)
@@ -205,7 +206,7 @@
 # if CPPAD_FOR_HES_SWEEP_TRACE
 	std::cout << std::endl;
 	CppAD::vectorBool zf_value(limit);
-	CppAD::vectorBool zh_value(limit);
+	CppAD::vectorBool zh_value(limit * limit);
 # endif
 	while(more_operators)
 	{
@@ -1027,24 +1028,25 @@
 		}
 # if CPPAD_FOR_HES_SWEEP_TRACE
 		if( non_zero )
-		{	for(j = 0; j < limit; j++)
-			{	zf_value[j] = false;
-			zh_value[j] = false;
+		{	for(i = 0; i < limit; i++)
+			{	zf_value[i] = false;
+				for(j = 0; j < limit; j++)
+					zh_value[i * limit + j] = false;
 			}
-# ifdef NOT_DEFINED
 			for_jac_sparse.begin(i_var);;
 			j = for_jac_sparse.next_element();;
 			while( j < limit )
 			{	zf_value[j] = true;
 				j = for_jac_sparse.next_element();
 			}
-			for_hes_sparse.begin(i_var);;
-			j = for_hes_sparse.next_element();;
-			while( j < limit )
-			{	zh_value[j] = true;
-				j = for_hes_sparse.next_element();
+			for(i = 0; i < limit; i++)
+			{	for_hes_sparse.begin(i);;
+				j = for_hes_sparse.next_element();;
+				while( j < limit )
+				{	zh_value[i * limit + j] = true;
+					j = for_hes_sparse.next_element();
+				}
 			}
-# endif
 			printOp(
 				std::cout,
 				play,


fixed compile error, but test still not ok, it does not return

git-svn-id: e171abefef93db0a74257c7d87d5b6400fe00c1f@828 f22100f3-aa73-48fe-a4fb-fd497bb32605

--- trunk/extension/test/app/test.cpp
+++ trunk/extension/test/app/test.cpp
@@ -88,7 +88,7 @@
   m_SVN->GetOutput();

   // test various wxEx methods that need the app
-  const wxString header = wxExHeader(wxExFileName("test.h"), m_Config, "hello test");
+  const wxString header = wxExHeader(wxExFileName("test.h"), wxExApp::GetConfig(), "hello test");
   CPPUNIT_ASSERT(header.Contains("hello test"));

   // test util


Unit test VectorComponentFunctor

Unit test VectorComponentFunctor

--- unit/src/MooseFunctorTest.C
+++ unit/src/MooseFunctorTest.C
@@ -10,37 +10,77 @@
 #include "gtest/gtest.h"
 #include "MooseFunctor.h"
 #include "FaceInfo.h"
+#include "VectorComponentFunctor.h"
+#include "GreenGaussGradient.h"
+#include "MeshGeneratorMesh.h"
+#include "GeneratedMeshGenerator.h"
+#include "AppFactory.h"
 #include "libmesh/elem.h"
 #include "libmesh/quadrature_gauss.h"
+#include "libmesh/type_tensor.h"

 using namespace libMesh;
 using namespace Moose;
+using namespace FV;

 template <typename T>
 class TestFunctor : public FunctorBase<T>
 {
 public:
-  using typename FunctorBase<T>::FunctorType;
-  using typename FunctorBase<T>::FunctorReturnType;
   using typename FunctorBase<T>::ValueType;
-  using typename FunctorBase<T>::GradientType;
-  using typename FunctorBase<T>::DotType;

   TestFunctor() = default;

 private:
-  ValueType evaluate(const Moose::ElemArg &, unsigned int) const override final { return 0; }
-  ValueType evaluate(const Moose::ElemFromFaceArg &, unsigned int) const override final
-  {
-    return 0;
-  }
-  ValueType evaluate(const Moose::FaceArg &, unsigned int) const override final { return 0; }
-  ValueType evaluate(const Moose::SingleSidedFaceArg &, unsigned int) const override final
-  {
-    return 0;
-  }
-  ValueType evaluate(const Moose::ElemQpArg &, unsigned int) const override final { return 0; }
-  ValueType evaluate(const Moose::ElemSideQpArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const ElemArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const ElemFromFaceArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const FaceArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const SingleSidedFaceArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const ElemQpArg &, unsigned int) const override final { return 0; }
+  ValueType evaluate(const ElemSideQpArg &, unsigned int) const override final { return 0; }
+};
+
+template <typename T>
+class WithGradientTestFunctor : public TestFunctor<T>
+{
+public:
+  using typename TestFunctor<T>::GradientType;
+
+  WithGradientTestFunctor(const MooseMesh & mesh) : _mesh(mesh) {}
+
+  bool isExtrapolatedBoundaryFace(const FaceInfo & fi) const override { return !fi.neighborPtr(); }
+
+private:
+  using TestFunctor<T>::evaluateGradient;
+  GradientType evaluateGradient(const ElemArg & elem_arg, unsigned int) const override final
+  {
+    return greenGaussGradient(elem_arg, *this, true, _mesh);
+  }
+
+  GradientType evaluateGradient(const FaceArg & face, unsigned int) const override final
+  {
+    const auto & fi = *face.fi;
+    if (!isExtrapolatedBoundaryFace(fi))
+    {
+      const auto elem_arg = face.makeElem();
+      const auto elem_gradient = this->gradient(elem_arg);
+      const auto neighbor_arg = face.makeNeighbor();
+      const auto linear_interp_gradient =
+          fi.gC() * elem_gradient + (1 - fi.gC()) * this->gradient(neighbor_arg);
+      return linear_interp_gradient +
+             outer_product(((*this)(neighbor_arg) - (*this)(elem_arg)) / fi.dCFMag() -
+                               linear_interp_gradient * fi.eCF(),
+                           fi.eCF());
+    }
+
+    // One term expansion
+    if (!fi.neighborPtr())
+      return this->gradient(face.makeElem());
+    else
+      return this->gradient(face.makeNeighbor());
+  }
+
+  const MooseMesh & _mesh;
 };

 TEST(MooseFunctorTest, testArgs)
@@ -62,88 +102,156 @@
   FaceInfo fi(elem.get(), 1, neighbor.get());
   QGauss qrule(1, CONSTANT);

-  auto elem_arg = Moose::ElemArg{elem.get(), false, false};
-  auto face = Moose::FaceArg({&fi,
-                              FV::LimiterType::CentralDifference,
-                              true,
-                              false,
-                              false,
-                              INVALID_BLOCK_ID,
-                              INVALID_BLOCK_ID});
-  auto single_face = Moose::SingleSidedFaceArg(
-      {&fi, FV::LimiterType::CentralDifference, true, false, false, INVALID_BLOCK_ID});
-  auto elem_from_face = Moose::ElemFromFaceArg({elem.get(), &fi, false, false, INVALID_BLOCK_ID});
+  auto elem_arg = ElemArg{elem.get(), false, false};
+  auto face = FaceArg({&fi,
+                       LimiterType::CentralDifference,
+                       true,
+                       false,
+                       false,
+                       INVALID_BLOCK_ID,
+                       INVALID_BLOCK_ID});
+  auto single_face = SingleSidedFaceArg(
+      {&fi, LimiterType::CentralDifference, true, false, false, INVALID_BLOCK_ID});
+  auto elem_from_face = ElemFromFaceArg({elem.get(), &fi, false, false, INVALID_BLOCK_ID});
   auto elem_qp = std::make_tuple(elem.get(), 0, &qrule);
   auto elem_side_qp = std::make_tuple(elem.get(), 0, 0, &qrule);

-  auto test_dot = [&test](const auto & arg)
-  {
-    try
-    {
-      test.dot(arg);
-      ASSERT_TRUE(false);
-    }
-    catch (std::runtime_error & e)
-    {
-      ASSERT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
-    }
-  };
-
-  test_dot(elem_arg);
-  test_dot(face);
-  test_dot(single_face);
-  test_dot(elem_from_face);
-  test_dot(elem_qp);
-  test_dot(elem_side_qp);
-
-  auto test_gradient = [&test](const auto & arg)
-  {
-    try
-    {
-      test.gradient(arg);
-      ASSERT_TRUE(false);
-    }
-    catch (std::runtime_error & e)
-    {
-      ASSERT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
-    }
-  };
-
-  test_gradient(elem_arg);
-  test_gradient(face);
-  test_gradient(single_face);
-  test_gradient(elem_from_face);
-  test_gradient(elem_qp);
-  test_gradient(elem_side_qp);
-
-  ConstantFunctor<Real> cf(2);
-  EXPECT_EQ(cf(elem_arg), 2);
-  EXPECT_EQ(cf(elem_from_face), 2);
-  EXPECT_EQ(cf(face), 2);
-  EXPECT_EQ(cf(single_face), 2);
-  EXPECT_EQ(cf(elem_from_face), 2);
-  EXPECT_EQ(cf(elem_qp), 2);
-  EXPECT_EQ(cf(elem_side_qp), 2);
-
-  auto constant_gradient_test = [&cf](const auto & arg)
-  {
-    const auto result = cf.gradient(arg);
+  // Test not-implemented errors
+  {
+    auto test_dot = [&test](const auto & arg)
+    {
+      try
+      {
+        test.dot(arg);
+        ASSERT_TRUE(false);
+      }
+      catch (std::runtime_error & e)
+      {
+        ASSERT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
+      }
+    };
+
+    test_dot(elem_arg);
+    test_dot(face);
+    test_dot(single_face);
+    test_dot(elem_from_face);
+    test_dot(elem_qp);
+    test_dot(elem_side_qp);
+
+    auto test_gradient = [&test](const auto & arg)
+    {
+      try
+      {
+        test.gradient(arg);
+        ASSERT_TRUE(false);
+      }
+      catch (std::runtime_error & e)
+      {
+        ASSERT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
+      }
+    };
+
+    test_gradient(elem_arg);
+    test_gradient(face);
+    test_gradient(single_face);
+    test_gradient(elem_from_face);
+    test_gradient(elem_qp);
+    test_gradient(elem_side_qp);
+  }
+
+  auto zero_gradient_test = [](const auto & functor, const auto & arg)
+  {
+    const auto result = functor.gradient(arg);
     for (const auto i : make_range(unsigned(LIBMESH_DIM)))
       EXPECT_EQ(result(i), 0);
   };
-  constant_gradient_test(elem_arg);
-  constant_gradient_test(elem_from_face);
-  constant_gradient_test(face);
-  constant_gradient_test(single_face);
-  constant_gradient_test(elem_from_face);
-  constant_gradient_test(elem_qp);
-  constant_gradient_test(elem_side_qp);
-
-  EXPECT_EQ(cf.dot(elem_arg), 0);
-  EXPECT_EQ(cf.dot(elem_from_face), 0);
-  EXPECT_EQ(cf.dot(face), 0);
-  EXPECT_EQ(cf.dot(single_face), 0);
-  EXPECT_EQ(cf.dot(elem_from_face), 0);
-  EXPECT_EQ(cf.dot(elem_qp), 0);
-  EXPECT_EQ(cf.dot(elem_side_qp), 0);
+
+  // Test ConstantFunctor
+  {
+    ConstantFunctor<Real> cf(2);
+    EXPECT_EQ(cf(elem_arg), 2);
+    EXPECT_EQ(cf(elem_from_face), 2);
+    EXPECT_EQ(cf(face), 2);
+    EXPECT_EQ(cf(single_face), 2);
+    EXPECT_EQ(cf(elem_from_face), 2);
+    EXPECT_EQ(cf(elem_qp), 2);
+    EXPECT_EQ(cf(elem_side_qp), 2);
+
+    zero_gradient_test(cf, elem_arg);
+    zero_gradient_test(cf, elem_from_face);
+    zero_gradient_test(cf, face);
+    zero_gradient_test(cf, single_face);
+    zero_gradient_test(cf, elem_from_face);
+    zero_gradient_test(cf, elem_qp);
+    zero_gradient_test(cf, elem_side_qp);
+
+    EXPECT_EQ(cf.dot(elem_arg), 0);
+    EXPECT_EQ(cf.dot(elem_from_face), 0);
+    EXPECT_EQ(cf.dot(face), 0);
+    EXPECT_EQ(cf.dot(single_face), 0);
+    EXPECT_EQ(cf.dot(elem_from_face), 0);
+    EXPECT_EQ(cf.dot(elem_qp), 0);
+    EXPECT_EQ(cf.dot(elem_side_qp), 0);
+  }
+
+  // Test VectorComponentFunctor
+  {
+    const char * argv[2] = {"foo", "\0"};
+
+    MultiMooseEnum coord_type_enum("XYZ RZ RSPHERICAL", "XYZ");
+
+    const auto nx = 2;
+    auto app = AppFactory::createAppShared("MooseUnitApp", 1, (char **)argv);
+    auto * factory = &app->getFactory();
+    std::string mesh_type = "MeshGeneratorMesh";
+
+    std::shared_ptr<MeshGeneratorMesh> mesh;
+    {
+      InputParameters params = factory->getValidParams(mesh_type);
+      mesh = factory->create<MeshGeneratorMesh>(mesh_type, "moose_mesh", params);
+    }
+
+    app->actionWarehouse().mesh() = mesh;
+
+    {
+      std::unique_ptr<MeshBase> lm_mesh;
+      InputParameters params = factory->getValidParams("GeneratedMeshGenerator");
+      params.set<unsigned int>("nx") = nx;
+      params.set<unsigned int>("ny") = nx;
+      params.set<MooseEnum>("dim") = "2";
+      auto mesh_gen =
+          factory->create<GeneratedMeshGenerator>("GeneratedMeshGenerator", "mesh_gen", params);
+      lm_mesh = mesh_gen->generate();
+      mesh->setMeshBase(std::move(lm_mesh));
+    }
+
+    mesh->prepare();
+    mesh->setCoordSystem({}, coord_type_enum);
+    // Build the face info
+    const auto & all_fi = mesh->allFaceInfo();
+    mesh->computeFaceInfoFaceCoords();
+
+    WithGradientTestFunctor<RealVectorValue> vec_test_func(*mesh);
+    VectorComponentFunctor<Real> vec_comp(vec_test_func, 0);
+    EXPECT_EQ(vec_comp(elem_arg), 0);
+    EXPECT_EQ(vec_comp(elem_from_face), 0);
+    EXPECT_EQ(vec_comp(face), 0);
+    EXPECT_EQ(vec_comp(single_face), 0);
+    EXPECT_EQ(vec_comp(elem_from_face), 0);
+    EXPECT_EQ(vec_comp(elem_qp), 0);
+    EXPECT_EQ(vec_comp(elem_side_qp), 0);
+
+    const auto & mesh_fi = all_fi.front();
+    const auto vec_elem_arg = ElemArg{&mesh_fi.elem(), false, false};
+    auto vec_face_arg =
+        FaceArg({&mesh_fi,
+                 LimiterType::CentralDifference,
+                 true,
+                 false,
+                 false,
+                 mesh_fi.elem().subdomain_id(),
+                 mesh_fi.neighborPtr() ? mesh_fi.neighbor().subdomain_id() : INVALID_BLOCK_ID});
+    zero_gradient_test(vec_comp, vec_elem_arg);
+    zero_gradient_test(vec_comp, vec_face_arg);
+  }
 }


removed unnecessary printout

removed unnecessary printout

--- unittests/testCollision.cpp
+++ unittests/testCollision.cpp
@@ -822,8 +822,6 @@
   const collision::CollisionResult& result2 = world->getLastCollisionResult();
   EXPECT_TRUE(result2.inCollision(boxBodyNode1));
   EXPECT_TRUE(result2.inCollision(boxBodyNode2));
-
-  std::cout << "Num body nodes: " << result2.getCollidingBodyNodes().size() << std::endl;
 }

 //==============================================================================


Do not delete atoms that have a label - when they still have bonds

Signed-off-by: Lennard Wasserthal <682e03da6185febc6b3ed5fc50982932fd247b4b@nefkom.net>

--- sdlctrl.hxx
+++ sdlctrl.hxx
@@ -431,8 +431,14 @@
 					{
 						TELESCOPE_aggressobject(tlmultilist,ilv2);
 						TELESCOPE_clear();
+						if (ilv1==1) if ((*((n_instance*)(ibufferpos+isize*ilv2))).Element!=constants_Element_implicitcarbon)
+						{
+							(*((n_instance*)(ibufferpos+isize*ilv2))).Element=constants_Element_implicitcarbon;
+							goto i_delete_skip;
+						}
 						(*((basic_instance*)(ibufferpos+isize*ilv2))).exist=0;
 					}
+					i_delete_skip:;
 				}
 			}
 			i_delete_fertig:;
@@ -451,7 +457,13 @@
 				{
 					TELESCOPE_aggressobject(glob_n_multilist,control_hot[STRUCTURE_OBJECTTYPE_n]);
 					TELESCOPE_clear();
+					if ((*((n_instance*)(ibufferpos+isize*control_hot[STRUCTURE_OBJECTTYPE_n]))).Element!=constants_Element_implicitcarbon)
+					{
+						(*((n_instance*)(ibufferpos+isize*control_hot[STRUCTURE_OBJECTTYPE_n]))).Element=constants_Element_implicitcarbon;
+						goto i_delete_hot_skip;
+					}
 					(*((basic_instance*)(ibufferpos+isize*control_hot[STRUCTURE_OBJECTTYPE_n]))).exist=0;
+					i_delete_hot_skip:;
 					isuccessful=1;
 				}
 			}


engine: properly declare unused variable

--- engine/src/cuestack.cpp
+++ engine/src/cuestack.cpp
@@ -540,7 +540,7 @@
 {
     qDebug() << Q_FUNC_INFO;

-    Q_ASSERT(timer != NULL);
+    Q_UNUSED(timer);

     /* If no fade out is needed, dismiss all the requested faders.
      * Otherwise, set all the faders to fade out and let Universe dismiss them


turn InvalidParams test into value-parameterized test

--- modules/layers/test/layer_z_unittests.cpp
+++ modules/layers/test/layer_z_unittests.cpp
@@ -8,19 +8,30 @@
 using namespace cv;
 using namespace sem;

+// name of keys in signal
+const string NAME_INPUT_SPIKES  = "in";          ///< no. of afferent spikes
+const string NAME_OUTPUT_SPIKES = "out";         ///< no. of output spikes/size of output layer
+const string NAME_OUTPUT_MEM_POT = "mem_pot";    ///< membrane potential
+
 /**
- * @brief class for testing layer Z initialization, the main, SEM learning algorithm
+ * @brief mixin for testing layer Z, the main, SEM learning algorithm
+ * Because we expect to test using fixutres as well as parametrized tests
+ * Since these two test types are derived differently mixins solves the problem of defining a common base
+ * The solution is adopted from this StackOverflow post:
+ * @see http://stackoverflow.com/questions/3152326/google-test-parameterized-tests-which-use-an-existing-test-fixture-class
+ *
+ * T specifies test type (fixture or parameterized)
  */
-class LayerZInitTest : public ::testing::Test
+template <class T> class LayerZTestBase : public T
 {
 protected:
     virtual void SetUp()
     {
         nb_afferents_ = 50;
-        PTree params;
-        params.put(LayerZ::PARAM_NB_AFFERENTS, nb_afferents_);
-        params.put(LayerZ::PARAM_NB_OUTPUT_NODES, 10);
-        config_.Params(params);
+        params_ = PTree();
+        params_.put(LayerZ::PARAM_NB_AFFERENTS, nb_afferents_);
+        params_.put(LayerZ::PARAM_NB_OUTPUT_NODES, 10);
+        config_.Params(params_);

         // IO
         config_.Input(LayerZ::KEY_INPUT_SPIKES, NAME_INPUT_SPIKES);
@@ -30,19 +41,21 @@
     }

     // members
-    LayerZ to_;             ///< test object
     LayerConfig config_;    ///< default layer configuration
+    PTree params_;          ///< default params

     int nb_afferents_;
-    // name of keys in signal
-    static const string NAME_INPUT_SPIKES;      ///< no. of afferent spikes
-    static const string NAME_OUTPUT_SPIKES;     ///< no. of output spikes/size of output layer
-    static const string NAME_OUTPUT_MEM_POT;    ///< membrane potential
 };
-// initialize static members
-const string LayerZInitTest::NAME_INPUT_SPIKES  = "in";
-const string LayerZInitTest::NAME_OUTPUT_SPIKES = "out";
-const string LayerZInitTest::NAME_OUTPUT_MEM_POT = "mem_pot";
+
+/**
+ * @brief class for testing layer z initialization routines
+ */
+class LayerZInitTest : public LayerZTestBase<testing::Test >
+{
+protected:
+    // members
+    LayerZ to_;  ///< test object
+};

 /**
  * @brief test validation of missing params
@@ -50,83 +63,10 @@
 TEST_F(LayerZInitTest, MissingParams)
 {
     // remove key to output nodes
-    PTree params = config_.Params();
-    params.erase(LayerZ::PARAM_NB_OUTPUT_NODES);
-    config_.Params(params);
+    params_.erase(LayerZ::PARAM_NB_OUTPUT_NODES);
+    config_.Params(params_);

-    LayerZ to;
-    EXPECT_THROW(to.Reset(config_), std::exception);
-}
-
-/**
- * @brief test parameter validation
- */
-TEST_F(LayerZInitTest, InvalidParams)
-{
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_DELTA_T, -0.1f);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_DELTA_T, 0.f);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_DELTA_T, -0.f);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_LEN_HISTORY, -3);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_LEN_HISTORY, 0);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_NB_AFFERENTS, 0);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_NB_AFFERENTS, -3);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
-    {
-        PTree params = config_.Params();
-        params.put(LayerZ::PARAM_WTA_FREQ, -1);
-        config_.Params(params);
-
-        LayerZ to;
-        EXPECT_THROW(to.Reset(config_), ExceptionValueError);
-    }
+    EXPECT_THROW(LayerZ().Reset(config_), std::exception);
 }

 TEST_F(LayerZInitTest, IONames)
@@ -148,3 +88,35 @@
         EXPECT_NO_THROW(to.IONames(cfg)) << "all required IO names present";
     }
 }
+
+typedef std::pair<std::string, float > TParamPairSF; /// convinience typdef to use as test params below
+
+/**
+ * @brief Parameterized test for testing layer z parameter value validation
+ * Using paramterized tests allows us to try different value more easily
+ */
+class LayerZParamsTest : public LayerZTestBase<testing::TestWithParam<TParamPairSF > >
+{
+protected:
+};
+
+// if you're using QTCreator, don't mind the ..._EvalGenerator_ warning at the bottom
+INSTANTIATE_TEST_CASE_P(TestWithParams,
+                        LayerZParamsTest,
+                        testing::Values(TParamPairSF(LayerZ::PARAM_DELTA_T, -1.f),
+                                        TParamPairSF(LayerZ::PARAM_DELTA_T, -0.f),
+                                        TParamPairSF(LayerZ::PARAM_DELTA_T, 0.f),
+                                        TParamPairSF(LayerZ::PARAM_LEN_HISTORY, -3),
+                                        TParamPairSF(LayerZ::PARAM_LEN_HISTORY, 0),
+                                        TParamPairSF(LayerZ::PARAM_NB_AFFERENTS, 0),
+                                        TParamPairSF(LayerZ::PARAM_NB_AFFERENTS, -3),
+                                        TParamPairSF(LayerZ::PARAM_WTA_FREQ, -0.001f),
+                                        TParamPairSF(LayerZ::PARAM_WTA_FREQ, -1.f)));
+
+TEST_P(LayerZParamsTest, InvalidParams)
+{
+    TParamPairSF tp = GetParam();
+    params_.put(tp.first, tp.second);
+    config_.Params(params_);
+    EXPECT_THROW(LayerZ().Reset(config_), ExceptionValueError);
+}


New assets are given a different name if it already exists

--- creator/lib/objectmanager.cpp
+++ creator/lib/objectmanager.cpp
@@ -122,6 +122,17 @@

     QUrl newLocation( QString( "Assets/%1" ).arg( newAsset->fullyQualifiedFileName() ) );

+    int i = 0;
+    QStringList theSplitName = newAsset->name().split('.');
+    QString firstName = theSplitName.takeAt(0);
+    while(QFile::exists(newLocation.toLocalFile()))
+    {
+        i++;
+        QString newName = firstName.append( QString( " (%1)." ).arg( i ) ).append( theSplitName.join(".") );
+        newAsset->setName( newName );
+        newLocation = QUrl( QString( "Assets/%1" ).arg( newAsset->fullyQualifiedFileName() ) );
+    }
+
     QFile( fileName ).copy( newLocation.toLocalFile() );

     newAsset->setFile( newLocation );


added broken def but oh well

added broken def but oh well

--- dbeacon.cpp
+++ dbeacon.cpp
@@ -28,6 +28,10 @@
 #include <list>
 #include <vector>

+#ifndef IP_RECVTTL
+#define IP_RECVTTL 12
+#endif
+
 // not everyone have this
 #ifndef MCAST_JOIN_SOURCE_GROUP
 #define MCAST_JOIN_SOURCE_GROUP 46


Revert "[Cleanup]: Get rid of clang-tidy warnings"

This reverts commit 1ce9ff21ae38c7139058386ab9717d25e15ed644.

Reason for revert:

The TRACE* macros should ve fixed

Change-Id: I0fffb91cf1db3f2d7203e73ce7d95a5bab7dfc52
Reviewed-on: http://review.couchbase.org/c/kv_engine/+/127731
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- engines/ep/src/couch-kvstore/couch-kvstore.cc
+++ engines/ep/src/couch-kvstore/couch-kvstore.cc
@@ -980,7 +980,7 @@
     Vbid vbid = hook_ctx->compactConfig.db_file_id;
     hook_ctx->config = &configuration;

-    TRACE_EVENT1("CouchKVStore", "compactDB", "vbid", vbid.get())
+    TRACE_EVENT1("CouchKVStore", "compactDB", "vbid", vbid.get());

     // Open the source VBucket database file ...
     errCode = openDB(
@@ -1509,7 +1509,7 @@
                        "vbid",
                        ctx.vbid.get(),
                        "startSeqno",
-                       ctx.startSeqno)
+                       ctx.startSeqno);

     auto& couchKvHandle = static_cast<CouchKVFileHandle&>(*ctx.handle);
     auto& db = couchKvHandle.getDbHolder();
@@ -1526,7 +1526,8 @@
                                          bySeqnoScanCallback,
                                          static_cast<void*>(&ctx));

-    TRACE_EVENT_END1("CouchKVStore", "scan", "lastReadSeqno", ctx.lastReadSeqno)
+    TRACE_EVENT_END1(
+            "CouchKVStore", "scan", "lastReadSeqno", ctx.lastReadSeqno);

     if (errorCode != COUCHSTORE_SUCCESS) {
         if (errorCode == COUCHSTORE_ERROR_CANCEL) {
@@ -1549,7 +1550,7 @@
                        "vbid",
                        ctx.vbid.get(),
                        "ranges",
-                       uint32_t(ctx.ranges.size()))
+                       uint32_t(ctx.ranges.size()));

     auto& couchKvHandle = static_cast<CouchKVFileHandle&>(*ctx.handle);
     auto& db = couchKvHandle.getDbHolder();
@@ -1575,7 +1576,7 @@
         }
     }
     TRACE_EVENT_END1(
-            "CouchKVStore", "scan by id", "lastReadSeqno", ctx.lastReadSeqno)
+            "CouchKVStore", "scan by id", "lastReadSeqno", ctx.lastReadSeqno);

     if (errorCode != COUCHSTORE_SUCCESS) {
         if (errorCode == COUCHSTORE_ERROR_CANCEL) {
@@ -1683,7 +1684,7 @@
                            "vbucketId",
                            vbucketId.get(),
                            "fileRev",
-                           fileRev)
+                           fileRev);
         }
     }
     if (configuration.getCouchstoreWriteValidationEnabled()) {
@@ -2007,7 +2008,7 @@
                  "vbid",
                  vbucket2flush.get(),
                  "pendingCommitCnt",
-                 pendingCommitCnt)
+                 pendingCommitCnt);

     std::vector<Doc*> docs(pendingCommitCnt);
     std::vector<DocInfo*> docinfos(pendingCommitCnt);


MB-37313: Add magma function to get valueSize from metadata

As part of CBSS-332, adding metadata to seq index, we need a way to get
the value size from the metadata.

For magma, we encode the value with both metadata and value. We also
store the value in the key index when the value is small. When
traversing the seq index, we need to know if the value is stored in the
key index by looking at the value size from the metadata. We need a
function to get that value size.

Change-Id: Ic21133f5c64f892efaaaa8f36a3dc11aed365e9c
Reviewed-on: http://review.couchbase.org/119572
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- engines/ep/src/magma-kvstore/magma-kvstore.cc
+++ engines/ep/src/magma-kvstore/magma-kvstore.cc
@@ -325,6 +325,12 @@
     magmakv::MetaData* docMeta = reinterpret_cast<magmakv::MetaData*>(
             const_cast<char*>(metaSlice.Data()));
     return docMeta->bySeqno;
+}
+
+static const size_t getValueSize(const Slice& metaSlice) {
+    const auto* docMeta =
+            reinterpret_cast<const magmakv::MetaData*>(metaSlice.Data());
+    return docMeta->valueSize;
 }

 static const uint32_t getExpiryTime(const Slice& metaSlice) {
@@ -553,6 +559,7 @@
             configuration.getMagmaTombstoneFragThreshold();
     configuration.magmaCfg.GetSeqNum = getSeqNum;
     configuration.magmaCfg.GetExpiryTime = getExpiryTime;
+    configuration.magmaCfg.GetValueSize = getValueSize;
     configuration.magmaCfg.IsTombstone = isDeleted;
     configuration.magmaCfg.EnableDirectIO =
             configuration.getMagmaEnableDirectIo();


modified:   src/tsdf_meshing.cpp

modified:   src/tsdf_meshing.cpp

--- cvt_ros/src/tsdf_meshing.cpp
+++ cvt_ros/src/tsdf_meshing.cpp
@@ -159,7 +159,7 @@
         {
             FILE* f = fopen( file.c_str(), "wb" );

-            ROS_INFO( "MESH: vertices -> %ul, normals -> %lu, faces -> %ul", mesh.vertexSize(), mesh.normalSize(), mesh.faceSize() );
+            ROS_INFO( "MESH: vertices -> %zd, normals -> %zd, faces -> %zd", mesh.vertexSize(), mesh.normalSize(), mesh.faceSize() );

             for( size_t idx = 0; idx < mesh.vertexSize(); idx++ ) {
                 cvt::Vector3f vtx = mesh.vertex( idx );


do not debug-output this pointer - it is mostly useless

git-svn-id: 40192aece4a9e6664bc9a93aa558322db432a344@852 15ae5fad-cc11-0410-8fac-bce609e504b0

--- cxxtools/src/http/socket.cpp
+++ cxxtools/src/http/socket.cpp
@@ -215,7 +215,7 @@
 {
     log_trace("onOutput");

-    log_debug(this << " send data to " << getPeerAddr());
+    log_debug("send data to " << getPeerAddr());

     sb.beginWrite();


Add support for color light (#15494)

Add support for color light (#15494)

--- examples/all-clusters-app/esp32/main/main.cpp
+++ examples/all-clusters-app/esp32/main/main.cpp
@@ -271,6 +271,24 @@
                 // update the temp attribute here for hardcoded endpoint 1
                 chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Set(1, static_cast<int16_t>(n * 100));
             }
+            else if (name == "Color Current Level")
+            {
+                // update the current level here for hardcoded endpoint 1
+                ESP_LOGI(TAG, "Brightness changed to : %d", (n * 100 / 255));
+                app::Clusters::LevelControl::Attributes::CurrentLevel::Set(1, n);
+            }
+            else if (name == "Current Hue")
+            {
+                // update the current hue here for hardcoded endpoint 1
+                ESP_LOGI(TAG, "Hue changed to : %d", n * 360 / 254);
+                app::Clusters::ColorControl::Attributes::CurrentHue::Set(1, n);
+            }
+            else if (name == "Current Saturation")
+            {
+                // update the current saturation here for hardcoded endpoint 1
+                ESP_LOGI(TAG, "Saturation changed to : %d", n * 100 / 254);
+                app::Clusters::ColorControl::Attributes::CurrentSaturation::Set(1, n);
+            }
             value = buffer;
         }
         else if (IsBooleanAttribute())
@@ -576,6 +594,21 @@
     AddCluster("Illuminance Measurement");
     AddAttribute("MeasuredValue", "1000");
     app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::Set(1, static_cast<int16_t>(1000));
+
+    AddDevice("Color Light");
+    AddEndpoint("1");
+    AddCluster("OnOff");
+    AddAttribute("OnOff", "Off");
+    app::Clusters::OnOff::Attributes::OnOff::Set(1, false);
+    AddCluster("Level Control");
+    AddAttribute("Color Current Level", "255");
+    app::Clusters::LevelControl::Attributes::CurrentLevel::Set(1, 255);
+    AddEndpoint("2");
+    AddCluster("Color Control");
+    AddAttribute("Current Hue", "200");
+    app::Clusters::ColorControl::Attributes::CurrentHue::Set(1, 200);
+    AddAttribute("Current Saturation", "150");
+    app::Clusters::ColorControl::Attributes::CurrentSaturation::Set(1, 150);
 }

 WiFiWidget pairingWindowLED;


Fix changing INTERFACEPORT to WIRE

Fix changing INTERFACEPORT to WIRE

Signed-off-by: Kamil Rakoczy <539d6a2650324aa9156edbbb09228193dfee5b9b@antmicro.com>

--- uhdm-plugin/UhdmAst.cc
+++ uhdm-plugin/UhdmAst.cc
@@ -219,7 +219,8 @@
 				child->is_input = (*it)->is_input;
 				child->is_output = (*it)->is_output;
 				child->port_id = (*it)->port_id;
-				child->type = AST::AST_WIRE;
+				if (child->type == AST::AST_MEMORY)
+				    child->type = AST::AST_WIRE;
 			}
 			if (!(*it)->children.empty() && child->children.empty()) {
 				// This is a bit ugly, but if the child we're replacing has children and


Fixes a redundant flag test

Fixes a redundant flag test

--- Engine/source/renderInstance/renderDeferredMgr.cpp
+++ Engine/source/renderInstance/renderDeferredMgr.cpp
@@ -682,7 +682,6 @@
                   type == MFT_UseInstancing ||
                   type == MFT_DiffuseVertColor ||
                   type == MFT_DetailMap ||
-                  type == MFT_DetailNormalMap ||
                   type == MFT_DiffuseMapAtlas)
          newFeatures.addFeature( type );


Make border for potential reactions thicker.

--- periodic/ElementCube.cpp
+++ periodic/ElementCube.cpp
@@ -169,9 +169,13 @@
         for (int i = 0; i < SCREEN_WIDTH; i++)
         {
             v.fb32.plot(vec(i, 0), POTENTIAL_COLOR);
+            v.fb32.plot(vec(i, 1), POTENTIAL_COLOR);
             v.fb32.plot(vec(i, SCREEN_HEIGHT - 1), POTENTIAL_COLOR);
+            v.fb32.plot(vec(i, SCREEN_HEIGHT - 2), POTENTIAL_COLOR);
             v.fb32.plot(vec(0, i), POTENTIAL_COLOR);
+            v.fb32.plot(vec(1, i), POTENTIAL_COLOR);
             v.fb32.plot(vec(SCREEN_WIDTH - 1, i), POTENTIAL_COLOR);
+            v.fb32.plot(vec(SCREEN_WIDTH - 2, i), POTENTIAL_COLOR);
         }
     }


changed greater than logic

changed greater than logic

fixes #4

--- Project5/Hangman.cpp
+++ Project5/Hangman.cpp
@@ -86,7 +86,7 @@

 	hangmanDraw(guessesCounter, winning, solution); // show blank

-	while ((guessesCounter <= 7) && (winning == 0))
+	while ((guessesCounter > 0) && (winning == 0))
 	{

 		cout << "Guess a letter: ";


Update TGClient.cxx

Update TGClient.cxx

Prevent null pointer dereference.


Remove a style specific hack. Make test pass with Qt 4.6

--- gui/markupdirector_p.cpp
+++ gui/markupdirector_p.cpp
@@ -277,9 +277,8 @@
   if ( fontForeground != Qt::NoBrush
        && !( m_openElements.contains( SpanForeground ) ) // Can only open one foreground element at a time.
        && ( fontForeground != m_openForeground )
-       && !(( m_openElements.contains( Anchor )       // If inside an anchor, only open a foreground span tag if
-              || m_elementsToOpen.contains( Anchor ) ) // it is not blue. Qt sort of enforces links being blue
-            && ( fontForeground == Qt::blue ) )  // and underlined. See qt bug 203510.
+       && !(( m_openElements.contains( Anchor )          // Links can't have a foreground color.
+              || m_elementsToOpen.contains( Anchor ) ) )
      ) {
     m_elementsToOpen.insert( SpanForeground );
     m_foregroundToOpen = fontForeground;


Light detail (1/2)

Light detail (1/2)

--- alg_test.cpp
+++ alg_test.cpp
@@ -1,12 +1,21 @@
 #include <SFML/Graphics.hpp>
+#include <unordered_map>
 #include <iostream>

+#define _USE_MATH_DEFINES
+#include <math.h>
+
 using namespace std;

-#define M_PI 3.14f
 #define LIGHT_RADIUS 400

+enum LightDetail
+{
+	LIGHTDETAIL_LOW,
+	LIGHTDETAIL_MEDIUM,
+	LIGHTDETAIL_HIGH
+};

 struct Line
 {
@@ -38,10 +47,10 @@
 	inline void add(float x, float y) {
 		points.push_back(sf::Vector2f(x, y));
 	}
-
+
 	inline int getLineCount() { return points.size(); }

-	inline Line getLine(int i) {
+	Line getLine(int i) {
 		Line ret;
 		ret.create(points[i], points[(i == points.size() - 1) ? 0 : (i + 1)]);
 		return ret;
@@ -86,7 +95,7 @@
 	// collinear
 	if (crossProduct(r, s) == 0 && crossProduct((q - p), r) == 0)
 		return false; // i guess i can ignore (for now) if two lines are collinear
-	else if (crossProduct(r, s) != 0 && (T >= 0 && T <= 1) && (U >= 0 && U <= 1)) { // parallel - not intersecting
+	else if (crossProduct(r, s) != 0 && (T >= 0 && T <= 1) && (U >= 0 && U <= 1)) { // intersecting
 		ret = q + U*s;
 		return true; // pointOfIntersection = q + U*s;
 	}
@@ -119,42 +128,100 @@
 	inter.setRadius(4);
 	inter.setOrigin(4, 4);

+	sf::Clock fpsClock;
+	float fps;
+
+	char precisionMode = LIGHTDETAIL_MEDIUM;
+
 	while (wnd.isOpen()) {
 		while (wnd.pollEvent(event)) {
 			if (event.type == sf::Event::Closed)
 				wnd.close();
 			else if (event.type == sf::Event::Resized)
 				wnd.setView(sf::View(sf::FloatRect(0, 0, event.size.width, event.size.height)));
-		}
+			else if (event.type == sf::Event::KeyPressed)
+				printf("FPS: %.3fs\n", fps);
+		}
+
+		fps = fpsClock.restart().asMilliseconds() / 1000.0f;

 		wnd.clear();

 		q.a = sf::Vector2f(sf::Mouse::getPosition(wnd));
-		std::vector<sf::Vertex> varr;
-		varr.push_back(sf::Vertex(q.a, sf::Color::White));
+		bool skipObject = false;
+		//std::vector<sf::Vertex> varr;
+		//varr.push_back(sf::Vertex(q.a, sf::Color::White));
+		unordered_map<int, bool> highDefColObjs;
 		for (float angle = 0; angle < 2 * M_PI; angle += 2 * M_PI / 32) {
 			sf::Vector2f resPos = q.b = sf::Vector2f(q.a.x + cos(angle) * LIGHT_RADIUS, q.a.y + sin(angle) * LIGHT_RADIUS);

+			skipObject = false;
 			for (int j = 0; j < objs.size(); j++) {
 				sf::Vector2f interPos;
 				int cnt = objs[j].getLineCount();
-				for (int i = 0; i < cnt; i++)
-					if (doIntersect(q, objs[j].getLine(i), interPos))
-						if (length(q.a, resPos) > length(q.a, interPos))
+				for (int i = 0; i < cnt; i++) {
+					if (doIntersect(q, objs[j].getLine(i), interPos)) {
+						if (length(q.a, resPos) > length(q.a, interPos)) {
 							resPos = interPos;
+							highDefColObjs[j] = true;
+						}
+						skipObject = true;
+					}
+				}
 			}
+
+			if (skipObject && precisionMode == LIGHTDETAIL_MEDIUM)
+				continue;
+
 			inter.setPosition(resPos);
 			q.b = resPos;

 			// RADIAL GRADIENT:
-			sf::Color resColor(255, 255, 255, 255 - length(q.a, q.b)*(255.0f / LIGHT_RADIUS));
-			varr.push_back(sf::Vertex(resPos, resColor));
-
-			//q.draw(wnd, sf::Color::Red);
-			//wnd.draw(inter);
-		}
-		varr.push_back(varr[1]);
-		wnd.draw(&varr[0], varr.size(), sf::TrianglesFan);
+			//sf::Color resColor(255, 255, 255, 255 - length(q.a, q.b)*(255.0f / LIGHT_RADIUS));
+			//varr.push_back(sf::Vertex(resPos, resColor));
+
+			q.draw(wnd, sf::Color::Red);
+			wnd.draw(inter);
+		}
+
+		if (precisionMode > LIGHTDETAIL_LOW) {
+			for (int j = 0; j < objs.size(); j++) {
+				if (!highDefColObjs[j])
+					continue;
+
+				Object* obj = &objs[j];
+				for (int i = 0; i < obj->points.size(); i++) {
+					sf::Vector2f point = obj->points[i];
+
+					if (length(q.a, point) > LIGHT_RADIUS)
+						continue;
+
+					float newAngle = atan2(point.y - q.a.y, point.x - q.a.x);
+					printf("%.4f\n", newAngle);
+					// TODO: (newAngle - 0.01f) and (newAngle + 0.01f) cases
+					q.b = sf::Vector2f(q.a.x + cos(newAngle) * LIGHT_RADIUS, q.a.y + sin(newAngle) * LIGHT_RADIUS);
+
+					sf::Vector2f interPos, resPos = q.b;
+
+					//for (int k = std::max(i - 1, 0); k < std::min(i + 1, (int)obj->points.size()); k++) {
+					for (int k = 0; k < (int)obj->points.size(); k++) {
+						if (doIntersect(q, obj->getLine(k), interPos)) {
+							if (length(q.a, resPos) > length(q.a, interPos)) {
+								resPos = interPos;
+							}
+						}
+					}
+
+					q.b = resPos;
+
+					q.draw(wnd, sf::Color::Blue);
+				}
+			}
+		}
+
+
+		//varr.push_back(varr[1]);
+		//wnd.draw(&varr[0], varr.size(), sf::TrianglesFan);

 		for (int i = 0; i < objs.size(); i++)
 			objs[i].draw(wnd);


fix log error colon typo

fix log error colon typo

--- src/ConnectionSTREAM/ConnectionSTREAMing.cpp
+++ src/ConnectionSTREAM/ConnectionSTREAMing.cpp
@@ -512,7 +512,7 @@
     }
     catch (const std::bad_alloc& ex) //not enough memory for buffers
     {
-        lime:error("Error allocating Tx buffers, not enough memory");
+        lime::error("Error allocating Tx buffers, not enough memory");
         return;
     }


explicit spi readback for stream lml setup

--- src/ConnectionSTREAM/ConnectionSTREAMing.cpp
+++ src/ConnectionSTREAM/ConnectionSTREAMing.cpp
@@ -326,12 +326,12 @@
     if (config.isTx) rfic.ConfigureLML_BB2RF(s0, s1, s2, s3);
     else             rfic.ConfigureLML_RF2BB(s0, s1, s2, s3);

-    rfic.Modify_SPI_Reg_bits(FCLK1_INV, 1);
-    rfic.Modify_SPI_Reg_bits(FCLK2_INV, 1);
-    rfic.Modify_SPI_Reg_bits(LML1_FIDM, 0); //Frame start=0
-    rfic.Modify_SPI_Reg_bits(LML2_FIDM, 0); //Frame start=0
-    rfic.Modify_SPI_Reg_bits(LML1_MODE, 0); //TRXIQ
-    rfic.Modify_SPI_Reg_bits(LML2_MODE, 0); //TRXIQ
+    rfic.Modify_SPI_Reg_bits(FCLK1_INV, 1, true);
+    rfic.Modify_SPI_Reg_bits(FCLK2_INV, 1, true);
+    rfic.Modify_SPI_Reg_bits(LML1_FIDM, 0, true); //Frame start=0
+    rfic.Modify_SPI_Reg_bits(LML2_FIDM, 0, true); //Frame start=0
+    rfic.Modify_SPI_Reg_bits(LML1_MODE, 0, true); //TRXIQ
+    rfic.Modify_SPI_Reg_bits(LML2_MODE, 0, true); //TRXIQ

     if (config.isTx) mStreamService->txStreamUseCount++;
     if (!config.isTx) mStreamService->rxStreamUseCount++;


Make carets line up in dtc diagnostics if the line starts with a tab.

--- usr.bin/dtc/input_buffer.cc
+++ usr.bin/dtc/input_buffer.cc
@@ -216,7 +216,8 @@
 	putc('\n', stderr);
 	for (int i=0 ; i<(cursor-line_start) ; ++i)
 	{
-		putc(' ', stderr);
+		char c = (buffer[i+line_start] == '\t') ? '\t' : ' ';
+		putc(c, stderr);
 	}
 	putc('^', stderr);
 	putc('\n', stderr);


~50% more effecient SphericalProjection

~50% more effecient SphericalProjection

Thanks Komzpa for idea

--- libglosm-client/src/SphericalProjection.cc
+++ libglosm-client/src/SphericalProjection.cc
@@ -35,16 +35,24 @@
 	double ref_angle_y = (double)ref.y * GEOM_DEG_TO_RAD;
 	double ref_height = (double)ref.z / GEOM_UNITSINMETER;

+	/* using sqrt(1-sin^2) instead of cos and vice versa gives
+	 * ~30% performance gain (thx Komzpa). Precision loss this
+	 * brings should be insignificant */
+	double cosy = cos(point_angle_y);
+	double sinx = sin(point_angle_x);
 	Vector3d point_vector(
-		(WGS84_EARTH_EQ_RADIUS + point_height) * sin(point_angle_x) * cos(point_angle_y),
-		(WGS84_EARTH_EQ_RADIUS + point_height) * sin(point_angle_y),
-		(WGS84_EARTH_EQ_RADIUS + point_height) * cos(point_angle_x) * cos(point_angle_y)
+		(WGS84_EARTH_EQ_RADIUS + point_height) * sinx * cosy,
+		(WGS84_EARTH_EQ_RADIUS + point_height) * sqrt(1.0 - cosy * cosy),
+		(WGS84_EARTH_EQ_RADIUS + point_height) * sqrt(1.0 - sinx * sinx) * cosy
 	);

+	/* additional ~20% performance gain */
+	double cosay = cos(ref_angle_y);
+	double sinay = sqrt(1.0 - cosay * cosay);
 	return Vector3f(
 		point_vector.x,
-		point_vector.y * cos(ref_angle_y) - point_vector.z * sin(ref_angle_y),
-		point_vector.y * sin(ref_angle_y) + point_vector.z * cos(ref_angle_y) - WGS84_EARTH_EQ_RADIUS - ref_height
+		point_vector.y * cosay - point_vector.z * sinay,
+		point_vector.y * sinay + point_vector.z * cosay - WGS84_EARTH_EQ_RADIUS - ref_height
 	);
 }


fix a define issue

fix a define issue

--- src/S3ExtWrapper_test.cpp
+++ src/S3ExtWrapper_test.cpp
@@ -86,8 +86,8 @@
 void ExtWrapperTest(const char *url, uint64_t buffer_size, const char *md5_str,
                     int segid, int segnum, uint64_t chunksize) {
     InitConfig(NULL, NULL);
-    s3ext_secret = string("SECRET");
-    s3ext_accessid = string("KEYID");
+    s3ext_secret = string(SECRET);
+    s3ext_accessid = string(KEYID);
     s3ext_segid = segid;
     s3ext_segnum = segnum;


Always use light-blue progress bar when loading prelim run mode.

--- src/core/init_state.cxx
+++ src/core/init_state.cxx
@@ -165,13 +165,17 @@
   static const float progressW = 0.3f;
   float currProgress = currStep/(float)numSteps + currStepProgress/numSteps;
   float baseX = 0.5f - progressW/2;
-  #if defined(AB_OPENGL_14)
-  asgi::colour(1.0f, 0.4f, 0.2f, 0.75f);
-  #elif defined(AB_OPENGL_21)
-  asgi::colour(0.2f, 1.0f, 0.4f, 0.75f);
-  #else
-  asgi::colour(0.2f, 0.3f, 0.9f, 0.75f);
-  #endif
+  if (!preliminaryRunMode) {
+    #if defined(AB_OPENGL_14)
+    asgi::colour(1.0f, 0.4f, 0.2f, 0.75f);
+    #elif defined(AB_OPENGL_21)
+    asgi::colour(0.2f, 1.0f, 0.4f, 0.75f);
+    #else
+    asgi::colour(0.2f, 0.3f, 0.9f, 0.75f);
+    #endif
+  } else {
+    asgi::colour(0.2f, 0.3f, 0.9f, 0.75f);
+  }
   asgi::begin(asgi::Quads);
   asgi::vertex(baseX, 4*progressH);
   asgi::vertex(baseX, 5*progressH);


fix remap_swapcolons

fix remap_swapcolons

--- src/core/kext/remap.cpp
+++ src/core/kext/remap.cpp
@@ -854,12 +854,12 @@
   {
     if (! config.remap_swapcolons) return;

-    if (params.ex_origKey != KeyCode::SEMICOLON || *(params.key) != KeyCode::SEMICOLON) return;
+    if (! RemapUtil::isKey(params, KeyCode::SEMICOLON)) return;

     if (allFlagStatus.isHeldDown_shift()) {
       allFlagStatus.temporaryDecrease_shift();
     } else {
-      RemapUtil::keyToKeyWithModifier(params, KeyCode::SEMICOLON, KeyCode::SEMICOLON, ModifierFlag::SHIFT_L);
+      allFlagStatus.shiftL.temporary_increase();
     }
   }


Removing debug output.

Removing debug output.

--- src/core/nconn/nconn.cc
+++ src/core/nconn/nconn.cc
@@ -44,11 +44,11 @@
 //: ----------------------------------------------------------------------------
 int32_t nconn::nc_run_state_machine(mode_t a_mode, nbq *a_in_q, nbq *a_out_q)
 {
-        NDBG_PRINT("%sRUN_STATE_MACHINE%s: CONN[%p] STATE[%d] MODE: %d --START\n",
-                        ANSI_COLOR_BG_YELLOW, ANSI_COLOR_OFF, this, m_nc_state, a_mode);
+        //NDBG_PRINT("%sRUN_STATE_MACHINE%s: CONN[%p] STATE[%d] MODE: %d --START\n",
+        //                ANSI_COLOR_BG_YELLOW, ANSI_COLOR_OFF, this, m_nc_state, a_mode);
 state_top:
-        NDBG_PRINT("%sRUN_STATE_MACHINE%s: CONN[%p] STATE[%d] MODE: %d\n",
-                        ANSI_COLOR_FG_YELLOW, ANSI_COLOR_OFF, this, m_nc_state, a_mode);
+        //NDBG_PRINT("%sRUN_STATE_MACHINE%s: CONN[%p] STATE[%d] MODE: %d\n",
+        //                ANSI_COLOR_FG_YELLOW, ANSI_COLOR_OFF, this, m_nc_state, a_mode);
         switch (m_nc_state)
         {

@@ -112,7 +112,7 @@
                         //NDBG_PRINT("Still connecting...\n");
                         return NC_STATUS_AGAIN;
                 }
-                NDBG_PRINT("%sConnected%s: label: %s\n", ANSI_COLOR_FG_RED, ANSI_COLOR_OFF, m_label.c_str());
+                //NDBG_PRINT("%sConnected%s: label: %s\n", ANSI_COLOR_FG_RED, ANSI_COLOR_OFF, m_label.c_str());
                 // Returning client fd
                 // If OK -change state to connected???
                 m_nc_state = NC_STATE_CONNECTED;


remove useless file

remove useless file

--- src/Storing/store_map.cpp
+++ src/Storing/store_map.cpp
@@ -1,86 +0,0 @@
-#include "store.h"
-#include <map>
-#include <iostream>
-#include <fstream>
-
-using namespace std;
-
-class Store_map : Store
-{
-public:
-	Store_map();
-	~Store_map();
-
-	// Open and close store
-	void open(string filename){
-		ifstream ifs;
-		string buff_word;
-		int buff_n;
-		ifs.open(filename);
-
-		if (!ifs.is_open() || !ifs.good()){
-			cerr << "ERROR : couldn't load file " << filename << endl;
-		}
-		else{
-			cin >> tot;
-			while (cin >> buff_word){
-				cin >> buff_n;
-				hits.insert(pair<string, int>(buff_word, buff_n));
-			}
-
-		}
-		ifs.close();
-	}
-
-	void close(string filename){
-		ofstream ofs;
-
-		if (!ofs.is_open() || !ofs.good()){
-			cerr << "ERROR : couldn't open file " << filename << endl;
-		}
-		else{
-			for (pair<string, int> p : hits){
-				cout << p.first << " " << p.second << endl;
-			}
-		}
-		ofs.close();
-	}
-
-	// Check if store is initialized (e.g. table was created, etc.) and initializes it
-	bool is_init(){
-		return true;
-	}
-
-	void init(){}
-
-	// Check if word exists and insert it
-	bool exists(string word){
-		return hits.find(word) != hits.end();
-	}
-
-	void create(string word, int nb){
-		hits.insert(pair<string, int>(word, nb));
-		tot += nb;
-	}
-
-	// Access or modify hits
-	int get_hits(string word){
-		return hits[word];
-	}
-	void set_hits(string word, int nb){
-		tot += nb - hits[word];
-		hits[word] = nb;
-
-	}
-
-	// Access proba
-	double get_proba(string word){
-		return ((float)hits[word])/((double)tot);
-	}
-
-
-
-private:
-	int tot;
-	map<string, int> hits;
-};


android: try blitting a big texture to the screen instead; fails.

--- vcl/android/androidinst.cxx
+++ vcl/android/androidinst.cxx
@@ -39,6 +39,7 @@
 #include <rtl/strbuf.hxx>

 #define ANDROID_EGL
+#undef ANDROID_EGL_LOCK
 #undef ANDROID_PIXELS

 class AndroidSalData : public SalGenericData
@@ -88,11 +89,67 @@
              rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom,
              nDestX, nDestY);

+    basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer();
+    basegfx::B2IVector aDevSize = aDev->getSize();
+    sal_Int32 nStride = aDev->getScanlineStride();
+    unsigned char *pSrc = aSrcData.get();
+
+#ifdef ANDROID_EGL
+    (void)pOutBuffer;
+    GLuint nTexture;
+    glGenTextures (1, &nTexture);
+    glBindTexture(GL_TEXTURE_2D,nTexture);
+    // Pixels to texture:
+    fprintf (stderr, "before create texure '%d'\n", glGetError());
+    glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGB,
+                 nStride / 3, aDevSize.getY(),
+                 0 /* border */, GL_RGB, GL_UNSIGNED_BYTE,
+                 pSrc);
+    fprintf (stderr, "created texure '%d'\n", glGetError());
+
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
+
+    glEnable(GL_TEXTURE_2D);
+
+    glDisable(GL_DEPTH_TEST);
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_ZERO, GL_SRC_COLOR);
+    glDisable(GL_LIGHTING);
+
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+
+    glViewport(0, 0, aDevSize.getX(), aDevSize.getY());
+
+    glBindTexture(GL_TEXTURE_2D,nTexture);
+
+    GLfloat aVertices[] = { 0, 0,
+                            0, aDevSize.getY(),
+                            aDevSize.getX(), aDevSize.getY(),
+                            aDevSize.getX(), 0 };
+    glVertexPointer(2, GL_FLOAT, 0, aVertices);
+    fprintf (stderr, "after set vertex '%d'\n", glGetError());
+    glEnableClientState(GL_VERTEX_ARRAY);
+	glColor4f(0.5f, 0.5f, 1.0f, 1.0f);
+    glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
+//    glTexCoordPointer(2, GL_FLOAT, 0, aVertices);
+    fprintf (stderr, "after draw arrays '%d'\n", glGetError());
+
+//    glDisable(GL_TEXTURE_2D);
+
+    // free the texture
+//    glDeleteTextures(1,&nTexture);
+#endif
+
+#ifdef ANDROID_PIXELS
     // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc.
     ARect aSrcRect = rSrcRect;
-    sal_Int32 nStride = aDev->getScanlineStride();
-    basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer();
-    unsigned char *pSrc = aSrcData.get();

     // FIXME: we have WINDOW_FORMAT_RGB_565            = 4 ...

@@ -139,6 +196,7 @@
             break;
         }
     }
+#endif // ANDROID_PIXELS
     fprintf (stderr, "done blit!\n");
 }

@@ -172,6 +230,7 @@
     //    glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1);
     //    glClear(GL_COLOR_BUFFER_BIT);

+#ifdef ANDROID_EGL_LOCK // failed to do anything !
     const EGLint aAttribs[] = {
         EGL_MAP_PRESERVE_PIXELS_KHR, EGL_FALSE,
         EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR,
@@ -196,6 +255,7 @@
     aOutBuffer.stride = nStride / 2; // FIXME - assuming 565
     aOutBuffer.width = nWidth;
     aOutBuffer.height = nHeight;
+#endif

 #endif // ANDROID_EGL

@@ -208,10 +268,10 @@
              nRet, aRect.left, aRect.top, aRect.right, aRect.bottom,
              aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride,
              aOutBuffer.format, aOutBuffer.bits);
-#endif // ANDROID_PIXELS
-
     if (aOutBuffer.bits != NULL)
     {
+#endif // ANDROID_PIXELS
+
 #if 1 // pre-'clean' the buffer with cruft:
         // hard-code / guess at a format ...
         int32_t *p = (int32_t *)aOutBuffer.bits;
@@ -228,17 +288,19 @@
             SvpSalFrame *pFrame = static_cast<SvpSalFrame *>(*it);
             BlitFrameToWindow (&aOutBuffer, pFrame->getDevice());
         }
+
+#ifdef ANDROID_PIXELS
     }
     else
         fprintf (stderr, "no buffer for locked window\n");
-
-#ifdef ANDROID_PIXELS
     ANativeWindow_unlockAndPost(pWindow);
 #endif

 #ifdef ANDROID_EGL
+#ifdef ANDROID_EGL_LOCK
     nRet = eglUnlockSurfaceKHR(mxDisplay, mxSurface);
     fprintf (stderr, "eGL unlock %d\n", nRet);
+#endif
     eglSwapBuffers(mxDisplay, mxSurface);
 #endif


Avoid incorrectly continuing for_each_chunk_in_range loop

--- src/core/text-buffer.cc
+++ src/core/text-buffer.cc
@@ -180,7 +180,7 @@
     }

     if (current_position < goal_position) {
-      previous_layer->for_each_chunk_in_range(
+      return previous_layer->for_each_chunk_in_range(
         base_position,
         base_position.traverse(goal_position.traversal(current_position)),
         callback


rendercontext: Correct output of the type that is not double-buffered.

And also don't attempt to draw the non-double-buffered windows via double
buffering.

Change-Id: Ic7afb976dfbe005e1aeff2d726360f259f87f4bc

--- vcl/source/window/paint.cxx
+++ vcl/source/window/paint.cxx
@@ -192,9 +192,9 @@
         // but we are in the middle of double-buffered paint, we might be
         // losing information
         if (m_pBuffer && !m_pWindow->SupportsDoubleBuffering())
-            SAL_WARN("vcl.doublebuffering", "non-double buffered window in the double-buffered hierarchy, painting directly: " << typeid(m_pWindow).name());
-
-        if (m_pBuffer)
+            SAL_WARN("vcl.doublebuffering", "non-double buffered window in the double-buffered hierarchy, painting directly: " << typeid(*m_pWindow.get()).name());
+
+        if (m_pBuffer && m_pWindow->SupportsDoubleBuffering())
         {
             // double-buffering
             m_pWindow->PushPaintHelper(this, *m_pWindow);


Ensure thread device has synced with latest Dataset before sending MLE Announce. (#845)

--- src/core/thread/mle.cpp
+++ src/core/thread/mle.cpp
@@ -418,7 +418,7 @@
     mNetif.GetNetworkDataLocal().ClearResubmitDelayTimer();
     mNetif.GetIp6().SetForwardingEnabled(false);

-    if (mPreviousPanId != Mac::kPanIdBroadcast)
+    if (mPreviousPanId != Mac::kPanIdBroadcast && (mDeviceMode & ModeTlv::kModeFFD))
     {
         mPreviousPanId = Mac::kPanIdBroadcast;
         mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
@@ -1507,8 +1507,6 @@
     return;
 }

-
-
 ThreadError Mle::SendMessage(Message &aMessage, const Ip6::Address &aDestination)
 {
     ThreadError error = kThreadError_None;
@@ -2007,6 +2005,12 @@
         mNetif.GetPendingDataset().Clear();
     }

+    if (mPreviousPanId != Mac::kPanIdBroadcast && ((mDeviceMode & ModeTlv::kModeFFD) == 0))
+    {
+        mPreviousPanId = Mac::kPanIdBroadcast;
+        mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
+    }
+
     mRetrieveNewNetworkData = false;

 exit:
@@ -2462,6 +2466,11 @@

     if (localTimestamp == NULL || localTimestamp->Compare(timestamp) > 0)
     {
+        if ((mDeviceMode & ModeTlv::kModeFFD) == 0)
+        {
+            mRetrieveNewNetworkData = true;
+        }
+
         Stop();
         mPreviousChannel = mMac.GetChannel();
         mPreviousPanId = mMac.GetPanId();


Use correct index when adjusting percentage space allocated

--- src/ToolWindowManager.cpp
+++ src/ToolWindowManager.cpp
@@ -280,7 +280,7 @@
         int availSize = parentSplitterSizes[indexInParentSplitter];

         parentSplitterSizes[indexInParentSplitter] = int(availSize * (1.0f - area.percentage()));
-        parentSplitterSizes.insert(indexInParentSplitter, int(availSize * area.percentage()));
+        parentSplitterSizes.insert(insertIndex, int(availSize * area.percentage()));

         parentSplitter->setSizes(parentSplitterSizes);
       }


Fixes #428: Corrected direction of size check in one of the array copy functions.

--- src/cuda/api/memory.hpp
+++ src/cuda/api/memory.hpp
@@ -849,7 +849,7 @@
 template <typename T, dimensionality_t NumDimensions>
 void copy(region_t destination, const array_t<T, NumDimensions>& source)
 {
-	if (source.size_bytes() < destination.size()) {
+	if (destination.size() < source.size_bytes()) {
 		throw ::std::logic_error("Attempt to copy an array into a memory region too small to hold the copy");
 	}
 	copy(destination.start(), source);


Run spirv-opt pass to eliminate dead functions after inlining

The inliner leaves the original functions. If we want the simplicity of
not thinking about functions, we have to remove them.

Change-Id: I0d0c7f8d3de21095b52d86a4c62015287eda32cc
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27272
Tested-by: Chris Forbes <c3279c50043e18e9442c1ae071cafa0e7a4ca967@google.com>
Presubmit-Ready: Chris Forbes <c3279c50043e18e9442c1ae071cafa0e7a4ca967@google.com>
Kokoro-Presubmit: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Ben Clayton <1f693eb7158dc33015048c09d6712f74dabddf79@google.com>
Reviewed-by: Nicolas Capens <51edc787c30f24c4904e8ffbb5523c3a9f7a451d@google.com>

--- src/Vulkan/VkPipeline.cpp
+++ src/Vulkan/VkPipeline.cpp
@@ -206,6 +206,7 @@
 	});

 	opt.RegisterPass(spvtools::CreateInlineExhaustivePass());
+	opt.RegisterPass(spvtools::CreateEliminateDeadFunctionsPass());

 	// If the pipeline uses specialization, apply the specializations before freezing
 	if (specializationInfo)


(SQLite): добавил принудительное выставление флагов при создании соединения с БД( вместо умолчательное)

--- extensions/DBServer-SQLite/SQLiteInterface.cc
+++ extensions/DBServer-SQLite/SQLiteInterface.cc
@@ -38,7 +38,7 @@
 connected(false),
 opTimeout(300),
 opCheckPause(50)
-{
+{
 }

 SQLiteInterface::~SQLiteInterface()
@@ -59,7 +59,9 @@
 //	if( !create && !UniSetTypes::file_exist(dbfile) )
 //		return false;

-	int flags = create ? 0 : SQLITE_OPEN_READWRITE;
+	int flags = SQLITE_OPEN_READWRITE;
+	if( create )
+		flags |= SQLITE_OPEN_CREATE;

 	int rc = sqlite3_open_v2(dbfile.c_str(), &db, flags, NULL);

@@ -127,7 +129,7 @@
 // -----------------------------------------------------------------------------------------
 bool SQLiteInterface::checkResult( int rc )
 {
-	if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED || rc==SQLITE_INTERRUPT || rc==SQLITE_IOERR )
+	if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED || rc==SQLITE_INTERRUPT || rc==SQLITE_IOERR ) // || rc==SQLITE_NOMEM || rc==SQLITE_FULL )
 		return false;

 	return true;


prevent the creation of reserved sections

--- gui/window_callbacks.cpp
+++ gui/window_callbacks.cpp
@@ -277,9 +277,13 @@
                     return e.name == newName;
                 })
             || newName.empty()
-            || newName == L"OUTPUT")
-    {
-        fl_alert("Name needs to be unique and not null");
+            /* reserved */
+            || newName == L"OUTPUT"
+            || newName == L"Output"
+            || newName == L"WHO"
+            || newName == L"WHAT")
+    {
+        fl_alert("Name needs to be unique, not reserved, and not null");
         inp->value(W2MB(oldName).get());
         // Fl::focus(inp); // doesn't work because e.g. the tab key is
                            // handled later...


Fix sort mapping to QueryDSL

Fix sort mapping to QueryDSL

--- src/database_handler.cc
+++ src/database_handler.cc
@@ -1327,7 +1327,24 @@
 			if (pos != std::string_view::npos) {
 				auto field = sort.substr(0, pos);
 				auto value = sort.substr(pos);
-				query_object.get_sorter(sorter, { field, value });
+				MsgPack sort_obj;
+				if (!query_field.metric.empty()) {
+					if (field[0] == '-') {
+						field = field.substr(1, field.size());
+						sort_obj = MsgPack({{ field, {{ RESERVED_VALUE, value }, { RESERVED_QUERYDSL_METRIC , query_field.metric}, { RESERVED_QUERYDSL_ORDER , QUERYDSL_DESC }} }});
+					} else {
+						sort_obj = MsgPack({{ field, {{ RESERVED_VALUE, value }, { RESERVED_QUERYDSL_METRIC , query_field.metric}} }});
+					}
+				} else {
+					if (field[0] == '-') {
+						field = field.substr(1, field.size());
+						sort_obj = MsgPack({{ field, {{ RESERVED_VALUE, value }, { RESERVED_QUERYDSL_ORDER , QUERYDSL_DESC }} }});
+					} else {
+						sort_obj = MsgPack({{ field, {{ RESERVED_VALUE, value }} }});
+					}
+				}
+
+				query_object.get_sorter(sorter, sort_obj);
 			} else {
 				query_object.get_sorter(sorter, sort);
 			}


Fixed compilation warning

Fixed compilation warning


Initialize static variables only if XAPIAND_V8 or XAPIAND_CHAISCRIPT are defined

--- src/database_handler.cc
+++ src/database_handler.cc
@@ -132,8 +132,10 @@
 }

+#if defined(XAPIAND_V8) || defined(XAPIAND_CHAISCRIPT)
 std::mutex DatabaseHandler::documents_mtx;
 std::unordered_map<size_t, std::shared_ptr<Document>> DatabaseHandler::documents;
+#endif

 DatabaseHandler::DatabaseHandler()


fix compiler

fix compiler

--- src/detail/happ_raw.cpp
+++ src/detail/happ_raw.cpp
@@ -584,7 +584,7 @@
                 if (REDIS_CONN_TCP == rctx->c.connection_type) {
                     self->log_info("tcp:%s:%d AUTH failed. %s",
                                    rctx->c.tcp.host ? rctx->c.tcp.host : (rctx->c.tcp.source_addr ? rctx->c.tcp.source_addr : "UNKNOWN"), rctx->c.tcp.port,
-                                   error_text;
+                                   error_text);
                 } else if (REDIS_CONN_UNIX == rctx->c.connection_type) {
                     self->log_info("unix:%s AUTH failed. %s", rctx->c.unix_sock.path ? rctx->c.unix_sock.path : "NULL", error_text);
                 } else {


added machdep.h include

added machdep.h include

--- src/dotnet/HugsServ.cpp
+++ src/dotnet/HugsServ.cpp
@@ -5,6 +5,7 @@
 extern "C" {
 #include "prelude.h"
 #include "storage.h"
+#include "machdep.h"
 #include "connect.h"
 };
 #include "prim.h"


Negate MPU6000 X and Y axes.

Negate MPU6000 X and Y axes.


glsl: Move the definition of precision_qualifier_allowed

We will need this to build later patches

Reviewed-by: Tapani Pälli <cdcb67a5e49297de94340ca09f25994bd5e7f762@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <b753b212f30aed827c3eea2e437609dc37310153@igalia.com>


Fixed dishes orientation.

Fixed dishes orientation.

--- src/api/rvmmeshhelper.cpp
+++ src/api/rvmmeshhelper.cpp
@@ -598,7 +598,7 @@
     vector<vector<int> > normalindex;
     vector<vector<float> > vectors;

-    float hd = diameter / 2;
+    float hd = diameter;
     int sides = int(2*M_PI * radius / maxSideSize);
     if (sides < minSides / 2) {
         sides = minSides / 2;
@@ -617,15 +617,15 @@
         for (int j = 0; j < csides; j++) {
             float C = (float)cos(2*M_PI / csides * j);
             float S = (float)sin(2*M_PI / csides * j);
-            v[0] = hd * C * c; v[1] = hd * S * c; v[2] = -radius * s;
+            v[0] = hd * C * c; v[1] = hd * S * c; v[2] = radius * s;
             points.push_back(v);
-            n[0] = radius * C * c; n[1] = radius * S * c; n[2] = -hd * s;
+            n[0] = radius * C * c; n[1] = radius * S * c; n[2] = hd * s;
             vectors.push_back(normalize(n));
         }
     }
-    v[0] = 0; v[1] = 0; v[2] = -radius;
+    v[0] = 0; v[1] = 0; v[2] = radius;
     points.push_back(v);
-    n[0] = 0; n[1] = 0; n[2] = -1;
+    n[0] = 0; n[1] = 0; n[2] = 1;
     vectors.push_back(n);

     // Sides
@@ -660,8 +660,8 @@
     vector<vector<int> > normalindex;
     vector<vector<float> > vectors;

-    float radius = diameter * diameter / (4 * height);
-    float hd = diameter / 2;
+    float radius = diameter * diameter / height;
+    float hd = diameter;
     int csides = int(2*M_PI * radius / maxSideSize);
     if (csides < minSides) {
         csides = minSides;
@@ -678,15 +678,15 @@
         for (int j = 0; j < csides; j++) {
             float C = (float)cos(2*M_PI / csides * j);
             float S = (float)sin(2*M_PI / csides * j);
-            v[0] = radius * C * c; v[1] = radius * S * c; v[2] = radius - height -radius * s;
+            v[0] = radius * C * c; v[1] = radius * S * c; v[2] = -(radius - height -radius * s);
             points.push_back(v);
-            n[0] = radius * C * c; n[1] = radius * S * c; n[2] = -radius * s;
+            n[0] = radius * C * c; n[1] = radius * S * c; n[2] = radius * s;
             vectors.push_back(normalize(n));
         }
     }
-    v[0] = 0; v[1] = 0; v[2] = -height;
+    v[0] = 0; v[1] = 0; v[2] = height;
     points.push_back(v);
-    n[0] = 0; n[1] = 0; n[2] = -1;
+    n[0] = 0; n[1] = 0; n[2] = 1;
     vectors.push_back(n);

     // Sides


Add getTicketAppId API.

Add getTicketAppId API.

--- src/api/steam_api_auth.cc
+++ src/api/steam_api_auth.cc
@@ -135,6 +135,19 @@
   info.GetReturnValue().Set(greenworks::SteamID::Create(steam_id));
 }

+NAN_METHOD(getTicketAppId) {
+  Nan::HandleScope scope;
+  if (info.Length() < 1 || !node::Buffer::HasInstance(info[0])) {
+    THROW_BAD_ARGS("Bad arguments");
+  }
+  char* decrypted_ticket_buf = node::Buffer::Data(info[0]);
+  size_t decrypted_ticket_buf_size = node::Buffer::Length(info[0]);
+  uint32 app_id = SteamEncryptedAppTicket_GetTicketAppID(
+      reinterpret_cast<uint8*>(decrypted_ticket_buf),
+      decrypted_ticket_buf_size);
+  info.GetReturnValue().Set(app_id);
+}
+
 void RegisterAPIs(v8::Handle<v8::Object> target) {
   Nan::Set(target,
            Nan::New("getAuthSessionTicket").ToLocalChecked(),
@@ -160,6 +173,10 @@
            Nan::New<v8::FunctionTemplate>(
                getTicketSteamId)->GetFunction());
   Nan::Set(target,
+           Nan::New("getTicketAppId").ToLocalChecked(),
+           Nan::New<v8::FunctionTemplate>(
+               getTicketAppId)->GetFunction());
+  Nan::Set(target,
            Nan::New("cancelAuthTicket").ToLocalChecked(),
            Nan::New<v8::FunctionTemplate>(CancelAuthTicket)->GetFunction());
 }


Show favorites number. Fix search filter typo.

--- src/app/ModuleBrowser.cpp
+++ src/app/ModuleBrowser.cpp
@@ -303,7 +303,10 @@

 struct ShowFavoritesQuantity : ui::Quantity {
 	widget::Widget *widget;
-	std::string getLabel() override {return "Only show favorites";}
+	std::string getLabel() override {
+		int favoritesLen = settings.favoriteModels.size();
+		return string::f("Only show favorites (%d)", favoritesLen);
+	}
 	void setValue(float value) override;
 	float getValue() override;
 };
@@ -330,6 +333,7 @@
 		addChild(favoriteButton);

 		authorLabel = new ui::Label;
+		// authorLabel->fontSize = 16;
 		authorLabel->color = nvgRGB(0x80, 0x80, 0x80);
 		authorLabel->text = "Authors";
 		addChild(authorLabel);
@@ -353,6 +357,7 @@
 		}

 		tagLabel = new ui::Label;
+		// tagLabel->fontSize = 16;
 		tagLabel->color = nvgRGB(0x80, 0x80, 0x80);
 		tagLabel->text = "Tags";
 		addChild(tagLabel);
@@ -420,6 +425,7 @@
 		addChild(modelScroll);

 		modelLabel = new ui::Label;
+		// modelLabel->fontSize = 16;
 		modelLabel->box.pos = math::Vec(10, 10);
 		modelScroll->container->addChild(modelLabel);

@@ -497,7 +503,7 @@
 				assert(m);
 				float score = 0.f;
 				if (m->visible) {
-					modelScore(m->model, search);
+					score = modelScore(m->model, search);
 					m->visible = (score > 0);
 				}
 				scores[m] = score;


Print time before primes

Print time before primes

--- src/apps/console/main.cpp
+++ src/apps/console/main.cpp
@@ -54,6 +54,11 @@
     size = max(size, label_size);
   }

+  if (opts.time)
+    cout << setw(size) << "Seconds" << " : "
+         << fixed << setprecision(3) << pps.getSeconds()
+         << endl;
+
   // print results
   for (int i = 0; i < 6; i++)
   {
@@ -61,11 +66,6 @@
       cout << setw(size) << labels[i] << " : "
            << pps.getCount(i) << endl;
   }
-
-  if (opts.time)
-    cout << setw(size) << "Seconds" << " : "
-         << fixed << setprecision(3) << pps.getSeconds()
-         << endl;
 }

 /// Used to count and print primes and prime k-tuplets
@@ -88,7 +88,7 @@
   if (!opts.quiet)
   {
     cout << "Sieve size = " << pps.getSieveSize() << " kilobytes" << endl;
-    cout << "Threads    = " << pps.idealNumThreads() << endl;
+    cout << "Threads = " << pps.idealNumThreads() << endl;
   }

   if (opts.status)
@@ -114,11 +114,11 @@
   uint64_t start = numbers[1];
   uint64_t nthPrime = pps.nthPrime(n, start);

-  cout << "Nth prime : " << nthPrime << endl;
-
   if (opts.time)
     cout << "Seconds   : " << fixed << setprecision(3)
          << pps.getSeconds() << endl;
+
+  cout << "Nth prime : " << nthPrime << endl;
 }

 } // namespace


Dealer the Builder  Can he fix it?!

Dealer the Builder
Can he fix it?!

YES HE CAN!!!

--- src/arcemu-world/Unit.cpp
+++ src/arcemu-world/Unit.cpp
@@ -3960,7 +3960,7 @@
     // FLAGS changed so other players see attack animation
     //    addUnitFlag(UNIT_FLAG_COMBAT);
     //    setUpdateMaskBit(UNIT_FIELD_FLAGS );
-    if(GetTypeId() != TYPEID_PLAYER)
+    if(GetTypeId() == TYPEID_PLAYER)
     {
         Player* pThis = static_cast< Player* >( this );
         if( pThis->cannibalize)