added new DEBUG mode for AssignBondOrderProcessor

DEBUG mode for atom penalty rules debugging

--- source/STRUCTURE/assignBondOrderProcessor.C
+++ source/STRUCTURE/assignBondOrderProcessor.C
@@ -44,6 +44,8 @@
 //#define UNNORMALIZED_DEBUG 1
 #undef UNNORMALIZED_DEBUG

+//#define DEBUG_RULES
+#undef DEBUG_RULES

 using namespace std;
 using namespace BALL::VIEW;
@@ -1578,7 +1580,26 @@
 #ifdef DEBUG_READ
 cout << "preassignPenaltyClasses_() HIT : " << at->getFullName() << " with index " << at->getIndex() << " assigned to block  "<< j+1 << " : " << block_definition_[j].first << "   "
 		<<  block_definition_[j].second << endl;
-#endif
+#endif
+
+
+#ifdef DEBUG_RULES
+	int valence = 0;
+	Atom::BondIterator b_it;
+	for (b_it=at->beginBond(); b_it != at->endBond(); b_it++)
+	{
+		valence+=b_it->getOrder();
+	}
+
+	int current_start_index   = block_to_start_idx_[j];
+	int current_start_valence = block_to_start_valence_[j];
+
+	if (penalties_[current_start_index + valence  - current_start_valence] > 0)
+	{
+		cout <<   at->getFullName()  << " :  Rule " << j+1 << "  penalty: " << 	penalties_[current_start_index + valence  - current_start_valence] << endl;
+	}
+#endif
+
 						// store the penalty block's index
 						// NOTE: we start counting at 0!
 						atom_to_block_[i][0]=j;


Catch and print exceptions in the CHECK macros

--- doc/examples/ecdsa_tests.cpp
+++ doc/examples/ecdsa_tests.cpp
@@ -27,8 +27,8 @@
 using namespace std;

 #define BOOST_AUTO_TEST_CASE(name) void name()
-#define BOOST_CHECK_MESSAGE(expr, print) if(!(expr)) std::cout << print << "\n";
-#define BOOST_CHECK(expr) if(!(expr)) std::cout << #expr << "\n";
+#define BOOST_CHECK_MESSAGE(expr, print) try { if(!(expr)) std::cout << print << "\n"; } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << "\n"; }
+#define BOOST_CHECK(expr) try { if(!(expr)) std::cout << #expr << "\n"; } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << "\n"; }

 namespace {

@@ -590,8 +590,8 @@

 int main()
    {
-    Botan::InitializerOptions init_options("");
-    Botan::LibraryInitializer init(init_options);
+   Botan::InitializerOptions init_options("");
+   Botan::LibraryInitializer init(init_options);

    test_hash_larger_than_n();
    test_message_larger_than_n();


PERF: PyBuffer importImageFilterWillOwnTheBuffer is constexpr

--- Modules/Bridge/NumPy/include/itkPyBuffer.hxx
+++ Modules/Bridge/NumPy/include/itkPyBuffer.hxx
@@ -158,7 +158,7 @@
   using InternalPixelType = typename TImage::InternalPixelType;
   using ImporterType = ImportImageContainer<SizeValueType, InternalPixelType>;
   typename ImporterType::Pointer importer = ImporterType::New();
-  const bool                     importImageFilterWillOwnTheBuffer = false;
+  constexpr bool                 importImageFilterWillOwnTheBuffer = false;
   InternalPixelType *            data = (InternalPixelType *)buffer;
   importer->SetImportPointer(data, numberOfPixels, importImageFilterWillOwnTheBuffer);


Go through vectors by reference in for each.

--- cPlusPlusPlusLib/StringFunctions.cpp
+++ cPlusPlusPlusLib/StringFunctions.cpp
@@ -61,11 +61,11 @@
 	while (!working_delims.empty())
 	{
 		std::vector<std::string> tmp_vec;
-		for (const std::string cur : ret_vec)
+		for (const std::string &cur : ret_vec)
 		{
 			std::vector<std::string> inner_vec = StringFunctions::splitIntoVector(cur, working_delims.front());

-			for (const std::string cur_in : inner_vec)
+			for (const std::string &cur_in : inner_vec)
 			{
 				tmp_vec.push_back(cur_in);
 			}


Added test for mitkLabel

Added test for mitkLabel

--- Modules/Multilabel/Testing/mitkLabelTest.cpp
+++ Modules/Multilabel/Testing/mitkLabelTest.cpp
@@ -0,0 +1,166 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "mitkLabel.h"
+#include "mitkStringProperty.h"
+#include <mitkTestFixture.h>
+#include <mitkTestingMacros.h>
+
+class mitkLabelTestSuite : public mitk::TestFixture
+{
+  CPPUNIT_TEST_SUITE(mitkLabelTestSuite);
+  MITK_TEST(TestSetLock);
+  MITK_TEST(TestSetVisibility);
+  MITK_TEST(TestSetOpacity);
+  MITK_TEST(TestSetName);
+  MITK_TEST(TestSetCenterOfMassIndex);
+  MITK_TEST(TestSetCenterOfMassCoordinates);
+  MITK_TEST(TestSetColor);
+  MITK_TEST(TestSetValue);
+  MITK_TEST(TestSetLayer);
+  MITK_TEST(TestSetProperty);
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+
+  void TestSetLock()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    CPPUNIT_ASSERT_MESSAGE("Initial label not locked", label->GetLocked() == true);
+
+    label->SetLocked(false);
+    CPPUNIT_ASSERT_MESSAGE("Label should not be locked", label->GetLocked() == false);
+  }
+
+  void TestSetVisibility()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    CPPUNIT_ASSERT_MESSAGE("Initial label not visible", label->GetVisible() == true);
+
+    label->SetVisible(false);
+    CPPUNIT_ASSERT_MESSAGE("Label should not be visible", label->GetVisible() == false);
+  }
+
+  void TestSetOpacity()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong opacity", mitk::Equal(label->GetOpacity(), 0.6f));
+
+    label->SetOpacity(0.32f);
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong opacity", mitk::Equal(label->GetOpacity(), 0.32f));
+  }
+
+  void TestSetName()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    std::string initialName("noName!");
+    std::string labelName = label->GetName();
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong name", initialName.compare(labelName) == 0);
+
+    label->SetName("AwesomeLabel");
+    labelName = label->GetName();
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong name", labelName.compare("AwesomeLabel") == 0);
+  }
+
+  void TestSetCenterOfMassIndex()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    mitk::Point3D currentIndex = label->GetCenterOfMassIndex();
+    mitk::Point3D indexToBeCompared;
+    indexToBeCompared.Fill(0);
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong center of mass index", mitk::Equal(currentIndex, indexToBeCompared));
+
+    indexToBeCompared.SetElement(1, 234.3f);
+    indexToBeCompared.SetElement(2, -53);
+    indexToBeCompared.SetElement(3, 120);
+    label->SetCenterOfMassIndex(indexToBeCompared);
+    currentIndex = label->GetCenterOfMassIndex();
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong center of mass index", mitk::Equal(currentIndex, indexToBeCompared));
+  }
+
+  void TestSetCenterOfMassCoordinates()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    mitk::Point3D currentPoint = label->GetCenterOfMassCoordinates();
+    mitk::Point3D pointToBeCompared;
+    pointToBeCompared.Fill(0);
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong center of mass index", mitk::Equal(currentPoint, pointToBeCompared));
+
+    pointToBeCompared.SetElement(1, 234.3f);
+    pointToBeCompared.SetElement(2, -53);
+    pointToBeCompared.SetElement(3, 120);
+    label->SetCenterOfMassCoordinates(pointToBeCompared);
+    currentPoint = label->GetCenterOfMassCoordinates();
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong center of mass index", mitk::Equal(currentPoint, pointToBeCompared));
+  }
+
+  void TestSetColor()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    mitk::Color currentColor = label->GetColor();
+    mitk::Color colorToBeCompared;
+    colorToBeCompared.Set(0,0,0);
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetBlue() == colorToBeCompared.GetBlue());
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetGreen() == colorToBeCompared.GetGreen());
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetRed() == colorToBeCompared.GetRed());
+
+    colorToBeCompared.Set(0.4f,0.3f,1.0f);
+    label->SetColor(colorToBeCompared);
+    currentColor = label->GetColor();
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetBlue() == colorToBeCompared.GetBlue());
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetGreen() == colorToBeCompared.GetGreen());
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong color", currentColor.GetRed() == colorToBeCompared.GetRed());
+  }
+
+  void TestSetValue()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    int initialValue(-1);
+    int valueToBeCompared = label->GetValue();
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong value", initialValue == valueToBeCompared);
+
+    label->SetValue(12345);
+    valueToBeCompared = 12345;
+    initialValue = label->GetValue();
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong value", initialValue == valueToBeCompared);
+  }
+
+  void TestSetLayer()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+    int initialLayer(-1);
+    int valueToBeCompared = label->GetValue();
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong value", initialLayer == valueToBeCompared);
+
+    label->SetLayer(2);
+    valueToBeCompared = 2;
+    initialLayer = label->GetLayer();
+    CPPUNIT_ASSERT_MESSAGE("Label has wrong value", initialLayer == valueToBeCompared);
+  }
+
+  void TestSetProperty()
+  {
+    mitk::Label::Pointer label = mitk::Label::New();
+
+    mitk::StringProperty::Pointer prop = mitk::StringProperty::New("abc");
+    label->SetProperty("cba",prop);
+    std::string propVal("");
+    label->GetStringProperty("cba", propVal);
+    CPPUNIT_ASSERT_MESSAGE("Initial label has wrong value", propVal.compare("abc") == 0);
+  }
+};
+
+MITK_TEST_SUITE_REGISTRATION(mitkLabel)


print call the g2d->print.

print call the g2d->print.

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

--- plugins/video/renderer/glide3/g3dglide.cpp
+++ plugins/video/renderer/glide3/g3dglide.cpp
@@ -38,6 +38,7 @@

 //#include "render/glide3/driver2d/g2d.h" @@@
 #include "cs3d/glide3/g3dglide.h"
+#include "cs2d/glide2common/iglide2d.h"

 void sys_fatalerror(char *str, HRESULT hRes = S_OK)
 {
@@ -91,6 +92,7 @@
 IMPLEMENT_IBASE (csGraphics3DGlide3x)
   IMPLEMENTS_INTERFACE (iPlugIn)
   IMPLEMENTS_INTERFACE (iGraphics3D)
+  IMPLEMENTS_INTERFACE (iHaloRasterizer)
 IMPLEMENT_IBASE_END

 /**
@@ -339,7 +341,15 @@
     return false;

   m_bVRetrace = config->GetYesNo("Glide3x","VRETRACE",FALSE);
-
+  iGraphics2DGlide *piGlide = QUERY_INTERFACE( m_piG2D, iGraphics2DGlide );
+  if (!piGlide){
+      SysPrintf( MSG_INITIALIZATION, "Could not set VRETRACE\n" );
+  }else{
+      SysPrintf( MSG_INITIALIZATION, "VRETRACE is %s\n", m_bVRetrace ? "on" : "off" );
+      piGlide->SetVRetrace( m_bVRetrace );
+      piGlide->DecRef();
+  }
+
   FxI32 grncard=0;

   grGet(GR_NUM_BOARDS, sizeof(FxI32), &grncard);
@@ -612,10 +622,7 @@
 /// do the page swap.
 void csGraphics3DGlide3x::Print(csRect* rect)
 {
-  if(m_bVRetrace)
-    grBufferSwap(1);
-  else
-    grBufferSwap(0);
+  m_piG2D->Print( rect );
 }

 /// Set the mode for the Z buffer (functionality also exists in SetRenderState).


Remove KDE 3 compatibility code

Remove KDE 3 compatibility code

svn path=/trunk/KDE/kdepim/kalarm/lib/; revision=476754

--- kalarm/lib/lineedit.cpp
+++ kalarm/lib/lineedit.cpp
@@ -26,7 +26,7 @@
 #include <QDropEvent>
 #include <QFocusEvent>

-#include <k3urldrag.h>
+#include <kurl.h>
 #include <kurlcompletion.h>

 #include <libkdepim/maillistdrag.h>
@@ -99,7 +99,7 @@
 		ok = false;   // don't accept "text/calendar" objects
 	else
 		ok = (data->hasText()
-		   || K3URLDrag::canDecode(e)
+		   || KURL::List::canDecode(data)
 		   || mType != Url && KPIM::MailListDrag::canDecode(e)
 		   || mType == Emails && KVCardDrag::canDecode(e));
 	if (ok)
@@ -130,7 +130,7 @@
 				setText(mailList.first().subject());    // replace any existing text
 		}
 	}
-	// This must come before K3URLDrag
+	// This must come before KURL
 	else if (mType == Emails
 	&&  KVCardDrag::canDecode(e)  &&  KVCardDrag::decode(e, addrList))
 	{
@@ -142,7 +142,7 @@
 				newEmails.append(em);
 		}
 	}
-	else if (K3URLDrag::decode(e, files)  &&  files.count())
+	else if (!(files = KURL::List::fromMimeData(data)).isEmpty())
 	{
 		// URL(s)
 		switch (mType)


Even if the server tells us on the SSL port, that it supports TLS, we don't
support TLS over SSL :-)

svn path=/trunk/kdenetwork/kmail/; revision=110194

--- kmail/accountdialog.cpp
+++ kmail/accountdialog.cpp
@@ -903,10 +903,11 @@
 {
   mServerTest = NULL;
   mPop.checkCapabilities->setEnabled(TRUE);
+  bool nc = list.findIndex("NORMAL-CONNECTION") != -1;
   mPop.usePipeliningCheck->setChecked(list.findIndex("PIPELINING") != -1);
-  mPop.encryptionNone->setEnabled(list.findIndex("NORMAL-CONNECTION") != -1);
+  mPop.encryptionNone->setEnabled(nc);
   mPop.encryptionSSL->setEnabled(list.findIndex("SSL") != -1);
-  mPop.encryptionTLS->setEnabled(list.findIndex("STLS") != -1);
+  mPop.encryptionTLS->setEnabled(list.findIndex("STLS") != -1 && nc);
   mPop.authPlain->setEnabled(list.findIndex("PLAIN") != -1);
   mPop.authLogin->setEnabled(list.findIndex("LOGIN") != -1);
   mPop.authCRAM_MD5->setEnabled(list.findIndex("CRAM-MD5") != -1);
@@ -920,9 +921,10 @@
 {
   mServerTest = NULL;
   mImap.checkCapabilities->setEnabled(TRUE);
-  mImap.encryptionNone->setEnabled(list.findIndex("NORMAL-CONNECTION") != -1);
+  bool nc = list.findIndex("NORMAL-CONNECTION") != -1;
+  mImap.encryptionNone->setEnabled(nc);
   mImap.encryptionSSL->setEnabled(list.findIndex("SSL") != -1);
-  mImap.encryptionTLS->setEnabled(list.findIndex("STARTTLS") != -1);
+  mImap.encryptionTLS->setEnabled(list.findIndex("STARTTLS") != -1 && nc);
   mImap.authPlain->setEnabled(list.findIndex("AUTH=PLAIN") != -1);
   mImap.authLogin->setEnabled(list.findIndex("AUTH=LOGIN") != -1);
   mImap.authCramMd5->setEnabled(list.findIndex("AUTH=CRAM-MD5") != -1);


Forwardport SVN commit 687341 by vkrause:

Fix crash when moving folders (Kolab issue 1846).

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

--- kmail/copyfolderjob.cpp
+++ kmail/copyfolderjob.cpp
@@ -93,8 +93,10 @@
     msgList.append( msgBase );
   }
   if ( msgList.count() == 0 ) {
+    mStorage->blockSignals( false );
+    // ### be careful, after slotCopyNextChild() the source folder
+    // (including mStorage) might already be deleted!
     slotCopyNextChild(); // no contents, check subfolders
-    mStorage->blockSignals( false );
   } else {
     KMCommand *command = new KMCopyCommand( mNewFolder, msgList );
     connect( command, SIGNAL( completed( KMCommand * ) ),


Fix a big mistake

Fix a big mistake


Improve warning message when extra attributes cannot be created


i965/fs: Rework compression control selection.

The next commit uses an add(16) with a UW destination with a stride of
2, which needs compression control since it's writing two registers. The
old code would have failed to set compression control correctly.

Reviewed-by: Jason Ekstrand <b186559eaedf698788888c8a2559b4efb4db10d6@intel.com>

--- src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1601,10 +1601,13 @@
          break;
       case 16:
       case 32:
-         if (type_sz(inst->dst.type) < sizeof(float))
+         /* If the instruction writes to more than one register, it needs to
+          * be a "compressed" instruction on Gen <= 5.
+          */
+         if (inst->exec_size * inst->dst.stride * type_sz(inst->dst.type) > 32)
+            brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
+         else
             brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
-         else
-            brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
          break;
       default:
          unreachable("Invalid instruction width");


i965/fs: Only unroll high-accuracy dFdy() from SIMD16 to SIMD8 on gen4 and IVB.

In commit 800610f (i965/fs: Improve accuracy of dFdy() to match
dFdx()) I unrolled the high-accuracy dFdy() computation from a single
SIMD16 instruction to two SIMD8 instructions because of text I found
in the i965 (gen4) PRM saying that instruction compression could not
be used in align16 mode.  I couldn't find similar text in later
hardware docs, and I observed problems trying to use instruction
compression on align16 mode on Ivy Bridge, so I assumed that the
restriction still applied and the associated documentation had simply
been lost.

After consultation with the hardware engineers, it turns out this is
not the case.  In point of fact, the restriction was dropped in gen5,
re-introduced in Ivy Bridge, and dropped again in Haswell.  The reason
I didn't notice this is that in the Ivy Bridge documentation, the
restriction was in a different section, and described using different
language.

Now that we know that the restriction only applies to Gen4 and Ivy
Bridge, we can limit the unrolling to those platforms.

Tested on gen5, gen6, and gen7 (both Ivy Bridge and Haswell).

Reviewed-by: Matt Turner <789b315743a28dd066a4ba1459c35951c291d8a6@gmail.com>
Reviewed-by: Eric Anholt <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@anholt.net>

--- src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -640,6 +640,30 @@
                          bool negate_value)
 {
    if (c->key.high_quality_derivatives) {
+      /* From the Ivy Bridge PRM, volume 4 part 3, section 3.3.9 (Register
+       * Region Restrictions):
+       *
+       *     In Align16 access mode, SIMD16 is not allowed for DW operations
+       *     and SIMD8 is not allowed for DF operations.
+       *
+       * In this context, "DW operations" means "operations acting on 32-bit
+       * values", so it includes operations on floats.
+       *
+       * Gen4 has a similar restriction.  From the i965 PRM, section 11.5.3
+       * (Instruction Compression -> Rules and Restrictions):
+       *
+       *     A compressed instruction must be in Align1 access mode. Align16
+       *     mode instructions cannot be compressed.
+       *
+       * Similar text exists in the g45 PRM.
+       *
+       * On these platforms, if we're building a SIMD16 shader, we need to
+       * manually unroll to a pair of SIMD8 instructions.
+       */
+      bool unroll_to_simd8 =
+         (dispatch_width == 16 &&
+          (brw->gen == 4 || (brw->gen == 7 && !brw->is_haswell)));
+
       /* produce accurate derivatives */
       struct brw_reg src0 = brw_reg(src.file, src.nr, 0,
                                     BRW_REGISTER_TYPE_F,
@@ -655,20 +679,13 @@
                                     BRW_SWIZZLE_ZWZW, WRITEMASK_XYZW);
       brw_push_insn_state(p);
       brw_set_access_mode(p, BRW_ALIGN_16);
-      brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+      if (unroll_to_simd8)
+         brw_set_compression_control(p, BRW_COMPRESSION_NONE);
       if (negate_value)
          brw_ADD(p, dst, src1, negate(src0));
       else
          brw_ADD(p, dst, src0, negate(src1));
-      if (dispatch_width == 16) {
-         /* From page 340 of the i965 PRM:
-          *
-          *     "A compressed instruction must be in Align1 access
-          *     mode. Align16 mode instructions cannot be compressed."
-          *
-          * Therefore, when doing a 16-wide dispatch, we need to manually
-          * unroll to two instructions.
-          */
+      if (unroll_to_simd8) {
          brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF);
          src0 = sechalf(src0);
          src1 = sechalf(src1);


Fix incorrect seeding (according to gcc and clang)

--- src/Utility/Random.cpp
+++ src/Utility/Random.cpp
@@ -20,7 +20,8 @@

 Random::Random_Bits_Generator Random::get_new_seeded_random_bit_source() noexcept
 {
-    return Random_Bits_Generator{Seeder{}};
+    auto seeder = Seeder{};
+    return Random_Bits_Generator(seeder);
 }

 double Random::random_laplace(double width) noexcept


Reuse random_integer() for random_unsigned_int64()

--- src/Utility/Random.cpp
+++ src/Utility/Random.cpp
@@ -2,6 +2,7 @@

 #include <random>
 #include <string>
+#include <limits>

 double Random::random_laplace(double width) noexcept
 {
@@ -13,9 +14,8 @@

 uint64_t Random::random_unsigned_int64() noexcept
 {
-    thread_local static std::mt19937_64 generator(std::random_device{}());
-    thread_local static std::uniform_int_distribution<uint64_t> dist;
-    return dist(generator);
+    return random_integer(std::numeric_limits<uint64_t>::min(),
+                          std::numeric_limits<uint64_t>::max());
 }

 bool Random::coin_flip() noexcept


Delete unneeded type conversion

Delete unneeded type conversion

--- src/Utility/String.cpp
+++ src/Utility/String.cpp
@@ -104,12 +104,12 @@

     if(start_comment_index == std::string::npos || end_comment_index == std::string::npos)
     {
-        throw std::invalid_argument("\"" + str + "\" is missing a comment delimiter: " + std::string{start} + std::string{end});
+        throw std::invalid_argument("\"" + str + "\" is missing a comment delimiter: " + start + end);
     }

     if(start_comment_index >= end_comment_index)
     {
-        throw std::invalid_argument("\"" + str + "\" contains bad comment delimiters: " + std::string{start} + std::string{end});
+        throw std::invalid_argument("\"" + str + "\" contains bad comment delimiters: " + start + end);
     }

     auto first_part = str.substr(0, start_comment_index);


Simplify String::remove_extra_whitespace()

--- src/Utility/String.cpp
+++ src/Utility/String.cpp
@@ -66,16 +66,14 @@

 std::string String::remove_extra_whitespace(const std::string& s) noexcept
 {
-    std::string s2 = trim_outer_whitespace(s);
-    std::replace_if(s2.begin(), s2.end(), [](auto c) { return String::contains(whitespace, c); }, ' ');
     std::string result;
-    std::copy_if(s2.begin(), s2.end(), std::back_inserter(result),
+    std::copy_if(s.begin(), s.end(), std::back_inserter(result),
                  [&result](auto c)
                  {
-                     return c != ' ' || result.back() != ' ';
+                     return ! isspace(c) || ( ! result.empty() && ! std::isspace(result.back()));
                  });

-    return result;
+    return trim_outer_whitespace(result);
 }

 std::string String::strip_comments(const std::string& str, const std::string& comment) noexcept


Fix signalling

Fix signalling

--- src/Vehicle/Vehicle.cc
+++ src/Vehicle/Vehicle.cc
@@ -202,17 +202,32 @@

 void Vehicle::_handleHomePosition(mavlink_message_t& message)
 {
+    bool emitHomePositionChanged =          false;
+    bool emitHomePositionAvailableChanged = false;
+
     mavlink_home_position_t homePos;

     mavlink_msg_home_position_decode(&message, &homePos);
-
-    _homePosition.setLatitude(homePos.latitude / 10000000.0);
-    _homePosition.setLongitude(homePos.longitude / 10000000.0);
-    _homePosition.setAltitude(homePos.altitude / 1000.0);
+
+    QGeoCoordinate newHomePosition (homePos.latitude / 10000000.0,
+                                    homePos.longitude / 10000000.0,
+                                    homePos.altitude / 1000.0);
+    if (newHomePosition != _homePosition) {
+        emitHomePositionChanged = true;
+        _homePosition = newHomePosition;
+    }
+
+    if (!_homePositionAvailable) {
+        emitHomePositionAvailableChanged = true;
+    }
     _homePositionAvailable = true;
-
-    emit homePositionChanged(_homePosition);
-    emit homePositionAvailableChanged(true);
+
+    if (emitHomePositionChanged) {
+        emit homePositionChanged(_homePosition);
+    }
+    if (emitHomePositionAvailableChanged) {
+        emit homePositionAvailableChanged(true);
+    }
 }

 void Vehicle::_handleHeartbeat(mavlink_message_t& message)


add NFCTaskModule.cpp

add NFCTaskModule.cpp

--- NFServer/NFGameLogicPlugin/NFCTaskModule.cpp
+++ NFServer/NFGameLogicPlugin/NFCTaskModule.cpp
@@ -0,0 +1,32 @@
+#include "NFCTaskModule.h"
+
+bool NFCTaskModule::Init()
+{
+    return true;
+}
+
+bool NFCTaskModule::Shut()
+{
+    return true;
+}
+
+bool NFCTaskModule::Execute( const float fLasFrametime, const float fStartedTime )
+{
+    return true;
+}
+
+bool NFCTaskModule::AfterInit()
+{
+    return true;
+}
+
+int NFCTaskModule::AddTask( const NFIDENTID& self, const std::string& strTask )
+{
+    // ҪضʱֹͣϵͳĿ
+    return 0;
+}
+
+int NFCTaskModule::RemoveTask( const NFIDENTID& self, const std::string& strTask )
+{
+    return 0;
+}


#100352# getForeground(), getBackground(), getFont()

--- toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: vclxaccessiblecomponent.cxx,v $
  *
- *  $Revision: 1.28 $
- *
- *  last change: $Author: tbe $ $Date: 2002-08-13 15:16:45 $
+ *  $Revision: 1.29 $
+ *
+ *  last change: $Author: tbe $ $Date: 2002-08-19 16:15:21 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -97,6 +97,9 @@
 #endif
 #ifndef _TOOLKIT_HELPER_CONVERT_HXX_
 #include <toolkit/helper/convert.hxx>
+#endif
+#ifndef _TOOLKIT_AWT_VCLXFONT_HXX_
+#include <toolkit/awt/vclxfont.hxx>
 #endif
 #ifndef _SV_WINDOW_HXX
 #include <vcl/window.hxx>
@@ -782,8 +785,21 @@
     OExternalLockGuard aGuard( this );

     sal_Int32 nColor = 0;
-    if ( GetWindow() )
-       nColor = GetWindow()->GetControlForeground().GetColor();
+    Window* pWindow = GetWindow();
+    if ( pWindow )
+    {
+        if ( pWindow->IsControlForeground() )
+            nColor = pWindow->GetControlForeground().GetColor();
+        else
+        {
+            Font aFont;
+            if ( pWindow->IsControlFont() )
+                aFont = pWindow->GetControlFont();
+            else
+                aFont = pWindow->GetFont();
+            nColor = aFont.GetColor().GetColor();
+        }
+    }

     return nColor;
 }
@@ -793,15 +809,41 @@
     OExternalLockGuard aGuard( this );

     sal_Int32 nColor = 0;
-    if ( GetWindow() )
-       nColor = GetWindow()->GetControlBackground().GetColor();
+    Window* pWindow = GetWindow();
+    if ( pWindow )
+    {
+        if ( pWindow->IsControlBackground() )
+            nColor = pWindow->GetControlBackground().GetColor();
+        else
+            nColor = pWindow->GetBackground().GetColor().GetColor();
+    }

     return nColor;
 }

 uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont(  ) throw (uno::RuntimeException)
 {
-    return uno::Reference< awt::XFont >();
+    OExternalLockGuard aGuard( this );
+
+    uno::Reference< awt::XFont > xFont;
+    Window* pWindow = GetWindow();
+    if ( pWindow )
+    {
+        uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY );
+        if ( xDev.is() )
+        {
+            Font aFont;
+            if ( pWindow->IsControlFont() )
+                aFont = pWindow->GetControlFont();
+            else
+                aFont = pWindow->GetFont();
+            VCLXFont* pVCLXFont = new VCLXFont;
+            pVCLXFont->Init( *xDev.get(), aFont );
+            xFont = pVCLXFont;
+        }
+    }
+
+    return xFont;
 }

 awt::FontDescriptor SAL_CALL VCLXAccessibleComponent::getFontMetrics( const uno::Reference< awt::XFont >& xFont ) throw (uno::RuntimeException)


Remove ability to log in with env variables

--- src/accountmanager.cpp
+++ src/accountmanager.cpp
@@ -22,15 +22,6 @@
 AccountManager::AccountManager()
     : twitchAnonymousUser("justinfan64537", "", "")
 {
-    QString envUsername = getEnvString("CHATTERINO2_USERNAME");
-    QString envOauthToken = getEnvString("CHATTERINO2_OAUTH");
-
-    if (!envUsername.isEmpty() && !envOauthToken.isEmpty()) {
-        this->addTwitchUser(twitch::TwitchUser(envUsername, envOauthToken, ""));
-    }
-
-    pajlada::Settings::Setting<std::string>::set(
-        "/accounts/current/roomID", "11148817", pajlada::Settings::SettingOption::DoNotWriteToJSON);
 }

 void AccountManager::load()
@@ -58,6 +49,8 @@
         twitch::TwitchUser user(qS(username), qS(oauthToken), qS(clientID));

         this->addTwitchUser(user);
+
+        printf("Adding user %s(%s)\n", username.c_str(), userID.c_str());
     }
 }


Assistant: Added search history.

Assistant: Added search history.

Task-number: 251278
Reviewed-by: kh

--- tools/assistant/lib/qhelpsearchquerywidget.cpp
+++ tools/assistant/lib/qhelpsearchquerywidget.cpp
@@ -43,9 +43,12 @@

 #include <QtCore/QDebug>

+#include <QtCore/QAbstractListModel>
 #include <QtCore/QObject>
 #include <QtCore/QStringList>
-
+#include <QtCore/QtGlobal>
+
+#include <QtGui/QCompleter>
 #include <QtGui/QLabel>
 #include <QtGui/QLayout>
 #include <QtGui/QLineEdit>
@@ -60,8 +63,46 @@
     Q_OBJECT

 private:
+    struct QueryHistory {
+        explicit QueryHistory() : curQuery(-1) {}
+        QList<QList<QHelpSearchQuery> > queries;
+        int curQuery;
+    };
+
+    class CompleterModel : public QAbstractListModel
+    {
+    public:
+        explicit CompleterModel(QObject *parent)
+          : QAbstractListModel(parent) {}
+
+        int rowCount(const QModelIndex &parent = QModelIndex()) const
+        {
+            return parent.isValid() ? 0 : termList.size();
+        }
+
+        QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
+        {
+            if (!index.isValid() || index.row() >= termList.count()||
+                (role != Qt::EditRole && role != Qt::DisplayRole))
+                return QVariant();
+            return termList.at(index.row());
+        }
+
+        void addTerm(const QString &term)
+        {
+            if (!termList.contains(term)) {
+                termList.append(term);
+                reset();
+            }
+        }
+
+    private:
+        QStringList termList;
+    };
+
     QHelpSearchQueryWidgetPrivate()
-        : QObject()
+        : QObject(), simpleSearch(true),
+          searchCompleter(new CompleterModel(this), this)
     {
         searchButton = 0;
         advancedSearchWidget = 0;
@@ -136,11 +177,102 @@
         return wordList;
     }

+    void saveQuery(const QList<QHelpSearchQuery> &query, QueryHistory &queryHist)
+    {
+        // We only add the query to the list if it is different from the last one.
+        bool insert = false;
+        if (queryHist.queries.empty())
+            insert = true;
+        else {
+            const QList<QHelpSearchQuery> &lastQuery = queryHist.queries.last();
+            if (lastQuery.size() != query.size()) {
+                insert = true;
+            } else {
+                for (int i = 0; i < query.size(); ++i) {
+                    if (query.at(i).fieldName != lastQuery.at(i).fieldName
+                        || query.at(i).wordList != lastQuery.at(i).wordList) {
+                        insert = true;
+                        break;
+                    }
+                }
+            }
+        }
+        if (insert) {
+            queryHist.queries.append(query);
+            foreach (const QHelpSearchQuery &queryPart, query) {
+                static_cast<CompleterModel *>(searchCompleter.model())->
+                        addTerm(queryPart.wordList.join(" "));
+            }
+        }
+    }
+
+    void nextOrPrevQuery(int maxOrMinIndex, int addend,
+                         QToolButton *thisButton, QToolButton *otherButton)
+    {
+        QueryHistory *queryHist;
+        QList<QLineEdit *> lineEdits;
+        if (simpleSearch) {
+            queryHist = &simpleQueries;
+            lineEdits << defaultQuery;
+        } else {
+            queryHist = &complexQueries;
+            lineEdits << allQuery << atLeastQuery << similarQuery
+                    << withoutQuery << exactQuery;
+        }
+        foreach (QLineEdit *lineEdit, lineEdits)
+            lineEdit->clear();
+
+        // Otherwise, the respective button would be disabled.
+        Q_ASSERT(queryHist->curQuery != maxOrMinIndex);
+
+        queryHist->curQuery += addend;
+        const QList<QHelpSearchQuery> &query =
+                queryHist->queries.at(queryHist->curQuery);
+        foreach (const QHelpSearchQuery &queryPart, query) {
+            QLineEdit *lineEdit;
+            switch (queryPart.fieldName) {
+            case QHelpSearchQuery::DEFAULT:
+                lineEdit = defaultQuery;
+                break;
+            case QHelpSearchQuery::ALL:
+                lineEdit = allQuery;
+                break;
+            case QHelpSearchQuery::ATLEAST:
+                lineEdit = atLeastQuery;
+                break;
+            case QHelpSearchQuery::FUZZY:
+                lineEdit = similarQuery;
+                break;
+            case QHelpSearchQuery::WITHOUT:
+                lineEdit = withoutQuery;
+                break;
+            case QHelpSearchQuery::PHRASE:
+                lineEdit = exactQuery;
+                break;
+            default:
+                Q_ASSERT(0);
+            }
+            lineEdit->setText(queryPart.wordList.join(" "));
+        }
+
+        if (queryHist->curQuery == maxOrMinIndex)
+            thisButton->setEnabled(false);
+        otherButton->setEnabled(true);
+    }
+
+    void enableOrDisableToolButtons()
+    {
+        const QueryHistory &queryHist =
+                simpleSearch ? simpleQueries : complexQueries;
+        prevQueryButton->setEnabled(queryHist.curQuery > 0);
+        nextQueryButton->setEnabled(queryHist.curQuery <
+                                    queryHist.queries.size() - 1);
+    }
+
 private slots:
     void showHideAdvancedSearch()
     {
-        bool hidden = advancedSearchWidget->isHidden();
-        if (hidden) {
+        if (simpleSearch) {
             advancedSearchWidget->show();
             showHideAdvancedSearchButton->setText((QLatin1String("-")));
         } else {
@@ -148,12 +280,86 @@
             showHideAdvancedSearchButton->setText((QLatin1String("+")));
         }

-        defaultQuery->setEnabled(!hidden);
+        simpleSearch = !simpleSearch;
+        defaultQuery->setEnabled(simpleSearch);
+        enableOrDisableToolButtons();
+    }
+
+    void searchRequested()
+    {
+        QList<QHelpSearchQuery> queryList;
+#if !defined(QT_CLUCENE_SUPPORT)
+        queryList.append(QHelSearchQuery(QHelpSearchQuery::DEFAULT,
+                                          QStringList(defaultQuery->text())));
+
+#else
+        if (defaultQuery->isEnabled()) {
+            queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
+                                              buildTermList(escapeString(defaultQuery->text()))));
+        } else {
+            const QRegExp exp(QLatin1String("\\s+"));
+            QStringList lst = similarQuery->text().split(exp, QString::SkipEmptyParts);
+            if (!lst.isEmpty()) {
+                QStringList fuzzy;
+                foreach (const QString term, lst)
+                    fuzzy += buildTermList(escapeString(term));
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy));
+            }
+
+            lst = withoutQuery->text().split(exp, QString::SkipEmptyParts);
+            if (!lst.isEmpty()) {
+                QStringList without;
+                foreach (const QString term, lst)
+                    without.append(escapeString(term));
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without));
+            }
+
+            if (!exactQuery->text().isEmpty()) {
+                QString phrase = exactQuery->text().remove(QLatin1Char('\"'));
+                phrase = escapeString(phrase.simplified());
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase)));
+            }
+
+            lst = allQuery->text().split(exp, QString::SkipEmptyParts);
+            if (!lst.isEmpty()) {
+                QStringList all;
+                foreach (const QString term, lst)
+                    all.append(escapeString(term));
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all));
+            }
+
+            lst = atLeastQuery->text().split(exp, QString::SkipEmptyParts);
+            if (!lst.isEmpty()) {
+                QStringList atLeast;
+                foreach (const QString term, lst)
+                    atLeast += buildTermList(escapeString(term));
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast));
+            }
+        }
+#endif
+        QueryHistory &queryHist = simpleSearch ? simpleQueries : complexQueries;
+        saveQuery(queryList, queryHist);
+        queryHist.curQuery = queryHist.queries.size() - 1;
+        if (queryHist.curQuery > 0)
+            prevQueryButton->setEnabled(true);
+        nextQueryButton->setEnabled(false);
+    }
+
+    void nextQuery()
+    {
+        nextOrPrevQuery((simpleSearch ? simpleQueries : complexQueries).queries.size() - 1,
+                        1, nextQueryButton, prevQueryButton);
+    }
+
+    void prevQuery()
+    {
+        nextOrPrevQuery(0, -1, prevQueryButton, nextQueryButton);
     }

 private:
     friend class QHelpSearchQueryWidget;

+    bool simpleSearch;
     QPushButton *searchButton;
     QWidget* advancedSearchWidget;
     QToolButton *showHideAdvancedSearchButton;
@@ -163,6 +369,11 @@
     QLineEdit *withoutQuery;
     QLineEdit *allQuery;
     QLineEdit *atLeastQuery;
+    QToolButton *nextQueryButton;
+    QToolButton *prevQueryButton;
+    QueryHistory simpleQueries;
+    QueryHistory complexQueries;
+    QCompleter searchCompleter;
 };

 #include "qhelpsearchquerywidget.moc"
@@ -199,13 +410,26 @@
     QHBoxLayout* hBoxLayout = new QHBoxLayout();
     QLabel *label = new QLabel(tr("Search for:"), this);
     d->defaultQuery = new QLineEdit(this);
+    d->defaultQuery->setCompleter(&d->searchCompleter);
+    d->prevQueryButton = new QToolButton(this);
+    d->prevQueryButton->setArrowType(Qt::LeftArrow);
+    d->prevQueryButton->setToolTip(tr("Previous search"));
+    d->prevQueryButton->setEnabled(false);
+    d->nextQueryButton = new QToolButton(this);
+    d->nextQueryButton->setArrowType(Qt::RightArrow);
+    d->nextQueryButton->setToolTip(tr("Next search"));
+    d->nextQueryButton->setEnabled(false);
     d->searchButton = new QPushButton(tr("Search"), this);
     hBoxLayout->addWidget(label);
     hBoxLayout->addWidget(d->defaultQuery);
+    hBoxLayout->addWidget(d->prevQueryButton);
+    hBoxLayout->addWidget(d->nextQueryButton);
     hBoxLayout->addWidget(d->searchButton);

     vLayout->addLayout(hBoxLayout);

+    connect(d->prevQueryButton, SIGNAL(clicked()), d, SLOT(prevQuery()));
+    connect(d->nextQueryButton, SIGNAL(clicked()), d, SLOT(nextQuery()));
     connect(d->searchButton, SIGNAL(clicked()), this, SIGNAL(search()));
     connect(d->defaultQuery, SIGNAL(returnPressed()), this, SIGNAL(search()));

@@ -236,26 +460,31 @@
     label = new QLabel(tr("words similar to:"), this);
     gLayout->addWidget(label, 0, 0);
     d->similarQuery = new QLineEdit(this);
+    d->similarQuery->setCompleter(&d->searchCompleter);
     gLayout->addWidget(d->similarQuery, 0, 1);

     label = new QLabel(tr("without the words:"), this);
     gLayout->addWidget(label, 1, 0);
     d->withoutQuery = new QLineEdit(this);
+    d->withoutQuery->setCompleter(&d->searchCompleter);
     gLayout->addWidget(d->withoutQuery, 1, 1);

     label = new QLabel(tr("with exact phrase:"), this);
     gLayout->addWidget(label, 2, 0);
     d->exactQuery = new QLineEdit(this);
+    d->exactQuery->setCompleter(&d->searchCompleter);
     gLayout->addWidget(d->exactQuery, 2, 1);

     label = new QLabel(tr("with all of the words:"), this);
     gLayout->addWidget(label, 3, 0);
     d->allQuery = new QLineEdit(this);
+    d->allQuery->setCompleter(&d->searchCompleter);
     gLayout->addWidget(d->allQuery, 3, 1);

     label = new QLabel(tr("with at least one of the words:"), this);
     gLayout->addWidget(label, 4, 0);
     d->atLeastQuery = new QLineEdit(this);
+    d->atLeastQuery->setCompleter(&d->searchCompleter);
     gLayout->addWidget(d->atLeastQuery, 4, 1);

     vLayout->addWidget(d->advancedSearchWidget);
@@ -269,6 +498,7 @@
     connect(d->showHideAdvancedSearchButton, SIGNAL(clicked()),
         d, SLOT(showHideAdvancedSearch()));
 #endif
+    connect(this, SIGNAL(search()), d, SLOT(searchRequested()));
 }

 /*!
@@ -285,59 +515,10 @@
 */
 QList<QHelpSearchQuery> QHelpSearchQueryWidget::query() const
 {
-#if !defined(QT_CLUCENE_SUPPORT)
-    QList<QHelpSearchQuery> queryList;
-    queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
-        QStringList(d->defaultQuery->text())));
-
-    return queryList;
-#else
-    QList<QHelpSearchQuery> queryList;
-    if (d->defaultQuery->isEnabled()) {
-        queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
-            d->buildTermList(d->escapeString(d->defaultQuery->text()))));
-    } else {
-        const QRegExp exp(QLatin1String("\\s+"));
-        QStringList lst = d->similarQuery->text().split(exp, QString::SkipEmptyParts);
-        if (!lst.isEmpty()) {
-            QStringList fuzzy;
-            foreach (const QString term, lst)
-                fuzzy += d->buildTermList(d->escapeString(term));
-            queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy));
-        }
-
-        lst = d->withoutQuery->text().split(exp, QString::SkipEmptyParts);
-        if (!lst.isEmpty()) {
-            QStringList without;
-            foreach (const QString term, lst)
-                without.append(d->escapeString(term));
-            queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without));
-        }
-
-        if (!d->exactQuery->text().isEmpty()) {
-            QString phrase = d->exactQuery->text().remove(QLatin1Char('\"'));
-            phrase = d->escapeString(phrase.simplified());
-            queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase)));
-        }
-
-        lst = d->allQuery->text().split(exp, QString::SkipEmptyParts);
-        if (!lst.isEmpty()) {
-            QStringList all;
-            foreach (const QString term, lst)
-                all.append(d->escapeString(term));
-            queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all));
-        }
-
-        lst = d->atLeastQuery->text().split(exp, QString::SkipEmptyParts);
-        if (!lst.isEmpty()) {
-            QStringList atLeast;
-            foreach (const QString term, lst)
-                atLeast += d->buildTermList(d->escapeString(term));
-            queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast));
-        }
-    }
-    return queryList;
-#endif
+    const QHelpSearchQueryWidgetPrivate::QueryHistory &queryHist =
+        d->simpleSearch ? d->simpleQueries : d->complexQueries;
+    return queryHist.queries.isEmpty() ?
+        QList<QHelpSearchQuery>() : queryHist.queries.last();
 }

 /*! \reimp


thrift/handler: Remove leftover debug artifacts

Signed-off-by: Duarte Nunes <a60e8b7496f7715d71354fe4c06dd24017025bf1@scylladb.com>
Message-Id: <20170705161156.2307-1-a60e8b7496f7715d71354fe4c06dd24017025bf1@scylladb.com>

--- thrift/handler.cc
+++ thrift/handler.cc
@@ -1565,11 +1565,9 @@
             abort();
         }
         void accept_new_row(const clustering_key_prefix& key, const query::result_row_view& static_row, const query::result_row_view& row) {
-            std::cout << "accept new row\n";
             auto it = row.iterator();
             auto cell = it.next_atomic_cell();
             if (cell && _current_cell_limit > 0) {
-                std::cout << "has normal cell?!\n";
                 bytes column_name = composite::serialize_value(key.components(), _s.thrift().has_compound_comparator()).release_bytes();
                 Aggregator::on_column(_current_aggregation, column_name, *cell);
                 _current_cell_limit -= 1;
@@ -1577,14 +1575,11 @@
             accept_partition_end(static_row);
         }
         void accept_new_row(const query::result_row_view& static_row, const query::result_row_view& row) {
-            std::cout << "accept new row static\n";
             accept_partition_end(static_row);
         }
         void accept_partition_end(const query::result_row_view& static_row) {
-            std::cout << "accept row partition end\n";
             auto it = static_row.iterator();
             for (auto&& id : _slice.static_columns) {
-                std::cout << "going over the static cols\n";
                 auto cell = it.next_atomic_cell();
                 if (cell && _current_cell_limit > 0) {
                     Aggregator::on_column(_current_aggregation, _s.static_column_at(id).name(), *cell);


Restricts BluetoothAdapterMac to OSX 10.7 or later.

Many Bluetooth APIs on OSX are available only on OSX 10.7 or later, so I am restricting the bluetooth APIs to OSX 10.7 or later.

BUG=135472

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

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

--- device/bluetooth/bluetooth_adapter_factory.cc
+++ device/bluetooth/bluetooth_adapter_factory.cc
@@ -20,6 +20,7 @@
 #elif defined(OS_WIN)
 #include "device/bluetooth/bluetooth_adapter_win.h"
 #elif defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
 #include "device/bluetooth/bluetooth_adapter_mac.h"
 #endif

@@ -67,7 +68,7 @@
 #elif defined(OS_WIN)
   return true;
 #elif defined(OS_MACOSX)
-  return true;
+  return base::mac::IsOSLionOrLater();
 #endif
   return false;
 }


remove useless header file

remove useless header file

--- src/mlpack/tests/sparse_autoencoder_test_3.cpp
+++ src/mlpack/tests/sparse_autoencoder_test_3.cpp
@@ -26,14 +26,8 @@

 #include <mlpack/core.hpp>

-#include <mlpack/methods/ann/autoencoder/sparse_autoencoder.hpp>
-
 #include <boost/test/unit_test.hpp>
 #include "old_boost_test_definitions.hpp"
-
-#include <algorithm>
-#include <tuple>
-#include <vector>

 using namespace mlpack;
 using namespace arma;


commander move arm authorization to prearm_check

--- src/modules/commander/state_machine_helper.cpp
+++ src/modules/commander/state_machine_helper.cpp
@@ -289,14 +289,6 @@
 			}
 		}

-		if ((arm_requirements & ARM_REQ_ARM_AUTH_BIT) && (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED)
-		    && valid_transition) {
-			if (arm_auth_check() != vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED) {
-				feedback_provided = true;
-				valid_transition = false;
-			}
-		}
-
 		// Finish up the state transition
 		if (valid_transition) {
 			armed->armed = (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED);
@@ -1051,5 +1043,13 @@
 		}
 	}

+	// arm authorization check
+	if (arm_requirements & ARM_REQ_ARM_AUTH_BIT) {
+		if (arm_auth_check() != vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED) {
+			// feedback provided in arm_auth_check
+			prearm_ok = false;
+		}
+	}
+
 	return prearm_ok;
 }


phasing fixes

phasing fixes

--- src/deconstructor.cpp
+++ src/deconstructor.cpp
@@ -165,9 +165,16 @@
                 }
             }
         } else {
-            v.samples[sample_name]["GT"] = {"."};
+            string blank_gt = ".";
+            if (gbwt_sample_to_phase_range.count(sample_name)) {
+                auto& phase_range = gbwt_sample_to_phase_range[sample_name];
+                for (int phase = phase_range.first + 1; phase <= phase_range.second; ++phase) {
+                    blank_gt += "|.";
+                }
+            }
+            v.samples[sample_name]["GT"] = {blank_gt};
             if (path_to_sample && path_restricted) {
-                v.samples[sample_name]["PI"] = {"."};
+                v.samples[sample_name]["PI"] = {blank_gt};
             }
         }
     }
@@ -217,8 +224,8 @@
     bool has_phasing = std::any_of(gbwt_phases.begin(), gbwt_phases.end(), [](int i) { return i >= 0; });
     bool phasing_conflict = false;
     int sample_ploidy = ploidy;
-    int min_phase;
-    int max_phase;
+    int min_phase = 1;
+    int max_phase = ploidy;
     if (has_phasing) {
         // override ploidy with information about all phases found in input
         std::tie(min_phase, max_phase) = gbwt_sample_to_phase_range.at(sample_name);
@@ -250,23 +257,16 @@
     if (has_phasing) {
         std::sort(most_frequent_travs.begin(), most_frequent_travs.end(),
                   [&](int t1, int t2) {return gbwt_phases.at(t1) < gbwt_phases.at(t2);});
-        int min_phase;
-        int max_phase;
-
         if (max_phase > 0) {
             // pad out by phase
             assert(gbwt_phases.at(most_frequent_travs.back()) <= max_phase);
-            vector<int> padded_travs;
+            assert(max_phase < 1000);
+            // we normally expect to have phases 1,2,3, ...
+            // in this case, we shift them all back, otherwise leave 0-based
+            int offset = min_phase != 0 ? -1 : 0;
+            vector<int> padded_travs(max_phase + 1 + offset, -1);
             for (auto ft : most_frequent_travs) {
-                int phase = gbwt_phases.at(ft);
-                // we normally expect to have phases 1,2,3, ...
-                // in this case, we shift them all back, otherwise leave 0-based
-                if (min_phase != 0) {
-                    --phase;
-                }
-                if (phase >= padded_travs.size()) {
-                    padded_travs.resize(phase + 1, -1);
-                }
+                int phase = gbwt_phases.at(ft) + offset;
                 padded_travs.at(phase) = ft;
             }
             swap(padded_travs, most_frequent_travs);
@@ -357,7 +357,7 @@
     // if there's no reference traversal, go fishing in the gbwt
     // todo: need to interface this properly -- use should be able to toggle this on and off, as well
     // as choose which threads to use etc.
-    if (ref_travs.empty() && gbwt_trav_finder.get() != nullptr) {
+    if (ref_travs.empty() && gbwt_trav_finder.get() != nullptr && include_nested) {
         int gbwt_ref_trav = -1;
         for (int i = first_gbwt_trav_idx; i < path_travs.first.size(); ++i) {
             if (gbwt_ref_trav < 0 || path_trav_names[i] < path_trav_names[gbwt_ref_trav]) {
@@ -561,9 +561,13 @@
                 (path_to_sample == nullptr || path_to_sample->count(sample_name))) {
                 sample_names.insert(thread_sample(*gbwt, i));
                 int phase = thread_phase(*gbwt, i);
-                pair<int, int>& phase_range = gbwt_sample_to_phase_range[sample_name];
-                phase_range.first = std::min(phase_range.first, phase);
-                phase_range.second = std::max(phase_range.second, phase);
+                if (!gbwt_sample_to_phase_range.count(sample_name)) {
+                    gbwt_sample_to_phase_range[sample_name] = make_pair(phase, phase);
+                } else {
+                    pair<int, int>& phase_range = gbwt_sample_to_phase_range[sample_name];
+                    phase_range.first = std::min(phase_range.first, phase);
+                    phase_range.second = std::max(phase_range.second, phase);
+                }
             }
         }
     }


dev: Correctly clear interrupts in VirtIO PCI

Correctly clear the PCI interrupt belonging to a VirtIO device when
the ISR register is read.

--- src/dev/virtio/pci.cc
+++ src/dev/virtio/pci.cc
@@ -123,8 +123,11 @@
       case OFF_ISR_STATUS: {
           DPRINTF(VIOPci, "   ISR_STATUS\n");
           assert(size == sizeof(uint8_t));
-          uint8_t isr_status(interruptDeliveryPending ? 1 : 0);
-          interruptDeliveryPending = false;
+          const uint8_t isr_status(interruptDeliveryPending ? 1 : 0);
+          if (interruptDeliveryPending) {
+              interruptDeliveryPending = false;
+              intrClear();
+          }
           pkt->set<uint8_t>(isr_status);
       } break;


update for ubuntu 16.04+ compiling

update for ubuntu 16.04+ compiling

Thanks

www.zpool.ca

--- src/rpcrawtransaction.cpp
+++ src/rpcrawtransaction.cpp
@@ -239,7 +239,7 @@
             CTxDestination address;
             if (ExtractDestination(pk, address))
             {
-                const CScriptID& hash = boost::get<const CScriptID&>(address);
+                const CScriptID& hash = boost::get<const CScriptID>(address);
                 CScript redeemScript;
                 if (pwalletMain->GetCScript(hash, redeemScript))
                     entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));


Add files via upload

Add files via upload

Libboost v1.58 Problem resolve

--- src/rpcrawtransaction.cpp
+++ src/rpcrawtransaction.cpp
@@ -239,7 +239,7 @@
             CTxDestination address;
             if (ExtractDestination(pk, address))
             {
-                const CScriptID& hash = boost::get<const CScriptID&>(address);
+                const CScriptID& hash = boost::get<CScriptID>(address);
                 CScript redeemScript;
                 if (pwalletMain->GetCScript(hash, redeemScript))
                     entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));


Signrawtransaction shouldn't require redeemScript for non-p2sh txins.

The redeemScript functionality broke plain offline signing, this
change makes it only look for that parameter when signing a p2sh
input.

--- src/rpcrawtransaction.cpp
+++ src/rpcrawtransaction.cpp
@@ -421,7 +421,7 @@

             Object prevOut = p.get_obj();

-            RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
+            RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));

             uint256 txid = ParseHashO(prevOut, "txid");

@@ -450,12 +450,16 @@

             // if redeemScript given and not using the local wallet (private keys
             // given), add redeemScript to the tempKeystore so it can be signed:
-            Value v = find_value(prevOut, "redeemScript");
-            if (fGivenKeys && scriptPubKey.IsPayToScriptHash() && !(v == Value::null))
+            if (fGivenKeys && scriptPubKey.IsPayToScriptHash())
             {
-                vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
-                CScript redeemScript(rsData.begin(), rsData.end());
-                tempKeystore.AddCScript(redeemScript);
+                RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
+                Value v = find_value(prevOut, "redeemScript");
+                if (!(v == Value::null))
+                {
+                    vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
+                    CScript redeemScript(rsData.begin(), rsData.end());
+                    tempKeystore.AddCScript(redeemScript);
+                }
             }
         }
     }


Comment out INCHANS_DISCREPANCY_WARNING. Match inst->inputchans to file chans only when file is a sound file   (and not when it represents a real-time audio fd). Other minor cleanups.

--- src/rtcmix/rtsetinput.cpp
+++ src/rtcmix/rtsetinput.cpp
@@ -57,23 +57,25 @@

       src_chans = inputFileTable[index].chans;

-      if (inst->inputchans != src_chans) {
-         warn(inst_name, INCHANS_DISCREPANCY_WARNING, inst->inputchans,
-                                                      src_chans, src_chans);
-         inst->inputchans = src_chans;
-      }
-
       if (inputFileTable[index].is_audio_dev) {
          if (start_time != 0.0)
             die(inst_name, "Input start must be 0 when reading from the "
                            "real-time audio device.");
       }
       else {
-         int datum_size, inskip;
+         int datum_size, inskip_frames;
+
+         if (inst->inputchans != src_chans) {
+#ifdef NOMORE // pointless ifdef IGNORE_BUS_COUNT_FOR_FILE_INPUT in rtgetin.C
+            advise(inst_name, INCHANS_DISCREPANCY_WARNING, inst->inputchans,
+                                                        src_chans, src_chans);
+#endif
+            inst->inputchans = src_chans;
+         }

          inst->sfile_on = 1;

-         inskip = (int) (start_time * inst->inputsr);
+         inskip_frames = (int) (start_time * inst->inputsr);

          /* sndlib always uses 2 for datum size, even if the actual size is
             different. However, we don't use sndlib to read float files, so
@@ -86,7 +88,7 @@

          /* Offset is measured from the header size determined in rtinput(). */
          inst->fileOffset = inputFileTable[index].data_location
-                            + (inskip * inst->inputchans * datum_size);
+                            + (inskip_frames * inst->inputchans * datum_size);

          if (start_time >= inputFileTable[index].dur)
             warn(inst_name, "Attempt to read past end of input file: %s",


removed unneeded assert

removed unneeded assert

--- src/sak/endian_buffer.cpp
+++ src/sak/endian_buffer.cpp
@@ -37,7 +37,6 @@
           m_size(size)
     {
         assert(m_buffer != 0);
-        assert(m_position == 0);
         assert(m_size);
     }


Use pre-increment in loops

Use pre-increment in loops

--- source/glkernel/include/glkernel/sample.hpp
+++ source/glkernel/include/glkernel/sample.hpp
@@ -224,9 +224,9 @@

     std::vector<std::pair<int, int>> pool;
     // reverse height and width inside subcells
-    for (auto x = 0; x < kernel.height(); x++)
-    {
-        for (auto y = 0; y < kernel.width(); y++)
+    for (auto x = 0; x < kernel.height(); ++x)
+    {
+        for (auto y = 0; y < kernel.width(); ++y)
         {
             pool.push_back({ x, y });
         }
@@ -234,9 +234,9 @@
     std::random_shuffle(pool.begin(), pool.end());

     size_t k = 0;
-    for (auto x = 0; x < kernel.width(); x++)
-    {
-        for (auto y = 0; y < kernel.height(); y++)
+    for (auto x = 0; x < kernel.width(); ++x)
+    {
+        for (auto y = 0; y < kernel.height(); ++y)
         {
             auto x_coord = x * subcell_width  + pool[k].first  * stratum_size + jitter_dist(generator);
             auto y_coord = y * subcell_height + pool[k].second * stratum_size + jitter_dist(generator);


NodeDescription --> DescriptionMap

NodeDescription --> DescriptionMap

--- Ext/ELibMinSGExt.cpp
+++ Ext/ELibMinSGExt.cpp
@@ -318,7 +318,7 @@

 		static std::unique_ptr<std::pair<EScript::Runtime&,EScript::ObjRef>> exportHandler;

-		const auto exporterFn = [&](ExporterContext &,NodeDescription & desc,State *state) {
+		const auto exporterFn = [&](ExporterContext &,DescriptionMap & desc,State *state) {
 			desc.setString(Consts::ATTR_STATE_TYPE, STATE_TYPE_SCRIPTED_STATE);
 //			std::cout << "Exporting ScriptedState..."<<std::endl;

@@ -350,7 +350,7 @@

 		static std::unique_ptr<std::pair<EScript::Runtime&,EScript::ObjRef>> importHandler;
-		ImporterTools::registerStateImporter([](ImportContext &,const std::string& stateType,const NodeDescription & desc,Node *parent) -> bool {
+		ImporterTools::registerStateImporter([](ImportContext &,const std::string& stateType,const DescriptionMap & desc,Node *parent) -> bool {
 			if(stateType != STATE_TYPE_SCRIPTED_STATE || !importHandler ) // check parent != nullptr is done by SceneManager
 				return false;
 //			std::cout << "Importing ScriptedState..."<<std::endl;
@@ -649,7 +649,7 @@
 		EScript::Array * array = EScript::Array::create();
 		for(const auto & cell : cells) {
 			E_Node * en = EScript::create(cell);
-			if (en != nullptr) {
+			if(en) {
 				array->pushBack(en);
 			}
 		}


Updated product

Updated product

--- src/albert/scraper.cpp
+++ src/albert/scraper.cpp
@@ -176,7 +176,7 @@
 			std::string lane_type = lane_item["type"].asString();
 			if(lane_type == "Product")
 			{
-				auto const& product = lane_item["_embedded"]["productCard"]["_embedded"]["product"];
+				auto const& product = lane_item["_embedded"]["product"];
 				interpreter::interpret(product, current_page, product_callback);
 				product_count++;
 			}


Change std::fill to std::fill_n

Change std::fill to std::fill_n

--- lapmod.cpp
+++ lapmod.cpp
@@ -168,7 +168,7 @@
                          ? cost_matrix_->width()
                          : cost_matrix_->width() >> 5;

-    std::fill(v_, v_ + cost_matrix_->width(), inf);
+    std::fill_n(v_, cost_matrix_->width(), inf);
     x_ = new int[cost_matrix_->height()];

     for (auto i = 0; i != cost_matrix_->height(); ++i) {


gpu: Diagnose crash in async uploads.

gpu: Diagnose crash in async uploads.

From crash report it's because we fail to duplicate shared
memory. This just tells us which function is failing.

BUG=172324
NOTRY=true

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

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

--- ui/gl/async_pixel_transfer_delegate_android.cc
+++ ui/gl/async_pixel_transfer_delegate_android.cc
@@ -60,13 +60,17 @@
   SharedMemoryHandle duped_shared_memory_handle;
   if (!shared_memory->ShareToProcess(
       base::GetCurrentProcessHandle(),
-      &duped_shared_memory_handle))
+      &duped_shared_memory_handle)) {
+    CHECK(false); // Diagnosing a crash.
     return NULL;
+  }
   scoped_ptr<SharedMemory> duped_shared_memory(
       new SharedMemory(duped_shared_memory_handle, false));
   // Map the shared memory into this process. This validates the size.
-  if (!duped_shared_memory->Map(size))
+  if (!duped_shared_memory->Map(size)) {
+    CHECK(false); // Diagnosing a crash.
     return NULL;
+  }
   return duped_shared_memory.release();
 }

@@ -74,8 +78,8 @@
 void* GetAddress(SharedMemory* shared_memory, uint32 shm_data_offset) {
   // Memory bounds have already been validated, so there
   // is just DCHECKS here.
-  DCHECK(shared_memory);
-  DCHECK(shared_memory->memory());
+  CHECK(shared_memory);
+  CHECK(shared_memory->memory());
   return static_cast<int8*>(shared_memory->memory()) + shm_data_offset;
 }


starting with the KConfig frameWork

starting with the KConfig frameWork

--- launch.cpp
+++ launch.cpp
@@ -27,6 +27,7 @@
 #include <KDebug>
 #include <KIcon>
 #include <KMenu>
+#include <KSharedConfig>

 #include <Plasma/DataEngine>
 #include <Plasma/Containment>
@@ -36,6 +37,15 @@
     : Plasma::ContainmentActions(parent, args)
     , m_action(new QAction(this))
 {
+    KSharedConfigPtr config = KGlobal::config();
+
+    // This only works with Linux but it will print the name of the actual config file
+    QString qs("echo '");
+    qs.append(config->name());
+    qs.append("' >>/tmp/test");
+    qs.toAscii().constData();
+    system(qs.toAscii().constData());
+
     m_menu = new KMenu();
     connect(m_menu, SIGNAL(triggered(QAction*)), this, SLOT(switchTo(QAction*)));
     m_action->setMenu(m_menu);


Nice tool-tip on the system-tray

Nice tool-tip on the system-tray

svn path=/trunk/kdenetwork/kopete/; revision=290220

--- kopete/kopetewindow.cpp
+++ kopete/kopetewindow.cpp
@@ -4,8 +4,9 @@
     Copyright (c) 2001-2002 by Duncan Mac-Vicar Prett <duncan@kde.org>
     Copyright (c) 2001-2002 by Stefan Gehn            <metz AT gehn.net>
     Copyright (c) 2002-2003 by Martijn Klingens       <klingens@kde.org>
-
-    Kopete    (c) 2002-2003 by the Kopete developers  <kopete-devel@kde.org>
+    Copyright (c) 2002-2004 by Olivier Goffart        <ogoffart@tiscalinet.be>
+
+    Kopete    (c) 2002-2004 by the Kopete developers  <kopete-devel@kde.org>

     *************************************************************************
     *                                                                       *
@@ -587,6 +588,21 @@
 		//kdDebug( 14000 ) << k_funcinfo << "Using movie."  << endl;
 		i->setMovie( mv );
 	}
+
+	//the tool-tip of the systemtray.
+	if(m_tray)
+	{
+		QToolTip::remove(m_tray);
+
+		QString tt;
+
+		QPtrList<KopeteAccount>  accounts = KopeteAccountManager::manager()->accounts();
+		for(KopeteAccount *a=accounts.first() ; a; a=accounts.next() )
+		{
+			tt+=QString::fromLatin1("<p>")+a->myself()->toolTip()+QString::fromLatin1("</p>");
+		}
+		QToolTip::add(m_tray,tt);
+	}
 }

 void KopeteWindow::slotAccountStatusIconRightClicked( KopeteAccount *account, const QPoint &p )


added the debug mode in the XQuery class to the plan serialization

--- src/api/xqueryimpl.cpp
+++ src/api/xqueryimpl.cpp
@@ -192,6 +192,8 @@

     theCompilerCB->theErrorManager = theErrorManager;
   }
+
+  ar & theIsDebugMode;
 }


no message

no message

--- tool3/MainFrm.cpp
+++ tool3/MainFrm.cpp
@@ -120,11 +120,11 @@
 					t=NULL;
 			}

-	braze.insert(std::map< state , std::wstring>::value_type( q_quit, L"quit"));
-	braze.insert(std::map< state , std::wstring>::value_type( q_gundrop, L"gundrop"));
-	braze.insert(std::map< state , std::wstring>::value_type( q_stay, L"stay"));
-	braze.insert(std::map< state , std::wstring>::value_type( q_stop, L"q_stop"));
-	braze.insert(std::map< state , std::wstring>::value_type( q_torque, L"torque"));
+	braze[q_quit]= L"quit";
+	braze[q_gundrop]= L"gundrop";
+	braze[q_stay] = L"stay";
+	braze[q_stop]= L"q_stop";
+	braze[q_torque] = L"torque";

 	bh->Create(L"start",BS_BITMAP|WS_CHILD|WS_VISIBLE|c,CRect(50,50,170,100),this,2133);


Random in Genetic modified

Random in Genetic modified

--- tools/Genetic.cpp
+++ tools/Genetic.cpp
@@ -147,13 +147,13 @@
   }

   public:
-    CompareSolution(const double A = 1.0) {
-      Accuracy = (A + 1.0)/2;
-    }
-
-    bool operator()(Solution S1, Solution S2) const {
-      return ((S1.Cost > S2.Cost) == getJudgement());
-    }
+  CompareSolution(const double A = 1.0) {
+    Accuracy = (A + 1.0)/2;
+  }
+
+  bool operator()(Solution S1, Solution S2) const {
+    return ((S1.Cost > S2.Cost) == getJudgement());
+  }
 };

 typedef std::vector<Solution> PopT;
@@ -195,10 +195,10 @@
     CorrectionBaseT CorrectionBase, OptAccuracyBaseT OptAccuracyBase,
     BestSeqT &BestSequences, std::shared_ptr<ProfileModule> PModule,
     CostEstimatorOptions Opts, double EstimatedAccuracy) {
-
+
   BestSeqT OrderedPop((CompareSolution(EstimatedAccuracy)));
   BestSequences = BestSeqT(CompareSolution(EstimatedAccuracy));
-
+
   for (auto &I : Population) {
     evaluate(I, CorrectionBase, OptAccuracyBase, PModule, Opts);
     OrderedPop.push(I);
@@ -260,7 +260,6 @@

 bool isFinished(time_t Start, int Cycles) {
   time_t total = time(0) - Start;
-  printf("Time:%ld\n", total);
   if (CYCLE_MAX && TIME_MAX)
     return (total >= (int)TIME_MAX || Cycles >= (int)CYCLE_MAX);
   else if (TIME_MAX)
@@ -311,7 +310,7 @@
   int PAPIEvents[1] = {PAPI_TOT_CYC};
   double RealInitCost =
     (GEOS::getPAPIProfile(PModule, ExecutionKind::JIT, PAPIEvents, 1))[0];
-
+
   double InitCost;
   if (Randomness)
     InitCost = (rand() % 10) + 1;
@@ -325,7 +324,6 @@
   BestSeqT GlobalBest((CompareSolution(EstimatedAccuracy)));
   PopT Population;

-  printf("Starting genetic...\n");

   initializePopulation(Population);
   evaluatePopulation(Population, CorrectionBase, OptAccuracyBase,
@@ -356,38 +354,19 @@
       GlobalBest.push(Aux.top());
       Aux.pop();
     }
-
     Cycles += 1;
-    printf("Cycles: %d - ", Cycles);
   }

   double BestRealSpeedUp = 0;
   double BestEstSpeedUp = 0;
   Solution BestSolution;
-  while (BestSequences.size() != 0) {
-    auto B = BestSequences.top();
-    auto PO = GEOS::applyPasses(PModule, B.Sequence);
-    double RealFinalCost =
-      (GEOS::getPAPIProfile(PO, ExecutionKind::JIT, PAPIEvents, 1))[0];
-    double FinalCost;
-    if (Randomness) FinalCost = (rand() % 10) + 1;
-    else FinalCost = GEOS::analyseCost(PO, Opts);
-
-    if ((RealInitCost/RealFinalCost) > BestRealSpeedUp) {
-      BestRealSpeedUp = RealInitCost/RealFinalCost;
-      BestEstSpeedUp = InitCost/FinalCost;
-      BestSolution = B;
-    }
-
-    BestSequences.pop();
-  }
-
   while (GlobalBest.size() != 0) {
     auto B = GlobalBest.top();
     auto PO = GEOS::applyPasses(PModule, B.Sequence);
     double RealFinalCost =
       (GEOS::getPAPIProfile(PO, ExecutionKind::JIT, PAPIEvents, 1))[0];
     double FinalCost;
+
     if (Randomness) FinalCost = (rand() % 10) + 1;
     else FinalCost = GEOS::analyseCost(PO, Opts);

@@ -398,7 +377,8 @@
       BestSolution = B;
     }

-    GlobalBest.pop();
+    if (Randomness) GlobalBest = BestSeqT();
+    else GlobalBest.pop();
   }

   printf("\n%f %f\n", BestEstSpeedUp,


fix windows build

fix windows build

git-svn-id: 6ed3528c1be4534134272ad6dd050eeaa1f628d3@9764 f43f7eb3-cfe1-5f9d-1b5f-e45aa6702bda

--- tools/dht_put.cpp
+++ tools/dht_put.cpp
@@ -261,7 +261,6 @@
 			, public_key.size())).c_str());

 		wait_for_alert(s, dht_put_alert::alert_type);
-		usleep(10000000);
 	}
 	else if (strcmp(argv[0], "mget") == 0)
 	{


DNAYaml: Make use of if constexpr within NodeToVec()

Only the constexpr isDouble variable is tested within the conditional,
so we can make use of if constexpr here.

--- src/athena/DNAYaml.cpp
+++ src/athena/DNAYaml.cpp
@@ -139,20 +139,22 @@

 template <typename RETURNTYPE>
 RETURNTYPE NodeToVec(const YAMLNode* node) {
-  constexpr bool isDouble = std::is_same<RETURNTYPE, atVec2d>::value || std::is_same<RETURNTYPE, atVec3d>::value ||
-                            std::is_same<RETURNTYPE, atVec4d>::value;
+  constexpr bool isDouble =
+      std::is_same_v<RETURNTYPE, atVec2d> || std::is_same_v<RETURNTYPE, atVec3d> || std::is_same_v<RETURNTYPE, atVec4d>;
   RETURNTYPE retval = {};
   auto it = node->m_seqChildren.begin();
   simd_values<std::conditional_t<isDouble, double, float>> f;
   for (size_t i = 0; i < 4 && it != node->m_seqChildren.end(); ++i, ++it) {
     YAMLNode* snode = it->get();
     if (snode->m_type == YAML_SCALAR_NODE) {
-      if (isDouble)
+      if constexpr (isDouble) {
         f[i] = NodeToVal<double>(snode);
-      else
+      } else {
         f[i] = NodeToVal<float>(snode);
-    } else
+      }
+    } else {
       f[i] = 0.0;
+    }
   }
   retval.simd.copy_from(f);
   return retval;


better error ignor^H^H^H^H^Hhandling

better error ignor^H^H^H^H^Hhandling

--- src/server/graph_serv.cpp
+++ src/server/graph_serv.cpp
@@ -21,6 +21,7 @@
 #include "../graph/graph_factory.hpp"
 #include "../common/util.hpp"
 #include "../common/membership.hpp"
+#include "graph_client.hpp"

 #include "../framework/aggregators.hpp"

@@ -33,6 +34,9 @@

 namespace jubatus { namespace server {

+enum graph_serv_error {
+  NODE_ALREADY_EXISTS = 0xDEADBEEF
+};

 inline node_id uint642nodeid(uint64_t i){
   return pfi::lang::lexical_cast<node_id, uint64_t>(i);
@@ -64,9 +68,11 @@
   uint64_t nid = idgen_.generate();
   std::string nid_str = pfi::lang::lexical_cast<std::string>(nid);
   // send true create_global_node to other machines.
+  //DLOG(INFO) << __func__ << " " << nid_str;

   if(not a_.is_standalone()){
-    // TODO: we need global locking
+    // we dont need global locking, because getting unique id from zk
+    // guarantees there'll be no data confliction
     {
       common::cht ht(zk_, a_.name);
       std::vector<std::pair<std::string, int> > nodes;
@@ -74,40 +80,46 @@
       if(nodes.empty()){
         throw std::runtime_error("fatal: no server found in cht: "+nid_str);
       }
-
+      // this sequences MUST success, in case of failures the whole request should be canceled
       if(nodes[0].first == a_.eth && nodes[0].second == a_.port){
-        create_node_here(nid_str);
+        this->create_node_here(nid_str);
       }else{
-        pfi::network::mprpc::rpc_client c(nodes[0].first, nodes[0].second, 5.0);
-        pfi::lang::function<int(std::string)> f = c.call<int(std::string)>("craete_node_here");
-        f(nid_str);
+        client::graph c(nodes[0].first, nodes[0].second, 5.0);
+        c.create_node_here(a_.name, nid_str);
       }
+
       for(size_t i = 1; i < nodes.size(); ++i){
         try{
           if(nodes[i].first == a_.eth && nodes[i].second == a_.port){
-            create_node_here(nid_str);
+            this->create_node_here(nid_str);
           }else{
-            pfi::network::mprpc::rpc_client c(nodes[i].first, nodes[i].second, 5.0);
-            pfi::lang::function<int(std::string)> f = c.call<int(std::string)>("craete_node_here");
-            f(nid_str);
+            client::graph c(nodes[i].first, nodes[i].second, 5.0);
+            c.create_node_here(a_.name, nid_str);
           }
-        }catch(const std::runtime_error& e){
-          LOG(INFO) << i << "th replica: " << nodes[i].first << ":" << nodes[i].second << " " << e.what();
+        }catch(const graph::local_node_exists& e){ // pass through
+        }catch(const graph::global_node_exists& e){// pass through
+
+        }catch(const std::runtime_error& e){ // error !
+          LOG(INFO) << i+1 << "th replica: " << nodes[i].first << ":" << nodes[i].second << " " << e.what();
         }
       }
-
     }
     std::vector<std::pair<std::string, int> > members;
     get_members(members);
     if(not members.empty()){
       common::mprpc::rpc_mclient c(members, a_.timeout); //create global node
       c.call_async("create_global_node", a_.name, nid_str);
-      c.join_all<int>(pfi::lang::function<int(int,int)>(&jubatus::framework::add<int>));
+
+      try{
+        c.join_all<int>(pfi::lang::function<int(int,int)>(&jubatus::framework::add<int>));
+      }catch(const std::runtime_error & e){ // no results?, pass through
+        DLOG(INFO) << __func__ << " " << e.what();
+      }
     }
   }else{
-    create_node_here(nid_str);
-  }
-  //DLOG(INFO) << "new node created: " << nid_str;
+    this->create_node_here(nid_str);
+  }
+  DLOG(INFO) << "new node created: " << nid_str;
   return nid_str;
 }

@@ -124,8 +136,8 @@
   g_.get_model()->remove_global_node(n2i(nid));

   if(not a_.is_standalone()){
-  // TODO: we need global locking
-  // send true remove_node_ to other machine,
+    // send true remove_node_ to other machine,
+    // if conflicts with create_node, users should re-run to ensure removal
     std::vector<std::pair<std::string, int> > members;
     get_members(members);

@@ -283,20 +295,43 @@

 int graph_serv::create_node_here(const std::string& nid)
 {
-  graph::node_id_t id = pfi::lang::lexical_cast<graph::node_id_t>(nid);
-  g_.get_model()->create_node(id);
-  g_.get_model()->create_global_node(id);
+  try{
+    graph::node_id_t id = pfi::lang::lexical_cast<graph::node_id_t>(nid);
+    g_.get_model()->create_node(id);
+    g_.get_model()->create_global_node(id);
+
+  }catch(const graph::local_node_exists& e){ //pass through
+  }catch(const graph::global_node_exists& e){//pass through
+  }catch(const std::runtime_error& e){
+    DLOG(INFO) << e.what() << " " << nid;
+    throw e;
+  }
+
   return 0;
 }
 int graph_serv::create_global_node(const std::string& nid)
 {
-  g_.get_model()->create_global_node(n2i(nid));
+  try{
+    g_.get_model()->create_global_node(n2i(nid));
+  }catch(const graph::local_node_exists& e){
+  }catch(const graph::global_node_exists& e){
+  }catch(const std::runtime_error& e){
+    DLOG(INFO) << e.what() << " " << nid;
+    throw e;
+  }
   return 0;
 } //update internal

 int graph_serv::remove_global_node(const std::string& nid)
 {
-  g_.get_model()->remove_global_node(n2i(nid));
+  try{
+    g_.get_model()->remove_global_node(n2i(nid));
+  }catch(const graph::local_node_exists& e){
+  }catch(const graph::global_node_exists& e){
+  }catch(const std::runtime_error& e){
+    DLOG(INFO) << e.what() << " " << nid;
+    throw e;
+  }
   return 0;
 } //update internal


fixed typo

fixed typo

--- src/server/graph_serv.cpp
+++ src/server/graph_serv.cpp
@@ -149,7 +149,7 @@
         } catch(const graph::local_node_exists& e) { // pass through
         } catch(const graph::global_node_exists& e) {// pass through
         } catch(const std::runtime_error& e) { // error !
-          LOG(WARNING) << "cannot crate " << i << "th replica: " << nodes[i].first << ":" << nodes[i].second;
+          LOG(WARNING) << "cannot create " << i << "th replica: " << nodes[i].first << ":" << nodes[i].second;
           LOG(WARNING) << e.what();
         }
       }


HTTP Client: Print pending data size or number of pending requests

--- src/server/http_client.cc
+++ src/server/http_client.cc
@@ -478,12 +478,20 @@
 		// } else if (running) {
 		// 	L_NOTICE("Client closed unexpectedly after {}: There was still a worker running", string::from_delta(new_request->begins, std::chrono::system_clock::now()));
 		} else if (!write_queue.empty()) {
-			L_NOTICE("Client closed unexpectedly after {}: There was still pending data", string::from_delta(new_request->begins, std::chrono::system_clock::now()));
+			size_t pending_bytes = 0;
+			std::shared_ptr<Buffer> buffer;
+			while (write_queue.front(buffer)) {
+				pending_bytes += buffer->size();
+				write_queue.pop(buffer);
+			}
+			if (pending_bytes) {
+				L_NOTICE("Client closed unexpectedly after {}: There were still {} bytes of pending data", string::from_delta(new_request->begins, std::chrono::system_clock::now()), pending_bytes);
+			}
 		} else {
 			std::lock_guard<std::mutex> lk(runner_mutex);
 			auto requests_size = requests.size();
 			if (requests_size && (requests_size > 1 || requests.front()->response.status == static_cast<http_status>(0))) {
-				L_NOTICE("Client closed unexpectedly after {}: There were still pending requests", string::from_delta(new_request->begins, std::chrono::system_clock::now()));
+				L_NOTICE("Client closed unexpectedly after {}: There were still {} pending requests", string::from_delta(new_request->begins, std::chrono::system_clock::now()), requests_size);
 			}
 		}
 		close();


Remove duplicate pass

Remove duplicate pass

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

--- tools/llc/llc.cpp
+++ tools/llc/llc.cpp
@@ -118,10 +118,6 @@
                 << Opt->getPassName() << "\n";
   }

-  // Decompose multi-dimensional refs into a sequence of 1D refs
-  // FIXME: This is sparc specific!
-  Passes.add(createDecomposeMultiDimRefsPass());
-
   // Replace malloc and free instructions with library calls.
   // Do this after tracing until lli implements these lib calls.
   // For now, it will emulate malloc and free internally.


HttpClient: Fixed MsgPack's move

HttpClient: Fixed MsgPack's move

--- src/server/http_client.cc
+++ src/server/http_client.cc
@@ -838,12 +838,8 @@
 				// There should be a runner, just enqueue request.
 				requests.push_back(std::move(new_request));
 			}
-
-			// FIXME: The following assignment should be outside this scope
-			// (shouldn't need th lock) but MsgPack's move (above) must have an
-			// error and isn't really moving something.
-			new_request = Request(this);
-		}
+		}
+		new_request = Request(this);
 	}
 	waiting = false;


Add newline at end of file.

Add newline at end of file.

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

--- tools/lto/lto.cpp
+++ tools/lto/lto.cpp
@@ -262,4 +262,4 @@
 lto_codegen_debug_options(lto_code_gen_t cg, const char * opt)
 {
   cg->setCodeGenDebugOptions(opt);
-}+}


HttpClient: Use request.head to display "Response taking too long"

--- src/server/http_client.cc
+++ src/server/http_client.cc
@@ -882,7 +882,7 @@
 	if (request.log) {
 		request.log->clear();
 	}
-	request.log = L_DELAYED(true, 1s, LOG_DEBUG, PURPLE, "Response taking too long: %s %s HTTP/%d.%d", http_method_str(HTTP_PARSER_METHOD(&request.parser)), request.path, request.parser.http_major, request.parser.http_minor).release();
+	request.log = L_DELAYED(true, 1s, LOG_DEBUG, PURPLE, "Response taking too long: %s", request.head).release();

 	request.received = std::chrono::system_clock::now();


add memory via to ok

add memory via to ok

Just like the time via, but instead of printing how long the thing took
to run it prints how much memory was used by the process at peak.

When ok runs in (default) process-per-task mode, this is quite handy.

Change-Id: I331d446e39363a44c545278d7153fa7548e2add0
Reviewed-on: https://skia-review.googlesource.com/20261
Reviewed-by: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@chromium.org>
Commit-Queue: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@chromium.org>

--- tools/ok_vias.cpp
+++ tools/ok_vias.cpp
@@ -9,6 +9,7 @@
 #include "SkOSFile.h"
 #include "SkPictureRecorder.h"
 #include "SkPngEncoder.h"
+#include "ProcStats.h"
 #include "Timer.h"
 #include "ok.h"
 #include <chrono>
@@ -156,6 +157,28 @@
         return target->image();
     }
 };
-static Register _time{"time",
-                      "print wall run time",
-                      Time::Create};
+static Register _time{"time", "print wall run time", Time::Create};
+
+struct Memory : Dst {
+    std::unique_ptr<Dst> target;
+
+    static std::unique_ptr<Dst> Create(Options options, std::unique_ptr<Dst> dst) {
+        Memory via;
+        via.target = std::move(dst);
+        return move_unique(via);
+    }
+
+    Status draw(Src* src) override {
+        Status status = target->draw(src);
+
+        auto msg = SkStringPrintf("%dMB", sk_tools::getMaxResidentSetSizeMB());
+        ok_log(msg.c_str());
+
+        return status;
+    }
+
+    sk_sp<SkImage> image() override {
+        return target->image();
+    }
+};
+static Register memory{"memory", "print process maximum memory usage", Memory::Create};


HTTP Client: Cleanups for search_view

HTTP Client: Cleanups for search_view

--- src/server/http_client.cc
+++ src/server/http_client.cc
@@ -2233,61 +2233,6 @@
 {
 	L_CALL("HttpClient::search_view()");

-	std::string selector_string_holder;
-	auto selector = request.path_parser.get_slc();
-	auto id = request.path_parser.get_id();
-
-	auto query_field = query_field_maker(request, QUERY_FIELD_VOLATILE | (id.empty() ? QUERY_FIELD_SEARCH : QUERY_FIELD_ID));
-	endpoints_maker(request, query_field.as_volatile);
-
-	if (!query_field.selector.empty()) {
-		selector = query_field.selector;
-	}
-
-	MSet mset{};
-	MsgPack aggregations;
-
-	request.processing = std::chrono::system_clock::now();
-
-	DatabaseHandler db_handler;
-	try {
-		if (query_field.as_volatile) {
-			if (endpoints.size() != 1) {
-				THROW(ClientError, "Expecting exactly one index with volatile");
-			}
-			db_handler.reset(endpoints, DB_OPEN | DB_WRITABLE, method);
-		} else {
-			db_handler.reset(endpoints, DB_OPEN, method);
-		}
-
-		if (request.raw.empty()) {
-			mset = db_handler.get_mset(query_field, nullptr, nullptr);
-		} else {
-			auto& decoded_body = request.decoded_body();
-
-			AggregationMatchSpy aggs(decoded_body, db_handler.get_schema());
-
-			if (decoded_body.find(QUERYDSL_SELECTOR) != decoded_body.end()) {
-				auto selector_obj = decoded_body.at(QUERYDSL_SELECTOR);
-				if (selector_obj.is_string()) {
-					selector_string_holder = selector_obj.as_str();
-					selector = selector_string_holder;
-				} else {
-					THROW(ClientError, "The %s must be a string", QUERYDSL_SELECTOR);
-				}
-			}
-
-			mset = db_handler.get_mset(query_field, &decoded_body, &aggs);
-			aggregations = aggs.get_aggregation().at(AGGREGATION_AGGREGATIONS);
-		}
-	} catch (const NotFoundError&) {
-		/* At the moment when the endpoint does not exist and it is chunck it will return 200 response
-		 * with zero matches this behavior may change in the future for instance ( return 404 ) */
-	}
-
-	int rc = 0;
-	auto total_count = mset.size();
-
 	// Get default content type to return.
 	auto ct_type = resolve_ct_type(request, MSGPACK_CONTENT_TYPE);
 	if (
@@ -2305,6 +2250,61 @@
 		return;
 	}

+	std::string selector_string_holder;
+	auto selector = request.path_parser.get_slc();
+	auto id = request.path_parser.get_id();
+
+	auto query_field = query_field_maker(request, QUERY_FIELD_VOLATILE | (id.empty() ? QUERY_FIELD_SEARCH : QUERY_FIELD_ID));
+	endpoints_maker(request, query_field.as_volatile);
+
+	if (!query_field.selector.empty()) {
+		selector = query_field.selector;
+	}
+
+	MSet mset{};
+	MsgPack aggregations;
+
+	request.processing = std::chrono::system_clock::now();
+
+	// Open database
+	DatabaseHandler db_handler;
+	try {
+		if (query_field.as_volatile) {
+			if (endpoints.size() != 1) {
+				THROW(ClientError, "Expecting exactly one index with volatile");
+			}
+			db_handler.reset(endpoints, DB_OPEN | DB_WRITABLE, method);
+		} else {
+			db_handler.reset(endpoints, DB_OPEN, method);
+		}
+
+		if (request.raw.empty()) {
+			mset = db_handler.get_mset(query_field, nullptr, nullptr);
+		} else {
+			auto& decoded_body = request.decoded_body();
+
+			AggregationMatchSpy aggs(decoded_body, db_handler.get_schema());
+
+			if (decoded_body.find(QUERYDSL_SELECTOR) != decoded_body.end()) {
+				auto selector_obj = decoded_body.at(QUERYDSL_SELECTOR);
+				if (selector_obj.is_string()) {
+					selector_string_holder = selector_obj.as_str();
+					selector = selector_string_holder;
+				} else {
+					THROW(ClientError, "The %s must be a string", QUERYDSL_SELECTOR);
+				}
+			}
+
+			mset = db_handler.get_mset(query_field, &decoded_body, &aggs);
+			aggregations = aggs.get_aggregation().at(AGGREGATION_AGGREGATIONS);
+		}
+	} catch (const NotFoundError&) {
+		/* At the moment when the endpoint does not exist and it is chunck it will return 200 response
+		 * with zero matches this behavior may change in the future for instance ( return 404 ) */
+	}
+
+	auto total_count = mset.size();
+
 	MsgPack obj;
 	if (aggregations) {
 		obj[RESPONSE_AGGREGATIONS] = aggregations;
@@ -2317,13 +2317,11 @@
 	auto& hits = obj[RESPONSE_QUERY][RESPONSE_HITS];

 	const auto m_e = mset.end();
-	for (auto m = mset.begin(); m != m_e; ++rc, ++m) {
+	for (auto m = mset.begin(); m != m_e; ++m) {
+
+		// Retrive document data
 		auto document = db_handler.get_document(*m);
-
 		const auto data = Data(document.get_data());
-		if (data.empty()) {
-			continue;
-		}

 		MsgPack hit_obj;
 		auto main_locator = data.get("");
@@ -2369,8 +2367,6 @@

 	request.ready = std::chrono::system_clock::now();
 	auto took = std::chrono::duration_cast<std::chrono::nanoseconds>(request.ready - request.processing).count();
-	auto took_milliseconds = took / 1e6;
-	auto took_delta = string::Number(took_milliseconds).str();
 	L_TIME("Searching took %s", string::from_delta(took));

 	if (aggregations) {


That's better!

That's better!

--- src/settings/Settings.cxx
+++ src/settings/Settings.cxx
@@ -24,7 +24,7 @@
 }

 Settings::~Settings() {
-
+    delete[] m_vfs;
 }

 void Settings::read_settings() {
@@ -152,6 +152,6 @@
 }

 bool Settings::do_saved_settings_exist() {
-    return 0;
+    return m_vfs->exists(m_file);
 }


update #include

update #include

--- src/share/log_monitor.hpp
+++ src/share/log_monitor.hpp
@@ -1,6 +1,5 @@
 #pragma once

-#include "file_monitor.hpp"
 #include "filesystem.hpp"
 #include "gcd_utility.hpp"
 #include "spdlog_utility.hpp"


Implement set_property via atom interface (working blinkenlights).

git-svn-id: fb6d863945102bebb9fe1d25d24b18a16295c170@4294 a436a847-0d15-0410-975c-d299462d15a1

--- src/shared/AtomReader.cpp
+++ src/shared/AtomReader.cpp
@@ -140,6 +140,22 @@
 			_iface.set_response_id(obj->body.id);
 			_iface.put(subject_uri, props);
 		}
+	} else if (obj->body.otype == _uris.patch_Set) {
+		const LV2_Atom_Object* body = NULL;
+		lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0);
+		if (!body) {
+			Raul::warn << "Set message has no body" << std::endl;
+			return;
+		} else if (!subject_uri) {
+			Raul::warn << "Set message has no subject" << std::endl;
+			return;
+		}
+
+		LV2_ATOM_OBJECT_FOREACH(body, p) {
+			Raul::Atom val;
+			get_uri(&p->value, val);
+			_iface.set_property(subject_uri, _map.unmap_uri(p->key), val);
+		}
 	} else if (obj->body.otype == _uris.patch_Patch) {
 		if (!subject_uri) {
 			Raul::warn << "Put message has no subject" << std::endl;


Removed unused entry_fits function.

Removed unused entry_fits function.

--- src/btree/leaf_node.cc
+++ src/btree/leaf_node.cc
@@ -99,39 +99,15 @@
     }
 }

-template <class V>
-const V *entry_value(const entry_t *p) {
+const void *entry_value(const entry_t *p) {
     if (entry_is_deletion(p)) {
         return NULL;
     } else {
-        return reinterpret_cast<const V *>(reinterpret_cast<const char *>(p) + entry_key(p)->full_size());
-    }
-}
-
-template <class V>
-bool entry_fits(value_sizer_t<V> *sizer, const entry_t *p, int size) {
-    if (size < 1) {
-        return false;
-    }
-
-    uint8_t code = *reinterpret_cast<const uint8_t *>(p);
-    switch (code) {
-    case DELETE_ENTRY_CODE:
-        return entry_key(p)->fits(size - 1);
-    case SKIP_ENTRY_CODE_ONE:
-        return true;
-    case SKIP_ENTRY_CODE_TWO:
-        return size >= 2;
-    case SKIP_ENTRY_CODE_MANY:
-        return size >= 3 && size >= 3 + *reinterpret_cast<const uint16_t *>(1 + reinterpret_cast<const char *>(p));
-    default:
-        rassert(code <= MAX_KEY_SIZE);
-        return entry_key(p)->fits(size) && sizer->fits(entry_value<V>(p), size - entry_key(p)->full_size());
-    }
-}
-
-template <class V>
-int entry_size(value_sizer_t<V> *sizer, const entry_t *p) {
+        return reinterpret_cast<const char *>(p) + entry_key(p)->full_size();
+    }
+}
+
+int entry_size(value_sizer_t<void> *sizer, const entry_t *p) {
     uint8_t code = *reinterpret_cast<const uint8_t *>(p);
     switch (code) {
     case DELETE_ENTRY_CODE:
@@ -144,7 +120,7 @@
         return 3 + *reinterpret_cast<const uint16_t *>(1 + reinterpret_cast<const char *>(p));
     default:
         rassert(code <= MAX_KEY_SIZE);
-        return entry_key(p)->full_size() + sizer->size(entry_value<V>(p));
+        return entry_key(p)->full_size() + sizer->size(entry_value(p));
     }
 }

@@ -197,7 +173,7 @@
         const btree_key_t *key = entry_key(entry);
         out += strprintf("%.*s:", int(key->size), key->contents);
         out += strprintf("[entry size=%d]", entry_size(sizer, entry));
-        out += strprintf("[value size=%d]", sizer->size(entry_value<void>(entry)));
+        out += strprintf("[value size=%d]", sizer->size(entry_value(entry)));
     } else if (entry_is_deletion(entry)) {
         const btree_key_t *key = entry_key(entry);
         out += strprintf("%.*s:[deletion]", int(key->size), key->contents);
@@ -247,7 +223,7 @@
         const btree_key_t *key = entry_key(entry);
         fprintf(fp, "%.*s:", int(key->size), key->contents);
         fprintf(fp, "[entry size=%d]", entry_size(sizer, entry));
-        fprintf(fp, "[value size=%d]", sizer->size(entry_value<void>(entry)));
+        fprintf(fp, "[value size=%d]", sizer->size(entry_value(entry)));
     } else if (entry_is_deletion(entry)) {
         const btree_key_t *key = entry_key(entry);
         fprintf(fp, "%.*s:[deletion]", int(key->size), key->contents);
@@ -378,7 +354,7 @@

         const entry_t *ent = get_entry(node, offset);
         if (entry_is_live(ent)) {
-            const void *value = entry_value<void>(ent);
+            const void *value = entry_value(ent);
             int space = sizer->block_size().value() - (reinterpret_cast<const char *>(value) - reinterpret_cast<const char *>(node));
             if (!sizer->fits(value, space)) {
                 *msg_out = strprintf("problem with key %.*s: value does not fit\n", entry_key(ent)->size, entry_key(ent)->contents);
@@ -1162,7 +1138,7 @@
     if (find_key(node, key, &index)) {
         const entry_t *ent = get_entry(node, node->pair_offsets[index]);
         if (entry_is_live(ent)) {
-            const void *val = entry_value<void>(ent);
+            const void *val = entry_value(ent);
             memcpy(value_out, val, sizer->size(val));
             return true;
         }
@@ -1349,7 +1325,7 @@
             const entry_t *ent = get_entry(node, iter.offset);

             if (entry_is_live(ent)) {
-                cb->key_value(entry_key(ent), entry_value<void>(ent), tstamp);
+                cb->key_value(entry_key(ent), entry_value(ent), tstamp);
             } else if (entry_is_deletion(ent) && include_deletions) {
                 cb->deletion(entry_key(ent), tstamp);
             }
@@ -1384,7 +1360,7 @@
     if (index_ == node->num_pairs) {
         return NULL;
     } else {
-        return entry_value<void>(get_entry(node, node->pair_offsets[index_]));
+        return entry_value(get_entry(node, node->pair_offsets[index_]));
     }
 }


Roger only shoots when in Lockinangle, not targettingangle

git-svn-id: 67bf12f30ddf2081c31403e0b02b2123541f1680@3340 08b3d480-bf2c-0410-a26f-811ee3361c24

--- src/bzflag/playing.cxx
+++ src/bzflag/playing.cxx
@@ -1720,7 +1720,7 @@

         TimeKeeper now = TimeKeeper::getCurrent();
 	if (now - lastShot >= 0.5f) {
-	  if (fabs(rotation) < BZDB->eval(StateDatabase::BZDB_TARGETINGANGLE)) {
+	  if (fabs(rotation) < BZDB->eval(StateDatabase::BZDB_LOCKONANGLE)) {
 	    float dir[3] = {cosf(azimuth), sinf(azimuth), 0.0f};
 	    Ray tankRay(pos, dir);
 	    distance += BZDB->eval(StateDatabase::BZDB_TANKLENGTH);