end battle function add diamond

end battle function add diamond

--- NFServer/NFGameLogicPlugin/NFCEctypeModule.cpp
+++ NFServer/NFGameLogicPlugin/NFCEctypeModule.cpp
@@ -215,7 +215,8 @@
     int nType = m_pElementInfoModule->GetPropertyInt(strSceneID, "SceneType");

     int nAddMoney = 0;
-    int nAddExp = 0;
+	int nAddExp = 0;
+	int nAddDiamnod = 0;
     NFCDataList xItemList;
     NFCDataList xCountList;

@@ -227,7 +228,9 @@
     // ֪ͨͻ
     NFCDataList xAwardInfoList;
     xAwardInfoList << nAddMoney;
-    xAwardInfoList << nAddExp;
+	xAwardInfoList << nAddExp;
+	xAwardInfoList << nAddDiamnod;
+
     if (xItemList.GetCount() == xCountList.GetCount())
     {
         for (int i = 0; i < xItemList.GetCount(); ++i)


Comment fixed to decribe actual reasoning for use of this offset for ScrollablePane content.

--- cegui/src/elements/CEGUIScrollablePane.cpp
+++ cegui/src/elements/CEGUIScrollablePane.cpp
@@ -346,7 +346,7 @@
                      cegui_absdim(-getVertScrollbar()->getScrollPosition()));

     // this bias is the absolute position that 0 on the scrollbars represent.
-    // effectively removes un-used empty space from the pane.
+    // Allows the pane to function correctly with negatively positioned content.
     UVector2 bias(cegui_absdim(d_contentRect.d_left),
                   cegui_absdim(d_contentRect.d_top));


added an example

added an example

git-svn-id: df10b4d4b9a50ecd05a5547a4432f768b32f36aa@140 c65b9dfa-2e9b-4d30-9b60-b5bbc3021b56

--- Samples/CollisionHandling/CustomSimulation.cpp
+++ Samples/CollisionHandling/CustomSimulation.cpp
@@ -221,6 +221,61 @@
        addSimulationObject(box);
        addSimulationObject(new PolygonRenderer(box->geometry()));
        addSimulationObject(DynamicCollidable::create(*new Octree(box->geometry(),3,*new BoundingSphereFactory()),box->body()));
+       addSimulationObject(new DelegateAction("box mass",[box](){
+         if(box->body().getMass()){
+           box->body().setMass(0);
+         }else{
+           box->body().setMass(1);
+         }
+       }));
+    }
+
+    {
+      DynamicGeometry<Rectangle> * rectangle;
+      PolygonRenderer * renderer;
+      Real spacing=3;
+      DynamicCollidable * collidable;
+      Vector3D offset(0,0,-3);
+      Vector3D left(-1,0,0);
+      Vector3D right(1,0,0);
+      Real angle = PI/6;
+      Vector3D axis(0,0,1);
+      Vector2D rectangleDim(3,2);
+      Quaternion q;
+      Vector3D pos;
+      q.setFromAxisAngle(Vector3D(1,0,0),PI/2);
+      for(int i=0; i< 4; i++){
+        rectangle =   new DynamicGeometry<Rectangle>(
+          *new Rectangle(rectangleDim),
+          0,
+          Matrix3x3::Zero());
+        renderer = new PolygonRenderer(rectangle->geometry());
+        collidable = DynamicCollidable::create(*new Octree(rectangle->geometry(),4,*new BoundingSphereFactory()),rectangle->body(),0.1);
+
+
+         pos = offset + Vector3D(0,spacing * i,0);
+        Quaternion ori;
+        if(i%2){
+          pos = pos + right;
+          ori.setFromAxisAngle(axis,angle);
+        }else{
+          pos = pos + left;
+          ori.setFromAxisAngle(axis,-angle);
+        }
+
+        rectangle->coordinates().position() = pos;
+        rectangle->coordinates().orientation() =ori*q;
+
+        addSimulationObject(rectangle);
+        addSimulationObject(renderer);
+        addSimulationObject(collidable);
+      }
+
+      DynamicSphere * sphere = new DynamicSphere(0.1,0.6);
+      addSimulationObject(sphere);
+      addSimulationObject(new SphereRenderer(sphere->geometry()));
+      addSimulationObject(DynamicCollidable::create(sphere->geometry(), sphere->body(),0.4,10,6));
+      sphere->coordinates().position() = pos+Vector3D(0,1,0);

     }


Modified: OpenGL 2 texture clamp mode was set to ‘clamp to border’

--- Source/Dreemchest/Renderer/OpenGL/OpenGL2.cpp
+++ Source/Dreemchest/Renderer/OpenGL/OpenGL2.cpp
@@ -588,7 +588,12 @@
             break;
     }

+    GLfloat borderColor[] = { 1.0, 1.0, 1.0, 1.0 };
+
     glTexImage2D(target, 0, format, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT/*GL_UNSIGNED_BYTE*/, NULL);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
+    glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
 }

 // ** OpenGL2::Texture::bind


Fix minor details in quest menu

Fix minor details in quest menu

--- Source/HeliumRain/UI/Menus/FlareQuestMenu.cpp
+++ Source/HeliumRain/UI/Menus/FlareQuestMenu.cpp
@@ -486,7 +486,7 @@
 					+ SHorizontalBox::Slot()
 					[
 						SNew(STextBlock)
-						.TextStyle(&Theme.TextFont)
+						.TextStyle(&Theme.NameFont)
 						.Text(StepConditionsText)
 					]

@@ -768,8 +768,7 @@
 	UFlareQuestManager* QuestManager = MenuManager->GetGame()->GetQuestManager();
 	FCHECK(QuestManager);

-	// Hide this for completed quests
-	if (SelectedQuest && (CurrentQuestStep == QuestStep || !QuestManager->IsQuestOngoing(SelectedQuest)))
+	if (SelectedQuest)
 	{
 		return SelectedQuest->FormatTags(QuestStep->GetStepDescription());
 	}
@@ -784,8 +783,7 @@
 	UFlareQuestManager* QuestManager = MenuManager->GetGame()->GetQuestManager();
 	FCHECK(QuestManager);

-	// Hide this for completed quests
-	if (SelectedQuest && (CurrentQuestStep == QuestStep || !QuestManager->IsQuestOngoing(SelectedQuest)))
+	if (SelectedQuest)
 	{
 		return EVisibility::Visible;
 	}


unit test for Local_Connection size_check.

--- test/Local_Connection_Test.cpp
+++ test/Local_Connection_Test.cpp
@@ -1,3 +1,6 @@
+#include <joedb/Writable.h>
+#include <joedb/journal/Generic_File.h>
+#include <joedb/journal/Writable_Journal.h>
 #ifndef JOEDB_PORTABLE
 #include "joedb/concurrency/Local_Connection.h"
 #include "joedb/journal/File.h"
@@ -64,4 +67,27 @@
  client1.pull();
  EXPECT_EQ(2, int(client1.get_database().get_tables().size()));
 }
+
+/////////////////////////////////////////////////////////////////////////////
+TEST(Local_Connection, size_check)
+/////////////////////////////////////////////////////////////////////////////
+{
+ std::remove(file_name);
+
+ {
+  joedb::File file(file_name, joedb::Open_Mode::create_new);
+  joedb::Writable_Journal journal(file);
+  journal.timestamp(0);
+  journal.flush();
+ }
+
+ try
+ {
+  Local_Connection<File> connection(file_name);
+  FAIL() << "Expected an exception\n";
+ }
+ catch(...)
+ {
+ }
+}
 #endif


Fixed memory leak in unit test introduced in my previous commit r322503

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

--- unittests/libclang/LibclangTest.cpp
+++ unittests/libclang/LibclangTest.cpp
@@ -592,6 +592,9 @@
     if (i == 2)
       flags |= CXTranslationUnit_CreatePreambleOnFirstParse;

+    if (i != 0)
+       clang_disposeTranslationUnit(ClangTU);  // dispose from previous iter
+
     // parse once
     ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0,
                                          nullptr, 0, flags);


Another Windows compile fix.

Another Windows compile fix.

git-svn-id: 6625e4d6743179724b113c04fbf297d122273a36@1587 108fab2b-820f-0410-9f2c-e5cc2c41d7be

--- lib/vplot/Splitter.cpp
+++ lib/vplot/Splitter.cpp
@@ -45,7 +45,7 @@

     Path* current = new Path(0,0);

-    Path::iterator i=p->begin(),j=(Path::iterator)0;
+    Path::iterator i=p->begin();
     bool above = i->second > splitter;

     if(above && top) current->addPointAbsolute(i->first, i->second);
@@ -62,7 +62,7 @@
         {
           if(continuous)
           {
-            j = i;
+            Path::iterator j = i;
             j--;
             tdouble = intersecth(splitter,*i,*j);
             current->addPointAbsolute(tdouble,splitter);
@@ -82,7 +82,7 @@
         {
           if(continuous)
           {
-            j = i;
+            Path::iterator j = i;
             j--;
             tdouble = intersecth(splitter,*i,*j);
             current->addPointAbsolute(tdouble,splitter);


check for ref ptr

check for ref ptr

--- PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.cxx
+++ PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.cxx
@@ -732,7 +732,7 @@
       fNtuple->Write();
   }

-  AliInfo(Form("%s: Accepted %lld events", GetName(), fNEvs));
+  AliInfo(Form("%s: Accepted %lld events          ", GetName(), fNEvs));
 }

 //________________________________________________________________________
@@ -2042,6 +2042,8 @@
   Int_t n = p->GetNumberOfTrackReferences();
   for (Int_t i=0; i<n; ++i) {
     AliTrackReference *ref = p->GetTrackReference(i);
+    if (!ref)
+      continue;
     ref->SetUserId(ref->DetectorId());
     ref->Print();
   }
@@ -2110,7 +2112,7 @@
   if (0) {
     printf("%d pid=%d: %.3f %.3f %.3f (%.2f %.2f %.2f); nd=%d,%d, mo=%d\n",
            index,p->PdgCode(),p->Px(),p->Py(),p->Pz(),p->Xv(),p->Yv(),p->Zv(),d1,d2, p->GetMother());
-    //PrintTrackRefs(p);
+    PrintTrackRefs(p);
   }
   Int_t nents  = fMcParts->GetEntries();


modify XeXe Cuts

modify XeXe Cuts


PWGGA/GammaConv: Changed train configs for pPb5TeVRun2 PHOS


Updated code format

Updated code format

--- test/optimisationProblem/blackBoxOptimisationBenchmark/testAttractiveSectorFunction.cpp
+++ test/optimisationProblem/blackBoxOptimisationBenchmark/testAttractiveSectorFunction.cpp
@@ -18,10 +18,10 @@
     mant::bbob::AttractiveSectorFunction<> attractiveSectorFunction(numberOfDimensions);

     arma::Mat<double> parameters;
-    CHECK( parameters.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_parameters_" + std::to_string(numberOfDimensions) +"x10.input") );
+    CHECK( parameters.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_parameters_" + std::to_string(numberOfDimensions) + "x10.input") );

     arma::Col<double> translation;
-    CHECK( translation.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_translation_" + std::to_string(numberOfDimensions) +"x1.input") );
+    CHECK( translation.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_translation_" + std::to_string(numberOfDimensions) + "x1.input") );

     arma::Mat<double> rotationR;
     CHECK( rotationR.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_randomRotationMatrix_" + std::to_string(numberOfDimensions) + "x" + std::to_string(numberOfDimensions) + "_2.input") );
@@ -30,7 +30,7 @@
     CHECK( rotationQ.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_randomRotationMatrix_" + std::to_string(numberOfDimensions) + "x" + std::to_string(numberOfDimensions) + "_1.input") );

     arma::Col<double> expected;
-    CHECK( expected.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/bbob_attractiveSectorFunction_dim" + std::to_string(numberOfDimensions) +".expected") );
+    CHECK( expected.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/bbob_attractiveSectorFunction_dim" + std::to_string(numberOfDimensions) + ".expected") );

     attractiveSectorFunction.setObjectiveValueTranslation(0);
     attractiveSectorFunction.setParameterTranslation(translation);


Make product name dynamic in DOMUI pref unit tests

BUG=50466
TEST=OptionsUITest test should pass on official builder in addition to main waterfall.

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

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

--- chrome/browser/dom_ui/options_ui_uitest.cc
+++ chrome/browser/dom_ui/options_ui_uitest.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

+#include "app/l10n_util.h"
 #include "base/command_line.h"
 #include "chrome/app/chrome_dll_resource.h"
 #include "chrome/common/chrome_switches.h"
@@ -10,6 +11,9 @@
 #include "chrome/test/automation/tab_proxy.h"
 #include "chrome/test/automation/window_proxy.h"
 #include "chrome/test/ui/ui_test.h"
+
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"

 namespace {

@@ -24,7 +28,10 @@
   void AssertIsOptionsPage(TabProxy* tab) {
     std::wstring title;
     ASSERT_TRUE(tab->GetTabTitle(&title));
-    ASSERT_EQ(L"Chromium Options", title);
+    std::wstring expected_title =
+        l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE,
+            l10n_util::GetString(IDS_PRODUCT_NAME));
+    ASSERT_EQ(expected_title, title);
   }
 };


Reduce messages

Reduce messages

--- PWGLF/FORWARD/analysis2/AliFMDEnergyFitter.cxx
+++ PWGLF/FORWARD/analysis2/AliFMDEnergyFitter.cxx
@@ -288,8 +288,7 @@
   //
   // Return:
   //    True on success, false otherwise
-  //
-  DGUARD(fDebug, 1, "Accumulate statistics in AliFMDEnergyFitter");
+  //  DGUARD(fDebug, 3, "Accumulate statistics in AliFMDEnergyFitter");
   Int_t icent = fCentralityAxis.FindBin(cent);
   if (icent < 1 || icent > fCentralityAxis.GetNbins()) icent = 0;

@@ -323,7 +322,7 @@
     } // for ring
   } // for detector

-  DMSG(fDebug, 1, "Found a total of %d signals for c=%f, and %sempty event",
+  DMSG(fDebug, 3, "Found a total of %d signals for c=%f, and %sempty event",
        nFills, cent, (empty ? "" : "non-"));
   return kTRUE;
 }


Disabling a couple of UI tests while I investigate.

TBR=ojan
Review URL: http://codereview.chromium.org/46040

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


Don't reload whole chrome://extensions page when interacting with single extension (disable/enable...).

BUG=26163
TEST=Click on Disable/Reload links and check if the whole page got reloaded.

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

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


Small "fix" to make window deallocation similar to window allocation.

r72998 fixed a regression in how windows were allocated for the GPU process.
This patch applies a similar fix for window deallocation.

BUG=none
TEST=none

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

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


CG: Fixed a typo in an error msg.

CG: Fixed a typo in an error msg.

--- PlugIns/CgProgramManager/src/OgreCgProgram.cpp
+++ PlugIns/CgProgramManager/src/OgreCgProgram.cpp
@@ -196,7 +196,7 @@
         //LogManager::getSingleton().logMessage(cgGetProgramString(mCgProgram, CG_COMPILED_PROGRAM));

         // Check for errors
-        checkForCgError("CgProgram::loadFromSource",
+        checkForCgError("CgProgram::compileMicrocode",
             "Unable to compile Cg program " + mName + ": ", mCgContext);

         CGerror error = cgGetError();


support DOS- and Mac-style line breaks

support DOS- and Mac-style line breaks

--- sources/aspotashev/as/tokenan.cpp
+++ sources/aspotashev/as/tokenan.cpp
@@ -86,7 +86,12 @@
             while ( isdigit( *ptr))
                 ptr ++;
         }
-        else if ( *ptr == '\n')
+        else if ( *ptr == '\r' && ptr[1] == '\n') // DOS
+        {
+            res.push_back( TokenAn::Token::createEos());
+            ptr += 2;
+        }
+        else if ( *ptr == '\n' || *ptr == '\r') // Unix, Mac
         {
             res.push_back( TokenAn::Token::createEos());
             ptr ++;


legion: another attempt at getting these dump template rules right across all versions of c++

--- runtime/legion/legion.inl
+++ runtime/legion/legion.inl
@@ -1435,9 +1435,9 @@
           {
             case 0:
               break;
-              // C++ is stupid, apparently the `using` statement is not
+              // C++11 is stupid, apparently the `using` statement is not
               // smart enough to rename explicit destructor invocations, FML
-#if __cplusplus >= 201103L
+#if __cplusplus == 201103L
 #define DIMFUNC(DIM) \
             case DIM: \
               { \


adl: Update comment on v2/v3 differences

--- src/adl.cpp
+++ src/adl.cpp
@@ -2825,8 +2825,9 @@
 		}

 		// TODO: Detect whether v2 (EOB2) or v3 (KYRA1). The only
-		// difference seems to be how offsets are encoded for some
-		// opcodes in the sound programs. Assume v3 for now.
+		// difference seems to be how offsets are encoded for the
+		// update_jumpToSubroutine opcode in the sound programs.
+		// Assume v3 for now.

 		// more sanity checks
 		if (_version > 1) {


typo fix

typo fix

--- src/cm-reportserver.cc
+++ src/cm-reportserver.cc
@@ -60,7 +60,7 @@

 void quit(int n) {
   shutdown_sig = true;
-  fnord::logInfo("cm.repotserver", "Shutting down...");
+  fnord::logInfo("cm.reportserver", "Shutting down...");
   // FIXPAUL: wait for http server stop...
   ev.shutdown();
 }
@@ -259,7 +259,7 @@

   table_janitor.stop();
   table_janitor.check();
-  fnord::logInfo("cm.repotserver", "Exiting...");
+  fnord::logInfo("cm.reportserver", "Exiting...");

   return 0;
 }


Fixed command line option handling.

Fixed command line option handling.

--- cpp/app/KernelPlugin.cpp
+++ cpp/app/KernelPlugin.cpp
@@ -75,10 +75,10 @@
    // command line options
    if(rval)
    {
-      Config& c = App::makeMetaConfig(
-         meta, PLUGIN_CL_CFG_ID, "command line", "options")
-            [ConfigManager::APPEND][PLUGIN_NAME];
-      c["modulePath"]->setType(Array);
+      Config c = App::makeMetaConfig(
+         meta, PLUGIN_CL_CFG_ID, "command line", "options");
+      c[ConfigManager::APPEND][PLUGIN_NAME]["modulePath"]->setType(Array);
+      c[ConfigManager::MERGE][PLUGIN_NAME]->setType(Map);
    }

    return rval;
@@ -100,25 +100,26 @@
 "\n";

    DynamicObject opt;
-   Config& options = getApp()->getMetaConfig()
-      ["options"][PLUGIN_CL_CFG_ID][ConfigManager::MERGE];
-   Config& configOptions = options[PLUGIN_NAME];
+   Config& options = getApp()->getMetaConfig()["options"][PLUGIN_CL_CFG_ID];
+   Config& oa = options[ConfigManager::APPEND];
+   Config& om = options[ConfigManager::MERGE];

    opt = spec["options"]->append();
    opt["short"] = "-m";
    opt["long"] = "--module-path";
-   opt["append"] = configOptions["modulePath"];
+   opt["append"]["root"] = oa;
+   opt["append"]["path"] = PLUGIN_NAME ".modulePath";
    opt["argError"] = "No path specified.";

    opt = spec["options"]->append();
    opt["long"] = "--no-module-path-env";
-   opt["setFalse"]["root"] = configOptions;
-   opt["setFalse"]["path"] = "env";
+   opt["setFalse"]["root"] = om;
+   opt["setFalse"]["path"] = PLUGIN_NAME ".env";

    opt = spec["options"]->append();
    opt["long"] = "--module-versions";
-   opt["setTrue"]["root"] = configOptions;
-   opt["setTrue"]["path"] = "printModuleVersions";
+   opt["setTrue"]["root"] = om;
+   opt["setTrue"]["path"] = PLUGIN_NAME ".printModuleVersions";

    DynamicObject specs = AppPlugin::getCommandLineSpecs();
    specs->append(spec);


INTEGRATION: CWS tl48_SRC680 (1.4.36); FILE MERGED 2007/10/17 15:05:18 tl 1.4.36.1: #i81311# fix warning with non-pro build and a possible crash

--- lingucomponent/source/languageguessing/guesslang.cxx
+++ lingucomponent/source/languageguessing/guesslang.cxx
@@ -5,9 +5,9 @@
  *
  *  $RCSfile: guesslang.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: rt $ $Date: 2007-06-22 08:32:42 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: hr $ $Date: 2007-11-01 10:54:35 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -165,11 +165,11 @@
     };
     LangCountry aDisable[] =
     {
-        {"gv", ""}, {"sco", ""}, {"tl", ""},            // not lang-id available yet...
-        {"hy", ""}, {"drt", ""},                        // 0 bytes fingerprints...
-        {"zh", "CN"}, {"zh", "TW"}, {"ja", ""}, {"ko", ""},   // not yet correct functional...
+        {"gv", ""}, {"sco", ""},                            // no lang-id available yet...
+//        {"hy", ""}, {"drt", ""},                          // 0 bytes fingerprints...
+        {"zh", "CN"}, {"zh", "TW"}, {"ja", ""}, {"ko", ""}, // not yet correct functional...
         {"ka", ""}, {"hi", ""}, {"mr", ""}, {"ne", ""},
-        {"sa", ""}, {"ta", ""}, {"tl", ""}, {"th", ""},
+        {"sa", ""}, {"ta", ""}, {"th", ""},
         {"qu", ""}, {"yi", ""}
     };
     sal_Int32 nNum = sizeof(aDisable) / sizeof(aDisable[0]);


Fix async index delayed finishing

Fix async index delayed finishing

--- urbackupclient/ClientServiceCMD.cpp
+++ urbackupclient/ClientServiceCMD.cpp
@@ -536,9 +536,9 @@
 			if (it2->first == async_file_list_id)
 			{
 				Server->Log("Previously finished async index " + async_id + " with \"" + it2->second + "\"", LL_DEBUG);
-				if (it2->second == "DONE")
+				if (it2->second == "done")
 				{
-					tcpstack.Send(pipe, "done");
+					tcpstack.Send(pipe, "DONE");
 				}
 				else
 				{


Fix String.ends_with() for empty string arguments

--- core/string/ustring.cpp
+++ core/string/ustring.cpp
@@ -3074,11 +3074,16 @@
 }

 bool String::ends_with(const String &p_string) const {
+	int l = p_string.length();
+	if (l == 0) {
+		return true;
+	}
+
 	int pos = rfind(p_string);
 	if (pos == -1) {
 		return false;
 	}
-	return pos + p_string.length() == length();
+	return pos + l == length();
 }

 bool String::begins_with(const String &p_string) const {


legion: fixes for bounds checks

legion: fixes for bounds checks

--- runtime/legion/legion.inl
+++ runtime/legion/legion.inl
@@ -2336,7 +2336,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, READ_ONLY);
+            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -2362,7 +2362,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, READ_ONLY);
+            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(FT);
@@ -2645,7 +2645,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, READ_ONLY);
+            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -2671,7 +2671,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, READ_ONLY);
+            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           strides[0] = accessor.strides[0] / sizeof(FT);
           return accessor.ptr(r.lo);
@@ -4268,7 +4268,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, REDUCE);
+            field_region.fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -4295,7 +4295,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, REDUCE);
+            field_region.fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(typename REDOP::RHS);
@@ -4558,7 +4558,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, REDUCE);
+            field_region.fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -4585,7 +4585,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(DomainPoint(r), field, REDUCE);
+            field_region.fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           strides[0] = accessor.strides[0] / sizeof(typename REDOP::RHS);
           return accessor.ptr(r.lo);


- fix compile error on qt 4.7

- fix compile error on qt 4.7

--- copasi/qlayout/qeffectdescriptionedit.cpp
+++ copasi/qlayout/qeffectdescriptionedit.cpp
@@ -1,7 +1,16 @@
+// Copyright (C) 2013 by Pedro Mendes, Virginia Tech Intellectual
+// Properties, Inc., University of Heidelberg, and The University
+// of Manchester.
+// All rights reserved.
+
 #include <QColorDialog>

 #include <qlayout/qeffectdescription.h>
 #include <qlayout/qeffectdescriptionedit.h>
+
+#if QT_VERSION < 40800
+#include <QPainter>
+#endif

 QEffectDescriptionEdit::QEffectDescriptionEdit(QWidget* parent, Qt::WindowFlags f)
   : QWidget(parent, f)
@@ -15,17 +24,23 @@

 void setColor(QLabel *widget, const QColor& color)
 {
-  QPalette palette(color);
-  palette.setColor(QPalette::Base, color);
-  palette.setColor(QPalette::Background, color);
-  palette.setColor(QPalette::Window, color);
-  palette.setColor(QPalette::Foreground, color);
-  widget->setPalette(palette);
+  QPalette palette(color);
+  palette.setColor(QPalette::Base, color);
+  palette.setColor(QPalette::Background, color);
+  palette.setColor(QPalette::Window, color);
+  palette.setColor(QPalette::Foreground, color);
+  widget->setPalette(palette);
   QImage image(widget->rect().size(), QImage::Format_ARGB32);
+
+#if QT_VERSION >= 40800
   image.fill(color);
+#else
+  QPainter painter(&image);
+  painter.fillRect(widget->rect(), color);
+#endif
+
   QPixmap pix = QPixmap::fromImage(image);
   widget->setPixmap(pix);
-
 }

 void QEffectDescriptionEdit::initFrom(const QEffectDescription* other, bool multiple)
@@ -35,26 +50,27 @@

   if (multiple)
     txtObjectName->setText("");
-  else
+  else
     txtObjectName->setText(other->getCN().c_str());

   txtScaleStart->setText(QString::number(other->getScaleStart()));
   txtScaleEnd->setText(QString::number(other->getScaleEnd()));

-  switch(other->getMode())
-  {
-  case QEffectDescription::Colorize:
-    radColorize->setChecked(true);
-    break;
-  case QEffectDescription::DropShadow:
-    radShadow->setChecked(true);
-    break;
-  default:
-  case QEffectDescription::Scale:
-    radScale->setChecked(true);
-    break;
-  }
+  switch (other->getMode())
+    {
+      case QEffectDescription::Colorize:
+        radColorize->setChecked(true);
+        break;

+      case QEffectDescription::DropShadow:
+        radShadow->setChecked(true);
+        break;
+
+      default:
+      case QEffectDescription::Scale:
+        radScale->setChecked(true);
+        break;
+    }
 }

 void QEffectDescriptionEdit::saveTo(QEffectDescription* other, bool /* multiple*/)
@@ -68,9 +84,8 @@
     other->setMode(QEffectDescription::Colorize);
   else if (radShadow->isChecked())
     other->setMode(QEffectDescription::DropShadow);
-  else
+  else
     other->setMode(QEffectDescription::Scale);
-
 }

 QEffectDescription* QEffectDescriptionEdit::toDescription() const
@@ -86,7 +101,7 @@
     result->setMode(QEffectDescription::Colorize);
   else if (radShadow->isChecked())
     result->setMode(QEffectDescription::DropShadow);
-  else
+  else
     result->setMode(QEffectDescription::Scale);

   return result;


If at first you don't succeed...

If at first you don't succeed...

--- cpp/new_journal_alert.cc
+++ cpp/new_journal_alert.cc
@@ -321,17 +321,22 @@
                                "An automated process has determined that new issues are available for\n"
                                "serials that you are subscribed to.  The list is:\n"
                                "
\n"); // start journal list
+
+    bool first_iteration(true);
     std::string last_series_title, last_volume_year_and_issue;
     for (const auto &new_issue_info : new_issue_infos) {
         if (new_issue_info.series_title_ != last_series_title) {
-            if (not last_series_title.empty())
+            if (not first_iteration) {
+                email_contents += "
\n"; // end items
                 email_contents += "
\n"; // end volume/year/issue list
+            }
             last_series_title = new_issue_info.series_title_;
             email_contents += "
" + HtmlUtil::HtmlEscape(last_series_title) + "
\n";
             email_contents += "
\n"; // start volume/year/issue list
             last_volume_year_and_issue.clear();
         }

+        // Generate "volume_year_and_issue":
         std::string volume_year_and_issue;
         if (not new_issue_info.volume_.empty())
             volume_year_and_issue += new_issue_info.volume_;
@@ -347,7 +352,7 @@
         }

         if (volume_year_and_issue != last_volume_year_and_issue) {
-            if (not last_volume_year_and_issue.empty())
+            if (not first_iteration)
                 email_contents += "
\n"; // end items
             email_contents += "
" + HtmlUtil::HtmlEscape(volume_year_and_issue) + "
\n";
             last_volume_year_and_issue = volume_year_and_issue;
@@ -360,6 +365,8 @@
             authors += "   " + HtmlUtil::HtmlEscape(author);
         email_contents += "
" + HtmlUtil::HtmlEscape(new_issue_info.issue_title_) + "" + authors
                           + "
\n";
+
+        first_iteration = false;
     }
     email_contents += "
\n"; // end items
     email_contents += "
\n"; // end volume/year/issue list


fixing the last part of #1755 (do not show dialog windows in the task bar as "untitled window") -- except for nicer icon images, which is now #1774

--- livesupport/src/modules/widgets/src/DialogWindow.cxx
+++ livesupport/src/modules/widgets/src/DialogWindow.cxx
@@ -132,6 +132,7 @@

     set_default_size(100*buttonCount + 50, 120);
     property_window_position().set_value(Gtk::WIN_POS_CENTER);
+    set_skip_taskbar_hint(true);    // do not show in the task bar

     add(*layout);
 }


Do not descend into symlink subdirs in os_remove_nonempty_dir

--- urbackupcommon/os_functions_lin.cpp
+++ urbackupcommon/os_functions_lin.cpp
@@ -407,11 +407,7 @@
 				int rc=lstat64((upath+"/"+(std::string)dirp->d_name).c_str(), &f_info);
 				if(rc==0)
 				{
-					if(S_ISDIR(f_info.st_mode) )
-					{
-                        subdirs.push_back((dirp->d_name));
-					}
-					else if(S_ISLNK(f_info.st_mode))
+					if(S_ISLNK(f_info.st_mode))
 					{
 						if(symlink_callback!=NULL)
 						{
@@ -424,6 +420,10 @@
                                 Log("Error deleting symlink \""+upath+"/"+(std::string)dirp->d_name+"\"", LL_ERROR);
 							}
 						}
+					}
+					else if(S_ISDIR(f_info.st_mode) )
+					{
+                        subdirs.push_back((dirp->d_name));
 					}
 					else
 					{


Avoid building tls_server on MinGW. GH #39

--- src/cmd/tls_server.cpp
+++ src/cmd/tls_server.cpp
@@ -7,9 +7,9 @@

 #include "apps.h"

-#if defined(BOTAN_HAS_TLS) \
-  && defined(BOTAN_HAS_DSA) \
-  && !defined(BOTAN_TARGET_OS_IS_WINDOWS)
+#if defined(BOTAN_HAS_TLS) && defined(BOTAN_HAS_DSA) \
+  && !defined(BOTAN_TARGET_OS_IS_WINDOWS) \
+  && !defined(BOTAN_TARGET_OS_IS_MINGW)

 #include <botan/tls_server.h>
 #include <botan/hex.h>


legion: Fix compile warnings for bounds checks

--- runtime/legion/runtime.cc
+++ runtime/legion/runtime.cc
@@ -17575,7 +17575,7 @@
       if (!region->contains_ptr(ptr))
       {
         fprintf(stderr,"BOUNDS CHECK ERROR IN TASK %s: Accessing invalid "
-                       "pointer %d\n", region->get_task_name(), ptr.value);
+                       "pointer %lld\n", region->get_task_name(), ptr.value);
         assert(false);
       }
     }
@@ -17591,18 +17591,18 @@
         {
           case 1:
             fprintf(stderr,"BOUNDS CHECK ERROR IN TASK %s: Accessing invalid "
-                           "1D point (%d)\n", region->get_task_name(),
+                           "1D point (%lld)\n", region->get_task_name(),
                             dp.point_data[0]);
             break;
           case 2:
             fprintf(stderr,"BOUNDS CHECK ERROR IN TASK %s: Accessing invalid "
-                           "2D point (%d,%d)\n", region->get_task_name(),
+                           "2D point (%lld,%lld)\n", region->get_task_name(),
                             dp.point_data[0], dp.point_data[1]);
             break;
           case 3:
             fprintf(stderr,"BOUNDS CHECK ERROR IN TASK %s: Accessing invalid "
-                           "3D point (%d,%d,%d)\n", region->get_task_name(),
-                      dp.point_data[0], dp.point_data[1], dp.point_data[2]);
+                         "3D point (%lld,%lld,%lld)\n", region->get_task_name(),
+                          dp.point_data[0], dp.point_data[1], dp.point_data[2]);
             break;
           default:
             assert(false);


optimize.hpp: put CSkipOP operations on tape (not yet tested).

git-svn-id: 1728f4fe1fce71bf2b1ab77247b3d200e5970555@2966 0e562018-b8fb-0310-a933-ecf073c7c197

--- cppad/local/optimize.hpp
+++ cppad/local/optimize.hpp
@@ -1264,8 +1264,8 @@
 	while(op != BeginOp)
 	{	// next op
 		play->next_reverse(op, arg, i_op, i_var);
-		// This if is not necessary becasue last assignment
-		// with this value of i_var will have NumRes(op) > 0
+
+		// Store the operator corresponding to each variable
 		if( NumRes(op) > 0 )
 		{	tape[i_var].op = op;
 			tape[i_var].arg = arg;
@@ -1713,6 +1713,30 @@
 	// Erase all information in the recording
 	rec->free();

+	// Determine which variables can be conditionally skipped
+	// 2DO: Perhaps we should change NumRes( UserOp ) = 1 , so it
+	// also gets a separate skip_on_true and skip_on false value
+	for(i = 0; i < num_var; i++)
+	{	if( tape[i].connect_type == cexp_true_connected )
+		{	j = tape[i].connect_index;
+			cskip_info[j].skip_on_false.push_back(i);
+		}
+		if( tape[i].connect_type == cexp_false_connected )
+		{	j = tape[i].connect_index;
+			cskip_info[j].skip_on_true.push_back(i);
+		}
+	}
+	// Sort the conditional skip information by the maximum of the
+	// index for the left and right comparision operands
+	CppAD::vector<size_t> cskip_info_order( cskip_info.size() );
+	{	CppAD::vector<size_t> keys( cskip_info.size() );
+		for(i = 0; i < cskip_info.size(); i++)
+			keys[i] = std::max( cskip_info[i].left, cskip_info[i].right );
+		CppAD::index_sort(keys, cskip_info_order);
+	}
+	size_t cskip_info_next = 0;
+
+
 	// Initilaize table mapping hash code to variable index in tape
 	// as pointing to the BeginOp at the beginning of the tape
 	CppAD::vector<size_t>  hash_table_var(CPPAD_HASH_TABLE_SIZE);
@@ -1772,6 +1796,41 @@
 		play->next_forward(op, arg, i_op, i_var);
 		CPPAD_ASSERT_UNKNOWN( (i_op > n)  | (op == InvOp) );
 		CPPAD_ASSERT_UNKNOWN( (i_op <= n) | (op != InvOp) );
+
+		// determine if we should insert a conditional skip here
+		bool skip = cskip_info_next < cskip_info.size();
+		if( skip )
+		{	j     = cskip_info_order[cskip_info_next];
+			skip &= cskip_info[j].left < i_var;
+			skip &= cskip_info[j].right < i_var;
+		}
+		if( skip )
+		{	cskip_info_next++;
+			skip &= cskip_info[j].skip_on_true.size() > 0 ||
+					cskip_info[j].skip_on_false.size() > 0;
+		}
+		if( skip )
+		{	optimize_cskip_info info = cskip_info[j];
+			CPPAD_ASSERT_UNKNOWN( NumRes(CSkipOp) == 0 );
+			CPPAD_ASSERT_UNKNOWN( info.left < i_var );
+			CPPAD_ASSERT_UNKNOWN( info.right < i_var );
+			rec->PutArg(
+				info.cop                  , // arg[0]
+				info.flag                 , // arg[1]
+				info.left                 , // arg[2]
+				info.right                , // arg[3]
+				info.skip_on_true.size()  , // arg[4]
+				info.skip_on_false.size()   // arg[5]
+			);
+			// These are old variable indices and need to be mapped
+			// to new variable indices after forward pass is completed.
+			for(i = 0; i < info.skip_on_true.size(); i++)
+				rec->PutArg( info.skip_on_true[i] );
+			for(i = 0; i < info.skip_on_false.size(); i++)
+				rec->PutArg( info.skip_on_false[i] );
+			//
+			rec->PutOp(CSkipOp);
+		}

 		// determine if we should keep this operation in the new
 		// operation sequence


Rewrote the entire bloody code generator

--- src/codegen_x64elf.cpp
+++ src/codegen_x64elf.cpp
@@ -11,6 +11,8 @@
 #include <climits>
 #include <common.hpp>
 #include <air.hpp>
+
+#define SECTION_HEADER_ENTRY_SIZE 0x40

 enum reg
 {
@@ -118,43 +120,45 @@
 #define SECTION_ATTRIB_MASKOS   0x0F000000  // NOTE(Isaac): environment-specific
 #define SECTION_ATTRIB_MASKPROC 0xF0000000  // NOTE(Isaac): processor-specific

+enum section_type : uint32_t
+{
+  SHT_NULL            = 0u,
+  SHT_PROGBITS        = 1u,
+  SHT_SYMTAB          = 2u,
+  SHT_STRTAB          = 3u,
+  SHT_RELA            = 4u,
+  SHT_HASH            = 5u,
+  SHT_DYNAMIC         = 6u,
+  SHT_NOTE            = 7u,
+  SHT_NOBITS          = 8u,
+  SHT_REL             = 9u,
+  SHT_SHLIB           = 10u,
+  SHT_DYNSYM          = 11u,
+  SHT_INIT_ARRAY      = 14u,
+  SHT_FINI_ARRAY      = 15u,
+  SHT_PREINIT_ARRAY   = 16u,
+  SHT_GROUP           = 17u,
+  SHT_SYMTAB_SHNDX    = 18u,
+  SHT_LOOS            = 0x60000000,
+  SHT_HIOS            = 0x6FFFFFFF,
+  SHT_LOPROC          = 0x70000000,
+  SHT_HIPROC          = 0x7FFFFFFF,
+  SHT_LOUSER          = 0x80000000,
+  SHT_HIUSER          = 0x8FFFFFFF
+};
+
 struct elf_section
 {
-  uint32_t name;                        // Offset in the string table to the section name
-  enum section_type : uint32_t
-  {
-    SHT_NULL            = 0u,
-    SHT_PROGBITS        = 1u,
-    SHT_SYMTAB          = 2u,
-    SHT_STRTAB          = 3u,
-    SHT_RELA            = 4u,
-    SHT_HASH            = 5u,
-    SHT_DYNAMIC         = 6u,
-    SHT_NOTE            = 7u,
-    SHT_NOBITS          = 8u,
-    SHT_REL             = 9u,
-    SHT_SHLIB           = 10u,
-    SHT_DYNSYM          = 11u,
-    SHT_INIT_ARRAY      = 14u,
-    SHT_FINI_ARRAY      = 15u,
-    SHT_PREINIT_ARRAY   = 16u,
-    SHT_GROUP           = 17u,
-    SHT_SYMTAB_SHNDX    = 18u,
-    SHT_LOOS            = 0x60000000,
-    SHT_HIOS            = 0x6FFFFFFF,
-    SHT_LOPROC          = 0x70000000,
-    SHT_HIPROC          = 0x7FFFFFFF,
-    SHT_LOUSER          = 0x80000000,
-    SHT_HIUSER          = 0x8FFFFFFF
-  } type;
-  uint64_t flags;
-  uint64_t address;                     // Virtual address of the beginning of the section in memory
-  uint64_t offset;                      // Offset of the beginning of the section in the file
-  uint64_t size;                        // NOTE(Isaac): for SHT_NOBITS, this is NOT the size in the file!
-  uint32_t link;                        // Index of an associated section
-  uint32_t info;
-  uint64_t addressAlignment;            // Required alignment of this section
-  uint64_t entrySize;                   // Size of each section entry (if fixed, zero otherwise)
+  uint32_t      name;               // Offset in the string table to the section name
+  section_type  type;
+  uint64_t      flags;
+  uint64_t      address;            // Virtual address of the beginning of the section in memory
+  uint64_t      offset;             // Offset of the beginning of the section in the file
+  uint64_t      size;               // NOTE(Isaac): for SHT_NOBITS, this is NOT the size in the file!
+  uint32_t      link;               // Index of an associated section
+  uint32_t      info;
+  uint64_t      addressAlignment;   // Required alignment of this section
+  uint64_t      entrySize;          // Size of each section entry (if fixed, zero otherwise)
 };

 struct elf_string
@@ -188,9 +192,83 @@
 void Free<elf_string>(elf_string& /*str*/)
 { }

-static void GenerateHeader(FILE* f, elf_header& header)
-{
-  const uint16_t sectionHeaderEntrySize = 0x40;
+enum symbol_binding : uint8_t
+{
+  SYM_BIND_LOCAL      = 0x0,
+  SYM_BIND_GLOBAL     = 0x1,
+  SYM_BIND_WEAK       = 0x2,
+  SYM_BIND_LOOS       = 0xA,
+  SYM_BIND_HIOS       = 0xC,
+  SYM_BIND_LOPROC     = 0xD,
+  SYM_BIND_HIGHPROC   = 0xF,
+};
+
+enum symbol_type : uint8_t
+{
+  SYM_TYPE_NONE,
+  SYM_TYPE_OBJECT,
+  SYM_TYPE_FUNCTION,
+  SYM_TYPE_SECTION,
+};
+
+struct elf_symbol
+{
+  uint32_t  name;
+  uint8_t   info;
+  uint16_t  sectionIndex;
+  uint64_t  definitionOffset;
+  uint64_t  size;
+};
+
+struct code_generator
+{
+  FILE*                   f;
+  codegen_target*         target;           // NOTE(Isaac): pointer because storing references is a PITA
+  linked_list<elf_string> strings;
+  linked_list<elf_string> sectionNames;
+  linked_list<elf_symbol> symbols;
+  elf_header              header;
+  elf_section             symbolTable;
+  elf_section             stringTable;
+  elf_section             sectionNameTable;
+  elf_section             text;
+};
+
+static void InitSection(code_generator& generator, elf_section& section, const char* name, section_type type, uint64_t alignment)
+{
+  section.name              = CreateString(generator.sectionNames, name);
+  section.type              = type;
+  section.flags             = 0u;
+  section.address           = 0u;
+  section.offset            = 0u;
+  section.size              = 0u;
+  section.link              = 0u;
+  section.info              = 0u;
+  section.addressAlignment  = alignment;
+  section.entrySize         = 0u;
+}
+
+void CreateSymbol(code_generator& generator, const char* name, symbol_binding binding, symbol_type type, uint16_t sectionIndex, uint64_t defOffset, uint64_t size)
+{
+  elf_symbol symbol;
+  symbol.name = CreateString(generator.strings, name);
+  symbol.info = type;
+  symbol.info |= binding;
+  symbol.sectionIndex = sectionIndex;
+  symbol.definitionOffset = defOffset;
+  symbol.size = size;
+
+  AddToLinkedList<elf_symbol>(generator.symbols, symbol);
+}
+
+static void EmitHeader(code_generator& generator)
+{
+  FILE* f = generator.f;
+
+  /*
+   * NOTE(Isaac): this is already a define, but `fwrite` is stupid, so it has to be a lvalue too
+   */
+  const uint16_t sectionHeaderEntrySize = SECTION_HEADER_ENTRY_SIZE;

 /*0x00*/fputc(0x7F,     f); // Emit the 4 byte magic value
         fputc('E',      f);
@@ -206,87 +284,55 @@
         {
           fputc(0x00,   f); // Pad out EI_ABIVERSION and EI_PAD
         }
-/*0x10*/fwrite(&(header.fileType), sizeof(uint16_t), 1, f);
+/*0x10*/fwrite(&(generator.header.fileType), sizeof(uint16_t), 1, f);
 /*0x12*/fputc(0x3E,     f); // Specify we are targetting the x86_64 ISA
         fputc(0x00,     f);
 /*0x14*/fputc(0x01,     f); // Specify we are targetting the first version of ELF
         fputc(0x00,     f);
         fputc(0x00,     f);
         fputc(0x00,     f);
-/*0x18*/fwrite(&(header.entryPoint), sizeof(uint64_t), 1, f);
-/*0x20*/fputc(0x00,     f); // Offset to the program header - there isn't one
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-        fputc(0x00,     f);
-/*0x28*/fwrite(&(header.sectionHeaderOffset), sizeof(uint64_t), 1, f);
+/*0x18*/fwrite(&(generator.header.entryPoint), sizeof(uint64_t), 1, f);
+/*0x20*/fputc(0x00,     f); // Offset to the program generator.header - there isn't one
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+        fputc(0x00,     f);
+/*0x28*/fwrite(&(generator.header.sectionHeaderOffset), sizeof(uint64_t), 1, f);
 /*0x30*/fputc(0x00,     f); // Specify some flags (undefined for x86_64)
         fputc(0x00,     f);
         fputc(0x00,     f);
         fputc(0x00,     f);
-/*0x34*/fputc(64u,      f); // Specify the size of the header (64 bytes)
-        fputc(0x00,     f);
-/*0x36*/fputc(0x00,     f); // Specify the size of a program header entry as 0
-        fputc(0x00,     f);
-/*0x38*/fputc(0x00,     f); // Specify that there are 0 program header entries
+/*0x34*/fputc(64u,      f); // Specify the size of the generator.header (64 bytes)
+        fputc(0x00,     f);
+/*0x36*/fputc(0x00,     f); // Specify the size of a program generator.header entry as 0
+        fputc(0x00,     f);
+/*0x38*/fputc(0x00,     f); // Specify that there are 0 program generator.header entries
         fputc(0x00,     f);
 /*0x3A*/fwrite(&sectionHeaderEntrySize,           sizeof(uint16_t), 1, f);
-/*0x3C*/fwrite(&(header.numSectionHeaderEntries), sizeof(uint16_t), 1, f);
-/*0x3E*/fwrite(&(header.sectionWithSectionNames), sizeof(uint16_t), 1, f);
+/*0x3C*/fwrite(&(generator.header.numSectionHeaderEntries), sizeof(uint16_t), 1, f);
+/*0x3E*/fwrite(&(generator.header.sectionWithSectionNames), sizeof(uint16_t), 1, f);
 /*0x40*/
 }

-static void GenerateSectionHeaderEntry(FILE* f, elf_header& header, elf_section& section)
-{
-  header.numSectionHeaderEntries++;
+static void EmitSectionEntry(code_generator& generator, elf_section& section)
+{
+  generator.header.numSectionHeaderEntries++;

 /*n + */
-/*0x00*/fwrite(&(section.name),             sizeof(uint32_t), 1, f);
-/*0x04*/fwrite(&(section.type),             sizeof(uint32_t), 1, f);
-/*0x08*/fwrite(&(section.flags),            sizeof(uint64_t), 1, f);
-/*0x10*/fwrite(&(section.address),          sizeof(uint64_t), 1, f);
-/*0x18*/fwrite(&(section.offset),           sizeof(uint64_t), 1, f);
-/*0x20*/fwrite(&(section.size),             sizeof(uint64_t), 1, f);
-/*0x28*/fwrite(&(section.link),             sizeof(uint32_t), 1, f);
-/*0x2C*/fwrite(&(section.info),             sizeof(uint32_t), 1, f);
-/*0x30*/fwrite(&(section.addressAlignment), sizeof(uint64_t), 1, f);
-/*0x38*/fwrite(&(section.entrySize),        sizeof(uint64_t), 1, f);
+/*0x00*/fwrite(&(section.name),             sizeof(uint32_t), 1, generator.f);
+/*0x04*/fwrite(&(section.type),             sizeof(uint32_t), 1, generator.f);
+/*0x08*/fwrite(&(section.flags),            sizeof(uint64_t), 1, generator.f);
+/*0x10*/fwrite(&(section.address),          sizeof(uint64_t), 1, generator.f);
+/*0x18*/fwrite(&(section.offset),           sizeof(uint64_t), 1, generator.f);
+/*0x20*/fwrite(&(section.size),             sizeof(uint64_t), 1, generator.f);
+/*0x28*/fwrite(&(section.link),             sizeof(uint32_t), 1, generator.f);
+/*0x2C*/fwrite(&(section.info),             sizeof(uint32_t), 1, generator.f);
+/*0x30*/fwrite(&(section.addressAlignment), sizeof(uint64_t), 1, generator.f);
+/*0x38*/fwrite(&(section.entrySize),        sizeof(uint64_t), 1, generator.f);
 /*0x40*/
-}
-
-#define SYMBOL_BINDING_LOCAL    0x0
-#define SYMBOL_BINDING_GLOBAL   0x1
-#define SYMBOL_BINDING_WEAK     0x2
-#define SYMBOL_BINDING_LOOS     0xA     // NOTE(Isaac): environment-specific
-#define SYMBOL_BINDING_HIOS     0xC     // NOTE(Isaac): environment-specific
-#define SYMBOL_BINDING_LOPROC   0xD     // NOTE(Isaac): processor-specific
-#define SYMBOL_BINDING_HIGHPROC 0xF     // NOTE(Isaac): processor-specific
-
-#define SYMBOL_TYPE_NONE        0x0
-#define SYMBOL_TYPE_OBJECT      0x1
-#define SYMBOL_TYPE_FUNC        0x2
-#define SYMBOL_TYPE_SECTION     0x3
-
-static void EmitSymbol(FILE* f, elf_section& symbolTable, uint32_t name, uint8_t binding, uint8_t type,
-                       uint16_t sectionTableIndex, uint64_t definitionOffset, uint64_t size)
-{
-  uint8_t info = 0u;
-  info |= binding << 4u;
-  info |= type;
-
-/*n + */
-/*0x00*/fwrite(&name, sizeof(uint32_t), 1, f);
-/*0x04*/fwrite(&info, sizeof(uint8_t), 1, f);
-/*0x05*/fputc(0x00, f);
-/*0x06*/fwrite(&sectionTableIndex, sizeof(uint16_t), 1, f);
-/*0x08*/fwrite(&definitionOffset, sizeof(uint64_t), 1, f);
-/*0x10*/fwrite(&size, sizeof(uint64_t), 1, f);
-/*0x18*/
-
-  symbolTable.size += 0x18;
 }

 /*
@@ -318,33 +364,33 @@
  * `reg` : opcode offset of the destination register
  * `r/m` : opcode offset of the source register, optionally with a displacement (as specified by `mod`)
  */
-static inline uint8_t CreateRegisterModRM(codegen_target& target, reg dest, reg src)
+static inline uint8_t CreateRegisterModRM(codegen_target* target, reg dest, reg src)
 {
   uint8_t result = 0b11000000; // NOTE(Isaac): use the register-direct addressing mode
-  result |= target.registerSet[dest].pimpl->opcodeOffset << 3u;
-  result |= target.registerSet[src].pimpl->opcodeOffset;
+  result |= target->registerSet[dest].pimpl->opcodeOffset << 3u;
+  result |= target->registerSet[src].pimpl->opcodeOffset;
   return result;
 }

-static inline uint8_t CreateExtensionModRM(codegen_target& target, uint8_t extension, reg r)
+static inline uint8_t CreateExtensionModRM(codegen_target* target, uint8_t extension, reg r)
 {
   uint8_t result = 0b11000000;  // NOTE(Isaac): register-direct addressing mode
   result |= extension << 3u;
-  result |= target.registerSet[r].pimpl->opcodeOffset;
+  result |= target->registerSet[r].pimpl->opcodeOffset;
   return result;
 }

 /*
  * NOTE(Isaac): returns the number of bytes emitted
  */
-static uint64_t Emit(FILE* f, codegen_target& target, i instruction, ...)
+static uint64_t Emit(code_generator& generator, i instruction, ...)
 {
   va_list args;
   va_start(args, instruction);
   uint64_t numBytesEmitted = 0u;

   #define EMIT(thing) \
-    fputc(thing, f); \
+    fputc(thing, generator.f); \
     numBytesEmitted++;

   switch (instruction)
@@ -356,13 +402,13 @@

       EMIT(0x48);
       EMIT(static_cast<uint8_t>(i::ADD_REG_REG));
-      EMIT(CreateRegisterModRM(target, dest, src));
+      EMIT(CreateRegisterModRM(generator.target, dest, src));
     } break;

     case i::PUSH_REG:
     {
       reg r = static_cast<reg>(va_arg(args, int));
-      EMIT(static_cast<uint8_t>(i::PUSH_REG) + target.registerSet[r].pimpl->opcodeOffset);
+      EMIT(static_cast<uint8_t>(i::PUSH_REG) + generator.target->registerSet[r].pimpl->opcodeOffset);
     } break;

     case i::ADD_REG_IMM32:
@@ -372,8 +418,8 @@

       EMIT(0x48);   // Specify we are moving 64-bit values around
       EMIT(static_cast<uint8_t>(i::ADD_REG_IMM32));
-      EMIT(CreateExtensionModRM(target, 0u, result));
-      fwrite(&imm, sizeof(uint32_t), 1, f);
+      EMIT(CreateExtensionModRM(generator.target, 0u, result));
+      fwrite(&imm, sizeof(uint32_t), 1, generator.f);
       numBytesEmitted += 4u;
     } break;

@@ -384,7 +430,7 @@

       EMIT(0x48);
       EMIT(static_cast<uint8_t>(i::MOV_REG_REG));
-      EMIT(CreateRegisterModRM(target, dest, src));
+      EMIT(CreateRegisterModRM(generator.target, dest, src));
     } break;

     case i::MOV_REG_IMM32:
@@ -393,8 +439,8 @@
       uint32_t imm = va_arg(args, uint32_t);

 //      EMIT(0x48);
-      EMIT(static_cast<uint8_t>(i::MOV_REG_IMM32) + target.registerSet[dest].pimpl->opcodeOffset);
-      fwrite(&imm, sizeof(uint32_t), 1, f);
+      EMIT(static_cast<uint8_t>(i::MOV_REG_IMM32) + generator.target->registerSet[dest].pimpl->opcodeOffset);
+      fwrite(&imm, sizeof(uint32_t), 1, generator.f);
       numBytesEmitted += 4u;
     } break;

@@ -408,55 +454,17 @@

   va_end(args);
   return numBytesEmitted;
-}
-
-/*
-void GenerateBootstrap(FILE* f, elf_section& textSection, elf_header& header, uint64_t entryFunctionOffset)
-{
-  header.entryPoint = ftell(f);
-  unsigned numBytesEmitted = 0u;
-
-  // xor ebp, ebp
-  EMIT(0x31);
-  EMIT(0xED);
-
-  // call {the entry function}
-  EMIT(0xE8);
-  uint32_t relativeAddressToEntryFunction = (uint32_t)(entryFunctionOffset - (ftell(f) + 4u));
-  fwrite(&relativeAddressToEntryFunction, sizeof(uint32_t), 1, f);
-  numBytesEmitted += 4u;
-
-  // mov rax, 1
-  EMIT(0xB8);
-  EMIT(0x01);
-  EMIT(0x00);
-  EMIT(0x00);
-  EMIT(0x00);
-
-  // xor ebx, ebx
-  EMIT(0x31);
-  EMIT(0xDB);
-
-  // int 0x80
-  EMIT(0xCD);
-  EMIT(0x80);
-
-  textSection.size += numBytesEmitted;
-}
 #undef EMIT
-*/
-
-void GenerateTextSection(FILE* file, codegen_target& target, elf_section& section, parse_result& result)
-{
-  section.type = elf_section::section_type::SHT_PROGBITS;
-  section.flags = SECTION_ATTRIB_E | SECTION_ATTRIB_A;
-  section.address = 0u;
-  section.offset = ftell(file);
-  section.size = 0u;
-  section.link = 0u;
-  section.info = 0u;
-  section.addressAlignment = 0x10;
-  section.entrySize = 0x00;
+}
+
+void EmitText(code_generator& generator, parse_result& result)
+{
+  InitSection(generator, generator.text, ".text", SHT_PROGBITS, 0x10);
+  generator.text.flags = SECTION_ATTRIB_E | SECTION_ATTRIB_A;
+  generator.text.offset = ftell(generator.f);
+
+  #define EMIT(...) \
+    generator.text.size += Emit(generator, __VA_ARGS__);

   // Generate code for each function
   for (auto* functionIt = result.functions.first;
@@ -482,14 +490,14 @@
       {
         case I_ENTER_STACK_FRAME:
         {
-          section.size += Emit(file, target, i::PUSH_REG, RBP);
-          section.size += Emit(file, target, i::MOV_REG_REG, RBP, RSP);
+          EMIT(i::PUSH_REG, RBP);
+          EMIT(i::MOV_REG_REG, RBP, RSP);
         } break;

         case I_LEAVE_STACK_FRAME:
         {
-          section.size += Emit(file, target, i::LEAVE);
-          section.size += Emit(file, target, i::RET);
+          EMIT(i::LEAVE);
+          EMIT(i::RET);
         } break;

         case I_RETURN:
@@ -508,11 +516,11 @@

           if (mov.src->type == slot::slot_type::INT_CONSTANT)
           {
-            section.size += Emit(file, target, i::MOV_REG_IMM32, mov.dest->color, mov.src->payload.i);
+            EMIT(i::MOV_REG_IMM32, mov.dest->color, mov.src->payload.i);
           }
           else
           {
-            section.size += Emit(file, target, i::MOV_REG_REG, mov.dest->color, mov.src->color);
+            EMIT(i::MOV_REG_REG, mov.dest->color, mov.src->color);
           }
         } break;

@@ -527,20 +535,20 @@

           if (triple.left->shouldBeColored) // NOTE(Isaac): this effectively checks if it's gonna be in a register
           {
-            section.size += Emit(file, target, i::MOV_REG_REG, triple.result->color, triple.left->color);
+            EMIT(i::MOV_REG_REG, triple.result->color, triple.left->color);
           }
           else
           {
-            section.size += Emit(file, target, i::MOV_REG_IMM32, triple.result->color, triple.left->payload.i);
+            EMIT(i::MOV_REG_IMM32, triple.result->color, triple.left->payload.i);
           }

           if (triple.right->shouldBeColored)
           {
-            section.size += Emit(file, target, i::ADD_REG_REG, triple.result->color, triple.right->color);
+            EMIT(i::ADD_REG_REG, triple.result->color, triple.right->color);
           }
           else
           {
-            section.size += Emit(file, target, i::ADD_REG_IMM32, triple.result->color, triple.right->payload.i);
+            EMIT(i::ADD_REG_IMM32, triple.result->color, triple.right->payload.i);
           }
         } break;

@@ -572,84 +580,76 @@
       }
     }
   }
+#undef EMIT
 }

 void Generate(const char* outputPath, codegen_target& target, parse_result& result)
 {
-  FILE* f = fopen(outputPath, "wb");
-
-  if (!f)
+  code_generator generator;
+  generator.f = fopen(outputPath, "wb");
+  generator.target = ⌖
+  CreateLinkedList<elf_string>(generator.strings);
+  CreateLinkedList<elf_string>(generator.sectionNames);
+  CreateLinkedList<elf_symbol>(generator.symbols);
+
+  if (!generator.f)
   {
     fprintf(stderr, "Failed to open output file: %s\n", outputPath);
     exit(1);
   }

-  linked_list<elf_string> strings;
-  CreateLinkedList<elf_string>(strings);
-
-  linked_list<elf_string> sectionNames;
-  CreateLinkedList<elf_string>(sectionNames);
-
-  elf_header header;
-  header.fileType = 0x01;
-  header.numSectionHeaderEntries = 0u;
-  header.entryPoint = 0x00;
-  header.sectionWithSectionNames = 3u; // NOTE(Isaac): this is hardcoded
+  generator.header.fileType = 0x01;
+  generator.header.numSectionHeaderEntries = 0u;
+  generator.header.entryPoint = 0x00;
+  generator.header.sectionWithSectionNames = 3u; // NOTE(Isaac): this is hardcoded
+
+  // Test symbol
+  CreateSymbol(generator, "testThang", SYM_BIND_LOCAL, SYM_TYPE_NONE, 1u, 42u, 0u);

   // --- The symbol table ---
-  elf_section symbolTable;
-  symbolTable.name = CreateString(sectionNames, ".symtab");
-  symbolTable.type = elf_section::section_type::SHT_SYMTAB;
-  symbolTable.flags = 0u;
-  symbolTable.address = 0u;
-  symbolTable.offset = 0u;
-  symbolTable.size = 0u;
-  symbolTable.link = 4u;    // NOTE(Isaac): hardcoded to be the section index of the string table used
-  symbolTable.info = UINT_MAX;
-  symbolTable.addressAlignment = 0x04;
-  symbolTable.entrySize = 0x18;
+  InitSection(generator, generator.symbolTable, ".symtab", SHT_SYMTAB, 0x04);
+  generator.symbolTable.link = 4u;    // NOTE(Isaac): hardcoded to be the section index of the string table used
+  generator.symbolTable.info = UINT_MAX;
+  generator.symbolTable.entrySize = 0x18;

   // --- The string table of symbols ---
-  elf_section stringTable;
-  stringTable.name = CreateString(sectionNames, ".strtab");
-  stringTable.type = elf_section::section_type::SHT_STRTAB;
-  stringTable.flags = 0u;
-  stringTable.address = 0u;
-  stringTable.offset = 0u;
-  stringTable.size = 1u; // NOTE(Isaac): 1 because of the leading null-terminator
-  stringTable.link = 0u;
-  stringTable.info = 0u;
-  stringTable.addressAlignment = 0x01;
-  stringTable.entrySize = 0u;
+  InitSection(generator, generator.stringTable, ".strtab", SHT_STRTAB, 0x01);
+  generator.stringTable.size = 1u; // NOTE(Isaac): 1 because of the leading null-terminator

   // --- The string table of section names ---
-  elf_section sectionNameStringTable;
-  sectionNameStringTable.name = CreateString(sectionNames, ".shstrtab");
-  sectionNameStringTable.type = elf_section::section_type::SHT_STRTAB;
-  sectionNameStringTable.flags = 0u;
-  sectionNameStringTable.address = 0u;
-  sectionNameStringTable.offset = 0u;
-  sectionNameStringTable.size = 1u; // NOTE(Isaac): 1 because of the leading null-terminator
-  sectionNameStringTable.link = 0u;
-  sectionNameStringTable.info = 0u;
-  sectionNameStringTable.addressAlignment = 0x01;
-  sectionNameStringTable.entrySize = 0u;
+  InitSection(generator, generator.sectionNameTable, ".shstrtab", SHT_STRTAB, 0x01);
+  generator.sectionNameTable.size = 1u;

   // [0x40] Generate the object code that will be in the .text section
-  fseek(f, 0x40, SEEK_SET);
-  elf_section textSection;
-  GenerateTextSection(f, target, textSection, result);
-  textSection.name = CreateString(sectionNames, ".text");
+  fseek(generator.f, 0x40, SEEK_SET);
+  EmitText(generator, result);
+  generator.text.name = CreateString(generator.sectionNames, ".text");

   // [???] Emit the symbol table
-  symbolTable.offset = ftell(f);
-  EmitSymbol(f, symbolTable, CreateString(strings, "testThang"), SYMBOL_BINDING_GLOBAL, SYMBOL_TYPE_NONE, 1u, 0x40, 0u);
+  generator.symbolTable.offset = ftell(generator.f);
+
+  for (auto* symbolIt = generator.symbols.first;
+       symbolIt;
+       symbolIt = symbolIt->next)
+  {
+
+/*n + */
+/*0x00*/fwrite(&((**symbolIt).name), sizeof(uint32_t), 1, generator.f);
+/*0x04*/fwrite(&((**symbolIt).info), sizeof(uint8_t), 1, generator.f);
+/*0x05*/fputc(0x00, generator.f);
+/*0x06*/fwrite(&((**symbolIt).sectionIndex), sizeof(uint16_t), 1, generator.f);
+/*0x08*/fwrite(&((**symbolIt).definitionOffset), sizeof(uint64_t), 1, generator.f);
+/*0x10*/fwrite(&((**symbolIt).size), sizeof(uint64_t), 1, generator.f);
+/*0x18*/
+
+    generator.symbolTable.size += 0x18;
+  }

   // [???] Emit the string table of section names
-  sectionNameStringTable.offset = ftell(f);
-  fputc('\0', f);   // NOTE(Isaac): start with a leading null-terminator
-
-  for (auto* stringIt = sectionNames.first;
+  generator.sectionNameTable.offset = ftell(generator.f);
+  fputc('\0', generator.f);   // NOTE(Isaac): start with a leading null-terminator
+
+  for (auto* stringIt = generator.sectionNames.first;
        stringIt;
        stringIt = stringIt->next)
   {
@@ -657,20 +657,20 @@
          i < strlen((**stringIt).str);
          i++)
     {
-      fputc((**stringIt).str[i], f);
-      sectionNameStringTable.size++;
+      fputc((**stringIt).str[i], generator.f);
+      generator.sectionNameTable.size++;
     }

     // Add a null-terminator
-    fputc('\0', f);
-    sectionNameStringTable.size++;
+    fputc('\0', generator.f);
+    generator.sectionNameTable.size++;
   }

   // [???] Emit the string table
-  stringTable.offset = ftell(f);
-  fputc('\0', f);   // NOTE(Isaac): start with a leading null-terminator
-
-  for (auto* stringIt = strings.first;
+  generator.stringTable.offset = ftell(generator.f);
+  fputc('\0', generator.f);   // NOTE(Isaac): start with a leading null-terminator
+
+  for (auto* stringIt = generator.strings.first;
        stringIt;
        stringIt = stringIt->next)
   {
@@ -678,42 +678,37 @@
          i < strlen((**stringIt).str);
          i++)
     {
-      fputc((**stringIt).str[i], f);
-      stringTable.size++;
+      fputc((**stringIt).str[i], generator.f);
+      generator.stringTable.size++;
     }

     // Add a null-terminator
-    fputc('\0', f);
-    stringTable.size++;
+    fputc('\0', generator.f);
+    generator.stringTable.size++;
   }

   // [???] Create the section header
-  header.sectionHeaderOffset = ftell(f);
+  generator.header.sectionHeaderOffset = ftell(generator.f);

   // Create a sentinel null section at index 0
-  elf_section nullSection;
-  nullSection.name = 0;
-  nullSection.type = elf_section::section_type::SHT_NULL;
-  nullSection.flags = 0;
-  nullSection.address = 0;
-  nullSection.offset = 0;
-  nullSection.size = 0u;
-  nullSection.link = 0u;
-  nullSection.info = 0u;
-  nullSection.addressAlignment = 0u;
-  nullSection.entrySize = 0u;
-
-  GenerateSectionHeaderEntry(f, header, nullSection);             // [0]
-  GenerateSectionHeaderEntry(f, header, textSection);             // [1]
-  GenerateSectionHeaderEntry(f, header, symbolTable);             // [2]
-  GenerateSectionHeaderEntry(f, header, sectionNameStringTable);  // [3]
-  GenerateSectionHeaderEntry(f, header, stringTable);             // [4]
+  generator.header.numSectionHeaderEntries = 1u;
+  for (unsigned int i = 0u;
+       i < SECTION_HEADER_ENTRY_SIZE;
+       i++)
+  {
+    fputc(0x00, generator.f);
+  }
+
+  EmitSectionEntry(generator, generator.text);              // [1]
+  EmitSectionEntry(generator, generator.symbolTable);       // [2]
+  EmitSectionEntry(generator, generator.sectionNameTable);  // [3]
+  EmitSectionEntry(generator, generator.stringTable);       // [4]

   // [0x00] Generate the ELF header
-  fseek(f, 0x00, SEEK_SET);
-  GenerateHeader(f, header);
-
-  FreeLinkedList<elf_string>(strings);
-  FreeLinkedList<elf_string>(sectionNames);
-  fclose(f);
-}
+  fseek(generator.f, 0x00, SEEK_SET);
+  EmitHeader(generator);
+
+  FreeLinkedList<elf_string>(generator.strings);
+  FreeLinkedList<elf_string>(generator.sectionNames);
+  fclose(generator.f);
+}


Change PutOp(op) return value to addr_t and check that values are small enough.

--- cppad/local/recorder.hpp
+++ cppad/local/recorder.hpp
@@ -1,8 +1,7 @@
-// $Id$
 # ifndef CPPAD_LOCAL_RECORDER_HPP
 # define CPPAD_LOCAL_RECORDER_HPP
 /* --------------------------------------------------------------------------
-CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-16 Bradley M. Bell
+CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell

 CppAD is distributed under multiple licenses. This distribution is under
 the terms of the
@@ -107,7 +106,7 @@
 		text_rec_.free();
 	}
 	/// Put next operator in the operation sequence.
-	inline size_t PutOp(OpCode op);
+	inline addr_t PutOp(OpCode op);
 	/// Put a vecad load operator in the operation sequence (special case)
 	inline size_t PutLoadOp(OpCode op);
 	/// Add a value to the end of the current vector of VecAD indices.
@@ -188,7 +187,7 @@
 and after each call to Erase.
 */
 template <class Base>
-inline size_t recorder<Base>::PutOp(OpCode op)
+inline addr_t recorder<Base>::PutOp(OpCode op)
 {	size_t i    = op_rec_.extend(1);
 	CPPAD_ASSERT_KNOWN(
 		(abort_op_index_ == 0) || (abort_op_index_ != i),
@@ -202,7 +201,13 @@
 	num_var_rec_ += NumRes(op);
 	CPPAD_ASSERT_UNKNOWN( num_var_rec_ > 0 );

-	return num_var_rec_ - 1;
+	// index of parameter just stored
+	CPPAD_ASSERT_KNOWN(
+		(size_t) std::numeric_limits<addr_t>::max() >= num_var_rec_ - 1,
+		"cppad_tape_addr_type maximum value has been exceeded"
+	)
+
+	return static_cast<addr_t>( num_var_rec_ - 1 );
 }

 /*!


Fix redefinition of default argument, found by modules build.  It's not
entirely clear whether this should be valid with modules enabled, but the fixed
code is cleaner regardless.

Also fix a TU-local type that accidentally had external linkage.

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

--- utils/TableGen/IntrinsicEmitter.cpp
+++ utils/TableGen/IntrinsicEmitter.cpp
@@ -14,6 +14,7 @@
 #include "CodeGenIntrinsics.h"
 #include "CodeGenTarget.h"
 #include "SequenceToOffsetTable.h"
+#include "TableGenBackends.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/TableGen/Error.h"
 #include "llvm/TableGen/Record.h"
@@ -476,11 +477,13 @@
   OS << "#endif\n\n";  // End of GET_INTRINSIC_GENERATOR_GLOBAL
 }

+namespace {
 enum ModRefKind {
   MRK_none,
   MRK_readonly,
   MRK_readnone
 };
+}

 static ModRefKind getModRefKind(const CodeGenIntrinsic &intrinsic) {
   switch (intrinsic.ModRef) {
@@ -787,10 +790,6 @@
   OS << "#endif\n\n";
 }

-namespace llvm {
-
-void EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly = false) {
+void llvm::EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly) {
   IntrinsicEmitter(RK, TargetOnly).run(OS);
 }
-
-} // End llvm namespace


SubtargetEmitter fix

SubtargetEmitter fix

Don't output data if we are supposed to ignore the record.

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

--- utils/TableGen/SubtargetEmitter.cpp
+++ utils/TableGen/SubtargetEmitter.cpp
@@ -1340,11 +1340,11 @@
         for (std::vector<CodeGenSchedTransition>::const_iterator
                TI = SC.Transitions.begin(), TE = SC.Transitions.end();
              TI != TE; ++TI) {
-          OS << "      if (";
           if (*PI != 0 && !std::count(TI->ProcIndices.begin(),
                                       TI->ProcIndices.end(), *PI)) {
               continue;
           }
+          OS << "      if (";
           for (RecIter RI = TI->PredTerm.begin(), RE = TI->PredTerm.end();
                RI != RE; ++RI) {
             if (RI != TI->PredTerm.begin())


update: spi_io typedef

update: spi_io typedef

--- MAX7219_sample/main.cpp
+++ MAX7219_sample/main.cpp
@@ -10,7 +10,7 @@
 				https://github.com/hirakuni45/R8C/blob/master/LICENSE
 */
 //=====================================================================//
-#include <cstring>
+#include <cstdint>
 #include "common/vect.h"
 #include "system.hpp"
 #include "clock.hpp"
@@ -37,7 +37,7 @@
 	typedef device::PORT<device::PORT1, device::bitpos::B0> SPI_SDA;
 	typedef device::PORT<device::PORT1, device::bitpos::B2> SPI_SCL;

-	typedef device::spi_io<SPI_SCL, SPI_SDA, device::NULL_PORT> SPI;
+	typedef device::spi_io<device::NULL_PORT, SPI_SDA, SPI_SCL, device::soft_spi_mode::CK10> SPI;
 	SPI spi_;

 	typedef device::PORT<device::PORT1, device::bitpos::B1> SELECT;


fix shifts.

fix shifts.

--- libcpu/cpu_generic.cpp
+++ libcpu/cpu_generic.cpp
@@ -173,7 +173,7 @@
 	Value *shift = AND(addr,CONST(3));
 	if (!cpu->is_little_endian)
 		shift = XOR(shift, CONST(3));
-	return SHL(CONST(3), shift);
+	return SHL(shift, CONST(3));
 }

 static Value *
@@ -182,7 +182,7 @@
 	Value *shift = AND(addr,CONST(1));
 	if (!cpu->is_little_endian)
 		shift = XOR(shift, CONST(1));
-	return SHL(CONST(4), shift);
+	return SHL(shift, CONST(4));
 }

 Value *


print testing in join

print testing in join

--- client.cpp
+++ client.cpp
@@ -172,6 +172,9 @@

 // Sends join requests to the server.
 int SendJoin(const char *channel) {
+
+  std::cout << "join channel: " << channel << std::endl;
+
   struct request_join join;
   memset((char *) &join, 0, sizeof(join));
   join.req_type = REQ_JOIN;
@@ -184,6 +187,10 @@
   }

   channels.push_back((char *) channel);
+
+  for (auto c : channels) {
+    std::cout << "channel in channels: " << c << std::endl;
+  }

   return 0;
 }


fixed single stepping

fixed single stepping

--- libcpu/libcpu_main.cpp
+++ libcpu/libcpu_main.cpp
@@ -283,7 +283,7 @@
 {
 	// find all instructions that need labels and create basic blocks for them
 	int bbs = 0;
-	addr_t pc, bytes;
+	addr_t pc;
 	pc = cpu->code_start;
 	while (pc < cpu->code_end) {
 		//printf("%04X: %d\n", pc, get_tag(cpu, pc));
@@ -407,7 +407,6 @@
 static BasicBlock *
 cpu_recompile_singlestep(cpu_t *cpu, BasicBlock *bb_ret, BasicBlock *bb_trap)
 {
-	int bytes;
 	addr_t new_pc;
 	tag_t tag;
 	BasicBlock *cur_bb = NULL, *bb_target = NULL, *bb_next = NULL;
@@ -419,14 +418,13 @@

 	disasm_instr(cpu, pc);

-	if (!(cpu->flags & CPU_FLAG_QUIET)) printf("%s:%d\n", __func__, __LINE__);
-
+	//XXX this is duplicated a little too often
 	next_pc = pc + cpu->f.tag_instr(cpu, pc, &tag, &new_pc);
 	if (tag & TAG_DELAY_SLOT)		/* skip delay slot */
 		next_pc += cpu->f.tag_instr(cpu, next_pc, &dummy1, &dummy2);

 	/* get target basic block */
-	if (new_pc == NEW_PC_NONE) /* recompile_instr() will set PC */
+	if ((tag & TAG_RET) || (new_pc == NEW_PC_NONE)) /* recompile_instr() will set PC */
 		bb_target = bb_ret;
 	else
 		bb_target = create_singlestep_return_basicblock(cpu, new_pc, bb_ret);
@@ -434,14 +432,13 @@
 	if (tag & TAG_CONDITIONAL)
 		bb_next = create_singlestep_return_basicblock(cpu, next_pc, bb_ret);

-//	recompile_instr(cpu, pc, tag, bb_target, bb_next, bb_trap, cur_bb);
+	recompile_instr(cpu, pc, tag, bb_target, bb_next, bb_trap, cur_bb);

 	/* If it's not a branch, append "store PC & return" to basic block */
 	if (tag & TAG_CONTINUE ) {
-		emit_store_pc_return(cpu, cur_bb, pc + bytes, bb_ret);
+		emit_store_pc_return(cpu, cur_bb, next_pc, bb_ret);
 	}
 	return cur_bb;
-//printf("%s:%d pc=%llx\n", __func__, __LINE__, pc);
 }

 static StructType *


client cast instead of memcpy for initial text_type read

--- client.cpp
+++ client.cpp
@@ -541,9 +541,8 @@
         ssize_t read_size = read(client_socket, receive_buffer, kBufferSize);

         if (read_size != 0) {
-          struct text message;
-          memcpy(&message, receive_buffer, sizeof(struct text));
-          text_t text_type = message.txt_type;
+          struct text *message = (struct text *) receive_buffer;
+          text_t text_type = message->txt_type;

           switch (text_type) {
             case TXT_SAY:


Changed semantics of JUMPDEST so that *the next* instruction is a jump destination

--- libevmjit/Compiler.cpp
+++ libevmjit/Compiler.cpp
@@ -91,9 +91,12 @@

 		case Instruction::JUMPDEST:
 		{
-			// A basic block starts here.
-			splitPoints.insert(currentPC);
-			indirectJumpTargets.push_back(currentPC);
+			// A basic block starts at the next instruction.
+			if (currentPC + 1 < bytecode.size())
+			{
+				splitPoints.insert(currentPC + 1);
+				indirectJumpTargets.push_back(currentPC + 1);
+			}
 			break;
 		}

@@ -653,8 +656,7 @@

 		case Instruction::JUMPDEST:
 		{
-			// Extra asserts just in case.
-			assert(currentPC == basicBlock.begin());
+			// Nothing to do
 			break;
 		}


This change is patched from http://codereview.chromium.org/276071 by randy.posynick@gmail.com

Don't overwrite email with lowercase value from GetUserInfo().

BUG=20848
TEST=See bug for description
TBR=brg@chromium.org

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

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


Possibly fix checksum verification

Possibly fix checksum verification


Fix a leak in newly added sync channel unit tests.

BUG=1334220

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


Remove dead WebKit Autofill code

Remove dead WebKit Autofill code

BUG=51644
TEST=none

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

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

--- chrome/renderer/autofill/autofill_agent.cc
+++ chrome/renderer/autofill/autofill_agent.cc
@@ -141,10 +141,6 @@
     string16 substring = value;
     substring = substring.substr(0, element.maxLength());
     element.setValue(substring, true);
-
-    WebFrame* webframe = node.document().frame();
-    if (webframe)
-      webframe->notifiyPasswordListenerOfAutocomplete(element);
   } else {
     // Fill the values for the whole form.
     FillAutofillFormData(node, unique_id, AUTOFILL_FILL);


shutdown write only

shutdown write only

--- libi2pd_client/SAM.cpp
+++ libi2pd_client/SAM.cpp
@@ -55,7 +55,7 @@
 		if (m_Socket.is_open ())
 		{
 			boost::system::error_code ec;
-			m_Socket.shutdown (boost::asio::ip::tcp::socket::shutdown_both, ec);
+			m_Socket.shutdown (boost::asio::ip::tcp::socket::shutdown_send, ec);
 			m_Socket.close ();
 		}
 		m_Owner.RemoveSocket(this);


Try fixing compilation issue

Try fixing compilation issue

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

--- keypoints/include/pcl/keypoints/impl/susan.hpp
+++ keypoints/include/pcl/keypoints/impl/susan.hpp
@@ -304,7 +304,7 @@

   const int surface_size = static_cast<int> (surface_->size ());
 #if defined (HAVE_OPENMP) && (!defined(_WIN32) || ((__GNUC__ > 4) && (__GNUC_MINOR__ > 2)))
-#pragma omp parallel for shared ((*response)) num_threads(threads_)
+#pragma omp parallel for shared (response) num_threads(threads_)
 #endif
   for (int point_index = 0; point_index < surface_size; ++point_index)
   {


Fix bad if path

Fix bad if path

--- libmemcached/string.cc
+++ libmemcached/string.cc
@@ -281,18 +281,20 @@
 {
   char* value= NULL;

-  if (memcached_string_length(self))
-  {
-    assert_msg(self, "Invalid memcached_string_st");
-    // If we fail at adding the null, we copy and move on
-    if (memcached_success(memcached_string_append_null(self)))
-    {
-      return memcached_string_c_copy(self);
-    }
-
-    value= self->string;
-
-    _init_string(self);
+  assert_msg(self, "Invalid memcached_string_st");
+  if (self)
+  {
+    if (memcached_string_length(self))
+    {
+      // If we fail at adding the null, we copy and move on
+      if (memcached_failed(memcached_string_append_null(self)))
+      {
+        return NULL;
+      }
+
+      value= self->string;
+      _init_string(self);
+    }
   }

   return value;


Fix matching in allocator.

Fix matching in allocator.

--- libpolyml/exporter.cpp
+++ libpolyml/exporter.cpp
@@ -474,7 +474,7 @@
         bool match = false;
         switch (naType)
         {
-        case NAWord: match = !space->isMutable && !space->byteOnly && !space->isCode;
+        case NAWord: match = !space->isMutable && !space->byteOnly && !space->isCode; break;
         case NAMutable: match = space->isMutable && !space->noOverwrite; break;
         case NANoOverwriteMutable: match = space->isMutable && space->noOverwrite; break;
         case NAByte: match = !space->isMutable && space->byteOnly; break;


When creating the clang::Type make sure to create an clang::ElaboratedType if the type is nested

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

--- cint/cling/lib/Interpreter/Interpreter.cpp
+++ cint/cling/lib/Interpreter/Interpreter.cpp
@@ -857,7 +857,13 @@
             case NestedNameSpecifier::TypeSpecWithTemplate: {
                 // Type name qualified with "template".
                 // Note: Do we need to check for a dependent type here?
-                *setResultType = NNS->getAsType();
+                NestedNameSpecifier *prefix = NNS->getPrefix();
+                if (prefix) {
+                   QualType temp = Context.getElaboratedType(ETK_None,prefix,QualType(NNS->getAsType(),0));
+                   *setResultType = temp.getTypePtr();
+                } else {
+                   *setResultType = NNS->getAsType();
+                }
                 const TagType* TagTy = (*setResultType)->getAs<TagType>();
                 if (TagTy) {
                   // It is a class, struct, or union.


Bail saving window placement if the function is called after WM_DESTROY (window_delegate_ is NULL).

http://crbug.com/6376

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

git-svn-id: http://src.chromium.org/svn/trunk/src@9099 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 079ffe9dea97b95e2b2660ded252ef26085214ae

--- chrome/views/window.cc
+++ chrome/views/window.cc
@@ -637,6 +637,13 @@
 }

 void Window::SaveWindowPosition() {
+  // The window delegate does the actual saving for us. It seems like (judging
+  // by go/crash) that in some circumstances we can end up here after
+  // WM_DESTROY, at which point the window delegate is likely gone. So just
+  // bail.
+  if (!window_delegate_)
+    return;
+
   WINDOWPLACEMENT win_placement = { 0 };
   win_placement.length = sizeof(WINDOWPLACEMENT);


comment

comment

--- lib/flow2/FlowParser.cpp
+++ lib/flow2/FlowParser.cpp
@@ -687,6 +687,7 @@
 	return nullptr; // TODO
 }

+// compoundStmt ::= '{' varDecl* stmt* '}'
 std::unique_ptr<Stmt> FlowParser::compoundStmt()
 {
 	FNTRACE();


[TRAFODION-2836] Enable Trafodion SQL processes to configure garbage collector
in its embedded JVM

Provided a way to configure the garbage collector when the JVM is created
in EsgynDB processes.

--- core/sql/executor/JavaObjectInterface.cpp
+++ core/sql/executor/JavaObjectInterface.cpp
@@ -26,13 +26,14 @@
 #include "Globals.h"
 #include "ComUser.h"
 #include "LmJavaOptions.h"
-
-// Changed the default to 256 to limit java heap size used by SQL processes.
-// Keep this define in sync with udrserv/udrserv.cpp
+#include "ex_ex.h"
+
 #define DEFAULT_JVM_MAX_HEAP_SIZE 256
 #define DEFAULT_COMPRESSED_CLASSSPACE_SIZE 128
 #define DEFAULT_MAX_METASPACE_SIZE 128
 #define TRAF_DEFAULT_JNIHANDLE_CAPACITY 32
+
+
 // ===========================================================================
 // ===== Class JavaObjectInterface
 // ===========================================================================
@@ -75,6 +76,8 @@
 //////////////////////////////////////////////////////////////////////////////
 JavaObjectInterface::~JavaObjectInterface()
 {
+  if (jenv_ == NULL)
+     return;
   if ((long)javaObj_ != -1)
      jenv_->DeleteGlobalRef(javaObj_);
   javaObj_ = NULL;
@@ -136,6 +139,7 @@
     {
       classPathArg = buildClassPath();
       jvm_options[numJVMOptions].optionString = classPathArg;
+      jvm_options[numJVMOptions].extraInfo = NULL;
       QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG, "Using classpath: %s",
                     jvm_options[numJVMOptions].optionString);
       numJVMOptions++;
@@ -145,7 +149,7 @@
     {
       int maxHeapEnvvarMB = DEFAULT_JVM_MAX_HEAP_SIZE;
       const char *maxHeapSizeStr = getenv("JVM_MAX_HEAP_SIZE_MB");
-      if (maxHeapSizeStr)
+      if (maxHeapSizeStr != NULL)
         {
           maxHeapEnvvarMB = atoi(maxHeapSizeStr);
           if (maxHeapEnvvarMB <= 0)
@@ -155,17 +159,30 @@
       snprintf(maxHeapOptions, sizeof(maxHeapOptions),
                "-Xmx%dm", maxHeapEnvvarMB);
       jvm_options[numJVMOptions].optionString = maxHeapOptions;
+      jvm_options[numJVMOptions].extraInfo = NULL;
       QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
                     "Max heap option: %s",
                     jvm_options[numJVMOptions].optionString);
       numJVMOptions++;
     }

+    const char *jvmGC = getenv("JVM_GC_OPTION");
+    if (jvmGC != NULL)
+    {
+       jvm_options[numJVMOptions].optionString = (char *)jvmGC;
+       jvm_options[numJVMOptions].extraInfo = NULL;
+       QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
+                   "GC Option: %s",
+                   jvm_options[numJVMOptions].optionString);
+       numJVMOptions++;
+    }
+
+
   if (!isDefinedInOptions(options, "-XX:CompressedClassSpaceSize="))
     {
       int compressedClassSpaceSize = 0;
       const char *compressedClassSpaceSizeStr = getenv("JVM_COMPRESSED_CLASS_SPACE_SIZE");
-      if (compressedClassSpaceSizeStr)
+      if (compressedClassSpaceSizeStr != NULL)
         compressedClassSpaceSize = atoi(compressedClassSpaceSizeStr);
       if (compressedClassSpaceSize <= 0)
         compressedClassSpaceSize = DEFAULT_COMPRESSED_CLASSSPACE_SIZE;
@@ -173,6 +190,7 @@
                sizeof(compressedClassSpaceSizeOptions),
                "-XX:CompressedClassSpaceSize=%dm", compressedClassSpaceSize);
       jvm_options[numJVMOptions].optionString = compressedClassSpaceSizeOptions;
+      jvm_options[numJVMOptions].extraInfo = NULL;
       QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
                     "CompressedClassSpaceSize: %s",
                     jvm_options[numJVMOptions].optionString);
@@ -183,13 +201,14 @@
     {
       int maxMetaspaceSize = 0;
       const char *maxMetaspaceSizeStr = getenv("JVM_MAX_METASPACE_SIZE");
-      if (maxMetaspaceSizeStr)
+      if (maxMetaspaceSizeStr != NULL)
         maxMetaspaceSize = atoi(maxMetaspaceSizeStr);
       if (maxMetaspaceSize <= 0)
         maxMetaspaceSize = DEFAULT_MAX_METASPACE_SIZE;
       snprintf(maxMetaspaceSizeOptions, sizeof(maxMetaspaceSizeOptions),
                "-XX:MaxMetaspaceSize=%dm", maxMetaspaceSize);
       jvm_options[numJVMOptions].optionString = maxMetaspaceSizeOptions;
+      jvm_options[numJVMOptions].extraInfo = NULL;
       QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
                     "MaxMetaspaceSize: %s",
                     jvm_options[numJVMOptions].optionString);
@@ -199,7 +218,7 @@
   if (!isDefinedInOptions(options, "-Xms"))
     {
       const char *initHeapSizeStr = getenv("JVM_INIT_HEAP_SIZE_MB");
-      if (initHeapSizeStr)
+      if (initHeapSizeStr != NULL)
         {
           const int initHeapEnvvarMB = atoi(initHeapSizeStr);
           if (initHeapEnvvarMB > 0)
@@ -207,6 +226,7 @@
               snprintf(initHeapOptions, sizeof(initHeapOptions),
                        "-Xms%dm", initHeapEnvvarMB);
               jvm_options[numJVMOptions].optionString = initHeapOptions;
+              jvm_options[numJVMOptions].extraInfo = NULL;
               QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
                             "Init heap option: %s",
                             jvm_options[numJVMOptions].optionString);
@@ -243,6 +263,7 @@
           else
             strcat(debugOptions, ",suspend=n");
           jvm_options[numJVMOptions].optionString = debugOptions;
+          jvm_options[numJVMOptions].extraInfo = NULL;
           QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_WARN,
                         "Debugging JVM with options: %s",
                         jvm_options[numJVMOptions].optionString);
@@ -253,6 +274,7 @@
   if (!isDefinedInOptions(options, oomOption))
     {
       jvm_options[numJVMOptions].optionString = (char *)oomOption;
+      jvm_options[numJVMOptions].extraInfo = NULL;
       numJVMOptions++;
     }

@@ -268,14 +290,18 @@
           strcat(oomDumpDir, mySqRoot);
           strcat(oomDumpDir, "/logs");
           jvm_options[numJVMOptions].optionString = (char *)oomDumpDir;
+          jvm_options[numJVMOptions].extraInfo = NULL;
           numJVMOptions++;
         }
     }
+
+  ex_assert((numJVMOptions < MAX_NO_JVM_OPTIONS), "Buffer overflow in JVM options");

   if (options)
     for (CollIndex o=0; o<options->entries(); o++)
       {
         jvm_options[numJVMOptions].optionString = (char *) options->getOption(o);
+        jvm_options[numJVMOptions].extraInfo = NULL;
         QRLogger::log(CAT_SQL_HDFS_JNI_TOP, LL_DEBUG,
                       "Option passed to JavaObjectInterface::createJVM(): %s",
                       jvm_options[numJVMOptions].optionString);


Handle optional pSizes parameter to vkCmdBindTransformFeedbackBuffersEXT

--- renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp
+++ renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp
@@ -4832,7 +4832,7 @@
           {
             m_RenderState.xfbbuffers[firstBinding + i].buf = GetResID(pBuffers[i]);
             m_RenderState.xfbbuffers[firstBinding + i].offs = pOffsets[i];
-            m_RenderState.xfbbuffers[firstBinding + i].size = pSizes[i];
+            m_RenderState.xfbbuffers[firstBinding + i].size = pSizes ? pSizes[i] : VK_WHOLE_SIZE;
           }
         }
       }


simplify tests

simplify tests

--- spec/can_recognize_ascii_tree_tokens.cpp
+++ spec/can_recognize_ascii_tree_tokens.cpp
@@ -131,7 +131,7 @@
 {
 	TEST_CLASS(can_recognize_ascii_tree_tokens)
 	{
-        void TokensShouldMatch_(std::initializer_list<token> expected, vector<token>& actual)
+        void tokens_should_match_(std::initializer_list<token> expected, vector<token>& actual)
         {
             auto mismatch_pair = std::mismatch(expected.begin(), expected.end(), actual.begin());

@@ -248,41 +248,20 @@

         TEST_METHOD(should_recognize_a_root_node_next_to_a_named_node)
         {
-            auto expected_tokens =
-            {
-                token { token::root_node, "" },
-                token { token::named_node, "a" }
-            };
-
             auto tokens = ascii_tree::tokenize("[*][a]");
-
-            TokensShouldMatch_(expected_tokens, tokens);
+            tokens_should_match_({ { token::root_node, "" }, { token::named_node, "a" } }, tokens);
         }

         TEST_METHOD(should_recognize_a_root_node_next_to_a_horizontal_edge)
         {
-            auto expected_tokens =
-            {
-                token { token::root_node, "" },
-                token { token::horizontal_edge, "a" }
-            };
-
             auto tokens = ascii_tree::tokenize("[*]-a-");
-
-            TokensShouldMatch_(expected_tokens, tokens);
+            tokens_should_match_({ { token::root_node, "" }, { token::horizontal_edge, "a" } }, tokens);
         }

         TEST_METHOD(should_recognize_a_horizontal_edge_next_to_a_named_node)
         {
-            auto expected_tokens =
-            {
-                token { token::horizontal_edge, "a" },
-                token { token::named_node, "b" }
-            };
-
             auto tokens = ascii_tree::tokenize("-a-[b]");
-
-            TokensShouldMatch_(expected_tokens, tokens);
+            tokens_should_match_({ { token::horizontal_edge, "a" }, { token::named_node, "b" } }, tokens);
         }

     };


in QueryBuilder::prepare_filter(), the "wordsNum" should be calculated based on the word type "IndexManager::FilterWordT".

--- source/core/search-manager/QueryBuilder.cpp
+++ source/core/search-manager/QueryBuilder.cpp
@@ -80,12 +80,15 @@
     }
     else
     {
-        unsigned int bitsNum = pIndexReader_->maxDoc() + 1;
-        unsigned int wordsNum = bitsNum/(sizeof(uint32_t) * 8) + (bitsNum % (sizeof(uint32_t) * 8) == 0 ? 0 : 1);
+        const unsigned int bitsNum = pIndexReader_->maxDoc() + 1;
+        const unsigned int wordBitNum = sizeof(IndexManager::FilterWordT) << 3;
+        const unsigned int wordsNum = (bitsNum - 1) / wordBitNum + 1;
+
         pFilterBitmap.reset(new IndexManager::FilterBitmapT);
         pFilterBitmap->addStreamOfEmptyWords(true, wordsNum);
         boost::shared_ptr<IndexManager::FilterBitmapT> pFilterBitmap2;
         boost::shared_ptr<IndexManager::FilterBitmapT> pFilterBitmap3;
+
         try
         {
             std::vector<QueryFiltering::FilteringType>::const_iterator iter = filtingList.begin();


- fixed bug with rendering on some machines (DX9)

--- rendersystems/DirectX/9/DirectX9_RenderSystem.cpp
+++ rendersystems/DirectX/9/DirectX9_RenderSystem.cpp
@@ -878,16 +878,19 @@
 			this->_setProjectionMatrix(this->projectionMatrix);
 			hlog::write(april::logTag, "Direct3D9 Device restored.");
 		}
-		else if (hr == D3DERR_WASSTILLDRAWING)
-		{
-			for_iter (i, 0, 100)
-			{
-				hr = this->d3dDevice->Present(NULL, NULL, NULL, NULL);
-				if (!FAILED(hr))
+		else
+		{
+			if (hr == D3DERR_WASSTILLDRAWING)
+			{
+				for_iter (i, 0, 100)
 				{
-					break;
+					hr = this->d3dDevice->Present(NULL, NULL, NULL, NULL);
+					if (!FAILED(hr))
+					{
+						break;
+					}
+					hthread::sleep(1.0f);
 				}
-				hthread::sleep(1.0f);
 			}
 			this->d3dDevice->BeginScene();
 		}


More emotes and edits

More emotes and edits

Dice emote, and changed `flipRes` to `rFlip` for consistency.

--- Projects/CoX/Servers/MapServer/MapInstance.cpp
+++ Projects/CoX/Servers/MapServer/MapInstance.cpp
@@ -747,9 +747,9 @@
         else if(lowerContents == "coin" || lowerContents == "cointoss"
                 || lowerContents == "flipcoin")                                 // Coin: Flips a coin, randomly displays heads or tails, and hold stance. Coin image remains until stance broken.
         {
-            int flipRes = rand() % 2;                                           // Randomly pick heads or tails.
+            int rFlip = rand() % 2;                                           // Randomly pick heads or tails.
             QString msg;
-            switch(flipRes)
+            switch(rFlip)
             {
                 case 0:                                                         // 0: Heads
                 {
@@ -809,6 +809,57 @@
                     break;
                 }
             }
+            qDebug() << msg;
+            info = new InfoMessageCmd(InfoType::DEBUG_INFO, msg);
+            src->addCommandToSendNextUpdate(std::unique_ptr<InfoMessageCmd>(info));
+        }
+        else if(lowerContents == "dice" || lowerContents == "rolldice")         // Dice: Picks up, shakes and rolls a die, randomly displays the results (1-6), default stance. Die image quickly fades.
+        {
+            int rDice = rand() % 6 + 1;                                         // Randomly pick a die result.
+            QString msg;
+            switch(rDice)
+            {
+                case 1:                                                         // 1: 1
+                {
+                    msg = "1: Unhandled \"1\" Dice emote";
+                    break;
+                }
+                case 2:                                                         // 2: 2
+                {
+                    msg = "2: Unhandled \"2\" Dice emote";
+                    break;
+                }
+                case 3:                                                         // 3: 3
+                {
+                    msg = "3: Unhandled \"3\" Dice emote";
+                    break;
+                }
+                case 4:                                                         // 4: 4
+                {
+                    msg = "4: Unhandled \"4\" Dice emote";
+                    break;
+                }
+                case 5:                                                         // 5: 5
+                {
+                    msg = "5: Unhandled \"5\" Dice emote";
+                    break;
+                }
+                case 6:                                                         // 6: 6
+                {
+                    msg = "6: Unhandled \"6\" Dice emote";
+                    break;
+                }
+            }
+            qDebug() << msg;
+            info = new InfoMessageCmd(InfoType::DEBUG_INFO, msg);
+            src->addCommandToSendNextUpdate(std::unique_ptr<InfoMessageCmd>(info));
+        }
+        else if(lowerContents == "dice1")                                       // Dice1: Picks up, shakes and rolls a die, displays a 1, default stance.
+        {
+            QString msg = "Unhandled Dice1 emote";
+            qDebug() << msg;
+            info = new InfoMessageCmd(InfoType::DEBUG_INFO, msg);
+            src->addCommandToSendNextUpdate(std::unique_ptr<InfoMessageCmd>(info));
         }
     }
 }


fix compilation error.

fix compilation error.

--- applications/dcc_decoder/targets/freertos.armv7m.ek-tm4c123gxl/HwInit.cxx
+++ applications/dcc_decoder/targets/freertos.armv7m.ek-tm4c123gxl/HwInit.cxx
@@ -61,6 +61,7 @@
 {
     typedef DummyPin DccPacketDelay;
     typedef DummyPin DccDecodeInterrupts;
+    typedef DummyPin DccPacketFinishedHook;
     typedef DummyPin CapTimerOverflow;
 };


Added #if statement for SRC612 build

Added #if statement for SRC612 build


fix regression test failure when compiled against latest V8 (3.17.11)

--- Source/Noesis.Javascript/JavascriptInterop.cpp
+++ Source/Noesis.Javascript/JavascriptInterop.cpp
@@ -201,6 +201,13 @@
 System::Object^
 JavascriptInterop::UnwrapObject(Handle<Value> iValue)
 {
+	 if (iValue->IsExternal())
+	{
+		Handle<External> external = Handle<External>::Cast(iValue);
+		JavascriptExternal* wrapper = (JavascriptExternal*) external->Value();
+		return wrapper->GetObject();
+	}
+
 	if (iValue->IsObject())
 	{
 		Handle<Object> object = iValue->ToObject();
@@ -211,12 +218,6 @@
 			JavascriptExternal* wrapper = (JavascriptExternal*) external->Value();
 			return wrapper->GetObject();
 		}
-	}
-	else if (iValue->IsExternal())
-	{
-		Handle<External> external = Handle<External>::Cast(iValue);
-		JavascriptExternal* wrapper = (JavascriptExternal*) external->Value();
-		return wrapper->GetObject();
 	}

 	return nullptr;


enable debug generation from main menu safely

--- Projects/Evilization/Evilization/GameState.cpp
+++ Projects/Evilization/Evilization/GameState.cpp
@@ -517,7 +517,8 @@

 void CGameState::EndCurrentGame()
 {
-	delete pCurrentMap;
+	if (pCurrentMap)
+		delete pCurrentMap;
 	pCurrentMap = NULL;
 	curSelCity = NULL;
 	curSelUnit = NULL;


vcl: check the OpenGL drawable as well as the context.

Change-Id: Idac493dfb3239f7ae5b5e49158d79c4f3e707509

--- vcl/source/opengl/OpenGLContext.cxx
+++ vcl/source/opengl/OpenGLContext.cxx
@@ -1137,7 +1137,8 @@
 void OpenGLContext::makeCurrent()
 {
 #if defined( WNT )
-    if (wglGetCurrentContext() == m_aGLWin.hRC)
+    if (wglGetCurrentContext() == m_aGLWin.hRC &&
+        wglGetCurrentDC() == m_aGLWin.hDC)
     {
         SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
     }
@@ -1151,11 +1152,13 @@
 #elif defined( IOS ) || defined( ANDROID )
     // nothing
 #elif defined( UNX )
-    if (glXGetCurrentContext() == m_aGLWin.ctx)
+    GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
+    if (glXGetCurrentContext() == m_aGLWin.ctx &&
+        glXGetCurrentDrawable() == nDrawable)
     {
         SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
     }
-    else if (!glXMakeCurrent( m_aGLWin.dpy, mbPixmap ? m_aGLWin.glPix : m_aGLWin.win, m_aGLWin.ctx ))
+    else if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
         SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed");
 #endif
 }


Cleanup compute_ideal_colors_and_weights

--- Source/astcenc_ideal_endpoints_and_weights.cpp
+++ Source/astcenc_ideal_endpoints_and_weights.cpp
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: Apache-2.0
 // ----------------------------------------------------------------------------
-// Copyright 2011-2021 Arm Limited
+// Copyright 2011-2022 Arm Limited
 //
 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
 // use this file except in compliance with the License. You may obtain a copy
@@ -54,8 +54,8 @@
 	float lowvalues[BLOCK_MAX_PARTITIONS] { 1e10f, 1e10f, 1e10f, 1e10f };
 	float highvalues[BLOCK_MAX_PARTITIONS] { -1e10f, -1e10f, -1e10f, -1e10f };

-	float partition_error_scale[BLOCK_MAX_PARTITIONS];
-	float linelengths_rcp[BLOCK_MAX_PARTITIONS];
+	float length_squared[BLOCK_MAX_PARTITIONS];
+	float scale[BLOCK_MAX_PARTITIONS];

 	const float *error_weights = nullptr;
 	const float* data_vr = nullptr;
@@ -96,36 +96,34 @@
 	vmask4 sep_mask = vint4::lane_id() == vint4(component);
 	for (int i = 0; i < partition_count; i++)
 	{
-		float diff = highvalues[i] - lowvalues[i];
-
-		if (diff < 0)
+		float length = highvalues[i] - lowvalues[i];
+		if (length < 0.0f)
 		{
 			lowvalues[i] = 0.0f;
 			highvalues[i] = 0.0f;
 		}

-		diff = astc::max(diff, 1e-7f);
-
-		partition_error_scale[i] = diff * diff;
-		linelengths_rcp[i] = 1.0f / diff;
+		length = astc::max(length, 1e-7f);
+		length_squared[i] = length * length;
+		scale[i] = 1.0f / length;

 		ei.ep.endpt0[i] = select(blk.data_min, vfloat4(lowvalues[i]), sep_mask);
 		ei.ep.endpt1[i] = select(blk.data_max, vfloat4(highvalues[i]), sep_mask);
 	}

 	bool is_constant_wes = true;
-	float constant_wes = partition_error_scale[pi.partition_of_texel[0]] * error_weights[0];
+	float constant_wes = length_squared[pi.partition_of_texel[0]] * error_weights[0];

 	for (int i = 0; i < texel_count; i++)
 	{
 		float value = data_vr[i];
 		int partition = pi.partition_of_texel[i];
 		value -= lowvalues[partition];
-		value *= linelengths_rcp[partition];
+		value *= scale[partition];
 		value = astc::clamp1f(value);

 		ei.weights[i] = value;
-		ei.weight_error_scale[i] = partition_error_scale[partition] * error_weights[i];
+		ei.weight_error_scale[i] = length_squared[partition] * error_weights[i];
 		assert(!astc::isnan(ei.weight_error_scale[i]));

 		is_constant_wes = is_constant_wes && ei.weight_error_scale[i] == constant_wes;
@@ -188,6 +186,7 @@
 	}
 	else // (component1 == 1 && component2 == 2)
 	{
+		assert(component1 == 1 && component2 == 2);
 		error_weights = ewb.texel_weight_gb;
 		data_vr = blk.data_g;
 		data_vg = blk.data_b;
@@ -242,7 +241,7 @@
 		if (length < 0.0f) // Case for when none of the texels had any weight
 		{
 			lowparam[i] = 0.0f;
-			highparam[i] = 1e-7f;
+			highparam[i] = 0.0f;
 		}

 		// It is possible for a uniform-color partition to produce length=0; this causes NaN issues
@@ -403,7 +402,7 @@
 	for (unsigned int i = 0; i < partition_count; i++)
 	{
 		float length = highparam[i] - lowparam[i];
-		if (length < 0)			// Case for when none of the texels had any weight
+		if (length < 0.0f) // Case for when none of the texels had any weight
 		{
 			lowparam[i] = 0.0f;
 			highparam[i] = 1e-7f;
@@ -412,7 +411,6 @@
 		// It is possible for a uniform-color partition to produce length=0; this causes NaN issues
 		// so set to a small value to avoid this problem.
 		length = astc::max(length, 1e-7f);
-
 		length_squared[i] = length * length;
 		scale[i] = 1.0f / length;

@@ -548,16 +546,15 @@
 	for (int i = 0; i < partition_count; i++)
 	{
 		float length = highparam[i] - lowparam[i];
-		if (length < 0)
+		if (length < 0.0f) // Case for when none of the texels had any weight
 		{
 			lowparam[i] = 0.0f;
-			highparam[i] = 1e-7f;
+			highparam[i] = 0.0f;
 		}

 		// It is possible for a uniform-color partition to produce length=0; this causes NaN issues
 		// so set to a small value to avoid this problem.
 		length = astc::max(length, 1e-7f);
-
 		length_squared[i] = length * length;
 		scale[i] = 1.0f / length;