This should fix the UnstructuredGridPieces test.

--- Parallel/vtkExtractUnstructuredGridPiece.cxx
+++ Parallel/vtkExtractUnstructuredGridPiece.cxx
@@ -28,7 +28,7 @@
 #include "vtkUnsignedCharArray.h"
 #include "vtkUnstructuredGrid.h"

-vtkCxxRevisionMacro(vtkExtractUnstructuredGridPiece, "1.12");
+vtkCxxRevisionMacro(vtkExtractUnstructuredGridPiece, "1.13");
 vtkStandardNewMacro(vtkExtractUnstructuredGridPiece);

 vtkExtractUnstructuredGridPiece::vtkExtractUnstructuredGridPiece()
@@ -152,7 +152,7 @@
   if (ghostLevel > 0 && this->CreateGhostCells)
     {
     cellGhostLevels = vtkUnsignedCharArray::New();
-    cellGhostLevels->SetNumberOfTuples(numCells);
+    cellGhostLevels->Allocate(numCells);
     // We may want to create point ghost levels even
     // if there are no ghost cells.  Since it cost extra,
     // and no filter really uses it, and the filter did not
@@ -161,7 +161,7 @@
     pointOwnership = vtkIdList::New();
     pointOwnership->Allocate(numPts);
     pointGhostLevels = vtkUnsignedCharArray::New();
-    pointGhostLevels->SetNumberOfTuples(numPts);
+    pointGhostLevels->Allocate(numPts);
     }

   // Break up cells based on which piece they belong to.


Test updates

Test updates

--- aws-cpp-sdk-ec2-integration-tests/EC2Tests.cpp
+++ aws-cpp-sdk-ec2-integration-tests/EC2Tests.cpp
@@ -75,6 +75,7 @@
         ASSERT_TRUE(createOutcome.IsSuccess());

         m_vpcId = createOutcome.GetResult().GetVpc().GetVpcId();
+        WaitOnVpcState(m_vpcId, ObjectState::Ready);

         DeleteSecurityGroup(SECURITY_GROUP_NAME);
     }
@@ -110,6 +111,10 @@
                 const Aws::Vector< Aws::EC2::Model::SecurityGroup >& groups = describeOutcome.GetResult().GetSecurityGroups();
                 bool exists = std::find_if(groups.cbegin(), groups.cend(), [](const Aws::EC2::Model::SecurityGroup& group){ return group.GetGroupName() == SECURITY_GROUP_NAME; }) != groups.cend();
                 finished = (objectState == ObjectState::Nonexistent && !exists) || (objectState == ObjectState::Ready && exists);
+            }
+            else if (describeOutcome.GetError().GetErrorType() == Aws::EC2::EC2Errors::INVALID_GROUP__NOT_FOUND)
+            {
+                finished = objectState == ObjectState::Nonexistent;
             }

             if (!finished)
@@ -145,6 +150,10 @@
                 bool exists = std::find_if(vpcs.cbegin(), vpcs.cend(), [vpcId](const Aws::EC2::Model::Vpc& vpc){ return vpc.GetVpcId() == vpcId; }) != vpcs.cend();
                 finished = (objectState == ObjectState::Nonexistent && !exists) || (objectState == ObjectState::Ready && exists);
             }
+            else if (describeOutcome.GetError().GetErrorType() == Aws::EC2::EC2Errors::INVALID_VPC_I_D__NOT_FOUND)
+            {
+                finished = objectState == ObjectState::Nonexistent;
+            }

             if (!finished)
             {


remove no long needed platform specific includes

--- src/cinder/app/App.cpp
+++ src/cinder/app/App.cpp
@@ -34,20 +34,6 @@
 #include "cinder/Thread.h"
 #include "cinder/Log.h"

-#if defined( CINDER_COCOA )
-	#if defined( CINDER_MAC )
-		#import "cinder/app/CinderView.h"
-		#import <Cocoa/Cocoa.h>
-	#endif
-	#include "cinder/cocoa/CinderCocoa.h"
-#elif defined( CINDER_WINRT )
-	#include "cinder/app/AppImplWinRT.h"
-	#include <thread>
-	#include <filesystem>
-#elif defined( CINDER_MSW )
-	#include "cinder/app/AppImplMsw.h"
-#endif
-
 using namespace std;

 namespace cinder { namespace app {


IRC is enabled by default

IRC is enabled by default

git-svn-id: 0634bf30b6d7a21f2003d4a9f34c102a3ffa6fda@4650 34602234-ff1f-0410-a465-ea8f3b77ab7f

--- src/client/Options.cpp
+++ src/client/Options.cpp
@@ -174,7 +174,7 @@
 		( tLXOptions->sHttpProxy, "Network.HttpProxy", "" )
 		( tLXOptions->bAutoSetupHttpProxy, "Network.AutoSetupHttpProxy", true )

-		( tLXOptions->bEnableChat, "Network.EnableChat", false ) // That's a shame that such marvellous feature is disabled by default :P
+		( tLXOptions->bEnableChat, "Network.EnableChat", true )
 		( tLXOptions->sServerName, "Network.ServerName", "OpenLieroX Server" )
 		( tLXOptions->sWelcomeMessage, "Network.WelcomeMessage", "Welcome to <server>, <player>" )
 		( tLXOptions->sServerPassword, "Network.Password" )


Remove FIXME on CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE

Nothing to do there really.

Signed-off-by: Kévin Petit <7be082ac62c87f3fb90b426eef925ff08291362b@free.fr>

--- src/api.cpp
+++ src/api.cpp
@@ -435,7 +435,7 @@
         size_ret = sizeof(val_uint);
         break;
     case CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE:
-        val_uint = 128; // FIXME do better?
+        val_uint = 128; // Alignment in bytes of long16
         copy_ptr = &val_uint, size_ret = sizeof(val_uint);
         break;
     case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:


Refactoring FLAC streamer

Refactoring FLAC streamer

--- src/slim/flac/Encoder.hpp
+++ src/slim/flac/Encoder.hpp
@@ -42,19 +42,19 @@
 					}

 					// setting maximum possible compression level
-					if (set_compression_level(8))
+					if (!set_compression_level(8))
 					{
 						throw Exception("Could not set compression level");
 					}

 					// setting amount of channels
-					if (set_channels(channels))
+					if (!set_channels(channels))
 					{
 						throw Exception("Could not set amount of channels");
 					}

 					// setting sampling rate
-					if (set_sample_rate(sampleRate))
+					if (!set_sample_rate(sampleRate))
 					{
 						throw Exception("Could not set sampling rate");
 					}
@@ -70,13 +70,13 @@
 					}

 					// setting sampling rate
-					if (set_bits_per_sample(b))
+					if (!set_bits_per_sample(b))
 					{
 						throw Exception("Could not set bits per sample");
 					}

 					// choosing big enough number of expected samples for streaming purpose
-					if (set_total_samples_estimate(0xFFFFFFFF))
+					if (!set_total_samples_estimate(0xFFFFFFFF))
 					{
 						throw Exception("Could not set estimated amount of samples");
 					}


bug fix: numBase->getMinInclusive()->toString()

git-svn-id: 3ec853389310512053d525963cab269c063bb453@172885 13f79535-47bb-0310-9956-ffa450edef68

--- src/validators/datatype/DecimalDatatypeValidator.cpp
+++ src/validators/datatype/DecimalDatatypeValidator.cpp
@@ -56,6 +56,9 @@

 /*
  * $Log$
+ * Revision 1.11  2001/07/17 21:30:12  peiyongz
+ * bug fix: numBase->getMinInclusive()->toString()
+ *
  * Revision 1.10  2001/06/20 17:56:32  peiyongz
  * support for "fixed" option on constrainning facets
  *
@@ -529,7 +532,7 @@
                         {
                             XMLCh* value1 = getMaxExclusive()->toString();
                             ArrayJanitor<XMLCh> jan1(value1);
-                            XMLCh* value2 = numBase->getMinExclusive()->toString();
+                            XMLCh* value2 = numBase->getMinInclusive()->toString();
                             ArrayJanitor<XMLCh> jan2(value2);
                             ThrowXML2(InvalidDatatypeFacetException
                                 , XMLExcepts::FACET_maxExcl_base_minExcl


fixed usage

fixed usage

--- src/app.cpp
+++ src/app.cpp
@@ -44,12 +44,20 @@
 "Note that decimal integers are casted to 'double' and 'bool'\n"
 "in the natural way, e.g., '1' is interpreted as 'true'.\n"
 "\n"
-"Then '<input>' is a (compressed) DIMACS file and '<output>'\n"
-"is a file to store the DRAT proof.  If no '<proof>' file is\n"
-"specified, then no proof is generated.  If no '<input>' is given\n"
-"then '<stdin>' is used. If '-' is used as '<input>' then the\n"
-"solver reads from '<stdin>'.  If '-' is specified for '<proof>'\n"
-"then the proof is generated and printed to '<stdout>'.\n",
+"Then '<input>' has to be a DIMACS file and in '<output>' a DRAT\n"
+"proof is saved.  If no '<proof>' file is specified, then no proof\n"
+"is generated.  If no '<input>' is given then '<stdin>' is used.\n"
+"If '-' is used as '<input>' then the solver reads from '<stdin>'.\n"
+"If '-' is specified for '<proof> then a proof is generated and\n"
+"printed to '<stdout>'.  The proof is by default stored in binary\n"
+"format unless '--binary=0' or the proof is written to '<stdout>'\n"
+"and '<stdout>' is connected to a terminal.\n"
+"\n"
+"The input is assumed to be compressed if it is given explicitly\n"
+"and has a '.gz', '.bz2' or '.7z' suffix.  The same applies to the\n"
+"output file.  For decompression helper commands 'gunzip', 'bzcat'\n"
+"and '7z' are needed, and for proof compression
+"and '7z' have to be in the path and are used through opening a pipe.\n",
   stdout);
 }


Add include guard

Add include guard

--- src/app.hpp
+++ src/app.hpp
@@ -1,3 +1,6 @@
+#ifndef __APP_HPP__
+#define __APP_HPP__
+
 #include <vector>
 #include <string>
 #include "util/winpath.hpp"
@@ -64,3 +67,5 @@
 };

 }
+
+#endif


Use new API for Baryon (step 2)

Use new API for Baryon (step 2)

--- benchmarks/tensors/baryon/baryon_generator.cpp
+++ benchmarks/tensors/baryon/baryon_generator.cpp
@@ -25,16 +25,16 @@
     tiramisu::function function0(name);
     global::set_implicit_function(&function0);

-    tiramisu::constant N_CONST("N", tiramisu::expr((int32_t) size), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant BT_CONST("BT", tiramisu::expr((int32_t) BT), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant a1("a1", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant a2("a2", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant a3("a3", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant xp0("xp0", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant KMAX("KMAX", tiramisu::expr((int32_t) BK), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant b0("b0", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant b1("b1", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
-    tiramisu::constant b2("b2", tiramisu::expr((int32_t) 0), p_int32, true, NULL, 0, &function0);
+    tiramisu::constant N_CONST("N", tiramisu::expr((int32_t) size));
+    tiramisu::constant BT_CONST("BT", tiramisu::expr((int32_t) BT));
+    tiramisu::constant a1("a1", tiramisu::expr((int32_t) 0));
+    tiramisu::constant a2("a2", tiramisu::expr((int32_t) 0));
+    tiramisu::constant a3("a3", tiramisu::expr((int32_t) 0));
+    tiramisu::constant xp0("xp0", tiramisu::expr((int32_t) 0));
+    tiramisu::constant KMAX("KMAX", tiramisu::expr((int32_t) BK));
+    tiramisu::constant b0("b0", tiramisu::expr((int32_t) 0));
+    tiramisu::constant b1("b1", tiramisu::expr((int32_t) 0));
+    tiramisu::constant b2("b2", tiramisu::expr((int32_t) 0));

     tiramisu::var i3("i3"), i2("i2"), i1("i1"), k("k", 1, KMAX), t("t");
     tiramisu::input fc1("fc1", {k}, p_int32);


Relaxes line rasterization tolerances

Relaxes line rasterization tolerances

Components: Framework
VK-GL-CTS Issue: 2033

Affects:
dEQP-VK.rasterization.*

Change-Id: Ib41552b1bb6d9aa2b25d0cbc6f02d51ce997f4e3

--- framework/common/tcuRasterizationVerifier.cpp
+++ framework/common/tcuRasterizationVerifier.cpp
@@ -2103,7 +2103,7 @@
 	typedef tcu::Vector<deInt64, 2> I64Vec2;

 	const deUint64		numSubPixels						= ((deUint64)1) << subpixelBits;
-	const deUint64		pixelHitBoxSize						= (multisample) ? (numSubPixels) : (2+2);	//!< allow 4 central (2x2) for non-multisample pixels. Rounding may move edges 1 subpixel to any direction.
+	const deUint64		pixelHitBoxSize						= (multisample) ? (numSubPixels) : 5;		//!< 5 = ceil(6 * sqrt(2) / 2) to account for a 3 subpixel fuzz around pixel center
 	const bool			order								= isTriangleClockwise(p0, p1, p2);			//!< clockwise / counter-clockwise
 	const tcu::Vec4&	orderedP0							= p0;										//!< vertices of a clockwise triangle
 	const tcu::Vec4&	orderedP1							= (order) ? (p1) : (p2);
@@ -2137,12 +2137,13 @@

 	// Broad triangle - pixel area intersection
 	{
-		const I64Vec2 pixelCenterPosition = I64Vec2(pixel.x(), pixel.y()) * I64Vec2(numSubPixels, numSubPixels) + I64Vec2(numSubPixels / 2, numSubPixels / 2);
-		const I64Vec2 triangleSubPixelSpaceRound[3] =
-		{
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
+		const DVec2 pixelCenterPosition			=	DVec2((double)pixel.x(), (double)pixel.y()) * DVec2((double)numSubPixels, (double)numSubPixels) +
+													DVec2((double)numSubPixels / 2, (double)numSubPixels / 2);
+		const DVec2 triangleSubPixelSpace[3]	=
+		{
+			DVec2(triangleScreenSpace[0].x() * (double)numSubPixels, triangleScreenSpace[0].y() * (double)numSubPixels),
+			DVec2(triangleScreenSpace[1].x() * (double)numSubPixels, triangleScreenSpace[1].y() * (double)numSubPixels),
+			DVec2(triangleScreenSpace[2].x() * (double)numSubPixels, triangleScreenSpace[2].y() * (double)numSubPixels),
 		};

 		// Check (using cross product) if pixel center is
@@ -2152,10 +2153,10 @@
 		for (int vtxNdx = 0; vtxNdx < 3; ++vtxNdx)
 		{
 			const int		otherVtxNdx				= (vtxNdx + 1) % 3;
-			const deInt64	maxPixelDistanceSquared	= pixelHitBoxSize*pixelHitBoxSize; // Max distance from the pixel center from within the pixel is (sqrt(2) * boxWidth/2). Use 2x value for rounding tolerance
-			const I64Vec2	edge					= triangleSubPixelSpaceRound[otherVtxNdx]	- triangleSubPixelSpaceRound[vtxNdx];
-			const I64Vec2	v						= pixelCenterPosition						- triangleSubPixelSpaceRound[vtxNdx];
-			const deInt64	crossProduct			= (edge.x() * v.y() - edge.y() * v.x());
+			const double	maxPixelDistanceSquared	= (double)(pixelHitBoxSize * pixelHitBoxSize); // Max distance from the pixel center from within the pixel is (sqrt(2) * boxWidth/2). Use 2x value for rounding tolerance
+			const DVec2		edge					= triangleSubPixelSpace[otherVtxNdx]	- triangleSubPixelSpace[vtxNdx];
+			const DVec2		v						= pixelCenterPosition					- triangleSubPixelSpace[vtxNdx];
+			const double	crossProduct			= (edge.x() * v.y() - edge.y() * v.x());

 			// distance from edge: (edge x v) / |edge|
 			//     (edge x v) / |edge| > maxPixelDistance
@@ -2181,12 +2182,14 @@
 			I64Vec2((pixel.x()+1) * numSubPixels, (pixel.y()+1) * numSubPixels),
 			I64Vec2((pixel.x()+0) * numSubPixels, (pixel.y()+1) * numSubPixels),
 		};
+
+		// 3 subpixel tolerance around pixel center to account for accumulated errors during various line rasterization methods
 		const I64Vec2 pixelCenterCorners[4] =
 		{
-			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 0, pixel.y() * numSubPixels + numSubPixels/2 + 0),
-			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 1, pixel.y() * numSubPixels + numSubPixels/2 + 0),
-			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 1, pixel.y() * numSubPixels + numSubPixels/2 + 1),
-			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 0, pixel.y() * numSubPixels + numSubPixels/2 + 1),
+			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 - 3, pixel.y() * numSubPixels + numSubPixels/2 - 3),
+			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 3, pixel.y() * numSubPixels + numSubPixels/2 - 3),
+			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 + 3, pixel.y() * numSubPixels + numSubPixels/2 + 3),
+			I64Vec2(pixel.x() * numSubPixels + numSubPixels/2 - 3, pixel.y() * numSubPixels + numSubPixels/2 + 3),
 		};

 		// both rounding directions


Fix printHelp function

Fix printHelp function

Summary: The printHelp function was not printing the correct loss function for the supervised setting

Reviewed By: ajoulin

Differential Revision: D3915973

fbshipit-source-id: df4efb750387eb57cc65887610c2596b2fb02646

--- src/args.cc
+++ src/args.cc
@@ -123,6 +123,9 @@
 }

 void Args::printHelp() {
+  std::string lname = "ns";
+  if (loss == loss_name::hs) lname = "hs";
+  if (loss == loss_name::softmax) lname = "softmax";
   std::cout
     << "\n"
     << "The following arguments are mandatory:\n"
@@ -137,7 +140,7 @@
     << "  -minCount     minimal number of word occurences [" << minCount << "]\n"
     << "  -neg          number of negatives sampled [" << neg << "]\n"
     << "  -wordNgrams   max length of word ngram [" << wordNgrams << "]\n"
-    << "  -loss         loss function {ns, hs, softmax} [ns]\n"
+    << "  -loss         loss function {ns, hs, softmax} [" << lname << "]\n"
     << "  -bucket       number of buckets [" << bucket << "]\n"
     << "  -minn         min length of char ngram [" << minn << "]\n"
     << "  -maxn         max length of char ngram [" << maxn << "]\n"


ARM VFP multiplication testing.

ARM VFP multiplication testing.

--- src/arm.cpp
+++ src/arm.cpp
@@ -1002,6 +1002,20 @@
   }
 }

+void floatMultiplyR(Context* con, unsigned size, Assembler::Register* a, Assembler::Register* b, Assembler::Register* t) {
+  if (size == 8) {
+    emit(con, fmdrr(0, a->low, a->high));
+    emit(con, fmdrr(1, b->low, b->high));
+    emit(con, fmuld(0, 0, 1));
+    emit(con, fmrrd(t->low, t->high, 0));
+  } else {
+    emit(con, fmsr(0, a->low));
+    emit(con, fmsr(1, b->low));
+    emit(con, fmuls(0, 0, 1));
+    emit(con, fmrs(t->low, 0));
+  }
+}
+
 int
 normalize(Context* c, int offset, int index, unsigned scale,
           bool* preserveIndex, bool* release)
@@ -1807,6 +1821,8 @@

   to[index(c, Multiply, R)] = CAST3(multiplyR);

+  to[index(c, FloatMultiply, R)] = CAST3(floatMultiplyR);
+
   to[index(c, ShiftLeft, R)] = CAST3(shiftLeftR);
   to[index(c, ShiftLeft, C)] = CAST3(shiftLeftC);

@@ -2137,6 +2153,7 @@
     case Or:
     case Xor:
     case Multiply:
+    case FloatMultiply:
       *aTypeMask = *bTypeMask = (1 << RegisterOperand);
       break;

@@ -2144,7 +2161,6 @@
     case Remainder:
     case FloatAdd:
     case FloatSubtract:
-    case FloatMultiply:
     case FloatDivide:
     case FloatRemainder:
     case JumpIfFloatEqual:


Resolved CID 351862 (#1 of 1): Dereference before null check

check_after_deref: Null-checking this->_player suggests that it may be null, but it has already been dereferenced on all paths leading to the check

--- src/world/Server/Packets/Handlers/AuctionHandler.cpp
+++ src/world/Server/Packets/Handlers/AuctionHandler.cpp
@@ -231,7 +231,7 @@

     const auto auctionHouse = creature->auctionHouse;
     const auto auction = auctionHouse->GetAuction(srlPacket.auctionId);
-    if (auction == nullptr || !auction->Owner || _player == nullptr)
+    if (auction == nullptr || !auction->Owner)
     {
         SendPacket(SmsgAuctionCommandResult(0, AUCTION_BID, AUCTION_ERROR_INTERNAL, 0).serialise().get());
         return;


style fix. the header for .cc has to be the 1st include.

BUG=none
TEST=none

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

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

--- views/controls/combobox/native_combobox_gtk.cc
+++ views/controls/combobox/native_combobox_gtk.cc
@@ -2,9 +2,9 @@
 // source code is governed by a BSD-style license that can be found in the
 // LICENSE file.

+#include "views/controls/combobox/native_combobox_gtk.h"
+
 #include <gtk/gtk.h>
-
-#include "views/controls/combobox/native_combobox_gtk.h"

 #include "app/combobox_model.h"
 #include "base/logging.h"


Adding comments and improving print functions in ast.cpp

--- src/ast.cpp
+++ src/ast.cpp
@@ -11,7 +11,9 @@
 #include "parser.h"

 /**
-   Overload for the == operator to allow for simple comparison of two NIdentifiers
+   Overload for the == operator to allow for simple comparison of two NIdentifiers.
+   The NIdentifier values being compared are of type string, which represent the names of
+   variables, lists, structs, struct members, etc.

    @param i1 First NIdentifier to compare
    @param i2 Second NIdentifier to compare
@@ -35,17 +37,39 @@
   return os;
 }

+/**
+   Print function for NBlock objects in the AST. Each block is composed of a vector of
+   statements. This function iterators over the typedef std::vector<NStatement*> StatementList,
+   printing each each statement in a given block, and returning the output stream.
+
+   @param os Output stream to print to
+   @return Output stream passed in
+*/
 std::ostream & NBlock::print(std::ostream & os) const
 {
     os << "Block: {" << std::endl;
-    for (int i = 0; i < statements.size(); i++)
-    {
-      os << *(statements[i]) << std::endl;
-    }
+
+    for (StatementList::const_iterator it = statements.begin(); it != statements.end(); ++it)
+      os << *(*it) << std::endl;
+
     os << "}" << std::endl;
     return os;
 }

+/**
+   Print function for NVariableDeclaration objects. There are three members of the
+   NVariableDeclaration object that are printed:
+
+   1) Type
+   2) NIdentifier (Variable name)
+   3) Associated value or RHS (optional)
+
+   The initializationExpression is the RHS in variable assignments (e.g. the 4 in int a = 4).
+   If initializationExpression is NULL, then the no value was assigned to variable (e.g. int a).
+
+   @param os Output stream to print to
+   @return Output stream passed in
+*/
 std::ostream & NVariableDeclaration::print(std::ostream & os) const
 {
   if (!type.isList)
@@ -64,14 +88,23 @@
   return os;
 }

+/**
+   Print function for NFunctionDeclaration objects. It first prints the return type
+   and name of the function followed by the arguments contained within the
+   typedef std::vector<NVariableDeclaration *> VariableList. Then, the NBlock body
+   of the function is printed.
+
+   @param os Output stream to print to
+   @return Output stream passed in
+*/
 std::ostream & NFunctionDeclaration::print(std::ostream & os) const
 {
   os << "Function declared --- (" << type << " " << ident << "(";
-  for (int i = 0; i < variables.size(); i++)
-    {
-      os << *(variables[i]) << " ";
-    }
-  os << ") " << *body << ")";
+
+  for (VariableList::const_iterator it = variables.begin(); it != variables.end(); ++it)
+      os << *(*it) << ") ";
+
+  os << *body << ")";
   os << std::endl;

   return os;


removing some warnings from agrad/matrix.hpp

--- src/stan/agrad/matrix.hpp
+++ src/stan/agrad/matrix.hpp
@@ -8,7 +8,7 @@

 namespace stan {
   namespace agrad {
-
+    typedef typename Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic>::size_type size_type;

     void fill(var& x, const var& y) {
       x = y;
@@ -757,8 +757,7 @@
                         const Eigen::Matrix<var, R2, C2>& v2) {
       stan::math::validate_matching_sizes(v1,v2,"columns_dot_product");
       Eigen::Matrix<var, 1, C1> ret(1,v1.cols());
-      size_t j;
-      for (j = 0; j < v1.cols(); ++j) {
+      for (size_type j = 0; j < v1.cols(); ++j) {
         ret(j) = var(new dot_product_vv_vari(v1.col(j),v2.col(j)));
       }
       return ret;
@@ -783,8 +782,7 @@
                         const Eigen::Matrix<var, R2, C2>& v2) {
       stan::math::validate_matching_sizes(v1,v2,"columns_dot_product");
       Eigen::Matrix<var, 1, C1> ret(1,v1.cols());
-      size_t j;
-      for (j = 0; j < v1.cols(); ++j) {
+      for (size_type j = 0; j < v1.cols(); ++j) {
         ret(j) = var(new dot_product_vd_vari(v2.col(j),v1.col(j)));
       }
       return ret;
@@ -943,17 +941,15 @@
         _variRefA(A.rows(),A.cols()), _variRefB(B.rows(),B.cols()),
         _variRefC(B.rows(),B.cols())
       {
-        size_t i,j;
-
-        for (j = 0; j < _variRefA.cols(); j++) {
-          for (i = 0; i < _variRefA.rows(); i++) {
+        for (size_type j = 0; j < _variRefA.cols(); j++) {
+          for (size_type i = 0; i < _variRefA.rows(); i++) {
             _variRefA(i,j) = A(i,j).vi_;
             _A(i,j) = A(i,j).val();
           }
         }

-        for (j = 0; j < _variRefB.cols(); j++) {
-          for (i = 0; i < _variRefB.rows(); i++) {
+        for (size_type j = 0; j < _variRefB.cols(); j++) {
+          for (size_type i = 0; i < _variRefB.rows(); i++) {
             _variRefB(i,j) = B(i,j).vi_;
             _C(i,j) = B(i,j).val();
           }
@@ -961,8 +957,8 @@

         _C = _A.colPivHouseholderQr().solve(_C);

-        for (j = 0; j < _variRefC.cols(); j++) {
-          for (i = 0; i < _variRefC.rows(); i++) {
+        for (size_type j = 0; j < _variRefC.cols(); j++) {
+          for (size_type i = 0; i < _variRefC.rows(); i++) {
             _variRefC(i,j) = new vari(_C(i,j),false);
           }
         }
@@ -973,21 +969,20 @@
         Eigen::Matrix<double,R2,C2> adjB(_variRefB.rows(),_variRefB.cols());
         Eigen::Matrix<double,R1,C2> adjC(_variRefC.rows(),_variRefC.cols());

-        size_t i,j;
-        for (j = 0; j < adjC.cols(); j++)
-          for (i = 0; i < adjC.rows(); i++)
+        for (size_type j = 0; j < adjC.cols(); j++)
+          for (size_type i = 0; i < adjC.rows(); i++)
             adjC(i,j) = _variRefC(i,j)->adj_;

         adjB = _A.transpose().colPivHouseholderQr().solve(adjC);
         adjA.noalias() = -adjB*_C.transpose();

-        for (j = 0; j < adjA.cols(); j++)
-          for (i = 0; i < adjA.rows(); i++)
+        for (size_type j = 0; j < adjA.cols(); j++)
+          for (size_type i = 0; i < adjA.rows(); i++)
             _variRefA(i,j)->adj_ += adjA(i,j);

-        for (j = 0; j < adjB.cols(); j++)
-          for (i = 0; i < adjB.rows(); i++)
+        for (size_type j = 0; j < adjB.cols(); j++)
+          for (size_type i = 0; i < adjB.rows(); i++)
             _variRefB(i,j)->adj_ += adjB(i,j);
       }
     };
@@ -1007,10 +1002,8 @@
       _A(A), _C(B.rows(),B.cols()),
       _variRefB(B.rows(),B.cols()), _variRefC(B.rows(),B.cols())
       {
-        size_t i,j;
-
-        for (j = 0; j < _variRefB.cols(); j++) {
-          for (i = 0; i < _variRefB.rows(); i++) {
+        for (size_type j = 0; j < _variRefB.cols(); j++) {
+          for (size_type i = 0; i < _variRefB.rows(); i++) {
             _variRefB(i,j) = B(i,j).vi_;
             _C(i,j) = B(i,j).val();
           }
@@ -1018,8 +1011,8 @@

         _C = _A.colPivHouseholderQr().solve(_C);

-        for (j = 0; j < _variRefC.cols(); j++) {
-          for (i = 0; i < _variRefC.rows(); i++) {
+        for (size_type j = 0; j < _variRefC.cols(); j++) {
+          for (size_type i = 0; i < _variRefC.rows(); i++) {
             _variRefC(i,j) = new vari(_C(i,j),false);
           }
         }
@@ -1029,16 +1022,15 @@
         Eigen::Matrix<double,R2,C2> adjB(_variRefB.rows(),_variRefB.cols());
         Eigen::Matrix<double,R1,C2> adjC(_variRefC.rows(),_variRefC.cols());

-        size_t i,j;
-        for (j = 0; j < adjC.cols(); j++)
-          for (i = 0; i < adjC.rows(); i++)
+        for (size_type j = 0; j < adjC.cols(); j++)
+          for (size_type i = 0; i < adjC.rows(); i++)
             adjC(i,j) = _variRefC(i,j)->adj_;

         adjB = _A.transpose().colPivHouseholderQr().solve(adjC);

-        for (j = 0; j < adjB.cols(); j++)
-          for (i = 0; i < adjB.rows(); i++)
+        for (size_type j = 0; j < adjB.cols(); j++)
+          for (size_type i = 0; i < adjB.rows(); i++)
             _variRefB(i,j)->adj_ += adjB(i,j);
       }
     };
@@ -1058,10 +1050,8 @@
       _A(A.rows(),A.cols()), _C(B.rows(),B.cols()),
       _variRefA(A.rows(),A.cols()), _variRefC(B.rows(),B.cols())
       {
-        size_t i,j;
-
-        for (j = 0; j < _variRefA.cols(); j++) {
-          for (i = 0; i < _variRefA.rows(); i++) {
+        for (size_type j = 0; j < _variRefA.cols(); j++) {
+          for (size_type i = 0; i < _variRefA.rows(); i++) {
             _variRefA(i,j) = A(i,j).vi_;
             _A(i,j) = A(i,j).val();
           }
@@ -1070,8 +1060,8 @@

         _C = _A.colPivHouseholderQr().solve(B);

-        for (j = 0; j < _variRefC.cols(); j++) {
-          for (i = 0; i < _variRefC.rows(); i++) {
+        for (size_type j = 0; j < _variRefC.cols(); j++) {
+          for (size_type i = 0; i < _variRefC.rows(); i++) {
             _variRefC(i,j) = new vari(_C(i,j),false);
           }
         }
@@ -1081,15 +1071,14 @@
         Eigen::Matrix<double,R1,C1> adjA(_variRefA.rows(),_variRefA.cols());
         Eigen::Matrix<double,R1,C2> adjC(_variRefC.rows(),_variRefC.cols());

-        size_t i,j;
-        for (j = 0; j < adjC.cols(); j++)
-          for (i = 0; i < adjC.rows(); i++)
+        for (size_type j = 0; j < adjC.cols(); j++)
+          for (size_type i = 0; i < adjC.rows(); i++)
             adjC(i,j) = _variRefC(i,j)->adj_;

         adjA = -_A.transpose().colPivHouseholderQr().solve(adjC*_C.transpose());

-        for (j = 0; j < adjA.cols(); j++)
-          for (i = 0; i < adjA.rows(); i++)
+        for (size_type j = 0; j < adjA.cols(); j++)
+          for (size_type i = 0; i < adjA.rows(); i++)
             _variRefA(i,j)->adj_ += adjA(i,j);
       }
     };
@@ -1109,10 +1098,8 @@
       // for the returned matrix.  Memory will be cleaned up with the arena allocator.
       mdivide_left_vv_vari<R1,C1,R2,C2> *baseVari = new mdivide_left_vv_vari<R1,C1,R2,C2>(A,b);

-      size_t i,j;
-
-      for (i = 0; i < res.rows(); i++)
-        for (j = 0; j < res.cols(); j++)
+      for (size_type i = 0; i < res.rows(); i++)
+        for (size_type j = 0; j < res.cols(); j++)
           res(i,j).vi_ = baseVari->_variRefC(i,j);

       return res;
@@ -1133,10 +1120,8 @@
       // for the returned matrix.  Memory will be cleaned up with the arena allocator.
       mdivide_left_vd_vari<R1,C1,R2,C2> *baseVari = new mdivide_left_vd_vari<R1,C1,R2,C2>(A,b);

-      size_t i,j;
-
-      for (i = 0; i < res.rows(); i++)
-        for (j = 0; j < res.cols(); j++)
+      for (size_type i = 0; i < res.rows(); i++)
+        for (size_type j = 0; j < res.cols(); j++)
           res(i,j).vi_ = baseVari->_variRefC(i,j);

       return res;
@@ -1157,10 +1142,8 @@
       // for the returned matrix.  Memory will be cleaned up with the arena allocator.
       mdivide_left_dv_vari<R1,C1,R2,C2> *baseVari = new mdivide_left_dv_vari<R1,C1,R2,C2>(A,b);

-      size_t i,j;
-
-      for (i = 0; i < res.rows(); i++)
-        for (j = 0; j < res.cols(); j++)
+      for (size_type i = 0; i < res.rows(); i++)
+        for (size_type j = 0; j < res.cols(); j++)
           res(i,j).vi_ = baseVari->_variRefC(i,j);

       return res;
@@ -1476,9 +1459,8 @@
       log_determinant_vari(const Eigen::Matrix<var,R,C> &A)
       : vari(log_determinant_vari_calc(A)), _A(A.rows(),A.cols()), _adjARef(A.rows(),A.cols())
       {
-        size_t i,j;
-        for (j = 0; j < A.cols(); j++) {
-          for (i = 0; i < A.rows(); i++) {
+        for (size_type j = 0; j < A.cols(); j++) {
+          for (size_type i = 0; i < A.rows(); i++) {
             _A(i,j) = A(i,j).val();
             _adjARef(i,j) = A(i,j).vi_;
           }
@@ -1488,18 +1470,16 @@
       double log_determinant_vari_calc(const Eigen::Matrix<var,R,C> &A)
       {
         Eigen::Matrix<double,R,C> Ad(A.rows(),A.cols());
-        size_t i,j;
-        for (j = 0; j < A.cols(); j++)
-          for (i = 0; i < A.rows(); i++)
+        for (size_type j = 0; j < A.cols(); j++)
+          for (size_type i = 0; i < A.rows(); i++)
             Ad(i,j) = A(i,j).val();
         return Ad.fullPivHouseholderQr().logAbsDeterminant();
       }
       virtual void chain() {
-        Eigen::Matrix<double,R,C> adjA(_A.rows(),_A.cols());
-        size_t i,j;
+        Eigen::Matrix<double,R,C> adjA(_A.rows(),_A.cols());
         adjA = adj_ * _A.inverse().transpose();
-        for (j = 0; j < _adjARef.cols(); j++) {
-          for (i = 0; i < _adjARef.rows(); i++) {
+        for (size_type j = 0; j < _adjARef.cols(); j++) {
+          for (size_type i = 0; i < _adjARef.rows(); i++) {
             _adjARef(i,j)->adj_ += adjA(i,j);
           }
         }
@@ -1870,7 +1850,6 @@
     inline void assign_to_var(Eigen::Matrix<LHS,R,C>& x,
 			      const Eigen::Matrix<RHS,R,C>& y) {
       stan::math::validate_matching_sizes(x,y,"assign_to_var");
-      typedef typename Eigen::Matrix<LHS,R,C>::size_type size_type;
       for (size_type n = 0; n < x.cols(); ++n)
         for (size_type m = 0; m < x.rows(); ++m)
           assign_to_var(x(m,n),y(m,n));


get DPI

get DPI

--- src/engine/win/os.cpp
+++ src/engine/win/os.cpp
@@ -476,8 +476,8 @@

 int getDPI()
 {
-	// TODO
-	return 96;
+	const HDC hdc = GetDC(NULL);
+    return GetDeviceCaps(hdc, LOGPIXELSX);
 }


added array output in row-major order for code generator in stanc

--- src/stan/gm/generator.hpp
+++ src/stan/gm/generator.hpp
@@ -1924,6 +1924,9 @@
       }
     };

+
+
+
     struct write_csv_vars_visgen : public visgen {
       write_csv_vars_visgen(std::ostream& o)
         : visgen(o) {
@@ -1989,6 +1992,7 @@
         }
       }
     };
+

     void generate_write_csv_method(const program& prog,
                                    const std::string& model_name,
@@ -2051,6 +2055,285 @@
       o << INDENT2 << "writer__.newline();" << EOL;
       o << INDENT << "}" << EOL2;
     }
+
+
+    // see init_member_var_visgen for cut & paste
+    struct write_array_visgen : public visgen {
+      write_array_visgen(std::ostream& o)
+        : visgen(o) {
+      }
+      void operator()(const nil& x) const { }
+      void operator()(const int_var_decl& x) const {
+        generate_initialize_array("int","integer",EMPTY_EXP_VECTOR,
+                                  x.name_,x.dims_);
+      }
+      void operator()(const double_var_decl& x) const {
+        if (!is_nil(x.range_.low_.expr_)) {
+          if (!is_nil(x.range_.high_.expr_)) {
+            std::vector<expression> read_args;
+            read_args.push_back(x.range_.low_);
+            read_args.push_back(x.range_.high_);
+            generate_initialize_array("double","scalar_lub",read_args,
+                                      x.name_,x.dims_);
+          } else {
+            std::vector<expression> read_args;
+            read_args.push_back(x.range_.low_);
+            generate_initialize_array("double","scalar_lb",read_args,x.name_,x.dims_);
+          }
+        } else {
+          if (!is_nil(x.range_.high_.expr_)) {
+            std::vector<expression> read_args;
+            read_args.push_back(x.range_.high_);
+            generate_initialize_array("double","scalar_ub",read_args,x.name_,x.dims_);
+          } else {
+            generate_initialize_array("double","scalar",EMPTY_EXP_VECTOR,x.name_,x.dims_);
+          }
+        }
+      }
+      void operator()(const vector_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.M_);
+        generate_initialize_array("vector_d","vector",read_args,x.name_,x.dims_);
+      }
+      void operator()(const row_vector_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.N_);
+        generate_initialize_array("row_vector_d","row_vector",read_args,x.name_,x.dims_);
+      }
+      void operator()(const matrix_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.M_);
+        read_args.push_back(x.N_);
+        generate_initialize_array("matrix_d","matrix",read_args,x.name_,x.dims_);
+      }
+      void operator()(const simplex_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.K_);
+        generate_initialize_array("vector_d","simplex",read_args,x.name_,x.dims_);
+      }
+      void operator()(const ordered_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.K_);
+        generate_initialize_array("vector_d","ordered",read_args,x.name_,x.dims_);
+      }
+      void operator()(const cov_matrix_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.K_);
+        generate_initialize_array("matrix_d","cov_matrix",read_args,x.name_,x.dims_);
+      }
+      void operator()(const corr_matrix_var_decl& x) const {
+        std::vector<expression> read_args;
+        read_args.push_back(x.K_);
+        generate_initialize_array("matrix_d","corr_matrix",read_args,x.name_,x.dims_);
+      }
+      void generate_initialize_array(const std::string& var_type,
+                                     const std::string& read_type,
+                                     const std::vector<expression>& read_args,
+                                     const std::string& name,
+                                     const std::vector<expression>& dims) const {
+        if (dims.size() == 0) {
+          generate_indent(2,o_);
+          o_ << var_type << " ";
+          o_ << name << " = in__." << read_type  << "_constrain(";
+          for (size_t j = 0; j < read_args.size(); ++j) {
+            if (j > 0) o_ << ",";
+            generate_expression(read_args[j],o_);
+          }
+          o_ << ");" << EOL;
+          o_ << INDENT2 << "writer__.write(" << name << ");" << EOL;
+          return;
+        }
+        o_ << INDENT2;
+        for (size_t i = 0; i < dims.size(); ++i) o_ << "vector<";
+        o_ << var_type;
+        for (size_t i = 0; i < dims.size(); ++i) o_ << "> ";
+        o_ << name << ";" << EOL;
+        std::string name_dims(name);
+        for (size_t i = 0; i < dims.size(); ++i) {
+          generate_indent(i + 2, o_);
+          o_ << "size_t dim_"  << name << "_" << i << " = ";
+          generate_expression(dims[i],o_);
+          o_ << ";" << EOL;
+          if (i < dims.size() - 1) {
+            generate_indent(i + 2, o_);
+            o_ << name_dims << ".resize(dim" << "_" << name << "_" << i << ");"
+               << EOL;
+            name_dims.append("[k_").append(to_string(i)).append("]");
+          }
+          generate_indent(i + 2, o_);
+          o_ << "for (size_t k_" << i << " = 0;"
+             << " k_" << i << " < dim_" << name << "_" << i << ";"
+             << " ++k_" << i << ") {" << EOL;
+          if (i == dims.size() - 1) {
+            generate_indent(i + 3, o_);
+            o_ << name_dims << ".push_back(in__." << read_type << "_constrain(";
+            for (size_t j = 0; j < read_args.size(); ++j) {
+              if (j > 0) o_ << ",";
+              generate_expression(read_args[j],o_);
+            }
+            o_ << "));" << EOL;
+          }
+        }
+
+        // cut from write_csv: need to reverse order, just used write_array_vars!
+        // generate_indent(dims.size() + 2, o_);
+        // o_ << "vars__.push_back(" << name;
+        // if (dims.size() > 0) {
+        //   o_ << '[';
+        //   for (size_t i = 0; i < dims.size(); ++i) {
+        //     if (i > 0) o_ << "][";
+        //     o_ << "k_" << i;
+        //   }
+        //   o_ << ']';
+        // }
+        // o_ << ");" << EOL;
+
+        for (size_t i = dims.size(); i > 0; --i) {
+          generate_indent(i + 1, o_);
+          o_ << "}" << EOL;
+        }
+
+
+      }
+    };
+
+
+
+
+    struct write_array_vars_visgen : public visgen {
+      write_array_vars_visgen(std::ostream& o)
+        : visgen(o) {
+      }
+      void operator()(const nil& x) const { }
+      // FIXME: template these out
+      void operator()(const int_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const double_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const vector_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const row_vector_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const matrix_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const simplex_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const ordered_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const cov_matrix_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void operator()(const corr_matrix_var_decl& x) const {
+        write_array(x.name_,x.dims_);
+      }
+      void write_array(const std::string& name,
+                       const std::vector<expression>& dims) const {
+        if (dims.size() == 0) {
+          o_ << INDENT2 << "writer__.write(" << name << ");" << EOL;
+          return;
+        }
+        // for (size_t i = 0; i < dims.size(); ++i) {
+        for (size_t i = dims.size(); i > 0; ) {
+          --i;
+          generate_indent((dims.size() - i) + 1, o_);
+          o_ << "for (int k_" << i << " = 0;"
+             << " k_" << i << " < ";
+          generate_expression(dims[i],o_);
+          o_ << "; ++k_" << i << ") {" << EOL;
+        }
+
+        generate_indent(dims.size() + 2, o_);
+        o_ << "vars__.push_back(" << name;
+        if (dims.size() > 0) {
+          o_ << '[';
+          for (size_t i = 0; i < dims.size(); ++i) {
+            if (i > 0) o_ << "][";
+            o_ << "k_" << i;
+          }
+          o_ << ']';
+        }
+        o_ << ");" << EOL;
+
+        for (size_t i = dims.size(); i > 0; --i) {
+          generate_indent(i + 1, o_);
+          o_ << "}" << EOL;
+        }
+      }
+    };
+
+
+    void generate_write_array_method(const program& prog,
+                                     const std::string& model_name,
+                                     std::ostream& o) {
+      o << INDENT << "void write_array(std::vector<double>& params_r__," << EOL;
+      o << INDENT << "                 std::vector<int>& params_i__," << EOL;
+      o << INDENT << "                 std::vector<double>& vars__) {" << EOL;
+      o << INDENT2 << "vars__.resize(0);" << EOL;
+      o << INDENT2 << "stan::io::reader<double> in__(params_r__,params_i__);" << EOL;
+      o << INDENT2 << "static const char* function__ = \""
+        << model_name << "_namespace::write_array(%1%)\";" << EOL;
+
+      // declares, reads, and sets parameters
+      generate_comment("read-transform, write parameters",2,o);
+      write_array_visgen vis(o);
+      for (size_t i = 0; i < prog.parameter_decl_.size(); ++i)
+        boost::apply_visitor(vis,prog.parameter_decl_[i].decl_);
+
+      // this is for all other values
+      write_array_vars_visgen vis_writer(o);
+
+      // writes parameters
+      for (size_t i = 0; i < prog.parameter_decl_.size(); ++i)
+        boost::apply_visitor(vis_writer,prog.parameter_decl_[i].decl_);
+
+
+      // transformed parameters guaranteed to satisfy constraints
+
+      o << EOL;
+      generate_comment("declare and define transformed parameters",2,o);
+      o << INDENT2 <<  "double lp__ = 0.0;" << EOL;
+      static bool is_var = false;
+      generate_local_var_decls(prog.derived_decl_.first,2,o,is_var);
+      o << EOL;
+      static bool include_sampling = false;
+      generate_statements(prog.derived_decl_.second,2,o,include_sampling,is_var);
+      o << EOL;
+
+      generate_comment("validate transformed parameters",2,o);
+      generate_validate_var_decls(prog.derived_decl_.first,2,o);
+      o << EOL;
+
+      generate_comment("write transformed parameters",2,o);
+      for (size_t i = 0; i < prog.derived_decl_.first.size(); ++i)
+        boost::apply_visitor(vis_writer, prog.derived_decl_.first[i].decl_);
+      o << EOL;
+
+      generate_comment("declare and define generated quantities",2,o);
+      generate_local_var_decls(prog.generated_decl_.first,2,o,is_var);
+      o << EOL;
+      generate_statements(prog.generated_decl_.second,2,o,include_sampling,is_var);
+      o << EOL;
+
+      generate_comment("validate generated quantities",2,o);
+      generate_validate_var_decls(prog.generated_decl_.first,2,o);
+      o << EOL;
+
+      generate_comment("write generated quantities",2,o);
+      for (size_t i = 0; i < prog.generated_decl_.first.size(); ++i)
+        boost::apply_visitor(vis_writer, prog.generated_decl_.first[i].decl_);
+      if (prog.generated_decl_.first.size() > 0)
+        o << EOL;
+
+      o << INDENT << "}" << EOL2;
+    }
+

     // know all data is set and range expressions only depend on data
     struct set_param_ranges_visgen : public visgen {
@@ -2230,6 +2513,7 @@
       generate_log_prob(prog,out);
       generate_param_names_method(prog,out);
       generate_dims_method(prog,out);
+      generate_write_array_method(prog,model_name,out);
       generate_write_csv_header_method(prog,out);
       generate_write_csv_method(prog,model_name,out);
       generate_end_class_decl(out);


removed 'assert' in generator

removed 'assert' in generator

--- src/stan/gm/generator.hpp
+++ src/stan/gm/generator.hpp
@@ -532,7 +532,7 @@
                              const std::string& type_name) const {
         generate_begin_for_dims(x.dims_);
         generate_indent(indents_ + x.dims_.size(),o_);
-        o_ << "assert(stan::math::check_" << type_name << "(function,";
+        o_ << "stan::math::check_" << type_name << "(function,";
         generate_loop_var(x.name_,x.dims_.size());
         o_ << ",\"";
         generate_loop_var(x.name_,x.dims_.size());


Fix incorrect printing of signed 64-bit immediates.

--- reil/aarch64/printer.cpp
+++ reil/aarch64/printer.cpp
@@ -25,7 +25,7 @@
 }

 static void PrintSignedImmediate(std::ostream& stream, const Immediate& opnd) {
-  if (opnd.value & 1 << (opnd.size - 1)) {
+  if (opnd.value & (1ull << (opnd.size - 1))) {
     stream << "#-0x" << std::hex << (~opnd.value) + 1;
   } else {
     stream << "#0x" << std::hex << opnd.value;


added missing include

added missing include

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

--- src/escape_string.cpp
+++ src/escape_string.cpp
@@ -40,6 +40,7 @@
 #include <algorithm>
 #include <iostream>
 #include <limits>
+#include <cstring>

 #include <boost/optional.hpp>
 #include <boost/array.hpp>


fix out-of-bounds memory access in to_string

git-svn-id: 4f0141143c3c635d33f1b9f02fcb2b6c73e45c89@6471 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/escape_string.cpp
+++ src/escape_string.cpp
@@ -71,7 +71,7 @@
 	boost::array<char, 3 + std::numeric_limits<size_type>::digits10> to_string(size_type n)
 	{
 		boost::array<char, 3 + std::numeric_limits<size_type>::digits10> ret;
-		char *p = &ret.back();;
+		char *p = &ret.back();
 		*p = '\0';
 		unsigned_size_type un = n;
 		if (n < 0)  un = -un;
@@ -80,7 +80,7 @@
 			un /= 10;
 		} while (un);
 		if (n < 0) *--p = '-';
-		std::memmove(&ret.front(), p, sizeof(ret.elems));
+		std::memmove(&ret[0], p, &ret.back() - p);
 		return ret;
 	}


Removes the gdnative library when no script (gdns) references it any longer. This enables hot reload for gdnative.

(cherry picked from commit cc5d8bb5adf46aef63828fb23095589e51cca783)

--- modules/gdnative/nativescript/nativescript.cpp
+++ modules/gdnative/nativescript/nativescript.cpp
@@ -1528,6 +1528,12 @@
 		S->get().erase(script);
 		if (S->get().size() == 0) {
 			library_script_users.erase(S);
+
+			Map<String, Ref<GDNative> >::Element *G = library_gdnatives.find(script->lib_path);
+			if (G) {
+				G->get()->terminate();
+				library_gdnatives.erase(G);
+			}
 		}
 	}
 #ifndef NO_THREADS


Event counter: print info more compactly

Per-loop stats, averaged over 500 loops:
- Collision checks: 261
- Movement calls: 63
- Loop time in ticks: 17
- Per-section game logic times: _ 2 _ _ _ _ 5 6
- Total game logic time in ticks: 15

--- src/event_counter.cpp
+++ src/event_counter.cpp
@@ -42,13 +42,15 @@
     printf("- Loop time in ticks: %d\n",
            (latest_time - game_loop_start_time) / num_loops);
     uint32_t total_game_logic_time = 0;
+    printf("- Per-section game logic times: ");
     for (int i = 0; i < MAX_GAME_LOGIC_SECTIONS; ++i) {
-        if (game_logic_times[i] == 0)
-            continue;
-        printf("- Game logic section %d, time in ticks: %d\n", i,
-               game_logic_times[i] / num_loops);
         total_game_logic_time += game_logic_times[i];
+        if (game_logic_times[i] >= num_loops)
+            printf("%lu ", game_logic_times[i] / num_loops);
+        else    // If the rounded-down value is zero, don't bother printing it.
+            printf("_ ");   // Just print a placeholder.
     }
+    printf("\n");
     printf("- Total game logic time in ticks: %d\n",
            total_game_logic_time / num_loops);
 }


Always read pixels from fbo in fbo recreate.no_rebind tests

Instead of rendering texture to screen and verifying result, read texture
attachments pixels using fbo. This changes texture tests to work same way as
renderbuffer tests work and avoids triggering some bugs in reference context.

Bug: 21526068
Change-Id: I3009703a947e1a11327cf8f49585dce2a3270a04

--- modules/gles2/functional/es2fFboRenderTest.cpp
+++ modules/gles2/functional/es2fFboRenderTest.cpp
@@ -1967,24 +1967,8 @@

 	ctx.disable(GL_DEPTH_TEST);

-	if (fbo.getConfig().colorbufferType == GL_TEXTURE_2D)
-	{
-		// Unbind fbo
-		ctx.bindFramebuffer(GL_FRAMEBUFFER, 0);
-
-		// Draw to screen
-		ctx.bindTexture(GL_TEXTURE_2D, fbo.getColorbuffer());
-		ctx.viewport(0, 0, ctx.getWidth(), ctx.getHeight());
-		sglr::drawQuad(ctx, texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
-
-		// Read from screen
-		ctx.readPixels(dst, 0, 0, ctx.getWidth(), ctx.getHeight());
-	}
-	else
-	{
-		// Read from fbo
-		ctx.readPixels(dst, 0, 0, width, height);
-	}
+	// Read from fbo
+	ctx.readPixels(dst, 0, 0, width, height);
 }

 class RepeatedClearCase : public FboRenderCase


change transformation matrix

change transformation matrix


Fixed attribute presence filter parsing.

[SVN r85446]

--- src/filter_parser.cpp
+++ src/filter_parser.cpp
@@ -252,6 +252,8 @@
                 // If the filter has negation operator, do not expect a relation (i.e. "!%attr% > 1" is not valid because "!%attr%" is interpreted as an attribute presence test)
                 if (!negation_present)
                     p = parse_relation(p, end);
+                else
+                    on_relation_complete();
             }
             else if (c == constants::char_exclamation || scan_keyword(p, end, next, constants::not_keyword()))
             {


planning: add CROSSWALK tag to learning data


ProstProcessing: Removed unused variable

--- modules/postprocessing/processors/hdrbloom.cpp
+++ modules/postprocessing/processors/hdrbloom.cpp
@@ -170,7 +170,7 @@
     utilgl::GlBoolState blend(GL_BLEND, true);
     glBlendFunc(GL_ONE, GL_ONE);
     glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
-    std::array<float, Levels> factors{1.0f, 0.8f, 0.6f, 0.4f, 0.2f};
+
     compose_.setUniform("bloomStrength", strength_.get());
     compose_.setUniform("bloomRadius", radius_.get());
     for (int i = 0; i < Levels; i++) {


Prediction: modify min_prediction_length to 20.0

--- modules/prediction/common/prediction_gflags.cc
+++ modules/prediction/common/prediction_gflags.cc
@@ -36,7 +36,7 @@
 DEFINE_double(prediction_duration, 5.0, "Prediction duration (in seconds)");
 DEFINE_double(prediction_period, 0.1, "Prediction period (in seconds");
 DEFINE_double(double_precision, 1e-6, "precision of double");
-DEFINE_double(min_prediction_length, 50.0,
+DEFINE_double(min_prediction_length, 20.0,
               "Minimal length of prediction trajectory");

 // Bag replay timestamp gap


implement RTF_SB and RTF_SA

implement RTF_SB and RTF_SA

--- writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -353,6 +353,8 @@
         case RTF_LIN: nSprm = 0x845e; break;
         case RTF_RI: nSprm = NS_sprm::LN_PDxaRight; break;
         case RTF_RIN: nSprm = 0x845d; break;
+        case RTF_SB: nSprm = NS_sprm::LN_PDyaBefore; break;
+        case RTF_SA: nSprm = NS_sprm::LN_PDyaAfter; break;
         default: break;
     }
     if (nSprm > 0)


add comment explaining ww8 import does the same

--- writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -259,12 +259,16 @@
     return NULL;
 }

-sal_uInt32 lcl_BrgToRgb(sal_uInt32 nBrg)
-{
-    sal_uInt32 nBlue = (nBrg & 0xff0000) >> 16;
-    sal_uInt32 nGreen = (nBrg & 0x00ff00) >> 8;
-    sal_uInt32 nRed = nBrg & 0x0000ff;
-    return (nRed << 16) | (nGreen << 8) | nBlue;
+// NEEDSWORK: wwUtility::BGRToRGB does the same.
+sal_uInt32 lcl_BGRToRGB(sal_uInt32 nColor)
+{
+    sal_uInt8
+        r(static_cast<sal_uInt8>(nColor&0xFF)),
+        g(static_cast<sal_uInt8>(((nColor)>>8)&0xFF)),
+        b(static_cast<sal_uInt8>((nColor>>16)&0xFF)),
+        t(static_cast<sal_uInt8>((nColor>>24)&0xFF));
+    nColor = (t<<24) + (r<<16) + (g<<8) + b;
+    return nColor;
 }

 RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext,
@@ -2460,7 +2464,7 @@
         else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("fillColor")))
         {
             uno::Any aColor;
-            aColor <<= lcl_BrgToRgb(i->second.toInt32());
+            aColor <<= lcl_BGRToRGB(i->second.toInt32());
             xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aColor);
         }
         else


implement RTF_S outside RTF_STYLESHEET

implement RTF_S outside RTF_STYLESHEET

--- writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -238,8 +238,8 @@
                 m_aStates.top().nCurrentStyleIndex = nParam;
             else
             {
-                /*RTFValue::Pointer_t pValue(new RTFValue(nParam));
-                m_aStates.top().aSprms[NS_sprm::LN_CRgFtc0] = pValue;*/
+                RTFValue::Pointer_t pValue(new RTFValue(nParam));
+                m_aStates.top().aAttributes[NS_rtf::LN_ISTD] = pValue;
             }
             break;
         case RTF_SBASEDON:


tighter checks on quaternions

tighter checks on quaternions

--- moveit_core/planning_models/src/transforms.cpp
+++ moveit_core/planning_models/src/transforms.cpp
@@ -41,7 +41,7 @@
 {
   q = Eigen::Quaterniond(qmsg.w, qmsg.x, qmsg.y, qmsg.z);
   double error = fabs(q.squaredNorm() - 1.0);
-  if (error > 0.1)
+  if (error > 0.05)
   {
     ROS_ERROR("Quaternion is NOWHERE CLOSE TO NORMALIZED [x,y,z,w], [%.2f, %.2f, %.2f, %.2f]. Can't do much, returning identity.",
         qmsg.x, qmsg.y, qmsg.z, qmsg.w);


INTEGRATION: CWS jl51 (1.5.30); FILE MERGED 2007/02/05 13:54:18 jl 1.5.30.1: #i69228 warning free code

--- xmlsecurity/source/framework/decryptorimpl.cxx
+++ xmlsecurity/source/framework/decryptorimpl.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: decryptorimpl.cxx,v $
  *
- *  $Revision: 1.5 $
- *
- *  last change: $Author: obo $ $Date: 2006-09-16 14:36:56 $
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: ihi $ $Date: 2007-04-17 10:17:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -191,7 +191,7 @@
     tryToPerform();
 }

-void SAL_CALL DecryptorImpl::removeDecryptionResultListener( const cssu::Reference< cssxc::sax::XDecryptionResultListener >& listener )
+void SAL_CALL DecryptorImpl::removeDecryptionResultListener( const cssu::Reference< cssxc::sax::XDecryptionResultListener >&)
         throw (cssu::RuntimeException)
 {
 }
@@ -200,8 +200,7 @@
 void SAL_CALL DecryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments )
     throw (cssu::Exception, cssu::RuntimeException)
 {
-    sal_Int32 nLength = aArguments.getLength();
-    OSL_ASSERT(nLength == 5);
+    OSL_ASSERT(aArguments.getLength() == 5);

     rtl::OUString ouTempString;


add to string impl for length func - closes #2437

--- src/function_call.cpp
+++ src/function_call.cpp
@@ -113,6 +113,7 @@
     else if (fun.target<atan_impl>()) return "atan";
     else if (fun.target<exp_impl>()) return "exp";
     else if (fun.target<abs_impl>()) return "abs";
+    else if (fun.target<length_impl>()) return "length";
     else return "unknown";
 }


db_conf.cpp: limit fixed type: max valid length is 65536

--- src/terark/db/db_conf.cpp
+++ src/terark/db/db_conf.cpp
@@ -2292,8 +2292,8 @@
 		ColumnMeta colmeta(Schema::parseColumnType(type));
 		if (ColumnType::Fixed == colmeta.type) {
 			long fixlen = col["length"];
-			if (fixlen <= 0) {
-				THROW_STD(invalid_argument, "invalid fixed length=%ld, must > 0", fixlen);
+			if (fixlen <= 0 || fixlen > 65536) {
+				THROW_STD(invalid_argument, "invalid fixed length=%ld, must > 0 and <= 65536", fixlen);
 			}
 			colmeta.fixedLen = (uint32_t)fixlen;
 		}


ColumnMeta: add numberType()

ColumnMeta: add numberType()

--- src/terark/db/db_conf.hpp
+++ src/terark/db/db_conf.hpp
@@ -73,6 +73,47 @@
 		bool isString() const;
 		explicit ColumnMeta(ColumnType);
 		size_t fixedEndOffset() const { return fixedOffset + fixedLen; }
+
+		static ColumnType numberType(int       x) { return sintType(x); }
+		static ColumnType numberType(short     x) { return sintType(x); }
+		static ColumnType numberType(long      x) { return sintType(x); }
+		static ColumnType numberType(long long x) { return sintType(x); }
+
+		static ColumnType numberType(unsigned int       x) { return uintType(x); }
+		static ColumnType numberType(unsigned short     x) { return uintType(x); }
+		static ColumnType numberType(unsigned long      x) { return uintType(x); }
+		static ColumnType numberType(unsigned long long x) { return uintType(x); }
+
+		static ColumnType numberType(float  x) { return ColumnType::Float32; }
+		static ColumnType numberType(double x) { return ColumnType::Float64; }
+		static ColumnType numberType(long double x) {
+			if (sizeof(long double) > 8) // 16 for gcc
+				return ColumnType::Float128;
+			else
+				return ColumnType::Float64; // msvc
+		}
+
+	private:
+		template<class Uint>
+		static ColumnType uintType(Uint) {
+			if (sizeof(Uint) ==  1) return ColumnType::Uint08;
+			if (sizeof(Uint) ==  2) return ColumnType::Uint16;
+			if (sizeof(Uint) ==  4) return ColumnType::Uint32;
+			if (sizeof(Uint) ==  8) return ColumnType::Uint64;
+			if (sizeof(Uint) == 16) return ColumnType::Uint128;
+			abort();
+			return ColumnType::Any;
+		}
+		template<class Sint>
+		static ColumnType sintType(Sint) {
+			if (sizeof(Sint) ==  1) return ColumnType::Sint08;
+			if (sizeof(Sint) ==  2) return ColumnType::Sint16;
+			if (sizeof(Sint) ==  4) return ColumnType::Sint32;
+			if (sizeof(Sint) ==  8) return ColumnType::Sint64;
+			if (sizeof(Sint) == 16) return ColumnType::Sint128;
+			abort();
+			return ColumnType::Any;
+		}
 	};

 	class TERARK_DB_DLL ColumnVec {
@@ -353,6 +394,7 @@
 			assert(colvec.size() == m_columnsMeta.end_i());
 			assert(colmeta.isNumber());
 			assert(colmeta.fixedLen == sizeof(NumberType));
+			assert(colmeta.numberType(NumberType()) == colmeta.type);
 		#endif
 			ColumnVec::Elem e = colvec.m_cols[columnId];
 			assert(sizeof(NumberType) == e.len);


Add assertion

Add assertion

--- Source/HeliumRain/UI/Menus/FlareTechnologyMenu.cpp
+++ Source/HeliumRain/UI/Menus/FlareTechnologyMenu.cpp
@@ -317,6 +317,7 @@
 	for (FName UnlockedScannableIdentifier : MenuManager->GetPC()->GetUnlockedScannables())
 	{
 		auto Scannable = MenuManager->GetGame()->GetScannableCatalog()->Get(UnlockedScannableIdentifier);
+		FCHECK(Scannable);

 		ArtifactList->AddSlot()
 			.HAlign(HAlign_Fill)


Add keyword 'explicit' to PoseTestRepresentation()

--- SurgSim/Blocks/UnitTests/PoseInterpolatorTests.cpp
+++ SurgSim/Blocks/UnitTests/PoseInterpolatorTests.cpp
@@ -32,16 +32,15 @@

 namespace
 {
-	RigidTransform3d startPose = makeRigidTransform(Quaterniond::Identity(), Vector3d(1.0,2.0,3.0));
-	RigidTransform3d endPose = makeRigidTransform(Quaterniond::Identity(), Vector3d(3.0,2.0,1.0));
+	RigidTransform3d startPose = makeRigidTransform(Quaterniond::Identity(), Vector3d(1.0, 2.0, 3.0));
+	RigidTransform3d endPose = makeRigidTransform(Quaterniond::Identity(), Vector3d(3.0, 2.0, 1.0));
 }

 class PoseTestRepresentation : public SurgSim::Framework::Representation
 {
 public:
-	PoseTestRepresentation(const std::string& name) : Representation(name)
+	explicit PoseTestRepresentation(const std::string& name) : Representation(name)
 	{
-
 	}

 	virtual void setInitialPose(const SurgSim::Math::RigidTransform3d& pose)
@@ -67,8 +66,6 @@
 private:
 	RigidTransform3d m_pose;
 };
-
-

 namespace SurgSim
 {
@@ -195,6 +192,5 @@

 }

-}
-}
-
+};
+};


Avoid green artifacts on the username label.

Switched to DrawStringWithHalo for drawing text to avoid green dots
along the perimeter.

BUG=chromium-os:9337
TEST=Lock device, notice the green dots have disappeared.

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

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

--- chrome/browser/chromeos/login/username_view.cc
+++ chrome/browser/chromeos/login/username_view.cc
@@ -11,7 +11,6 @@
 #include "gfx/rect.h"
 #include "third_party/skia/include/core/SkComposeShader.h"
 #include "third_party/skia/include/effects/SkGradientShader.h"
-#include "views/background.h"

 namespace {
 // Username label background color.
@@ -84,10 +83,13 @@
                                  flags);
   text_width_ = std::min(text_width_, bounds.width() - margin_width_);
   // Draw the text.
-  canvas.DrawStringInt(GetText(), font(), GetColor(),
-                        bounds.x() + margin_width_, bounds.y(),
-                        bounds.width() - margin_width_, bounds.height(),
-                        flags);
+  // Note, direct call of the DrawStringInt method produces the green dots
+  // along the text perimeter (when the label is place on the white background).
+  SkColor kInvisibleHaloColor = 0x00000000;
+  canvas.DrawStringWithHalo(GetText(), font(), GetColor(), kInvisibleHaloColor,
+                            bounds.x() + margin_width_, bounds.y(),
+                            bounds.width() - margin_width_, bounds.height(),
+                            flags);

   text_image_.reset(new SkBitmap(canvas.ExtractBitmap()));
   text_image_->buildMipMap(false);


If wifi is active (bolded), do not bold cellular menu item in network dropdown menu.
BUG=chromium-os:25163
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/9466018

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

--- chrome/browser/chromeos/status/network_menu.cc
+++ chrome/browser/chromeos/status/network_menu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

@@ -649,7 +649,8 @@
       }

       int flag = FLAG_CELLULAR;
-      bool isActive = active_cellular &&
+      // If wifi is associated, then cellular is not active.
+      bool isActive = !cros->wifi_network() && active_cellular &&
           cell_networks[i]->service_path() == active_cellular->service_path() &&
           (cell_networks[i]->connecting() || cell_networks[i]->connected());
       bool supports_data_plan =


Refatorando 1273.

Refatorando 1273.

--- uri/1273/1273.cpp
+++ uri/1273/1273.cpp
@@ -1,10 +1,11 @@
 #include <iostream>
+#include <iomanip>
 #include <vector>

 using namespace std;

 int main(){
-    unsigned int i, j, g;
+    unsigned int i, g;
     int n;
     string s;
     bool newline = false;
@@ -22,7 +23,7 @@
         }

         for (i = 0; i < ss.size(); i++){
-            for (j = 0; j < g - ss[i].length(); j++) cout << " ";
+            cout << setw(g);
             cout << ss[i] << endl;
         }
     }


bustage fix - file moved

bustage fix - file moved

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

--- chrome/browser/debugger/devtools_window_win.cc
+++ chrome/browser/debugger/devtools_window_win.cc
@@ -6,7 +6,7 @@

 #include "chrome/browser/debugger/devtools_manager.h"
 #include "chrome/browser/debugger/devtools_view.h"
-#include "chrome/views/window.h"
+#include "chrome/views/window/window.h"

 // static


resolve merge conflicts of d097869 to nyc-dev

Change-Id: Id5780291dfd79a8256a0d979ce1e6d13a90293e9

--- modules/gles2/functional/es2fClippingTests.cpp
+++ modules/gles2/functional/es2fClippingTests.cpp
@@ -1881,7 +1881,8 @@

 void PolyVertexClipTestGroup::init (void)
 {
-	const float far = 30000.0f;
+	const float far					= 30000.0f;
+	const float farForThreeVertex	= 20000.0f; // 3 vertex clipping tests use smaller triangles
 	const tcu::IVec3 outside[] =
 	{
 		// outside one clipping plane
@@ -2023,9 +2024,9 @@
 		const tcu::IVec3 r0		= outside[ndx1];
 		const tcu::IVec3 r1		= outside[ndx2];
 		const tcu::IVec3 r2		= outside[ndx3];
-		const tcu::Vec4 p0		= tcu::Vec4(float(r0.x()) * far * w0, float(r0.y()) * far * w0, float(r0.z()) * far * w0, w0);
-		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
-		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
+		const tcu::Vec4 p0		= tcu::Vec4(float(r0.x()) * farForThreeVertex * w0, float(r0.y()) * farForThreeVertex * w0, float(r0.z()) * farForThreeVertex * w0, w0);
+		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * farForThreeVertex * w1, float(r1.y()) * farForThreeVertex * w1, float(r1.z()) * farForThreeVertex * w1, w1);
+		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * farForThreeVertex * w2, float(r2.y()) * farForThreeVertex * w2, float(r2.z()) * farForThreeVertex * w2, w2);

 		// ignore cases where polygon is along xz or yz planes
 		if (pointsOnLine(r0.swizzle(0, 1), r1.swizzle(0, 1), r2.swizzle(0, 1)))


Update the documentation of MemoryClass

Update the documentation of MemoryClass

--- general/mem_manager.hpp
+++ general/mem_manager.hpp
@@ -66,13 +66,13 @@
  *  use MemoryClass::DEVICE for their inputs. */
 enum class MemoryClass
 {
-   HOST,        /**< Memory types: { HOST, HOST_32, HOST_64, HOST_DEBUG,
-                                     HOST_UMPIRE, MANAGED } */
-   HOST_32,     ///< Memory types: { HOST_32, HOST_64, HOST_DEBUG }
-   HOST_64,     ///< Memory types: { HOST_64, HOST_DEBUG }
-   DEVICE,      /**< Memory types: { DEVICE, DEVICE_DEBUG, DEVICE_UMPIRE,
-                                     MANAGED } */
-   MANAGED      ///< Memory types: { MANAGED }
+   HOST,    /**< Memory types: { HOST, HOST_32, HOST_64, HOST_DEBUG,
+                                 HOST_UMPIRE, HOST_PINNED, MANAGED } */
+   HOST_32, ///< Memory types: { HOST_32, HOST_64, HOST_DEBUG }
+   HOST_64, ///< Memory types: { HOST_64, HOST_DEBUG }
+   DEVICE,  /**< Memory types: { DEVICE, DEVICE_DEBUG, DEVICE_UMPIRE,
+                                 DEVICE_UMPIRE_2, MANAGED } */
+   MANAGED  ///< Memory types: { MANAGED }
 };

 /// Return true if the given memory type is in MemoryClass::HOST.


Fix flakiness resulting from deleting TabContents before
the registrar.  Only seems to have shown up on two download
tests, curiously.

BUG=81985
TEST=PrerenderBrowserTests.*

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

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

--- chrome/browser/prerender/prerender_contents.cc
+++ chrome/browser/prerender/prerender_contents.cc
@@ -797,6 +797,7 @@
 TabContentsWrapper* PrerenderContents::ReleasePrerenderContents() {
   render_view_host_observer_.reset();
   prerender_contents_->download_tab_helper()->set_delegate(NULL);
+  tab_contents_observer_registrar_.Observe(NULL);
   return prerender_contents_.release();
 }


Increase GLES2 fbo comparison threshold to 0.03 am: 3f450ecc23
am: c509a7f078

* commit 'c509a7f07850a479acf88036a330ec191dd54ef8':
  Increase GLES2 fbo comparison threshold to 0.03

--- modules/gles2/functional/es2fFboRenderTest.cpp
+++ modules/gles2/functional/es2fFboRenderTest.cpp
@@ -625,7 +625,7 @@
 	}

 	// Compare images
-	const float		threshold	= 0.02f;
+	const float		threshold	= 0.03f;
 	bool			imagesOk	= tcu::fuzzyCompare(log, "ComparisonResult", "Image comparison result", refFrame, gles2Frame, threshold, tcu::COMPARE_LOG_RESULT);

 	if (!imagesOk && !failReason)


add another test for #463

add another test for #463

--- Code/GraphMol/Descriptors/test.cpp
+++ Code/GraphMol/Descriptors/test.cpp
@@ -1706,7 +1706,7 @@
   }

-  { // now chi values, where the problem was retported:
+  { // now chi values, where the problem was reported:

     RWMol *mol;
     mol = SmilesToMol("O=C(Nc1nccs1)NC(C1CC1)C");
@@ -1725,6 +1725,24 @@
     delete mol;
     delete nm;
   }
+
+  { // the root cause was handling of rings
+    RWMol *mol;
+    mol = SmilesToMol("C1CC1");
+    TEST_ASSERT(mol);
+    TEST_ASSERT(mol->getNumAtoms()==3);
+    std::vector<double> hkds(mol->getNumAtoms());
+    Descriptors::detail::hkDeltas(*mol,hkds,true);
+
+    double cv=calcChi3v(*mol);
+    TEST_ASSERT(feq(hkds[0],hkds[1]));
+    TEST_ASSERT(feq(hkds[1],hkds[2]));
+    TEST_ASSERT(feq(cv,hkds[0]*hkds[0]*hkds[0]));
+
+
+    delete mol;
+  }
+

   BOOST_LOG(rdErrorLog) << "  done" << std::endl;
 }


rewrite

rewrite

--- modules/pixkit-image/src/qualityassessment.cpp
+++ modules/pixkit-image/src/qualityassessment.cpp
@@ -397,10 +397,12 @@
 }
 bool pixkit::qualityassessment::RAPSD(const Mat Spectrum1f, Mat &RAPSD1f, Mat &Anisotropy1f){

+	//////////////////////////////////////////////////////////////////////////
 	if(Spectrum1f.rows!=Spectrum1f.cols){
 		CV_Assert(false);
 	}

+	//////////////////////////////////////////////////////////////////////////
 	Mat map1b;
 	map1b.create(Spectrum1f.size(),CV_8UC1);
 	int im = 255;
@@ -413,86 +415,82 @@
 	int Number_APS = (int)((dd)/dr);
 	double HalfImgWidth = Spectrum1f.rows / 2.0;

+	//////////////////////////////////////////////////////////////////////////
 	#pragma region RAPSD
 	Mat APS_m1f;
 	APS_m1f.create(1,Number_APS,CV_32FC1);
 	APS_m1f.setTo(0);
-
 	for (int p=0; p<Number_APS; p++){
-
 		map1b.setTo(0);
 		double TotalE = 0;
 		int Counter = 0;
 		double r = p * dr;
-
 		for (double theta=0; theta<360; theta+=0.1){

 			double epi = (double)theta * pi / 180.0;
 			int x = (int) floor( (r * cos(epi)) +0.5 );
 			int y = (int) floor( (r * sin(epi)) +0.5 );
-
-			if ((int)HalfImgWidth+x < 0 || (int)HalfImgWidth+x >= Spectrum1f.rows)
+			int	mod_x	=	cvRound(HalfImgWidth+x);
+			int	mod_y	=	cvRound(HalfImgWidth+y);
+
+			if (mod_x < 0 || mod_x >= Spectrum1f.rows)
 				continue;
-
-			if ((int)HalfImgWidth+y < 0 || (int)HalfImgWidth+y >= Spectrum1f.rows)
+			if (mod_y < 0 || mod_y >= Spectrum1f.rows)
 				continue;
-
-			if (map1b.data[((int)HalfImgWidth+x) * map1b.cols + ((int)HalfImgWidth+y)] == 255)
+			if (map1b.ptr<uchar>(mod_y)[mod_x] == 255)
 				continue;

-			TotalE = TotalE + Spectrum1f.ptr<float>(HalfImgWidth+x)[(int)HalfImgWidth+y] ;
-
-			Counter = Counter + 1;
-
-			map1b.data[((int)(map1b.rows/2.0)+x) * map1b.cols + ((int)(map1b.cols/2.0)+y)] = 255;
-		}
-
+			TotalE	+=	Spectrum1f.ptr<float>(mod_y)[mod_x];
+			Counter+=1;
+			map1b.ptr<uchar>(mod_y)[mod_x] = 255;
+		}
 		if (Counter != 0 && TotalE != 0)
-			APS_m1f.ptr<float>(0)[p]=  (float) (TotalE / Counter);
+			APS_m1f.ptr<float>(0)[p]=  (float) (TotalE / (float)Counter);
 	}
 	#pragma endregion

+	//////////////////////////////////////////////////////////////////////////
 	#pragma region Anisotropy
-	Mat AN_m ;
-	AN_m.create(1,Number_APS,CV_32FC1);
-	AN_m.setTo(0);
-	for (int p=0; p<Number_APS; p++)
-	{
+	Mat AN_m1f ;
+	AN_m1f.create(1,Number_APS,CV_32FC1);
+	AN_m1f.setTo(0);
+	for (int p=0; p<Number_APS; p++){
 		map1b.setTo(0);
 		double TotalE = 0;
 		int Counter = 0;
 		double r = p * dr;

-		for (double theta=0; theta<360; theta+=0.1)
-		{
+		for (double theta=0; theta<360; theta+=0.1){
 			double epi = (double)theta * pi / 180.0;
 			int x = (int) floor( (r * cos(epi)) +0.5 );
 			int y = (int) floor( (r * sin(epi)) +0.5 );
-
-			if ((int)HalfImgWidth+x < 0 || (int)HalfImgWidth+x >= Spectrum1f.rows)
+			int	mod_x	=	cvRound(HalfImgWidth+x);
+			int	mod_y	=	cvRound(HalfImgWidth+y);
+
+			if (mod_x < 0 || mod_x >= Spectrum1f.rows)
 				continue;
-
-			if ((int)HalfImgWidth+y < 0 || (int)HalfImgWidth+y >= Spectrum1f.rows)
+			if (mod_y < 0 || mod_y >= Spectrum1f.rows)
 				continue;
-
-			if (map1b.data[((int)HalfImgWidth+x) * map1b.cols + ((int)HalfImgWidth+y)] == 255)
+			if (map1b.ptr<uchar>(mod_y)[mod_x] == 255)
 				continue;

-			TotalE = TotalE +
-				(APS_m1f.ptr<float>(0)[p] - Spectrum1f.ptr<float>((int)HalfImgWidth+x)[(int)HalfImgWidth+y]) *
-				(APS_m1f.ptr<float>(0)[p] - Spectrum1f.ptr<float>((int)HalfImgWidth+x)[(int)HalfImgWidth+y]);
-
-			Counter = Counter + 1;
-			map1b.data[((int)(map1b.rows/2.0)+x) * map1b.cols + ((int)(map1b.cols/2.0)+y)] = 255;
+			TotalE+=
+				(APS_m1f.ptr<float>(0)[p] - Spectrum1f.ptr<float>(mod_y)[mod_x]) *
+				(APS_m1f.ptr<float>(0)[p] - Spectrum1f.ptr<float>(mod_y)[mod_x]);
+
+			Counter+=1;
+			map1b.ptr<uchar>(mod_y)[mod_x] = 255;
 		}

 		if (Counter != 0 && TotalE != 0)
-			AN_m.ptr<float>(0)[p] = 10*log10((TotalE / (Counter-1)) / (APS_m1f.ptr<float>(0)[p]*APS_m1f.ptr<float>(0)[p]));
+			AN_m1f.ptr<float>(0)[p] = 10.*log10((TotalE / (Counter-1)) / (APS_m1f.ptr<float>(0)[p]*APS_m1f.ptr<float>(0)[p]));
 	}
 	#pragma endregion

+	//////////////////////////////////////////////////////////////////////////
+	///// copy
 	RAPSD1f = APS_m1f;
-	Anisotropy1f = AN_m;
+	Anisotropy1f = AN_m1f;

 	return true;
 }


BUG: If too many restrictions we could not even be able to construct one single serie

--- Code/IO/itkGDCMSeriesFileNames.cxx
+++ Code/IO/itkGDCMSeriesFileNames.cxx
@@ -87,9 +87,14 @@
   m_InputFileNames.clear();
   // Accessing the first serie found (assume there is at least one)
   gdcm::GdcmFileList *flist = m_SerieHelper->GetFirstCoherentFileList();
-  bool found = false;
+  if( !flist )
+    {
+    itkWarningMacro(<<"No Series can be found, make sure you restiction are not too strong");
+    return m_InputFileNames;
+    }
   if( serie != "" ) // user did not specify any sub selcection based on UID
     {
+    bool found = false;
     while(flist && !found)
       {
       if( flist->size() ) //make sure we have at leat one serie


planning: scenario dispatch for stop-sign scenarios

--- modules/planning/scenarios/scenario_manager.cc
+++ modules/planning/scenarios/scenario_manager.cc
@@ -126,8 +126,48 @@

 ScenarioConfig::ScenarioType ScenarioManager::SelectStopSignScenario(
     const Frame& frame) {
-  // TODO(all):
-  return ScenarioConfig::STOP_SIGN_UNPROTECTED;
+  const auto& reference_line_info = frame.reference_line_info().front();
+  const double adc_front_edge_s = reference_line_info.AdcSlBoundary().end_s();
+  const double stop_sign_overlap_start_s =
+      PlanningContext::GetScenarioInfo()->next_stop_sign_overlap.start_s;
+  const double adc_distance_to_stop_sign =
+      stop_sign_overlap_start_s - adc_front_edge_s;
+  ADEBUG << "adc_distance_to_stop_sign[" << adc_distance_to_stop_sign
+         << "] stop_sign_overlap_start_s[" << stop_sign_overlap_start_s << "]";
+
+  bool stop_sign = (adc_distance_to_stop_sign > 0 &&
+      adc_distance_to_stop_sign <=
+      config_map_[ScenarioConfig::STOP_SIGN_UNPROTECTED]
+                  .stop_sign_unprotected_config()
+                  .start_stop_sign_scenario_distance());
+  bool stop_sign_all_way = false;  // TODO(all)
+
+  switch (current_scenario_->scenario_type()) {
+    case ScenarioConfig::LANE_FOLLOW:
+    case ScenarioConfig::CHANGE_LANE:
+    case ScenarioConfig::SIDE_PASS:
+    case ScenarioConfig::APPROACH:
+      if (stop_sign) {
+        return stop_sign_all_way ? ScenarioConfig::STOP_SIGN_PROTECTED:
+            ScenarioConfig::STOP_SIGN_UNPROTECTED;
+      }
+      break;
+    case ScenarioConfig::STOP_SIGN_PROTECTED:
+      break;
+    case ScenarioConfig::STOP_SIGN_UNPROTECTED:
+      if (current_scenario_->GetStatus() ==
+              Scenario::ScenarioStatus::STATUS_DONE) {
+        return ScenarioConfig::LANE_FOLLOW;
+      }
+      break;
+    case ScenarioConfig::TRAFFIC_LIGHT_PROTECTED:
+    case ScenarioConfig::TRAFFIC_LIGHT_UNPROTECTED_LEFT_TURN:
+    case ScenarioConfig::TRAFFIC_LIGHT_UNPROTECTED_RIGHT_TURN:
+    default:
+      break;
+  }
+
+  return current_scenario_->scenario_type();
 }

 ScenarioConfig::ScenarioType ScenarioManager::SelectTrafficLightScenario(
@@ -258,12 +298,6 @@
     const common::TrajectoryPoint& ego_point,
     const Frame& frame) {
   CHECK(!frame.reference_line_info().empty());
-
-  if (current_scenario_->GetStatus() !=
-      Scenario::ScenarioStatus::STATUS_DONE) {
-    ADEBUG << "continue current scenario: " << current_scenario_->Name();
-    return;
-  }

   const auto& reference_line_info = frame.reference_line_info().front();
   const auto& first_encountered_overlaps =


FIX: Added error check in Solve function.

--- Code/Numerics/FEM/itkFEMSolver.cxx
+++ Code/Numerics/FEM/itkFEMSolver.cxx
@@ -747,7 +747,6 @@
  */
 void Solver::DecomposeK()
 {
-  std::cout<<"Decomposing the K\n";
 }

@@ -758,9 +757,19 @@
  */
 void Solver::Solve()
 {
-  std::cout<<"Initializing the solution vector\n";
+  // Check if master stiffness matrix and master force vector were
+  // properly initialized.
+  if(!m_ls->IsMatrixInitialized())
+  {
+    throw FEMExceptionSolution(__FILE__,__LINE__,"Solver::Solve()","Master stiffness matrix was not initialized!");
+  }
+  if(!m_ls->IsVectorInitialized())
+  {
+    throw FEMExceptionSolution(__FILE__,__LINE__,"Solver::Solve()","Master force vector was not initialized!");
+  }
+
+  // Solve the system of linear equations
   m_ls->InitializeSolution();
-  std::cout<<"Solving the system of linear equations\n";
   m_ls->Solve();
 }


BUG: Fl_Widget destructor generates one last FL_HIDE event which causes segmentation fault (maybe because the object is already in its desctruction process). Therefore we should avoid to process FL_HIDE events.

--- Code/Visualization/otbGlWidget.cxx
+++ Code/Visualization/otbGlWidget.cxx
@@ -37,7 +37,10 @@
 }

 GlWidget::~GlWidget()
-{}
+{
+  // Clear registered controller
+  m_Controller = NULL;
+}

 void GlWidget::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
@@ -123,15 +126,17 @@

 int GlWidget::handle(int event)
 {
-  // If there is a controller
-  if(m_Controller.IsNotNull())
+  // Call superclass implementation
+  int resp = Fl_Widget::handle(event);
+
+  // Check if there is a controller
+  // Avoid processing hide events, since it causes segfault (the
+  // destructor of the Fl class generates hide events).
+  if(m_Controller.IsNotNull() && event != FL_HIDE)
     {
-    return m_Controller->HandleWidgetEvent(m_Identifier,event);
+    resp = m_Controller->HandleWidgetEvent(m_Identifier,event);
     }
-  else
-    {
-    return 0;
-    }
+  return resp;
 }

 GlWidget::PointType GlWidget::GetMousePosition()


Use target in focusStep to get the scene

--- CodeReview/src/commands/CFocus.cpp
+++ CodeReview/src/commands/CFocus.cpp
@@ -60,16 +60,16 @@
 	return false;
 }

-Interaction::CommandResult* CFocus::execute(Visualization::Item*, Visualization::Item*,
+Interaction::CommandResult* CFocus::execute(Visualization::Item* source, Visualization::Item*,
 				const QStringList&, const std::unique_ptr<Visualization::Cursor>&)
 {
-	focusStep({}, {}, {});
+	focusStep(source, {}, {});
 	return new Interaction::CommandResult{};
 }

-bool CFocus::focusStep(Visualization::Item *, QKeySequence, Interaction::ActionRegistry::InputState)
+bool CFocus::focusStep(Visualization::Item* target, QKeySequence, Interaction::ActionRegistry::InputState)
 {
-	Visualization::VisualizationManager::instance().mainScene()->removeOverlayGroup("focusOverlay");
+	target->scene()->removeOverlayGroup("focusOverlay");

 	auto focusInformations = focusList_.values(currentStep_);


forgot to declare a variable in the tests

--- UseUnaryOperator.cpp
+++ UseUnaryOperator.cpp
@@ -19,12 +19,14 @@
     // input for the transformation
     std::string cpp_input =
 	"void fun() {\n"
+	"  int a = 0;\n"
         "  a += 1;\n"
 	"}\n"
     ;
     // the text that i expect to get after the transformation
     std::string cpp_output =
 	"void fun() {\n"
+	"  int a = 0;\n"
 	"  ++a;\n"
 	"}\n"
     ;


CMF: Initialize iNoteCount (#57)

CMF: Initialize iNoteCount (#57)

--- src/cmf.cpp
+++ src/cmf.cpp
@@ -421,6 +421,7 @@
 	this->bSongEnd = false;
 	this->iPlayPointer = 0;
 	this->iPrevCommand = 0; // just in case
+	this->iNoteCount = 0;

 	// Read in the number of ticks until the first event
 	this->iDelayRemaining = this->readMIDINumber();


better alignment for xalt_configuration report

--- compiled/xalt_configuration_report.C
+++ compiled/xalt_configuration_report.C
@@ -68,7 +68,7 @@
       json.add("XALT_ENABLE_BACKGROUNDING",   enable_backgrounding);
       json.add("XALT_TRANSMISSION_STYLE",     transmission);
       if (strcmp(transmission,"syslog") == 0)
-        json.add("XALT_LOGGING_TAG",          syslog_tag);
+        json.add("XALT_LOGGING_TAG",            syslog_tag);
       json.add("XALT_COMPUTE_SHA1",           computeSHA1);
       json.add("XALT_ETC_DIR",                xalt_etc_dir);
       json.add("XALT_CONFIG_PY",              XALT_CONFIG_PY);


Popagate type specialization result for Math.pow

--- lib/Backend/GlobOpt.cpp
+++ lib/Backend/GlobOpt.cpp
@@ -9597,8 +9597,7 @@
                 IR::Opnd* src2 = instr->GetSrc2();
                 this->ToInt32(instr, src2, this->currentBlock, src2Val, nullptr, lossy);

-                IR::Opnd* dst = instr->GetDst();
-                this->ToFloat64Dst(instr, dst->AsRegOpnd(), this->currentBlock);
+                TypeSpecializeFloatDst(instr, nullptr, src1Val, src2Val, pDstVal);
             }
             else
             {


correlation: provide 2.x table names to events.

--- correlation/src/main.cc
+++ correlation/src/main.cc
@@ -1,5 +1,5 @@
 /*
-** Copyright 2011-2015 Centreon
+** Copyright 2011-2016 Centreon
 **
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
@@ -116,7 +116,8 @@
                   "issue",
                   &correlation::issue::operations,
                   correlation::issue::entries,
-                  "rt_issues"));
+                  "rt_issues",
+                  "issues"));
         e.register_event(
             io::events::correlation,
             correlation::de_issue_parent,
@@ -124,7 +125,8 @@
                   "issue_parent",
                   &correlation::issue_parent::operations,
                   correlation::issue_parent::entries,
-                  "rt_issues_issues_parents"));
+                  "rt_issues_issues_parents",
+                  "issues_issues_parents"));
         e.register_event(
             io::events::correlation,
             correlation::de_log_issue,
@@ -132,7 +134,8 @@
                   "log_issue",
                   &correlation::log_issue::operations,
                   correlation::log_issue::entries,
-                  "log_logs"));
+                  "log_logs",
+                  "logs"));
       }
     }
     return ;


Added code to use X-Forwarded-Server for host for proxy'd stuff.

--- net/cpp/db/net/http/HttpConnectionServicer.cpp
+++ net/cpp/db/net/http/HttpConnectionServicer.cpp
@@ -114,9 +114,11 @@
             // set response version according to request version
             resHeader->setVersion(reqHeader->getVersion());

-            // include host path if one was used
+            // use proxy'd host field if one was used
+            // else use host field if one was used
             string host;
-            if(reqHeader->getField("Host", host))
+            if(reqHeader->getField("X-Forwarded-Server", host) ||
+               reqHeader->getField("Host", host))
             {
                resHeader->setField("Host", host);
             }


HeapEnum: Walk heap segment UCRs.

HeapEnum: Walk heap segment UCRs.

R=manzagop@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1322263002.

--- syzygy/experimental/heap_enumerate/heap_enumerate.cc
+++ syzygy/experimental/heap_enumerate/heap_enumerate.cc
@@ -227,7 +227,11 @@

   bool Initialize(HANDLE heap, TypeRepository* repo);

+  // Get an enumerator for the heap's segment list.
   ListEntryEnumerator GetSegmentEnumerator();
+
+  // Get an enumerator for a segment's UCR list.
+  ListEntryEnumerator GetUCREnumerator(const TypedData& segment);

   // Accessor to the heap.
   const TypedData& heap() const { return heap_; }
@@ -340,6 +344,23 @@
   }

   return heap_segment_enum;
+}
+
+ListEntryEnumerator HeapEnumerator::GetUCREnumerator(const TypedData& segment) {
+  TypedData ucr_list;
+  if (!segment.GetNamedField(L"UCRSegmentList", &ucr_list)) {
+    LOG(ERROR) << "No UCRSegmentList in segment.";
+    return ListEntryEnumerator();
+  }
+
+  ListEntryEnumerator ucr_list_enum;
+  if (!ucr_list_enum.Initialize(ucr_list, heap_ucr_descriptor_type_,
+                                L"SegmentEntry")) {
+    LOG(ERROR) << "Failed to initialize UCR enumerator";
+    return ListEntryEnumerator();
+  }
+
+  return ucr_list_enum;
 }

 // TODO(siggi): This thing needs two modes for de-obfuscating heap entries.
@@ -659,7 +680,9 @@
         if (!walker.GetDecodedEntry(&entry)) {
           // TODO(siggi): This currently happens on stepping into an
           //     uncommitted range - do better - but how?
-          fprintf(output_, "GetDecodedEntry failed\n");
+          fprintf(output_, "GetDecodedEntry failed @0x%08llX(%d)\n",
+                  walker.curr_entry().range().addr(),
+                  walker.curr_entry().range().size());
           break;
         }

@@ -693,5 +716,9 @@
     } else {
       LOG(ERROR) << "EnumSegment failed.";
     }
-  }
-}
+
+    ListEntryEnumerator enum_ucrs = enumerator.GetUCREnumerator(segment);
+    while (enum_ucrs.Next())
+      DumpTypedData(enum_ucrs.current_record(), 1);
+  }
+}


Base: Camera fitter: Fixes for basis not centered at zero and with rotated basises

--- modules/base/src/algorithm/camerautils.cpp
+++ modules/base/src/algorithm/camerautils.cpp
@@ -111,7 +111,7 @@
         // take the largest needed distance for all corners.
         const auto it = std::max_element(corners.begin(), corners.end(),
                                          [&](vec3 a, vec3 b) { return dist(a) < dist(b); });
-        const auto lookFrom = dist(*it) * viewDir;
+        const auto lookOffset = dist(*it) * viewDir;

         NetworkLock lock(&cam);
         if (updateNearFar == UpdateNearFar::Yes) {
@@ -120,7 +120,7 @@
         if (updateLookRanges == UpdateLookRanges::Yes) {
             setCameraLookRanges(cam, boundingBox);
         }
-        cam.setLook(lookFrom, lookTo, lookUp);
+        cam.setLook(lookTo + lookOffset, lookTo, lookUp);
     } else {
         LogWarnCustom("camerautil::setCameraView",
                       "setCameraView only supports perspective cameras");
@@ -135,7 +135,9 @@

 void setCameraView(CameraProperty &cam, const mat4 &boundingBox, Side side, float fitRatio,
                    UpdateNearFar updateNearFar, UpdateLookRanges updateLookRanges) {
-    setCameraView(cam, boundingBox, detail::getViewDir(side), detail::getLookUp(side), fitRatio,
+    const auto viewDir = mat3(boundingBox) * detail::getViewDir(side);
+    const auto lookUp = mat3(boundingBox) * detail::getLookUp(side);
+    setCameraView(cam, boundingBox, viewDir, lookUp, fitRatio,
                   updateNearFar, updateLookRanges);
 }


Trying (fruitlessly) to fix Windows builds.

--- src/condor_io/sock.cpp
+++ src/condor_io/sock.cpp
@@ -38,6 +38,7 @@

 #if defined(WIN32)
 #include <winsock2.h>
+#include <ws2def.h>
 #else
 #include <netinet/in.h>
 #endif


Missed changes in entity.cpp

Missed changes in entity.cpp

--- Projects/CoX/Common/NetStructures/Entity.cpp
+++ Projects/CoX/Common/NetStructures/Entity.cpp
@@ -616,6 +616,15 @@
     m_char.dump();
 }

+void Entity::addPosUpdate(const PosUpdate & p) {
+    m_update_idx = (m_update_idx+1) % 64;
+    m_pos_updates[m_update_idx] = p;
+}
+
+void Entity::addInterp(const PosUpdate & p) {
+    interpResults.emplace_back(p);
+}
+
 Entity::Entity()
 {
     m_logout_sent = false;


Update OrientationFilterComplementaryOpticalARG to only filter in the optical yaw since that's the only rotation component that should have drift.

--- src/psmoveservice/Filter/OrientationFilter.cpp
+++ src/psmoveservice/Filter/OrientationFilter.cpp
@@ -445,8 +445,21 @@
             optical_weight= g_weight_override;
         }

-        const Eigen::Quaternionf new_orientation =
-            eigen_quaternion_normalized_lerp(SEq_new, packet.optical_orientation, optical_weight);
+		const Eigen::EulerAnglesf optical_euler_angles = eigen_quaternionf_to_euler_angles(packet.optical_orientation);
+		const Eigen::EulerAnglesf SEeuler_new= eigen_quaternionf_to_euler_angles(packet.optical_orientation);
+
+		// Blend in the yaw from the optical orientation
+		const float blended_heading_radians=
+			wrap_lerpf(
+				SEeuler_new.get_heading_radians(),
+				optical_euler_angles.get_heading_radians(),
+				optical_weight,
+				-k_real_pi, k_real_pi);
+		const Eigen::EulerAnglesf new_euler_angles(
+			SEeuler_new.get_bank_radians(), blended_heading_radians, SEeuler_new.get_attitude_radians());
+		const Eigen::Quaternionf new_orientation =
+			eigen_euler_angles_to_quaternionf(new_euler_angles);
+
         const Eigen::Vector3f &new_angular_velocity= current_omega;
         const Eigen::Vector3f new_angular_acceleration = (current_omega - m_state->angular_velocity) / delta_time;


Fix unit tests after commit c1827f9e9cef5275b99b96705a23ad1869c90774

--- src/tests/test_master.cpp
+++ src/tests/test_master.cpp
@@ -31,6 +31,10 @@
   {}

   virtual ~NoopScheduler() {}
+
+  virtual ExecutorInfo getExecutorInfo(SchedulerDriver*) {
+    return ExecutorInfo("noexecutor", "");
+  }

   virtual void registered(SchedulerDriver*, FrameworkID fid) {
     LOG(INFO) << "NoopScheduler registered";
@@ -93,6 +97,10 @@

   virtual ~FixedResponseScheduler() {}

+  virtual ExecutorInfo getExecutorInfo(SchedulerDriver*) {
+    return ExecutorInfo("noexecutor", "");
+  }
+
   virtual void resourceOffer(SchedulerDriver* d,
                              OfferID id,
                              const vector<SlaveOffer>& offers) {


get_build_log: only dump to std::cerr on VERBOSE or DEBUG

--- lib/CL/pocl_llvm_api.cc
+++ lib/CL/pocl_llvm_api.cc
@@ -176,7 +176,10 @@
                          unsigned device_i,
                          std::stringstream &ss_build_log,
                          clang::TextDiagnosticBuffer *diagsBuffer,
-                         const SourceManager &sm) {
+                         const SourceManager &sm)
+{
+    static const bool show_log = pocl_get_bool_option("POCL_VERBOSE", 0) ||
+      pocl_get_bool_option("POCL_DEBUG", 0);

     for (TextDiagnosticBuffer::const_iterator i = diagsBuffer->err_begin(),
          e = diagsBuffer->err_end(); i != e; ++i)
@@ -195,7 +198,8 @@
                                   ss_build_log.str().c_str(),
                                   ss_build_log.str().size());

-    std::cerr << ss_build_log.str();
+    if (show_log)
+      std::cerr << ss_build_log.str();

 }


use new qmgmt interface

use new qmgmt interface

--- src/condor_prio/prio.C
+++ src/condor_prio/prio.C
@@ -37,6 +37,7 @@
 #include "condor_constants.h"
 #include "condor_debug.h"
 #include "condor_config.h"
+#include "condor_attributes.h"
 #include "filter.h"
 #include "alloc.h"

@@ -203,14 +204,14 @@
 void UpdateJobAd(int cluster, int proc)
 {
 	int old_prio, new_prio;
-	if (GetAttributeInt(cluster, proc, "Prio", &old_prio) < 0)
+	if (GetAttributeInt(cluster, proc, ATTR_JOB_PRIO, &old_prio) < 0)
 	{
 		fprintf(stderr, "Couldn't retrieve current prio for %d.%d.\n",
 				cluster, proc);
 		return;
 	}
 	new_prio = calc_prio( old_prio );
-	SetAttributeInt(cluster, proc, "Prio", new_prio);
+	SetAttributeInt(cluster, proc, ATTR_JOB_PRIO, new_prio);
 }

 void ProcArg(const char* arg)
@@ -230,14 +231,18 @@
 		if(*tmp == '\0')
 		// update prio for all jobs in the cluster
 		{
-			int next_cluster = cluster;
-			proc = -1;
-			while(next_cluster == cluster) {
-				if (GetNextJob(cluster, proc, &next_cluster, &proc) < 0) {
-					return;
-				}
+			ClassAd	*ad = new ClassAd;
+			char constraint[100];
+			sprintf(constraint, "%s == %d", ATTR_CLUSTER_ID, cluster);
+			int firstTime = 1;
+			while(GetNextJobByConstraint(constraint, ad, firstTime) >= 0) {
+				ad->LookupInteger(ATTR_PROC_ID, proc);
+				delete ad;
+				ad = new ClassAd;
 				UpdateJobAd(cluster, proc);
+				firstTime = 0;
 			}
+			delete ad;
 			return;
 		}
 		if(*tmp == '.')
@@ -259,27 +264,38 @@
 		}
 		fprintf(stderr, "Warning: unrecognized \"%s\" skipped\n", arg);
 	}
-	else if(isalpha(*arg) || (arg[0] == '-' && arg[1] == 'a'))
+	else if(arg[0] == '-' && arg[1] == 'a')
+	{
+		ClassAd *ad = new ClassAd;
+		int firstTime = 1;
+		while(GetNextJob(ad, firstTime) >= 0) {
+			ad->LookupInteger(ATTR_CLUSTER_ID, cluster);
+			ad->LookupInteger(ATTR_PROC_ID, proc);
+			delete ad;
+			ad = new ClassAd;
+			UpdateJobAd(cluster, proc);
+			firstTime = 0;
+		}
+		delete ad;
+	}
+	else if(isalpha(*arg))
 	// update prio by user name
 	{
-		char	owner[1000];
-
-		cluster = proc = -1;
-		while (GetNextJob(cluster, proc, &cluster, &proc) >= 0) {
-			if (arg[0] == '-' && arg[1] == 'a') {
-				UpdateJobAd(cluster, proc);
-			}
-			else {
-				if (GetAttributeString(cluster, proc, "Owner", owner) < 0) {
-					fprintf(stderr, "Couldn't retrieve owner attribute for "
-							"%d.%d\n", cluster, proc);
-					return;
-				}
-				if (strcmp(owner, arg) == MATCH) {
-					UpdateJobAd(cluster, proc);
-				}
-			}
-		}
+		char	constraint[100];
+		ClassAd	*ad = new ClassAd;
+		int firstTime = 1;
+
+		sprintf(constraint, "%s == \"%s\"", ATTR_OWNER, arg);
+
+		while (GetNextJobByConstraint(constraint, ad, firstTime) >= 0) {
+			ad->LookupInteger(ATTR_CLUSTER_ID, cluster);
+			ad->LookupInteger(ATTR_PROC_ID, proc);
+			delete ad;
+			ad = new ClassAd;
+			UpdateJobAd(cluster, proc);
+			firstTime = 0;
+		}
+		delete ad;
 	}
 	else
 	{


Making mac build happy...

Making mac build happy...

--- src/python/lib/graph/rag/graph_accumulator.cxx
+++ src/python/lib/graph/rag/graph_accumulator.cxx
@@ -169,7 +169,8 @@
                 py::class_<NodeMapType>(ragModule, "DefaultAccNodeMapUndirectedGraph")
                     // move implementation to grid_rag_features.hxx instead?
                     .def("getFeatureMatrix",[](NodeMapType * self){
-                            marray::PyView<double> featMat({self->numberOfNodes(),self->numberOfFeatures()});
+                            size_t shape[] = {self->numberOfNodes(),self->numberOfFeatures()};
+                            marray::PyView<double> featMat(shape, shape+2);
                             for(size_t n = 0; n < self->numberOfNodes(); n++) {
                                 double feats[self->numberOfFeatures()];
                                 self->getFeatures(n, feats);


Monitor chrome::NOTIFICATION_SESSION_STARTED instead of NOTIFICATION_PROFILE_CREATED.

It seems that observing NOTIFICATION_PROFILE_CREATED is currently not working fine because:
- When a user logs in, the chrome::NOTIFICATION_PROFILE_CREATED notification is sent to the browser twice, one is with StatusAreaViewChromeos::IsLoginMode(), the other is with IsBrowserMode().
- When a new user is added, the chrome::NOTIFICATION_PROFILE_CREATED notification is sent to the browser twice both with StatusAreaViewChromeos::IsLoginMode().

This CL changes the notification type to watch to NOTIFICATION_SESSION_STARTED because when the notification is sent, it is guaranteed that IsBrowserMode() always returns true.

BUG=chromium-os:26542
TEST=see the bug

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

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

--- chrome/browser/chromeos/status/input_method_menu.cc
+++ chrome/browser/chromeos/status/input_method_menu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

@@ -163,12 +163,15 @@
                    chrome::NOTIFICATION_LOGIN_USER_CHANGED,
                    content::NotificationService::AllSources());
 #if defined(USE_AURA)
-    // On Aura status area is not recreated on sign in.
+    // On Aura status area is not recreated on sign in. Instead, 2 notifications
+    // are sent to Chrome on sign in: NOTIFICATION_LOGIN_USER_CHANGED with
+    // StatusAreaViewChromeos::IsLoginMode() and NOTIFICATION_SESSION_STARTED
+    // with StatusAreaViewChromeos::IsBrowserMode().
     // In case of Chrome crash, Chrome will be reloaded but IsLoginMode() will
-    // return false at this point so NOTIFICATION_PROFILE_CREATED will be
+    // return false at this point so NOTIFICATION_SESSION_STARTED will be
     // ignored and all initialization will happen in ctor.
     registrar_.Add(this,
-                   chrome::NOTIFICATION_PROFILE_CREATED,
+                   chrome::NOTIFICATION_SESSION_STARTED,
                    content::NotificationService::AllSources());
 #endif
   }
@@ -413,6 +416,7 @@
   UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
 }

+// TODO(yusukes): Move code for handling preferences to chromeos/input_method/.
 void InputMethodMenu::PreferenceUpdateNeeded(
     InputMethodManager* manager,
     const input_method::InputMethodDescriptor& previous_input_method,
@@ -706,11 +710,12 @@
     RemoveObservers();
   }
 #if defined(USE_AURA)
-  if (type == chrome::NOTIFICATION_PROFILE_CREATED) {
-    // On Aura status area is not recreated on login for normal user sign in.
-    // NOTIFICATION_LOGIN_USER_CHANGED has been notified early in login process.
+  if (type == chrome::NOTIFICATION_SESSION_STARTED) {
     InitializePrefMembers();
     AddObservers();
+    InputMethodManager* manager = InputMethodManager::GetInstance();
+    UpdateUIFromInputMethod(manager->current_input_method(),
+                            manager->GetNumActiveInputMethods());
   }
 #endif
 }


Crash Fix - If the database has no default value for custom permissions, the app crashes

--- ghost++/ghost/ghost.cpp
+++ ghost++/ghost/ghost.cpp
@@ -2154,6 +2154,9 @@
 	for( vector<permission> :: iterator j = (*i)->m_Permissions.begin( ); j != (*i)->m_Permissions.end( ); ++j ) {
             if( j->player == name ) {
 		string bin = j->binaryPermissions;
+		if(bin.size()==0) {
+		  return false;
+		}
 		if(    (command=="ping" && bin.substr(0,1) == "1" )
 		    || (command=="from" && bin.substr(1,1) == "1" )
                     || (command=="drop" && bin.substr(2,1) == "1" )


Pass target triple to setLangDefaults for LLVM 3.9

--- lib/CL/pocl_llvm_api.cc
+++ lib/CL/pocl_llvm_api.cc
@@ -370,8 +370,14 @@
     }

   LangOptions *la = pocl_build.getLangOpts();
+#ifdef LLVM_OLDER_THAN_3_9
   pocl_build.setLangDefaults
     (*la, clang::IK_OpenCL, clang::LangStandard::lang_opencl12);
+#else
+  llvm::Triple triple(device->llvm_target_triplet);
+  pocl_build.setLangDefaults
+    (*la, clang::IK_OpenCL, triple, clang::LangStandard::lang_opencl12);
+#endif

   // LLVM 3.3 and older do not set that char is signed which is
   // defined by the OpenCL C specs (but not by C specs).