BUG#13864642: DROP/CREATE USER BEHAVING ODDLY

BACKGROUND:
In certain situations DROP USER fails to remove all privileges
belonging to user being dropped from in-memory structures.
Current workaround is to do DROP USER twice in scenario below
OR doing FLUSH PRIVILEGES after doing DROP USER.

ANALYSIS:
In MySQL, When we grant some stored routines privileges to a
user they are stored in their respective hash.
When doing DROP USER all the stored routine privilege entries
associated with that user has to be deleted from its respective
hash.
The root cause for this bug is some entries from the hash
are not getting deleted.
The problem is that code that deletes entries from the hash tries
to do so while iterating over it, without taking enough measures
to address the fact that such deletion can reshuffle elements in
the hash. If the user/administrator creates the same user again
he is thrown an  error 'Error 1396 ER_CANNOT_USER' from MySQL.
This prompts the user to either do FLUSH PRIVILEGES or do DROP USER
again. This behaviour is not desirable as it is a workaround and
does not solves the problem mentioned above.

FIX:
This bug is fixed by introducing a dynamic array to store the
pointersto all stored routine privilege objects that either have
to be deleted or updated. This is done in 3 steps.
Step 1: Fetching the element from the hash and checking whether
it is to be deleted or updated.
Step 2: Storing the pointer to that privilege object in dynamic array.
Step 3: Traversing the dynamic array to perform the appropriate action
either delete or update.
This is a much cleaner way to delete or update the privilege entries
associated with some user and solves the problem mentioned above.
Also the code has been refactored a bit by introducing an enum
instead of hard coded numbers used for respective dynamic arrays
and hashes in handle_grant_struct() function.

--- sql/sql_acl.cc
+++ sql/sql_acl.cc
@@ -195,7 +195,17 @@
 static my_bool acl_load(THD *thd, TABLE_LIST *tables);
 static my_bool grant_load(THD *thd, TABLE_LIST *tables);
 static inline void get_grantor(THD *thd, char* grantor);
-
+/*
+ Enumeration of various ACL's and Hashes used in handle_grant_struct()
+*/
+enum enum_acl_lists
+{
+  USER_ACL= 0,
+  DB_ACL,
+  COLUMN_PRIVILEGES_HASH,
+  PROC_PRIVILEGES_HASH,
+  FUNC_PRIVILEGES_HASH
+};
 /*
   Convert scrambled password to binary form, according to scramble type,
   Binary form is stored in user.salt.
@@ -5390,19 +5400,19 @@
     Delete from grant structure if drop is true.
     Update in grant structure if drop is false and user_to is not NULL.
     Search in grant structure if drop is false and user_to is NULL.
-    Structures are numbered as follows:
-    0 acl_users
-    1 acl_dbs
-    2 column_priv_hash
-    3 proc_priv_hash
-    4 func_priv_hash
+    Structures are enumerated as follows:
+    0 ACL_USER
+    1 ACL_DB
+    2 COLUMN_PRIVILEGES_HASH
+    3 PROC_PRIVILEGES_HASH
+    4 FUNC_PRIVILEGES_HASH

   @retval > 0  At least one element matched.
   @retval 0    OK, but no element matched.
-  @retval -1   Wrong arguments to function.
+  @retval -1   Wrong arguments to function or Out of Memory
 */

-static int handle_grant_struct(uint struct_no, bool drop,
+static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
                                LEX_USER *user_from, LEX_USER *user_to)
 {
   int result= 0;
@@ -5413,6 +5423,11 @@
   ACL_USER *acl_user= NULL;
   ACL_DB *acl_db= NULL;
   GRANT_NAME *grant_name= NULL;
+  /*
+    Dynamic array acl_grant_name used to store pointers to all
+    GRANT_NAME objects
+  */
+  Dynamic_array<GRANT_NAME *> acl_grant_name;
   HASH *grant_name_hash= NULL;
   DBUG_ENTER("handle_grant_struct");
   DBUG_PRINT("info",("scan struct: %u  search: '%s'@'%s'",
@@ -5425,21 +5440,21 @@

   /* Get the number of elements in the in-memory structure. */
   switch (struct_no) {
-  case 0:
+  case USER_ACL:
     elements= acl_users.elements;
     break;
-  case 1:
+  case DB_ACL:
     elements= acl_dbs.elements;
     break;
-  case 2:
+  case COLUMN_PRIVILEGES_HASH:
     elements= column_priv_hash.records;
     grant_name_hash= &column_priv_hash;
     break;
-  case 3:
+  case PROC_PRIVILEGES_HASH:
     elements= proc_priv_hash.records;
     grant_name_hash= &proc_priv_hash;
     break;
-  case 4:
+  case FUNC_PRIVILEGES_HASH:
     elements= func_priv_hash.records;
     grant_name_hash= &func_priv_hash;
     break;
@@ -5458,21 +5473,21 @@
       Get a pointer to the element.
     */
     switch (struct_no) {
-    case 0:
+    case USER_ACL:
       acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
       user= acl_user->user;
       host= acl_user->host.hostname;
     break;

-    case 1:
+    case DB_ACL:
       acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
       user= acl_db->user;
       host= acl_db->host.hostname;
       break;

-    case 2:
-    case 3:
-    case 4:
+    case COLUMN_PRIVILEGES_HASH:
+    case PROC_PRIVILEGES_HASH:
+    case FUNC_PRIVILEGES_HASH:
       grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx);
       user= grant_name->user;
       host= grant_name->host.hostname;
@@ -5498,86 +5513,60 @@
     if ( drop )
     {
       switch ( struct_no ) {
-      case 0:
+      case USER_ACL:
         delete_dynamic_element(&acl_users, idx);
-        break;
-
-      case 1:
-        delete_dynamic_element(&acl_dbs, idx);
-        break;
-
-      case 2:
-      case 3:
-      case 4:
-        hash_delete(grant_name_hash, (uchar*) grant_name);
-	break;
-      }
-      elements--;
-      /*
+        elements--;
+        /*
         - If we are iterating through an array then we just have moved all
           elements after the current element one position closer to its head.
           This means that we have to take another look at the element at
           current position as it is a new element from the array's tail.
-        - If we are iterating through a hash the current element was replaced
-          with one of elements from the tail. So we also have to take a look
-          at the new element in current position.
-          Note that in our HASH implementation hash_delete() won't move any
-          elements with position after current one to position before the
-          current (i.e. from the tail to the head), so it is safe to continue
-          iteration without re-starting.
-      */
-      idx--;
+        - This is valid for USER_ACL, DB_ACL.
+        */
+        idx--;
+        break;
+
+      case DB_ACL:
+        delete_dynamic_element(&acl_dbs, idx);
+        elements--;
+        idx--;
+        break;
+
+      case COLUMN_PRIVILEGES_HASH:
+      case PROC_PRIVILEGES_HASH:
+      case FUNC_PRIVILEGES_HASH:
+        /*
+          Deleting while traversing a hash table is not valid procedure and
+          hence we save pointers to GRANT_NAME objects for later processing.
+        */
+        if (acl_grant_name.append(grant_name))
+          DBUG_RETURN(-1);
+	break;
+      }
     }
     else if ( user_to )
     {
       switch ( struct_no ) {
-      case 0:
+      case USER_ACL:
         acl_user->user= strdup_root(&mem, user_to->user.str);
         acl_user->host.hostname= strdup_root(&mem, user_to->host.str);
         break;

-      case 1:
+      case DB_ACL:
         acl_db->user= strdup_root(&mem, user_to->user.str);
         acl_db->host.hostname= strdup_root(&mem, user_to->host.str);
         break;

-      case 2:
-      case 3:
-      case 4:
-        {
-          /*
-            Save old hash key and its length to be able properly update
-            element position in hash.
-          */
-          char *old_key= grant_name->hash_key;
-          size_t old_key_length= grant_name->key_length;
-
-          /*
-            Update the grant structure with the new user name and host name.
-          */
-          grant_name->set_user_details(user_to->host.str, grant_name->db,
-                                       user_to->user.str, grant_name->tname,
-                                       TRUE);
-
-          /*
-            Since username is part of the hash key, when the user name
-            is renamed, the hash key is changed. Update the hash to
-            ensure that the position matches the new hash key value
-          */
-          hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
-                      old_key_length);
-          /*
-            hash_update() operation could have moved element from the tail
-            of the hash to the current position. So we need to take a look
-            at the element in current position once again.
-            Thanks to the fact that hash_update() for our HASH implementation
-            won't move any elements from the tail of the hash to the positions
-            before the current one (a.k.a. head) it is safe to continue
-            iteration without restarting.
-          */
-          idx--;
-          break;
-        }
+      case COLUMN_PRIVILEGES_HASH:
+      case PROC_PRIVILEGES_HASH:
+      case FUNC_PRIVILEGES_HASH:
+        /*
+          Updating while traversing a hash table is not valid procedure and
+          hence we save pointers to GRANT_NAME objects for later processing.
+        */
+        if (acl_grant_name.append(grant_name))
+          DBUG_RETURN(-1);
+        break;
       }
     }
     else
@@ -5586,6 +5575,48 @@
       break;
     }
   }
+
+  if (drop || user_to)
+  {
+    /*
+      Traversing the elements stored in acl_grant_name dynamic array
+      to either delete or update them.
+    */
+    for (int i= 0; i < acl_grant_name.elements(); ++i)
+    {
+      grant_name= acl_grant_name.at(i);
+
+      if (drop)
+      {
+        my_hash_delete(grant_name_hash, (uchar *) grant_name);
+      }
+      else
+      {
+        /*
+          Save old hash key and its length to be able properly update
+          element position in hash.
+        */
+        char *old_key= grant_name->hash_key;
+        size_t old_key_length= grant_name->key_length;
+
+        /*
+          Update the grant structure with the new user name and host name.
+        */
+        grant_name->set_user_details(user_to->host.str, grant_name->db,
+                                     user_to->user.str, grant_name->tname,
+                                     TRUE);
+
+        /*
+          Since username is part of the hash key, when the user name
+          is renamed, the hash key is changed. Update the hash to
+          ensure that the position matches the new hash key value
+        */
+        my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
+                       old_key_length);
+      }
+    }
+  }
+
 #ifdef EXTRA_DEBUG
   DBUG_PRINT("loop",("scan struct: %u  result %d", struct_no, result));
 #endif
@@ -5623,6 +5654,7 @@
 {
   int result= 0;
   int found;
+  int ret;
   DBUG_ENTER("handle_grant_data");

   /* Handle user table. */
@@ -5634,14 +5666,19 @@
   else
   {
     /* Handle user array. */
-    if ((handle_grant_struct(0, drop, user_from, user_to) && ! result) ||
-        found)
+    if (((ret= handle_grant_struct(USER_ACL, drop, user_from, user_to) > 0) &&
+         ! result) || found)
     {
       result= 1; /* At least one record/element found. */
       /* If search is requested, we do not need to search further. */
       if (! drop && ! user_to)
         goto end;
     }
+    else if (ret < 0)
+    {
+      result= -1;
+      goto end;
+    }
   }

   /* Handle db table. */
@@ -5653,14 +5690,19 @@
   else
   {
     /* Handle db array. */
-    if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) ||
-         found) && ! result)
+    if ((((ret= handle_grant_struct(DB_ACL, drop, user_from, user_to) > 0) &&
+          ! result) || found) && ! result)
     {
       result= 1; /* At least one record/element found. */
       /* If search is requested, we do not need to search further. */
       if (! drop && ! user_to)
         goto end;
     }
+    else if (ret < 0)
+    {
+      result= -1;
+      goto end;
+    }
   }

   /* Handle stored routines table. */
@@ -5672,23 +5714,35 @@
   else
   {
     /* Handle procs array. */
-    if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) ||
-         found) && ! result)
+    if ((((ret= handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from,
+                                    user_to) > 0) && ! result) || found) &&
+        ! result)
     {
       result= 1; /* At least one record/element found. */
       /* If search is requested, we do not need to search further. */
       if (! drop && ! user_to)
         goto end;
     }
+    else if (ret < 0)
+    {
+      result= -1;
+      goto end;
+    }
     /* Handle funcs array. */
-    if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) ||
-         found) && ! result)
+    if ((((ret= handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from,
+                                    user_to) > 0) && ! result) || found) &&
+        ! result)
     {
       result= 1; /* At least one record/element found. */
       /* If search is requested, we do not need to search further. */
       if (! drop && ! user_to)
         goto end;
     }
+    else if (ret < 0)
+    {
+      result= -1;
+      goto end;
+    }
   }

   /* Handle tables table. */
@@ -5716,9 +5770,12 @@
     else
     {
       /* Handle columns hash. */
-      if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) ||
-           found) && ! result)
+      if ((((ret= handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from,
+                                      user_to) > 0) && ! result) || found) &&
+          ! result)
         result= 1; /* At least one record/element found. */
+      else if (ret < 0)
+        result= -1;
     }
   }
  end:


net: Fix close issue with Botan TLS stream

--- api/net/botan/tls_server.hpp
+++ api/net/botan/tls_server.hpp
@@ -44,6 +44,7 @@
     assert(m_transport->is_connected());
     // default read callback
     m_transport->on_read(4096, {this, &Server::tls_read});
+    m_transport->on_close({this, &Server::close_callback_once});
   }
   ~Server() {
     assert(m_busy == false && "Cannot delete stream while in its call stack");
@@ -82,7 +83,13 @@
     if (this->m_busy) {
       this->m_deferred_close = true; return;
     }
+    CloseCallback cb = std::move(m_on_close);
+    this->reset_callbacks();
     m_transport->close();
+    if (cb) cb();
+  }
+  void close_callback_once()
+  {
     CloseCallback cb = std::move(m_on_close);
     this->reset_callbacks();
     if (cb) cb();
@@ -97,7 +104,6 @@
     m_on_write = nullptr;
     m_on_connect = nullptr;
     m_on_close = nullptr;
-    m_transport->reset_callbacks();
   }

   net::Socket local() const override {
@@ -142,6 +148,7 @@
 protected:
   void tls_read(buffer_t buf)
   {
+    this->m_busy = true;
     try
     {
       int rem = m_tls.received_data(buf->data(), buf->size());
@@ -153,6 +160,8 @@
       printf("Fatal TLS error %s\n", e.what());
       this->close();
     }
+    this->m_busy = false;
+    if (this->m_deferred_close) this->close();
   }

   void tls_alert(Botan::TLS::Alert alert) override
@@ -186,10 +195,7 @@
   void tls_record_received(uint64_t, const uint8_t buf[], size_t buf_len) override
   {
     if (m_on_read) {
-      this->m_busy = true;
       m_on_read(Stream::construct_buffer(buf, buf + buf_len));
-      this->m_busy = false;
-      if (this->m_deferred_close) this->close();
     }
   }


add common anchor

add common anchor

--- ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp
+++ ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp
@@ -470,6 +470,23 @@

 void TCell::FillTcPr(PPTX::Logic::TableCellProperties &oTcPr)
 {
+    //anchor
+    auto& attr = m_pShape->m_pShape->m_oText.m_oAttributes;
+    if (attr.m_nTextAlignVertical != -1)
+    {
+        auto pAnchor = new PPTX::Limit::TextAnchor;
+        BYTE anchor[] = {4,1,0};
+        if (sizeof (anchor) > (UINT)attr.m_nTextAlignVertical)
+            pAnchor->SetBYTECode(anchor[attr.m_nTextAlignVertical]);
+
+        oTcPr.Anchor = pAnchor;
+    }
+    if (attr.m_nTextAlignHorizontal == 1)
+    {
+        oTcPr.AnchorCtr = true;
+    }
+
+
     auto pSolidFill = new PPTX::Logic::SolidFill;
     auto& clr = m_pShape->m_oBrush.Color1;


Remove hardcoded paths from Java binding (not the best solution though)

--- bindings/java/binding/JointJavaContext.cpp
+++ bindings/java/binding/JointJavaContext.cpp
@@ -1,4 +1,7 @@
 #include <binding/JointJavaContext.hpp>
+
+#include <joint/devkit/system/CurrentLibraryPath.hpp>
+
 #include <jni/JNIHelpers.hpp>
 #include <utils/Utils.hpp>

@@ -12,8 +15,13 @@

 	JointJavaContext::JointJavaContext()
 	{
-		std::string class_path_opt = "-Djava.class.path=/home/koplyarov/work/joint/build/bin/joint.jar";
-		std::string lib_path_opt = "-Djava.library.path=/home/koplyarov/work/joint/build/bin";
+		auto current_lib_path = joint::devkit::CurrentLibraryPath::Get();
+		auto last_slash_index = current_lib_path.find_last_of("/\\");
+		auto current_lib_dir = (last_slash_index == std::string::npos) ? std::string() : current_lib_path.substr(0, last_slash_index);
+
+		std::string lib_path_opt = "-Djava.library.path=" + current_lib_dir;
+		std::string class_path_opt = "-Djava.class.path=" + current_lib_dir +  "/joint.jar";
+
 		JavaVMOption opt[] = {
 			{ const_cast<char*>(class_path_opt.c_str()), nullptr },
 			{ const_cast<char*>(lib_path_opt.c_str()), nullptr }


Fix bugs in MergeAdjacentImages.cxx

Fix bugs in MergeAdjacentImages.cxx

--- Applications/MergeAdjacentImages/MergeAdjacentImages.cxx
+++ Applications/MergeAdjacentImages/MergeAdjacentImages.cxx
@@ -113,7 +113,7 @@
   // Perform merging
   timeCollector.Start( "Merging images" );

-  typedef tube::MergeAdjacentImages< TPixel, VDimension >
+  typedef tube::MergeAdjacentImages< ImageType >
     MergeAdjacentImagesFilterType;

   typename MergeAdjacentImagesFilterType::Pointer filter =
@@ -152,7 +152,7 @@
   try
     {
     writer->SetFileName( outputVolume.c_str() );
-    writer->SetInput( outImage );
+    writer->SetInput( filter->GetOutput() );
     writer->SetUseCompression( true );
     writer->Update();
     }


The constructor prints also the number of bytes to send together with the thread ID

git-svn-id: 4f15cd35116e72df6ba252f213c0d8a6c7d4ad11@228431 523d945c-050c-4681-91ec-863ad3bb968a

--- Benchmark/bulkDataNTPerf/src/BDNTSenderSimulatorFlow.cpp
+++ Benchmark/bulkDataNTPerf/src/BDNTSenderSimulatorFlow.cpp
@@ -55,7 +55,7 @@
 	if (threadManager.spawn((ACE_THR_FUNC)BDNTSenderSimulatorFlow::threadFunc, this, 0, &threadId) == -1) {
 		cerr << "Error spawning thread" << name << endl;
 	} else {
-		cout << "Thread for "<< name << " name started with Id=" << threadId << endl;
+		cout << "Thread for "<< name << " name started with Id=" << threadId << ": will send "<< size << " bytes" << endl;
 	}
 }


Fixed build issue in organizeritemrecurrencetransform.cpp

--- plugins/organizer/symbian/transform/organizeritemrecurrencetransform.cpp
+++ plugins/organizer/symbian/transform/organizeritemrecurrencetransform.cpp
@@ -41,7 +41,7 @@
 #include "organizeritemrecurrencetransform.h"
 #include "qorganizeritemrecurrence.h"
 #include "qorganizereventtimerange.h"
-#include "QOrganizerTodoTimeRange"
+#include "qorganizertodotimerange.h"

 #include <calrrule.h>


@.  Probably.

@.  Probably.

--- software/firmware/libraries/LogobotText/LogobotText.cpp
+++ software/firmware/libraries/LogobotText/LogobotText.cpp
@@ -287,42 +287,56 @@

 		void writeColon(float x, float y)
 		{
-			pushTo(x + w/3, y + capHeight/3);
-			pushPD();
-			pushTo(x + 2*w/3, y + capHeight/3);
-			pushPU();
-			pushTo(x + 2*w/3, y + 2*capHeight/3);
-			pushPD();
-			pushTo(x + w/3, y + 2*capHeight/3);
+			pushTo(x + w / 3, y + capHeight / 3);
+			pushPD();
+			pushTo(x + 2 * w / 3, y + capHeight / 3);
+			pushPU();
+			pushTo(x + 2 * w / 3, y + 2 * capHeight / 3);
+			pushPD();
+			pushTo(x + w / 3, y + 2 * capHeight / 3);
 		}

 		void writeCloseBracket(float x, float y)
 		{
-			pushTo(x + w/3, y);
-			pushPD();
-			pushTo(x + 2*w/3, y + capHeight/4);
-			pushTo(x + 2*w/3, y + 3*capHeight/4);
-			pushTo(x + w/3, y + capHeight);
+			pushTo(x + w / 3, y);
+			pushPD();
+			pushTo(x + 2 * w / 3, y + capHeight / 4);
+			pushTo(x + 2 * w / 3, y + 3 * capHeight / 4);
+			pushTo(x + w / 3, y + capHeight);
 		}

 		void writeHash(float x, float y)
 		{
-			pushTo(x, y + capHeight/3);
-			pushPD();
-			pushTo(x + w, y + capHeight/3);
-			pushPU();
-			pushTo(x + w, y + 2*capHeight/3);
-			pushPD();
-			pushTo(x, y + 2*capHeight/3);
-			pushPU();
-
-			pushTo(x + w/3, y + capHeight);
-			pushPD();
-			pushTo(x + w/3, y);
-			pushPU();
-			pushTo(x + 2*w/3, y);
-			pushPD();
-			pushTo(x + 2*w/3, y + capHeight);
+			pushTo(x, y + capHeight / 3);
+			pushPD();
+			pushTo(x + w, y + capHeight / 3);
+			pushPU();
+			pushTo(x + w, y + 2 * capHeight / 3);
+			pushPD();
+			pushTo(x, y + 2 * capHeight / 3);
+			pushPU();
+
+			pushTo(x + w / 3, y + capHeight);
+			pushPD();
+			pushTo(x + w / 3, y);
+			pushPU();
+			pushTo(x + 2 * w / 3, y);
+			pushPD();
+			pushTo(x + 2 * w / 3, y + capHeight);
+		}
+
+		void writeAt(float x, float y)
+		{
+			pushTo(x + 2 * w / 3, y + capHeight / 3);
+			pushPD();
+			pushTo(x + 2 * w / 3, y + 2 * capHeight / 3);
+			pushTo(x + w / 3, y + capHeight / 2);
+			pushTo(x + 2 * w / 3, y + capHeight / 3);
+			pushTo(x + w, y + capHeight / 2);
+			pushTo(x + 2 * w / 3, y + capHeight);
+			pushTo(x, y + capHeight / 2);
+			pushTo(x + w / 2, y);
+			pushTo(x + w, y + capHeight / 3);
 		}
 	}
 	// End private namespace functions
@@ -427,18 +441,19 @@
 				// nothing to do, just move to next letter
 				break;
 			case ':':
-				writeColon(x,y);
+				writeColon(x, y);
 				break;
 			case ')':
-				writeCloseBracket(x,y);
+				writeCloseBracket(x, y);
 				break;
 			case '#':
-				writeHash(x,y);
-				break;
+				writeHash(x, y);
+				break;
+			case '@':
+				writeAt(x, y);

 			default:
-				_cmdQ->enqueue("500",LOGO_CMD_BZ);
-				//pushCmd("BZ 500");
+				_cmdQ->enqueue("500", LOGO_CMD_BZ);
 				return;
 		}


minor fix

minor fix

--- CMSSW/src/L1Trigger/TrackFindingAM/src/PCATrackFitter.cc
+++ CMSSW/src/L1Trigger/TrackFindingAM/src/PCATrackFitter.cc
@@ -710,7 +710,7 @@
                             layersid,
                             pslayersid,
                             tow,
-                            pca::INTEGPT))
+                            pca::FLOATPT))
       {
         double cottheta = 0.0; // eta
         double z0 = 0.0;


bug fix in command line parameter processing

git-svn-id: a4b26c34c00ddc9206f2ebf811dcbf46daf0547e@26 2439b94c-f860-40a2-9219-eeaa48156016

--- example/apriltags_demo.cpp
+++ example/apriltags_demo.cpp
@@ -163,6 +163,7 @@

     m_draw(true),
     m_arduino(false),
+    m_timing(false),

     m_width(640),
     m_height(480),
@@ -200,7 +201,7 @@
   // parse command line options to change default behavior
   void parseOptions(int argc, char* argv[]) {
     int c;
-    while ((c = getopt(argc, argv, ":h?adC:F:H:S:W:E:G:B:")) != -1) {
+    while ((c = getopt(argc, argv, ":h?adtC:F:H:S:W:E:G:B:D:")) != -1) {
       // Each option character has to be in the string in getopt();
       // the first colon changes the error character from '?' to ':';
       // a colon after an option means that there is an extra
@@ -217,6 +218,9 @@
         break;
       case 'd':
         m_draw = false;
+        break;
+      case 't':
+        m_timing = true;
         break;
       case 'C':
         setTagCodes(optarg);


Remove debug code.

Remove debug code.

--- src/mc/units/concurrent_units.cc
+++ src/mc/units/concurrent_units.cc
@@ -98,7 +98,7 @@
           return active(true, false);
         }

-        if (on(j_units_cit, o, j_units_end)) // on j or its subunits
+        if (on(j_units_cit, o)) // on j or its subunits
         {
           for (const auto& arc : node)
           {
@@ -139,7 +139,7 @@
           return active(false, true);
         }

-        if (on(i_units_cit, o, i_units_end)) // on i or its subunits
+        if (on(i_units_cit, o)) // on i or its subunits
         {
           for (const auto& arc : node)
           {
@@ -179,7 +179,7 @@
           return active(false, false);
         }

-        if (on(i_units_cit, o, i_units_end)) // on i or its subunits
+        if (on(i_units_cit, o)) // on i or its subunits
         {
           for (const auto& arc : node)
           {
@@ -203,7 +203,7 @@
             }
           }
         }
-        else if (on(j_units_cit, o, j_units_end))
+        else if (on(j_units_cit, o))
         {
           for (const auto& arc : node)
           {
@@ -247,9 +247,8 @@

   static
   bool
-  on(InputIterator cit, const order& o, InputIterator end)
-  {
-    assert(cit != end);
+  on(InputIterator cit, const order& o)
+  {
     // Units identifiers are sorted by their order of apparition in the SDD.
     // So we can safely check the head of units identifiers.
     return o.identifier().user() == *cit;


Player can't launch a locked level in "ChooseYourLevelMenu". fix #185

--- src/menu/ChooseYourLevelMenu.cpp
+++ src/menu/ChooseYourLevelMenu.cpp
@@ -184,7 +184,8 @@
 	}
 	// Handle a clic on a level button
 	for (unsigned int i = 0; i < m_levelButtonVector.size(); ++i){
-		if (m_levelButtonVector[i]->isTargetedByMouse(mouseX, mouseY)){
+		//If the player clic on a level he can play
+		if (m_levelButtonVector[i]->isTargetedByMouse(mouseX, mouseY) && i < m_pPlayer->getCurrentLevel()) {

 			//Convert int to string
 			std::ostringstream oss;


KS message changed

KS message changed

--- eacirc/eacirc.cc
+++ eacirc/eacirc.cc
@@ -82,7 +82,7 @@
         logger::info() << "KS is in " << _significance_level
                        << "% interval -> uniformity hypothesis rejected" << std::endl;
     } else {
-        logger::info() << "KS is not in " << _significance_level << "% interval -> is uniform"
-                       << std::endl;
+        logger::info() << "KS is not in " << _significance_level
+                       << "% interval -> uniformity hypothesis accepted" << std::endl;
     }
 }


Increase lookup area for fixed points to avoid considering road as thunderstorms

--- analyze.cpp
+++ analyze.cpp
@@ -231,7 +231,7 @@
         }
     }

-    auto dd = makeDd(2);
+    auto dd = makeDd(4);

     std::vector<Data> sourceDataFrames;
     for (const auto& frame: frames) {


Update parsing of textAlign prop for Text

Summary: This fixes the parsing of textAlign prop in BaseTextProps class. The name is textAlign and not alignment.

Reviewed By: JoshuaGross

Differential Revision: D16057477

fbshipit-source-id: a00a472af4c7df0a6cd3d6efb17b30cd9134907b

--- ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp
+++ ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp
@@ -50,7 +50,7 @@
   textAttributes.lineHeight =
       convertRawProp(rawProps, "lineHeight", defaultTextAttributes.lineHeight);
   textAttributes.alignment =
-      convertRawProp(rawProps, "alignment", defaultTextAttributes.alignment);
+      convertRawProp(rawProps, "textAlign", defaultTextAttributes.alignment);
   textAttributes.baseWritingDirection = convertRawProp(
       rawProps,
       "baseWritingDirection",


BasicGeometryGenerator - Cylinder, Plane에서 Object가 생서되지 않던 버그 수정

--- SOCEngine/SOCEngine/Rendering/Mesh/BasicGeometryGenerator.cpp
+++ SOCEngine/SOCEngine/Rendering/Mesh/BasicGeometryGenerator.cpp
@@ -584,7 +584,7 @@
 	Object* object = nullptr;
 	auto CreateObject = [&](const Mesh::CreateFuncArguments& args)
 	{
-		Object* object = new Object("Cylinder");
+		object = new Object("Cylinder");
 		object->AddComponent<Mesh>()->Initialize(args);
 	};

@@ -597,7 +597,7 @@
 	Object* object = nullptr;
 	auto CreateObject = [&](const Mesh::CreateFuncArguments& args)
 	{
-		Object* object = new Object("plane");
+		object = new Object("plane");
 		object->AddComponent<Mesh>()->Initialize(args);
 	};


backport timezone detection fix
CCBUG: 119993

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

--- korganizer/koprefs.cpp
+++ korganizer/koprefs.cpp
@@ -47,6 +47,7 @@
 #include <libkpimidentities/identity.h>
 #include <libemailfunctions/email.h>
 #include <kabc/stdaddressbook.h>
+#include <ktimezones.h>
 #include "kocore.h"

 KOPrefs *KOPrefs::mInstance = 0;
@@ -146,18 +147,9 @@
 {
   QString zone;

-  char zonefilebuf[100];
-  int len = readlink("/etc/localtime",zonefilebuf,100);
-  if (len > 0 && len < 100) {
-    zonefilebuf[len] = '\0';
-    zone = zonefilebuf;
-    zone = zone.mid(zone.find("zoneinfo/") + 9);
-  } else {
-    tzset();
-    zone = tzname[0];
-  }
-
-  kdDebug () << "----- time zone: " << zone << endl;
+  zone = KTimezones().local()->name();
+
+  kdDebug() << "----- time zone: " << zone << endl;

   mTimeZoneId = zone;
 }


After egg's review.

After egg's review.

--- ksp_plugin/pile_up.hpp
+++ ksp_plugin/pile_up.hpp
@@ -32,7 +32,7 @@

 // A |PileUp| handles a connected component of the graph of |Vessels| under
 // physical contact.  It advances the history and prolongation of its component
-// |Vessels|, modeling them as massless bodies at their centre of mass.
+// |Vessels|, modeling them as a massless body at their centre of mass.
 class PileUp final {
  public:
   explicit PileUp(std::list<not_null<Vessel*>>&& vessels);


Bugfix for CalculationFinished in mean and plusminus modifier

--- himan-lib/source/modifier.cpp
+++ himan-lib/source/modifier.cpp
@@ -587,7 +587,7 @@

 	double val = itsResult[i];

-		if (!IsMissingValue(val))
+		if (!IsMissingValue(val) && itsRange[i] > 0.0)
 		{
 			itsResult[i] = val / itsRange[i];
 		}
@@ -598,17 +598,27 @@

 bool modifier_mean::CalculationFinished() const
 {
+
+	if (itsResult.size() == 0)
+	{
+		return false;
+	}
+
 	if (itsResult.size() > 0 && static_cast<size_t> (count(itsOutOfBoundHeights.begin(), itsOutOfBoundHeights.end(), true)) == itsResult.size())
 	{
 		return true;
 	}
-
-	if (itsPreviousHeight > itsUpperHeight)
-	{
-		return true;
-	}
-
-	return false;
+
+
+	for (size_t i=0; i<itsResult.size(); ++i)
+	{
+		if (itsUpperHeight[i] > itsPreviousHeight[i])
+		{
+			return false;
+		}
+	}
+
+	return true;

 }

@@ -1224,6 +1234,7 @@

 void modifier_plusminusarea::Calculate(double theValue, double theHeight)
 {
+	theValue-=273.15;
 	double lowerHeight = -1e38;

 	if (!itsLowerHeight.empty())
@@ -1341,17 +1352,26 @@

 bool modifier_plusminusarea::CalculationFinished() const
 {
+
+    if (itsResult.size() == 0)
+	{
+		return false;
+	}
+
 	if (itsMinusArea.size() > 0 && static_cast<size_t> (count(itsOutOfBoundHeights.begin(), itsOutOfBoundHeights.end(), true)) == itsMinusArea.size())
 	{
 		return true;
 	}
-
-	if (itsPreviousHeight > itsUpperHeight)
-	{
-		return true;
-	}
-
-	return false;
+
+    for (size_t i=0; i<itsResult.size(); ++i)
+    {
+        if (itsUpperHeight[i] > itsPreviousHeight[i])
+        {
+            return false;
+        }
+    }
+
+    return true;
 }

 const std::vector<double>& modifier_plusminusarea::Result() const


Add break;

Add break;

--- himan-plugins/source/grib.cpp
+++ himan-plugins/source/grib.cpp
@@ -2091,6 +2091,7 @@
 			// snow pellet
 			case 7:
 				val = 13;
+				break;
 			// ice pellet
 			case 8:
 				break;


Specify forecast type for hitool

Specify forecast type for hitool

--- himan-plugins/source/gust.cpp
+++ himan-plugins/source/gust.cpp
@@ -77,7 +77,7 @@
 };

 void DeltaT(shared_ptr<const plugin_configuration> conf, info_t T_lowestLevel, const forecast_time& ftime,
-            size_t gridSize, deltaT& dT);
+            const forecast_type& ftype, size_t gridSize, deltaT& dT);
 void DeltaTot(deltaTot& dTot, info_t T_lowestLevel, size_t gridSize);
 void IntT(intT& iT, const deltaT& dT, size_t gridSize);
 void IntTot(intTot& iTot, const deltaTot& dTot, size_t gridSize);
@@ -195,7 +195,7 @@
 	deltaT dT;
 	vector<double> lowAndMiddleClouds(gridSize, kFloatMissing);

-	boost::thread t(&DeltaT, itsConfiguration, T_LowestLevelInfo, forecastTime, gridSize, boost::ref(dT));
+	boost::thread t(&DeltaT, itsConfiguration, T_LowestLevelInfo, forecastTime, forecastType, gridSize, boost::ref(dT));
 	boost::thread t2(&LowAndMiddleClouds, boost::ref(lowAndMiddleClouds), LCloudInfo, MCloudInfo, HCloudInfo,
 	                 TCloudInfo);

@@ -232,6 +232,7 @@

 	h->Configuration(itsConfiguration);
 	h->Time(forecastTime);
+	h->ForecastType(forecastType);

 	vector<double> maxEstimate;
 	try
@@ -506,12 +507,13 @@
 }

 void DeltaT(shared_ptr<const plugin_configuration> conf, info_t T_lowestLevel, const forecast_time& ftime,
-            size_t gridSize, deltaT& dT)
+            const forecast_type& ftype, size_t gridSize, deltaT& dT)
 {
 	auto h = GET_PLUGIN(hitool);

 	h->Configuration(conf);
 	h->Time(ftime);
+	h->ForecastType(ftype);

 	const param TParam("T-K");


[HIPIFY] -no-output support.

[HIPIFY] -no-output support.

Actually output file is created by clang itself, but isn't updated and is deleted after processing.
In cooperation with -print-stat -no-output (or single -n) is used for examine the source CUDA code.

Conflicting options:
-inplce
-o

--- hipify-clang/src/Cuda2Hip.cpp
+++ hipify-clang/src/Cuda2Hip.cpp
@@ -2107,6 +2107,16 @@
   if (N) {
     NoOutput = PrintStats = true;
   }
+  if (NoOutput) {
+    if (Inplace) {
+      llvm::errs() << "Conflict: both -no-output and -inplace options are specified.\n";
+      return 1;
+    }
+    if (!dst.empty()) {
+      llvm::errs() << "Conflict: both -no-output and -o options are specified.\n";
+      return 1;
+    }
+  }
   if (dst.empty()) {
     dst = fileSources[0];
     if (!Inplace) {
@@ -2120,6 +2130,7 @@
   } else {
     if (Inplace) {
       llvm::errs() << "Conflict: both -o and -inplace options are specified.\n";
+      return 1;
     }
     dst += ".hip";
   }
@@ -2167,15 +2178,18 @@
   if (!Tool.applyAllReplacements(Rewrite)) {
     DEBUG(dbgs() << "Skipped some replacements.\n");
   }
-
-  Result = Rewrite.overwriteChangedFiles();
-
-  if (!Inplace) {
+  if (!NoOutput) {
+    Result = Rewrite.overwriteChangedFiles();
+  }
+  if (!Inplace && !NoOutput) {
     size_t pos = dst.rfind(".");
     if (pos != std::string::npos) {
       rename(dst.c_str(), dst.substr(0, pos).c_str());
     }
   }
+  if (NoOutput) {
+    remove(dst.c_str());
+  }
   if (PrintStats) {
     printStats(fileSources[0], PPCallbacks, Callback);
   }


test3

--- projects/Direct2dTemplate/Direct2dTemplate/MainFrame.cpp
+++ projects/Direct2dTemplate/Direct2dTemplate/MainFrame.cpp
@@ -1,5 +1,5 @@
 // Direct2dTemplate.cpp : AvP[ṼGg |Cg`܂B
-//
+//

 #include "stdafx.h"
 #include "Direct2dTemplate.h"


issue #195: added SYS_SAVE() function to save files

--- lib/V8/v8-utils.cpp
+++ lib/V8/v8-utils.cpp
@@ -876,7 +876,7 @@
 ///
 /// @FUN{internal.read(@FA{filename})}
 ///
-/// Reads in a files and returns the content as string.
+/// Reads in a file and returns the content as string.
 ////////////////////////////////////////////////////////////////////////////////

 static v8::Handle<v8::Value> JS_Read (v8::Arguments const& argv) {
@@ -903,6 +903,45 @@
   TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, content);

   return scope.Close(result);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief writes to a file
+///
+/// @FUN{internal.save(@FA{filename})}
+///
+/// Writes the content into a file.
+////////////////////////////////////////////////////////////////////////////////
+
+static v8::Handle<v8::Value> JS_Save (v8::Arguments const& argv) {
+  v8::HandleScope scope;
+
+  if (argv.Length() != 2) {
+    return scope.Close(v8::ThrowException(v8::String::New("usage: save(<filename>, <content>)")));
+  }
+
+  v8::String::Utf8Value name(argv[0]);
+
+  if (*name == 0) {
+    return scope.Close(v8::ThrowException(v8::String::New("<filename> must be a string")));
+  }
+
+  v8::String::Utf8Value content(argv[1]);
+
+  if (*content == 0) {
+    return scope.Close(v8::ThrowException(v8::String::New("<content> must be a string")));
+  }
+
+  ofstream file;
+
+  file.open(*name, ios::out | ios::binary);
+  if (file.is_open()) {
+    file << *content;
+    file.close();
+    return scope.Close(v8::True());
+  }
+
+  return scope.Close(v8::ThrowException(v8::String::New("cannot write to file")));
 }

 ////////////////////////////////////////////////////////////////////////////////
@@ -1528,6 +1567,10 @@
                          v8::FunctionTemplate::New(JS_Read)->GetFunction(),
                          v8::ReadOnly);

+  context->Global()->Set(v8::String::New("SYS_SAVE"),
+                         v8::FunctionTemplate::New(JS_Save)->GetFunction(),
+                         v8::ReadOnly);
+
   context->Global()->Set(v8::String::New("SYS_SHA256"),
                          v8::FunctionTemplate::New(JS_Sha256)->GetFunction(),
                          v8::ReadOnly);


Fixing bug with locale and language

Fixing bug with locale and language

--- Source/CSBackend/Platform/RPi/Core/Base/SystemInfoFactory.cpp
+++ Source/CSBackend/Platform/RPi/Core/Base/SystemInfoFactory.cpp
@@ -78,9 +78,9 @@
             utsname info;
             uname(&info);

-            std::string osVersion(info.version);
+            std::string osVersion(info.release);
             std::string machineType(info.machine);
-            std::locale globalLocale; //Creating with the default constructor will set it to the global locale
+            std::locale globalLocale(""); //Creating with the empty string will set it to the global locale

             ChilliSource::DeviceInfo deviceInfo(k_deviceModel, machineType, k_deviceManufacturer, k_deviceUdid, globalLocale.name(), ParseLanguageFromLocale(globalLocale.name()), osVersion, get_nprocs());


reverting coverity fix on Axel's suggestion

--- hist/hist/src/TFormula_v5.cxx
+++ hist/hist/src/TFormula_v5.cxx
@@ -2686,7 +2686,7 @@
 {
    Int_t i,j;
    // coverity[uninit] the tab value of tab is guaranteed to be set properly by the control flow.
-   Double_t tab[kMAXFOUND] = {0};
+   Double_t tab[kMAXFOUND];
    const char *stringStack[gMAXSTRINGFOUND] = {0};
    Double_t param_calc[kMAXFOUND];
    char *string_calc[gMAXSTRINGFOUND] = {0};


update for recent api changes.  I have a hard time believing that this is actually a useful example.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@135374 91177308-0d34-0410-b5e6-96231b3b80d8

--- examples/BrainF/BrainF.cpp
+++ examples/BrainF/BrainF.cpp
@@ -80,8 +80,8 @@
   //%arr = malloc i8, i32 %d
   ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal));
   BasicBlock* BB = builder->GetInsertBlock();
-  const Type* IntPtrTy = IntegerType::getInt32Ty(C);
-  const Type* Int8Ty = IntegerType::getInt8Ty(C);
+  Type* IntPtrTy = IntegerType::getInt32Ty(C);
+  Type* Int8Ty = IntegerType::getInt8Ty(C);
   Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty);
   allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
   ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, val_mem,


Added a trace to ZIOP perform_compression about ratio

git-svn-id: 021028fd378944f3b1a2367ba97e5515d7af6ffb@1344 819ff99d-f73b-0410-b8ac-dab01f8602e2

--- TIDorb/source/TIDorbC/orb/TIDorb/core/comm/ziop/ZIOPMessage.C
+++ TIDorb/source/TIDorbC/orb/TIDorb/core/comm/ziop/ZIOPMessage.C
@@ -38,6 +38,7 @@

 #include "TIDorb/core/comm/ziop/ZIOPMessage.h"

+#include <iomanip>

 namespace TIDorb {
 namespace core {
@@ -141,8 +142,8 @@
   message_buffer_out->write_ulong(source_length);

   // Check min ratio
-  //if ((100 - (((float)compressed.length() / (float)source.length())*100)) < min_ratio)
-  if ( ((float)compressed.length() / (float)source.length()) < min_ratio)
+  float ratio = 1 - ((float)compressed.length() / (float)source.length());
+  if ( ratio < min_ratio)
     return false;

   message_buffer_out->write_octet_array(compressed.get_buffer(), 0 , compressed.length());
@@ -155,6 +156,7 @@
     msg << " from " << source.length() << " bytes ";
     msg << " to " << compressed.length() << " bytes ";
     msg << "using compressor " << compressor.compressor_id;
+    msg << " achieving ratio " << setprecision(4) << ratio*100 << " %";
     orb->print_trace(TIDorb::util::TR_USER, msg.str().data());
   }


MIPS: Fix simplification of DoLoadNamedFieldPolymorphic.  This is a commit of https://chromiumcodereview.appspot.com/10391096/ for Akos Palfi

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

--- src/mips/lithium-codegen-mips.cc
+++ src/mips/lithium-codegen-mips.cc
@@ -2343,6 +2343,7 @@
   Register object = ToRegister(instr->object());
   Register result = ToRegister(instr->result());
   Register scratch = scratch0();
+
   int map_count = instr->hydrogen()->types()->length();
   bool need_generic = instr->hydrogen()->need_generic();

@@ -2357,8 +2358,8 @@
     bool last = (i == map_count - 1);
     Handle<Map> map = instr->hydrogen()->types()->at(i);
     if (last && !need_generic) {
-      Handle<Map> map = instr->hydrogen()->types()->last();
       DeoptimizeIf(ne, instr->environment(), scratch, Operand(map));
+      EmitLoadFieldOrConstantFunction(result, object, map, name);
     } else {
       Label next;
       __ Branch(&next, ne, scratch, Operand(map));


more comments for lars

more comments for lars

--- src/mlpack/methods/lars/lars.hpp
+++ src/mlpack/methods/lars/lars.hpp
@@ -139,8 +139,11 @@
    */
   const arma::mat MatUtriCholFactor();

-  /*
-   * Do LARS
+  /* Run LARS
+   *
+   * @param matX Input data into the algorithm - a matrix where each row is a
+   *    point and each column is a dimension
+   * @param y A vector of targets
    */
   void DoLARS(const arma::mat& matX, const arma::vec& y);


Use size_t types for output size_t.

Use size_t types for output size_t.

--- layers/mem_tracker.cpp
+++ layers/mem_tracker.cpp
@@ -1639,8 +1639,8 @@
                     "%s: Flush/Invalidate offset (" PRINTF_SIZE_T_SPECIFIER
                     ") is less than Memory Object's offset "
                     "(" PRINTF_SIZE_T_SPECIFIER ").",
-                    funcName, pMemRanges[i].offset,
-                    mem_element->second.memRange.offset);
+                    funcName, static_cast<size_t>(pMemRanges[i].offset),
+                    static_cast<size_t>(mem_element->second.memRange.offset));
             }
             if ((mem_element->second.memRange.size != VK_WHOLE_SIZE) &&
                 ((mem_element->second.memRange.offset +
@@ -1654,9 +1654,10 @@
                     "%s: Flush/Invalidate upper-bound (" PRINTF_SIZE_T_SPECIFIER
                     ") exceeds the Memory Object's upper-bound "
                     "(" PRINTF_SIZE_T_SPECIFIER ").",
-                    funcName, pMemRanges[i].offset + pMemRanges[i].size,
-                    mem_element->second.memRange.offset +
-                        mem_element->second.memRange.size);
+                    funcName, static_cast<size_t>(pMemRanges[i].offset +
+                                                  pMemRanges[i].size),
+                    static_cast<size_t>(mem_element->second.memRange.offset +
+                                        mem_element->second.memRange.size));
             }
         }
     }


Fix closing parenthesis.

Fix closing parenthesis.

--- src/mlpack/tests/allknn_test.cpp
+++ src/mlpack/tests/allknn_test.cpp
@@ -306,7 +306,7 @@
   for (size_t i = 0; i < moveDistances.n_elem; ++i)
   {
     BOOST_REQUIRE_EQUAL(moveNeighbors[i], neighbors[i]);
-    if (std::abs(distances[i] < 1e-5))
+    if (std::abs(distances[i]) < 1e-5)
       BOOST_REQUIRE_SMALL(moveDistances[i], 1e-5);
     else
       BOOST_REQUIRE_CLOSE(moveDistances[i], distances[i], 1e-5);


Testcases for YIELDDISC

Testcases for YIELDDISC

Signed-off-by: I-Jui (Ray) Sung <7f525154e857f3d57a641a83dddc584f42addc6a@multicorewareinc.com>

--- sc/qa/unit/opencl-test.cxx
+++ sc/qa/unit/opencl-test.cxx
@@ -351,6 +351,13 @@
         double fExcel = pDocRes->GetValue(ScAddress(7,i,11));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
+        //[AMLOEXT-33]
+    for (SCROW i = 1; i <= 10; ++i)
+    {
+        double fLibre = pDoc->GetValue(ScAddress(5,i,12));
+        double fExcel = pDocRes->GetValue(ScAddress(5,i,12));
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+    }
     xDocSh->DoClose();
     xDocShRes->DoClose();
 }


Add better logging on authz helper return failures

--- cvmfs/authz/authz_fetch.cc
+++ cvmfs/authz/authz_fetch.cc
@@ -459,7 +459,26 @@
       // freeing the memory
       binary_msg->permit.token.data = smalloc(size);
       memcpy(binary_msg->permit.token.data, json_token->string_value, size);
+
+      LogCvmfs(kLogAuthz, kLogDebug,
+               "Got a bearer_token from authz_helper.  Setting token type to kTokenBearer");
+
     }
+    else
+    {
+      // We got a bearer_token, but a size 0 (or negative?) string
+      LogCvmfs(kLogAuthz, kLogSyslogErr | kLogDebug,
+               "bearer_token was in returned JSON from Authz helper, but of size 0 from authz helper %s",
+               progname_.c_str());
+    }
+  }
+
+  if (binary_msg->permit.token.type == kTokenUnknown) {
+    // No auth token returned, so authz should do... what exactly?
+    // Log error message
+    LogCvmfs(kLogAuthz, kLogSyslogErr | kLogDebug,
+               "No auth token found in returned JSON from Authz helper %s",
+               progname_.c_str());
   }

   return true;


KUDU-599. Add kudu-lint check to catch calls to sleep, usleep, nanosleep.

Change-Id: Ifb69fdb5cac4afd5aed72ee565e136b0541e2081
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5862
Reviewed-by: Adar Dembo <866ca730bfc7f544e3ebce604ceeba4879f23df0@cloudera.com>
Tested-by: jenkins

--- build-support/tools/kudu-lint/kudu-lint.cc
+++ build-support/tools/kudu-lint/kudu-lint.cc
@@ -231,8 +231,18 @@
     .bind("decl");
   ErrorPrinter<Decl> ref_member_printer("Reference-typed member", "decl", true);

+  // Disallow calls to sleep, usleep, and nanosleep.
+  // SleepFor(MonoDelta) should be used instead, as it is not prone to
+  // unit conversion errors, and also ignores EINTR so will safely sleep
+  // at least the requested duration.
+  StatementMatcher sleep_matcher =
+    callExpr(callee(namedDecl(matchesName("(nano|u)?sleep")))).bind("sleep_expr");
+  ErrorPrinter<Stmt> sleep_printer("sleep, usleep or nanosleep call", "sleep_expr", true);
+
   MatchFinder finder;
   finder.addMatcher(ignored_status_matcher, &ignored_status_printer);
   finder.addMatcher(ref_member_matcher, &ref_member_printer);
+  finder.addMatcher(sleep_matcher, &sleep_printer);
+
   return Tool.run(newFrontendActionFactory(&finder));
 }


Add IRIX support.

Add IRIX support.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@4610 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/image_processing/computed_field_sigmoidImageFilter.cpp
+++ source/image_processing/computed_field_sigmoidImageFilter.cpp
@@ -272,10 +272,14 @@
 Create the computed_field representation of the SigmoidImageFilter.
 ==============================================================================*/
 {
+#if defined DONOTUSE_TEMPLATETEMPLATES
+	create_filters_singlecomponent_multidimensions(
+		Computed_field_sigmoidImageFilter_Functor, this);
+#else
 	create_filters_singlecomponent_multidimensions
 		< Computed_field_sigmoidImageFilter_Functor, Computed_field_sigmoidImageFilter >
 		(this);
-
+#endif
 }

 } //namespace


- forgot to check this in for the previous fix

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@8791 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- WebCore/khtml/rendering/render_text.cpp
+++ WebCore/khtml/rendering/render_text.cpp
@@ -1023,7 +1023,7 @@
     int left;
     if (box->m_reversed) {
 	long len = box->m_start+box->m_len-offset;
-	QString string(str->s + box->m_start+offset,len);
+	QString string(str->s +offset,len);
 	left = box->m_x + fm.boundingRect(string,len).right();
     } else {
 	long len = offset - box->m_start; // the number of characters we are into the string


Simplify userdata being passed to checkServerIdentity callback.

--- packages/grpc-native-core/ext/channel_credentials.cc
+++ packages/grpc-native-core/ext/channel_credentials.cc
@@ -60,14 +60,10 @@
   grpc_channel_credentials_release(wrapped_credentials);
 }

-struct callback_md {
-    Nan::Callback *callback;
-};
-
 static int verify_peer_callback_wrapper(const char* servername, const char* cert, void* userdata) {
   Nan::HandleScope scope;
   Nan::TryCatch try_catch;
-  struct callback_md* md = (struct callback_md*)userdata;
+  Nan::Callback *callback = (Nan::Callback*)userdata;

   const unsigned argc = 2;
   Local<Value> argv[argc];
@@ -82,7 +78,7 @@
     argv[1] = Nan::New<v8::String>(cert).ToLocalChecked();
   }

-  md->callback->Call(argc, argv);
+  callback->Call(argc, argv);

   if (try_catch.HasCaught()) {
     return 1;
@@ -92,9 +88,8 @@
 }

 static void verify_peer_callback_destruct(void *userdata) {
-  callback_md *md = (callback_md*)userdata;
-  delete md->callback;
-  delete md;
+  Nan::Callback *callback = (Nan::Callback*)userdata;
+  delete callback;
 }

 void ChannelCredentials::Init(Local<Object> exports) {
@@ -211,10 +206,9 @@
             if (!value->IsFunction()) {
                 return Nan::ThrowError("Value of checkServerIdentity must be a function.");
             }
-            struct callback_md *md = new struct callback_md;
-            md->callback = new Callback(Local<Function>::Cast(value));
+            Nan::Callback *callback = new Callback(Local<Function>::Cast(value));
             verify_options.verify_peer_callback = verify_peer_callback_wrapper;
-            verify_options.verify_peer_callback_userdata = (void*)md;
+            verify_options.verify_peer_callback_userdata = (void*)callback;
             verify_options.verify_peer_destruct = verify_peer_callback_destruct;

           }


Refactor: generalise directory cleaning

Refactor: generalise directory cleaning

--- cvmfs/cvmfs_suid_helper.cc
+++ cvmfs/cvmfs_suid_helper.cc
@@ -104,58 +104,99 @@
   ExecAsRoot("/bin/kill", "-9", pid.c_str(), NULL);
 }

-static bool ClearWorkingDir() {
-  int retval;
-  DIR *dirp = opendir(".");
-  if (dirp == NULL)
-    return false;
-  platform_dirent64 *dirent;
-  while ((dirent = platform_readdir(dirp)) != NULL) {
-    if ((strcmp(dirent->d_name, ".") == 0) ||
-        (strcmp(dirent->d_name, "..") == 0))
-    {
-      continue;
+class ScopedWorkingDirectory {
+ public:
+  ScopedWorkingDirectory(const string &path)
+    : previous_path_(GetCurrentWorkingDirectory())
+    , directory_handle_(NULL)
+  {
+    ChangeDirectory(path);
+    directory_handle_ = opendir(".");
+  }
+
+  ~ScopedWorkingDirectory() {
+    if (directory_handle_ != NULL) {
+      closedir(directory_handle_);
     }
-
-    platform_stat64 info;
-    retval = platform_lstat(dirent->d_name, &info);
-    if (retval != 0) {
-      closedir(dirp);
+    ChangeDirectory(previous_path_);
+  }
+
+  operator bool() const { return directory_handle_ != NULL; }
+
+  struct DirectoryEntry {
+    bool   is_directory;
+    string name;
+  };
+
+  bool NextDirectoryEntry(DirectoryEntry *entry) {
+    platform_dirent64 *dirent;
+    while ((dirent = platform_readdir(directory_handle_)) != NULL &&
+           IsMetaEntry(dirent));
+    if (dirent == NULL) {
       return false;
     }

-    if (S_ISDIR(info.st_mode)) {
-      // Recursion
-      retval = chdir(dirent->d_name);
-      if (retval != 0) {
-        closedir(dirp);
-        return false;
-      }
-      retval = ClearWorkingDir();
-      if (!retval) {
-        closedir(dirp);
-        return false;
-      }
-      retval = chdir("..");
-      if (retval != 0) {
-        closedir(dirp);
-        return false;
-      }
-      retval = rmdir(dirent->d_name);
-      if (retval != 0) {
-        closedir(dirp);
-        return false;
-      }
-    } else {
-      retval = unlink(dirent->d_name);
-      if (retval != 0) {
-        closedir(dirp);
-        return false;
-      }
+    platform_stat64 info;
+    if (platform_lstat(dirent->d_name, &info) != 0) {
+      return false;
     }
-  }
-  closedir(dirp);
-  return true;
+
+    entry->is_directory = S_ISDIR(info.st_mode);
+    entry->name         = dirent->d_name;
+    return true;
+  }
+
+ protected:
+  string GetCurrentWorkingDirectory() {
+    char path[PATH_MAX];
+    const char* cwd = getcwd(path, PATH_MAX);
+    assert(cwd == path);
+    return string(cwd);
+  }
+
+  void ChangeDirectory(const string &path) {
+    const int retval = chdir(path.c_str());
+    assert(retval == 0);
+  }
+
+  bool IsMetaEntry(const platform_dirent64 *dirent) {
+    return (strcmp(dirent->d_name, ".")  == 0) ||
+           (strcmp(dirent->d_name, "..") == 0);
+  }
+
+ private:
+  const string  previous_path_;
+        DIR    *directory_handle_;
+};
+
+static bool ClearDirectory(const string &path) {
+  ScopedWorkingDirectory swd(path);
+  if (!swd) {
+    return false;
+  }
+
+  bool success = true;
+  ScopedWorkingDirectory::DirectoryEntry dirent;
+  while (success && swd.NextDirectoryEntry(&dirent)) {
+    success = (dirent.is_directory)
+      ? ClearDirectory(dirent.name) && (rmdir(dirent.name.c_str()) == 0)
+      : (unlink(dirent.name.c_str()) == 0);
+  }
+
+  return success;
+}
+
+static int CleanupDirectory(const string &path) {
+  if (!ClearDirectory(path)) {
+    fprintf(stderr, "failed to clear %s\n", path.c_str());
+    return 1;
+  }
+  return 0;
+}
+
+static int DoSynchronousScratchCleanup(const string &fqrn) {
+  const string scratch = string(kSpoolArea) + "/" + fqrn + "/scratch/current";
+  return CleanupDirectory(scratch);
 }

 static void Usage(const string &exe, FILE *output) {
@@ -223,17 +264,7 @@
   } else if (command == "rdonly_lazy_umount") {
     LazyUmount(string(kSpoolArea) + "/" + fqrn + "/rdonly");
   } else if (command == "clear_scratch") {
-    const string scratch_area = string(kSpoolArea) + "/" + fqrn + "/scratch";
-    retval = chdir(scratch_area.c_str());
-    if (retval != 0) {
-      fprintf(stderr, "failed to chdir to %s\n", scratch_area.c_str());
-      return 1;
-    }
-    retval = ClearWorkingDir();
-    if (!retval) {
-      fprintf(stderr, "failed to clear %s\n", scratch_area.c_str());
-      return 1;
-    }
+    return DoSynchronousScratchCleanup(fqrn);
   } else {
     Usage(argv[0], stderr);
     return 1;


Revert previous commit which was by accident

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

--- base/metrics/histogram.cc
+++ base/metrics/histogram.cc
@@ -614,6 +614,7 @@
        ++it) {
     total += *it;
   }
+  DCHECK_EQ(total, redundant_count_);
   return total;
 }


model based segmentation tests

model based segmentation tests

--- source/FAST/Algorithms/ModelBasedSegmentation/Tests.cpp
+++ source/FAST/Algorithms/ModelBasedSegmentation/Tests.cpp
@@ -1,4 +1,6 @@
 #include <FAST/Visualization/LineRenderer/LineRenderer.hpp>
+#include <FAST/Exporters/VTKMeshFileExporter.hpp>
+#include <FAST/Exporters/MetaImageExporter.hpp>
 #include "FAST/Testing.hpp"
 #include "FAST/Streamers/ImageFileStreamer.hpp"
 #include "KalmanFilter.hpp"
@@ -16,15 +18,12 @@
 #include "FAST/Algorithms/SurfaceExtraction/SurfaceExtraction.hpp"

 using namespace fast;
-
 /*
 TEST_CASE("Model based segmentation with mean value coordinates on 3D cardiac US data", "[fast][ModelBasedSegmentation][cardiac][3d][visual]") {
-	ImageFileStreamer::pointer streamer = ImageFileStreamer::New();
-	streamer->setFilenameFormat("/media/extra/CETUS/Patient1/Patient1_frame#.mhd");
-	streamer->setZeroFilling(2);
-	streamer->setStartNumber(1);
-	streamer->enableLooping();
-	streamer->setStreamingMode(STREAMING_MODE_PROCESS_ALL_FRAMES);
+    bool visualize = false;
+	ImageFileStreamer::pointer streamer = ImageFileStreamer::New();
+	streamer->setFilenameFormat("/home/smistad/data/volume_bmode_new/image_#.mhd");
+	//streamer->enableLooping();
 	//streamer->setSleepTime(2000);

 	MeanValueCoordinatesModel::pointer shapeModel = MeanValueCoordinatesModel::New();
@@ -42,32 +41,43 @@
 	segmentation->setShapeModel(shapeModel);
 	segmentation->setInputConnection(streamer->getOutputPort());

-
 	MeshToSegmentation::pointer meshToSeg = MeshToSegmentation::New();
 	meshToSeg->setInputConnection(0, segmentation->getOutputPort());
 	meshToSeg->setInputConnection(1, streamer->getOutputPort());

-	SurfaceExtraction::pointer extraction = SurfaceExtraction::New();
-	extraction->setInputConnection(meshToSeg->getOutputPort());
-
-	TriangleRenderer::pointer TriangleRenderer = TriangleRenderer::New();
-	TriangleRenderer->setInputConnection(segmentation->getOutputPort());
-	TriangleRenderer->setDefaultOpacity(0.5);
-
-	SliceRenderer::pointer sliceRenderer = SliceRenderer::New();
-	sliceRenderer->setInputConnection(streamer->getOutputPort());
-	sliceRenderer->setSlicePlane(PLANE_Y);
-	SliceRenderer::pointer sliceRenderer2 = SliceRenderer::New();
-	sliceRenderer2->setInputConnection(streamer->getOutputPort());
-	sliceRenderer2->setSlicePlane(PLANE_X);
-
-	SimpleWindow::pointer window = SimpleWindow::New();
-	window->addRenderer(sliceRenderer);
-	window->addRenderer(sliceRenderer2);
-	window->addRenderer(TriangleRenderer);
-	window->start();
-}
-
+	if(!visualize) {
+		MetaImageExporter::pointer exporter2 = MetaImageExporter::New();
+		exporter2->setInputConnection(meshToSeg->getOutputPort());
+		VTKMeshFileExporter::pointer exporter = VTKMeshFileExporter::New();
+		exporter->setInputConnection(segmentation->getOutputPort());
+		exporter->setWriteNormals(true);
+		for (int i = 0; i < streamer->getNrOfFrames(); ++i) {
+			exporter->setFilename(
+					"/home/smistad/data/volume_bmode_new/segmentations/frame_" + std::to_string(i) + ".vtk");
+			exporter->update(i, STREAMING_MODE_PROCESS_ALL_FRAMES);
+			exporter2->setFilename(
+					"/home/smistad/data/volume_bmode_new/segmentations/frame_" + std::to_string(i) + ".mhd");
+			exporter2->update(i, STREAMING_MODE_PROCESS_ALL_FRAMES);
+		}
+	} else {
+		TriangleRenderer::pointer TriangleRenderer = TriangleRenderer::New();
+		TriangleRenderer->setInputConnection(segmentation->getOutputPort());
+		TriangleRenderer->setDefaultOpacity(0.5);
+
+		SliceRenderer::pointer sliceRenderer = SliceRenderer::New();
+		sliceRenderer->addInputConnection(streamer->getOutputPort(), PLANE_X);
+		sliceRenderer->addInputConnection(streamer->getOutputPort(), PLANE_Y);
+
+
+		SimpleWindow::pointer window = SimpleWindow::New();
+		window->addRenderer(sliceRenderer);
+		window->addRenderer(TriangleRenderer);
+		window->start();
+	}
+}
+*/
+
+/*
 TEST_CASE("Model based segmentation with spline model on 2D pediatric cardiac US data", "[fast][ModelBasedSegmentation][2d][cardiac][pediatric][visual]") {
 	ImageFileStreamer::pointer streamer = ImageFileStreamer::New();
 	streamer->setFilenameFormat("/home/smistad/Cardiac_2D/test3/labelImage#.mhd");


Enhance bubble_sorter with readable error messages.

--- examples/bubble_sorter.cpp
+++ examples/bubble_sorter.cpp
@@ -78,9 +78,16 @@
                         StrictWeakOrdering compare={}, Projection projection={}) const
             -> void
         {
+            static_assert(
+                std::is_base_of<
+                    std::forward_iterator_tag,
+                    typename std::iterator_traits<ForwardIterator>::iterator_category
+                >::value,
+                "bubble_sorter requires at least forward iterators"
+            );
+
             bubble_sort(first,
-                        compare,
-                        projection,
+                        compare, projection,
                         std::distance(first, last));
         }

@@ -97,9 +104,16 @@
                         Projection projection={}) const
             -> void
         {
+            static_assert(
+                std::is_base_of<
+                    std::forward_iterator_tag,
+                    typename std::iterator_traits<decltype(std::begin(iterable))>::iterator_category
+                >::value,
+                "bubble_sorter requires at least forward iterators"
+            );
+
             bubble_sort(std::begin(iterable),
-                        compare,
-                        projection,
+                        compare, projection,
                         cppsort::utility::size(iterable));
         }
     };


still not working, it seems that constraint is not checked againts newly changed

--- scheduler/src/scipUser.cpp
+++ scheduler/src/scipUser.cpp
@@ -171,19 +171,20 @@
   ));

   SCIP_CALL( SCIPaddCons(scip, conj) );
+  SCIP_CALL( SCIPreleaseCons(scip, &con));
+  SCIP_CALL( SCIPreleaseCons(scip, &con2));
+
+  SCIP_CALL(SCIPprintCons(scip,	conj, NULL));
+  cout << "\n";
   t_con->at(i) = conj;

-  /*
-  delete ti;
-  ti = NULL;
+
   delete con;
   con = NULL;
   delete con2;
   con2 = NULL;
-  delete vars0;
-  vars = NULL;
-  delete conj;
-  conj = NULL;*/
+
+

   return SCIP_OKAY;
 }
@@ -398,8 +399,16 @@
   }

   //everything went successful, we can delete original constraint and create a new one
+  SCIP_CALL(SCIPsetConsChecked(scip,t_con->at(j),FALSE));
   SCIP_CALL(SCIPdelCons(scip, t_con->at(j)));
   t_con->at(j) = NULL;
+
+  char con_name[255];
+  SCIPsnprintf(con_name, 255, "junse_%d", j);
+  SCIP_CONS * conx = SCIPfindCons(scip, con_name);
+  if (conx == NULL)
+   cout << "smazano\n";
+
   SCIP_CALL(setOneTcons(j, t_var, t_con, sj, xj));

   /*---------------------------------*/
@@ -412,14 +421,14 @@
     //this means, that we need to end before start, this is not feasible
     *result = 2;
     return SCIP_OKAY;
-  }
-
+  }
+
   //everything went successful, we can delete original constraint and create a new one
+  SCIP_CALL(SCIPsetConsChecked(scip,t_con->at(i),FALSE));
   SCIP_CALL(SCIPdelCons(scip, t_con->at(i)));
   t_con->at(i) = NULL;
   SCIP_CALL(setOneTcons(i, t_var, t_con, si, xi));
-
-
+
   return SCIP_OKAY;
 }

@@ -457,10 +466,22 @@
 		TRUE,//  	printreason,
 		res //  	result
     ));
+    SCIP_CALL(SCIPsetConsChecked(scip,con,FALSE));
+
+
     //we need to free solution to be able to add the constraint
+
+    int result = *res;
+
+    //delete pointers
+     delete res;
+     res = NULL;
+     delete sol;
+     sol = NULL;
+
     SCIP_CALL( SCIPfreeTransform(scip));
+

-    int result = *res;
     if(result == 4) //constrain is feasible with existing problem
     {
       SCIP_CALL( SCIPaddCons(scip, con));
@@ -468,26 +489,35 @@
     }
     else if(result == 5) //constraint violates existing problem
     {
+
       if(runs ==0) //first run
       {
-        int * resExistCons;
+
+        int * resExistCons = new int;
         *resExistCons = 0;
+cout << "ij" << i << " " << j << " " << dist << "\n";

         SCIP_CALL(editExistingTcons(i, j, t_con, t_var, tasksToS, dist, resExistCons));
         if(*resExistCons == 0)
         {
           //try to check the original constraint again, should proceed smooth
           //recursive call
+          delete resExistCons;
+          resExistCons = NULL;
           checkConstraint(con, i, j, t_con, t_var, tasksToS, dist, 1, ret_val);
+ cout << "stagex\n";
         }
         else //infeasibility occured
         {
           *ret_val = 1;
           return SCIP_OKAY;
         }
+
+
       }
       else //the constraint was changed, but still it is violated. this should not happen
       {
+
         *ret_val = 2;
         return SCIP_OKAY;
       }
@@ -496,12 +526,6 @@
     {
       *ret_val = 3;
     }
-
-    //delete pointers
-    delete res;
-    res = NULL;
-    delete sol;
-    sol = NULL;
   }
   return SCIP_OKAY;
 }
@@ -589,9 +613,12 @@
      if(type==0) //task j precedes task i
      {
        //creating a constraint tj + dj + dist - ti <= 0
+

        SCIP_Real dj = tasksToS->at(j)->getDuration();
-
+cout<<"stage11\n" << j << "\n";
+cout<<tasksToS->at(j)->getStart();
+
        if(tasksToS->at(j)->getEndPos().empty()) //if first task has no location, that the travel to following task might take maxDist;
        {
          distji = maxDist;
@@ -601,14 +628,15 @@
          distji = 0;
        }
        else
-       {
+       {
+
          distji = DistWrapper::dist(tasksToS->at(j)->getEndPos(),tasksToS->at(i)->getStartPos());
+cout<<"stage12\n";
        }
        if((tasksToS->at(j)->getEndPos().empty())&&(tasksToS->at(i)->getStartPos().empty()))
        {
          distji = 0;
        }
-

        SCIP_Real vals2[2]; //array of values
        vals2[0] = 1;
@@ -650,45 +678,16 @@

       delete result;
       result = NULL;
+
     }
     if(type==0)
     {
-      SCIP_CALL(SCIPpresolve(scip));
-      SCIP_CALL(SCIPprintStatus(scip,NULL));
-      SCIP_SOL * sol = SCIPgetBestSol(scip);
-      SCIP_RESULT * res = new SCIP_RESULT();
-      SCIP_Retcode retu = SCIPcheckCons(scip,
-		con2, //  	cons,
-		sol,//  	sol,
-		TRUE,// 	checkintegrality,
-		TRUE,//  	checklprows,
-		TRUE,//  	printreason,
-		res //  	result
-	);
-
- int a= retu;
-cout <<"return code" << a << "\n";
-
-      SCIP_CALL( SCIPfreeTransform(scip));
-      int result2 = *res;
-cout << "result" << result2 << "\n";
+      int * result = new int;
+      *result = 0;
+      SCIP_CALL(checkConstraint(con2, j, i, t_con, t_var, tasksToS, distji,0,result));

-      if((result2 == 4)||(result2==5))
-      {
-        SCIP_CALL( SCIPaddCons(scip, con2));
-        SCIP_CALL( SCIPreleaseCons(scip, &con2));
-      }
-      else
-      {
-        int temp = cin.get();
-        numinfeas++;
-      }
-
-
-      delete res;
-      res = NULL;
-      delete sol;
-      sol = NULL;
+      delete result;
+      result = NULL;

     }
     if(type==2)


Fix to .h capitalization

Fix to .h capitalization

--- JASP-Desktop/analysisforms/regressionloglinearbayesianform.cpp
+++ JASP-Desktop/analysisforms/regressionloglinearbayesianform.cpp
@@ -1,5 +1,5 @@
 #include "regressionloglinearbayesianform.h"
-#include "ui_regressionloglinearbayesianForm.h"
+#include "ui_regressionloglinearbayesianform.h"

 RegressionLogLinearBayesianForm::RegressionLogLinearBayesianForm(QWidget *parent) :
 	AnalysisForm("RegressionLogLinearBayesianForm", parent),


The dyld shared cache class table is not present in the iOS simulator, so do not actually warn to people when running under the simulator

rdar://20403987

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@234537 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
@@ -1577,6 +1578,18 @@
     if (m_noclasses_warning_emitted)
         return;

+    static ConstString g_ios_simulator("ios-simulator");
+
+    if (m_process &&
+        m_process->GetTarget().GetPlatform() &&
+        m_process->GetTarget().GetPlatform()->GetPluginName() == g_ios_simulator)
+    {
+        // the iOS simulator does not have the objc_opt_ro class table
+        // so don't actually complain to the user
+        m_noclasses_warning_emitted = true;
+        return;
+    }
+
     Debugger &debugger(GetProcess()->GetTarget().GetDebugger());

     if (debugger.GetAsyncOutputStream())


cosmetic

cosmetic

--- Library/Sources/Stroika/Foundation/Execution/ProcessRunner.cpp
+++ Library/Sources/Stroika/Foundation/Execution/ProcessRunner.cpp
@@ -229,7 +229,7 @@
     Characters::StringBuilder sb;
     sb += errorMessage;
     sb += L" '" + cmdLine + L"' failed";
-	{
+    {
         Characters::StringBuilder extraMsg;
         if (wExitStatus) {
             extraMsg += Characters::Format (L"exit status %d", int(*wExitStatus));
@@ -260,8 +260,8 @@
 {
     Characters::StringBuilder sb;
     sb += errorMessage;
-	sb += L" '" + cmdLine + L"' failed";
-	{
+    sb += L" '" + cmdLine + L"' failed";
+    {
         Characters::StringBuilder extraMsg;
         if (err) {
             extraMsg += Characters::Format (L"error: %d", int(*err));


Change cpp-config-ui.cpp for streaming with Fisheye

--- examples/cpp-config-ui.cpp
+++ examples/cpp-config-ui.cpp
@@ -5,6 +5,8 @@
 #include <thread>
 #include <iostream>
 #include <algorithm>
+#include <iomanip>
+
 #pragma comment(lib, "opengl32.lib")

 struct int2 { int x,y; };
@@ -92,6 +94,41 @@
         fill_rect(r, {0.5,0.5,0.5});
         fill_rect(dragger, {1,1,1});
         return changed;
+    }
+
+    void indicator(const rect & r, double min, double max, double value)
+    {
+        const int w = r.x1 - r.x0, h = r.y0 - r.y1;
+        double p = (w) * (value - min) / (max - min);
+        int Xdelta = 1;
+        int Ydelta = -1;
+        if (value == max)
+        {
+            int Xdelta =  0;
+            int Ydelta = -2;
+        }
+        else if (value == min)
+        {
+            int Xdelta = 2;
+            int Ydelta = 0;
+        }
+
+        const rect dragger = {int(r.x0+p+Xdelta), int(r.y0), int(r.x0+p+Ydelta), int(r.y1)};
+        fill_rect(r, {0.5,0.5,0.5});
+        fill_rect(dragger, {1,1,1});
+        glColor3f(1,1,1);
+
+        std::ostringstream oss;
+        oss << std::setprecision(2) << std::fixed << min;
+        draw_text(r.x0 - 22, r.y1 + abs(h/2) + 3, oss.str().c_str());
+
+        oss.str("");
+        oss << std::setprecision(2) << std::fixed << max;
+        draw_text(r.x1 + 6, r.y1 + abs(h/2) + 3, oss.str().c_str());
+
+        oss.str("");
+        oss << std::setprecision(2) << std::fixed << value;
+        draw_text(dragger.x0 - 1, dragger.y0 + 12, oss.str().c_str());
     }

     void vscroll(const rect & r, int client_height, int & offset)
@@ -109,7 +146,7 @@
     }
 };

-texture_buffer buffers[4];
+texture_buffer buffers[6];

 int main(int argc, char * argv[]) try
 {
@@ -117,7 +154,7 @@
     //rs::log_to_file(rs::log_severity::debug, "librealsense.log");

     glfwInit();
-    auto win = glfwCreateWindow(1550, 960, "CPP Configuration Example", nullptr, nullptr);
+    auto win = glfwCreateWindow(1100, 960, "CPP Configuration Example", nullptr, nullptr);
     glfwMakeContextCurrent(win);
     gui g;
     glfwSetWindowUserPointer(win, &g);
@@ -142,6 +179,7 @@
     dev->enable_stream(rs::stream::color, rs::preset::best_quality);
     dev->enable_stream(rs::stream::infrared, rs::preset::best_quality);
     try { dev->enable_stream(rs::stream::infrared2, rs::preset::best_quality); } catch(...) {}
+    try { dev->enable_stream(rs::stream::fisheye, rs::preset::best_quality);} catch(...) {}

     //std::this_thread::sleep_for(std::chrono::seconds(1));

@@ -187,7 +225,7 @@
         y += 34;
         if(!dev->is_streaming())
         {
-            for(int i=0; i<4; ++i)
+            for(int i=0; i<5; ++i)
             {
                 auto s = (rs::stream)i;
                 bool enable = dev->is_stream_enabled(s);
@@ -217,16 +255,23 @@
         g.label({w-260,y+12}, {1,1,1}, "IVCAM options preset: %g", iv_preset);
         if(g.slider(101, {w-260,y+16,w-20,y+36}, 0, 10, 1, iv_preset)) rs_apply_ivcam_preset((rs_device *)dev, static_cast<rs_ivcam_preset>((int)iv_preset));
         y += 38;
-
+
         panel_height = y + 10 + offset;

         if(dev->is_streaming())
         {
-            w-=270;
-            buffers[0].show(*dev, rs::stream::color, 0, 0, w/2, h/2);
-            buffers[1].show(*dev, rs::stream::depth, w/2, 0, w-w/2, h/2);
-            buffers[2].show(*dev, rs::stream::infrared, 0, h/2, w/2, h-h/2);
-            buffers[3].show(*dev, rs::stream::infrared2, w/2, h/2, w-w/2, h-h/2);
+            w+=150;
+            buffers[0].show(*dev, rs::stream::color, 0, 0, w/3, h/3);
+            buffers[1].show(*dev, rs::stream::depth, w/3, 0, w/3, h/3);
+            buffers[2].show(*dev, rs::stream::infrared, 0, h/3, w/3, h/3);
+            buffers[3].show(*dev, rs::stream::infrared2, w/3, h/3, w/3, h/3);
+            buffers[4].show(*dev, rs::stream::fisheye, 0, 2*h/3, w/3, h/3);
+
+            int x = w/3 + 5;
+            int y = 2*h/3 + 5;
+            buffers[5].print(x, y, "MM (200 Hz)");
+            buffers[5].print(x, y + 16, "Gyro: ");
+            g.indicator({x + 100, y + 26 , x + 300, y + 18}, 0, 100, 40);
         }

         glfwSwapBuffers(win);


When reading ObjC class table, use new SPI if it is avail

In the latest OS betas, the objc runtime has a special interface
for the debugger, class_getNameRaw(), instead of the existing
class_getName(), which will return class names in their raw, unmangled
(in the case of swift) form.  When lldb can access the unmangled
names of classes, it won't need to fetch them out of the inferior
process after we run our "get the objc class table" expression.

If the new interface is absent (debugging a process on an older
target), lldb will fall back to class_getName and reading any class
names that it got back in demangled form, at a bit of a performance
cost on the first expression.

<rdar://problem/50688054>

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@363103 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -157,6 +157,16 @@

 )";

+// We'll substitute in class_getName or class_getNameRaw depending
+// on which is present.
+static const char *g_shared_cache_class_name_funcptr = R"(
+extern "C"
+{
+    const char *%s(void *objc_class);
+    const char *(*class_name_lookup_func)(void *) = %s;
+}
+)";
+
 static const char *g_get_shared_cache_class_info_name =
     "__lldb_apple_objc_v2_get_shared_cache_class_info";
 // Testing using the new C++11 raw string literals. If this breaks GCC then we
@@ -165,7 +175,6 @@

 extern "C"
 {
-    const char *class_getName(void *objc_class);
     size_t strlen(const char *);
     char *strncpy (char * s1, const char * s2, size_t n);
     int printf(const char * format, ...);
@@ -286,7 +295,7 @@
                 if (class_infos && idx < max_class_infos)
                 {
                     class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
-                    const char *name = class_getName (class_infos[idx].isa);
+                    const char *name = class_name_lookup_func (class_infos[idx].isa);
                     DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
                     // Hash the class name so we don't have to read it
                     const char *s = name;
@@ -329,7 +338,7 @@
                 if (class_infos && idx < max_class_infos)
                 {
                     class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
-                    const char *name = class_getName (class_infos[idx].isa);
+                    const char *name = class_name_lookup_func (class_infos[idx].isa);
                     DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
                     // Hash the class name so we don't have to read it
                     const char *s = name;
@@ -1589,9 +1598,46 @@

   if (!m_get_shared_cache_class_info_code) {
     Status error;
+
+    // If the inferior objc.dylib has the class_getNameRaw function,
+    // use that in our jitted expression.  Else fall back to the old
+    // class_getName.
+    static ConstString g_class_getName_symbol_name("class_getName");
+    static ConstString g_class_getNameRaw_symbol_name("class_getNameRaw");
+    ConstString class_name_getter_function_name = g_class_getName_symbol_name;
+
+    ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
+    if (objc_runtime) {
+      const ModuleList &images = process->GetTarget().GetImages();
+      std::lock_guard<std::recursive_mutex> guard(images.GetMutex());
+      for (size_t i = 0; i < images.GetSize(); ++i) {
+        lldb::ModuleSP mod_sp = images.GetModuleAtIndexUnlocked(i);
+        if (objc_runtime->IsModuleObjCLibrary(mod_sp)) {
+          const Symbol *symbol =
+              mod_sp->FindFirstSymbolWithNameAndType(g_class_getNameRaw_symbol_name,
+                                                lldb::eSymbolTypeCode);
+          if (symbol &&
+              (symbol->ValueIsAddress() || symbol->GetAddressRef().IsValid())) {
+            class_name_getter_function_name = g_class_getNameRaw_symbol_name;
+          }
+        }
+      }
+    }
+
+    // Substitute in the correct class_getName / class_getNameRaw function name,
+    // concatenate the two parts of our expression text.  The format string
+    // has two %s's, so provide the name twice.
+    char *class_name_func_ptr_expr = nullptr;
+    asprintf (&class_name_func_ptr_expr, g_shared_cache_class_name_funcptr,
+              class_name_getter_function_name.AsCString(),
+              class_name_getter_function_name.AsCString());
+    std::string shared_class_expression = class_name_func_ptr_expr;
+    shared_class_expression += g_get_shared_cache_class_info_body;
+    free (class_name_func_ptr_expr);
+
     m_get_shared_cache_class_info_code.reset(
         GetTargetRef().GetUtilityFunctionForLanguage(
-            g_get_shared_cache_class_info_body, eLanguageTypeObjC,
+            shared_class_expression.c_str(), eLanguageTypeObjC,
             g_get_shared_cache_class_info_name, error));
     if (error.Fail()) {
       if (log)


Removing use of style byte indicator in Scriptol lexer.

--- lexers/LexScriptol.cxx
+++ lexers/LexScriptol.cxx
@@ -127,11 +127,10 @@
             }
 	}

-	styler.StartAt(startPos, 127);
+	styler.StartAt(startPos);

 	WordList &keywords = *keywordlists[0];

-	int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
 	char prevWord[200];
 	prevWord[0] = '\0';
         if (length == 0)  return;
@@ -143,36 +142,8 @@
         char chPrev2 = ' ';
         char chNext  = styler[startPos];
 	styler.StartSegment(startPos);
-	bool atStartLine = true;
-	int spaceFlags = 0;
 	for (int i = startPos; i < lengthDoc; i++)
         {
-
-         if (atStartLine)
-         {
-         char chBad = static_cast<char>(64);
-         char chGood = static_cast<char>(0);
-         char chFlags = chGood;
-
-         if (whingeLevel == 1)
-         {
-             chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
-         }
-         else if (whingeLevel == 2)
-         {
-             chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
-         }
-         else if (whingeLevel == 3)
-         {
-             chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
-         }
-         else if (whingeLevel == 4)
-         {
-              chFlags = (spaceFlags & wsTab) ? chBad : chGood;
-         }
-         styler.SetFlags(chFlags, static_cast<char>(state));
-         atStartLine = false;
-       }

        char ch = chNext;
        chNext = styler.SafeGetCharAt(i + 1);
@@ -185,7 +156,6 @@
           {
               styler.ColourTo(i, state);
           }
-          atStartLine = true;
         }

         if (styler.IsLeadByte(ch))


ProcessRunner fix errno handling usage

ProcessRunner fix errno handling usage

--- Library/Sources/Stroika/Foundation/Execution/ProcessRunner.cpp
+++ Library/Sources/Stroika/Foundation/Execution/ProcessRunner.cpp
@@ -531,9 +531,9 @@
         int  jStdout[2];
         int  jStderr[2];
         // @todo REDO USING pipe2 and set flags !!!
-        Verify (::pipe (jStdin));
-        Verify (::pipe (jStdout));
-        Verify (::pipe (jStderr));
+        Execution::Handle_ErrNoResultInteruption ([&jStdin] () -> int { return ::: pipe (jStdin);});
+        Execution::Handle_ErrNoResultInteruption ([&jStdout] () -> int { return ::: pipe (jStdout);});
+        Execution::Handle_ErrNoResultInteruption ([&jStderr] () -> int { return ::: pipe (jStderr);});
         int cpid = fork();
         if (cpid == -1) {
             Execution::DoThrow (StringException (L"fork failed"));  // must throw errno here


Added support for naming of ground reactions model values

--- src/models/FGGroundReactions.cpp
+++ src/models/FGGroundReactions.cpp
@@ -49,7 +49,7 @@

 namespace JSBSim {

-IDENT(IdSrc,"$Id: FGGroundReactions.cpp,v 1.49 2014/01/28 09:42:21 ehofman Exp $");
+IDENT(IdSrc,"$Id: FGGroundReactions.cpp,v 1.50 2014/05/17 15:25:20 jberndt Exp $");
 IDENT(IdHdr,ID_GROUNDREACTIONS);

 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -155,6 +155,8 @@
   } else {
     document = elem;
   }
+
+  Name = "Ground Reactions Model: " + document->GetAttributeValue("name");

   Debug(2);


fixed so that the index count was based on the current quad, and not the next quad

--- render/bufferbuilder2d.cc
+++ render/bufferbuilder2d.cc
@@ -26,15 +26,17 @@
 void BufferBuilder2d::AddQuad(const Point& a, const Point& b, const Point& c,
              const Point& d) {
   Assert(this);
-  AddVertex(a);
-  AddVertex(b);
-  AddVertex(c);
-  AddVertex(d);

   const unsigned int ai = data.size() / 4;
   const unsigned int bi = ai + 1;
   const unsigned int ci = ai + 2;
   const unsigned int di = ai + 3;
+
+  AddVertex(a);
+  AddVertex(b);
+  AddVertex(c);
+  AddVertex(d);
+
   AddTriangle(ci, bi, ai);
   AddTriangle(ci, di, bi);
 }


Avoid a lot of memset cost when adding a RenderQueue block.

--- renderer/render_queue.hpp
+++ renderer/render_queue.hpp
@@ -199,16 +199,16 @@

 	struct Block
 	{
-		std::vector<uint8_t> buffer;
+		std::unique_ptr<uint8_t[]> buffer;
 		uintptr_t ptr = 0;
 		uintptr_t begin = 0;
 		uintptr_t end = 0;

 		explicit Block(size_t size)
 		{
-			buffer.resize(size);
-			begin = reinterpret_cast<uintptr_t>(buffer.data());
-			end = reinterpret_cast<uintptr_t>(buffer.data()) + size;
+			buffer.reset(new uint8_t[size]);
+			begin = reinterpret_cast<uintptr_t>(buffer.get());
+			end = reinterpret_cast<uintptr_t>(buffer.get()) + size;
 			reset();
 		}


inc/obj_aio.hpp: Corrected handling of <bc>i/o-listener

  Should build a new port, not expect one T.T

--- inc/obj_aio.hpp
+++ inc/obj_aio.hpp
@@ -225,10 +225,9 @@

 inline Object::ref io_listener(Process& host, Object::ref proc, Object::ref port) {
 	#ifdef DEBUG
-		expect_type<HlIOPort>(
-			port,
-			"listener: expected an I/O port for port"
-		);
+		if(!is_a<int>(port)) {
+			throw_HlError("listener: expected an integer for I/O port number");
+		}
 	#endif
 	boost::shared_ptr<ProcessInvoker> pi = create_process_invoker(proc);
 	try {


inc/objects.hpp: Modified to remove redundant static inline in some declarations

  Necessary on newer versions of gcc; might be standard

--- inc/objects.hpp
+++ inc/objects.hpp
@@ -169,7 +169,7 @@
 		return to_ref<Generic*>(x);
 	}
 	template<>
-	static inline ref to_ref<Generic*>(Generic* x) {
+	ref to_ref<Generic*>(Generic* x) {
 		intptr_t tmp = reinterpret_cast<intptr_t>(x);
 		#ifdef DEBUG
 			if(tmp & tag_mask != 0) {
@@ -179,7 +179,7 @@
 		return ref(tmp + tag_traits<Generic*>::tag);
 	}
 	template<>
-	static inline ref to_ref<Symbol*>(Symbol* x) {
+	ref to_ref<Symbol*>(Symbol* x) {
 		intptr_t tmp = reinterpret_cast<intptr_t>(x);
 		#ifdef DEBUG
 			if(tmp & tag_mask != 0) {
@@ -189,7 +189,7 @@
 		return ref(tmp + tag_traits<Symbol*>::tag);
 	}
 	template<>
-	static inline ref to_ref<int>(int x) {
+	ref to_ref<int>(int x) {
 		#ifdef DEBUG
 			#if (INT_MAX >= INTPTR_MAX) || (INT_MIN <= INTPTR_MIN)
 				if(x < smallint_min || x > smallint_max) {
@@ -203,7 +203,7 @@
 		return ref(tmp + tag_traits<int>::tag);
 	}
 	template<>
-	static inline ref to_ref<UnicodeChar>(UnicodeChar x) {
+	ref to_ref<UnicodeChar>(UnicodeChar x) {
 		intptr_t tmp = x.dat << tag_bits;
 		return ref(tmp + tag_traits<UnicodeChar>::tag);
 	}
@@ -276,7 +276,7 @@
 	}

 	template<>
-	static inline int _as_a<int>(ref obj) {
+	int _as_a<int>(ref obj) {
 		#ifdef DEBUG
 			if(!_is_a<int>(obj)) {
 				throw_TypeError(obj,
@@ -289,7 +289,7 @@
 	}

 	template<>
-	static inline UnicodeChar _as_a<UnicodeChar>(ref obj) {
+	UnicodeChar _as_a<UnicodeChar>(ref obj) {
 		uint32_t tmp = obj.dat;
 		return UnicodeChar(tmp >> tag_bits);
 	}


Add some code to log the collision information.

--- OpenGLESApp2/OpenGLESApp2.Android.NativeActivity/Collision.cpp
+++ OpenGLESApp2/OpenGLESApp2.Android.NativeActivity/Collision.cpp
@@ -3,6 +3,8 @@
 #include <list>
 #include <boost/optional.hpp>

+//#define ENABLE_COLLISION_LOGGING
+#ifdef ENABLE_COLLISION_LOGGING
 #ifdef __ANDROID__
 #include <android/log.h>
 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "AndroidProject1.NativeActivity", __VA_ARGS__))
@@ -12,6 +14,10 @@
 #define LOGI(...) ((void)printf(__VA_ARGS__), (void)printf("\n"))
 #define LOGE(...) ((void)printf(__VA_ARGS__), (void)printf("\n"))
 #endif // __ANDROID__
+#else
+#define LOGI(...)
+#define LOGE(...)
+#endif // ENABLE_COLLISION_LOGGING

 namespace Mai {

@@ -349,6 +355,7 @@
 			tmax = std::min(tmax, t1);
 		  }
 		  if (tmin > tmax) {
+			LOGI("No collision: (%f, %f, %f), %f, %f", v.x, v.y, v.z, tmin, tmax);
 			return Result();
 		  }
 		}
@@ -364,7 +371,10 @@
 		}
 	  };

+#ifdef ENABLE_COLLISION_LOGGING
 	  bool logged = false;
+#endif // ENABLE_COLLISION_LOGGING
+
 	  int u0 = 0, u1 = 0;
 	  const Vector3F p = sphere.shape.center + tmin * sphere.v - box.center;
 	  const float f0 = box.normal[0].Dot(p);
@@ -383,24 +393,30 @@
 		const Line l(sphere.shape.center, sphere.v);
 		if (auto ret = IntersectSegmentCapsule(l, Capsule(c0, local::Corner(box, u1 ^ 1), sphere.shape.radius))) {
 		  if (ret.t < tmin) {
-			LOGI("Hit 0: (%f, %f, %f), %f, %f", ret.n.x, ret.n.y, ret.n.z, tmin, tmax);
+#ifdef ENABLE_COLLISION_LOGGING
+			LOGI("Hit 0: %f %f, %f, (%f, %f, %f)", ret.t, tmin, tmax, ret.n.x, ret.n.y, ret.n.z);
 			logged = true;
+#endif // ENABLE_COLLISION_LOGGING
 			tmin = ret.t;
 			n = ret.n;
 		  }
 		}
 		if (auto ret = IntersectSegmentCapsule(l, Capsule(c0, local::Corner(box, u1 ^ 2), sphere.shape.radius))) {
 		  if (ret.t < tmin) {
-			LOGI("Hit 1: (%f, %f, %f), %f, %f", ret.n.x, ret.n.y, ret.n.z, tmin, tmax);
+#ifdef ENABLE_COLLISION_LOGGING
+			LOGI("Hit 1: %f %f, %f, (%f, %f, %f)", ret.t, tmin, tmax, ret.n.x, ret.n.y, ret.n.z);
 			logged = true;
+#endif // ENABLE_COLLISION_LOGGING
 			tmin = ret.t;
 			n = ret.n;
 		  }
 		}
 		if (auto ret = IntersectSegmentCapsule(l, Capsule(c0, local::Corner(box, u1 ^ 4), sphere.shape.radius))) {
 		  if (ret.t < tmin) {
-			LOGI("Hit 2: (%f, %f, %f), %f, %f", ret.n.x, ret.n.y, ret.n.z, tmin, tmax);
+#ifdef ENABLE_COLLISION_LOGGING
+			LOGI("Hit 2: %f %f, %f, (%f, %f, %f)", ret.t, tmin, tmax, ret.n.x, ret.n.y, ret.n.z);
 			logged = true;
+#endif // ENABLE_COLLISION_LOGGING
 			tmin = ret.t;
 			n = ret.n;
 		  }
@@ -413,11 +429,14 @@
 		const Position3F c1 = local::Corner(box, u1);
 		const Line l(sphere.shape.center, sphere.v);
 		if (auto ret = IntersectSegmentCapsule(l, Capsule(c0, c1, sphere.shape.radius))) {
-		  LOGI("Hit 3: (%f, %f, %f), %f, %f", ret.n.x, ret.n.y, ret.n.z, tmin, tmax);
+#ifdef ENABLE_COLLISION_LOGGING
+		  LOGI("Hit 3: %f %f, %f, (%f, %f, %f)", ret.t, tmin, tmax, ret.n.x, ret.n.y, ret.n.z);
 		  logged = true;
+#endif // ENABLE_COLLISION_LOGGING
 		  tmin = ret.t;
 		  n = ret.n;
 		} else {
+		  LOGI("Through: %f, %f", tmin, tmax);
 		  return Result();
 		}
 	  }
@@ -441,9 +460,13 @@
 		LOGI("Outward:%x, %x, %f", u0, u1, n.Dot(sphere.accel));
 		return Result();
 	  }
+
+#ifdef ENABLE_COLLISION_LOGGING
 	  if (!logged) {
 		LOGI("Hit: (%f, %f, %f), %f, %f", n.x, n.y, n.z, tmin, tmax);
 	  }
+#endif // ENABLE_COLLISION_LOGGING
+
 	  const Plane plane(sphere.shape.center - sphere.shape.radius * n, n);
 	  SolveRestitution(lhs, rhs, plane, tmin);
 	  return Result(plane);


change efficiency corrected multiplicity bin


final sol cost/length instead of total.

final sol cost/length instead of total.

--- incl/search.hpp
+++ incl/search.hpp
@@ -44,8 +44,8 @@
 		if (dups >= 0)
 			dfpair(f, "total nodes duplicated", "%ld", dups);
 		dfpair(f, "total reopened", "%ld", reopnd);
-		dfpair(f, "total sol cost", "%g", (double) cost);
-		dfpair(f, "total sol length", "%lu", (unsigned long) path.size());
+		dfpair(f, "final sol cost", "%g", (double) cost);
+		dfpair(f, "final sol length", "%lu", (unsigned long) path.size());
 	}
 };


Remove unnecessary printouts

Remove unnecessary printouts

--- PWGHF/vertexingHF/vHFML/AliAnalysisTaskSEDstarPolarization.cxx
+++ PWGHF/vertexingHF/vHFML/AliAnalysisTaskSEDstarPolarization.cxx
@@ -470,7 +470,6 @@
                     if(labD >= 0) {
                         //check if reflected signal
                         int labDauFirst = dauPi->GetLabel();
-                        std::cout << labDauFirst << std::endl;
                         AliAODMCParticle* dauFirst = nullptr;
                         if(labDauFirst >= 0)
                             dauFirst = dynamic_cast<AliAODMCParticle *>(arrayMC->UncheckedAt(labDauFirst));
@@ -528,7 +527,6 @@
                     if(labD >= 0) {
                         //check if reflected signal
                         int labDauFirst = dauPi->GetLabel();
-                        std::cout << labDauFirst << std::endl;
                         AliAODMCParticle* dauFirst = nullptr;
                         if(labDauFirst >= 0)
                             dauFirst = dynamic_cast<AliAODMCParticle *>(arrayMC->UncheckedAt(labDauFirst));


Run 'make style' with clang-format 12

Run 'make style' with clang-format 12

TODO: Go through new options and update configuration.

--- fly/types/json/json.hpp
+++ fly/types/json/json.hpp
@@ -1433,8 +1433,8 @@
      */
     template <typename... Args>
     using object_insertion_result = std::conditional_t<
-        std::is_void_v<decltype(
-            std::declval<JsonTraits::object_type>().insert(std::declval<Args>()...))>,
+        std::is_void_v<decltype(std::declval<JsonTraits::object_type>().insert(
+            std::declval<Args>()...))>,
         void,
         std::pair<iterator, bool>>;


Macro out mapping matrix for now

Macro out mapping matrix for now

--- src/Core/Algorithms/Field/Tests/ConvertFieldBasisAlgoTests.cc
+++ src/Core/Algorithms/Field/Tests/ConvertFieldBasisAlgoTests.cc
@@ -49,15 +49,13 @@
   EXPECT_EQ(givenBasis, tetmesh->vfield()->basis_order());

   algo.set_option(Parameters::OutputType, "Constant");
+  algo.set(Parameters::BuildBasisMapping, false);

   FieldHandle result;
   ASSERT_TRUE(algo.runImpl(tetmesh, result));

   const int expectedBasis = 0;
   EXPECT_EQ(expectedBasis, result->vfield()->basis_order());
-
-  //TODO: compare basis
-  FAIL() << "todo";
 }

 /*


Reduced the number of parameters.

Reduced the number of parameters.

--- include/SNR.hpp
+++ include/SNR.hpp
@@ -31,16 +31,13 @@
   ~snrDedispersedConf();
   // Get
   unsigned int getNrSamplesPerBlock() const;
-  unsigned int getNrSamplesPerThread() const;
   // Set
   void setNrSamplesPerBlock(unsigned int samples);
-  void setNrSamplesPerThread(unsigned int samples);
   // utils
   std::string print() const;

 private:
   unsigned int nrSamplesPerBlock;
-  unsigned int nrSamplesPerThread;
 };

 // OpenCL SNR
@@ -52,16 +49,8 @@
   return nrSamplesPerBlock;
 }

-inline unsigned int snrDedispersedConf::getNrSamplesPerThread() const {
-  return nrSamplesPerThread;
-}
-
 inline void snrDedispersedConf::setNrSamplesPerBlock(unsigned int samples) {
   nrSamplesPerBlock = samples;
-}
-
-inline void snrDedispersedConf::setNrSamplesPerThread(unsigned int samples) {
-  nrSamplesPerThread = samples;
 }

 } // PulsarSearch


BitwiseOps templates

BitwiseOps templates

--- SHA_224.hpp
+++ SHA_224.hpp
@@ -78,7 +78,7 @@
                      AST_Var<Alg_uint8<FR>>,
                      SHA_Functions<AST_Node<Alg_uint32<FR>>,
                                    AST_Op<Alg_uint32<FR>>,
-                                   BitwiseAST<Alg_uint32<FR>, Alg_uint32<FR>>>>;
+                                   BitwiseAST<Alg_uint32<FR>>>>;
 } // namespace zk

 namespace eval {
@@ -87,7 +87,7 @@
                     std::uint8_t,
                     SHA_Functions<std::uint32_t,
                                   std::uint32_t,
-                                  BitwiseINT<std::uint32_t, std::uint32_t>>>
+                                  BitwiseINT<std::uint32_t>>>
         SHA224;
 } // namespace eval


8-bit unsigned int array pre-image

8-bit unsigned int array pre-image

--- SHA_384.hpp
+++ SHA_384.hpp
@@ -16,13 +16,16 @@
 // SHA-384
 //

-template <typename T, typename MSG, typename F>
-class SHA_384 : public SHA_512<T, MSG, F>
+template <typename T, typename MSG, typename U, typename F>
+class SHA_384 : public SHA_512<T, MSG, U, F>
 {
 public:
     typedef T WordType;
+    typedef U ByteType;
+
     typedef std::array<T, 16> MsgType;
     typedef std::array<T, 6> DigType;
+    typedef std::array<U, 16 * 8> PreType;

     SHA_384()
         : m_setDigest(false)
@@ -75,6 +78,7 @@
     template <typename FR> using
     SHA384 = SHA_384<AST_Var<Alg_uint64<FR>>,
                      Lazy<AST_Var<Alg_uint64<FR>>, std::uint64_t>,
+                     AST_Var<Alg_uint8<FR>>,
                      SHA_Functions<AST_Node<Alg_uint64<FR>>,
                                    AST_Op<Alg_uint64<FR>>,
                                    BitwiseAST<Alg_uint64<FR>, Alg_uint64<FR>>>>;
@@ -83,6 +87,7 @@
 namespace eval {
 typedef SHA_384<std::uint64_t,
                 std::uint64_t,
+                std::uint8_t,
                 SHA_Functions<std::uint64_t,
                               std::uint64_t,
                               BitwiseINT<std::uint64_t, std::uint64_t>>>


Verified that the plugin.dynamic-loader.darwin-kernel.scan-type
setting is working correctly now; remove the #if 0's around its
use.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@173982 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -239,10 +239,8 @@
 lldb::addr_t
 DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints (Process *process)
 {
-#if 0
     if (GetGlobalProperties()->GetScanType() == eKASLRScanNone)
         return LLDB_INVALID_ADDRESS;
-#endif

     Error read_err;
     addr_t addr = LLDB_INVALID_ADDRESS;
@@ -276,13 +274,11 @@
 lldb::addr_t
 DynamicLoaderDarwinKernel::SearchForKernelNearPC (Process *process)
 {
-#if 0
     if (GetGlobalProperties()->GetScanType() == eKASLRScanNone
         || GetGlobalProperties()->GetScanType() == eKASLRScanLowgloAddresses)
     {
         return LLDB_INVALID_ADDRESS;
     }
-#endif

     ThreadSP thread = process->GetThreadList().GetSelectedThread ();
     if (thread.get() == NULL)
@@ -339,12 +335,10 @@
 lldb::addr_t
 DynamicLoaderDarwinKernel::SearchForKernelViaExhaustiveSearch (Process *process)
 {
-#if 0
     if (GetGlobalProperties()->GetScanType() != eKASLRScanExhaustiveScan)
     {
         return LLDB_INVALID_ADDRESS;
     }
-#endif

     addr_t kernel_range_low, kernel_range_high;
     if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 8)


[Reproducers] Fix data race found by tsan

This fixes a data race uncovered by tsan during destruction of the
GDBRemoteReplay server. The solution is to lock the thread state mutex
when receiving packets.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@356168 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
@@ -55,6 +55,8 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
     Timeout<std::micro> timeout, Status &error, bool &interrupt, bool &quit) {
+  std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
+
   StringExtractorGDBRemote packet;
   PacketResult packet_result = WaitForPacketNoLock(packet, timeout, false);


Make the local buffer overflow safe.

Make the local buffer overflow safe.

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

--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -2854,11 +2854,10 @@
   bool HasCopyAndDispose = BlockRequiresCopying(Ty);

   // FIXME: Move up
-  static int UniqueBlockByRefTypeID = 0;
-  // FIXME. This is error prone. Luckinly stack-canary stuff caught it.
-  char Name[128];
+  static unsigned int UniqueBlockByRefTypeID = 0;
+  char * Name =
+    (char*)alloca(strlen("__Block_byref_") + 10 + 1 + strlen(DeclName) + 1);
   sprintf(Name, "__Block_byref_%d_%s", ++UniqueBlockByRefTypeID, DeclName);
-  assert((strlen(Name) < sizeof(Name)) && "BuildByRefType - buffer overflow");
   RecordDecl *T;
   T = RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
                          &Idents.get(Name));
@@ -2905,11 +2904,10 @@
   bool BlockHasCopyDispose,
   llvm::SmallVector<const Expr *, 8> &BlockDeclRefDecls) {
   // FIXME: Move up
-  static int UniqueBlockParmTypeID = 0;
-  // FIXME. This is error prone. Luckinly stack-canary stuff caught it.
-  char Name[128];
+  static unsigned int UniqueBlockParmTypeID = 0;
+  char * Name =
+    (char*)alloca(strlen("__block_literal_") + 10 + 1);
   sprintf(Name, "__block_literal_%u", ++UniqueBlockParmTypeID);
-  assert((strlen(Name) < sizeof(Name)) && "getBlockParmType - buffer overflow");
   RecordDecl *T;
   T = RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
                          &Idents.get(Name));


B2DVector supports operator!=.  Let's use it.

Change-Id: Iecf58e0f24909ec2fd2780a5f4b219105c7c4b47

--- chart2/source/view/axes/VCartesianAxis.cxx
+++ chart2/source/view/axes/VCartesianAxis.cxx
@@ -1258,19 +1258,15 @@

 void lcl_hideIdenticalScreenValues( TickIter& rTickIter )
 {
-    TickInfo* pPreviousTickInfo = rTickIter.firstInfo();
-    if(!pPreviousTickInfo)
+    TickInfo* pPrevTickInfo = rTickIter.firstInfo();
+    if (!pPrevTickInfo)
         return;
-    pPreviousTickInfo->bPaintIt = true;
+
+    pPrevTickInfo->bPaintIt = true;
     for( TickInfo* pTickInfo = rTickIter.nextInfo(); pTickInfo; pTickInfo = rTickIter.nextInfo())
     {
-        pTickInfo->bPaintIt =
-            ( static_cast<sal_Int32>(pTickInfo->aTickScreenPosition.getX())
-            != static_cast<sal_Int32>(pPreviousTickInfo->aTickScreenPosition.getX()) )
-            ||
-            ( static_cast<sal_Int32>(pTickInfo->aTickScreenPosition.getY())
-            != static_cast<sal_Int32>(pPreviousTickInfo->aTickScreenPosition.getY()) );
-        pPreviousTickInfo = pTickInfo;
+        pTickInfo->bPaintIt = (pTickInfo->aTickScreenPosition != pPrevTickInfo->aTickScreenPosition);
+        pPrevTickInfo = pTickInfo;
     }
 }


Mark CommandAgainGoesBackToOptionsTab as failing

TBR=zelidrag

BUG=47977
TEST=Green ChromeOS bot

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

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

--- chrome/browser/dom_ui/options_ui_uitest.cc
+++ chrome/browser/dom_ui/options_ui_uitest.cc
@@ -58,7 +58,7 @@
   AssertIsOptionsPage(tab);
 }

-TEST_F(OptionsUITest, CommandAgainGoesBackToOptionsTab) {
+TEST_F(OptionsUITest, FAILS_CommandAgainGoesBackToOptionsTab) {
   scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
   ASSERT_TRUE(browser.get());