mfplay: remove trailing whitespace in winmain

- sample code wasn't cleaned before initial commit

Change-Id: If4d978d454cf581aeed7a363b7ac12a7214de3a8

--- mediafoundation/webmmftests/mfplay/winmain.cpp
+++ mediafoundation/webmmftests/mfplay/winmain.cpp
@@ -1,3 +1,4 @@
+#include "gtest/gtest.h"
 #include "Player.hpp"

 PCWSTR szTitle = L"BasicPlayback";
@@ -5,7 +6,7 @@

 HINSTANCE   g_hInstance;                        // current instance
 BOOL        g_bRepaintClient = TRUE;            // Repaint the application client area?
-CPlayer     *g_pPlayer = NULL;                  // Global player object.
+CPlayer     *g_pPlayer = NULL;                  // Global player object.

 // Note: After WM_CREATE is processed, g_pPlayer remains valid until the
 // window is destroyed.
@@ -45,7 +46,7 @@
     // Perform application initialization.
     if (!InitInstance(hInstance, nCmdShow))
     {
-        NotifyError(NULL, L"Could not initialize the application.",
+        NotifyError(NULL, L"Could not initialize the application.",
             HRESULT_FROM_WIN32(GetLastError()));
         return FALSE;
     }
@@ -170,7 +171,7 @@
     PWSTR pszFilePath = NULL;

     // Create the FileOpenDialog object.
-    HRESULT hr = CoCreateInstance(__uuidof(FileOpenDialog), NULL,
+    HRESULT hr = CoCreateInstance(__uuidof(FileOpenDialog), NULL,
         CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFileOpen));
     if (FAILED(hr))
     {
@@ -226,9 +227,9 @@
 {
     HRESULT hr = S_OK;

-    // Pass in an OpenUrlDialogInfo structure to the dialog. The dialog
+    // Pass in an OpenUrlDialogInfo structure to the dialog. The dialog
     // fills in this structure with the URL. The dialog proc allocates
-    // the memory for the string.
+    // the memory for the string.

     OpenUrlDialogInfo url;
     ZeroMemory(&url, sizeof(&url));
@@ -258,7 +259,7 @@
 LRESULT OnCreateWindow(HWND hwnd)
 {
     // Initialize the player object.
-    HRESULT hr = CPlayer::CreateInstance(hwnd, hwnd, &g_pPlayer);
+    HRESULT hr = CPlayer::CreateInstance(hwnd, hwnd, &g_pPlayer);
     if (SUCCEEDED(hr))
     {
         UpdateUI(hwnd, Closed);
@@ -302,7 +303,7 @@
 }

-// Handler for WM_CHAR messages.
+// Handler for WM_CHAR messages.
 void OnKeyPress(WPARAM key)
 {
     switch (key)
@@ -379,7 +380,7 @@
     const size_t MESSAGE_LEN = 512;
     WCHAR message[MESSAGE_LEN];

-    if (SUCCEEDED(StringCchPrintf(message, MESSAGE_LEN, L"%s (HRESULT = 0x%X)",
+    if (SUCCEEDED(StringCchPrintf(message, MESSAGE_LEN, L"%s (HRESULT = 0x%X)",
         pszErrorMessage, hrErr)))
     {
         MessageBox(hwnd, message, NULL, MB_OK | MB_ICONERROR);
@@ -397,7 +398,7 @@
     switch (message)
     {
     case WM_INITDIALOG:
-        // The caller sends a pointer to an OpenUrlDialogInfo structure as the
+        // The caller sends a pointer to an OpenUrlDialogInfo structure as the
         // lParam. This structure stores the URL.
         pUrl = (OpenUrlDialogInfo*)lParam;
         return (INT_PTR)TRUE;
@@ -408,9 +409,9 @@
         case IDOK:
             if (pUrl)
             {
-                // Get the URL from the edit box in the dialog. This function
+                // Get the URL from the edit box in the dialog. This function
                 // allocates memory. The caller must call CoTaskMemAlloc.
-                if (SUCCEEDED(AllocGetWindowText(GetDlgItem(hDlg, IDC_EDIT_URL),
+                if (SUCCEEDED(AllocGetWindowText(GetDlgItem(hDlg, IDC_EDIT_URL),
                     &pUrl->pszURL, &pUrl->cch)))
                 {
                     result = TRUE;
@@ -436,7 +437,7 @@
 // hwnd:     Handle to the window.
 // pszText:  Receives a pointer to the string.
 // pcchLen:  Receives the length of the string, in characters, not including
-//           the terminating NULL character.
+//           the terminating NULL character.

 HRESULT AllocGetWindowText(HWND hwnd, WCHAR **pszText, DWORD *pcchLen)
 {
@@ -445,15 +446,15 @@
         return E_POINTER;
     }

-    *pszText = NULL;
-
-    int cch = GetWindowTextLength(hwnd);
-    if (cch < 0)
-    {
-        return E_UNEXPECTED;
-    }
-
-    PWSTR pszTmp = (PWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (cch + 1));
+    *pszText = NULL;
+
+    int cch = GetWindowTextLength(hwnd);
+    if (cch < 0)
+    {
+        return E_UNEXPECTED;
+    }
+
+    PWSTR pszTmp = (PWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (cch + 1));
     // Includes room for terminating NULL character

     if (!pszTmp)
@@ -467,7 +468,7 @@
     }
     else
     {
-        int res = GetWindowText(hwnd, pszTmp, (cch + 1));
+        int res = GetWindowText(hwnd, pszTmp, (cch + 1));
         // Size includes terminating null character.

         // GetWindowText returns 0 if (a) there is no text or (b) it failed.
@@ -483,7 +484,7 @@
     *pszText = pszTmp;

     // Return the length NOT including the '\0'.
-    *pcchLen = static_cast<DWORD>(cch);
+    *pcchLen = static_cast<DWORD>(cch);

      return S_OK;
 }


preprocess is called even if method is not known and no default method
is registered

git-svn-id: 9d37338a96b4246e490c3e81f78128c2c7fcee34@36 b39e363e-0249-4afc-b8ac-0517a591d126

--- src/frpcmethodregistry.cc
+++ src/frpcmethodregistry.cc
@@ -1,5 +1,5 @@
 /*
- * FILE          $Id: frpcmethodregistry.cc,v 1.2 2006-02-09 16:00:26 vasek Exp $
+ * FILE          $Id: frpcmethodregistry.cc,v 1.3 2006-03-02 13:55:39 vasek Exp $
  *
  * DESCRIPTION
  *
@@ -182,40 +182,30 @@
     Value_t *result;
     try
     {
-        std::map<std::string, RegistryEntry_t>::const_iterator pos = methodMap.find(
-                    methodName);
-
-        if(pos == methodMap.end())
-        {
-
-            //if default method registered call it
-            if(!defaultMethod)
-            {
-                throw Fault_t(FRPC_NO_SUCH_METHOD_ERROR,"Method %s not found",
+        std::map<std::string, RegistryEntry_t>::const_iterator
+            pos = methodMap.find(methodName);
+
+        if (pos == methodMap.end()){
+            if (callbacks)
+                callbacks->preProcess(methodName, clientIP, params);
+
+            // if not default method generate fault
+            if (!defaultMethod)
+                throw Fault_t(FRPC_NO_SUCH_METHOD_ERROR, "Method %s not found",
                               methodName.c_str());
-            }
-            else
-            {
-                if(callbacks)
-                    callbacks->preProcess(methodName, clientIP, params);
-
-
-                result = &(defaultMethod->call(pool, methodName,params));
-                if(callbacks)
-                    callbacks->postProcess(methodName, clientIP, params, *result,timeD.diff());
-
-            }
-
-        }
-        else
-        {
+
+            result = &(defaultMethod->call(pool, methodName,params));
+            if (callbacks)
+                callbacks->postProcess(methodName, clientIP, params, *result,
+                                       timeD.diff());
+        } else {
             if(callbacks)
                 callbacks->preProcess(methodName, clientIP, params);

             result = &(pos->second.method->call(pool, params));
             if(callbacks)
-                callbacks->postProcess(methodName, clientIP, params, *result,timeD.diff());
-
+                callbacks->postProcess(methodName, clientIP, params, *result,
+                                       timeD.diff());
         }
     }
     catch(const TypeError_t &typeError)


Force aborts in OutputNetcdf when there are problems with dimensions, for easier debug

--- src/Outputs/Netcdf.cpp
+++ src/Outputs/Netcdf.cpp
@@ -103,11 +103,15 @@
    // Dimensions
    NcDim* dims[6];
    NcDim* dimOffset   = ncfile.add_dim("Offset");
+   assert(mPdfX.size() > 0);
    NcDim* dimX        = ncfile.add_dim("X", mPdfX.size());
+   assert(mCdfInv.size() > 0);
    NcDim* dimCdf      = ncfile.add_dim("Cdf", mCdfInv.size());
    NcDim* dimVariable = ncfile.add_dim("Variable",1);
+   assert(mLocations.size() > 0);
    NcDim* dimLocation = ncfile.add_dim("Location", mLocations.size());
    //NcDim* dimMember   = ncfile.add_dim("Member", mConfiguration.getSelector()->getMaxMembers());
+   assert(numMembers > 0);
    NcDim* dimMember   = ncfile.add_dim("Member", numMembers);
    std::map<int, Location> map;

@@ -355,7 +359,9 @@
    // Dimensions
    if(!doAppend) {
       dimDate     = ncfile.add_dim("Date");
+      assert(mOffsets.size() > 0);
       dimOffset   = ncfile.add_dim("Offset", mOffsets.size());
+      assert(mCdfX.size() > 0);
       dimX        = ncfile.add_dim("X", mCdfX.size());
       dimVariable = ncfile.add_dim("Variable",1);
       assert(mLocations.size() > 0);


Execute sends macro:run command to director.

--- win32/DirectorExtension.cxx
+++ win32/DirectorExtension.cxx
@@ -206,8 +206,10 @@
 	return false;
 }

-bool DirectorExtension::OnExecute(const char *) {
-	return false;
+bool DirectorExtension::OnExecute(const char *cmd) {
+	CheckEnvironment(host);
+	::SendDirector("macro:run", cmd);
+	return true;
 }

 bool DirectorExtension::OnSavePointReached() {


Add assertion

Add assertion

--- src/PrimeGenerator.cpp
+++ src/PrimeGenerator.cpp
@@ -158,6 +158,7 @@
 void PrimeGenerator::initPrevPrimes(std::vector<uint64_t>& primes,
                                     size_t* size)
 {
+  assert(primes.size() <= 1);
   *size = primes.size();
   size_t n = primeCountApprox(start_, stop_);


Added setting background color via scene manager init.

--- src/PySceneManager.cpp
+++ src/PySceneManager.cpp
@@ -126,8 +126,14 @@
 }

-int PySceneManager::tp_init(Object *self, PyObject * /*args*/, PyObject * /*kwds*/)
-{
+int PySceneManager::tp_init(Object *self, PyObject *args, PyObject *kwds)
+{
+	PyObject *background = 0;
+	static char *kwlist[] = { "background", NULL};
+
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O", kwlist, &background))
+        return -1;
+
 	self->scene = PySceneObject::createWrapper("Separator");
 	self->sceneManager = new SoSceneManager();
 	if (self->scene && self->sceneManager)
@@ -140,6 +146,32 @@
 	Py_INCREF(Py_None);
 	self->renderCallback = Py_None;

+    // configure background color
+	if (background && PySequence_Check(background))
+	{
+		PyObject *seq = PySequence_Fast(background, "expected a sequence");
+		size_t n = PySequence_Size(seq);
+        if (n == 3)
+        {
+            SbColor color(0, 0, 0);
+            for (int i = 0; i < 3; ++i)
+            {
+                PyObject *seqItem = PySequence_GetItem(seq, i);
+                if (seqItem)
+                {
+                    if (PyFloat_Check(seqItem))
+                        color[i] = (float) PyFloat_AsDouble(seqItem);
+                    else if (PyLong_Check(seqItem))
+                        color[i] = (float) PyLong_AsDouble(seqItem);
+                }
+            }
+            if (self->sceneManager)
+                self->sceneManager->setBackgroundColor(color);
+        }
+
+		Py_XDECREF(seq);
+	}
+
 	return 0;
 }


Revert to r1423. I checked in the wrong file.

git-svn-id: 5069ba8be4c997ee907bf46f8ec9a2bbfb655637@1426 e59a4935-1847-0410-ae03-e826735625c1

--- src/STPManager/STP.cpp
+++ src/STPManager/STP.cpp
@@ -23,7 +23,6 @@
 #include "../simplifier/UseITEContext.h"
 #include "../simplifier/AlwaysTrue.h"
 #include "../simplifier/AIGSimplifyPropositionalCore.h"
-#include "../simplifier/BigRewriter.h"
 #include <memory>

 namespace BEEV {
@@ -109,7 +108,6 @@
             bm->ASTNodeStats("After bitblast simplification: ", simplified_solved_InputToSAT);
           }
       }
-
     return simplified_solved_InputToSAT;
   }

@@ -222,22 +220,9 @@
     // so it's expensive to call.
     if (!arrayops && initial_difficulty_score < 1000000)
       {
-        // Remove the sdiv/smod/srem
-        simplified_solved_InputToSAT = arrayTransformer->TransformFormula_TopLevel(simplified_solved_InputToSAT);
-
         simplified_solved_InputToSAT = callSizeReducing(simplified_solved_InputToSAT, bvSolver, initial_difficulty_score);
         initial_difficulty_score = difficulty.score(simplified_solved_InputToSAT);
       }
-
-    {
-      bm->GetRunTimes()->start(RunTimes::BigRewrite);
-      BEEV::BigRewriter b ;
-      ASTNodeMap fromTo;
-      SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
-      simplified_solved_InputToSAT = b.rewrite(simplified_solved_InputToSAT, fromTo, &nf,bm);
-      bm->GetRunTimes()->stop(RunTimes::BigRewrite);
-    }
-

     if (bm->UserFlags.stats_flag)
       cout << "Difficulty After Size reducing:" << initial_difficulty_score << endl;
@@ -294,7 +279,6 @@
           }
       }
     while (inputToSAT != simplified_solved_InputToSAT);
-

     if (bm->UserFlags.bitConstantProp_flag)
       {


fix vs2015 build error

fix vs2015 build error

--- src/Saba/Base/File.cpp
+++ src/Saba/Base/File.cpp
@@ -7,6 +7,7 @@
 #include "UnicodeUtil.h"

 #include <streambuf>
+#include <iterator>

 namespace saba
 {


Improved code to avoid duplicate calls to c_str for namespace/class/path strings

--- src/SampSharp/Main.cpp
+++ src/SampSharp/Main.cpp
@@ -76,22 +76,26 @@
 	#endif

     //load gamemode
+	auto namespace_ctr = (char *)name_space.c_str();
+	auto klass_ctr = (char *)klass.c_str();
+	auto path_ctr = (char *)path.c_str();
+
 	logprintf("[SampSharp] Loading gamemode: %s::%s from \"%s\".",
-		(char *)name_space.c_str(),
-		(char *)klass.c_str(),
-		(char *)path.c_str());
+		namespace_ctr,
+		klass_ctr,
+		path_ctr);

     MonoImage *image = mono_assembly_get_image(
         mono_assembly_open(PathUtil::GetPathInBin(path).c_str(), NULL));

-	auto class_from_name = mono_class_from_name(image, name_space.c_str(), klass.c_str());
+	auto class_from_name = mono_class_from_name(image, namespace_ctr, klass_ctr);

 	if (class_from_name == NULL)
 	{
 		logprintf("[SampShart] %s::%s is not a valid Namespace:Class combination inside \"%s\".",
-			(char *)name_space.c_str(),
-			(char *)klass.c_str(),
-			(char *)path.c_str());
+			namespace_ctr,
+			klass_ctr,
+			path_ctr);

 		return true;
 	}


Correct the allocation size for CCState's UsedRegs member, which
only needs one bit for each register. UsedRegs is a SmallVector
sized at 16, so this eliminates a heap allocation/free for every
call and return processed by Legalize on most targets.

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

--- lib/CodeGen/SelectionDAG/CallingConvLower.cpp
+++ lib/CodeGen/SelectionDAG/CallingConvLower.cpp
@@ -26,7 +26,7 @@
   // No stack is used.
   StackOffset = 0;

-  UsedRegs.resize(TRI.getNumRegs());
+  UsedRegs.resize((TRI.getNumRegs()+31)/32);
 }

 // HandleByVal - Allocate a stack slot large enough to pass an argument by


fix inverted conditional

fix inverted conditional

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

--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -599,7 +599,7 @@
     assert(TLI.isTypeLegal(TVT) &&
            "FIXME: Cannot handle illegal vector types here yet!");
     VT = TVT;
-  }
+  }

   MVT::ValueType DestVT = TLI.getTypeToTransformTo(VT);

@@ -1015,7 +1015,7 @@
 /// node.
 void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
                                                 unsigned Intrinsic) {
-  bool HasChain = IntrinsicCannotAccessMemory(Intrinsic);
+  bool HasChain = !IntrinsicCannotAccessMemory(Intrinsic);

   // Build the operand list.
   std::vector<SDOperand> Ops;


Fix Regression/CodeGen/X86/inline-asm.ll, a case where inline asm causes
implement extension of a register.

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

--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1780,15 +1780,19 @@
       return DAG.getNode(ISD::BUILD_PAIR, ValueVT, Hi, Val);
   }

-  // Otherwise, if the return value was promoted, truncate it to the
+  // Otherwise, if the return value was promoted or extended, truncate it to the
   // appropriate type.
   if (RegVT == ValueVT)
     return Val;

-  if (MVT::isInteger(RegVT))
-    return DAG.getNode(ISD::TRUNCATE, ValueVT, Val);
-  else
+  if (MVT::isInteger(RegVT)) {
+    if (ValueVT < RegVT)
+      return DAG.getNode(ISD::TRUNCATE, ValueVT, Val);
+    else
+      return DAG.getNode(ISD::ANY_EXTEND, ValueVT, Val);
+  } else {
     return DAG.getNode(ISD::FP_ROUND, ValueVT, Val);
+  }
 }

 /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the
@@ -1895,14 +1899,17 @@
   if (PhysReg.first) {
     if (VT == MVT::Other)
       ValueVT = *PhysReg.second->vt_begin();
-    RegVT = VT;
+
+    // Get the actual register value type.  This is important, because the user
+    // may have asked for (e.g.) the AX register in i32 type.  We need to
+    // remember that AX is actually i16 to get the right extension.
+    RegVT = *PhysReg.second->vt_begin();

     // This is a explicit reference to a physical register.
     Regs.push_back(PhysReg.first);

     // If this is an expanded reference, add the rest of the regs to Regs.
     if (NumRegs != 1) {
-      RegVT = *PhysReg.second->vt_begin();
       TargetRegisterClass::iterator I = PhysReg.second->begin();
       TargetRegisterClass::iterator E = PhysReg.second->end();
       for (; *I != PhysReg.first; ++I)


remove unused include directive

remove unused include directive

--- src/geometry/envelope.cpp
+++ src/geometry/envelope.cpp
@@ -22,7 +22,6 @@

 #include <mapnik/geometry/envelope.hpp>
 #include <mapnik/geometry/envelope_impl.hpp>
-#include <mapnik/text/symbolizer_helpers.hpp>

 namespace mapnik { namespace geometry {


Add timing report for various sub-passes under SelectionDAGISel.

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

--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -5314,11 +5314,17 @@
 }

 void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) {
+  NamedRegionTimer *RegionTimer = 0;
+
   DOUT << "Lowered selection DAG:\n";
   DEBUG(DAG.dump());

   // Run the DAG combiner in pre-legalize mode.
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("DAG Combining 1");
   DAG.Combine(false, *AA);
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   DOUT << "Optimized lowered selection DAG:\n";
   DEBUG(DAG.dump());
@@ -5329,13 +5335,21 @@
   DAG.LegalizeTypes();
   // Someday even later, enable a dag combine pass here.
 #endif
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("DAG Legalization");
   DAG.Legalize();
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   DOUT << "Legalized selection DAG:\n";
   DEBUG(DAG.dump());

   // Run the DAG combiner in post-legalize mode.
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("DAG Combining 2");
   DAG.Combine(true, *AA);
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   DOUT << "Optimized legalized selection DAG:\n";
   DEBUG(DAG.dump());
@@ -5347,14 +5361,26 @@

   // Third, instruction select all of the operations to machine code, adding the
   // code to the MachineBasicBlock.
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("Instruction Selection");
   InstructionSelect(DAG);
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   // Emit machine code to BB.  This can change 'BB' to the last block being
   // inserted into.
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("Instruction Scheduling");
   ScheduleAndEmitDAG(DAG);
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   // Perform target specific isel post processing.
+  if (TimePassesIsEnabled)
+    RegionTimer = new NamedRegionTimer("Instruction Selection Post Processing");
   InstructionSelectPostProcessing(DAG);
+  if (TimePassesIsEnabled)
+    delete RegionTimer;

   DOUT << "Selected machine code:\n";
   DEBUG(BB->dump());


Simka: back to simka original

Simka: back to simka original

--- src/SimkaAlgorithm.hpp
+++ src/SimkaAlgorithm.hpp
@@ -25,7 +25,7 @@
 #include<stdio.h>

 #define MULTI_DISK
-#define SIMKA_MIN
+//#define SIMKA_MIN
 #include "SimkaDistance.hpp"

 const string STR_SIMKA_SOLIDITY_PER_DATASET = "-solidity-single";


Fix a very ancient bug from mid 2015 (#2021)

--- src/governance-object.cpp
+++ src/governance-object.cpp
@@ -525,7 +525,7 @@
     // RETRIEVE TRANSACTION IN QUESTION

     if(!GetTransaction(nCollateralHash, txCollateral, Params().GetConsensus(), nBlockHash, true)){
-        strError = strprintf("Can't find collateral tx %s", txCollateral->ToString());
+        strError = strprintf("Can't find collateral tx %s", nCollateralHash.ToString());
         LogPrintf("CGovernanceObject::IsCollateralValid -- %s\n", strError);
         return false;
     }


ARMInstPrinter.cpp: Suppress a warning for -Asserts. [-Wunused-variable]

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

--- lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
+++ lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
@@ -544,9 +544,8 @@
     return;
   }

-  const MCOperand &MO3 = MI->getOperand(Op+2);
-
-  assert(ARM_AM::getAM3IdxMode(MO3.getImm()) != ARMII::IndexModePost &&
+  assert(ARM_AM::getAM3IdxMode(MI->getOperand(Op + 2).getImm()) !=
+             ARMII::IndexModePost &&
          "unexpected idxmode");
   printAM3PreOrOffsetIndexOp(MI, Op, O, AlwaysPrintImm0);
 }


R600/SI: Allow partial unrolling and increase thresholds.

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

--- lib/Target/R600/AMDGPUTargetTransformInfo.cpp
+++ lib/Target/R600/AMDGPUTargetTransformInfo.cpp
@@ -101,6 +101,12 @@

 void AMDGPUTTI::getUnrollingPreferences(Loop *L,
                                         UnrollingPreferences &UP) const {
+  UP.Threshold = 300; // Twice the default.
+  UP.Count = UINT_MAX;
+  UP.Partial = true;
+
+  // TODO: Do we want runtime unrolling?
+
   for (const BasicBlock *BB : L->getBlocks()) {
     for (const Instruction &I : *BB) {
       const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(&I);
@@ -120,7 +126,7 @@
         //
         // Don't use the maximum allowed value here as it will make some
         // programs way too big.
-        UP.Threshold = 500;
+        UP.Threshold = 800;
       }
     }
   }


Fixed typo in r260530

Fixed typo in r260530

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

--- lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -644,8 +644,8 @@
   return true;
 }

-/// Return an existing non-zero constant if this phi node has, otherwise ruturn
-/// constant 1.
+/// Return an existing non-zero constant if this phi node has one, otherwise
+/// return constant 1.
 static ConstantInt *GetAnyNonZeroConstInt(PHINode &PN) {
   assert(isa<IntegerType>(PN.getType()) && "Expect only intger type phi");
   for (Value *V : PN.operands())
@@ -934,9 +934,9 @@
     }
     // When a PHI is used only to be compared with zero, it is safe to replace
     // an incoming value proved as known nonzero with any non-zero constant.
-    // For example, in below code, the incoming value %v can be replaced with
-    // any non-zero constant based on the fact that the PHI is only used to be
-    // compared with zero and %v is a known non-zero value:
+    // For example, in the code below, the incoming value %v can be replaced
+    // with any non-zero constant based on the fact that the PHI is only used to
+    // be compared with zero and %v is a known non-zero value:
     // %v = select %cond, 1, 2
     // %p = phi [%v, BB] ...
     //      icmp eq, %p, 0


cache result of operator*

cache result of operator*

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

--- lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -230,8 +230,9 @@
     bool isAddressTaken = false;
     for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
          UI != E; ++UI) {
-      if (isa<LoadInst>(UI)) continue;
-      if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
+      User *U = *UI;
+      if (isa<LoadInst>(U)) continue;
+      if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
         // If storing TO the alloca, then the address isn't taken.
         if (SI->getOperand(1) == AI) continue;
       }


Make sure QTouchEvent::TouchPoint::rect() returns the proper rect...

... and not the screenRect

--- src/gui/kernel/qevent.cpp
+++ src/gui/kernel/qevent.cpp
@@ -3931,7 +3931,7 @@
 */
 QRectF QTouchEvent::TouchPoint::rect() const
 {
-    return d->screenRect;
+    return d->rect;
 }

 /*!


[LLE] Fix a comment

[LLE] Fix a comment

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@262270 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 525f545ba3fea9089fa2d33dd81b9c62265f073c)

--- lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -219,9 +219,9 @@
         if (OtherCand == nullptr)
           continue;

-        // Handle the very basic of case when the two stores are in the same
-        // block so deciding which one forwards is easy.  The later one forwards
-        // as long as they both have a dependence distance of one to the load.
+        // Handle the very basic case when the two stores are in the same block
+        // so deciding which one forwards is easy.  The later one forwards as
+        // long as they both have a dependence distance of one to the load.
         if (Cand.Store->getParent() == OtherCand->Store->getParent() &&
             Cand.isDependenceDistanceOfOne(PSE) &&
             OtherCand->isDependenceDistanceOfOne(PSE)) {


Add possibillity of overriding invertedY flag for wl_surfaces

Change-Id: I0f4c2696ae5c7071275af326c924dc1eaed6d5b6
Sanity-Review: Qt Sanity Bot <5581206bb7e0307f0d99eb71898ae6b694149ca5@ovi.com>
Reviewed-by: Andy Nichols <3d1e63b963f99f97839545621c6a9a8e2b2ab8fd@nokia.com>

--- src/compositor/wayland_wrapper/wlsurface.cpp
+++ src/compositor/wayland_wrapper/wlsurface.cpp
@@ -431,13 +431,19 @@
 #ifdef QT_COMPOSITOR_WAYLAND_GL
     Q_D(const Surface);

-    if (!d->surfaceBuffer)
-        return false;
-    if (d->compositor->graphicsHWIntegration() && d->surfaceBuffer->handle() && type() != WaylandSurface::Shm) {
-        return d->compositor->graphicsHWIntegration()->isYInverted(d->surfaceBuffer->handle());
-    }
+    bool ret = false;
+
+    static bool negateReturn = qgetenv("QT_COMPOSITOR_NEGATE_INVERTED_Y").toInt();
+
+    if (!d->surfaceBuffer) {
+        ret = false;
+    } else if (d->compositor->graphicsHWIntegration() && d->surfaceBuffer->handle() && type() != WaylandSurface::Shm) {
+        ret = d->compositor->graphicsHWIntegration()->isYInverted(d->surfaceBuffer->handle());
+    } else
 #endif
-    return true;
+        ret = true;
+
+    return ret^negateReturn;
 }

 bool Surface::visible() const


Fixed coverity-found bug.

Fixed coverity-found bug.

--- src/condor_userlog/condor_check_userlogs.cpp
+++ src/condor_userlog/condor_check_userlogs.cpp
@@ -74,9 +74,10 @@

         switch (outcome) {

-        case ULOG_NO_EVENT:
         case ULOG_RD_ERROR:
         case ULOG_UNK_ERROR:
+			logsMissing = true;
+        case ULOG_NO_EVENT:

 			printf( "Log outcome: %s\n", ULogEventOutcomeNames[outcome] );
 			done = true;


ofz#52292 Abrt

ofz#52292 Abrt

it might be we wanted st here not word

--- src/hunspell/affixmgr.cxx
+++ src/hunspell/affixmgr.cxx
@@ -1650,6 +1650,7 @@
         if (scpd > 0) {
           for (; scpd <= checkcpdtable.size() &&
                  (checkcpdtable[scpd - 1].pattern3.empty() ||
+                  i > word.size() ||
                   word.compare(i, checkcpdtable[scpd - 1].pattern3.size(), checkcpdtable[scpd - 1].pattern3) != 0);
                scpd++)
             ;


incrementally increase std::string conversion

--- src/hunspell/hunspell.cxx
+++ src/hunspell/hunspell.cxx
@@ -480,10 +480,13 @@
   int nstate = NBEGIN;
   int i;

+  std::string scw(cw);
+  std::vector<w_char> sunicw(unicw, unicw + (utf8 ? (nc > -1 ? nc : 0) : 0));
+
   for (i = 0; (i < wl); i++) {
-    if ((cw[i] <= '9') && (cw[i] >= '0')) {
+    if ((scw[i] <= '9') && (scw[i] >= '0')) {
       nstate = NNUM;
-    } else if ((cw[i] == ',') || (cw[i] == '.') || (cw[i] == '-')) {
+    } else if ((scw[i] == ',') || (scw[i] == '.') || (scw[i] == '-')) {
       if ((nstate == NSEP) || (i == 0))
         break;
       nstate = NSEP;
@@ -492,9 +495,6 @@
   }
   if ((i == wl) && (nstate == NNUM))
     return 1;
-
-  std::string scw(cw);
-  std::vector<w_char> sunicw(unicw, unicw + (utf8 ? (nc > -1 ? nc : 0) : 0));

   switch (captype) {
     case HUHCAP:


Fix fo CoreCLR cofde formating error
Add extra spacing

[tfs-changeset: 1669566]

--- src/jit/codegenlegacy.cpp
+++ src/jit/codegenlegacy.cpp
@@ -18904,7 +18904,7 @@
                 // stub dispatching is off or this is not a virtual call (could be a tailcall)
                 {
                     regNumber vptrReg;
-                    regNumber vptrReg1 = REG_NA;
+                    regNumber vptrReg1  = REG_NA;
                     regMaskTP vptrMask1 = RBM_NONE;
                     unsigned  vtabOffsOfIndirection;
                     unsigned  vtabOffsAfterIndirection;


adds DerefByValueFancy with random access iterator

(it's just a pointer)

--- tests/samples.hpp
+++ tests/samples.hpp
@@ -41,7 +41,7 @@
     class DerefByValue {
         private:
             static constexpr std::size_t N = 3;
-            int array[N] = {0};
+            int array[N] = {0, 1, 2};
         public:
             DerefByValue() = default;

@@ -78,5 +78,21 @@
                 return {this->array + N};
             }
     };
+
+    class DerefByValueFancy {
+        private:
+            static constexpr std::size_t N = 3;
+            int array[N] = {0, 1, 2};
+        public:
+            DerefByValueFancy() = default;
+
+            int *begin() {
+                return this->array;
+            }
+
+            int *end() {
+                return this->array + N;
+            }
+    };
 }
 #endif // #ifndef ITERTOOLS_SAMPLE_CLASSES_HPP


Remove voodoo workaround from find_acceptable_display_mode.

--- panda/src/windisplay/winGraphicsWindow.cxx
+++ panda/src/windisplay/winGraphicsWindow.cxx
@@ -2304,21 +2304,7 @@

     if ((dm.dmPelsWidth == dwWidth) && (dm.dmPelsHeight == dwHeight) &&
         (dm.dmBitsPerPel == bpp)) {
-      // cout << "[FS FOUND] " << dwWidth << "x" << dwHeight << "@" << bpp << endl;
-      // We want to modify the current DEVMODE rather than using a fresh one in order
-      // to work around a Windows 7 bug.
-      ZeroMemory(&dm, sizeof(dm));
-      dm.dmSize = sizeof(dm);
-      if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)){
-        dm.dmPelsWidth = dwWidth;
-        dm.dmPelsHeight = dwHeight;
-        dm.dmBitsPerPel = bpp;
-        return true;
-      } else {
-        windisplay_cat.error()
-          << "Couldn't retrieve active device mode.\n";
-        return false;
-      }
+      return true;
     }
     modenum++;
   }


Add path_sampling_with_time to UAV

Add path_sampling_with_time to UAV

--- cpp/src/core/uav.hpp
+++ cpp/src/core/uav.hpp
@@ -175,6 +175,22 @@
             return {waypoints, times};
         }

+        /* Returns a sequence of waypoints with its corresponding time following the dubins trajectory,
+         * one every step_size distance units. */
+        std::pair<std::vector<Waypoint3d>, std::vector<double>>
+        path_sampling_with_time(const Waypoint3d& origin, const Waypoint3d& target, const WindVector& wind,
+                                double step_size, double t_start) const {
+            ASSERT(step_size > 0);
+            DubinsWind path = DubinsWind(origin, target, wind, _max_air_speed, _min_turn_radius);
+            auto wp_time = path.sampled_with_time(step_size);
+            auto& t = std::get<1>(wp_time);
+            for (auto it = t.begin(); it != t.end(); ++it) {
+                *it += t_start;
+            }
+            return wp_time;
+
+        }
+
         /** Rotates the given segment on the center of the visibility area. */
         Segment rotate_on_visibility_center(const Segment& segment, double target_dir) const {
             const double visibility_depth = segment.length + _view_depth;


Added better TRACE debugging to the Winelib DLL.

--- winelib/bridge.dll/test.cpp
+++ winelib/bridge.dll/test.cpp
@@ -19,7 +19,7 @@

 Test::Test()
 {
-  WINE_TRACE("(this=%p)\n", this);
+  WINE_TRACE("(this=%p,vtable=%p,function_one=%p)\n", this, *((void **)(this)), &Test::function_one);
 }

 int Test::function_one(int param_one, bool param_two, const char *param_three)
@@ -30,7 +30,7 @@

 bool Test::function_two(double param_one, void *param_two, float param_three)
 {
-  WINE_TRACE("(this=%p,%f,%p,%f)\n", this, param_one, param_two, param_three);
+  WINE_TRACE("(this=%p,%f|%i&%i,%p,%f)\n", this, param_one, param_one, param_two, param_three);
   return true;
 }


Fix build

Fix build

--- src/corelib/animation/qabstractanimation.cpp
+++ src/corelib/animation/qabstractanimation.cpp
@@ -191,9 +191,9 @@
 void QUnifiedTimer::updateAnimationsTime()
 {
     // ignore consistentTiming in case the pause timer is active
-    const int delta = (consistentTiming && !isPauseTimerActive) ?
+    int delta = (consistentTiming && !isPauseTimerActive) ?
                         timingInterval : time.elapsed() - lastTick;
-    if slowMode)
+    if (slowMode)
         delta /= 5;
     lastTick = time.elapsed();


proper sampling from unit sphere

proper sampling from unit sphere

--- vest/line_optimizer.cc
+++ vest/line_optimizer.cc
@@ -81,7 +81,7 @@
                                      RandomNumberGenerator<boost::mt19937>* rng) {
   axis->clear();
   for (int i = 0; i < features_to_optimize.size(); ++i)
-    axis->set_value(features_to_optimize[i], rng->next() - 0.5);
+    axis->set_value(features_to_optimize[i], rng->NextNormal(0.0,1.0));
   (*axis) /= axis->l2norm();
 }


[ASTGen] Clean up casting with source locations

--- lib/AST/CASTBridging.cpp
+++ lib/AST/CASTBridging.cpp
@@ -14,6 +14,11 @@
 template <typename T>
 inline llvm::ArrayRef<T> getArrayRef(BridgedArrayRef bridged) {
   return {static_cast<const T *>(bridged.data), size_t(bridged.numElements)};
+}
+
+static SourceLoc getSourceLocFromPointer(void *loc) {
+  auto smLoc = llvm::SMLoc::getFromPointer((const char *)loc);
+  return SourceLoc(smLoc);
 }

 BridgedIdentifier
@@ -39,14 +44,15 @@
     importPath.push_back(ident, loc);
   }
   return ImportDecl::create(
-      Context, static_cast<DeclContext *>(dc), *(SourceLoc *)&importLoc,
-      static_cast<ImportKind>(kind), *(SourceLoc *)&kindLoc,
+      Context, static_cast<DeclContext *>(dc),
+      getSourceLocFromPointer(importLoc),
+      static_cast<ImportKind>(kind), getSourceLocFromPointer(kindLoc),
       std::move(importPath).get());
 }

 void *BridgedSourceLoc_advanced(void *loc, long len) {
-  SourceLoc l = ((SourceLoc *)&loc)->getAdvancedLoc(len);
-  return &l; // TODO: what?
+  SourceLoc l = getSourceLocFromPointer(loc).getAdvancedLoc(len);
+  return const_cast<void *>(l.getOpaquePointerValue());
 }

 void *SwiftTopLevelCodeDecl_createStmt(void *ctx, void *DC, void *startLoc,
@@ -54,8 +60,8 @@
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
   auto *S = static_cast<Stmt *>(element);
   auto Brace =
-      BraceStmt::create(Context, *(SourceLoc *)&startLoc,
-                        {S}, *(SourceLoc *)&endLoc,
+      BraceStmt::create(Context, getSourceLocFromPointer(startLoc),
+                        {S}, getSourceLocFromPointer(endLoc),
                         /*Implicit=*/true);
   auto *TLCD =
       new (Context) TopLevelCodeDecl(static_cast<DeclContext *>(DC), Brace);
@@ -67,8 +73,8 @@
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
   auto *E = static_cast<Expr *>(element);
   auto Brace =
-      BraceStmt::create(Context, *(SourceLoc *)&startLoc,
-                        {E}, *(SourceLoc *)&endLoc,
+      BraceStmt::create(Context, getSourceLocFromPointer(startLoc),
+                        {E}, getSourceLocFromPointer(endLoc),
                         /*Implicit=*/true);
   auto *TLCD =
       new (Context) TopLevelCodeDecl(static_cast<DeclContext *>(DC), Brace);
@@ -83,8 +89,8 @@
 void *SwiftTupleExpr_create(void *ctx, void *lparen, BridgedArrayRef subs,
                             void *rparen) {
   return TupleExpr::create(
-      *static_cast<ASTContext *>(ctx), *(SourceLoc *)&lparen,
-      getArrayRef<Expr *>(subs), {}, {}, *(SourceLoc *)&rparen,
+      *static_cast<ASTContext *>(ctx), getSourceLocFromPointer(lparen),
+      getArrayRef<Expr *>(subs), {}, {}, getSourceLocFromPointer(rparen),
       /*Implicit*/ false);
 }

@@ -108,7 +114,7 @@
   auto name = DeclNameRef{
       swift::Identifier::getFromOpaquePointer(base)};
   Expr *E = new (Context) UnresolvedDeclRefExpr(
-      name, DeclRefKind::Ordinary, DeclNameLoc{*(SourceLoc *)&loc});
+      name, DeclRefKind::Ordinary, DeclNameLoc{getSourceLocFromPointer(loc)});
   return E;
 }

@@ -118,7 +124,7 @@
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
   return new (Context) StringLiteralExpr(
       StringRef{reinterpret_cast<const char *>(string), size_t(len)},
-      *(SourceLoc *)&TokenLoc);
+      getSourceLocFromPointer(TokenLoc));
 }

 void *SwiftIntegerLiteralExpr_create(
@@ -126,12 +132,13 @@
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
   return new (Context) IntegerLiteralExpr(
       StringRef{reinterpret_cast<const char *>(string), size_t(len)},
-      *(SourceLoc *)&TokenLoc);
+      getSourceLocFromPointer(TokenLoc));
 }

 void *SwiftBooleanLiteralExpr_create(void *ctx, bool value, void *TokenLoc) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return new (Context) BooleanLiteralExpr(value, *(SourceLoc *)&TokenLoc);
+  return new (Context) BooleanLiteralExpr(
+      value, getSourceLocFromPointer(TokenLoc));
 }

 void *SwiftVarDecl_create(void *ctx, BridgedIdentifier _Nullable nameId,
@@ -139,22 +146,24 @@
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
   return new (Context) VarDecl(isStatic,
                                isLet ? VarDecl::Introducer::Let : VarDecl::Introducer::Var,
-                               *(SourceLoc *)&loc, Identifier::getFromOpaquePointer(nameId),
+                               getSourceLocFromPointer(loc),
+                               Identifier::getFromOpaquePointer(nameId),
                                reinterpret_cast<DeclContext *>(dc));
 }

 void *IfStmt_create(void *ctx, void *ifLoc, void *cond, void *_Nullable then, void *_Nullable elseLoc,
                     void *_Nullable elseStmt) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return new (Context) IfStmt(*(SourceLoc *)&ifLoc, (Expr *)cond, (Stmt *)then, *(SourceLoc *)&elseLoc,
-                              (Stmt *)elseStmt, None, Context);
+  return new (Context) IfStmt(
+      getSourceLocFromPointer(ifLoc), (Expr *)cond, (Stmt *)then,
+      getSourceLocFromPointer(elseLoc), (Stmt *)elseStmt, None, Context);
 }

 void *BraceStmt_createExpr(void *ctx, void *lbloc, BridgedArrayRef elements, void *rbloc) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return BraceStmt::create(Context, *(SourceLoc *)&lbloc,
+  return BraceStmt::create(Context, getSourceLocFromPointer(lbloc),
                            getArrayRef<ASTNode>(elements),
-                           *(SourceLoc *)&rbloc);
+                           getSourceLocFromPointer(rbloc));
 }

 void *BraceStmt_createStmt(void *ctx, void *lbloc, BridgedArrayRef elements, void *rbloc) {
@@ -164,9 +173,9 @@
   }

   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return BraceStmt::create(Context, *(SourceLoc *)&lbloc,
+  return BraceStmt::create(Context, getSourceLocFromPointer(lbloc),
                            Context.AllocateCopy(nodes),
-                           *(SourceLoc *)&rbloc);
+                           getSourceLocFromPointer(rbloc));
 }

 void *ParamDecl_create(
@@ -175,9 +184,10 @@
     void *_Nullable paramLoc, BridgedIdentifier _Nullable paramName,
     void *declContext) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return new (Context) ParamDecl(*(SourceLoc *)&loc, *(SourceLoc *)&argLoc,
+  return new (Context) ParamDecl(getSourceLocFromPointer(loc),
+                                 getSourceLocFromPointer(argLoc),
                                  Identifier::getFromOpaquePointer(argName),
-                                 *(SourceLoc *)&paramLoc,
+                                 getSourceLocFromPointer(paramLoc),
                                  Identifier::getFromOpaquePointer(paramName),
                                  (DeclContext *)declContext);
 }
@@ -190,16 +200,18 @@
                       void *_Nullable body, void *_Nullable returnType,
                       void *declContext) {
   auto *paramList = ParameterList::create(
-      *static_cast<ASTContext *>(ctx), *(SourceLoc *)&paramLLoc,
-      getArrayRef<ParamDecl *>(params), *(SourceLoc *)&paramRLoc);
+      *static_cast<ASTContext *>(ctx), getSourceLocFromPointer(paramLLoc),
+      getArrayRef<ParamDecl *>(params), getSourceLocFromPointer(paramRLoc));
   auto declName =
       DeclName(*static_cast<ASTContext *>(ctx),
                Identifier::getFromOpaquePointer(name), paramList);
   auto *out = FuncDecl::create(
-      *static_cast<ASTContext *>(ctx), *(SourceLoc *)&staticLoc,
+      *static_cast<ASTContext *>(ctx), getSourceLocFromPointer(staticLoc),
       isStatic ? StaticSpellingKind::KeywordStatic : StaticSpellingKind::None,
-      *(SourceLoc *)&funcLoc, declName, *(SourceLoc *)&nameLoc, isAsync,
-      *(SourceLoc *)&asyncLoc, throws, *(SourceLoc *)&throwsLoc, nullptr,
+      getSourceLocFromPointer(funcLoc), declName,
+      getSourceLocFromPointer(nameLoc), isAsync,
+      getSourceLocFromPointer(asyncLoc), throws,
+      getSourceLocFromPointer(throwsLoc), nullptr,
       paramList, (TypeRepr *)returnType, (DeclContext *)declContext);
   out->setBody((BraceStmt *)body, FuncDecl::BodyKind::Parsed);

@@ -208,17 +220,19 @@

 void *SimpleIdentTypeRepr_create(void *ctx, void *loc, BridgedIdentifier id) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  return new (Context) SimpleIdentTypeRepr(DeclNameLoc(*(SourceLoc *)&loc),
-                                           DeclNameRef(Identifier::getFromOpaquePointer(id)));
+  return new (Context) SimpleIdentTypeRepr(
+      DeclNameLoc(getSourceLocFromPointer(loc)),
+      DeclNameRef(Identifier::getFromOpaquePointer(id)));
 }

 void *UnresolvedDotExpr_create(
     void *ctx, void *base, void *dotLoc,  BridgedIdentifier name,
     void *nameLoc) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-      return new (Context) UnresolvedDotExpr((Expr *)base, *(SourceLoc *)&dotLoc,
-                                         DeclNameRef(Identifier::getFromOpaquePointer(name)),
-                                         DeclNameLoc(*(SourceLoc *)&nameLoc), false);
+      return new (Context) UnresolvedDotExpr(
+          (Expr *)base, getSourceLocFromPointer(dotLoc),
+          DeclNameRef(Identifier::getFromOpaquePointer(name)),
+          DeclNameLoc(getSourceLocFromPointer(nameLoc)), false);
 }

 void *ClosureExpr_create(void *ctx, void *body, void *dc) {
@@ -246,9 +260,9 @@
 DeclContextAndDecl StructDecl_create(
     void *ctx, void *loc, BridgedIdentifier name, void *nameLoc, void *dc) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  auto *out = new (Context) StructDecl(SourceLoc(), // *(SourceLoc *)&loc,
+  auto *out = new (Context) StructDecl(getSourceLocFromPointer(loc),
                                        Identifier::getFromOpaquePointer(name),
-                                       SourceLoc(), // *(SourceLoc *)&nameLoc,
+                                       getSourceLocFromPointer(nameLoc),
                                        {}, nullptr,
                                        (DeclContext *)dc);
   out->setImplicit(); // TODO: remove this.
@@ -258,17 +272,17 @@
 DeclContextAndDecl ClassDecl_create(
     void *ctx, void *loc, BridgedIdentifier name, void *nameLoc, void *dc) {
   ASTContext &Context = *static_cast<ASTContext *>(ctx);
-  auto *out = new (Context) ClassDecl(SourceLoc(), // *(SourceLoc *)&loc,
+  auto *out = new (Context) ClassDecl(getSourceLocFromPointer(loc),
                                       Identifier::getFromOpaquePointer(name),
-                                      SourceLoc(), // *(SourceLoc *)&nameLoc,
+                                      getSourceLocFromPointer(nameLoc),
                                       {}, nullptr,
                                       (DeclContext *)dc, false);
   out->setImplicit(); // TODO: remove this.
   return {(DeclContext *)out, (NominalTypeDecl *)out, (Decl *)out};
 }

-void TopLevelCodeDecl_dump(void *decl) { ((TopLevelCodeDecl *)decl)->dump(); }
-
-void Expr_dump(void *expr) { ((Expr *)expr)->dump(); }
-void Decl_dump(void *expr) { ((Decl *)expr)->dump(); }
-void Stmt_dump(void *expr) { ((Stmt *)expr)->dump(); }
+void TopLevelCodeDecl_dump(void *decl) { ((TopLevelCodeDecl *)decl)->dump(llvm::errs()); }
+
+void Expr_dump(void *expr) { ((Expr *)expr)->dump(llvm::errs()); }
+void Decl_dump(void *expr) { ((Decl *)expr)->dump(llvm::errs()); }
+void Stmt_dump(void *expr) { ((Stmt *)expr)->dump(llvm::errs()); }


create track on given storage with given music/artist/album as parent

--- mtp/metadata/Library.cpp
+++ mtp/metadata/Library.cpp
@@ -214,7 +214,7 @@
 		os.Write16(static_cast<u16>(DataTypeCode::String));
 		os.WriteString(filename);

-		auto response = _session->SendObjectPropList(Session::AnyStorage, Session::Device, type, size, propList);
+		auto response = _session->SendObjectPropList(_storage, album->MusicFolderId, type, size, propList);
 		return response.ObjectId;
 	}


modif

modif

--- tests/test-simd.C
+++ tests/test-simd.C
@@ -293,6 +293,11 @@
 }

 template<class simd, class Element, class SimdFunc, class ScalFunc>
+inline
+typename std::enable_if<
+(function_traits<SimdFunc>::arity != 10) &&
+!(std::is_same<typename function_traits<SimdFunc>::return_type, void>::value)
+, bool>::type
 test_blend(SimdFunc fsimd, ScalFunc fscal, uint64_t seed, size_t vectorSize, Element max, std::string name){
 	using vect_t = typename simd::vect_t;
 	uint8_t s = 0x1;


protect lockfiles with a guid

protect lockfiles with a guid

--- src/cpp/core/file_lock/LinkBasedFileLock.cpp
+++ src/cpp/core/file_lock/LinkBasedFileLock.cpp
@@ -42,6 +42,8 @@

 namespace {

+const char * const kFileLockGuid = "22341c29-6541-44eb-88da-e097378a46d4";
+
 std::string pidString()
 {
    PidType pid = system::currentProcessId();
@@ -74,6 +76,7 @@
 {
    return std::string()
          + ".rstudio-lock"
+         + "-" + kFileLockGuid
          + "-" + hostName()
          + "-" + pidString()
          + "-" + threadId();


Remove short-circuit evaluation and the extension warnings.  I'm
pretty sure we want to keep constant expression verification outside of
Evaluate. Because of that, the short-circuit evaluation doesn't
generally make sense, and the comma warning doesn't make sense in its
current form.

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

--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -42,12 +42,8 @@
   /// EvalResult - Contains information about the evaluation.
   Expr::EvalResult &EvalResult;

-  /// ShortCircuit - will be greater than zero if the current subexpression has
-  /// will not be evaluated because it's short-circuited (according to C rules).
-  unsigned ShortCircuit;
-
   EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx),
-           EvalResult(evalresult), ShortCircuit(0) {}
+           EvalResult(evalresult) {}
 };

@@ -559,13 +555,6 @@
   IntExprEvaluator(EvalInfo &info, APValue &result)
     : Info(info), Result(result) {}

-  bool Extension(SourceLocation L, diag::kind D, const Expr *E) {
-    Info.EvalResult.DiagLoc = L;
-    Info.EvalResult.Diag = D;
-    Info.EvalResult.DiagExpr = E;
-    return true;  // still a constant.
-  }
-
   bool Success(const llvm::APSInt &SI, const Expr *E) {
     assert(E->getType()->isIntegralType() && "Invalid evaluation result.");
     assert(SI.isSigned() == E->getType()->isSignedIntegerType() &&
@@ -592,18 +581,7 @@
   }

   bool Error(SourceLocation L, diag::kind D, const Expr *E) {
-    // If this is in an unevaluated portion of the subexpression, ignore the
-    // error.
-    if (Info.ShortCircuit) {
-      // If error is ignored because the value isn't evaluated, get the real
-      // type at least to prevent errors downstream.
-      return Success(0, E);
-    }
-
     // Take the first error.
-
-    // FIXME: This is wrong if we happen to have already emitted an
-    // extension diagnostic; in that case we should report this error.
     if (Info.EvalResult.Diag == 0) {
       Info.EvalResult.DiagLoc = L;
       Info.EvalResult.Diag = D;
@@ -792,14 +770,10 @@
     if (!Visit(E->getRHS()))
       return false;

-    if (!Info.ShortCircuit) {
-      // If we can't evaluate the LHS, it must be because it has
-      // side effects.
-      if (!E->getLHS()->isEvaluatable(Info.Ctx))
-        Info.EvalResult.HasSideEffects = true;
-
-      return Extension(E->getOperatorLoc(), diag::note_comma_in_ice, E);
-    }
+    // If we can't evaluate the LHS, it might have side effects;
+    // conservatively mark it.
+    if (!E->getLHS()->isEvaluatable(Info.Ctx))
+      Info.EvalResult.HasSideEffects = true;

     return true;
   }
@@ -812,19 +786,8 @@
     if (HandleConversionToBool(E->getLHS(), lhsResult, Info)) {
       // We were able to evaluate the LHS, see if we can get away with not
       // evaluating the RHS: 0 && X -> 0, 1 || X -> 1
-      if (lhsResult == (E->getOpcode() == BinaryOperator::LOr) ||
-          !lhsResult == (E->getOpcode() == BinaryOperator::LAnd)) {
-        Info.ShortCircuit++;
-        bool rhsEvaluated = HandleConversionToBool(E->getRHS(), rhsResult, Info);
-        Info.ShortCircuit--;
-
-        // FIXME: Return an extension warning saying that the RHS could not be
-        // evaluated.
-        // if (!rhsEvaluated) ...
-        (void) rhsEvaluated;
-
+      if (lhsResult == (E->getOpcode() == BinaryOperator::LOr))
         return Success(lhsResult, E);
-      }

       if (HandleConversionToBool(E->getRHS(), rhsResult, Info)) {
         if (E->getOpcode() == BinaryOperator::LOr)


Warning fixed.

Warning fixed.

--- multicast_send_queue.cpp
+++ multicast_send_queue.cpp
@@ -15,10 +15,10 @@
 MulticastSendQueue::MulticastSendQueue(const vector<Destination> targets,
     unsigned *rtts, bool use_fixed_rate_multicast) :
     store_position(0), data_on_flow(0),
-    window_size(INITIAL_WINDOW_SIZE), ssthresh(UINT_MAX),
-    last_packet_caused_congestion(UINT32_MAX),
-    is_queue_full(false), is_fatal_error_occurred(false),
-    use_fixed_rate(use_fixed_rate_multicast)
+    use_fixed_rate(use_fixed_rate_multicast),
+    window_size(INITIAL_WINDOW_SIZE),
+    ssthresh(UINT_MAX), last_packet_caused_congestion(UINT32_MAX),
+    is_queue_full(false), is_fatal_error_occurred(false)
 {
   n_destinations = targets.size();
   buffer = std::deque<MessageRecord*>(max(n_destinations * DEFAULT_BUFFER_SCALE,


[stackprotector] Changed isNoopBitcast/sameNoopInput to take TargetLoweringBase instead of TargetLowering.

Both functions only use functionality from TargetLoweringBase.

rdar://13935163

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

--- lib/CodeGen/Analysis.cpp
+++ lib/CodeGen/Analysis.cpp
@@ -202,7 +202,7 @@
 }

 static bool isNoopBitcast(Type *T1, Type *T2,
-                          const TargetLowering& TLI) {
+                          const TargetLoweringBase& TLI) {
   return T1 == T2 || (T1->isPointerTy() && T2->isPointerTy()) ||
          (isa<VectorType>(T1) && isa<VectorType>(T2) &&
           TLI.isTypeLegal(EVT::getEVT(T1)) && TLI.isTypeLegal(EVT::getEVT(T2)));
@@ -215,7 +215,7 @@
 static bool sameNoopInput(const Value *V1, const Value *V2,
                           SmallVectorImpl<unsigned> &Els1,
                           SmallVectorImpl<unsigned> &Els2,
-                          const TargetLowering &TLI) {
+                          const TargetLoweringBase &TLI) {
   using std::swap;
   bool swapParity = false;
   bool equalEls = Els1 == Els2;


Use the new name of getUniqueID.

Use the new name of getUniqueID.

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

--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1277,7 +1277,7 @@
   llvm::MemoryBuffer *Buffer = 0;
   std::string MainFilePath(FrontendOpts.Inputs[0].getFile());
   uint64_t MainFileID;
-  if (!llvm::sys::fs::GetUniqueID(MainFilePath, MainFileID)) {
+  if (!llvm::sys::fs::getUniqueID(MainFilePath, MainFileID)) {
     // Check whether there is a file-file remapping of the main file
     for (PreprocessorOptions::remapped_file_iterator
           M = PreprocessorOpts.remapped_file_begin(),
@@ -1286,7 +1286,7 @@
          ++M) {
       std::string MPath(M->first);
       uint64_t MID;
-      if (!llvm::sys::fs::GetUniqueID(MPath, MID)) {
+      if (!llvm::sys::fs::getUniqueID(MPath, MID)) {
         if (MainFileID == MID) {
           // We found a remapping. Try to load the resulting, remapped source.
           if (CreatedBuffer) {
@@ -1312,7 +1312,7 @@
          ++M) {
       std::string MPath(M->first);
       uint64_t MID;
-      if (!llvm::sys::fs::GetUniqueID(MPath, MID)) {
+      if (!llvm::sys::fs::getUniqueID(MPath, MID)) {
         if (MainFileID == MID) {
           // We found a remapping.
           if (CreatedBuffer) {
@@ -2484,10 +2484,10 @@
     std::string CompleteFilePath(File);
     uint64_t CompleteFileID;

-    if (!llvm::sys::fs::GetUniqueID(CompleteFilePath, CompleteFileID)) {
+    if (!llvm::sys::fs::getUniqueID(CompleteFilePath, CompleteFileID)) {
       std::string MainPath(OriginalSourceFile);
       uint64_t MainID;
-      if (!llvm::sys::fs::GetUniqueID(MainPath, MainID)) {
+      if (!llvm::sys::fs::getUniqueID(MainPath, MainID)) {
         if (CompleteFileID == MainID && Line > 1)
           OverrideMainBuffer
             = getMainBufferWithPrecompiledPreamble(*CCInvocation, false,


[ConstantRange] Use APInt::operator-= to remove temporary APInts.

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

--- lib/IR/ConstantRange.cpp
+++ lib/IR/ConstantRange.cpp
@@ -597,7 +597,7 @@
   if (LowerDiv.uge(MaxValue)) {
     APInt Div(getBitWidth(), 0);
     APInt::udivrem(LowerDiv, MaxBitValue, Div, LowerDiv);
-    UpperDiv = UpperDiv - MaxBitValue * Div;
+    UpperDiv -= MaxBitValue * Div;
   }

   if (UpperDiv.ule(MaxValue))
@@ -605,10 +605,10 @@
                          UpperDiv.trunc(DstTySize)).unionWith(Union);

   // The truncated value wraps around. Check if we can do better than fullset.
-  APInt UpperModulo = UpperDiv - MaxBitValue;
-  if (UpperModulo.ult(LowerDiv))
+  UpperDiv -= MaxBitValue;
+  if (UpperDiv.ult(LowerDiv))
     return ConstantRange(LowerDiv.trunc(DstTySize),
-                         UpperModulo.trunc(DstTySize)).unionWith(Union);
+                         UpperDiv.trunc(DstTySize)).unionWith(Union);

   return ConstantRange(DstTySize, /*isFullSet=*/true);
 }


Add reflector_verify for FC_REFLECT serialization verification

--- libraries/chain/include/eosio/chain/asset.hpp
+++ libraries/chain/include/eosio/chain/asset.hpp
@@ -26,9 +26,6 @@
       EOS_ASSERT( is_amount_within_range(), asset_type_exception, "magnitude of asset amount must be less than 2^62" );
       EOS_ASSERT( sym.valid(), asset_type_exception, "invalid symbol" );
    }
-
-   share_type amount;
-   symbol     sym;

    bool is_amount_within_range()const { return -max_amount <= amount && amount <= max_amount; }
    bool is_valid()const               { return is_amount_within_range() && sym.valid(); }
@@ -84,6 +81,17 @@

    friend std::ostream& operator << (std::ostream& out, const asset& a) { return out << a.to_string(); }

+   friend struct fc::reflector<asset>;
+
+   void reflector_verify()const {
+      EOS_ASSERT( is_amount_within_range(), asset_type_exception, "magnitude of asset amount must be less than 2^62" );
+      EOS_ASSERT( sym.valid(), asset_type_exception, "invalid symbol" );
+   }
+
+private:
+   share_type amount;
+   symbol     sym;
+
 };

 struct extended_asset  {


fix more Windows compilation errors

fix more Windows compilation errors

git-svn-id: b7791fb0f5d07d96612766859ad70a13be88ea96@3686 305cdda6-5ce1-45b3-a98d-dfc68c8b3305

--- library/MultiRegions/ExpListHomogeneous1D.cpp
+++ library/MultiRegions/ExpListHomogeneous1D.cpp
@@ -433,7 +433,7 @@
 			int num_points_per_plane = num_dofs/num_planes_per_proc;
 			int num_total_planes     = m_homogeneousBasis->GetNumPoints();
 			int num_processes        = num_total_planes/num_planes_per_proc;
-			int num_trans_per_proc   = ceil(num_points_per_plane/num_processes);
+			int num_trans_per_proc   = num_points_per_plane/num_processes + (num_points_per_plane%num_processes > 0);
 			int rank_id              = m_comm->GetColumnComm()->GetRank();
 			int copy_len             = num_trans_per_proc;

@@ -492,7 +492,7 @@
 			int num_points_per_plane = num_dofs/num_planes_per_proc;
 			int num_total_planes     = m_homogeneousBasis->GetNumPoints();
 			int num_processes        = num_total_planes/num_planes_per_proc;
-			int num_trans_per_proc   = ceil(num_points_per_plane/num_processes);
+			int num_trans_per_proc   = num_points_per_plane/num_processes + (num_points_per_plane%num_processes > 0);
 			int rank_id              = m_comm->GetColumnComm()->GetRank();
 			int copy_len;

@@ -585,7 +585,7 @@
                 n_exp = m_planes[0]->GetTotPoints(); // will operatore on m_phys
             }

-			num_dft = ceil(n_exp/num_processes);
+			num_dft = n_exp/num_processes + (n_exp%num_processes > 0);

             Array<OneD,unsigned int> nrows(num_dft);
             Array<OneD,unsigned int> ncols(num_dft);


Removed erroneous cout left in ExtractDataToCoeffs

--- library/MultiRegions/ExpListHomogeneous1D.cpp
+++ library/MultiRegions/ExpListHomogeneous1D.cpp
@@ -734,10 +734,6 @@
                         {
                             continue;
                         }
-                        if(m_comm->GetRank() == 1)
-                        {
-                            cout << "filling element " << eid << "on proc 1" << endl;
-                        }

                         planes_offset = it->second;
                         if(datalen == (*m_exp)[eid]->GetNcoeffs())


forgot to delete something

forgot to delete something

git-svn-id: 602a26e73ae9f2a14e2bb95676f2e137fcc39919@7132 7c0444ca-5550-0410-9008-faecdbe78eb5

--- src/layers/TextStream.cpp
+++ src/layers/TextStream.cpp
@@ -394,17 +394,6 @@
 //		std::cout<<"\n";
 //	}
 //	std::cout<<"\n\n\n";
-//	locIdx=0;
-//	for (int idx=0; idx<loc_ny*loc_nx; idx++) {
-//		for (int f=0; f<loc->nf; f++) {
-//			if(textData[locIdx]!=0){
-//				std::cout<<f<<" ";
-//			}
-//			locIdx++;
-//		}
-//		std::cout<<"\n";
-//	}
-//	std::cout<<"\n\n\n";
 	return PV_SUCCESS;
 }


Repaint when content changes.

Repaint when content changes.

--- src/lib/MapInfoDialog.cpp
+++ src/lib/MapInfoDialog.cpp
@@ -91,6 +91,7 @@
 {
     if ( m_popupItem ) {
         m_popupItem->setContent( html );
+        emit repaintNeeded();
     }
 }


Add level of indentation

Add level of indentation

--- tests/threads.cpp
+++ tests/threads.cpp
@@ -9,27 +9,29 @@
 	db->execute("CREATE TABLE rusqltest (`value` INT(2) NOT NULL)");
 	db->execute("INSERT INTO rusqltest VALUES (20)");

-	auto statement = db->prepare("SELECT value FROM rusqltest");
+	{
+		auto statement = db->prepare("SELECT value FROM rusqltest");

-	statement.execute();
+		statement.execute();

-	boost::thread thread([&db]() {
-		auto thread_handle = db->get_thread_handle();
-		db->execute("UPDATE rusqltest SET value=30");
-	});
-	thread.join();
+		boost::thread thread([&db]() {
+			auto thread_handle = db->get_thread_handle();
+			db->execute("UPDATE rusqltest SET value=30");
+		});
+		thread.join();

-	uint64_t value = 10;
-	statement.bind_results(value);
-	test(statement.fetch(), "one result");
-	test(value == 20, "value was correct (" + std::to_string(value) + ")");
-	test(!statement.fetch(), "exactly one result");
+		uint64_t value = 10;
+		statement.bind_results(value);
+		test(statement.fetch(), "one result");
+		test(value == 20, "value was correct (" + std::to_string(value) + ")");
+		test(!statement.fetch(), "exactly one result");

-	statement.execute();
-	statement.bind_results(value);
-	test(statement.fetch(), "one result");
-	test(value == 30, "value was correct (" + std::to_string(value) + ")");
-	test(!statement.fetch(), "exactly one result");
+		statement.execute();
+		statement.bind_results(value);
+		test(statement.fetch(), "one result");
+		test(value == 30, "value was correct (" + std::to_string(value) + ")");
+		test(!statement.fetch(), "exactly one result");
+	}

 	db->execute("DROP TABLE rusqltest");
 }


Use early returns to avoid indentation.

Use early returns to avoid indentation.

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

--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -973,84 +973,88 @@
       << 0;
     err = true;
   }
-  if (!err)
-    BuildBaseOrMemberInitializers(Context, Constructor,
+
+  if (err)
+    return;
+
+  BuildBaseOrMemberInitializers(Context, Constructor,
                       reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits),
                       NumMemInits);

-  if (!err && (Diags.getDiagnosticLevel(diag::warn_base_initialized)
-               != Diagnostic::Ignored ||
-               Diags.getDiagnosticLevel(diag::warn_field_initialized)
-               != Diagnostic::Ignored)) {
-    // Also issue warning if order of ctor-initializer list does not match order
-    // of 1) base class declarations and 2) order of non-static data members.
-    llvm::SmallVector<const void*, 32> AllBaseOrMembers;
+  if (Diags.getDiagnosticLevel(diag::warn_base_initialized) ==
+      Diagnostic::Ignored &&
+      Diags.getDiagnosticLevel(diag::warn_field_initialized) ==
+      Diagnostic::Ignored)
+    return;
+
+  // Also issue warning if order of ctor-initializer list does not match order
+  // of 1) base class declarations and 2) order of non-static data members.
+  llvm::SmallVector<const void*, 32> AllBaseOrMembers;
+
+  CXXRecordDecl *ClassDecl
+    = cast<CXXRecordDecl>(Constructor->getDeclContext());
+  // Push virtual bases before others.
+  for (CXXRecordDecl::base_class_iterator VBase =
+       ClassDecl->vbases_begin(),
+       E = ClassDecl->vbases_end(); VBase != E; ++VBase)
+    AllBaseOrMembers.push_back(VBase->getType()->getAs<RecordType>());

-    CXXRecordDecl *ClassDecl
-      = cast<CXXRecordDecl>(Constructor->getDeclContext());
-    // Push virtual bases before others.
-    for (CXXRecordDecl::base_class_iterator VBase =
-         ClassDecl->vbases_begin(),
-         E = ClassDecl->vbases_end(); VBase != E; ++VBase)
-      AllBaseOrMembers.push_back(VBase->getType()->getAs<RecordType>());
-
-    for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
-         E = ClassDecl->bases_end(); Base != E; ++Base) {
-      // Virtuals are alread in the virtual base list and are constructed
-      // first.
-      if (Base->isVirtual())
-        continue;
-      AllBaseOrMembers.push_back(Base->getType()->getAs<RecordType>());
-    }
-
-    for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
-         E = ClassDecl->field_end(); Field != E; ++Field)
-      AllBaseOrMembers.push_back(GetKeyForTopLevelField(*Field));
-
-    int Last = AllBaseOrMembers.size();
-    int curIndex = 0;
-    CXXBaseOrMemberInitializer *PrevMember = 0;
-    for (unsigned i = 0; i < NumMemInits; i++) {
-      CXXBaseOrMemberInitializer *Member =
-        static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
-      void *MemberInCtorList = GetKeyForMember(Member, true);
-
-      for (; curIndex < Last; curIndex++)
-        if (MemberInCtorList == AllBaseOrMembers[curIndex])
+  for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
+       E = ClassDecl->bases_end(); Base != E; ++Base) {
+    // Virtuals are alread in the virtual base list and are constructed
+    // first.
+    if (Base->isVirtual())
+      continue;
+    AllBaseOrMembers.push_back(Base->getType()->getAs<RecordType>());
+  }
+
+  for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
+       E = ClassDecl->field_end(); Field != E; ++Field)
+    AllBaseOrMembers.push_back(GetKeyForTopLevelField(*Field));
+
+  int Last = AllBaseOrMembers.size();
+  int curIndex = 0;
+  CXXBaseOrMemberInitializer *PrevMember = 0;
+  for (unsigned i = 0; i < NumMemInits; i++) {
+    CXXBaseOrMemberInitializer *Member =
+      static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
+    void *MemberInCtorList = GetKeyForMember(Member, true);
+
+    for (; curIndex < Last; curIndex++)
+      if (MemberInCtorList == AllBaseOrMembers[curIndex])
+        break;
+    if (curIndex == Last) {
+      assert(PrevMember && "Member not in member list?!");
+      // Initializer as specified in ctor-initializer list is out of order.
+      // Issue a warning diagnostic.
+      if (PrevMember->isBaseInitializer()) {
+        // Diagnostics is for an initialized base class.
+        Type *BaseClass = PrevMember->getBaseClass();
+        Diag(PrevMember->getSourceLocation(),
+             diag::warn_base_initialized)
+              << BaseClass->getDesugaredType(true);
+      } else {
+        FieldDecl *Field = PrevMember->getMember();
+        Diag(PrevMember->getSourceLocation(),
+             diag::warn_field_initialized)
+          << Field->getNameAsString();
+      }
+      // Also the note!
+      if (FieldDecl *Field = Member->getMember())
+        Diag(Member->getSourceLocation(),
+             diag::note_fieldorbase_initialized_here) << 0
+          << Field->getNameAsString();
+      else {
+        Type *BaseClass = Member->getBaseClass();
+        Diag(Member->getSourceLocation(),
+             diag::note_fieldorbase_initialized_here) << 1
+          << BaseClass->getDesugaredType(true);
+      }
+      for (curIndex = 0; curIndex < Last; curIndex++)
+        if (MemberInCtorList == AllBaseOrMembers[curIndex])
           break;
-      if (curIndex == Last) {
-        assert(PrevMember && "Member not in member list?!");
-        // Initializer as specified in ctor-initializer list is out of order.
-        // Issue a warning diagnostic.
-        if (PrevMember->isBaseInitializer()) {
-          // Diagnostics is for an initialized base class.
-          Type *BaseClass = PrevMember->getBaseClass();
-          Diag(PrevMember->getSourceLocation(),
-               diag::warn_base_initialized)
-                << BaseClass->getDesugaredType(true);
-        } else {
-          FieldDecl *Field = PrevMember->getMember();
-          Diag(PrevMember->getSourceLocation(),
-               diag::warn_field_initialized)
-            << Field->getNameAsString();
-        }
-        // Also the note!
-        if (FieldDecl *Field = Member->getMember())
-          Diag(Member->getSourceLocation(),
-               diag::note_fieldorbase_initialized_here) << 0
-            << Field->getNameAsString();
-        else {
-          Type *BaseClass = Member->getBaseClass();
-          Diag(Member->getSourceLocation(),
-               diag::note_fieldorbase_initialized_here) << 1
-            << BaseClass->getDesugaredType(true);
-        }
-        for (curIndex = 0; curIndex < Last; curIndex++)
-          if (MemberInCtorList == AllBaseOrMembers[curIndex])
-            break;
-      }
-      PrevMember = Member;
-    }
+    }
+    PrevMember = Member;
   }
 }


When we create an implicit CXXTemporaryObjectExpr we don't need to check that it's a valid init. Instead, just set it as the VarDecl's initializer.

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

--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -1827,10 +1827,6 @@
     if (!Constructor)
       RealDecl->setInvalidDecl();
     else {
-#if 0
-      // FIXME: Adding the initializer causes an error in
-      // test/SemaCXX/default2.cpp so it's disabled for now.
-
       // Let clients know that initialization was done with a direct
       // initializer.
       VDecl->setCXXDirectInitializer(true);
@@ -1841,8 +1837,7 @@
                                              (Expr**)Exprs.release(),
                                              NumExprs,
                                              SourceLocation());
-      AddInitializerToDecl(Dcl, ExprArg(*this, Temp), /*DirectInit=*/true);
-#endif
+      VDecl->setInit(Temp);
     }
     return;
   }


[ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a
*NamedDecl.  In turn, build the expressions after we're finished parsing the
asm.  This avoids a crasher if the lookup fails.

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

--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -367,19 +367,10 @@
   MCAsmParserSemaCallbackImpl(class Sema *Ref) { SemaRef = Ref; }
   ~MCAsmParserSemaCallbackImpl() {}

-  void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc,
-                                  void **IdentifierInfoPtr) {
+  void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc) {
     SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc);
     NamedDecl *OpDecl = SemaRef->LookupInlineAsmIdentifier(Name, Loc);
-    DeclarationNameInfo NameInfo(OpDecl->getDeclName(), Loc);
-    ExprResult OpExpr = SemaRef->BuildDeclarationNameExpr(CXXScopeSpec(),
-                                                          NameInfo,
-                                                          OpDecl);
-    if (OpExpr.isInvalid())
-      return 0;
-
-    *IdentifierInfoPtr = static_cast<void*>(OpDecl->getIdentifier());
-    return static_cast<void *>(OpExpr.take());
+    return static_cast<void *>(OpDecl);
   }
 };

@@ -468,14 +459,13 @@
   unsigned NumOutputs;
   unsigned NumInputs;
   std::string AsmStringIR;
-  SmallVector<void *, 4> VoidNames;
+  SmallVector<void *, 4> OpDecls;
   SmallVector<std::string, 4> Constraints;
-  SmallVector<void *, 4> VoidExprs;
   SmallVector<std::string, 4> Clobbers;
   MCAsmParserSemaCallbackImpl MCAPSI(this);
   if (Parser->ParseMSInlineAsm(AsmLoc.getPtrEncoding(), AsmStringIR,
-                               NumOutputs, NumInputs, VoidNames, Constraints,
-                               VoidExprs, Clobbers, MII, IP, MCAPSI))
+                               NumOutputs, NumInputs, OpDecls, Constraints,
+                               Clobbers, MII, IP, MCAPSI))
     return StmtError();

   // Build the vector of clobber StringRefs.
@@ -486,15 +476,23 @@

   // Recast the void pointers and build the vector of constraint StringRefs.
   unsigned NumExprs = NumOutputs + NumInputs;
-  assert (VoidNames.size() == NumExprs && "Unexpected number of names!");
-  assert (VoidExprs.size() == NumExprs && "Unexpected number of exprs!");
   Names.resize(NumExprs);
   ConstraintRefs.resize(NumExprs);
   Exprs.resize(NumExprs);
   for (unsigned i = 0, e = NumExprs; i != e; ++i) {
-    Names[i] = static_cast<IdentifierInfo *>(VoidNames[i]);
+    NamedDecl *OpDecl = static_cast<NamedDecl *>(OpDecls[i]);
+    if (!OpDecl)
+      return StmtError();
+
+    DeclarationNameInfo NameInfo(OpDecl->getDeclName(), AsmLoc);
+    ExprResult OpExpr = BuildDeclarationNameExpr(CXXScopeSpec(), NameInfo,
+                                                 OpDecl);
+    if (OpExpr.isInvalid())
+      return StmtError();
+
+    Names[i] = OpDecl->getIdentifier();
     ConstraintRefs[i] = StringRef(Constraints[i]);
-    Exprs[i] = static_cast<Expr *>(VoidExprs[i]);
+    Exprs[i] = OpExpr.take();
   }

   bool IsSimple = NumExprs > 0;


mouseboxsize is an int!

mouseboxsize is an int!

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

--- src/bzflag/bzflag.cxx
+++ src/bzflag/bzflag.cxx
@@ -675,7 +675,7 @@

   BZDB->set("radarsize", string_util::format("%d", renderer.getRadarSize()));

-  BZDB->set("mouseboxsize", string_util::format("%f", renderer.getMaxMotionFactor()));
+  BZDB->set("mouseboxsize", string_util::format("%d", renderer.getMaxMotionFactor()));

   BZDB->set("underline", OpenGLTexFont::getUnderlineColor());


Fixing test case.

Fixing test case.

In the qhttpnetworkconnection.cpp the defaultChannelCount is
hardcoded to 3, for Symbian platform, and that fact has to be
reflected in test case as well.

Reviewed-by: Markus Goetz

--- tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -3902,7 +3902,13 @@
             break;
     }

+#ifdef Q_OS_SYMBIAN
+    // see in qhttpnetworkconnection.cpp
+    // hardcoded defaultChannelCount = 3
+    QCOMPARE(pendingConnectionCount, 3);
+#else
     QCOMPARE(pendingConnectionCount, 6);
+#endif
 }

 #ifndef QT_NO_OPENSSL


Reverting a changes. dunno why, it causes a crash to MacOSX

--- src/bzflag/bzflag.cxx
+++ src/bzflag/bzflag.cxx
@@ -15,7 +15,16 @@

 /* system headers */
 #include <assert.h>
+#include <ctype.h>
+#include <fstream>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+#include <sys/types.h>
 #include <time.h>
+#include <vector>
 #if defined(_WIN32)
 #  include <shlobj.h>
 #  include <sys/types.h>
@@ -27,10 +36,13 @@
 #endif /* defined(_WIN32) */

 /* common headers */
+#include "Address.h"
 #include "BZDBCache.h"
 #include "BundleMgr.h"
 #include "BzfMedia.h"
 #include "BzfVisual.h"
+#include "BzfWindow.h"
+#include "CommandManager.h"
 #include "CommandsStandard.h"
 #include "ConfigFileManager.h"
 #include "DirectoryNames.h"
@@ -38,7 +50,9 @@
 #include "FileManager.h"
 #include "FontManager.h"
 #include "GUIOptionsMenu.h"
+#include "KeyManager.h"
 #include "OSFile.h"
+#include "OpenGLGState.h"
 #include "ParseColor.h"
 #include "PlatformFactory.h"
 #include "Protocol.h"
@@ -50,8 +64,9 @@
 #include "TimeBomb.h"
 #include "WordFilter.h"
 #include "World.h"
-#include "BzfDisplay.h"
-#include "global.h"
+#include "bzfSDL.h"
+#include "bzfgl.h"
+#include "bzfio.h"

 /* local headers */
 #include "ActionBinding.h"
@@ -59,6 +74,7 @@
 #include "callbacks.h"
 #include "playing.h"
 #include "sound.h"
+#include "playing.h"

 // invoke incessant rebuilding for build versioning
 #include "version.h"
@@ -68,6 +84,8 @@

 // client prefrences
 #include "clientConfig.h"
+
+int beginendCount = 0;

 const char*		argv0;
 static bool		anonymous = false;
@@ -77,8 +95,6 @@
 struct tm		userTime;
 bool			echoToConsole = false;
 bool			echoAnsi = false;
-
-// Setting a common.h value: used both in bzflag, bzfs and bzadmin
 int			debugLevel = 0;

 static BzfDisplay*	display = NULL;
@@ -96,7 +112,7 @@
 //

 // so that Windows can kill the wsa stuff if needed
-static int bail ( int returnCode )
+int bail ( int returnCode )
 {
 #ifdef _WIN32
 	WSACleanup();


fix mutex lock.

fix mutex lock.

--- src/lib/network/hosts.cpp
+++ src/lib/network/hosts.cpp
@@ -205,17 +205,19 @@
         return;
     }

-    // Critical Section
-    upgrade_lock lock(mutex_);
-
-    if (stopped_) {
-        return;
-    }
-
-    upgrade_to_unique_lock unq_lock(lock);
-
-    if (!store_cache()) {
-        return;
+    {
+        // Critical Section
+        upgrade_lock lock(mutex_);
+
+        if (stopped_) {
+            return;
+        }
+
+        upgrade_to_unique_lock unq_lock(lock);
+
+        if (!store_cache()) {
+            return;
+        }
     }

     snap_timer_->start(std::bind(&hosts::handle_timer, shared_from_this(), std::placeholders::_1));
@@ -527,9 +529,11 @@
     }

     // Critical Section
-    upgrade_lock lock(mutex_);
-
-    if (stopped_) {
+    mutex_.lock_upgrade();
+
+    if (stopped_) {
+        mutex_.unlock_upgrade();
+
         handler(error::service_stopped);
         return;
     }
@@ -548,7 +552,7 @@
     const auto step = std::max(usable / accept, size_t(1));
     size_t accepted = 0;

-    upgrade_to_unique_lock unq_lock(lock);
+    mutex_.unlock_upgrade_and_lock();
     //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     for (size_t index = 0; index < usable; index = ceiling_add(index, step)) {
@@ -579,6 +583,8 @@
             << " inactive size is " << inactive_.size()
             << ", buffer size is " << buffer_.size();

+    mutex_.unlock();
+
     handler(error::success);
 }


generate_lattice_array - testing

generate_lattice_array - testing

--- 5_QMC/qmc.cpp
+++ 5_QMC/qmc.cpp
@@ -65,7 +65,7 @@

 /* Testing */
 void test_generate_lattice_array(){
-    int array_size = 5, array[5];
+    int array_size = 10, array[array_size];
     generate_lattice_array(array_size, array);
     print_sites(array, array_size);
 }


Fixed tst_qpixmapfilter testcase

Fixed tst_qpixmapfilter testcase

Reviewed-by: Samuel
(cherry picked from commit e2e8104c03608ef753f84740bdf6ac1bff18be84)

--- tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp
+++ tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp
@@ -390,20 +390,20 @@
     const QRectF rect3(2.2, 6.3, 11.4, 47.5);

     filter.setOffset(QPointF(0,0));
-    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-2, -2, 2, 2));
+    QCOMPARE(filter.boundingRectFor(rect1), rect1);
+    QCOMPARE(filter.boundingRectFor(rect2), rect2);
+    QCOMPARE(filter.boundingRectFor(rect3), rect3);

     filter.setOffset(QPointF(1,1));
     QCOMPARE(filter.offset(), QPointF(1, 1));
-    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-2, -2, 2, 2));
+    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(0, 0, 1, 1));
+    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(0, 0, 1, 1));
+    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(0, 0, 1, 1));

     filter.setOffset(QPointF(-1,-1));
-    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-2, -2, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-2, -2, 2, 2));
+    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-1, -1, 0, 0));
+    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-1, -1, 0, 0));
+    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-1, -1, 0, 0));

     filter.setBlurRadius(2);
     filter.setOffset(QPointF(0,0));
@@ -418,9 +418,9 @@
     QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta + 1, -delta + 1, delta + 1, delta + 1));

     filter.setOffset(QPointF(-10,-10));
-    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-delta - 10, -delta - 10, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-delta - 10, -delta - 10, 2, 2));
-    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta - 10, -delta - 10, 2, 2));
+    QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-delta - 10, -delta - 10, 0, 0));
+    QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-delta - 10, -delta - 10, 0, 0));
+    QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta - 10, -delta - 10, 0, 0));
 }


Add a missing include of cstddef needed for size_t.

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

--- lib/Support/Valgrind.cpp
+++ lib/Support/Valgrind.cpp
@@ -15,6 +15,7 @@

 #include "llvm/Support/Valgrind.h"
 #include "llvm/Config/config.h"
+#include <cstddef>

 #if HAVE_VALGRIND_VALGRIND_H
 #include <valgrind/valgrind.h>


get rid of a silly fixed buffer

get rid of a silly fixed buffer

--- src/bzflag/bzflag.cxx
+++ src/bzflag/bzflag.cxx
@@ -853,9 +853,7 @@
   // set time from BZDB
   if (BZDB.isSet("fixedTime")) {
     int hours, minutes, seconds;
-    char dbTime[256];
-    strncpy(dbTime, BZDB.get("fixedTime").c_str(), sizeof(dbTime) - 1);
-    if (sscanf(dbTime, "%d:%d:%d", &hours, &minutes, &seconds) != 3 ||
+    if (sscanf(BZDB.get("fixedTime").c_str(), "%d:%d:%d", &hours, &minutes, &seconds) != 3 ||
 	hours < 0 || hours > 23 ||
 	minutes < 0 || minutes > 59 ||
 	seconds < 0 || seconds > 59)


Signed-off-by: mrlitong <litongtongxue@gmail.com>

--- ActorBash.cpp
+++ ActorBash.cpp
@@ -93,5 +93,10 @@
 	{
 		return;
 	}
+	// impulse
+	vec3 impulse = vec3_zero;

+	// ortho basis
+	vec3 tangent, binormal;
+	OrthoBasis(m_vUp, tangent, binormal);
 }


Added row_count() to opossum::table

Added row_count() to opossum::table

--- src/lib/storage/table.cpp
+++ src/lib/storage/table.cpp
@@ -31,6 +31,14 @@
 	return _column_types.size();
 }

+size_t table::row_count() const {
+	size_t ret = 0;
+	for (auto &&chunk : _chunks) {
+		ret += chunk.size();
+	}
+	return ret;
+}
+
 std::vector<int> table::column_string_widths(int max) const {
 	std::vector<int> widths(col_count());
 	for(size_t col = 0; col < col_count(); ++col) {
@@ -49,9 +57,9 @@
 	auto widths = column_string_widths(20);

 	for(size_t col = 0; col < col_count(); ++col) {
-		out << "|" << std::setw(widths[col]) << _column_names[col] << std::setw(0) << "|";
+		out << "|" << std::setw(widths[col]) << _column_names[col] << std::setw(0);
 	}
-	out << std::endl;
+	out << "|" << std::endl;

 	size_t chunk_id = 0;
 	for(auto &&chunk : _chunks) {


rnav: fix wrong handling of SUSPENDED state

--- libs/nav/src/reactive/CWaypointsNavigator.cpp
+++ libs/nav/src/reactive/CWaypointsNavigator.cpp
@@ -334,8 +334,12 @@
 void CWaypointsNavigator::navigationStep()
 {
 	MRPT_START
-
-	waypoints_navigationStep();
+	m_is_aligning = false;  // the robot is aligning into a waypoint with a desired heading
+
+	if (m_navigationState != SUSPENDED)
+	{
+		waypoints_navigationStep();
+	}

 	// Call base navigation step to execute one-single waypoint navigation, as usual:
 	if (!m_is_aligning)


readded optional quoting, better whitespace checking, and stdified the vote strings

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

--- src/bzfs/commands.cxx
+++ src/bzfs/commands.cxx
@@ -35,7 +35,7 @@
 // FIXME -- need to pull communication out of bzfs.cxx...
 extern void sendMessage(int playerIndex, PlayerId targetPlayer, const char *message, bool fullBuffer);
 extern bool hasPerm(int playerIndex, PlayerAccessInfo::AccessPerm right);
-extern PlayerInfo *player;
+extern PlayerInfo player[MaxPlayers];
 extern CmdLineOptions *clOptions;
 extern uint16_t curMaxPlayers;
 extern int NotConnected;
@@ -43,8 +43,10 @@

 void handlePollCmd(int t, const char *message)
 {
-  char reply[MessageLen];
-
+  char reply[MessageLen] = {0};
+
+  DEBUG2("Entered poll command handler (MessageLen is %d)\n", MessageLen);
+
   /* make sure player has permission to request a poll */
   if (!hasPerm(t, PlayerAccessInfo::poll)) {
     sprintf(reply,"%s, you are presently not authorized to run /poll", player[t].callSign);
@@ -52,6 +54,8 @@
     return;
   }

+  DEBUG2("Player has permission\n");
+
   /* make sure that there is a poll arbiter */
   if (BZDB->isEmpty("poll")) {
     sprintf(reply, "ERROR: the poll arbiter has disappeared (this should never happen)");
@@ -59,8 +63,12 @@
     return;
   }

+  DEBUG2("BZDB poll value is not empty\n");
+
   // only need to do this once
   static VotingArbiter *arbiter = (VotingArbiter *)BZDB->getPointer("poll");
+
+  DEBUG2("Arbiter was acquired with address 0x%x\n", (unsigned int)arbiter);

   /* make sure that there is not a poll active already */
   if (arbiter->knowsPoll()) {
@@ -71,6 +79,8 @@
     return;
   }

+  DEBUG2("The arbiter says there is not another poll active\n");
+
   // get available voter count
   unsigned short int available = 0;
   for (int i=0; i < curMaxPlayers; i++) {
@@ -79,8 +89,12 @@
       available++;
     }
   }
-
-  // make sure there are enough players to even make a poll (don't count the pollee)
+
+  DEBUG2("There are %d available players for %d votes required\n", available, clOptions->votesRequired);
+
+  /* make sure there are enough players to even make a poll that has a chance
+   * of succeeding (not counting the person being acted upon)
+   */
   if (available - 1 < clOptions->votesRequired) {
     sprintf(reply,"Unable to initiate a new poll.  There are not enough players.");
     sendMessage(ServerPlayer, t, reply, true);
@@ -93,97 +107,140 @@
     return;
   }

-  std::string pollCmd = &message[5];
-  std::string cmd;
-  std::string nick;
-
-  unsigned int endPos;
-  unsigned int startPos = pollCmd.find_first_not_of(" \t");
-  if (startPos != std::string::npos) {
-    endPos = pollCmd.find_first_of(" \t", startPos);
-    if (endPos == std::string::npos)
-      endPos = pollCmd.length();
-
-    cmd = pollCmd.substr(startPos,endPos-startPos);
-    pollCmd = pollCmd.substr(endPos);
-  }
-  else {
-    sprintf(reply,"Invalid poll syntax: /poll (kick|ban|vote|veto) playername");
-    sendMessage(ServerPlayer, t, reply, true);
-    return;
-  }
-
+  std::string arguments = &message[5];
+  std::string cmd = "";
+
+  DEBUG2("The arguments string is [%s]\n", arguments.c_str());
+
+  /* find the start of the command */
+  size_t startPosition = 0;
+  while ((startPosition < arguments.size()) &&
+	 (isWhitespace(arguments[startPosition]))) {
+    startPosition++;
+  }
+
+  DEBUG2("Start position is %d\n", (int)startPosition);
+
+  /* find the end of the command */
+  size_t endPosition = startPosition + 1;
+  while ((endPosition < arguments.size()) &&
+	 (!isWhitespace(arguments[endPosition]))) {
+    endPosition++;
+  }
+
+  DEBUG2("End position is %d\n", (int)endPosition);
+
+  /* stash the command ('kick', etc) in lowercase to simplify comparison */
+  if ((startPosition != arguments.size()) &&
+      (endPosition > startPosition)) {
+    for (size_t i = startPosition; i < endPosition; i++) {
+      cmd += tolower(arguments[i]);
+    }
+  }
+
+  DEBUG2("Command is %s\n", cmd.c_str());
+
+  /* handle subcommands */
+
   if ((cmd == "ban") || (cmd == "kick")) {

-    startPos = pollCmd.find_first_not_of(" \t");
-    if (startPos != std::string::npos) {
-      std::string votePlayer = pollCmd.substr(startPos);
-      if (votePlayer.length() == 0) {
-	sprintf(reply,"%s, no player was specified for the %s vote", player[t].callSign, cmd.c_str());
-	sendMessage(ServerPlayer, t, reply, true);
-	sprintf(reply,"Usage: /poll %s [playername]", cmd.c_str());
+    std::string nick;
+
+    arguments = arguments.substr(endPosition);
+
+    DEBUG2("Command arguments rguments is [%s]\n", arguments.c_str());
+
+    /* find the start of the player name */
+    startPosition = 0;
+    while ((startPosition < arguments.size()) &&
+	   (isWhitespace(arguments[startPosition]))) {
+      startPosition++;
+    }
+    // do not include a starting quote, if given
+    if ( arguments[startPosition] == '"' ) {
+      startPosition++;
+    }
+
+    DEBUG2("Start position for player name is %d\n", (int)startPosition);
+
+    /* find the end of the player name */
+    endPosition = arguments.size() - 1;
+    while ((endPosition > 0) &&
+	   (isWhitespace(arguments[endPosition]))) {
+      endPosition--;
+    }
+    // do not include a trailing quote, if given
+    if ( arguments[endPosition] == '"' ) {
+      endPosition--;
+    }
+
+    DEBUG2("End position for player name is %d\n", (int)endPosition);
+
+    nick = arguments.substr(startPosition, endPosition - startPosition + 1);
+
+    DEBUG2("Player specified to vote upon is [%s]\n", nick.c_str());
+
+    if (nick.length() == 0) {
+      sprintf(reply,"%s, no player was specified for the [%s] vote", player[t].callSign, cmd.c_str());
+      sendMessage(ServerPlayer, t, reply, true);
+      sprintf(reply,"Usage: /poll %s playername", cmd.c_str());
+      sendMessage(ServerPlayer, t, reply, true);
+      return;
+    }
+
+    /* make sure the requested player is actually here */
+    bool foundPlayer=false;
+    std::string playerIP = "";
+    for (int v = 0; v < curMaxPlayers; v++) {
+      if (strncasecmp(nick.c_str(), player[v].callSign, 256) == 0) {
+	playerIP = player[v].peer.getDotNotation().c_str();
+	foundPlayer=true;
+	break;
+      }
+    }
+
+    if (!foundPlayer) {
+      /* wrong name? */
+      sprintf(reply, "The player specified for a %s vote is not here", cmd.c_str());
+      sendMessage(ServerPlayer, t, reply, true);
+      return;
+    }
+
+    /* create and announce the new poll */
+    if (cmd == "ban") {
+      if (arbiter->pollToBan(nick.c_str(), player[t].callSign, playerIP) == false) {
+	sprintf(reply,"You are not able to request a ban poll right now, %s", player[t].callSign);
 	sendMessage(ServerPlayer, t, reply, true);
 	return;
-      }
-
-      /* make sure the requested player is actually here */
-      bool foundPlayer=false;
-      std::string playerIP = "";
-      for (int v = 0; v < curMaxPlayers; v++) {
-	if (votePlayer == player[v].callSign) {
-	  playerIP = player[v].peer.getDotNotation().c_str();
-	  foundPlayer=true;
-	  break;
-	}
-      }
-
-      if (!foundPlayer) {
-	/* wrong name? */
-	sprintf(reply, "The player specified for a %s vote is not here", cmd.c_str());
-	sendMessage(ServerPlayer, t, reply, true);
-	sprintf(reply,"Usage: /poll %s [playername]", cmd.c_str());
+      } else {
+	sprintf(reply,"A poll to temporarily ban %s has been requested by %s", nick.c_str(), player[t].callSign);
+	sendMessage(ServerPlayer, AllPlayers, reply, true);
+      }
+    } else {
+      if (arbiter->pollToKick(nick.c_str(), player[t].callSign) == false) {
+	sprintf(reply,"You are not able to request a kick poll right now, %s", player[t].callSign);
 	sendMessage(ServerPlayer, t, reply, true);
 	return;
-      }
+      } else {
+	sprintf(reply,"A poll to %s %s has been requested by %s", cmd.c_str(), nick.c_str(), player[t].callSign);
+	sendMessage(ServerPlayer, AllPlayers, reply, true);
+      }
+    }

-      /* create and announce the new poll */
-      if (cmd == "ban") {
-	if (arbiter->pollToBan(votePlayer.c_str(), player[t].callSign, playerIP) == false) {
-	  sprintf(reply,"You are not able to request a ban poll right now, %s", player[t].callSign);
-	  sendMessage(ServerPlayer, t, reply, true);
-	} else {
-	  sprintf(reply,"A poll to temporarily ban %s has been requested by %s", votePlayer.c_str(), player[t].callSign);
-	  sendMessage(ServerPlayer, AllPlayers, reply, true);
-	}
-      } else {
-	if (arbiter->pollToKick(votePlayer.c_str(), player[t].callSign) == false) {
-	  sprintf(reply,"You are not able to request a kick poll right now, %s", player[t].callSign);
-	  sendMessage(ServerPlayer, t, reply, true);
-	} else {
-	  sprintf(reply,"A poll to %s %s has been requested by %s", cmd.c_str(), votePlayer.c_str(), player[t].callSign);
-	  sendMessage(ServerPlayer, AllPlayers, reply, true);
-	}
-      }
+    // set the number of available voters
+    arbiter->setAvailableVoters(available);

-      // set the number of available voters
-      arbiter->setAvailableVoters(available);
-
-      // keep track of who is allowed to vote
-      for (int j=0; j < curMaxPlayers; j++) {
-	// anyone on the server (even observers) are eligible to vote
-	if (player[j].fd != NotConnected) {
-	  arbiter->grantSuffrage(player[j].callSign);
-	}
-      }
-
-      // automatically place a vote for the player requesting the poll
-      arbiter->voteYes(player[t].callSign);
-    }
-    else {
-      sprintf(reply,"Invalid poll syntax: /poll %s playername", cmd.c_str());
-      sendMessage(ServerPlayer, t, reply, true);
-      return;
-    }
+    // keep track of who is allowed to vote
+    for (int j=0; j < curMaxPlayers; j++) {
+      // anyone on the server (even observers) are eligible to vote
+      if (player[j].fd != NotConnected) {
+	arbiter->grantSuffrage(player[j].callSign);
+      }
+    }
+
+    // automatically place a vote for the player requesting the poll
+    arbiter->voteYes(player[t].callSign);
+
   } else if (cmd == "vote") {

     if (!hasPerm(t, PlayerAccessInfo::vote)) {
@@ -213,7 +270,11 @@

     sprintf(reply,"Invalid option to the poll command");
     sendMessage(ServerPlayer, t, reply, true);
-    sprintf(reply,"Usage: /poll ban|kick [playername]");
+    sprintf(reply,"Usage: /poll ban|kick playername");
+    sendMessage(ServerPlayer, t, reply, true);
+    sprintf(reply,"    or /poll vote yes|no");
+    sendMessage(ServerPlayer, t, reply, true);
+    sprintf(reply,"    or /poll veto");
     sendMessage(ServerPlayer, t, reply, true);
   } /* end handling of poll subcommands */

@@ -223,7 +284,7 @@

 void handleVoteCmd(int t, const char *message)
 {
-  char reply[MessageLen];
+  char reply[MessageLen] = {0};

   if (!hasPerm(t, PlayerAccessInfo::vote)) {
     /* permission denied for /vote */
@@ -249,51 +310,51 @@
     return;
   }

-  /* find the start of the vote answer */
-
+  std::string voteCmd = &message[5];
   std::string answer;
-  std::string voteCmd = &message[5];
-
-  unsigned int startPos = voteCmd.find_first_not_of(" \t");
-  if (startPos != std::string::npos) {
-    unsigned int endPos = voteCmd.find_first_of(" \t", startPos);
-    if (endPos == std::string::npos)
-      endPos = voteCmd.length();
-    answer = voteCmd.substr(startPos, endPos-startPos);
-  }
-
-  /* XXX answer arrays should be static const but it'll do for now */
-  static const unsigned int yesCount = 8;
-  char yesAnswers[8][5];
-  sprintf(yesAnswers[0], "y");
-  sprintf(yesAnswers[1], "1");
-  sprintf(yesAnswers[2], "yes");
-  sprintf(yesAnswers[3], "yea");
-  sprintf(yesAnswers[4], "si");
-  sprintf(yesAnswers[5], "ja");
-  sprintf(yesAnswers[6], "oui");
-  sprintf(yesAnswers[7], "sim");
-
-  static const unsigned int noCount = 7;
-  char noAnswers[7][5];
-  sprintf(noAnswers[0], "n");
-  sprintf(noAnswers[1], "0");
-  sprintf(noAnswers[2], "no");
-  sprintf(noAnswers[3], "nay");
-  sprintf(noAnswers[4], "nein");
-  sprintf(noAnswers[5], "non");
-  sprintf(noAnswers[6], "nao");
+
+  /* find the start of the vote answer */
+  size_t startPosition = 0;
+  while ((startPosition < voteCmd.size()) &&
+	 (isWhitespace(voteCmd[startPosition]))) {
+    startPosition++;
+  }
+
+  /* stash the answer ('yes', 'no', etc) in lowercase to simplify comparison */
+  for (size_t i = startPosition;  i < voteCmd.size() && !isWhitespace(voteCmd[i]); i++) {
+    answer += tolower(voteCmd[i]);
+  }
+
+  std::vector<std::string> yesAnswers;
+  yesAnswers.push_back("y");
+  yesAnswers.push_back("1");
+  yesAnswers.push_back("yes");
+  yesAnswers.push_back("yea");
+  yesAnswers.push_back("si");
+  yesAnswers.push_back("ja");
+  yesAnswers.push_back("oui");
+  yesAnswers.push_back("sim");
+
+  std::vector<std::string> noAnswers;
+  noAnswers.push_back("n");
+  noAnswers.push_back("0");
+  noAnswers.push_back("no");
+  noAnswers.push_back("nay");
+  noAnswers.push_back("nein");
+  noAnswers.push_back("non");
+  noAnswers.push_back("nao");

   // see if the vote response is a valid yes or no answer
   int vote=-1;
-  for (unsigned int v = 0; v < (noCount > yesCount ? noCount : yesCount); v++) {
-    if (v < yesCount) {
+  unsigned int maxAnswerCount = noAnswers.size() > yesAnswers.size() ? noAnswers.size() : yesAnswers.size();
+  for (unsigned int v = 0; v < maxAnswerCount; v++) {
+    if (v < yesAnswers.size()) {
       if (answer == yesAnswers[v]) {
 	vote = 1;
 	break;
       }
     }
-    if (v < noCount) {
+    if (v < noAnswers.size()) {
       if (answer == noAnswers[v]) {
 	vote = 0;
 	break;
@@ -319,14 +380,12 @@
     if (answer.length() == 0) {
       sprintf(reply,"%s, you did not provide a vote answer", player[t].callSign);
       sendMessage(ServerPlayer, t, reply, true);
-      sprintf(reply,"Usage: /vote yes|no|y|n|1|0|yea|nay|si|ja|nein|oui|non|sim|nao");
-      sendMessage(ServerPlayer, t, reply, true);
     } else {
       sprintf(reply,"%s, you did not vote in favor or in opposition", player[t].callSign);
       sendMessage(ServerPlayer, t, reply, true);
-      sprintf(reply,"Usage: /vote yes|no|y|n|1|0|yea|nay|si|ja|nein|oui|non|sim|nao");
-      sendMessage(ServerPlayer, t, reply, true);
-    }
+    }
+    sprintf(reply,"Usage: /vote yes|no|y|n|1|0|yea|nay|si|ja|nein|oui|non|sim|nao");
+    sendMessage(ServerPlayer, t, reply, true);
     return;
   }

@@ -343,7 +402,8 @@

 void handleVetoCmd(int t, const char * /*message*/)
 {
-  char reply[MessageLen];
+  char reply[MessageLen] = {0};
+
   if (!hasPerm(t, PlayerAccessInfo::veto)) {
     /* permission denied for /veto */
     sprintf(reply,"%s, you are presently not authorized to run /veto", player[t].callSign);


--- ActorBash.cpp
+++ ActorBash.cpp
@@ -228,6 +228,9 @@
 						float binormal_velocity = Dot(binormal, m_vVelocity);
 						if (CMathCore::Abs(tangent_velocity) > EPSILON || CMathCore::Abs(binormal_velocity) > EPSILON)
 						{
+							float friction_velocity = Clamp(Max(-normal_velocity, 0.0f) * friction * CMathCore::RSqrt(tangent_velocity * tangent_velocity + binormal_velocity * binormal_velocity), -1.0f, 1.0f);
+							m_vVelocity -= tangent * tangent_velocity * friction_velocity;
+							m_vVelocity -= binormal * binormal_velocity * friction_velocity;

 						}