[dsymutil][NFC] Replace calls to CoreFoundation with LLVM equivalent.

This patch replaces a block of logic that was implemented using
CoreFoundations calls with functionally equivalent logic that makes use
of LLVM libraries.

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

--- tools/dsymutil/CFBundle.cpp
+++ tools/dsymutil/CFBundle.cpp
@@ -11,6 +11,7 @@

 #ifdef __APPLE__
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <CoreFoundation/CoreFoundation.h>
 #include <assert.h>
@@ -56,7 +57,7 @@
   static const char *UTF8(CFStringRef CFStr, std::string &Str);
 };

-/// Static function that puts a copy of the UTF8 contents of CFStringRef into
+/// Static function that puts a copy of the UTF-8 contents of CFStringRef into
 /// std::string and returns the C string pointer that is contained in the
 /// std::string when successful, nullptr otherwise.
 ///
@@ -85,13 +86,10 @@
 /// RAII wrapper around CFBundleRef.
 class CFBundle : public CFReleaser<CFBundleRef> {
 public:
-  CFBundle(const char *Path = nullptr) : CFReleaser<CFBundleRef>() {
-    if (Path && Path[0])
-      SetFromPath(Path);
-  }
+  CFBundle(StringRef Path) : CFReleaser<CFBundleRef>() { SetFromPath(Path); }

-  CFBundle(CFURLRef url)
-      : CFReleaser<CFBundleRef>(url ? ::CFBundleCreate(nullptr, url)
+  CFBundle(CFURLRef Url)
+      : CFReleaser<CFBundleRef>(Url ? ::CFBundleCreate(nullptr, Url)
                                     : nullptr) {}

   /// Return the bundle identifier.
@@ -109,67 +107,49 @@
   }

 private:
-  /// Update this instance with a new bundle created from the given path.
-  bool SetFromPath(const char *Path);
+  /// Helper to initialize this instance with a new bundle created from the
+  /// given path. This function will recursively remove components from the
+  /// path in its search for the nearest Info.plist.
+  void SetFromPath(StringRef Path);
 };

-bool CFBundle::SetFromPath(const char *InPath) {
-  // Release our old bundle and URL.
+void CFBundle::SetFromPath(StringRef Path) {
+  // Start from an empty/invalid CFBundle.
   reset();

-  if (InPath && InPath[0]) {
-    char ResolvedPath[PATH_MAX];
-    const char *Path = ::realpath(InPath, ResolvedPath);
-    if (Path == nullptr)
-      Path = InPath;
+  if (Path.empty() || !sys::fs::exists(Path))
+    return;

-    CFAllocatorRef Allocator = kCFAllocatorDefault;
-    // Make our Bundle URL.
+  SmallString<256> RealPath;
+  sys::fs::real_path(Path, RealPath, /*expand_tilde*/ true);
+
+  do {
+    // Create a CFURL from the current path and use it to create a CFBundle.
     CFReleaser<CFURLRef> BundleURL(::CFURLCreateFromFileSystemRepresentation(
-        Allocator, (const UInt8 *)Path, strlen(Path), false));
-    if (BundleURL.get()) {
-      CFIndex LastLength = LONG_MAX;
+        kCFAllocatorDefault, (const UInt8 *)RealPath.data(), RealPath.size(),
+        false));
+    reset(::CFBundleCreate(kCFAllocatorDefault, BundleURL.get()));

-      while (BundleURL.get() != nullptr) {
-        // Check the Path range and make sure we didn't make it to just "/",
-        // ".", or "..".
-        CFRange rangeIncludingSeparators;
-        CFRange range = ::CFURLGetByteRangeForComponent(
-            BundleURL.get(), kCFURLComponentPath, &rangeIncludingSeparators);
-        if (range.length > LastLength)
-          break;
+    // If we have a valid bundle and find its identifier we are done.
+    if (get() != nullptr) {
+      if (GetIdentifier() != nullptr)
+        return;
+      reset();
+    }

-        reset(::CFBundleCreate(Allocator, BundleURL.get()));
-        if (get() != nullptr) {
-          if (GetIdentifier() != nullptr)
-            break;
-          reset();
-        }
-        BundleURL.reset(::CFURLCreateCopyDeletingLastPathComponent(
-            Allocator, BundleURL.get()));
-
-        LastLength = range.length;
-      }
-    }
-  }
-
-  return get() != nullptr;
+    // Remove the last component of the path and try again until there's
+    // nothing left but the root.
+    sys::path::remove_filename(RealPath);
+  } while (RealPath != sys::path::root_name(RealPath));
 }
-
 #endif

-/// On Darwin, try and find the original executable's Info.plist information
-/// using CoreFoundation calls by creating a URL for the executable and
-/// chopping off the last Path component. The CFBundle can then get the
-/// identifier and grab any needed information from it directly. Return default
-/// CFBundleInfo on other platforms.
+/// On Darwin, try and find the original executable's Info.plist to extract
+/// information about the bundle. Return default values on other platforms.
 CFBundleInfo getBundleInfo(StringRef ExePath) {
   CFBundleInfo BundleInfo;

 #ifdef __APPLE__
-  if (ExePath.empty() || !sys::fs::exists(ExePath))
-    return BundleInfo;
-
   auto PrintError = [&](CFTypeID TypeID) {
     CFString TypeIDCFStr(::CFCopyTypeIDDescription(TypeID));
     std::string TypeIDStr;
@@ -178,7 +158,7 @@
            << ", but it should be a string in: " << ExePath << ".\n";
   };

-  CFBundle Bundle(ExePath.data());
+  CFBundle Bundle(ExePath);
   if (CFStringRef BundleID = Bundle.GetIdentifier()) {
     CFString::UTF8(BundleID, BundleInfo.IDStr);
     if (CFTypeRef TypeRef =


jibrils bug fix

jibrils bug fix

--- ConnectedWorlds/ConnectedWorlds/Player.cpp
+++ ConnectedWorlds/ConnectedWorlds/Player.cpp
@@ -16,7 +16,10 @@
 		velocity.x += acc.x;
 	};

-	velocity.y += acc.y;
+	if (!onGround)
+	{
+		velocity.y += acc.y;
+	}

 	SpriteAnimation::Update(deltaTime);
 }


ENH: slight optimization

ENH: slight optimization

--- Core/DataStructures/mitkGeometry2DData.cpp
+++ Core/DataStructures/mitkGeometry2DData.cpp
@@ -46,7 +46,19 @@
 //##ModelId=3E6423D2030E
 void mitk::Geometry2DData::SetGeometry2D(mitk::Geometry2D *geometry2d)
 {
-  Superclass::SetGeometry(geometry2d);
+  if(geometry2d != NULL)
+  {
+    TimeSlicedGeometry* timeSlicedGeometry = GetTimeSlicedGeometry();
+    if(timeSlicedGeometry == NULL)
+    {
+      Superclass::SetGeometry(geometry2d);
+      return;
+    }
+    timeSlicedGeometry->InitializeEvenlyTimed(geometry2d, 1);
+    Modified();
+  }
+  else
+    Superclass::SetGeometry(geometry2d);
 }

 //##ModelId=3E66CC5A0295


Trying to avoid the message: Shutter reported that it was neither opened or closed, so I am confused

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@7554 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- DeviceAdapters/ZeissCAN29/ZeissMonitor.cpp
+++ DeviceAdapters/ZeissCAN29/ZeissMonitor.cpp
@@ -135,7 +135,9 @@
                memcpy(&position, message + 8, 2);
                position = ntohs((unsigned short) position);
             }
-            hub_.SetModelPosition(message[7], position);
+            // NS, 2011-08-03:
+            // Since the device is moving, we will only confuse ourselves by recording the actual moving position
+            // hub_.SetModelPosition(message[7], position);
             hub_.SetModelBusy(message[7], true);
          }
          else if (message[6] == 0x03) { // target position settled


INTEGRATION: CWS pbbeta02 (1.11.224); FILE MERGED 2004/12/08 07:26:47 pb 1.11.224.1: fix: #i34208# reset item for every load of a menuentry

--- svtools/source/config/dynamicmenuoptions.cxx
+++ svtools/source/config/dynamicmenuoptions.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: dynamicmenuoptions.cxx,v $
  *
- *  $Revision: 1.11 $
- *
- *  last change: $Author: rt $ $Date: 2004-06-16 10:06:27 $
+ *  $Revision: 1.12 $
+ *
+ *  last change: $Author: kz $ $Date: 2004-12-09 16:38:03 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -500,7 +500,6 @@
     //
     //      ... and so on ...

-    SvtDynMenuEntry   aItem         ;
     sal_uInt32  nItem     = 0 ;
     sal_uInt32  nPosition = 0 ;
     OUString    sName         ;
@@ -515,6 +514,7 @@
     // 4 subkeys for every item!
     for( nItem=0; nItem<nNewCount; ++nItem )
     {
+        SvtDynMenuEntry   aItem                       ;
         lValues[nPosition] >>= aItem.sURL             ;
         ++nPosition;
         lValues[nPosition] >>= aItem.sTitle           ;
@@ -532,6 +532,7 @@
     // 4 subkeys for every item!
     for( nItem=0; nItem<nWizardCount; ++nItem )
     {
+        SvtDynMenuEntry   aItem                       ;
         lValues[nPosition] >>= aItem.sURL             ;
         ++nPosition;
         lValues[nPosition] >>= aItem.sTitle           ;
@@ -549,6 +550,7 @@
     // 4 subkeys for every item!
     for( nItem=0; nItem<nHelpBookmarksCount; ++nItem )
     {
+        SvtDynMenuEntry   aItem                       ;
         lValues[nPosition] >>= aItem.sURL             ;
         ++nPosition;
         lValues[nPosition] >>= aItem.sTitle           ;


Update RqAqNewton.cc

Update RqAqNewton.cc

--- qNewton/RqAqNewton.cc
+++ qNewton/RqAqNewton.cc
@@ -16,6 +16,8 @@
     x=x-kv::Ramanujan_qAiry(itv(q),itv(x))*(1-q)*x
       /(kv::Ramanujan_qAiry(itv(q),itv(x))-kv::Ramanujan_qAiry(itv(q),itv(q*x)));
   cout<<x<<endl;
-  cout<<"value of RqA"<<kv::Ramanujan_qAiry(itv(q),itv(x))<<endl;
+  cout<<"value of RqA inf"<<kv::Ramanujan_qAiry(itv(q),itv(x.lower()))<<endl;
+  cout<<"value of RqA sup"<<kv::Ramanujan_qAiry(itv(q),itv(x.upper()))<<endl;
+  cout<<"value of RqA mid"<<kv::Ramanujan_qAiry(itv(q),itv(mid(x)))<<endl;
   }
 }


Fix issue with calculation of standard deviation at first point

--- src/chrono/utils/ChFilters.cpp
+++ src/chrono/utils/ChFilters.cpp
@@ -33,7 +33,7 @@
     m_data[(m_index++) % m_n] = val;
     int size = std::min(m_index, m_n);
     double mean = m_data.sum() / size;
-    m_std = std::sqrt(std::pow(m_data - mean, 2.0).sum() / (size - 1));
+    m_std = (size == 1) ? 0 : std::sqrt(std::pow(m_data - mean, 2.0).sum() / (size - 1));
     return mean;
 }


INTEGRATION: CWS dba24 (1.2.136); FILE MERGED 2005/02/04 14:52:50 fs 1.2.136.1: #b5008519#

--- svtools/source/contnr/contentenumeration.cxx
+++ svtools/source/contnr/contentenumeration.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: contentenumeration.cxx,v $
  *
- *  $Revision: 1.2 $
- *
- *  last change: $Author: pjunck $ $Date: 2004-10-22 12:32:58 $
+ *  $Revision: 1.3 $
+ *
+ *  last change: $Author: vg $ $Date: 2005-03-10 17:04:32 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -266,14 +266,25 @@

             try
             {
-                ::osl::MutexGuard aGuard( m_aMutex );
-
-                if ( !m_aFolder.aContent.get().is() )
-                    m_aFolder.aContent = Content( m_aFolder.sURL, m_xCommandEnv );
+                FolderDescriptor aFolder;
+                Reference< XCommandEnvironment > xEnvironment;
+                {
+                    ::osl::MutexGuard aGuard( m_aMutex );
+                    aFolder = m_aFolder;
+                    xEnvironment = m_xCommandEnv;
+                }
+                if ( !aFolder.aContent.get().is() )
+                {
+                    aFolder.aContent = Content( aFolder.sURL, xEnvironment );
+                    {
+                        ::osl::MutexGuard aGuard( m_aMutex );
+                        m_aFolder.aContent = aFolder.aContent;
+                    }
+                }

                 Reference< XDynamicResultSet > xDynResultSet;
                 ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS;
-                xDynResultSet = m_aFolder.aContent.createDynamicCursor( aProps, eInclude );
+                xDynResultSet = aFolder.aContent.createDynamicCursor( aProps, eInclude );

                 if ( xDynResultSet.is() )
                     xResultSet = xDynResultSet->getStaticResultSet();


docx iso export: ST_Shd requires val attribute, used clear

--- sw/source/filter/ww8/docxattributeoutput.cxx
+++ sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1579,6 +1579,7 @@
         OString sColor = impl_ConvertColor( aColor );
         m_pSerializer->singleElementNS( XML_w, XML_shd,
                 FSNS( XML_w, XML_fill ), sColor.getStr( ),
+                FSNS( XML_w, XML_val ), "clear",
                 FSEND );
 }

@@ -2841,7 +2842,9 @@
 void DocxAttributeOutput::CharBackground( const SvxBrushItem& rBrush )
 {
     m_pSerializer->singleElementNS( XML_w, XML_shd,
-            FSNS( XML_w, XML_fill ), impl_ConvertColor( rBrush.GetColor() ).getStr(), FSEND );
+            FSNS( XML_w, XML_fill ), impl_ConvertColor( rBrush.GetColor() ).getStr(),
+            FSNS( XML_w, XML_val ), "clear",
+            FSEND );
 }

 void DocxAttributeOutput::CharFontCJK( const SvxFontItem& rFont )
@@ -3738,6 +3741,7 @@
         OString sColor = impl_ConvertColor( rBrush.GetColor( ) );
         m_pSerializer->singleElementNS( XML_w, XML_shd,
                 FSNS( XML_w, XML_fill ), sColor.getStr( ),
+                FSNS( XML_w, XML_val ), "clear",
                 FSEND );
     }
 }


[C++] fixed member initialization order in ImmutableMessage

Change-Id: I3f398d14f65648c8405e327dcf3b6ba8c03e7c07

--- cpp/libjoynr/joynr-messaging/ImmutableMessage.cpp
+++ cpp/libjoynr/joynr-messaging/ImmutableMessage.cpp
@@ -29,9 +29,13 @@
 ImmutableMessage::ImmutableMessage(smrf::ByteVector&& serializedMessage, bool verifyInput)
         : serializedMessage(std::move(serializedMessage)),
           messageDeserializer(smrf::ByteArrayView(this->serializedMessage), verifyInput),
+          headers(),
+          bodyView(),
+          decompressedBody(),
           receivedFromGlobal(false),
-          bodyView(),
-          decompressedBody()
+          creator(),
+          id(),
+          type()
 {
     init();
 }
@@ -39,9 +43,13 @@
 ImmutableMessage::ImmutableMessage(const smrf::ByteVector& serializedMessage, bool verifyInput)
         : serializedMessage(serializedMessage),
           messageDeserializer(smrf::ByteArrayView(this->serializedMessage), verifyInput),
+          headers(),
+          bodyView(),
+          decompressedBody(),
           receivedFromGlobal(false),
-          bodyView(),
-          decompressedBody()
+          creator(),
+          id(),
+          type()
 {
     init();
 }


deleted a deprecated method call

deleted a deprecated method call

QLayout::setMargin is deprecated (and provokes a compilation error when included in a project and compiled against a recent Qt version) and redundent in this case since QLayout::setContentsMargins does exactly the same thing

--- qmarkdowntextedit.cpp
+++ qmarkdowntextedit.cpp
@@ -69,7 +69,6 @@
     // add a layout to the widget
     auto *layout = new QVBoxLayout(this);
     layout->setContentsMargins(0, 0, 0, 0);
-    layout->setMargin(0);
     layout->addStretch();
     this->setLayout(layout);


ARROW-6005: [C++] extend GetRecordBatchReader test to cover reading a single row group

This adds a basic unittest for row group selection with the `GetRecordBatchReader` API.

Closes #5012 from hatemhelal/arrow-6005 and squashes the following commits:

c1ccb88a6 <Hatem Helal> extend GetRecordBatchReader test to cover reading a single row group

Authored-by: Hatem Helal <6770b6823b2402dc813fc3254c5869d67b3a1d13@mathworks.com>
Signed-off-by: Wes McKinney <3be70eed0275ec2606f002bff3514252e145d204@apache.org>

--- cpp/src/parquet/arrow/arrow-reader-writer-test.cc
+++ cpp/src/parquet/arrow/arrow-reader-writer-test.cc
@@ -1891,6 +1891,7 @@
 TEST(TestArrowReadWrite, GetRecordBatchReader) {
   const int num_columns = 20;
   const int num_rows = 1000;
+  const int batch_size = 100;

   std::shared_ptr<Table> table;
   ASSERT_NO_FATAL_FAILURE(MakeDoubleTable(num_columns, num_rows, 1, &table));
@@ -1900,26 +1901,43 @@
                                              default_arrow_writer_properties(), &buffer));

   ArrowReaderProperties properties = default_arrow_reader_properties();
-  properties.set_batch_size(100);
+  properties.set_batch_size(batch_size);

   std::unique_ptr<FileReader> reader;
   FileReaderBuilder builder;
   ASSERT_OK(builder.Open(std::make_shared<BufferReader>(buffer)));
   ASSERT_OK(builder.properties(properties)->Build(&reader));

+  // Read the whole file, one batch at a time.
   std::shared_ptr<::arrow::RecordBatchReader> rb_reader;
   ASSERT_OK_NO_THROW(reader->GetRecordBatchReader({0, 1}, &rb_reader));
-
-  std::shared_ptr<::arrow::RecordBatch> batch;
+  std::shared_ptr<::arrow::RecordBatch> actual_batch, expected_batch;
+  ::arrow::TableBatchReader table_reader(*table);
+  table_reader.set_chunksize(batch_size);

   for (int i = 0; i < 10; ++i) {
-    ASSERT_OK(rb_reader->ReadNext(&batch));
-    ASSERT_EQ(100, batch->num_rows());
-    ASSERT_EQ(20, batch->num_columns());
-  }
-
-  ASSERT_OK(rb_reader->ReadNext(&batch));
-  ASSERT_EQ(nullptr, batch);
+    ASSERT_OK(rb_reader->ReadNext(&actual_batch));
+    ASSERT_OK(table_reader.ReadNext(&expected_batch));
+    ASSERT_NO_FATAL_FAILURE(::arrow::AssertBatchesEqual(*expected_batch, *actual_batch));
+  }
+
+  ASSERT_OK(rb_reader->ReadNext(&actual_batch));
+  ASSERT_EQ(nullptr, actual_batch);
+
+  // ARROW-6005: Read just the second row group
+  ASSERT_OK_NO_THROW(reader->GetRecordBatchReader({1}, &rb_reader));
+  std::shared_ptr<Table> second_rowgroup = table->Slice(num_rows / 2);
+  ::arrow::TableBatchReader second_table_reader(*second_rowgroup);
+  second_table_reader.set_chunksize(batch_size);
+
+  for (int i = 0; i < 5; ++i) {
+    ASSERT_OK(rb_reader->ReadNext(&actual_batch));
+    ASSERT_OK(second_table_reader.ReadNext(&expected_batch));
+    ASSERT_NO_FATAL_FAILURE(::arrow::AssertBatchesEqual(*expected_batch, *actual_batch));
+  }
+
+  ASSERT_OK(rb_reader->ReadNext(&actual_batch));
+  ASSERT_EQ(nullptr, actual_batch);
 }

 TEST(TestArrowReadWrite, ScanContents) {


Qt: Add drag & drop opened files to recent list. Qt: Show feedback (Warning on error & statusbar on success) on files loaded via drag & drop.

--- qt/src/mainwindow.cpp
+++ qt/src/mainwindow.cpp
@@ -370,22 +370,23 @@

 void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
-    if (event->mimeData()->hasUrls()){
-        for (const QUrl& url : event->mimeData()->urls()) {
-            /* Only accept local files. */
-            if (QFile::exists(url.toLocalFile()))
-                /* TODO - perhaps this should filter to XML files... */
-                return event->acceptProposedAction();
-        }
-    }
+    for (const QUrl& url : event->mimeData()->urls())
+        /* Only accept local files. */
+        if (QFile::exists(url.toLocalFile()))
+            /* TODO - perhaps this should filter to XML files... */
+            return event->acceptProposedAction();
 }

 void MainWindow::dropEvent(QDropEvent *event) {
-    if (event->mimeData()->hasUrls()){
-        for (const QUrl& url : event->mimeData()->urls()){
-            std::string err;
-            if (ui->centralwidget->universe.load(url.toLocalFile().toStdString(), err))
-                return event->acceptProposedAction();
+    std::string err;
+    for (const QUrl& url : event->mimeData()->urls()) {
+        if (!ui->centralwidget->universe.load(url.toLocalFile().toStdString(), err))
+            QMessageBox::warning(NULL, tr("Error loading simulation!"), QString::fromStdString(err));
+        else {
+            ui->statusbar->showMessage(("Loaded %1 planets from to \"" + url.toLocalFile() + '"').arg(ui->centralwidget->universe.size()), 8000);
+
+            addRecentFile(url.toLocalFile());
+            return event->acceptProposedAction();
         }
     }
 }


improve rep_tests 211, for fix #52

improve rep_tests 211, for fix #52

--- lib/replica_learn.cpp
+++ lib/replica_learn.cpp
@@ -764,11 +764,10 @@
 {
     check_hashed_access();

-    dwarn(
-        "%s: learning failed with err = %s, LastCommitted = %" PRId64,
+    derror(
+        "%s: learning failed with err = %s",
         name(),
-        err.to_string(),
-        _app->last_committed_decree()
+        err.to_string()
         );

     _potential_secondary_states.cleanup(true);


Add additional check for non-manadatory parameters

The OnPutFile notification has non mandatory parameters
`fileSize` and `length`. If the mobile application has no provided
appropriate parameters SDL sends `fileSize`: null as json value to HMI.

The commit fixes the issue and simply remove non mandatory parameter in
case mobile app sends nothing for one.

--- src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -302,18 +302,16 @@
   smart_objects::SmartObjectSPtr notification =
       std::make_shared<smart_objects::SmartObject>(
           smart_objects::SmartType_Map);
-
   smart_objects::SmartObject& message = *notification;
   message[strings::params][strings::function_id] =
       hmi_apis::FunctionID::BasicCommunication_OnPutFile;
-
   message[strings::params][strings::message_type] = MessageType::kNotification;
   message[strings::msg_params][strings::app_id] = connection_key();
   message[strings::msg_params][strings::sync_file_name] = sync_file_name_;
   message[strings::msg_params][strings::offset] = offset_;
-  if (0 == offset_) {
-    message[strings::msg_params][strings::file_size] =
-        (*message_)[strings::msg_params][strings::length];
+  if (0 == offset_ &&
+      !(*message_)[strings::msg_params].keyExists(strings::length)) {
+    message[strings::msg_params][strings::file_size] = length_;
   }
   message[strings::msg_params][strings::length] = length_;
   message[strings::msg_params][strings::persistent_file] = is_persistent_file_;


sls tactic default

sls tactic default

--- src/tactic/portfolio/smt_strategic_solver.cpp
+++ src/tactic/portfolio/smt_strategic_solver.cpp
@@ -37,11 +37,13 @@
 #include"horn_tactic.h"
 #include"smt_solver.h"

+#include"sls_tactic.h"
+
 tactic * mk_tactic_for_logic(ast_manager & m, params_ref const & p, symbol const & logic) {
     if (logic=="QF_UF")
         return mk_qfuf_tactic(m, p);
     else if (logic=="QF_BV")
-        return mk_qfbv_tactic(m, p);
+        return mk_qfbv_sls_tactic(m, p);
     else if (logic=="QF_IDL")
         return mk_qfidl_tactic(m, p);
     else if (logic=="QF_LIA")


tests chain postfix ++

tests chain postfix ++

--- catchtest/test_chain.cpp
+++ catchtest/test_chain.cpp
@@ -134,3 +134,12 @@
     auto ch = chain(emp);
     REQUIRE( std::begin(ch) == std::end(ch) );
 }
+
+TEST_CASE("chain: postfix ++", "[chain]") {
+    std::string s1{"a"}, s2{"b"};
+    auto ch = chain(s1, s2);
+    auto it = std::begin(ch);
+    it++;
+    REQUIRE( *it == 'b');
+}
+


untested begin()

untested begin()

--- P1/BST.hpp
+++ P1/BST.hpp
@@ -48,7 +48,7 @@
    */ // TODO
   virtual std::pair<iterator,bool> insert(const Data& item)
   {
-
+    isize++;
     return std::pair<a,b>;
   }

@@ -59,7 +59,8 @@
    */ // TODO
   iterator find(const Data& item) const
   {
-
+    BSTIterator<Data> iter = new BSTIterator<Data>((*this)->root);
+
   }

@@ -76,20 +77,25 @@
   void clear()
   {

-    size = 0;
+    isize = 0;
   }

   /** Return true if the BST is empty, else false.
    */ // TODO
   bool empty() const
   {
-    return ( size == 0 );
+    return ( isize == 0 );
   }

   /** Return an iterator pointing to the first item in the BST.
    */ // TODO
-  iterator begin() const {
+  iterator begin() const
+  {
+    BSTNode<Data> temp = ( (*this)->root );
+    while (temp->left)
+      temp = temp->left;

+    return new BSTIterator<Data>(temp);
   }

   /** Return an iterator pointing past the last item in the BST.


debugged NMIDistance

debugged NMIDistance

--- src/clustering/NMIDistance.cpp
+++ src/clustering/NMIDistance.cpp
@@ -100,13 +100,21 @@
 		for (cluster D = 0; D < eta.upperBound(); D++) {
 			count sizeC = size_zeta[C];
 			count sizeD = size_eta[D];
-			if ((sizeC != 0) && (sizeD != 0)) {
-				double factor1 = overlapSizes[intersect[C][D]] / (double) n;
-				assert ((size_zeta[C] * size_eta[D]) != 0);
-				TRACE("union of " << C << " and " << D << ": " << unionSize(C, D));
-				double frac2 = (unionSize(C, D) * n) / (size_zeta[C] * size_eta[D]);
-				double factor2 = log_b(frac2, 2);
-				MI += factor1 * factor2;
+			if ((sizeC != 0) && (sizeD != 0)) { // cluster ids may not correspond to a real cluster
+				// the two clusters may or may not intersect
+				cluster inter = intersect[C][D];
+				if (inter == none) { // clusters do not intersect
+					TRACE("clusters do not intersect: " << C << ", " << D);
+				} else {
+					double factor1 = overlapSizes[inter] / (double) n;
+					assert ((size_zeta[C] * size_eta[D]) != 0);
+					TRACE("union of " << C << " and " << D << " has size: " << unionSize(C, D));
+					TRACE("overlap of " << C << " and " << D << " has size: " << overlapSizes[inter]);
+					double frac2 = (overlapSizes[inter] * n) / (size_zeta[C] * size_eta[D]);
+					double factor2 = log_b(frac2, 2);
+					TRACE("frac2 = " << frac2 << ", factor1 = " << factor1 << ", factor2 = " << factor2);
+					MI += factor1 * factor2;
+				}
 			}
 		}
 	}
@@ -114,7 +122,6 @@
 	// sanity check
 	assert (! std::isnan(MI));
 	assert (MI >= 0.0);
-	assert (MI <= 1.0);

@@ -160,7 +167,7 @@
 		NMID = 1.0 - NMI;
 	}
 	// sanity check
-	assert (NMID >= 0.0);
+	// assert (NMID >= 0.0);
 	assert (NMID <= 1.0);
 	return NMID;


Allow the jukebox to play wav, mp3 and ogg.

--- pup_snd.cpp
+++ pup_snd.cpp
@@ -192,7 +192,6 @@
 			io::path_list::iterator it;
 			do {
 				it = pup::random_element(files_.begin(), files_.end());
-				//for (auto jit : files_) std::cout << jit << std::endl;
 			} while (std::find(history_.begin(), history_.end(), *it) != history_.end());
 			mus.start(*it);
 			history_.push_back(*it);
@@ -214,8 +213,11 @@
 {
 	for (auto it = files_.begin(); it != files_.end(); /* in-loop */) {
 		if (
-			boost::filesystem::is_regular_file(*it) &&
-			it->extension().string() == ".wav"
+			boost::filesystem::is_regular_file(*it) && (
+				it->extension().string() == ".mp3" ||
+				it->extension().string() == ".ogg" ||
+				it->extension().string() == ".wav"
+			)
 		) {
 			++it;
 		} else {


[MOD] net

[MOD] net

--- src/elf/net/net.cpp
+++ src/elf/net/net.cpp
@@ -716,8 +716,11 @@

     chunk_t *c = NULL;
     mutex_lock(&(ctx->lock));
-    clone = ctx->send_data->chunks;
-    ctx->send_data->chunks.clear();
+    chunk_queue &src = ctx->send_data->chunks;
+    for (size_t i = 0; i < CHUNK_MAX_NUM && !src.empty(); ++i) {
+        clone.push_back(src.front());
+        src.pop_front();
+    }
     mutex_unlock(&(ctx->lock));
     return c;
 }


FIX: d_defaultFont was not being initialised in GUIContext::GUIContext()

--- cegui/src/GUIContext.cpp
+++ cegui/src/GUIContext.cpp
@@ -84,6 +84,7 @@
     d_defaultTooltipObject(0),
     d_weCreatedTooltipObject(false),
     d_surfaceSize(target.getArea().getSize()),
+    d_defaultFont(0),
     d_windowContainingMouse(0),
     d_modalWindow(0),
     d_captureWindow(0),


Fixed a problem with the benchmark

Fixed a problem with the benchmark

--- test/benchmark.cpp
+++ test/benchmark.cpp
@@ -26,7 +26,7 @@
         cout << "file could not be open";
         return -1;
     }
-    auto rmdp = RMDP::transitions_from_csv(ifs,true);
+    auto rmdp = RMDP::from_csv(ifs,true);
     ifs.close();

     cout << "running test" << endl;


Remove dead code in Environment

Remove dead code in Environment

--- src/environment.cpp
+++ src/environment.cpp
@@ -65,9 +65,8 @@
       }

       int status;
-      int pid = d_->process.Wait(&status, WNOHANG); //waitpid(d_->child_pid_, &status, WNOHANG);
+      int pid = d_->process.Wait(&status, WNOHANG);
       if (pid == d_->process.pid()) {
-        // d_->child_pid_ = -1;
         FAIL() << "Dummy X server failed to start, did you run as root?";
         return;
       } else if (pid == 0) {
@@ -85,54 +84,6 @@

     FAIL() << "Unable to open connection to dummy X server";
   }
-
-#if 0
-  d_->child_pid_ = vfork();
-  if (d_->child_pid_ == -1) {
-    FAIL() << "Failed to fork a process for dummy X server: "
-    << std::strerror(errno);
-  } else if (!d_->child_pid_) { /* Child */
-    close(0);
-    close(1);
-    close(2);
-
-    execlp("Xorg", "Xorg", display_string, "-config", d_->path_to_conf_.c_str(),
-        NULL);
-    perror("Failed to start dummy X server");
-    exit(-1);
-  } else { /* Parent */
-    setenv("DISPLAY", display_string, true);
-
-    for (int i = 0; i < 10; /*++i*/) {
-      Display* display = XOpenDisplay(NULL);
-
-      if (display) {
-        XCloseDisplay(display);
-        return;
-      }
-
-      int status;
-      int pid = waitpid(d_->child_pid_, &status, WNOHANG);
-      if (pid == d_->child_pid_) {
-        d_->child_pid_ = -1;
-        FAIL() << "Dummy X server failed to start, did you run as root?";
-        return;
-      } else if (pid == 0) {
-        sleep(1); /* Give the dummy X server some time to start */
-        continue;
-      } else if (pid == -1) {
-        FAIL() << "Could not get status of dummy X server process: "
-        << std::strerror(errno);
-        return;
-      } else {
-        FAIL() << "Invalid child PID returned by waitpid()";
-        return;
-      }
-    }
-
-    FAIL() << "Unable to open connection to dummy X server";
-  }
-#endif
 }

 void xorg::testing::Environment::TearDown() {
@@ -143,15 +94,4 @@
       FAIL() << "Warning: Failed to kill dummy Xorg server: "
           << std::strerror(errno);
   }
-#if 0
-  if (d_->child_pid_ && d_->child_pid_ != -1) {
-    if (kill(d_->child_pid_, SIGTERM) < 0) {
-      FAIL() << "Warning: Failed to terminate dummy Xorg server: "
-      << std::strerror(errno);
-      if (kill(d_->child_pid_, SIGKILL))
-      FAIL() << "Warning: Failed to kill dummy Xorg server: "
-      << std::strerror(errno);
-    }
-  }
-#endif
 }


INTEGRATION: CWS changefileheader (1.24.2); FILE MERGED 2008/04/01 16:07:43 thb 1.24.2.3: #i85898# Stripping all external header guards 2008/04/01 13:02:58 thb 1.24.2.2: #i85898# Stripping all external header guards 2008/03/31 13:04:25 rt 1.24.2.1: #i87441# Change license header to LPGL v3.

--- xmlhelp/source/cxxhelp/provider/provider.cxx
+++ xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -1,35 +1,30 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
- *
- *  $RCSfile: provider.cxx,v $
- *
- *  $Revision: 1.24 $
- *
- *  last change: $Author: obo $ $Date: 2008-03-25 15:21:52 $
- *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: provider.cxx,v $
+ * $Revision: 1.25 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/

@@ -43,36 +38,20 @@
  *************************************************************************/

 #include <stdio.h>
-#ifndef _OSL_FILE_HXX_
 #include <osl/file.hxx>
-#endif
 #ifndef _VOS_DIAGNOSE_HXX_
 #include <vos/diagnose.hxx>
 #endif
-#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
 #include <ucbhelper/contentidentifier.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_
 #include <com/sun/star/frame/XConfigManager.hpp>
-#endif
 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
 #include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
 #include <com/sun/star/beans/PropertyState.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
 #include <com/sun/star/container/XContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
 #include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_
 #include <com/sun/star/container/XNameReplace.hpp>
-#endif
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>


quieter

quieter

git-svn-id: 17d41c460f3ddabe6271dd210d2e0bf85f349cae@988 29311d96-e01e-0410-9327-a35deaab8ce9

--- ceph/msg/NewMessenger.cc
+++ ceph/msg/NewMessenger.cc
@@ -151,12 +151,12 @@

   // register
   if (rank.entity_map.count(entity)) {
-    dout(0) << "namer.handle_register re-registering " << entity
+    dout(1) << "namer.handle_register re-registering " << entity
             << " inst " << m->get_source_inst()
             << " (was " << rank.entity_map[entity] << ")"
             << endl;
   } else {
-    dout(0) << "namer.handle_register registering " << entity
+    dout(1) << "namer.handle_register registering " << entity
             << " inst " << m->get_source_inst()
             << endl;
   }
@@ -196,7 +196,7 @@
 void Rank::Namer::handle_unregister(Message *m)
 {
   msg_addr_t who = m->get_source();
-  dout(0) << "namer.handle_unregister entity " << who << endl;
+  dout(1) << "namer.handle_unregister entity " << who << endl;

   rank.show_dir();

@@ -903,7 +903,7 @@
     local[raddr] = messenger = new EntityMessenger(raddr);
     messenger->set_dispatcher(this);

-    dout(0) << "start_rank " << my_rank << " at " << my_inst << endl;
+    dout(1) << "start_rank " << my_rank << " at " << my_inst << endl;
   }

   lock.Unlock();
@@ -1568,10 +1568,10 @@

   // stop my dispatch thread
   if (dispatch_thread.am_self()) {
-    dout(0) << "shutdown i am dispatch, setting stop flag" << endl;
+    dout(1) << "shutdown i am dispatch, setting stop flag" << endl;
     stop = true;
   } else {
-    dout(0) << "shutdown i am not dispatch, setting stop flag and joining thread." << endl;
+    dout(1) << "shutdown i am not dispatch, setting stop flag and joining thread." << endl;
     lock.Lock();
     stop = true;
     cond.Signal();


Use GetDeclarationLocationOfFunction in ShowSourceCode

`OrbitApp::ShowSourceCode` used to determine the jump location in a
source code file by getting LineInfo for the first instruction of the
function. This LineInfo does not necessarily need to be associated with
the first C++-statement.

We actually wanna jump to the first line of the function's declaration,
not to the first statement. So this commit introduces
`GetDeclarationLocationOfFunction` to determine the correct first source
code line.

--- src/OrbitGl/App.cpp
+++ src/OrbitGl/App.cpp
@@ -544,15 +544,16 @@
           [this, module,
            function](const std::filesystem::path& local_file_path) -> ErrorMessageOr<void> {
             const auto elf_file = orbit_elf_utils::ElfFile::Create(local_file_path);
-            const auto first_line_info_or_error = elf_file.value()->GetLineInfo(function.address());
-
-            if (first_line_info_or_error.has_error()) {
+            const auto decl_line_info_or_error =
+                elf_file.value()->GetDeclarationLocationOfFunction(function.address());
+
+            if (decl_line_info_or_error.has_error()) {
               return ErrorMessage{absl::StrFormat(
-                  "Could not find source code line info for function \"%s\" in module \"%s\": %s",
+                  "Could not find source code location of function \"%s\" in module \"%s\": %s",
                   function.pretty_name(), module->file_path(),
-                  first_line_info_or_error.error().message())};
+                  decl_line_info_or_error.error().message())};
             }
-            const auto& line_info = first_line_info_or_error.value();
+            const auto& line_info = decl_line_info_or_error.value();
             auto source_file_path =
                 std::filesystem::path{line_info.source_file()}.lexically_normal();


Bugfix: update action time while send reply

--- pink/src/worker_thread.cc
+++ pink/src/worker_thread.cc
@@ -158,6 +158,7 @@
         }
         if (pfe->mask & EPOLLOUT) {
           WriteStatus write_status = in_conn->SendReply();
+          in_conn->set_last_interaction(now);
           if (write_status == kWriteAll) {
             in_conn->set_is_reply(false);
             pink_epoll_->PinkModEvent(pfe->fd, 0, EPOLLIN);


fix openni_save_image - flip images vertically for proper orientation

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@4882 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- tools/openni_save_image.cpp
+++ tools/openni_save_image.cpp
@@ -47,6 +47,7 @@
 #include <vtkBMPWriter.h>
 #include <vtkPNGWriter.h>
 #include <vtkTIFFWriter.h>
+#include <vtkImageFlip.h>
 #include <vector>
 #include <string>

@@ -83,13 +84,15 @@
       : grabber_ (grabber),
         importer_ (vtkSmartPointer<vtkImageImport>::New ()),
         depth_importer_ (vtkSmartPointer<vtkImageImport>::New ()),
-        writer_ (vtkSmartPointer<vtkTIFFWriter>::New ())
+        writer_ (vtkSmartPointer<vtkTIFFWriter>::New ()),
+        flipper_ (vtkSmartPointer<vtkImageFlip>::New ())
     {
       importer_->SetNumberOfScalarComponents (3);
       importer_->SetDataScalarTypeToUnsignedChar ();
       depth_importer_->SetNumberOfScalarComponents (1);
       depth_importer_->SetDataScalarTypeToUnsignedShort ();
       writer_->SetCompressionToPackBits ();
+      flipper_->SetFilteredAxes (1);
     }

     void
@@ -148,8 +151,10 @@
           ss << "frame_" + time + "_rgb.tiff";
           importer_->SetImportVoidPointer (data, 1);
           importer_->Update ();
+          flipper_->SetInputConnection (importer_->GetOutputPort ());
+          flipper_->Update ();
           writer_->SetFileName (ss.str ().c_str ());
-          writer_->SetInputConnection (importer_->GetOutputPort ());
+          writer_->SetInputConnection (flipper_->GetOutputPort ());
           writer_->Write ();
         }

@@ -165,8 +170,10 @@
           depth_importer_->SetDataExtentToWholeExtent ();
           depth_importer_->SetImportVoidPointer ((void*)depth_image->getDepthMetaData ().Data (), 1);
           depth_importer_->Update ();
+          flipper_->SetInputConnection (depth_importer_->GetOutputPort ());
+          flipper_->Update ();
           writer_->SetFileName (ss.str ().c_str ());
-          writer_->SetInputConnection (depth_importer_->GetOutputPort ());
+          writer_->SetInputConnection (flipper_->GetOutputPort ());
           writer_->Write ();
         }
       }
@@ -185,6 +192,7 @@
     boost::shared_ptr<openni_wrapper::DepthImage> depth_image_;
     vtkSmartPointer<vtkImageImport> importer_, depth_importer_;
     vtkSmartPointer<vtkTIFFWriter> writer_;
+    vtkSmartPointer<vtkImageFlip> flipper_;
 };

 void


Quaternion blending fixed

Quaternion blending fixed

--- DEM/Low/src/Animation/AnimationBlender.cpp
+++ DEM/Low/src/Animation/AnimationBlender.cpp
@@ -79,19 +79,23 @@
 			{
 				const float Weight = std::min(SourceWeight, 1.f - RotationWeights);

-				// TODO: check this hardcore stuff for multiple quaternion blending:
-				// https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20070017872.pdf
-				// Impl: http://wiki.unity3d.com/index.php/Averaging_Quaternions_and_Vectors
-				// Impl: https://github.com/christophhagen/averaging-quaternions/blob/master/averageQuaternions.py
+				quaternion Q;
+				Q.x = CurrTfm.Rotation.x * Weight;
+				Q.y = CurrTfm.Rotation.y * Weight;
+				Q.z = CurrTfm.Rotation.z * Weight;
+				Q.w = CurrTfm.Rotation.w * Weight;
+
 				if (FinalMask & ETransformChannel::Rotation)
 				{
-					quaternion Q;
-					Q.slerp(quaternion::Identity, CurrTfm.Rotation, Weight);
-					FinalTfm.Rotation *= Q;
+					// Blend with shortest arc, based on a 4D dot product sign
+					if (Q.x * FinalTfm.Rotation.x + Q.y * FinalTfm.Rotation.y + Q.z * FinalTfm.Rotation.z + Q.w * FinalTfm.Rotation.w < 0.f)
+						FinalTfm.Rotation -= Q;
+					else
+						FinalTfm.Rotation += Q;
 				}
 				else
 				{
-					FinalTfm.Rotation.slerp(quaternion::Identity, CurrTfm.Rotation, Weight);
+					FinalTfm.Rotation = Q;
 				}

 				FinalMask |= ETransformChannel::Rotation;


add missing null checks

add missing null checks

--- features/FEATURE_BLE/source/generic/GenericGap.cpp
+++ features/FEATURE_BLE/source/generic/GenericGap.cpp
@@ -1782,7 +1782,8 @@
 void GenericGap::on_connection_parameter_request(const pal::GapRemoteConnectionParameterRequestEvent &e)
 {
     if (_user_manage_connection_parameter_requests) {
-        _eventHandler->onUpdateConnectionParametersRequest(
+        if (_eventHandler) {
+            _eventHandler->onUpdateConnectionParametersRequest(
                 UpdateConnectionParametersRequestEvent(
                     e.connection_handle,
                     conn_interval_t(e.min_connection_interval),
@@ -1791,6 +1792,7 @@
                     supervision_timeout_t(e.supervision_timeout)
                 )
             );
+        }
     } else {
         _pal_gap.accept_connection_parameter_request(
             e.connection_handle,
@@ -1806,6 +1808,10 @@

 void GenericGap::on_connection_update(const pal::GapConnectionUpdateEvent &e)
 {
+    if (!_eventHandler) {
+        return;
+    }
+
     _eventHandler->onConnectionParametersUpdateComplete(
         ConnectionParametersUpdateCompleteEvent(
             e.status == pal::hci_error_code_t::SUCCESS ? BLE_ERROR_NONE : BLE_ERROR_UNSPECIFIED,


Backport llvm PPC codegen fixes.

Backport llvm PPC codegen fixes.

--- interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ interpreter/llvm/src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -1029,23 +1029,23 @@
     writeInt16BE(LocalAddress, applyPPCha(Delta));
   } break;
   case ELF::R_PPC64_ADDR32: {
-    int32_t Result = static_cast<int32_t>(Value + Addend);
-    if (SignExtend32<32>(Result) != Result)
+    int64_t Result = static_cast<int64_t>(Value + Addend);
+    if (SignExtend64<32>(Result) != Result)
       llvm_unreachable("Relocation R_PPC64_ADDR32 overflow");
     writeInt32BE(LocalAddress, Result);
   } break;
   case ELF::R_PPC64_REL24: {
     uint64_t FinalAddress = Section.getLoadAddressWithOffset(Offset);
-    int32_t delta = static_cast<int32_t>(Value - FinalAddress + Addend);
-    if (SignExtend32<26>(delta) != delta)
+    int64_t delta = static_cast<int64_t>(Value - FinalAddress + Addend);
+    if (SignExtend64<26>(delta) != delta)
       llvm_unreachable("Relocation R_PPC64_REL24 overflow");
     // Generates a 'bl <address>' instruction
     writeInt32BE(LocalAddress, 0x48000001 | (delta & 0x03FFFFFC));
   } break;
   case ELF::R_PPC64_REL32: {
     uint64_t FinalAddress = Section.getLoadAddressWithOffset(Offset);
-    int32_t delta = static_cast<int32_t>(Value - FinalAddress + Addend);
-    if (SignExtend32<32>(delta) != delta)
+    int64_t delta = static_cast<int64_t>(Value - FinalAddress + Addend);
+    if (SignExtend64<32>(delta) != delta)
       llvm_unreachable("Relocation R_PPC64_REL32 overflow");
     writeInt32BE(LocalAddress, delta);
   } break;
@@ -1514,12 +1514,13 @@
       Obj.getPlatformFlags(AbiVariant);
       AbiVariant &= ELF::EF_PPC64_ABI;
       // A PPC branch relocation will need a stub function if the target is
-      // an external symbol (Symbol::ST_Unknown) or if the target address
-      // is not within the signed 24-bits branch address.
+      // an external symbol (either Value.SymbolName is set, or SymType is
+      // Symbol::ST_Unknown) or if the target address is not within the
+      // signed 24-bits branch address.
       SectionEntry &Section = Sections[SectionID];
       uint8_t *Target = Section.getAddressWithOffset(Offset);
       bool RangeOverflow = false;
-      if (SymType != SymbolRef::ST_Unknown) {
+      if (!Value.SymbolName && SymType != SymbolRef::ST_Unknown) {
         if (AbiVariant != 2) {
           // In the ELFv1 ABI, a function call may point to the .opd entry,
           // so the final symbol value is calculated based on the relocation
@@ -1534,21 +1535,19 @@
         }
         uint8_t *RelocTarget =
             Sections[Value.SectionID].getAddressWithOffset(Value.Addend);
-        int32_t delta = static_cast<int32_t>(Target - RelocTarget);
+        int64_t delta = static_cast<int64_t>(Target - RelocTarget);
         // If it is within 26-bits branch range, just set the branch target
-        if (SignExtend32<26>(delta) == delta) {
+        if (SignExtend64<26>(delta) == delta) {
           RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
-          if (Value.SymbolName)
-            addRelocationForSymbol(RE, Value.SymbolName);
-          else
-            addRelocationForSection(RE, Value.SectionID);
+          addRelocationForSection(RE, Value.SectionID);
         } else {
           RangeOverflow = true;
         }
       }
-      if (SymType == SymbolRef::ST_Unknown || RangeOverflow) {
-        // It is an external symbol (SymbolRef::ST_Unknown) or within a range
-        // larger than 24-bits.
+      if (Value.SymbolName || SymType == SymbolRef::ST_Unknown ||
+          RangeOverflow) {
+        // It is an external symbol (either Value.SymbolName is set, or
+        // SymType is SymbolRef::ST_Unknown) or out of range.
         StubMap::const_iterator i = Stubs.find(Value);
         if (i != Stubs.end()) {
           // Symbol function stub already created, just relocate to it
@@ -1602,7 +1601,7 @@
                             RelType, 0);
           Section.advanceStubOffset(getMaxStubSize());
         }
-        if (SymType == SymbolRef::ST_Unknown) {
+        if (Value.SymbolName || SymType == SymbolRef::ST_Unknown) {
           // Restore the TOC for external calls
           if (AbiVariant == 2)
             writeInt32BE(Target + 4, 0xE8410018); // ld r2,28(r1)


fcgi/Client: _FillBucketList() returns multiple STDOUT packets

--- src/fcgi/Client.cxx
+++ src/fcgi/Client.cxx
@@ -767,18 +767,72 @@
     }

     auto b = socket.ReadBuffer();
-    if (b.size > content_length)
-        b.size = content_length;
-
-    if (b.IsEmpty()) {
+    auto data = (const uint8_t *)b.data;
+    const auto end = data + b.size;
+
+    off_t available = response.available;
+    size_t current_content_length = content_length;
+    size_t current_skip_length = skip_length;
+
+    bool found_end_request = false;
+
+    while (true) {
+        if (current_content_length > 0) {
+            const size_t remaining = end - data;
+            size_t size = std::min(remaining, current_content_length);
+            if (available > 0) {
+                if ((off_t)size < available)
+                    size = available;
+                available -= size;
+            }
+
+            list.Push(ConstBuffer<void>(data, size));
+            data += size;
+            current_content_length -= size;
+
+            if (current_content_length > 0)
+                break;
+        }
+
+        if (current_skip_length > 0) {
+            const size_t remaining = end - data;
+            size_t size = std::min(remaining, current_skip_length);
+            data += size;
+            current_skip_length -= size;
+
+            if (current_skip_length > 0)
+                break;
+        }
+
+        const auto &header = *(const struct fcgi_record_header *)data;
+        const size_t remaining = end - data;
+        if (remaining < sizeof(header))
+            break;
+
+        if (header.request_id != id) {
+            /* ignore packets from other requests */
+            current_skip_length = sizeof(header)
+                + FromBE16(header.content_length)
+                + header.padding_length;
+            continue;
+        }
+
+        if (header.type != FCGI_STDOUT) {
+            if (header.type == FCGI_END_REQUEST)
+                found_end_request = true;
+
+            break;
+        }
+
+        current_content_length = FromBE16(header.content_length);
+        current_skip_length = header.padding_length;
+
+        data += sizeof(header);
+    }
+
+    if (available > 0 || (available < 0 && !found_end_request))
         list.SetMore();
-        return true;
-    }
-
-    list.Push(ConstBuffer<void>(b.data, b.size));
-
-    if (response.available < 0 || (off_t)b.size != response.available)
-        list.SetMore();
+
     return true;
 }

@@ -788,16 +842,67 @@
     assert(response.available != 0);
     assert(response.read_state == Response::READ_BODY);
     assert(!response.stderr);
-    assert(content_length > 0);
-
-    if (nbytes > content_length)
-        nbytes = content_length;
-
-    socket.Consumed(nbytes);
-    Consumed(nbytes);
-    content_length -= nbytes;
-
-    return nbytes;
+
+    size_t total = 0;
+
+    while (nbytes > 0) {
+        if (content_length > 0) {
+            size_t consumed = std::min(nbytes, content_length);
+            if (response.available > 0 && (off_t)consumed < response.available)
+                consumed = response.available;
+
+            socket.Consumed(consumed);
+            content_length -= consumed;
+            nbytes -= consumed;
+            total += consumed;
+
+            if (response.available > 0)
+                response.available -= consumed;
+
+            if (content_length > 0)
+                break;
+        }
+
+        if (skip_length > 0) {
+            const auto b = socket.ReadBuffer();
+            if (b.IsEmpty())
+                break;
+
+            size_t consumed = std::min(b.size, skip_length);
+            socket.Consumed(consumed);
+            skip_length -= consumed;
+
+            if (skip_length > 0)
+                break;
+        }
+
+        const auto b = socket.ReadBuffer();
+        const auto &header = *(const struct fcgi_record_header *)b.data;
+        if (b.size < sizeof(header))
+            break;
+
+        if (header.request_id != id) {
+            /* ignore packets from other requests */
+            skip_length = sizeof(header) + FromBE16(header.content_length)
+                + header.padding_length;
+            continue;
+        }
+
+        if (header.type != FCGI_STDOUT)
+            break;
+
+        content_length = FromBE16(header.content_length);
+        skip_length = header.padding_length;
+
+        socket.Consumed(sizeof(header));
+    }
+
+    assert(nbytes == 0);
+
+    if (total > 0)
+        Consumed(total);
+
+    return total;
 }

 /*


UDPSocket: Fixing multicast join/leave for non-source-filtered multicast operations. ip_mreq vs ip_mreq_source structure difference which was failing silently

--- platform/gucefCOMCORE/src/CUDPSocket.cpp
+++ platform/gucefCOMCORE/src/CUDPSocket.cpp
@@ -1257,7 +1257,7 @@
                              const CIPAddress& networkInterfaceToJoinOn )
 {GUCEF_TRACE;

-    struct ip_mreq_source imr;
+    struct ip_mreq imr;
     memset( &imr, 0, sizeof( imr ) );
     #if ( GUCEF_PLATFORM == GUCEF_PLATFORM_MSWIN )
     imr.imr_multiaddr.S_un.S_addr = multicastGroup.GetAddress();
@@ -1320,7 +1320,7 @@
 CUDPSocket::Leave( const CIPAddress& multicastGroup )
 {GUCEF_TRACE;

-    struct ip_mreq_source imr;
+    struct ip_mreq imr;
     memset( &imr, 0, sizeof( imr ) );
     #if ( GUCEF_PLATFORM == GUCEF_PLATFORM_MSWIN )
     imr.imr_multiaddr.S_un.S_addr = multicastGroup.GetAddress();


BLE: Check supervision timeout value in connect.

--- features/FEATURE_BLE/source/generic/GenericGap.cpp
+++ features/FEATURE_BLE/source/generic/GenericGap.cpp
@@ -654,6 +654,17 @@
         return BLE_ERROR_INVALID_PARAM;
     }

+    for (size_t i = 0; i < connectionParams.getPhySet().count(); ++i) {
+        if (supervision_timeout_t(connectionParams.getConnectionSupervisionTimeoutArray()[i]) <=
+            minSupervisionTimeout(
+                conn_interval_t(connectionParams.getMaxConnectionIntervalArray()[i]),
+                slave_latency_t(connectionParams.getSlaveLatencyArray()[i])
+            )
+        ) {
+            return BLE_ERROR_INVALID_PARAM;
+        }
+    }
+
     if (!is_extended_advertising_available()) {
         phy_set_t set(connectionParams.getPhySet());
         if (set.count() != 1 || set.get_1m() == false) {


Small code simplification

Small code simplification

--- lib/src/functions.cpp
+++ lib/src/functions.cpp
@@ -685,8 +685,7 @@
 	str.replace("\\r\\n", "\\n");

 	// Headers
-	QRegularExpression header("^(#+)([^#].*)$");
-	header.setPatternOptions(QRegularExpression::MultilineOption);
+	QRegularExpression header("^(#+)([^#].*)$", QRegularExpression::MultilineOption);
 	auto matches = header.globalMatch(str);
 	while (matches.hasNext()) {
 		auto match = matches.next();


Fixing protobuf error

Fixing protobuf error

--- arduino/src/uplink.cpp
+++ arduino/src/uplink.cpp
@@ -21,7 +21,7 @@

 void uplink_sendStatus(void){

-    antikeimena_Status status_pb;
+    antikeimena_Status status_pb = antikeimena_Status_init_zero;

     status_pb.version       = 12;
     status_pb.uptime        = 13;
@@ -30,18 +30,22 @@
     pb_ostream_t stream = pb_ostream_from_buffer(uplink_send_buffer, sizeof(uplink_send_buffer));
     pb_encode(&stream, antikeimena_Status_fields, &status_pb);

-    uint16_t s = antikeimena_Status_size;
+    uint16_t mysize = stream.bytes_written;

     Serial.write("ANSI");
+    Serial.flush();
+
     Serial.write(STATUS_MESSAGE);
+    Serial.flush();

-    Serial.write( (s     ) & 0xFF); // low
-    Serial.write( (s >> 8) & 0xFF); // high
+    Serial.write( (mysize     ) & 0xFF); // low
+    Serial.write( (mysize >> 8) & 0xFF); // high
+    Serial.flush();

-    for(uint32_t i = 0; i < antikeimena_Status_size; i++) {
+    for(uint32_t i = 0; i < mysize; i++) {
         Serial.write(uplink_send_buffer[i]);
     }
-
+    Serial.flush();
 }

 void uplink_sendSensor(void){


use dynamic step size of ball search grid in top and bottom image

--- NaoTHSoccer/Source/Core/Cognition/Modules/Perception/VisualCortex/Detectors/MaximumRedBallDetector.cpp
+++ NaoTHSoccer/Source/Core/Cognition/Modules/Perception/VisualCortex/Detectors/MaximumRedBallDetector.cpp
@@ -85,18 +85,14 @@

   int stepSize = params.stepSize;

-  if(cameraID == CameraInfo::Bottom)
-  {
-    if(getCameraMatrix().rotation.getYAngle() > Math::fromDegrees(40))
-    {
-      stepSize *= 3;
-    }
-    else if(getCameraMatrix().rotation.getYAngle() > Math::fromDegrees(10))
-    {
-      stepSize *= 2;
-    }
-  }
-
+  if(getCameraMatrix().rotation.getYAngle() > Math::fromDegrees(40))
+  {
+    stepSize *= 3;
+  }
+  else if(getCameraMatrix().rotation.getYAngle() > Math::fromDegrees(10))
+  {
+    stepSize *= 2;
+  }

   for(point.y = minY; point.y < (int) getImage().height() - 3 ; point.y += stepSize) {
     for(point.x = 0; point.x < (int) getImage().width(); point.x += stepSize)


INTEGRATION: CWS ooo20040704 (1.2.58); FILE MERGED 2004/07/19 05:50:45 svesik 1.2.58.3: RESYNC: (1.2-1.3); FILE MERGED 2004/07/02 10:21:15 cmc 1.2.58.2: #i30891# revert header and namespace change 2004/06/28 12:23:42 cmc 1.2.58.1: #i30801 allow using system stl if possible

--- framework/inc/xml/toolboxdocumenthandler.hxx
+++ framework/inc/xml/toolboxdocumenthandler.hxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: toolboxdocumenthandler.hxx,v $
  *
- *  $Revision: 1.3 $
- *
- *  last change: $Author: obo $ $Date: 2004-07-06 16:55:36 $
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: rt $ $Date: 2004-09-08 14:10:56 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -94,9 +94,7 @@
 #include <cppuhelper/weak.hxx>
 #endif

-#ifndef __SGI_STL_HASH_MAP
 #include <hash_map>
-#endif

 #ifndef __FRAMEWORK_STDTYPES_H_
 #include <stdtypes.h>


Update for conv2

Update for conv2

--- test/conv_test.hpp
+++ test/conv_test.hpp
@@ -17,18 +17,17 @@
 CONV_FUNCTOR( std_conv1_full, etl::impl::standard::conv1_full(a, b, c) )
 CONV_FUNCTOR( reduc_conv1_full, etl::impl::reduc::conv1_full(a, b, c) )

-//MMUL_FUNCTOR( lazy_mmul, c = etl::lazy_mmul(a, b) )
-//MMUL_FUNCTOR( strassen_mmul, c = etl::strassen_mmul(a, b) )
-//MMUL_FUNCTOR( eblas_mmul_float, etl::impl::eblas::fast_sgemm(a, b, c) )
-//MMUL_FUNCTOR( eblas_mmul_double, etl::impl::eblas::fast_dgemm(a, b, c) )
+CONV_FUNCTOR( default_conv2_full, c = etl::conv_2d_full(a, b) )
+CONV_FUNCTOR( std_conv2_full, etl::impl::standard::conv2_full(a, b, c) )
+CONV_FUNCTOR( reduc_conv2_full, etl::impl::reduc::conv2_full(a, b, c) )

 #define CONV1_FULL_TEST_CASE_SECTION_DEFAULT   CONV_TEST_CASE_SECTIONS( default_conv1_full, default_conv1_full )
 #define CONV1_FULL_TEST_CASE_SECTION_STD       CONV_TEST_CASE_SECTIONS( std_conv1_full, std_conv1_full )
 #define CONV1_FULL_TEST_CASE_SECTION_REDUC     CONV_TEST_CASE_SECTIONS( reduc_conv1_full, reduc_conv1_full )

-//#define MMUL_TEST_CASE_SECTION_LAZY      MMUL_TEST_CASE_SECTIONS( lazy_mmul, lazy_mmul )
-//#define MMUL_TEST_CASE_SECTION_STRASSEN  MMUL_TEST_CASE_SECTIONS( strassen_mmul, strassen_mmul )
-//#define MMUL_TEST_CASE_SECTION_EBLAS     MMUL_TEST_CASE_SECTIONS( eblas_mmul_float, eblas_mmul_double )
+#define CONV2_FULL_TEST_CASE_SECTION_DEFAULT   CONV_TEST_CASE_SECTIONS( default_conv2_full, default_conv2_full )
+#define CONV2_FULL_TEST_CASE_SECTION_STD       CONV_TEST_CASE_SECTIONS( std_conv2_full, std_conv2_full )
+#define CONV2_FULL_TEST_CASE_SECTION_REDUC     CONV_TEST_CASE_SECTIONS( reduc_conv2_full, reduc_conv2_full )

 //#ifdef ETL_BLAS_MODE
 //MMUL_FUNCTOR( blas_mmul_float, etl::impl::blas::sgemm(a, b, c) )
@@ -44,7 +43,7 @@
     TEST_CASE( name, description )

 #define CONV_TEST_CASE_SECTION( Tn, Impln) \
-        SECTION( #Tn #Impln ) \
+        SECTION( #Tn "_" #Impln ) \
         { \
             INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_TE____T_E_S_T____ )<Tn, Impln>(); \
         }
@@ -65,3 +64,12 @@
         CONV1_FULL_TEST_CASE_SECTION_REDUC \
     } \
     CONV_TEST_CASE_DEFN
+
+#define CONV2_FULL_TEST_CASE( name, description ) \
+    CONV_TEST_CASE_DECL( name, description ) \
+    { \
+        CONV2_FULL_TEST_CASE_SECTION_DEFAULT \
+        CONV2_FULL_TEST_CASE_SECTION_STD \
+        CONV2_FULL_TEST_CASE_SECTION_REDUC \
+    } \
+    CONV_TEST_CASE_DEFN


changed backplot file from .xml to .nc.xml

--- src/PythonStuff.cpp
+++ src/PythonStuff.cpp
@@ -71,12 +71,8 @@
 		// in Windows, at least, executing the bat file was making HeeksCAD change it's Z order
 		heeksCAD->GetMainFrame()->Raise();

-		// there should now be nccode.xml written
-#ifdef WIN32
-		wxString xml_file_str = theApp.GetDllFolder() + wxString(_T("/")) + filepath + wxString(_T(".xml"));
-#else
+		// there should now be a .nc.xml written
 		wxString xml_file_str = theApp.GetDllFolder() + wxString(_T("/")) + filepath + wxString(_T(".nc.xml"));
-#endif
 		wxFile ofs(xml_file_str.c_str());
 		if(!ofs.IsOpened())
 		{


INTEGRATION: CWS oj14 (1.5.8); FILE MERGED 2007/06/04 18:14:43 oj 1.5.8.6: RESYNC: (1.7-1.9); FILE MERGED 2006/11/07 09:19:11 oj 1.5.8.5: RESYNC: (1.6-1.7); FILE MERGED 2006/07/04 07:53:59 oj 1.5.8.4: RESYNC: (1.5-1.6); FILE MERGED 2006/04/25 13:02:50 oj 1.5.8.3: new include 2006/03/20 07:48:21 oj 1.5.8.2: use of module client helper 2006/01/03 07:49:06 oj 1.5.8.1: changed module client

--- dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ConnectionPageSetup.cxx,v $
  *
- *  $Revision: 1.9 $
- *
- *  last change: $Author: kz $ $Date: 2007-05-10 10:22:01 $
+ *  $Revision: 1.10 $
+ *
+ *  last change: $Author: rt $ $Date: 2007-07-06 08:10:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -44,9 +44,6 @@
 #endif
 #ifndef _DBAUI_DBADMINSETUP_HRC_
 #include "dbadminsetup.hrc"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
-#include "moduledbu.hxx"
 #endif
 #ifndef _DBU_DLG_HRC_
 #include "dbu_dlg.hrc"


Patch from Melchior Franz:

Patch from Melchior Franz:

From the cosmetics department ...

--- simgear/misc/props.cxx
+++ simgear/misc/props.cxx
@@ -1926,7 +1926,7 @@
 {
 				// Don't delete the value; we don't own
 				// the pointer.
-  delete _key;
+  delete [] _key;
 }

 void
@@ -1966,7 +1966,7 @@
     for (i = 0; i < _length; i++) {
       new_entries[i] = _entries[i];
     }
-    delete _entries;
+    delete [] _entries;
     _entries = new_entries;
     _entries[_length] = new entry;
     _entries[_length]->set_key(key);


Fixed failing unit tests on Linux due to NUM_TERMS_IN_VOCAB_A

--- platform/tests/VocabularyConfigTests.cpp
+++ platform/tests/VocabularyConfigTests.cpp
@@ -212,8 +212,10 @@
 		return boost::regex_search(file_contents, regex);
 	}

-	static const size_t NUM_TERMS_IN_VOCAB_A = 9;
+	static const size_t NUM_TERMS_IN_VOCAB_A;
 };
+
+const size_t VocabularyConfigWithPreExistingConfigFileOpen_F::NUM_TERMS_IN_VOCAB_A = 9;

 BOOST_AUTO_TEST_SUITE_FIXTURE_TEMPLATE(VocabularyConfigWithPreExistingConfigFileOpen_S,
 									   boost::mpl::list<VocabularyConfigWithPreExistingConfigFileOpen_F>)
@@ -223,7 +225,7 @@
 }

 BOOST_AUTO_TEST_CASE_FIXTURE_TEMPLATE(checkVocabSize) {
-	BOOST_CHECK_EQUAL(F::getVocabulary().size(), NUM_TERMS_IN_VOCAB_A);
+	BOOST_CHECK_EQUAL(F::getVocabulary().size(), this->NUM_TERMS_IN_VOCAB_A);
 }

 BOOST_AUTO_TEST_CASE_FIXTURE_TEMPLATE(checkVocabularyConfigOptionValues) {
@@ -317,8 +319,8 @@
 									   boost::mpl::list<BoundVocabularyConfig_F>)

 BOOST_AUTO_TEST_CASE_FIXTURE_TEMPLATE(checkVocabSize) {
-	BOOST_CHECK_EQUAL(F::getVocabulary().size(), NUM_TERMS_IN_VOCAB_A);
-	BOOST_CHECK_EQUAL(F::m_vocabulary.size(), NUM_TERMS_IN_VOCAB_A);
+	BOOST_CHECK_EQUAL(F::getVocabulary().size(), this->NUM_TERMS_IN_VOCAB_A);
+	BOOST_CHECK_EQUAL(F::m_vocabulary.size(), this->NUM_TERMS_IN_VOCAB_A);
 }

 BOOST_AUTO_TEST_CASE_FIXTURE_TEMPLATE(checkIdValues) {
@@ -412,9 +414,9 @@

 	// look up the term using the ID
 	Vocabulary::TermRef term_ref = F::m_vocabulary.findTerm(new_term.term_id);
-	BOOST_CHECK_EQUAL(term_ref, static_cast<Vocabulary::TermRef>(NUM_TERMS_IN_VOCAB_A + 1));
+	BOOST_CHECK_EQUAL(term_ref, static_cast<Vocabulary::TermRef>(this->NUM_TERMS_IN_VOCAB_A + 1));
 	term_ref = F::getVocabulary().findTerm(new_term.term_id);
-	BOOST_CHECK_EQUAL(term_ref, static_cast<Vocabulary::TermRef>(NUM_TERMS_IN_VOCAB_A + 1));
+	BOOST_CHECK_EQUAL(term_ref, static_cast<Vocabulary::TermRef>(this->NUM_TERMS_IN_VOCAB_A + 1));

 	// check Term member values
 	BOOST_CHECK_EQUAL(F::m_vocabulary[term_ref].term_id, new_term.term_id);


BLE: Mark LEGACY_ADVERTISING_HANDLE as active in initialization.

--- features/FEATURE_BLE/source/generic/GenericGap.cpp
+++ features/FEATURE_BLE/source/generic/GenericGap.cpp
@@ -458,6 +458,7 @@
             LEGACY_ADVERTISING_HANDLE,
             AdvertisingParameters()
         );
+        _active_sets.set(LEGACY_ADVERTISING_HANDLE);
     }
 }


INTEGRATION: CWS changefileheader (1.5.182); FILE MERGED 2008/03/31 13:27:54 rt 1.5.182.1: #i87441# Change license header to LPGL v3.

--- dbaccess/source/ui/misc/documentcontroller.cxx
+++ dbaccess/source/ui/misc/documentcontroller.cxx
@@ -1,35 +1,30 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: documentcontroller.cxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.5 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: ihi $ $Date: 2007-04-16 16:28:39 $
+ * $RCSfile: documentcontroller.cxx,v $
+ * $Revision: 1.6 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/


Teste de unidade para a DCEL

Teste de unidade para a DCEL

Signed-off-by: Paulo Roberto Urio <3fe8ccac6a69f4d3f38aa33cd87259c4db9a160f@gmail.com>

--- test/dcel_check.cc
+++ test/dcel_check.cc
@@ -35,36 +35,41 @@
 	twinOrigin->setIncidentEdge(*outTwinHalfEdge);
 }

+static MyDCEL::Face* createFace(MyDCEL& d, int id)
+{
+	MyDCEL::Face* face = d.createGetFace(NULL);
+
+	EXPECT_TRUE(face != NULL) << "Face não alocada.";
+	face->getData() = new FaceInfo(id);
+	return face;
+}
+

 TEST(DCELCheckTest, UnitTestingFrameworkWorks)
 {
 	LOG(INFO) << "Starting DCEL check test.";
 	const size_t VERTICES = 4;
-	const size_t EDGES = 10;
+	const size_t EDGES = 4;
 	const size_t FACES = 2;

+	/* Criar DCEL alocando espaço o necessário */
 	MyDCEL d(VERTICES, EDGES, FACES);
-
 	EXPECT_TRUE(d.getVertices().capacity() == VERTICES) << "Memória não alocada para os vértices.";
 	EXPECT_TRUE(d.getHalfEdges().capacity() == EDGES * 2) << "Memória não alocada para as meia arestas.";
 	EXPECT_TRUE(d.getFaces().capacity() == FACES) << "Memória não alocada para as faces.";

+	/* Criar os vértices */
 	MyDCEL::Vertex* v1 = createVertex(d, 0, 4);
 	MyDCEL::Vertex* v2 = createVertex(d, 2, 4);
 	MyDCEL::Vertex* v3 = createVertex(d, 2, 2);
 	MyDCEL::Vertex* v4 = createVertex(d, 1, 1);

-	MyDCEL::Face* f1 = d.createGetFace(NULL);
-	MyDCEL::Face* f2 = d.createGetFace(NULL);
+	/* Criar as faces */
+	MyDCEL::Face* f1 = createFace(d, 1);
+	MyDCEL::Face* f2 = createFace(d, 2);

-	f1->getData() = new FaceInfo(1);
-	f2->getData() = new FaceInfo(2);
-
-	EXPECT_TRUE(f1 != NULL) << "Face 1 não criada";
-	EXPECT_TRUE(f2 != NULL) << "Face 2 não criada";
-
+	/* Criar as meias arestas */
 	MyDCEL::HalfEdge *e11, *e12, *e21, *e22, *e31, *e32, *e41, *e42;
-
 	e11 = e12 = e21 = e22 = e31 = e32 = e41 = e42 = NULL;

 	/*  		  Src 	Face 	TwinSrc	TwinFace	HalfEdge	TwinHalfEdge */
@@ -87,6 +92,7 @@

 	d.checkAllFaces();

+	/* Limpar a DCEL */
 	delete f1->getData();
 	delete f2->getData();

@@ -96,8 +102,6 @@
 	delete v4->getData();
 	d.clear();

-	//d.getFace(0)->getData() = 0;
-
 	LOG(INFO) << "Finishing DCEL check test.";
 }


PRD: runtime IUE handling in MNFG mode

PRD: runtime IUE handling in MNFG mode

Change-Id: If2fe71e7f614d24d0ec72ad03868ec9ff451b379
RTC: 171867
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39176
Tested-by: Jenkins Server <8e3f934e4c44875bc48d33da3ea13d93ba9a233f@us.ibm.com>
Tested-by: Jenkins OP Build CI <e610bd72261d3c0a48f1e8ae36832ab00774d426@us.ibm.com>
Tested-by: FSP CI Jenkins <aa9e4d9ac7cd25905e9c0dd36d4150516e73dd86@us.ibm.com>
Reviewed-by: Zane C. Shelley <fc96e127d170d6ac0b2af86a8a56f95974ff36e8@us.ibm.com>

--- src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C
+++ src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C
@@ -197,6 +197,78 @@

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

+template<TARGETING::TYPE T>
+uint32_t __handleRceEte( ExtensibleChip * i_chip, bool & o_errorsFound,
+                         STEP_CODE_DATA_STRUCT & io_sc );
+
+template<>
+uint32_t __handleRceEte<TYPE_MCA>( ExtensibleChip * i_chip,
+                                   bool & o_errorsFound,
+                                   STEP_CODE_DATA_STRUCT & io_sc )
+{
+    #define PRDF_FUNC "[__handleRceEte] "
+
+    uint32_t o_rc = SUCCESS;
+
+    // Should only get this attention in MNFG mode.
+    PRDF_ASSERT( mfgMode() );
+
+    do
+    {
+        // The RCE ETE attention could be from IUE, IMPE, or IRCD. Need to check
+        // MCAECCFIR[37] to determine if there was at least one IUE.
+        SCAN_COMM_REGISTER_CLASS * fir = i_chip->getRegister( "MCAECCFIR" );
+        o_rc = fir->Read();
+        if ( SUCCESS != o_rc )
+        {
+            PRDF_ERR( PRDF_FUNC "Read() failed on MCAECCFIR: i_chip=0x%08x",
+                      i_chip->getHuid() );
+            break;
+        }
+        if ( !fir->IsBitSet(37) ) break; // nothing else to do
+
+        // Handle the IUE.
+        o_errorsFound = true;
+        io_sc.service_data->AddSignatureList( i_chip->getTrgt(),
+                                              PRDFSIG_MaintIUE );
+        o_rc = MemEcc::analyzeMaintIue<TYPE_MCA,McaDataBundle *>(i_chip, io_sc);
+        if ( SUCCESS != o_rc )
+        {
+            PRDF_ERR( PRDF_FUNC "analyzeMaintIue(0x%08x) failed",
+                      i_chip->getHuid() );
+            break;
+        }
+
+    } while (0);
+
+    return o_rc;
+
+    #undef PRDF_FUNC
+}
+
+/* TODO RTC 157888
+template<>
+uint32_t __handleRceEte<TYPE_MBA>( ExtensibleChip * i_chip,
+                                   bool & o_errorsFound,
+                                   STEP_CODE_DATA_STRUCT & io_sc )
+{
+    #define PRDF_FUNC "[__handleRceEte] "
+
+    uint32_t o_rc = SUCCESS;
+
+    do
+    {
+
+    } while (0);
+
+    return o_rc;
+
+    #undef PRDF_FUNC
+}
+*/
+
+//------------------------------------------------------------------------------
+
 template <TARGETING::TYPE T, typename D>
 uint32_t __checkEcc( ExtensibleChip * i_chip, TdQueue & io_queue,
                      const MemAddr & i_addr, bool & o_errorsFound,
@@ -334,9 +406,12 @@

         if ( 0 != (eccAttns & MAINT_RCE_ETE) )
         {
-            o_errorsFound = true;
-
-            // TODO: RTC 171867
+            o_rc = __handleRceEte<T>( i_chip, o_errorsFound, io_sc );
+            if ( SUCCESS != o_rc )
+            {
+                PRDF_ERR( PRDF_FUNC "__handleRceEte<T>(0x%08x) failed", huid );
+                break;
+            }
         }

         if ( 0 != (eccAttns & MAINT_UE) )


remove additional strand from intersect -bed -abam

--- src/utils/BamTools-Ancillary/BamAncillary.cpp
+++ src/utils/BamTools-Ancillary/BamAncillary.cpp
@@ -109,7 +109,7 @@

         // identify which indices relate to the "other"
         // (i,e. non-BED6) fields
-        for (size_t i = 5; i <= 11; ++i)
+        for (size_t i = 6; i <= 11; ++i)
             bed.other_idxs.push_back(i);
     }
 }


* Disable policy bit on resolve NH in vrouter

In case of gateway interface, a subnet route is created with
resolve NH with policy enabled if gateway has some policies
the same bit gets copied over the ARP NH created from this nexthop.
If policy bit is enabled in kernel then flow could get created
with resolve NH as key, for the very nexthop packet different flow
would be created using ARP NH, resolve the same by disabling
policy in vrouter
Closes-bug:#1566980

Change-Id: Idf70b22907902c2812624a6e7db74b438934c0fc

--- src/vnsw/agent/vrouter/ksync/nexthop_ksync.cc
+++ src/vnsw/agent/vrouter/ksync/nexthop_ksync.cc
@@ -770,6 +770,17 @@
             break;

         case NextHop::RESOLVE:
+            if (policy_) {
+                //Policy bit is used in agent to copy over the
+                //field to ARP nexthop that gets created from
+                //resolve NH in case of gateway interface,
+                //but the same is not needed in vrouter.
+                //If policy bit is enabled then first packet
+                //resulting flow with key NH of resolve NH
+                //followed by next packet with ARP NH as key
+                //resulting in flow drops
+                flags &= ~NH_FLAG_POLICY_ENABLED;
+            }
             encoder.set_nhr_type(NH_RESOLVE);
             break;


Implemented face eval for Disc FE in 2d, now do it in 1d and 3d also

--- src/fe/ElemType.cpp
+++ src/fe/ElemType.cpp
@@ -853,10 +853,22 @@

         constexpr unsigned int dim = 2;
+
+      basis* underlying_volume_basis;
+
+       if( _SolType < 3 ) {
+           underlying_volume_basis = _pt_basis;
+       }
+       else if( _SolType < 5 ) {
+              if( _GeomElemType == QUAD) underlying_volume_basis = new QuadLinear;
+         else if( _GeomElemType == TRI)  underlying_volume_basis = new TriLinear;
+       }
+
+

-#if PHIFACE_ONLY_FOR_LAGRANGIAN_FAMILIES == 1
-       if(_SolType < 3) {
-#endif
+// // // #if PHIFACE_ONLY_FOR_LAGRANGIAN_FAMILIES == 1
+// // //        if(_SolType < 3) {
+// // // #endif

 //----- auxiliary basis for the faces //(the reference element has straight edges)
       basis* linearLine = new LineLinear;
@@ -868,7 +880,7 @@
       const double* xi_ptr = {faceGaussPoint.GetGaussWeightsPointer() + faceGaussPoint.GetGaussPointsNumber()};
 // --------- quadrature

-      unsigned nFaces = _pt_basis->faceNumber[2];
+      unsigned nFaces = /*_pt_basis*/underlying_volume_basis->faceNumber[2];

       _phiFace.resize(nFaces);
       _gradPhiFace.resize(nFaces);
@@ -882,9 +894,9 @@
         std::vector< double > yv_face(n_face_dofs);

         for(int jnode = 0; jnode < n_face_dofs; jnode++) {
-          unsigned iDof = _pt_basis->GetFaceDof(iface, jnode);
-          xv_face[jnode] = *(_pt_basis->GetXcoarse(iDof) + 0);
-          yv_face[jnode] = *(_pt_basis->GetXcoarse(iDof) + 1);
+          unsigned iDof = /*_pt_basis*/underlying_volume_basis->GetFaceDof(iface, jnode);
+          xv_face[jnode] = *(/*_pt_basis*/underlying_volume_basis->GetXcoarse(iDof) + 0);
+          yv_face[jnode] = *(/*_pt_basis*/underlying_volume_basis->GetXcoarse(iDof) + 1);
         }

         unsigned nGaussPts = faceGaussPoint.GetGaussPointsNumber();
@@ -923,28 +935,24 @@
       }
       delete linearLine;

-#if PHIFACE_ONLY_FOR_LAGRANGIAN_FAMILIES == 1
-    }
-    else if(_SolType < 5) {
-       // if I am a Disc element, I don't have the nodes with me,
-       // but I need them in order to compute the face quadrature points.
-       // These are needed to locate the boundary quadrature points correctly on each face
-       // Basically, I need the underlying element, or more precisely the underlying Geometric Element
-       // in 2d, it is either a Quad or a Tri, and it will only be one of them
-
-
-      basis* underlying_volume_basis;
-            if( _GeomElemType == QUAD) underlying_volume_basis = new QuadLinear;
-       else if( _GeomElemType == TRI)  underlying_volume_basis = new TriLinear;
-
-
-
-
-      delete underlying_volume_basis;
-    }
-#endif
-
-
+// // // #if PHIFACE_ONLY_FOR_LAGRANGIAN_FAMILIES == 1
+// // //     }
+// // //     else if(_SolType < 5) {
+// // //        // if I am a Disc element, I don't have the nodes with me,
+// // //        // but I need them in order to compute the face quadrature points.
+// // //        // These are needed to locate the boundary quadrature points correctly on each face
+// // //        // Basically, I need the underlying element, or more precisely the underlying Geometric Element
+// // //        // in 2d, it is either a Quad or a Tri, and it will only be one of them
+// // //
+// // //
+// // //     }
+// // // #endif
+
+
+if( _SolType >= 3 && _SolType < 5 ) {
+    delete underlying_volume_basis;
+}
+
    }

       void elem_type_3D::allocate_and_fill_volume_shape_at_reference_boundary_quadrature_points_on_faces(const char* order_gauss)  {


Патч отменен

Патч отменен

--- search.cpp
+++ search.cpp
@@ -15,6 +15,10 @@
 		}
 	}

+	//k7/1p6/8/8/8/4Qppp/5pqq/3K4 w - - 0 1
+	/*if(!b.hash_enable) {
+		return 0;
+	}*/

 	if(real_depth) {
 		max_real_depth = std::max(max_real_depth, real_depth);
@@ -131,15 +135,14 @@
 	}

 	if(option.futility_pruning && !extended && !inCheck && !b.currentState.attacked && depth <= 2 && !inNullMove && !onPV) { //Futility pruning
-		if(/*b.getEvalute()*/quies(b, alpha, beta, rule, real_depth) - PAWN_EV / 2 >= beta) {
+		if(b.getEvalute() - PAWN_EV / 2 >= beta) {
 			return beta;
 		}
 	}

 	if(option.razoring && !extended && !inCheck && !b.currentState.attacked && !inNullMove && depth <= 4 && !onPV) { //Razoring
-		if(/*b.getEvalute()*/quies(b, alpha, beta, rule, real_depth) - QUEEN_EV >= beta) {
-			return beta;
-			//--nextDepth;
+		if(b.getEvalute() - QUEEN_EV >= beta) {
+			--nextDepth;
 		}
 	}


Remove postgres warning about duplicate column names

This seemed to be an error for older postgres servers.

--- src/condor_c++_util/sqlquery.C
+++ src/condor_c++_util/sqlquery.C
@@ -387,7 +387,7 @@
 			"DECLARE HISTORY_OWNER_VER_CUR CURSOR FOR SELECT hv.cluster_id,hv.proc_id,hv.attr,hv.val FROM "
 			"Jobs_Horizontal_History hh, Jobs_Vertical_History hv "
 			"WHERE hh.cluster_id=hv.cluster_id AND hh.proc_id=hv.proc_id AND hh.owner='%s' %s "
-			" ORDER BY scheddname, cluster_id,proc_id;",
+			" ORDER BY hh.scheddname, cluster_id,proc_id;",
 			((char *)parameters[0]), schedd_predicate_hh.Value() );
 		sprintf(fetch_cursor_str,
 			"FETCH FORWARD 5000 FROM HISTORY_OWNER_VER_CUR");


Fixed incorrect results given by lookup of attributes that have been modified in the current qmgmt transaction. #2101

This fixes an observed inaccuracy in accounting of nice_user jobs.

--- src/condor_schedd.V6/qmgmt.cpp
+++ src/condor_schedd.V6/qmgmt.cpp
@@ -2947,9 +2947,13 @@
 	IdToStr(cluster_id,proc_id,key);

 	if( JobQueue->LookupInTransaction(key, attr_name, attr_val) ) {
-		sscanf(attr_val, "%f", val);
+		ClassAd tmp_ad;
+		tmp_ad.AssignExpr(attr_name,attr_val);
 		free( attr_val );
-		return 1;
+		if( tmp_ad.LookupFloat(attr_name, *val) == 1) {
+			return 0;
+		}
+		return -1;
 	}

 	if (!JobQueue->LookupClassAd(key, ad)) {
@@ -2971,9 +2975,13 @@
 	IdToStr(cluster_id,proc_id,key);

 	if( JobQueue->LookupInTransaction(key, attr_name, attr_val) ) {
-		sscanf(attr_val, "%d", val);
+		ClassAd tmp_ad;
+		tmp_ad.AssignExpr(attr_name,attr_val);
 		free( attr_val );
-		return 1;
+		if( tmp_ad.LookupInteger(attr_name, *val) == 1) {
+			return 0;
+		}
+		return -1;
 	}

 	if (!JobQueue->LookupClassAd(key, ad)) {
@@ -2995,9 +3003,13 @@
 	IdToStr(cluster_id,proc_id,key);

 	if( JobQueue->LookupInTransaction(key, attr_name, attr_val) ) {
-		sscanf(attr_val, "%d", val);
+		ClassAd tmp_ad;
+		tmp_ad.AssignExpr(attr_name,attr_val);
 		free( attr_val );
-		return 1;
+		if( tmp_ad.LookupBool(attr_name, *val) == 1) {
+			return 0;
+		}
+		return -1;
 	}

 	if (!JobQueue->LookupClassAd(key, ad)) {
@@ -3025,15 +3037,13 @@
 	IdToStr(cluster_id,proc_id,key);

 	if( JobQueue->LookupInTransaction(key, attr_name, attr_val) ) {
-		int attr_len = strlen( attr_val );
-		if ( attr_val[0] != '"' || attr_val[attr_len-1] != '"' ) {
-			free( attr_val );
-			return -1;
-		}
-		attr_val[attr_len - 1] = '\0';
-		*val = strdup(&attr_val[1]);
+		ClassAd tmp_ad;
+		tmp_ad.AssignExpr(attr_name,attr_val);
 		free( attr_val );
-		return 1;
+		if( tmp_ad.LookupString(attr_name, val) == 1) {
+			return 0;
+		}
+		return -1;
 	}

 	if (!JobQueue->LookupClassAd(key, ad)) {
@@ -3060,16 +3070,14 @@
 	IdToStr(cluster_id,proc_id,key);

 	if( JobQueue->LookupInTransaction(key, attr_name, attr_val) ) {
-		int attr_len = strlen( attr_val );
-		if ( attr_val[0] != '"' || attr_val[attr_len-1] != '"' ) {
-			free( attr_val );
-			val = "";
-			return -1;
-		}
-		attr_val[attr_len - 1] = '\0';
-		val = attr_val + 1;
+		ClassAd tmp_ad;
+		tmp_ad.AssignExpr(attr_name,attr_val);
 		free( attr_val );
-		return 1;
+		if( tmp_ad.LookupString(attr_name, val) == 1) {
+			return 0;
+		}
+		val = "";
+		return -1;
 	}

 	if (!JobQueue->LookupClassAd(key, ad)) {


Reliability bugfixes

Reliability bugfixes

git-svn-id: ffc1bc5b3feaf8644044862cc38c386ade156493@2096 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- src/mesh/mesh_refinement_flagging.C
+++ src/mesh/mesh_refinement_flagging.C
@@ -1,5 +1,5 @@

-// $Id: mesh_refinement_flagging.C,v 1.31 2007-07-02 16:10:52 friedmud Exp $
+// $Id: mesh_refinement_flagging.C,v 1.32 2007-09-19 19:47:37 roystgnr Exp $

 // The libMesh Finite Element Library.
 // Copyright (C) 2002-2005  Benjamin S. Kirk, John W. Peterson
@@ -172,7 +172,7 @@

   // How much error per cell will we tolerate?
   const Real local_refinement_tolerance =
-    _absolute_global_tolerance / _mesh.n_active_elem();
+    _absolute_global_tolerance / std::sqrt(_mesh.n_active_elem());
   const Real local_coarsening_tolerance =
     local_refinement_tolerance * _coarsen_threshold;

@@ -255,9 +255,9 @@
   // The target number of elements to add or remove
   const int n_elem_new = _nelem_target - n_active_elem;

-  // Create an error vector with active elements only,
+  // Create an vector with active element errors and ids,
   // sorted by highest errors first
-  std::vector<float> sorted_error;
+  std::vector<std::pair<float, unsigned int> > sorted_error;

   sorted_error.reserve (n_active_elem);

@@ -265,8 +265,13 @@
   const MeshBase::element_iterator elem_end = _mesh.active_elements_end();

   for (; elem_it != elem_end; ++elem_it)
-    sorted_error.push_back (error_per_cell[(*elem_it)->id()]);
-
+    {
+      unsigned int eid = (*elem_it)->id();
+      sorted_error.push_back
+        (std::make_pair(error_per_cell[eid], eid));
+    }
+
+  // Default sort works since pairs are sorted lexicographically
   std::sort (sorted_error.begin(), sorted_error.end());
   std::reverse (sorted_error.begin(), sorted_error.end());

@@ -321,41 +326,29 @@
          refine_count < max_elem_refine &&
          coarsen_count < sorted_parent_error.size() &&
          refine_count < sorted_error.size() &&
-         sorted_error[refine_count] >
+         sorted_error[refine_count].first >
 	 sorted_parent_error[coarsen_count] * _coarsen_threshold)
   {
     coarsen_count++;
     refine_count++;
   }

-  unsigned int successful_refine_count = 0;
   if (refine_count > max_elem_refine)
     refine_count = max_elem_refine;
-  if (refine_count)
-  {
-    // Find out what our refinement error limit is
-    Real max_refinable_error = sorted_error.back();
-
-    if (refine_count < sorted_error.size())
-      max_refinable_error = sorted_error[refine_count-1];
-
-    // Flag elements for refinement
-    elem_it  = _mesh.active_elements_begin();
-    for (; elem_it != elem_end; ++elem_it)
-    {
-      Elem* elem = *elem_it;
-
-      if (max_elem_refine && refine_count &&
-	  error_per_cell[elem->id()] >= max_refinable_error &&
-	  elem->level() < _max_h_level)
-      {
-	elem->set_refinement_flag(Elem::REFINE);
-	successful_refine_count++;
-	if (successful_refine_count >= refine_count)
-	  break;
-      }
-    }
-  }
+  unsigned int successful_refine_count = 0;
+  for (unsigned int i=0; i != sorted_error.size(); ++i)
+    {
+      if (successful_refine_count >= refine_count)
+        break;
+
+      unsigned int eid = sorted_error[i].second;
+      Elem *elem = _mesh.elem(eid);
+      if (elem->level() < _max_h_level)
+        {
+	  elem->set_refinement_flag(Elem::REFINE);
+	  successful_refine_count++;
+        }
+    }

   // If we couldn't refine enough elements, don't coarsen too many
   // either


Remove useless cast

Remove useless cast

--- src/condor_sysapi/virt_mem.cpp
+++ src/condor_sysapi/virt_mem.cpp
@@ -72,7 +72,7 @@
 	/* in KB */
 	free_swap /= 1024.0;

-	if ((int)free_swap > INT_MAX)
+	if (free_swap > INT_MAX)
 	{
 		return INT_MAX;
 	}


generalized cardinality constraint: cardinality_any

--- src/metaSMT/support/cardinality.hpp
+++ src/metaSMT/support/cardinality.hpp
@@ -28,13 +28,91 @@
     return evaluate(ctx, Ite(ps[ps.size()-1], one_rail, zero_rail));
   }

+  /**
+   * Generalized cardinality constraint based on a construction using
+   * Binary Decision Diagrams (BDD) by E'{e}n and S\"orensson [1] and
+   * Bailleux et al. [2].
+   *
+   * [1] N. E'{e}n and N. S\"orensson. Translating pseudo-boolean
+   * constraints into SAT.  In Journal on Satisfiability, Boolean
+   * Modeling and Computation, volume 2, pages 1-26, 2006.
+   *
+   * [2] O. Bailleux, Y. Boufkhad, and O. Roussel, A Translation of
+   * Pseudo-Boolean Constraints to SAT, Journal on Satisfiability,
+   * Boolean Modeling and Computation, volume 2, pages 191-200, 2006.
+   *
+   * The tableau algorithm keeps only two rows of the tableau in
+   * memory which we call ``rails''.
+   *
+   * The construction applies to all operator types (<, <=, =, >=, >).
+   * An operator is selected by assigning values to the arguments lt,
+   * eq, gt, e.g., the less equal operator corresponds to lt = True,
+   * eq = True, gt = False.
+   *
+   * For instance, the constraint
+   *
+   *    ps[0] + ps[1] + ps[2] + ps[3] <=> 3 with <=> in {<, >, =, <=, >=}
+   *
+   * corresponds to the following tableau
+   *       RAILS  |   0    1     2     3
+   *              |          lt    lt    lt
+   *     ---------|------------------------
+   *        0     |    eq ps[0] ps[1] ps[2]
+   *        1  gt | ps[0] ps[1] ps[2] ps[3]
+   *
+   * From the bottom right node of the tableau a logic formula is
+   * constructed using the ITE-operator where the left neighbor node
+   * and the top neighbor node serve as the then and else part,
+   * respectively.
+   *
+   * Moreover, notice that cells with entries lt and gt are not
+   * explicitly saved in rails but are directly encoded when the
+   * formula is created.
+   *
+   * Precondition: ps.size > 0 && cardinality > 0 && ps.size() > cardinality
+   */
+  template <typename Context, typename Boolean, typename LT_Expr, typename EQ_Expr, typename GT_Expr>
+  typename Context::result_type
+  cardinality_any(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality,
+                  LT_Expr lt, EQ_Expr eq, GT_Expr gt) {
+    assert(ps.size() > 0 && "Cardinality constraint requires at least one input variable");
+    assert(cardinality > 0 && "Unsatisfied precondition for tableau construction");
+
+    assert( ps.size() > cardinality );
+
+    unsigned const rail_size = cardinality+1;
+    std::vector<typename Context::result_type> rails[2];
+    rails[0].resize(rail_size);
+    rails[1].resize(rail_size);
+
+    // Tableau algorithm - Iteratively calculate all elements
+    for (unsigned v = 0; v < ps.size() - cardinality + 1; ++v) {
+      for (unsigned u = 0; u < cardinality + 1; ++u) {
+        if (u == 0 && v == 0) {
+          rails[0][0] = evaluate(ctx, eq);
+        } else if (u == 0) {
+          rails[v%2][0] = evaluate(ctx, Ite(evaluate(ctx, ps[v-1]), gt, rails[(v-1)%2][0]));
+        } else if (v == 0) {
+          rails[0][u] = evaluate(ctx, Ite(evaluate(ctx, ps[u-1]), rails[0][u-1], lt));
+        } else {
+          rails[v%2][u] = evaluate(ctx, Ite(ps[u+v-1], rails[v%2][u-1], rails[(v-1)%2][u]));
+        }
+      }
+    }
+    return rails[(ps.size() - cardinality)%2][cardinality];
+  }
+
+
   template <typename Context, typename Boolean>
   typename Context::result_type
-  cardinality_geq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
-    assert(ps.size() > 0 && "Greater equal cardinality constraint requires at least one input variable");
-
-    if (ps.size() < cardinality) {
-      return evaluate(ctx, False);
+  cardinality_eq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
+    assert(ps.size() > 0 && "Equality cardinality constraint requires at least one input variable");
+
+    if (cardinality == 0) {
+      typename Context::result_type res = evaluate(ctx, True);
+      for (unsigned u = 0; u < ps.size(); ++u)
+        res = evaluate(ctx, And(res, Not(ps[u])));
+      return res;
     }

     if (ps.size() == cardinality) {
@@ -44,31 +122,60 @@
       return res;
     }

+    return cardinality_any(ctx, ps, cardinality, False, True, False);
+  }
+
+  template <typename Context, typename Boolean>
+  typename Context::result_type
+  cardinality_geq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
+    assert(ps.size() > 0 && "Greater equal cardinality constraint requires at least one input variable");
+
+    if (ps.size() < cardinality) {
+      return evaluate(ctx, False);
+    }
+
     if (cardinality == 0) {
       return evaluate(ctx, True);
     }

-    // Now: 0 <= cardinality < ps.size()
-    unsigned const rail_size = cardinality;
-    std::vector<typename Context::result_type> rails[2];
-    rails[0].resize(rail_size);
-    rails[1].resize(rail_size);
-
-    // Tableau algorithm - Iteratively calculate all elements
-    for (unsigned v = 0; v < ps.size() - cardinality + 1; ++v) {
-      for (unsigned u = 0; u < cardinality; ++u) {
-        if (u == 0 && v == 0) {
-          rails[0][0] = evaluate(ctx, ps[0]);
-        } else if (u == 0) {
-          rails[v%2][0] = evaluate(ctx, Ite(evaluate(ctx, ps[v]), True, rails[(v-1)%2][0]));
-        } else if (v == 0) {
-          rails[0][u] = evaluate(ctx, Ite(evaluate(ctx, ps[u]), rails[0][u-1], False));
-        } else {
-          rails[v%2][u] = evaluate(ctx, Ite(ps[u+v], rails[v%2][u-1], rails[(v-1)%2][u]));
-        }
-      }
+    if (ps.size() == cardinality) {
+      typename Context::result_type res = evaluate(ctx, True);
+      for (unsigned u = 0; u < ps.size(); ++u)
+        res = evaluate(ctx, And(res, ps[u]));
+      return res;
     }
-    return rails[(ps.size() - cardinality) % 2][cardinality - 1];
+
+    return cardinality_any(ctx, ps, cardinality, False, True, True);
+  }
+
+  template <typename Context, typename Boolean>
+  typename Context::result_type
+  cardinality_leq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
+    assert(ps.size() > 0 && "Lower equal cardinality constraint requires at least one input variable");
+
+    if (ps.size() < cardinality) {
+      return evaluate(ctx, True);
+    }
+
+    if (ps.size() == cardinality) {
+      return evaluate(ctx, True);
+    }
+
+    if (cardinality == 0) {
+      typename Context::result_type res = evaluate(ctx, True);
+      for (unsigned u = 0; u < ps.size(); ++u)
+        res = evaluate(ctx, And(res, Not(ps[u])));
+      return res;
+    }
+
+    return cardinality_any(ctx, ps, cardinality, True, True, False);
+  }
+
+  template <typename Context, typename Boolean>
+  typename Context::result_type
+  cardinality_gt(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
+    assert(ps.size() > 0 && "Greater than cardinality constraint requires at least one input variable");
+    return evaluate(ctx, Not(cardinality_leq(ctx, ps, cardinality)));
   }

   template <typename Context, typename Boolean>
@@ -78,26 +185,5 @@
     return evaluate(ctx, Not(cardinality_geq(ctx, ps, cardinality)));
   }

-  template <typename Context, typename Boolean>
-  typename Context::result_type
-  cardinality_leq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
-    assert(ps.size() > 0 && "Lower equal cardinality constraint requires at least one input variable");
-    return evaluate(ctx, Not(cardinality_geq(ctx, ps, cardinality+1)));
-  }
-
-  template <typename Context, typename Boolean>
-  typename Context::result_type
-  cardinality_gt(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
-    assert(ps.size() > 0 && "Greater than cardinality constraint requires at least one input variable");
-    return evaluate(ctx, Not(cardinality_leq(ctx, ps, cardinality)));
-  }
-
-  template <typename Context, typename Boolean>
-  typename Context::result_type
-  cardinality_eq(Context &ctx, std::vector<Boolean> const &ps, unsigned cardinality) {
-    assert(ps.size() > 0 && "Equality cardinality constraint requires at least one input variable");
-    return evaluate(ctx, And(cardinality_geq(ctx, ps, cardinality), cardinality_lt(ctx, ps, cardinality+1)));
-  }
-
 } // metaSMT


Geração de código de toc() corrigida.

Geração de código de toc() corrigida.

--- src/TocFunction.cpp
+++ src/TocFunction.cpp
@@ -14,5 +14,7 @@
     llvm::BasicBlock *mainBB = llvm::BasicBlock::Create(IR::Context, "toc", IR::MainFunction);
     IR::Builder.SetInsertPoint(mainBB);

+    this->body->generateCode();
+
     return mainBB;
 }


Use mapping of nodes by position rather than finding in sets

This solves a segfault we were getting due to invalid references. The find wasn't working when dropping nodes. If we actually use a map here then we can simply access the entry at the specified position and it works.

Contributes to issue CURA-4523.

--- src/TreeSupport.cpp
+++ src/TreeSupport.cpp
@@ -60,7 +60,7 @@
     {
         //Group together all nodes for each part.
         std::vector<PolygonsPart> parts = model_collision[0][layer_nr].splitIntoParts();
-        std::vector<std::unordered_set<Node>> nodes_per_part;
+        std::vector<std::unordered_map<Point, Node>> nodes_per_part;
         nodes_per_part.emplace_back(); //All nodes that aren't inside a part get grouped together in the 0th part.
         for (size_t part_index = 0; part_index < parts.size(); part_index++)
         {
@@ -70,7 +70,7 @@
         {
             if (node.to_buildplate)
             {
-                nodes_per_part[0].insert(node);
+                nodes_per_part[0][node.position] = node;
             }
             else
             {
@@ -79,7 +79,7 @@
                 {
                     if (parts[part_index].inside(node.position))
                     {
-                        nodes_per_part[part_index + 1].insert(node);
+                        nodes_per_part[part_index + 1][node.position] = node;
                         break;
                     }
                 }
@@ -87,12 +87,12 @@
         }
         //Create a MST for every part.
         std::vector<MinimumSpanningTree> spanning_trees;
-        for (std::unordered_set<Node> group : nodes_per_part)
+        for (const std::unordered_map<Point, Node> group : nodes_per_part)
         {
             std::unordered_set<Point> points_to_buildplate;
-            for (const Node& node : group)
-            {
-                points_to_buildplate.insert(node.position);
+            for (std::pair<Point, Node> entry : group)
+            {
+                points_to_buildplate.insert(entry.first); //Just the position of the node.
             }
             spanning_trees.emplace_back(points_to_buildplate);
         }
@@ -101,8 +101,9 @@
         {
             const MinimumSpanningTree& mst = spanning_trees[group_index];
             //In the first pass, merge all leaf nodes.
-            for (Node node : nodes_per_part[group_index])
-            {
+            for (std::pair<Point, Node> entry : nodes_per_part[group_index])
+            {
+                const Node node = entry.second;
                 std::vector<Point> neighbours = mst.adjacentNodes(node.position);
                 if (neighbours.size() == 1 && vSize2(neighbours[0] - node.position) < maximum_move_distance * maximum_move_distance) //This leaf is about to collapse. Merge it with the neighbour.
                 {
@@ -141,18 +142,16 @@
                     else
                     {
                         //We'll drop this node, but modify some of the properties of its neighbour.
-                        Node neighbour_finder;
-                        neighbour_finder.position = neighbours[0]; //Find the node by its position (which is the hash and equals function).
-                        std::unordered_set<Node>::iterator neighbour = nodes_per_part[group_index].find(neighbour_finder);
-                        neighbour->distance_to_top = std::max(neighbour->distance_to_top, node.distance_to_top);
-                        neighbour->support_roof_layers_below = std::max(neighbour->support_roof_layers_below, node.support_roof_layers_below);
-                        nodes_per_part[group_index].erase(node);
+                        Node& neighbour = nodes_per_part[group_index][neighbours[0]];
+                        neighbour.distance_to_top = std::max(neighbour.distance_to_top, node.distance_to_top);
+                        neighbour.support_roof_layers_below = std::max(neighbour.support_roof_layers_below, node.support_roof_layers_below);
                     }
                 }
             }
             //In the second pass, move all middle nodes.
-            for (Node node : nodes_per_part[group_index])
-            {
+            for (std::pair<Point, Node> entry : nodes_per_part[group_index])
+            {
+                Node node = entry.second;
                 Point next_layer_vertex = node.position;
                 std::vector<Point> neighbours = mst.adjacentNodes(node.position);
                 if (neighbours.size() > 1 || (neighbours.size() == 1 && vSize2(neighbours[0] - node.position) >= maximum_move_distance * maximum_move_distance)) //Only nodes that aren't about to collapse.


Make sure m_StackSizeToBeUsedInRepair Always has a valid value

--- src/UI/SlotArea.cpp
+++ src/UI/SlotArea.cpp
@@ -625,7 +625,8 @@

 cSlotAreaAnvil::cSlotAreaAnvil(cAnvilWindow & a_ParentWindow) :
 	cSlotAreaTemporary(3, a_ParentWindow),
-	m_MaximumCost(0)
+	m_MaximumCost(0),
+	m_StackSizeToBeUsedInRepair(0);
 {
 }

@@ -796,6 +797,7 @@
 		{
 			cItem NewSecondItem(*Item);
 			NewSecondItem.m_ItemCount -= m_StackSizeToBeUsedInRepair;
+			m_StackSizeToBeUsedInRepair = 0;
 			SetSlot(1, a_Player, NewSecondItem);
 		}
 		else