Entity: Switched detection of ground to use g_BlockIsSolid global variable.

git-svn-id: ffe80d23790c2318db4f9b6ad70c6163efa9c8e4@1499 0a769ca7-a7f5-676a-18bf-c427514a06d6

--- source/Entity.cpp
+++ source/Entity.cpp
@@ -225,12 +225,12 @@
 		int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
 		int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
 		BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
-		if( BlockIn == E_BLOCK_AIR || IsBlockWater(BlockIn) || BlockIn == E_BLOCK_FIRE || IsBlockLava(BlockIn) ) // If not in ground itself or in water or in fire or in lava
+		if(!g_BlockIsSolid[BlockIn]) // Making sure we are not inside a solid block
 		{
 			if( m_bOnGround ) // check if it's still on the ground
 			{
 				BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
-				if(BlockBelow == E_BLOCK_AIR || IsBlockWater(BlockBelow) || BlockBelow == E_BLOCK_FIRE || IsBlockLava(BlockBelow)) //Check if block below is air or water.
+				if(!g_BlockIsSolid[BlockBelow]) //Check if block below is air or water.
 				{
 					m_bOnGround = false;
 				}
@@ -238,19 +238,11 @@
 		}
 		else
 		{
-			if (BlockIn == E_BLOCK_COBWEB)
-			{
-				NextSpeed.x *= 0.25;
-				NextSpeed.z *= 0.25;
-			}
-			else
-			{
-				//Push out entity.
-				m_bOnGround = true;
-				NextPos.y += 0.2;
-				LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
-					m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
-			}
+			//Push out entity.
+			m_bOnGround = true;
+			NextPos.y += 0.2;
+			LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
+				m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
 		}

 		if (!m_bOnGround)
@@ -283,7 +275,15 @@
 				if ( fabs(NextSpeed.z) < 0.05 ) NextSpeed.z = 0;
 			}
 		}
-
+
+		//Adjust X and Z speed for COBWEB temporary. This speed modification should be handled inside block handlers since we
+		//might have different speed modifiers according to terrain.
+		if (BlockIn == E_BLOCK_COBWEB)
+		{
+			NextSpeed.x *= 0.25;
+			NextSpeed.z *= 0.25;
+		}
+
 		//Get water direction
 		Direction WaterDir = m_World->GetWaterSimulator()->GetFlowingDirection(BlockX, BlockY, BlockZ);


Mark FindNextInNewTabUsesPrepopulate as FLAKY on Mac

TEST=less redness
BUG=43070

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

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

--- chrome/browser/find_bar_host_browsertest.cc
+++ chrome/browser/find_bar_host_browsertest.cc
@@ -666,6 +666,12 @@
   EXPECT_EQ(position.x(), start_position.x());
 }

+#if defined(OS_MACOSX)
+// FindNextInNewTabUsesPrepopulate is flaky, at least on Mac.
+// See http://crbug.com/43070
+#define FindNextInNewTabUsesPrepopulate FLAKY_FindNextInNewTabUsesPrepopulate
+#endif
+
 // Make sure F3 in a new tab works if Find has previous string to search for.
 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
                        FindNextInNewTabUsesPrepopulate) {


shortcuts: translate Ctrl to Meta on macOS in default config

--- src/vconfigmanager.cpp
+++ src/vconfigmanager.cpp
@@ -1034,6 +1034,13 @@

     m_shortcuts.clear();
     m_shortcuts = readShortcutsFromSettings(defaultSettings, group);
+
+#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
+    // Translate Ctrl to Meta on macOS.
+    for (auto it = m_shortcuts.begin(); it != m_shortcuts.end(); ++it) {
+        it.value().replace("Ctrl", "Meta", Qt::CaseInsensitive);
+    }
+#endif

     // Update default settings according to user settings.
     QHash<QString, QString> userShortcuts = readShortcutsFromSettings(userSettings,


porting to linux

porting to linux

--- cc/mapi.cc
+++ cc/mapi.cc
@@ -1,4 +1,5 @@
 #include <unistd.h>
+#include <signal.h>

 #include "acmacs-base/argv.hh"
 #include "acmacs-base/temp-file.hh"


fix rpc amounts

fix rpc amounts

--- src/rpc/util.cpp
+++ src/rpc/util.cpp
@@ -75,7 +75,7 @@
     if (!value.isNum() && !value.isStr())
         throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
     CAmount amount;
-    if (!ParseFixedPoint(value.getValStr(), 8, &amount))
+    if (!ParseFixedPoint(value.getValStr(), 6, &amount))
         throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
     if (!MoneyRange(amount))
         throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");


Remove extraneous character from printf inside the TCC module.

--- modules/tcc/Module.cpp
+++ modules/tcc/Module.cpp
@@ -387,7 +387,7 @@

     SetConsoleTextAttribute(hstdout, csb_before.wAttributes);
 #else
-    printf("%c[0;32m[SQMOD]%c[0;37m", 27, 27, msg);
+    printf("%c[0;32m[SQMOD]%c[0;37m", 27, 27);
     vprintf(msg, args);
     puts("");
 #endif
@@ -410,7 +410,7 @@

     SetConsoleTextAttribute(hstdout, csb_before.wAttributes);
 #else
-    printf("%c[0;32m[SQMOD]%c[0;37m", 27, 27, msg);
+    printf("%c[0;32m[SQMOD]%c[0;37m", 27, 27);
     vprintf(msg, args);
     puts("");
 #endif


fix EMBPD00160213 for CE7 devices

fix EMBPD00160213 for CE7 devices

--- platform/wm/rhodes/browser/CEBrowserEngine.cpp
+++ platform/wm/rhodes/browser/CEBrowserEngine.cpp
@@ -817,15 +817,12 @@
         if (RHODESAPP().getExtManager().onWndMsg(msg) )
             continue;

-		if (msg.message == WM_MOUSEFIRST)
-		{
-			bool m_bFullScreen = RHOCONF().getBool("full_screen");
-
-			if (m_bFullScreen)
-			{
-				HWND taskbarWnd = FindWindow(L"HHTaskBar", NULL);
-				ShowWindow(taskbarWnd, SW_HIDE);
-			}
+		bool m_bFullScreen = RHOCONF().getBool("full_screen");
+
+		if (m_bFullScreen)
+		{
+			HWND taskbarWnd = FindWindow(L"HHTaskBar", NULL);
+			ShowWindow(taskbarWnd, SW_HIDE);
 		}

 		if (msg.message == WM_KEYDOWN && msg.wParam != VK_BACK)	//  Run Browser TranslateAccelerator


Don't re-request erased object requests

Don't re-request erased object requests

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -363,6 +363,7 @@

 // Keeps track of the time (in microseconds) when transactions were requested last time
 unordered_limitedmap<uint256, int64_t, StaticSaltedHasher> g_already_asked_for(MAX_INV_SZ, MAX_INV_SZ * 2);
+unordered_limitedmap<uint256, int64_t, StaticSaltedHasher> g_erased_object_requests(MAX_INV_SZ, MAX_INV_SZ * 2);

 /** Map maintaining per-node state. Requires cs_main. */
 std::map<NodeId, CNodeState> mapNodeState;
@@ -662,6 +663,7 @@
 {
     AssertLockHeld(cs_main);
     g_already_asked_for.erase(hash);
+    g_erased_object_requests.insert(std::make_pair(hash, GetTimeMillis()));
 }

 int64_t GetObjectRequestTime(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
@@ -4297,6 +4299,11 @@
             // Erase this entry from tx_process_time (it may be added back for
             // processing at a later time, see below)
             tx_process_time.erase(tx_process_time.begin());
+            if (g_erased_object_requests.count(inv.hash)) {
+                state.m_tx_download.m_tx_announced.erase(inv);
+                state.m_tx_download.m_tx_in_flight.erase(inv);
+                continue;
+            }
             if (!AlreadyHave(inv)) {
                 // If this transaction was last requested more than 1 minute ago,
                 // then request.


Fixed player swimstate crash.

Fixed player swimstate crash.

The check for swimming / submersion checks the Y coord first. Fixes #63.

--- source/Player.cpp
+++ source/Player.cpp
@@ -1322,7 +1322,7 @@

-void cPlayer::UseEquippedItem()
+void cPlayer::UseEquippedItem(void)
 {
 	if (GetGameMode() == gmCreative)  // No damage in creative
 	{
@@ -1332,29 +1332,39 @@
 	GetInventory().DamageEquippedItem();
 }

+
+
+
+
 void cPlayer::SetSwimState(cChunk & a_Chunk)
 {
-
+	int RelY = (int)floor(m_LastPosY + 0.1);
+	if ((RelY < 0) || (RelY >= cChunkDef::Height))
+	{
+		m_IsSwimming = false;
+		m_IsSubmerged = false;
+		return;
+	}
+
 	BLOCKTYPE BlockIn;
 	int RelX = (int)floor(m_LastPosX) - a_Chunk.GetPosX() * cChunkDef::Width;
-	int RelY = (int)floor(m_LastPosY + 0.1);
 	int RelZ = (int)floor(m_LastPosZ) - a_Chunk.GetPosZ() * cChunkDef::Width;

-	// first we check if the player is swimming
-
+	// Check if the player is swimming:
 	// Use Unbounded, because we're being called *after* processing super::Tick(), which could have changed our chunk
 	VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockIn));
-
 	m_IsSwimming = IsBlockWater(BlockIn);

-	// now we check if the player is submerged
-
-	VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY+1, RelZ, BlockIn));
-
+	// Check if the player is submerged:
+	VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY + 1, RelZ, BlockIn));
 	m_IsSubmerged = IsBlockWater(BlockIn);
 }

-void cPlayer::HandleAir()
+
+
+
+
+void cPlayer::HandleAir(void)
 {
 	// Ref.: http://www.minecraftwiki.net/wiki/Chunk_format
 	// see if the player is /submerged/ water (block above is water)
@@ -1363,27 +1373,36 @@
 	if (IsSubmerged())
 	{
 		// either reduce air level or damage player
-		if(m_AirLevel < 1)
-		{
-			if(m_AirTickTimer < 1)
+		if (m_AirLevel < 1)
+		{
+			if (m_AirTickTimer < 1)
 			{
 				// damage player
 				TakeDamage(dtDrowning, NULL, 1, 1, 0);
 				// reset timer
 				m_AirTickTimer = DROWNING_TICKS;
-			}else{
+			}
+			else
+			{
 				m_AirTickTimer -= 1;
 			}
-		}else{
+		}
+		else
+		{
 			// reduce air supply
 			m_AirLevel -= 1;
 		}
-	}else{
+	}
+	else
+	{
 		// set the air back to maximum
 		m_AirLevel = MAX_AIR_LEVEL;
 		m_AirTickTimer = DROWNING_TICKS;
 	}
 }
+
+
+

 void cPlayer::HandleFood(void)


Don't keep unfiltered read bytes around in the PassiveLogCollector.

BUG=81003
TEST=none

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

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

--- chrome/browser/net/passive_log_collector.cc
+++ chrome/browser/net/passive_log_collector.cc
@@ -460,8 +460,10 @@
   }

   // Don't keep read bytes around in the log, to save memory.
-  if (entry.type == net::NetLog::TYPE_URL_REQUEST_JOB_FILTERED_BYTES_READ)
+  if (entry.type == net::NetLog::TYPE_URL_REQUEST_JOB_BYTES_READ ||
+      entry.type == net::NetLog::TYPE_URL_REQUEST_JOB_FILTERED_BYTES_READ) {
     return ACTION_NONE;
+  }

   AddEntryToSourceInfo(entry, out_info);


tools: Make cgltf dependency optional for now

Not sure if we should add cgltf as a submodule or just embed it, so for
now let's make it unnecessary to compile lodviewer.

--- tools/lodviewer.cpp
+++ tools/lodviewer.cpp
@@ -11,8 +11,10 @@

 #include <GLFW/glfw3.h>

+#ifdef GLTF
 #define CGLTF_IMPLEMENTATION
 #include "cgltf.h"
+#endif

 #ifdef _WIN32
 #pragma comment(lib, "opengl32.lib")
@@ -107,6 +109,7 @@
 	return result;
 }

+#ifdef GLTF
 cgltf_accessor* getAccessor(const cgltf_attribute* attributes, size_t attribute_count, cgltf_attribute_type type, int index = 0)
 {
 	for (size_t i = 0; i < attribute_count; ++i)
@@ -125,7 +128,7 @@
 	return reinterpret_cast<const T*>(&buffer[offset]);
 }

-Mesh parseGltfC(const char* path)
+Mesh parseGltf(const char* path)
 {
 	cgltf_options options = {};
 	cgltf_data* data = 0;
@@ -271,14 +274,17 @@

 	return result;
 }
+#endif

 Mesh loadMesh(const char* path)
 {
 	if (strstr(path, ".obj"))
 		return parseObj(path);

+#ifdef GLTF
 	if (strstr(path, ".gltf") || strstr(path, ".glb"))
-		return parseGltfC(path);
+		return parseGltf(path);
+#endif

 	return Mesh();
 }


adapt to ptree change in boost 1.56 - closes #2365

Conflicts:
	src/save_map.cpp

--- src/save_map.cpp
+++ src/save_map.cpp
@@ -49,6 +49,7 @@
 // boost
 #include <boost/algorithm/string.hpp>
 #include <boost/optional.hpp>
+#include <boost/version.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>

@@ -688,7 +689,11 @@
 {
     ptree pt;
     serialize_map(pt,map,explicit_defaults);
-    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings(' ', 2));
+#if BOOST_VERSION >= 105600
+    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',2));
+#else
+    write_xml(filename,pt,std::locale(),boost::property_tree::xml_writer_make_settings(' ',2));
+#endif
 }

 std::string save_map_to_string(Map const& map, bool explicit_defaults)
@@ -696,7 +701,11 @@
     ptree pt;
     serialize_map(pt,map,explicit_defaults);
     std::ostringstream ss;
-    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings(' ', 2));
+#if BOOST_VERSION >= 105600
+    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ',2));
+#else
+    write_xml(ss,pt,boost::property_tree::xml_writer_make_settings(' ',2));
+#endif
     return ss.str();
 }


Commented out for testing

Commented out for testing

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -3700,7 +3700,7 @@
                 }
             }

-            vInv.reserve(std::max<size_t>(pto->vInventoryMNToSend.size(), INVENTORY_BROADCAST_MAX));
+            /*vInv.reserve(std::max<size_t>(pto->vInventoryMNToSend.size(), INVENTORY_BROADCAST_MAX));
             // Add other invs
             for (const CInv& inv : pto->vInventoryMNToSend) {
                 vInv.push_back(CInv(inv.type, inv.hash));
@@ -3709,7 +3709,7 @@
                     vInv.clear();
                 }
             }
-            pto->vInventoryMNToSend.clear();
+            pto->vInventoryMNToSend.clear();*/
         }
         if (!vInv.empty())
             connman->PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv));


initialized plcVertex and plcFaces using rply library

--- cdtGen.cpp
+++ cdtGen.cpp
@@ -1,5 +1,8 @@
 #include <CGAL/Linear_cell_complex.h>
 #include <CGAL/Delaunay_triangulation_3.h>
+#include "rply.h"
+
+

 using namespace std;

@@ -8,23 +11,97 @@
 typedef CGAL::Delaunay_triangulation_3 Delaunay;

 // PLC:
-map <unsigned, Point> PLCvertices; // mapping between vertex coordinates and corresponding unique id
-list <unsigned, unsigned, unsigned> PLCfaces; // contains ids of vertices/points making the triangle
+map <unsigned, Point> plcVertices; // mapping between vertex coordinates and corresponding unique id
+list <unsigned, unsigned, unsigned> plcFaces; // contains ids of vertices/points making the triangle

 // Delaunay tetrahedralization:
 Delaunay DT;

 // CDT: output mesh:
-map <unsigned, Point> CDTvertices;
-list <unsigned, unsigned, unsigned, unsigned> CDTtets; // contains ids of vertices making tetrahedron
+map <unsigned, Point> cdtVertices;
+list <unsigned, unsigned, unsigned, unsigned> cdtTets; // contains ids of vertices making tetrahedron
+
+
+static unsigned tempPoint[3];
+unsigned int dimensionId = 0;
+static unsigned pointId = 0;
+
+static tempFace[3];
+
+
+
+void vertex_cb(p_ply_argument argument)
+{
+	long eol;
+	ply_get_argument_user_data(argument, NULL, &eol);
+	tempPoint[dimensionId++] = ply_get_argument_value(argument);
+
+	// insert the vertex into plcVertex
+	if (strcmp(argument.element.name, 'z'))
+	{
+		plcVertex.push(pointId++, Point(tempPoint[0],tempPoint[1],tempPoint[2]));
+		dimensionId = 0;
+	}
+}
+
+
+
+
+void face_cb(p_ply_argument argument)
+{
+	long length, value_index;
+	ply_get_argument_property(argument, NULL, &length, &value_index);
+        switch (value_index)
+	{
+        	case 0:
+	        case 1:
+        		tempFace[pointId++] = ply_get_argument_value(argument);
+	                break;
+        	case 2:
+                	tempFace[pointId] = ply_get_argument_value(argument);
+			pointId = 0;
+			plcFaces.push(tempFace[0], tempFace[1], tempFace[2]);
+	                break;
+        	default:
+                	cout << "Invalid number of points in a face specified :(";
+			break;
+        }
+
+}
+
+
+

 // reads input PLC
 void readPLCInput()
 {
 	// read PLY file(assumed to contain the PLC)
-    	// initialize inputVertices
-    	// initialize inputFaces
+	string fileName;
+
+	cout << "Please enter input filename";
+	cin >> fileName;
+
+	p_ply inputPLY = ply_open(fileName);
+
+	if (!inputPLY) return 1;
+
+        if (!ply_read_header(inputPLY)) return 1;
+
+	if (!read_ply(inputPLY))
+	{
+		cout << "Cannot read the PLY file :(";
+		exit(0);
+	}
+
+	// Initialize plcVertex and plcFaces
+  	ply_set_read_cb(ply, "vertex", "x", vertex_cb, NULL, 0);
+	ply_set_read_cb(ply, "vertex", "y", vertex_cb, NULL, 0);
+	ply_set_read_cb(ply, "vertex", "z", vertex_cb, NULL, 0);
+
+	ply_set_read_cb(ply, "face", "vertex_indices", face_cb, NULL, 0);
+
+	inputPLY.close();

 }

@@ -37,7 +114,7 @@
 	for (map<unsigned, Point>::iterator pit = PLCvertices.begin(); pit != PLCvertices.end(); pit++)
 		tempPointList.push(PLCvertices.find(i)->second);

-    	DT.insert(tempPointList.begin(). tempPointList.end());
+    	DT.insert(tempPointList.begin(), tempPointList.end());
 }

 // removes local degeneracies from Delaunay tetrahedralization


Added bone transform caching for temp objects (no temp bones yet).

git-svn-id: 835ae83eb00d9297d8f1e21144e3a107e9f377fd@54 f69afed9-71f0-c812-a9e8-761ac3947e42

--- source/SCMLpp.cpp
+++ source/SCMLpp.cpp
@@ -2508,6 +2508,23 @@

 void Entity::draw_simple_object(float x, float y, float angle, float scale_x, float scale_y, Animation::Mainline::Key::Object* obj)
 {
+    //SDL_Color green = {0, 255, 0, 255};
+    //SDL_Color blue = {0, 0, 255, 255};
+
+    // Get parent bone transform
+    Transform parent_transform;
+
+    if(obj->parent < 0)
+    {
+        parent_transform = bone_transform_state.base_transform;
+    }
+    else
+    {
+        parent_transform = bone_transform_state.transforms[obj->parent];
+    }
+
+
+
     // 'spin' is based on what you are coming from (key1)
     float angle_i = obj->angle;
     float scale_x_i = obj->scale_x;
@@ -2517,69 +2534,16 @@
     float r_x = obj->x;
     float r_y = obj->y;

-    // Get parent bone hierarchy
-    list<Animation::Timeline::Key*> parents;
-    // Go through all the parents
-    // TODO: Get the right parentage
-    /*for(Animation::Mainline::Key::Bone_Ref* bone_ref = data->getBoneRef(entity, animation, ref1->key, ref1->parent); bone_ref != NULL; bone_ref = data->getBoneRef(entity, animation, ref1->key, bone_ref->parent))
-    {
-        Animation::Timeline::Key* k = data->getTimelineKey(entity, animation, bone_ref->timeline, bone_ref->key);
-        if(k == NULL || k->has_object)
-            break;
-
-        parents.push_front(k);
-    }*/
-
-
-    //SDL_Color green = {0, 255, 0, 255};
-    //SDL_Color blue = {0, 0, 255, 255};
-
-    float parent_x = 0.0f;
-    float parent_y = 0.0f;
-    float parent_angle = angle;
-    float parent_scale_x = scale_x;
-    float parent_scale_y = scale_y;
-    list<Animation::Timeline::Key*>::iterator b_key = parents.begin();
-
-    while(b_key != parents.end())
-    {
-        Animation::Timeline::Key::Bone* bone = &(*b_key)->bone;
-
-        // The transforms are definitely composed without matrices.  Evidence: Rotation does not affect scaling direction.
-        // However, the positioning is affected by rotation.
-
-        float bx = bone->x * parent_scale_x;
-        float by = bone->y * parent_scale_y;
-        rotate_point(bx, by, parent_angle, parent_x, parent_y);
-
-        float angle_b = bone->angle;
-
-        parent_angle += angle_b;
-        parent_x = bx;
-        parent_y = by;
-
-        // debug draw bone
-        /*GPU_Line(screen, x + parent_x, y + parent_y, x + parent_x + 50*cos(parent_angle*M_PI/180), y + parent_y + 50*sin(parent_angle*M_PI/180), green);
-        GPU_Circle(screen, x + bx, y + by, 5, blue);*/
-        parent_scale_x *= bone->scale_x;
-        parent_scale_y *= bone->scale_y;
-
-        b_key++;
-    }
-
-
-
-

     // Transform the sprite by the parent transform.
-    r_x *= parent_scale_x;
-    r_y *= parent_scale_y;
-    rotate_point(r_x, r_y, parent_angle, parent_x, parent_y);
-
-    angle_i += parent_angle;
-    scale_x_i *= parent_scale_x;
-    scale_y_i *= parent_scale_y;
+    r_x *= parent_transform.scale_x;
+    r_y *= parent_transform.scale_y;
+    rotate_point(r_x, r_y, parent_transform.angle, parent_transform.x, parent_transform.y);
+
+    angle_i += parent_transform.angle;
+    scale_x_i *= parent_transform.scale_x;
+    scale_y_i *= parent_transform.scale_y;

     // debug draw transform from parent
     /*SDL_Color orange = {255, 168, 0, 255};


コメントを追加

コメントを追加

--- src/schedule.cpp
+++ src/schedule.cpp
@@ -517,6 +517,7 @@
 		NextWait += Vint[VintCnt++];
 		if( VintCnt >= VSYNC_HZ ){
 			VintCnt -= VSYNC_HZ;
+			// １秒間に１回は強制的に画面を更新
 			EnableScrUpdate = 1;
 		}
 		ti->WaitReset();


test for nodup and dupsort trees in the same file. addresses #333

git-svn-id: 4b2652e19d8125fd9d24eff55f31fd1beb5a42e7@2099 c7de825b-a66e-492c-adef-691d508d4ae1

--- cxx/tests/db_create.cpp
+++ cxx/tests/db_create.cpp
@@ -1,7 +1,7 @@
 #include <assert.h>
 #include <db_cxx.h>

-int dbcreate(char *dbfile, char *dbname, int argc, char *argv[]) {
+int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *argv[]) {
     int r;
 #if USE_ENV
     DbEnv *env = new DbEnv(DB_CXX_NO_EXCEPTIONS);
@@ -10,6 +10,8 @@
     DbEnv *env = 0;
 #endif
     Db *db = new Db(env, DB_CXX_NO_EXCEPTIONS);
+    r = db->set_flags(dbflags);
+    assert(r == 0);
     r = db->open(0, dbfile, dbname, DB_BTREE, DB_CREATE, 0777);
     assert(r == 0);

@@ -33,12 +35,13 @@
 }

 int usage() {
-    printf("db_create [-s DBNAME] DBFILE [KEY VAL]*\n");
+    printf("db_create [-s DBNAME] [-D] [-S] DBFILE [KEY VAL]*\n");
     return 1;
 }

 int main(int argc, char *argv[]) {
     char *dbname = 0;
+    int dbflags = 0;

     int i;
     for (i=1; i<argc; i++) {
@@ -46,10 +49,17 @@
         if (0 == strcmp(arg, "-h") || 0 == strcmp(arg, "--help"))
             return usage();
         if (0 == strcmp(arg, "-s")) {
-            i++;
-            if (i >= argc)
+            if (i+1 >= argc)
                 return usage();
-            dbname = argv[i];
+            dbname = argv[++i];
+            continue;
+        }
+        if (0 == strcmp(arg, "-D")) {
+            dbflags += DB_DUP;
+            continue;
+        }
+        if (0 == strcmp(arg, "-S")) {
+            dbflags += DB_DUPSORT;
             continue;
         }
         break;
@@ -58,6 +68,6 @@
     if (i >= argc)
         return usage();
     char *dbfile = argv[i++];
-    return dbcreate(dbfile, dbname, argc-i, &argv[i]);
+    return dbcreate(dbfile, dbname, dbflags, argc-i, &argv[i]);
 }


sync: temp fix for ShowErrorUI

sync: temp fix for ShowErrorUI

If there's an auth error, and the user clicks a signin link, show the login dialog straight away.
Before this, the code would make a generic "ShowSetup" call with "NONFATAL_ERROR", resulting
in infinite spin.

BUG=91286, 92265
TEST=change gaia password for active sync account that is ASP enabled. observe error in UI, sign back in. dialog should dismiss on success.

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

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

--- chrome/browser/sync/profile_sync_service.cc
+++ chrome/browser/sync/profile_sync_service.cc
@@ -830,7 +830,10 @@
     return;
   }

-  ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR);
+  if (last_auth_error_.state() != AuthError::NONE)
+    ShowLoginDialog();
+  else
+    ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR);
 }

 void ProfileSyncService::ShowConfigure(bool sync_everything) {


Split up importaddress into helper functions

--- src/wallet/rpcdump.cpp
+++ src/wallet/rpcdump.cpp
@@ -146,6 +146,26 @@
     return NullUniValue;
 }

+void ImportScript(const CScript& script)
+{
+    if (::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
+        throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
+
+    pwalletMain->MarkDirty();
+
+    if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script))
+        throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");
+}
+
+void ImportAddress(const CBitcoinAddress& address, const string& strLabel)
+{
+    CScript script = GetScriptForDestination(address.Get());
+    ImportScript(script, false);
+    // add to address book or update label
+    if (address.IsValid())
+        pwalletMain->SetAddressBook(address.Get(), strLabel, "receive");
+}
+
 UniValue importaddress(const UniValue& params, bool fHelp)
 {
     if (!EnsureWalletIsAvailable(fHelp))
@@ -172,20 +192,6 @@
     if (fPruneMode)
         throw JSONRPCError(RPC_WALLET_ERROR, "Importing addresses is disabled in pruned mode");

-    LOCK2(cs_main, pwalletMain->cs_wallet);
-
-    CScript script;
-
-    CBitcoinAddress address(params[0].get_str());
-    if (address.IsValid()) {
-        script = GetScriptForDestination(address.Get());
-    } else if (IsHex(params[0].get_str())) {
-        std::vector<unsigned char> data(ParseHex(params[0].get_str()));
-        script = CScript(data.begin(), data.end());
-    } else {
-        throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address or script");
-    }
-
     string strLabel = "";
     if (params.size() > 1)
         strLabel = params[1].get_str();
@@ -195,28 +201,23 @@
     if (params.size() > 2)
         fRescan = params[2].get_bool();

+
+    LOCK2(cs_main, pwalletMain->cs_wallet);
+
+    CBitcoinAddress address(params[0].get_str());
+    if (address.IsValid()) {
+        ImportAddress(address, strLabel);
+    } else if (IsHex(params[0].get_str())) {
+        std::vector<unsigned char> data(ParseHex(params[0].get_str()));
+        ImportScript(CScript(data.begin(), data.end()));
+    } else {
+        throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address or script");
+    }
+
+    if (fRescan)
     {
-        if (::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
-            throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
-
-        // add to address book or update label
-        if (address.IsValid())
-            pwalletMain->SetAddressBook(address.Get(), strLabel, "receive");
-
-        // Don't throw error in case an address is already there
-        if (pwalletMain->HaveWatchOnly(script))
-            return NullUniValue;
-
-        pwalletMain->MarkDirty();
-
-        if (!pwalletMain->AddWatchOnly(script))
-            throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");
-
-        if (fRescan)
-        {
-            pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
-            pwalletMain->ReacceptWalletTransactions();
-        }
+        pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
+        pwalletMain->ReacceptWalletTransactions();
     }

     return NullUniValue;


[net processing] Only send a getheaders for one block in an INV

Headers-first is the primary method of announcement on the network. If a
node fell back sending blocks by inv, it's probably for a re-org. The
final block hash provided should be the highest, so send a getheaders
and then fetch the blocks we need to catch up.

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -2420,6 +2420,7 @@

         uint32_t nFetchFlags = GetFetchFlags(pfrom);
         const auto current_time = GetTime<std::chrono::microseconds>();
+        uint256* best_block{nullptr};

         for (CInv &inv : vInv)
         {
@@ -2436,17 +2437,14 @@
             if (inv.type == MSG_BLOCK) {
                 UpdateBlockAvailability(pfrom->GetId(), inv.hash);
                 if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
-                    // We used to request the full block here, but since headers-announcements are now the
-                    // primary method of announcement on the network, and since, in the case that a node
-                    // fell back to inv we probably have a reorg which we should get the headers for first,
-                    // we now only provide a getheaders response here. When we receive the headers, we will
-                    // then ask for the blocks we need.
-                    connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexBestHeader), inv.hash));
-                    LogPrint(BCLog::NET, "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->GetId());
-                }
-            }
-            else
-            {
+                    // Headers-first is the primary method of announcement on
+                    // the network. If a node fell back to sending blocks by inv,
+                    // it's probably for a re-org. The final block hash
+                    // provided should be the highest, so send a getheaders and
+                    // then fetch the blocks we need to catch up.
+                    best_block = &inv.hash;
+                }
+            } else {
                 pfrom->AddInventoryKnown(inv);
                 if (fBlocksOnly) {
                     LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom->GetId());
@@ -2457,6 +2455,12 @@
                 }
             }
         }
+
+        if (best_block != nullptr) {
+            connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexBestHeader), *best_block));
+            LogPrint(BCLog::NET, "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, best_block->ToString(), pfrom->GetId());
+        }
+
         return true;
     }


Added decoding time computation.

Added decoding time computation.

git-svn-id: f5d636078e73450abf2183305c5e43efec2a5605@760 1f5c12ca-751b-0410-a591-d2e778427230

--- moses-cmd/src/Main.cpp
+++ moses-cmd/src/Main.cpp
@@ -138,9 +138,10 @@

 			if (staticData.IsDetailedTranslationReportingEnabled()) {
 				TranslationAnalysis::PrintTranslationAnalysis(std::cerr, manager.GetBestHypothesis());
-         PrintUserTime(std::cerr, "Sentence Decoding Time:");
 			}
-
+
+      PrintUserTime(std::cerr, "Sentence Decoding Time:");
+
 			manager.CalcDecoderStatistics(staticData);
 			staticData.CleanUpAfterSentenceProcessing();


Fix Linux/Gtk build after r248965 with gcc 4.8

Fix Linux/Gtk build after r248965 with gcc 4.8. The compiler was complaining
about DevToolsContentsResizingStrategy not being copyable. Using a if/else
instead of a ternary makes the compiler happy.

R=thakis@chromium.org

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

Patch from Chris Dumez <ch.dumez@samsung.com>.

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

--- chrome/browser/ui/gtk/browser_window_gtk.cc
+++ chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -2286,9 +2286,12 @@
     HideDevToolsContainer();

   devtools_window_ = new_devtools_window;
-  contents_resizing_strategy_.CopyFrom(devtools_window_ ?
-      devtools_window_->GetContentsResizingStrategy() :
-      DevToolsContentsResizingStrategy());
+  if (devtools_window_) {
+    contents_resizing_strategy_.CopyFrom(
+      devtools_window_->GetContentsResizingStrategy());
+  } else {
+    contents_resizing_strategy_.CopyFrom(DevToolsContentsResizingStrategy());
+  }

   if (should_show)
     ShowDevToolsContainer();


Play a full 60 seconds of generated audio to match shadertoy.

--- src/sdl_main.cpp
+++ src/sdl_main.cpp
@@ -168,15 +168,15 @@
     wave.spec.callback = fillerup;

     const int mPlayTime = 60; // Shadertoy gives 60 seconds of audio
-    wave.soundlen = mPlayTime * wave.spec.freq;
-    wave.sound = new Uint8[2*wave.soundlen];
+    wave.soundlen = mPlayTime * wave.spec.freq * 2; // interlaced stereo
+    wave.sound = new Uint8[wave.soundlen];
     glViewport(0,0,512,512);
     const renderpass& r = g_toy.sound;
     glUseProgram(r.prog);

     unsigned char* mData = new unsigned char[512*512*4];
     int mTmpBufferSamples = 512*512;
-    int mPlaySamples = wave.soundlen;
+    int mPlaySamples = wave.soundlen / 2;
     int numBlocks = mPlaySamples / mTmpBufferSamples;
     for (int j=0; j<numBlocks; ++j)
     {


was/launch: move PreparedChildProcess declaration up

Assign file descriptors earlier to it, to take advantage of its
destructor in case of failure.

--- src/was/was_launch.cxx
+++ src/was/was_launch.cxx
@@ -50,33 +50,31 @@
 {
     int control_fds[2], input_fds[2], output_fds[2];

+    PreparedChildProcess p;
+
     if (socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, control_fds) < 0) {
         set_error_errno_msg(error_r, "failed to create socket pair");
         return false;
     }

+    p.control_fd = control_fds[1];
+
     if (pipe_cloexec(input_fds) < 0) {
         set_error_errno_msg(error_r, "failed to create first pipe");
         close(control_fds[0]);
-        close(control_fds[1]);
         return false;
     }
+
+    p.stdout_fd = input_fds[1];

     if (pipe_cloexec(output_fds) < 0) {
         set_error_errno_msg(error_r, "failed to create second pipe");
         close(control_fds[0]);
-        close(control_fds[1]);
         close(input_fds[0]);
-        close(input_fds[1]);
         return false;
     }

-    PreparedChildProcess p;
-
     p.stdin_fd = output_fds[0];
-    p.stdout_fd = input_fds[1];
-    /* fd2 is retained */
-    p.control_fd = control_fds[1];

     p.Append(executable_path);
     for (auto i : args)


run: add hotswap call

run: add hotswap call

--- daemon/src/BVSDaemon.cc
+++ daemon/src/BVSDaemon.cc
@@ -51,7 +51,7 @@
 	LOG(2, "starting!");
 	bvs->start();

-	bvs->run();
+	//bvs->run();

 	std::string input;
 	while (input != "q" && input != "quit")
@@ -78,6 +78,13 @@
 			testLogger();
 			testConfig();
 		}
+		else if (input.substr(0,2) == "hs" || input.substr(0, 7) == "hotswap")
+		{
+			size_t delimiter = input.find_first_of(" ");
+			input.erase(0, delimiter+1);
+			if (input.empty() || delimiter==std::string::npos) std::cout << "ERROR: no module ID given!" << std::endl;
+			else bvs->hotSwap(input);
+		}
 		else if (input == "q" || input == "quit")
 		{
 			LOG(2, "quitting...");
@@ -87,13 +94,14 @@
 		else if (input == "h" || input == "help")
 		{
 			std::cout << "usage:" << std::endl;
-			std::cout << "   r|run        run system until paused" << std::endl;
-			std::cout << "   c|continue   same as run" << std::endl;
-			std::cout << "   s|step       advance system by one step" << std::endl;
-			std::cout << "   p|pause      pause(stop) system" << std::endl;
-			std::cout << "   t|test       call test functions" << std::endl;
-			std::cout << "   q|quit       shutdown system and quit" << std::endl;
-			std::cout << "   h|help       show help" << std::endl;
+			std::cout << "   r|run            run system until paused" << std::endl;
+			std::cout << "   c|continue       same as run" << std::endl;
+			std::cout << "   s|step           advance system by one step" << std::endl;
+			std::cout << "   p|pause          pause(stop) system" << std::endl;
+			std::cout << "   hs|hotswap <arg> HotSwap(TM) <moduleID>" << std::endl;
+			std::cout << "   t|test           call test functions" << std::endl;
+			std::cout << "   q|quit           shutdown system and quit" << std::endl;
+			std::cout << "   h|help           show help" << std::endl;
 		}
 	}


Add morejs to page cycler tests.

Add morejs to page cycler tests.

BUG=12357
TEST=page cycler runs to completion

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

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

Former-commit-id: 176488d1be0bfa0196fe33a8ba0c362cfadcd6a0

--- chrome/test/page_cycler/page_cycler_test.cc
+++ chrome/test/page_cycler/page_cycler_test.cc
@@ -476,6 +476,14 @@
   RunTest("dhtml", false);
 }

+TEST_F(PageCyclerTest, MorejsFile) {
+  RunTest("morejs", false);
+}
+
+TEST_F(PageCyclerReferenceTest, MorejsFile) {
+  RunTest("morejs", false);
+}
+
 // http (localhost) tests
 TEST_F(PageCyclerTest, MozHttp) {
   RunTest("moz", true);


bug fix

bug fix

--- source/mesh_x.cpp
+++ source/mesh_x.cpp
@@ -1067,7 +1067,7 @@
 		for (auto& f : m_frames) {
 			XMStoreFloat4x4(&f.frameTransformMatrix, XMLoadFloat4x4(&f.frameTransformMatrixOrg));
 		}
-//		return;
+		return;
 	}
 	int revAnimId = m_animationSets.size() - animId - 1;


directories are readable in windows

directories are readable in windows

git-svn-id: 39e099a8ed5324aded674b764a67f7a08796d9a7@2509 662fdd30-d327-0410-a531-f549c87e1e9e

--- src/windows/system.cpp
+++ src/windows/system.cpp
@@ -15,6 +15,10 @@
 }

 bool readable(const std::string & path){
+    if (isDirectory(path)){
+        return true;
+    }
+
 	std::ifstream stream(path.c_str());
     bool ok = stream.good();
     if (stream.is_open()){


* Optionally warn about packages that give an assertion failure.

--- src/nix-env/nix-env.cc
+++ src/nix-env/nix-env.cc
@@ -1062,7 +1062,7 @@
             cout.flush();

         } catch (AssertionError & e) {
-            /* !!! hm, maybe we should give some sort of warning here? */
+            printMsg(lvlTalkative, format("skipping derivation named `%1%' which gives an assertion failure") % i->name);
         }
     }


shrpx: Replace strncpy + putting null with memcpy in ssl_pem_passwd_cb

--- src/shrpx_ssl.cc
+++ src/shrpx_ssl.cc
@@ -91,8 +91,8 @@
 }
 } // namespace

-
-static int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data)
+namespace {
+int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data)
 {
   Config *config = (Config *)user_data;
   int len = (int)strlen(config->private_key_passwd);
@@ -100,12 +100,11 @@
     LOG(ERROR) << "ssl_pem_passwd_cb: buf is too small " << size;
     return 0;
   }
-
-  strncpy(buf, config->private_key_passwd, len);
-  buf[len] = '\0';
+  // Copy string including last '\0'.
+  memcpy(buf, config->private_key_passwd, len+1);
   return len;
 }
-
+} // namespace

 SSL_CTX* create_ssl_context()
 {


* Use optimistic profile locking for nix-env operations like `-i' and   `-u'.  Instead of acquiring an exclusive lock on the profile for the   entire duration of the operation, we just perform the operation   optimistically (without an exclusive lock), and check at the end   whether the profile changed while we were busy (i.e., the symlink   target changed).  If so, the operation is restarted.  Restarting is   generally cheap, since the build results are still in the Nix store.   Most of the time, only the user environment has to be rebuilt.

--- src/nix-env/nix-env.cc
+++ src/nix-env/nix-env.cc
@@ -215,8 +215,34 @@
 }

-static void createUserEnv(EvalState & state, const DrvInfos & elems,
-    const Path & profile, bool keepDerivations)
+/* Ensure exclusive access to a profile.  Any command that modifies
+   the profile first acquires this lock. */
+static void lockProfile(PathLocks & lock, const Path & profile)
+{
+    lock.lockPaths(singleton<PathSet>(profile),
+        (format("waiting for lock on profile `%1%'") % profile).str());
+    lock.setDeletion(true);
+}
+
+
+/* Optimistic locking is used by long-running operations like `nix-env
+   -i'.  Instead of acquiring the exclusive lock for the entire
+   duration of the operation, we just perform the operation
+   optimistically (without an exclusive lock), and check at the end
+   whether the profile changed while we were busy (i.e., the symlink
+   target changed).  If so, the operation is restarted.  Restarting is
+   generally cheap, since the build results are still in the Nix
+   store.  Most of the time, only the user environment has to be
+   rebuilt. */
+static string optimisticLockProfile(const Path & profile)
+{
+    return pathExists(profile) ? readLink(profile) : "";
+}
+
+
+static bool createUserEnv(EvalState & state, const DrvInfos & elems,
+    const Path & profile, bool keepDerivations,
+    const string & lockToken)
 {
     /* Build the components in the user environment, if they don't
        exist already. */
@@ -305,9 +331,20 @@
     store->buildDerivations(singleton<PathSet>(topLevelDrv.queryDrvPath(state)));

     /* Switch the current user environment to the output path. */
+    PathLocks lock;
+    lockProfile(lock, profile);
+
+    Path lockTokenCur = optimisticLockProfile(profile);
+    if (lockToken != lockTokenCur) {
+        printMsg(lvlError, format("profile `%1%' changed while we were busy; restarting") % profile);
+        return false;
+    }
+
     debug(format("switching to new user environment"));
     Path generation = createGeneration(profile, topLevelDrv.queryOutPath(state));
     switchLink(profile, generation);
+
+    return true;
 }

@@ -544,14 +581,6 @@
 }

-static void lockProfile(PathLocks & lock, const Path & profile)
-{
-    lock.lockPaths(singleton<PathSet>(profile),
-        (format("waiting for lock on profile `%1%'") % profile).str());
-    lock.setDeletion(true);
-}
-
-
 static void installDerivations(Globals & globals,
     const Strings & args, const Path & profile)
 {
@@ -574,35 +603,35 @@

     /* Add in the already installed derivations, unless they have the
        same name as a to-be-installed element. */
-    PathLocks lock;
-    lockProfile(lock, profile);
-    DrvInfos installedElems = queryInstalled(globals.state, profile);
-
-    DrvInfos allElems(newElems);
-    for (DrvInfos::iterator i = installedElems.begin();
-         i != installedElems.end(); ++i)
-    {
-        DrvName drvName(i->name);
-        MetaInfo meta = i->queryMetaInfo(globals.state);
-        if (!globals.preserveInstalled &&
-            newNames.find(drvName.name) != newNames.end() &&
-            meta["keep"] != "true")
-            printMsg(lvlInfo,
-                format("replacing old `%1%'") % i->name);
-        else
-            allElems.push_back(*i);
-    }
-
-    for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i)
-        printMsg(lvlInfo,
-            format("installing `%1%'") % i->name);
-
-    printMissing(globals.state, newElems);
-
-    if (globals.dryRun) return;
-
-    createUserEnv(globals.state, allElems,
-        profile, globals.keepDerivations);
+
+    while (true) {
+        string lockToken = optimisticLockProfile(profile);
+
+        DrvInfos installedElems = queryInstalled(globals.state, profile);
+
+        DrvInfos allElems(newElems);
+        foreach (DrvInfos::iterator, i, installedElems) {
+            DrvName drvName(i->name);
+            MetaInfo meta = i->queryMetaInfo(globals.state);
+            if (!globals.preserveInstalled &&
+                newNames.find(drvName.name) != newNames.end() &&
+                meta["keep"] != "true")
+                printMsg(lvlInfo,
+                    format("replacing old `%1%'") % i->name);
+            else
+                allElems.push_back(*i);
+        }
+
+        foreach (DrvInfos::iterator, i, newElems)
+            printMsg(lvlInfo, format("installing `%1%'") % i->name);
+
+        printMissing(globals.state, newElems);
+
+        if (globals.dryRun) return;
+
+        if (createUserEnv(globals.state, allElems,
+                profile, globals.keepDerivations, lockToken)) break;
+    }
 }

@@ -634,77 +663,75 @@
        for a derivation in the input Nix expression that has the same
        name and a higher version number. */

-    /* Load the currently installed derivations. */
-    PathLocks lock;
-    lockProfile(lock, globals.profile);
-    DrvInfos installedElems = queryInstalled(globals.state, globals.profile);
-
-    /* Fetch all derivations from the input file. */
-    DrvInfos availElems;
-    queryInstSources(globals.state, globals.instSource, args, availElems, false);
-
-    /* Go through all installed derivations. */
-    DrvInfos newElems;
-    for (DrvInfos::iterator i = installedElems.begin();
-         i != installedElems.end(); ++i)
-    {
-        DrvName drvName(i->name);
-
-        MetaInfo meta = i->queryMetaInfo(globals.state);
-        if (meta["keep"] == "true") {
-            newElems.push_back(*i);
-            continue;
-        }
-
-        /* Find the derivation in the input Nix expression with the
-           same name that satisfies the version constraints specified
-           by upgradeType.  If there are multiple matches, take the
-           one with the highest priority.  If there are still multiple
-           matches, take the one with the highest version. */
-        DrvInfos::iterator bestElem = availElems.end();
-        DrvName bestName;
-        for (DrvInfos::iterator j = availElems.begin();
-             j != availElems.end(); ++j)
-        {
-            DrvName newName(j->name);
-            if (newName.name == drvName.name) {
-                int d = comparePriorities(globals.state, *i, *j);
-                if (d == 0) d = compareVersions(drvName.version, newName.version);
-                if (upgradeType == utLt && d < 0 ||
-                    upgradeType == utLeq && d <= 0 ||
-                    upgradeType == utEq && d == 0 ||
-                    upgradeType == utAlways)
-                {
-                    int d2 = -1;
-                    if (bestElem != availElems.end()) {
-                        d2 = comparePriorities(globals.state, *bestElem, *j);
-                        if (d2 == 0) d2 = compareVersions(bestName.version, newName.version);
-                    }
-                    if (d2 < 0) {
-                        bestElem = j;
-                        bestName = newName;
+    while (true) {
+        string lockToken = optimisticLockProfile(globals.profile);
+
+        DrvInfos installedElems = queryInstalled(globals.state, globals.profile);
+
+        /* Fetch all derivations from the input file. */
+        DrvInfos availElems;
+        queryInstSources(globals.state, globals.instSource, args, availElems, false);
+
+        /* Go through all installed derivations. */
+        DrvInfos newElems;
+        foreach (DrvInfos::iterator, i, installedElems) {
+            DrvName drvName(i->name);
+
+            MetaInfo meta = i->queryMetaInfo(globals.state);
+            if (meta["keep"] == "true") {
+                newElems.push_back(*i);
+                continue;
+            }
+
+            /* Find the derivation in the input Nix expression with
+               the same name that satisfies the version constraints
+               specified by upgradeType.  If there are multiple
+               matches, take the one with the highest priority.  If
+               there are still multiple matches, take the one with the
+               highest version. */
+            DrvInfos::iterator bestElem = availElems.end();
+            DrvName bestName;
+            foreach (DrvInfos::iterator, j, availElems) {
+                DrvName newName(j->name);
+                if (newName.name == drvName.name) {
+                    int d = comparePriorities(globals.state, *i, *j);
+                    if (d == 0) d = compareVersions(drvName.version, newName.version);
+                    if (upgradeType == utLt && d < 0 ||
+                        upgradeType == utLeq && d <= 0 ||
+                        upgradeType == utEq && d == 0 ||
+                        upgradeType == utAlways)
+                    {
+                        int d2 = -1;
+                        if (bestElem != availElems.end()) {
+                            d2 = comparePriorities(globals.state, *bestElem, *j);
+                            if (d2 == 0) d2 = compareVersions(bestName.version, newName.version);
+                        }
+                        if (d2 < 0) {
+                            bestElem = j;
+                            bestName = newName;
+                        }
                     }
                 }
             }
-        }
-
-        if (bestElem != availElems.end() &&
-            i->queryOutPath(globals.state) !=
+
+            if (bestElem != availElems.end() &&
+                i->queryOutPath(globals.state) !=
                 bestElem->queryOutPath(globals.state))
-        {
-            printMsg(lvlInfo,
-                format("upgrading `%1%' to `%2%'")
-                % i->name % bestElem->name);
-            newElems.push_back(*bestElem);
-        } else newElems.push_back(*i);
-    }
-
-    printMissing(globals.state, newElems);
-
-    if (globals.dryRun) return;
-
-    createUserEnv(globals.state, newElems,
-        globals.profile, globals.keepDerivations);
+            {
+                printMsg(lvlInfo,
+                    format("upgrading `%1%' to `%2%'")
+                    % i->name % bestElem->name);
+                newElems.push_back(*bestElem);
+            } else newElems.push_back(*i);
+        }
+
+        printMissing(globals.state, newElems);
+
+        if (globals.dryRun) return;
+
+        if (createUserEnv(globals.state, newElems,
+                globals.profile, globals.keepDerivations, lockToken)) break;
+    }
 }

@@ -748,29 +775,27 @@
     string flagValue = *arg++;
     DrvNames selectors = drvNamesFromArgs(Strings(arg, opArgs.end()));

-    /* Load the currently installed derivations. */
-    PathLocks lock;
-    lockProfile(lock, globals.profile);
-    DrvInfos installedElems = queryInstalled(globals.state, globals.profile);
-
-    /* Update all matching derivations. */
-    for (DrvInfos::iterator i = installedElems.begin();
-         i != installedElems.end(); ++i)
-    {
-        DrvName drvName(i->name);
-        for (DrvNames::iterator j = selectors.begin();
-             j != selectors.end(); ++j)
-            if (j->matches(drvName)) {
-                printMsg(lvlInfo,
-                    format("setting flag on `%1%'") % i->name);
-                setMetaFlag(globals.state, *i, flagName, flagValue);
-                break;
-            }
-    }
-
-    /* Write the new user environment. */
-    createUserEnv(globals.state, installedElems,
-        globals.profile, globals.keepDerivations);
+    while (true) {
+        string lockToken = optimisticLockProfile(globals.profile);
+
+        DrvInfos installedElems = queryInstalled(globals.state, globals.profile);
+
+        /* Update all matching derivations. */
+        foreach (DrvInfos::iterator, i, installedElems) {
+            DrvName drvName(i->name);
+            foreach (DrvNames::iterator, j, selectors)
+                if (j->matches(drvName)) {
+                    printMsg(lvlInfo,
+                        format("setting flag on `%1%'") % i->name);
+                    setMetaFlag(globals.state, *i, flagName, flagValue);
+                    break;
+                }
+        }
+
+        /* Write the new user environment. */
+        if (createUserEnv(globals.state, installedElems,
+                globals.profile, globals.keepDerivations, lockToken)) break;
+    }
 }

@@ -812,33 +837,33 @@
 static void uninstallDerivations(Globals & globals, Strings & selectors,
     Path & profile)
 {
-    PathLocks lock;
-    lockProfile(lock, profile);
-    DrvInfos installedElems = queryInstalled(globals.state, profile);
-    DrvInfos newElems;
-
-    for (DrvInfos::iterator i = installedElems.begin();
-         i != installedElems.end(); ++i)
-    {
-        DrvName drvName(i->name);
-        bool found = false;
-        for (Strings::iterator j = selectors.begin(); j != selectors.end(); ++j)
-            /* !!! the repeated calls to followLinksToStorePath() are
-               expensive, should pre-compute them. */
-            if ((isPath(*j) && i->queryOutPath(globals.state) == followLinksToStorePath(*j))
-                || DrvName(*j).matches(drvName))
-            {
-                printMsg(lvlInfo, format("uninstalling `%1%'") % i->name);
-                found = true;
-                break;
-            }
-        if (!found) newElems.push_back(*i);
-    }
-
-    if (globals.dryRun) return;
-
-    createUserEnv(globals.state, newElems,
-        profile, globals.keepDerivations);
+    while (true) {
+        string lockToken = optimisticLockProfile(profile);
+
+        DrvInfos installedElems = queryInstalled(globals.state, profile);
+        DrvInfos newElems;
+
+        foreach (DrvInfos::iterator, i, installedElems) {
+            DrvName drvName(i->name);
+            bool found = false;
+            foreach (Strings::iterator, j, selectors)
+                /* !!! the repeated calls to followLinksToStorePath()
+                   are expensive, should pre-compute them. */
+                if ((isPath(*j) && i->queryOutPath(globals.state) == followLinksToStorePath(*j))
+                    || DrvName(*j).matches(drvName))
+                {
+                    printMsg(lvlInfo, format("uninstalling `%1%'") % i->name);
+                    found = true;
+                    break;
+                }
+            if (!found) newElems.push_back(*i);
+        }
+
+        if (globals.dryRun) return;
+
+        if (createUserEnv(globals.state, newElems,
+                profile, globals.keepDerivations, lockToken)) break;
+    }
 }


Ensure smessage input buffer is large enough

--- src/smessage.cpp
+++ src/smessage.cpp
@@ -1011,7 +1011,7 @@
     char cLine[512];
     char *pName, *pValue;

-    char cAddress[64];
+    char cAddress[65];
     int addrRecv, addrRecvAnon;

     while (fgets(cLine, 512, fp))


Print license information on '--xml --meta'

The nixpkgs manual prescribes the use of values from stdenv.lib.licenses
for the meta.license attribute. Those values are attribute sets and
currently skipped when running nix-env with '--xml --meta'. This has the
consequence that also nixpkgs-lint will report missing licenses.

With this commit nix-env with '--xml --meta' will print all attributes
of an attribute set that are of type tString. For example the output for
the package nixpkgs.hello is

    <meta name="license" type="strings">
      <string type="url" value="http://spdx.org/licenses/GPL-3.0+" />
      <string type="shortName" value="gpl3Plus" />
      <string type="fullName" value="GNU General Public License v3.0 or later" />
      <string type="spdxId" value="GPL-3.0+" />
    </meta>

This commit fixes nixpkgs-lint, too.

--- src/nix-env/nix-env.cc
+++ src/nix-env/nix-env.cc
@@ -1140,7 +1140,19 @@
                                         attrs3["value"] = v->listElems()[j]->string.s;
                                         xml.writeEmptyElement("string", attrs3);
                                     }
+                              } else if (v->type == tAttrs) {
+                                  attrs2["type"] = "strings";
+                                  XMLOpenElement m(xml, "meta", attrs2);
+                                  Bindings & attrs = *v->attrs;
+                                  for (auto &i : attrs) {
+                                      Attr & a(*attrs.find(i.name));
+                                      if(a.value->type != tString) continue;
+                                      XMLAttrs attrs3;
+                                      attrs3["type"] = i.name;
+                                      attrs3["value"] = a.value->string.s;
+                                      xml.writeEmptyElement("string", attrs3);
                                 }
+                              }
                             }
                         }
                     }


F #4809: Enable federated of solo Zones

F #4809: Enable federated of solo Zones

--- src/sql/LogDB.cc
+++ src/sql/LogDB.cc
@@ -90,7 +90,7 @@

         oss << time(0);

-        insert_log_record(0, 0, oss, time(0), false);
+        insert_log_record(0, 0, oss, time(0), -1);
     }

     setup_index(r, i);
@@ -432,7 +432,14 @@
     // -------------------------------------------------------------------------
     if ( solo )
     {
-        return db->exec_wr(cmd);
+        rc = db->exec_wr(cmd);
+
+        if ( rc == 0 && Nebula::instance().is_federation_enabled() )
+        {
+            insert_log_record(0, cmd, time(0), federated_index);
+        }
+
+        return rc;
     }
     else if ( raftm == 0 || !raftm->is_leader() )
     {


Reinstate R_CheckUserInterrupt

Reinstate R_CheckUserInterrupt

git-svn-id: b6c97393e82be3812a607970066d172a5388f86f@3522 df83fd30-4cca-4c36-ab9d-e8b5583ccbd1

--- src/omxFitFunction.cpp
+++ src/omxFitFunction.cpp
@@ -119,7 +119,7 @@
 void ComputeFit(omxMatrix *fitMat, int want, FitContext *fc)
 {
 	bool doFit = want & FF_COMPUTE_FIT;
-	// R_CheckUserInterrupt(); add here? TODO
+	R_CheckUserInterrupt();

 #pragma omp atomic
 	++Global->computeCount; // could avoid lock by keeping in FitContext


small OTString update for iOS 7.

small OTString update for iOS 7.

Signed-off-by: FellowTraveler <71f9e3635dd61a511a33df5b0216634229abc0cb@gmail.com>

--- src/otlib/OTString.cpp
+++ src/otlib/OTString.cpp
@@ -574,7 +574,7 @@
 //
 bool OTString::TokenizeIntoKeyValuePairs(std::map<std::string, std::string> & mapOutput) const
 {
-#ifndef _WIN32
+#if !(_WIN32 || __IPHONE_7_0)
 	if (!Exists())
 		return true;
 	// --------------


Adjustment so start position is not part of path

--- src/pBidder/Bidder.cpp
+++ src/pBidder/Bidder.cpp
@@ -277,7 +277,7 @@

   // Send the path to the MOOSDB
   doNotify(getPathVar(id),
-      getPathVarVal(pathToString(pathPoints, path->getLength())));
+      getPathVarVal(pathToString(pathPoints + 1, path->getLength() - 1)));

   delete sub;
   delete tree;


Fix more type annotation (#1490)

Fix more type annotation (#1490)

--- src/pass/arg_binder.cc
+++ src/pass/arg_binder.cc
@@ -168,7 +168,7 @@
   if (Bind_(buffer->data, TVMArrayGet(Handle(), handle, intrinsic::kArrData),
             arg_name + ".data", true)) {
     Var vptr(buffer->data);
-    def_handle_dtype_.Set(vptr, make_const(buffer->dtype, 0));
+    def_handle_dtype_.Set(vptr, ir::TypeAnnotation(buffer->dtype));
     // mark alignment of external bufs
     init_nest_.emplace_back(AttrStmt::make(
         vptr, ir::attr::storage_alignment,
@@ -190,7 +190,7 @@
   }
   // strides field
   Var v_strides(arg_name + ".strides", Handle());
-  def_handle_dtype_.Set(v_strides, make_const(tvm_shape_type, 0));
+  def_handle_dtype_.Set(v_strides, ir::TypeAnnotation(tvm_shape_type));
   init_nest_.emplace_back(LetStmt::make(
       v_strides, TVMArrayGet(Handle(), handle, intrinsic::kArrStrides),
       nop));


Logbook file handling was done in a json file.

--- Logbook.cpp
+++ Logbook.cpp
@@ -1,6 +1,6 @@
 #include "Logbook.h"

-#define LOGBOOK_FILE_NAME "LOGBOOK.TXT"
+#define LOGBOOK_FILE_NAME "Logbook.json"

 const String NEW_LINE = "\n";

@@ -18,27 +18,24 @@
 	if (SD.exists(LOGBOOK_FILE_NAME)) {
 		SdFile logbookFile;
 		if (logbookFile.open(LOGBOOK_FILE_NAME, O_READ)) {
-			String line;
+
+			char fileContent[logbookFile.fileSize()];
 			int counter = 0;
 			while (logbookFile.available()) {
-				line = readStringUntil(&logbookFile, '\n');
-
-				if (counter == 4) {
-					logbookData->totalNumberOfDives = readIntFromLineEnd(line);
-				} else if (counter == 5) {
-					logbookData->totalDiveHours = readIntFromLineEnd(line);
-				} else if (counter == 6) {
-					logbookData->totalDiveMinutes = readIntFromLineEnd(line);
-				} else if (counter == 7) {
-					logbookData->totalMaximumDepth = readFloatFromLineEnd(line);
-				} else if (counter == 8) {
-					logbookData->lastDiveDateTime = readStringFromLineEnd(line);
-				}
+				fileContent[counter] = logbookFile.read();
 				counter++;
 			}
-			// The first 4 lines were skipped - this is the Summary section
-			logbookData->numberOfStoredProfiles = counter - 14;
 			logbookFile.close();
+
+			StaticJsonBuffer<JSON_OBJECT_SIZE(8)+JSON_ARRAY_SIZE(16)> jsonBuffer;
+			JsonObject& root = jsonBuffer.parseObject(fileContent);
+
+			logbookData->totalNumberOfDives = root["numberOfDives"];
+			logbookData->totalDiveHours = root["loggedDiveHours"];
+			logbookData->totalDiveMinutes = root["loggedDiveMinutes"];
+			logbookData->totalMaximumDepth = root["maxDepth"];
+			logbookData->lastDiveDateTime = root["lastDiveDate"].as<String>() + " " + root["lastDiveTime"].as<String>();
+			logbookData->numberOfStoredProfiles = root["numberOfStoredProfiles"];
 		}
 	} else {
 		//Create a new Logbook file, if it is not on the SD card with default values
@@ -54,40 +51,28 @@
 	SdFile logbookFile;
 	if (logbookFile.open(LOGBOOK_FILE_NAME, O_WRITE | O_CREAT | O_APPEND )) {

-		logbookFile.print(F("************\n"));
-		logbookFile.print(F("* Summary: *\n"));
-		logbookFile.print(F("************\n"));
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(F("Number of dives = "));
-		logbookFile.print(logbookData->totalNumberOfDives);
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(F("Logged dive hours = "));
-		logbookFile.print(logbookData->totalDiveHours);
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(F("Logged dive minutes = "));
-		logbookFile.print(logbookData->totalDiveMinutes);
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(F("Maximum depth (meter) = "));
-		logbookFile.print(logbookData->totalMaximumDepth, 1);
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(F("Last dive = "));
-		logbookFile.print(logbookData->lastDiveDateTime);
-		logbookFile.print(NEW_LINE);
-		logbookFile.print(NEW_LINE);
+		StaticJsonBuffer<JSON_OBJECT_SIZE(7)> jsonBuffer;
+
+		String lastDiveDate = "";
+		String lastDiveTime = "";
+
+		if (NULL != logbookData->lastDiveDateTime && logbookData->lastDiveDateTime.length() > 12) {
+			lastDiveDate = logbookData->lastDiveDateTime.substring(0, 10);
+			lastDiveTime = logbookData->lastDiveDateTime.substring(11);
+		}
+
+		JsonObject& root = jsonBuffer.createObject();
+		root.set("numberOfDives", logbookData->totalNumberOfDives);
+		root.set("loggedDiveHours", logbookData->totalDiveHours);
+		root.set("loggedDiveMinutes", logbookData->totalDiveMinutes);
+		root.set("maxDepth", logbookData->totalMaximumDepth);
+		root.set("lastDiveDate", lastDiveDate);
+		root.set("lastDiveTime", lastDiveTime);
+		root.set("numberOfStoredProfiles", logbookData->numberOfStoredProfiles);
+
+		root.prettyPrintTo(logbookFile);
+
 		logbookFile.flush();
-
-		logbookFile.print(F("**********\n"));
-		logbookFile.print(F("* Dives: *\n"));
-		logbookFile.print(F("**********\n"));
-		logbookFile.print(NEW_LINE);
-		logbookFile.flush();
-
-		for (int i=1; i<=logbookData->numberOfStoredProfiles; i++) {
-			logbookFile.print(getFileNameFromProfileNumber(i, false));
-			logbookFile.print(NEW_LINE);
-		}
-		logbookFile.flush();
-
 		logbookFile.close();
 	}
 }


improve code style

improve code style

remove useless break;

--- MFRC522.cpp
+++ MFRC522.cpp
@@ -1169,16 +1169,16 @@
 const __FlashStringHelper *MFRC522::GetStatusCodeName(MFRC522::StatusCode code	///< One of the StatusCode enums.
 										) {
 	switch (code) {
-		case STATUS_OK:				return F("Success.");										break;
-		case STATUS_ERROR:			return F("Error in communication.");						break;
-		case STATUS_COLLISION:		return F("Collission detected.");							break;
-		case STATUS_TIMEOUT:		return F("Timeout in communication.");						break;
-		case STATUS_NO_ROOM:		return F("A buffer is not big enough.");					break;
-		case STATUS_INTERNAL_ERROR:	return F("Internal error in the code. Should not happen.");	break;
-		case STATUS_INVALID:		return F("Invalid argument.");								break;
-		case STATUS_CRC_WRONG:		return F("The CRC_A does not match.");						break;
-		case STATUS_MIFARE_NACK:	return F("A MIFARE PICC responded with NAK.");				break;
-		default:					return F("Unknown error");									break;
+		case STATUS_OK:				return F("Success.");
+		case STATUS_ERROR:			return F("Error in communication.");
+		case STATUS_COLLISION:		return F("Collission detected.");
+		case STATUS_TIMEOUT:		return F("Timeout in communication.");
+		case STATUS_NO_ROOM:		return F("A buffer is not big enough.");
+		case STATUS_INTERNAL_ERROR:	return F("Internal error in the code. Should not happen.");
+		case STATUS_INVALID:		return F("Invalid argument.");
+		case STATUS_CRC_WRONG:		return F("The CRC_A does not match.");
+		case STATUS_MIFARE_NACK:	return F("A MIFARE PICC responded with NAK.");
+		default:					return F("Unknown error");
 	}
 } // End GetStatusCodeName()

@@ -1197,14 +1197,13 @@
 	//ignore 8-bit
 	sak&=0x7F;
 	switch (sak) {
-		case 0x09:	return PICC_TYPE_MIFARE_MINI;	break;
-		case 0x08:	return PICC_TYPE_MIFARE_1K;		break;
-		case 0x18:	return PICC_TYPE_MIFARE_4K;		break;
-		case 0x00:	return PICC_TYPE_MIFARE_UL;		break;
+		case 0x09:	return PICC_TYPE_MIFARE_MINI;
+		case 0x08:	return PICC_TYPE_MIFARE_1K;
+		case 0x18:	return PICC_TYPE_MIFARE_4K;
+		case 0x00:	return PICC_TYPE_MIFARE_UL;
 		case 0x10:
-		case 0x11:	return PICC_TYPE_MIFARE_PLUS;	break;
-		case 0x01:	return PICC_TYPE_TNP3XXX;		break;
-		default:	break;
+		case 0x11:	return PICC_TYPE_MIFARE_PLUS;
+		case 0x01:	return PICC_TYPE_TNP3XXX;
 	}

 	if (sak & 0x20) {
@@ -1226,17 +1225,17 @@
 const __FlashStringHelper *MFRC522::PICC_GetTypeName(byte piccType	///< One of the PICC_Type enums.
 										) {
 	switch (piccType) {
-		case PICC_TYPE_ISO_14443_4:		return F("PICC compliant with ISO/IEC 14443-4");	break;
-		case PICC_TYPE_ISO_18092:		return F("PICC compliant with ISO/IEC 18092 (NFC)");break;
-		case PICC_TYPE_MIFARE_MINI:		return F("MIFARE Mini, 320 bytes");					break;
-		case PICC_TYPE_MIFARE_1K:		return F("MIFARE 1KB");								break;
-		case PICC_TYPE_MIFARE_4K:		return F("MIFARE 4KB");								break;
-		case PICC_TYPE_MIFARE_UL:		return F("MIFARE Ultralight or Ultralight C");		break;
-		case PICC_TYPE_MIFARE_PLUS:		return F("MIFARE Plus");							break;
-		case PICC_TYPE_TNP3XXX:			return F("MIFARE TNP3XXX");							break;
-		case PICC_TYPE_NOT_COMPLETE:	return F("SAK indicates UID is not complete.");		break;
+		case PICC_TYPE_ISO_14443_4:		return F("PICC compliant with ISO/IEC 14443-4");
+		case PICC_TYPE_ISO_18092:		return F("PICC compliant with ISO/IEC 18092 (NFC)");
+		case PICC_TYPE_MIFARE_MINI:		return F("MIFARE Mini, 320 bytes");
+		case PICC_TYPE_MIFARE_1K:		return F("MIFARE 1KB");
+		case PICC_TYPE_MIFARE_4K:		return F("MIFARE 4KB");
+		case PICC_TYPE_MIFARE_UL:		return F("MIFARE Ultralight or Ultralight C");
+		case PICC_TYPE_MIFARE_PLUS:		return F("MIFARE Plus");
+		case PICC_TYPE_TNP3XXX:			return F("MIFARE TNP3XXX");
+		case PICC_TYPE_NOT_COMPLETE:	return F("SAK indicates UID is not complete.");
 		case PICC_TYPE_UNKNOWN:
-		default:						return F("Unknown type");							break;
+		default:						return F("Unknown type");
 	}
 } // End PICC_GetTypeName()


Remove old dialog construction code

Remove old dialog construction code

--- Settings/Controls/Dialog.cpp
+++ Settings/Controls/Dialog.cpp
@@ -14,18 +14,7 @@
 Dialog::Dialog(HWND parent, LPCWSTR dlgTemplate) :
 _parent(parent),
 _template(dlgTemplate) {
-//    _dlgHwnd = CreateDialogParam(
-//        NULL,
-//        dlgTemplate,
-//        parent,
-//        StaticDialogProc,
-//        (LPARAM) this);

-//    if (_dlgHwnd == NULL) {
-//        Logger::LogLastError();
-//    }
-
-//    UITranslator::TranslateWindowText(_dlgHwnd);
 }

 void Dialog::Show() {


Resolved CID 308923 (Unchecked dynamic_cast)

var_deref_model: Passing null pointer dynamic_cast <Container *>(tradeItem) to HasItems, which dereferences it.

--- src/world/Server/Packets/Handlers/TradeHandler.cpp
+++ src/world/Server/Packets/Handlers/TradeHandler.cpp
@@ -208,17 +208,20 @@

     if (tradeItem->isContainer())
     {
-        if (dynamic_cast<Container*>(tradeItem)->HasItems())
-        {
-            _player->getItemInterface()->BuildInventoryChangeError(tradeItem, nullptr, INV_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
-
-            SendPacket(SmsgTradeStatus(TRADE_STATUS_CANCELLED, 0).serialise().get());
-            _player->ResetTradeVariables();
-
-            playerTarget->m_session->SendPacket(SmsgTradeStatus(TRADE_STATUS_CANCELLED, 0).serialise().get());
-            playerTarget->ResetTradeVariables();
-
-            return;
+        if (const auto tradeContainer = dynamic_cast<Container*>(tradeItem))
+        {
+            if (tradeContainer->HasItems())
+            {
+                _player->getItemInterface()->BuildInventoryChangeError(tradeItem, nullptr, INV_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
+
+                SendPacket(SmsgTradeStatus(TRADE_STATUS_CANCELLED, 0).serialise().get());
+                _player->ResetTradeVariables();
+
+                playerTarget->m_session->SendPacket(SmsgTradeStatus(TRADE_STATUS_CANCELLED, 0).serialise().get());
+                playerTarget->ResetTradeVariables();
+
+                return;
+            }
         }
     }


Fix for Tru64.

Fix for Tru64.

--- src/xalanc/PlatformSupport/DirectoryEnumerator.hpp
+++ src/xalanc/PlatformSupport/DirectoryEnumerator.hpp
@@ -331,6 +331,10 @@
 		XalanDOMString		theSuffix;
 		if ( !target_Dir )
 		{
+#if defined(XALAN_STRICT_ANSI_HEADERS)
+            using std::strlen;
+#endif
+
 			int lenSpec = strlen(theSpec);
 			theName = theFullSearchSpec.substr(lenSpec, indexName);
 			theSuffix = theFullSearchSpec.substr(lenSpec+indexName+1, indexSuffix);


From Brede Johansen, fix the TexturePaletteRecord::endian() to handle old flt versions (11, 12 & 13).

--- src/osgPlugins/flt/TexturePaletteRecord.cpp
+++ src/osgPlugins/flt/TexturePaletteRecord.cpp
@@ -28,9 +28,23 @@
 // virtual
 void TexturePaletteRecord::endian()
 {
-    STexturePalette *pSTexture = (STexturePalette*)getData();

-    ENDIAN( pSTexture->diIndex );
-    ENDIAN( pSTexture->diX );
-    ENDIAN( pSTexture->diY );
+    int flightVersion = getFlightVersion();
+
+    if (flightVersion > 13)
+    {
+        STexturePalette *pSTexture = (STexturePalette*)getData();
+
+        ENDIAN( pSTexture->diIndex );
+        ENDIAN( pSTexture->diX );
+        ENDIAN( pSTexture->diY );
+    }
+    else    // version 11, 12 & 13
+    {
+        SOldTexturePalette *pSOldTexture = (SOldTexturePalette*)getData();
+
+        ENDIAN( pSOldTexture->diIndex );
+        ENDIAN( pSOldTexture->diX );
+        ENDIAN( pSOldTexture->diY );
+    }
 }


Fix Pathname GCC/Clang warning.

Fix Pathname GCC/Clang warning.

--- SimTKcommon/src/Pathname.cpp
+++ SimTKcommon/src/Pathname.cpp
@@ -338,12 +338,10 @@
         _getdcwd(which, buf, sizeof(buf));
         buf[0] = (char)tolower(buf[0]); // drive letter
     #else
-        #ifndef NDEBUG
-            char* bufp = getcwd(buf, sizeof(buf));
-            assert(bufp != 0); // buf not big enough if this happens
-        #else
-            (void) getcwd(buf, sizeof(buf));
-        #endif
+        char* bufp = getcwd(buf, sizeof(buf));
+        SimTK_ERRCHK_ALWAYS(bufp != 0,
+                "Pathname::getCurrentWorkingDirectory()",
+                "Buffer is not big enough to store current working directory.");
     #endif

     string cwd(buf);


Fix for 64bit build.

Fix for 64bit build.

git-svn-id: 23b6355f2bb369032457de4eb5f713ee134f73a8@2370 16af8721-9629-0410-8352-f15c8da7e697

--- src/osgPlugins/ive/ConvexPlanarOccluder.cpp
+++ src/osgPlugins/ive/ConvexPlanarOccluder.cpp
@@ -1,15 +1,15 @@
 /**********************************************************************
  *
- *	FILE:			ConvexPlanarOccluder.cpp
+ *    FILE:            ConvexPlanarOccluder.cpp
  *
- *	DESCRIPTION:	Read/Write osg::ConvexPlanarOccluder in binary format to disk.
+ *    DESCRIPTION:    Read/Write osg::ConvexPlanarOccluder in binary format to disk.
  *
- *	CREATED BY:		Auto generated by iveGenerator
- *					and later modified by Rune Schmidt Jensen.
+ *    CREATED BY:        Auto generated by iveGenerator
+ *                    and later modified by Rune Schmidt Jensen.
  *
- *	HISTORY:		Created 23.4.2003
+ *    HISTORY:        Created 23.4.2003
  *
- *	Copyright 2003 VR-C
+ *    Copyright 2003 VR-C
  **********************************************************************/

 #include "Exception.h"
@@ -20,63 +20,58 @@
 using namespace ive;

 void ConvexPlanarOccluder::write(DataOutputStream* out){
-	// Write ConvexPlanarOccluder's identification.
-	out->writeInt(IVECONVEXPLANAROCCLUDER);
-	// If the osg class is inherited by any other class we should also write this to file.
-	osg::Object*  obj = dynamic_cast<osg::Object*>(this);
-	if(obj){
-		((ive::Object*)(obj))->write(out);
-	}
-	else
-		throw Exception("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object.");
-	// Write ConvexPlanarOccluder's properties.
+    // Write ConvexPlanarOccluder's identification.
+    out->writeInt(IVECONVEXPLANAROCCLUDER);
+    // If the osg class is inherited by any other class we should also write this to file.
+    osg::Object*  obj = dynamic_cast<osg::Object*>(this);
+    if(obj){
+        ((ive::Object*)(obj))->write(out);
+    }
+    else
+        throw Exception("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object.");
+    // Write ConvexPlanarOccluder's properties.

-	// Write planar polygon occluder.
-	out->writeInt((int)&getOccluder());
-	if(&getOccluder())
-		((ive::ConvexPlanarPolygon*)(&getOccluder()))->write(out);
+    // Write planar polygon occluder.
+    ((ive::ConvexPlanarPolygon*)(&getOccluder()))->write(out);

-	// Write hole list.
-	HoleList holeList = getHoleList();
-	int size = holeList.size();
-	out->writeInt(size);
-	for(int i=0; i<size; i++){
-		((ive::ConvexPlanarPolygon*)(&holeList[i]))->write(out);
-	}
+    // Write hole list.
+    HoleList holeList = getHoleList();
+    int size = holeList.size();
+    out->writeInt(size);
+    for(int i=0; i<size; i++){
+        ((ive::ConvexPlanarPolygon*)(&holeList[i]))->write(out);
+    }
 }

 void ConvexPlanarOccluder::read(DataInputStream* in){
-	// Peek on ConvexPlanarOccluder's identification.
-	int id = in->peekInt();
-	if(id == IVECONVEXPLANAROCCLUDER){
-		// Read ConvexPlanarOccluder's identification.
-		id = in->readInt();
-		// If the osg class is inherited by any other class we should also read this from file.
-		osg::Object*  obj = dynamic_cast<osg::Object*>(this);
-		if(obj){
-			((ive::Object*)(obj))->read(in);
-		}
-		else
-			throw Exception("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object.");
-		// Read ConvexPlanarOccluder's properties
+    // Peek on ConvexPlanarOccluder's identification.
+    int id = in->peekInt();
+    if(id == IVECONVEXPLANAROCCLUDER){
+        // Read ConvexPlanarOccluder's identification.
+        id = in->readInt();
+        // If the osg class is inherited by any other class we should also read this from file.
+        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
+        if(obj){
+            ((ive::Object*)(obj))->read(in);
+        }
+        else
+            throw Exception("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object.");
+        // Read ConvexPlanarOccluder's properties

-		// Read planar polygon occluder.
-		if(in->readInt()){
-			osg::ConvexPlanarPolygon* cpp = new osg::ConvexPlanarPolygon();
-			((ive::ConvexPlanarPolygon*)(cpp))->read(in);
-			setOccluder(*cpp);
-		}
+        // Read planar polygon occluder.
+        osg::ConvexPlanarPolygon* cpp = &getOccluder();
+        ((ive::ConvexPlanarPolygon*)(cpp))->read(in);

-		// Read hole list.
-		int size = in->readInt();
-		for(int i=0; i<size; i++){
-			osg::ConvexPlanarPolygon* cpp = new osg::ConvexPlanarPolygon();
-			((ive::ConvexPlanarPolygon*)(cpp))->read(in);
-			addHole(*cpp);
-		}
+        // Read hole list.
+        int size = in->readInt();
+        for(int i=0; i<size; i++){
+            osg::ConvexPlanarPolygon* cpp = new osg::ConvexPlanarPolygon();
+            ((ive::ConvexPlanarPolygon*)(cpp))->read(in);
+            addHole(*cpp);
+        }

-	}
-	else{
-		throw Exception("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification.");
-	}
+    }
+    else{
+        throw Exception("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification.");
+    }
 }


fix problem with ping timeout test

fix problem with ping timeout test

--- MozQuic.cpp
+++ MozQuic.cpp
@@ -772,7 +772,8 @@
     }
   }

-  if (mPingDeadline && mConnEventCB && mPingDeadline >= Timestamp()) {
+  if (mPingDeadline && mConnEventCB && mPingDeadline < Timestamp()) {
+    fprintf(stderr,"deadline expired set at %ld now %ld\n", mPingDeadline, Timestamp());
     mPingDeadline = 0;
     mConnEventCB(mClosure, MOZQUIC_EVENT_ERROR, this);
   }


Unit tests for defaulted PPs (#14525)

Unit tests for defaulted PPs (#14525)

--- unit/src/InputParametersTest.C
+++ unit/src/InputParametersTest.C
@@ -259,3 +259,32 @@
         << "failed with unexpected error: " << msg;
   }
 }
+
+TEST(InputParameters, setPPandVofPP)
+{
+  // programmatically set default value of PPName parameter
+  InputParameters p1 = emptyInputParameters();
+  p1.addParam<std::vector<PostprocessorName>>("pp_name", "testing");
+  p1.set<std::vector<PostprocessorName>>("pp_name") = {"first", "second", "third"};
+
+  // check if we have a vector of pps
+  EXPECT_TRUE(!p1.isSinglePostprocessor("pp_name")) << "Failed to detect vector of PPs";
+
+  // check what happens if default value is requested
+  /*
+  try
+  {
+    p1.hasDefaultPostprocessorValue("pp_name", 2);
+    FAIL() << "failed to error on supression of nonexisting parameter";
+  }
+  catch (const std::exception & e)
+  {
+    std::string msg(e.what());
+    ASSERT_TRUE(msg.find("Attempting to access _have_default_postprocessor_val") !=
+  std::string::npos)
+        << "failed with unexpected error: " << msg;
+  }
+  */
+
+  // EXPECT_EQ(p1.getDefaultPostprocessorValue("pp_name"), 1);
+}


Follow up to r1519958, remove the last vestiges of Ev2 rotate from JavaHL.

* subversion/bindings/javahl/native/CommitEditor.cpp
  (build_rotation): Remove commented code block.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1519976 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/bindings/javahl/native/CommitEditor.cpp
+++ subversion/bindings/javahl/native/CommitEditor.cpp
@@ -200,57 +200,6 @@

   return checksum;
 }
-
-// void
-// build_rotation(const apr_array_header_t **p_relpaths,
-//                const apr_array_header_t **p_revisions,
-//                const Iterator& iter, SVN::Pool& pool)
-// {
-//   *p_relpaths = *p_revisions = NULL;
-//
-//   static jfieldID relpath_fid = 0;
-//   static jfieldID revision_fid = 0;
-//
-//   JNIEnv *env = JNIUtil::getEnv();
-//   if (0 == relpath_fid || 0 == revision_fid)
-//     {
-//       jclass cls = env->FindClass(JAVA_PACKAGE"/ISVNEditor$RotatePair");
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//
-//       relpath_fid = env->GetFieldID(cls, "relativePath", "Ljava/lang/String;");
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//       revision_fid = env->GetFieldID(cls, "revision", "J");
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//     }
-//
-//   apr_pool_t* result_pool = pool.getPool();
-//   apr_array_header_t* relpaths = apr_array_make(
-//       result_pool, 0, sizeof(const char*));
-//   apr_array_header_t* revisions = apr_array_make(
-//       result_pool, 0, sizeof(svn_revnum_t));
-//   while (iter.hasNext())
-//     {
-//       jobject jpair = iter.next();
-//       jobject jrelpath = env->GetObjectField(jpair, relpath_fid);
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//       jlong jrevision = env->GetLongField(jpair, revision_fid);
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//       JNIStringHolder relpath((jstring)jrelpath);
-//       if (JNIUtil::isJavaExceptionThrown())
-//         return;
-//
-//       APR_ARRAY_PUSH(relpaths, const char*) = relpath.pstrdup(result_pool);
-//       APR_ARRAY_PUSH(revisions, svn_revnum_t) = svn_revnum_t(jrevision);
-//     }
-//
-//   *p_relpaths = relpaths;
-//   *p_revisions = revisions;
-// }
 } // anonymous namespace


make msvc12 happy

make msvc12 happy

--- unittests/defer.hpp
+++ unittests/defer.hpp
@@ -146,17 +146,21 @@
     for( auto & node : o_nodes0 )
     {
       node->relations.resize( random_index( 0, 100, gen ) );
-      for( auto & r : node->relations )
-        r = {o_nodes0[random_index(0, o_nodes0.size() - 1, gen)],
-             random_value<int>(gen), random_basic_string<char>(gen)};
+      for (auto & r : node->relations)
+      {
+        r = { o_nodes0[random_index( 0, o_nodes0.size() - 1, gen )],
+             random_value<int>( gen ), random_basic_string<char>( gen ) };
+      }
     }

     for( auto & node : o_nodes1 )
     {
       node->relations.resize( random_index( 0, 100, gen ) );
-      for( auto & r : node->relations )
-        r = {o_nodes0[random_index(0, o_nodes0.size() - 1, gen)],
-             random_value<int>(gen), random_basic_string<char>(gen)};
+      for (auto & r : node->relations)
+      {
+        r = { o_nodes0[random_index( 0, o_nodes0.size() - 1, gen )],
+             random_value<int>( gen ), random_basic_string<char>( gen ) };
+      }
     }

     std::ostringstream os;


Fix unittests: resize() -> reserve()

Fix unittests: resize() -> reserve()

From: Mehdi Amini <mehdi.amini@apple.com>

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

--- unittests/ADT/DenseMapTest.cpp
+++ unittests/ADT/DenseMapTest.cpp
@@ -344,7 +344,7 @@
 TEST(DenseMapCustomTest, ResizeTest) {
   for (unsigned Size = 16; Size < 32; ++Size) {
     DenseMap<unsigned, unsigned> Map;
-    Map.resize(Size);
+    Map.reserve(Size);
     unsigned MemorySize = Map.getMemorySize();
     for (unsigned i = 0; i < Size; ++i)
       Map[i] = i;


INTEGRATION: CWS pngperf (1.12.52); FILE MERGED 2006/08/14 19:01:28 hdu 1.12.52.2: RESYNC: (1.12-1.13); FILE MERGED 2006/07/13 05:15:03 sj 1.12.52.1: #i55174# added preview rendering

--- svx/source/sdr/contact/objectcontactofpageview.cxx
+++ svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: objectcontactofpageview.cxx,v $
  *
- *  $Revision: 1.13 $
- *
- *  last change: $Author: hr $ $Date: 2006-06-19 16:26:11 $
+ *  $Revision: 1.14 $
+ *
+ *  last change: $Author: vg $ $Date: 2006-09-08 08:29:39 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -100,6 +100,7 @@
             mrPageViewWindow(rPageViewWindow),
             mpRememberedStartPage(0L)
         {
+            mbIsPreviewRenderer = ((SdrPaintView&)rPageViewWindow.GetPageView().GetView()).IsPreviewRenderer();
         }

         // The destructor. When PrepareDelete() was not called before (see there)


refactor ensuring polygon has at least a line in it

just split that out into a standalone function, no logic
change

Change-Id: I061d5d716b3fc2a9fb6385e7fb249ce300752130

--- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -40,6 +40,30 @@
         {
         }

+        static sal_uInt32 ensureGeometry(basegfx::B2DPolyPolygon& rUnitPolyPolygon)
+        {
+            sal_uInt32 nPolyCount(rUnitPolyPolygon.count());
+            sal_uInt32 nPointCount(0);
+
+            for(sal_uInt32 a(0); a < nPolyCount; a++)
+            {
+                nPointCount += rUnitPolyPolygon.getB2DPolygon(a).count();
+            }
+
+            if(!nPointCount)
+            {
+                OSL_FAIL("PolyPolygon object without geometry detected, this should not be created (!)");
+                basegfx::B2DPolygon aFallbackLine;
+                aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
+                aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
+                rUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
+
+                nPolyCount = 1;
+            }
+
+            return nPolyCount;
+        }
+
         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
         {
             const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
@@ -54,24 +78,7 @@
             // to current zoom so as objects relative position to grid
             // appears stable
             aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) );
-            sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
-            sal_uInt32 nPointCount(0);
-
-            for(sal_uInt32 a(0); a < nPolyCount; a++)
-            {
-                nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count();
-            }
-
-            if(!nPointCount)
-            {
-                OSL_FAIL("PolyPolygon object without geometry detected, this should not be created (!)");
-                basegfx::B2DPolygon aFallbackLine;
-                aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
-                aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
-                aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
-
-                nPolyCount = 1;
-            }
+            sal_uInt32 nPolyCount(ensureGeometry(aUnitPolyPolygon));

             // prepare object transformation and unit polygon (direct model data)
             basegfx::B2DHomMatrix aObjectMatrix;


[mask_rom] Reduce the brittleness of shutdown_unittest

shutdown_unittest is brittle with respect to the number of alert
sources: any time the HW folks change the sources, the test will break.
This brittleness is unnecessary because the unittest doesn't care about
the specifics of the alert configuration, just that a given
configuration gets applied.

1. Define a full alert configuration up to the current limit of
OTP-defined alert configuration (80 alerts).
2. Refactor the test cases to check that the applied configuration
length matches the number of alert config registers rather than the size
of the test's alert configuration structure.

Signed-off-by: Chris Frantz <d3397dc265da044816f611610217f391e4e7ef39@google.com>

--- sw/device/silicon_creator/lib/shutdown_unittest.cc
+++ sw/device/silicon_creator/lib/shutdown_unittest.cc
@@ -12,6 +12,7 @@
 #include "sw/device/silicon_creator/lib/drivers/mock_alert.h"
 #include "sw/device/silicon_creator/lib/error.h"

+#include "alert_handler_regs.h"
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 #include "otp_ctrl_regs.h"

@@ -88,9 +89,9 @@
 #define CLASSIFY(name, prod, prodend, dev, rma)                     \
   Pack32(kAlertClass##prod, kAlertClass##prodend, kAlertClass##dev, \
          kAlertClass##rma)
+
 // This alert configuration is described in the Mask ROM Shutdown specification:
 // https://docs.google.com/document/d/1V8hRvQnJhsvddieJbRHS3azbPZvoBWxfxPZV_0YA1QU/edit#
-
 // clang-format off
 #define ALERTS(Xmacro) \
       Xmacro("Uart0FatalFault",                C, C, X, X), \
@@ -153,7 +154,26 @@
       Xmacro("SramCtrlMainFatalParityError",   A, A, X, X), \
       Xmacro("OtbnFatal",                      A, A, X, X), \
       Xmacro("OtbnRecov",                      D, D, X, X), \
-      Xmacro("RomCtrlFatal",                   A, A, X, X)
+      Xmacro("RomCtrlFatal",                   A, A, X, X), \
+      Xmacro("Dummy61",                        X, X, X, X), \
+      Xmacro("Dummy62",                        X, X, X, X), \
+      Xmacro("Dummy63",                        X, X, X, X), \
+      Xmacro("Dummy64",                        X, X, X, X), \
+      Xmacro("Dummy65",                        X, X, X, X), \
+      Xmacro("Dummy66",                        X, X, X, X), \
+      Xmacro("Dummy67",                        X, X, X, X), \
+      Xmacro("Dummy68",                        X, X, X, X), \
+      Xmacro("Dummy69",                        X, X, X, X), \
+      Xmacro("Dummy70",                        X, X, X, X), \
+      Xmacro("Dummy71",                        X, X, X, X), \
+      Xmacro("Dummy72",                        X, X, X, X), \
+      Xmacro("Dummy73",                        X, X, X, X), \
+      Xmacro("Dummy74",                        X, X, X, X), \
+      Xmacro("Dummy75",                        X, X, X, X), \
+      Xmacro("Dummy76",                        X, X, X, X), \
+      Xmacro("Dummy77",                        X, X, X, X), \
+      Xmacro("Dummy78",                        X, X, X, X), \
+      Xmacro("Dummy79",                        X, X, X, X)

 // TODO: find all of the local alerts and define them.
 #define LOC_ALERTS(Xmacro) \
@@ -209,10 +229,13 @@
 constexpr DefaultAlertClassification kDefaultAlertClassification[] = {
     ALERTS(FULL),
 };
-
 static_assert(
-    ARRAYSIZE(kDefaultAlertClassification) == kTopEarlgreyAlertIdLast + 1,
-    "The default alert classification doesn't match the number of alerts");
+    ARRAYSIZE(kDefaultAlertClassification) <= 80,
+    "The default alert classification must be less than or equal to the number of reserved OTP words");
+
+static_assert(
+    kTopEarlgreyAlertIdLast < ARRAYSIZE(kDefaultAlertClassification),
+    "The number of alert sources must be smaller than the alert classification");

 constexpr alert_class_t kClasses[] = {
     kAlertClassA,
@@ -316,13 +339,12 @@

 TEST_F(ShutdownTest, InitializeProd) {
   SetupOtpReads();
-  uint32_t index = 0;
-  for (const auto &c : kDefaultAlertClassification) {
+  for(size_t i = 0; i < ALERT_HANDLER_ALERT_CLASS_MULTIREG_COUNT; ++i) {
+    const auto &c = kDefaultAlertClassification[i];
     alert_class_t cls = c.prod;
     alert_enable_t en = RomAlertClassEnable(cls);
-    EXPECT_CALL(alert_, alert_configure(index, cls, en))
+    EXPECT_CALL(alert_, alert_configure(i, cls, en))
         .WillOnce(Return(kErrorOk));
-    index += 1;
   }
   ExpectClassConfigure();
   EXPECT_EQ(shutdown_init(kLcStateProd), kErrorOk);
@@ -330,16 +352,15 @@

 TEST_F(ShutdownTest, InitializeProdWithError) {
   SetupOtpReads();
-  uint32_t index = 0;
-  for (const auto &c : kDefaultAlertClassification) {
+  for(size_t i = 0; i < ALERT_HANDLER_ALERT_CLASS_MULTIREG_COUNT; ++i) {
+    const auto &c = kDefaultAlertClassification[i];
     alert_class_t cls = c.prod;
     alert_enable_t en = RomAlertClassEnable(cls);
-    // Return an error on index zero.  The error should not cause alert
+    // Return an error on i zero.  The error should not cause alert
     // configuation to abort early (ie: still expect the rest of the
     // alerts to get configured).
-    EXPECT_CALL(alert_, alert_configure(index, cls, en))
-        .WillOnce(Return(index == 0 ? kErrorUnknown : kErrorOk));
-    index += 1;
+    EXPECT_CALL(alert_, alert_configure(i, cls, en))
+        .WillOnce(Return(i == 0 ? kErrorUnknown : kErrorOk));
   }
   ExpectClassConfigure();
   // We expect to get the error from alert configuration.
@@ -348,13 +369,12 @@

 TEST_F(ShutdownTest, InitializeProdEnd) {
   SetupOtpReads();
-  uint32_t index = 0;
-  for (const auto &c : kDefaultAlertClassification) {
+  for(size_t i = 0; i < ALERT_HANDLER_ALERT_CLASS_MULTIREG_COUNT; ++i) {
+    const auto &c = kDefaultAlertClassification[i];
     alert_class_t cls = c.prodend;
     alert_enable_t en = RomAlertClassEnable(cls);
-    EXPECT_CALL(alert_, alert_configure(index, cls, en))
+    EXPECT_CALL(alert_, alert_configure(i, cls, en))
         .WillOnce(Return(kErrorOk));
-    index += 1;
   }
   ExpectClassConfigure();
   EXPECT_EQ(shutdown_init(kLcStateProdEnd), kErrorOk);
@@ -362,13 +382,12 @@

 TEST_F(ShutdownTest, InitializeDev) {
   SetupOtpReads();
-  uint32_t index = 0;
-  for (const auto &c : kDefaultAlertClassification) {
+  for(size_t i = 0; i < ALERT_HANDLER_ALERT_CLASS_MULTIREG_COUNT; ++i) {
+    const auto &c = kDefaultAlertClassification[i];
     alert_class_t cls = c.dev;
     alert_enable_t en = RomAlertClassEnable(cls);
-    EXPECT_CALL(alert_, alert_configure(index, cls, en))
+    EXPECT_CALL(alert_, alert_configure(i, cls, en))
         .WillOnce(Return(kErrorOk));
-    index += 1;
   }
   ExpectClassConfigure();
   EXPECT_EQ(shutdown_init(kLcStateDev), kErrorOk);
@@ -376,13 +395,12 @@

 TEST_F(ShutdownTest, InitializeRma) {
   SetupOtpReads();
-  uint32_t index = 0;
-  for (const auto &c : kDefaultAlertClassification) {
+  for(size_t i = 0; i < ALERT_HANDLER_ALERT_CLASS_MULTIREG_COUNT; ++i) {
+    const auto &c = kDefaultAlertClassification[i];
     alert_class_t cls = c.rma;
     alert_enable_t en = RomAlertClassEnable(cls);
-    EXPECT_CALL(alert_, alert_configure(index, cls, en))
+    EXPECT_CALL(alert_, alert_configure(i, cls, en))
         .WillOnce(Return(kErrorOk));
-    index += 1;
   }
   ExpectClassConfigure();
   EXPECT_EQ(shutdown_init(kLcStateRma), kErrorOk);


Handled a couple how-to-construct-the-transaction disk_ack_signals in serializer_filestream.cc.

--- src/mock/serializer_filestream.cc
+++ src/mock/serializer_filestream.cc
@@ -13,8 +13,7 @@
     mirrored_cache_config_t config;
     cache_.init(new cache_t(serializer, config, &get_global_perfmon_collection()));
     if (cache_->contains_block(0)) {
-        // SAMRSI: Call a different txn constructor, instead of passing a NULL disk_ack_signal?
-        transaction_t txn(cache_.get(), rwi_read, 0, repli_timestamp_t::invalid, order_token_t::ignore, NULL);
+        transaction_t txn(cache_.get(), rwi_read, order_token_t::ignore);
         buf_lock_t bufzero(&txn, 0, rwi_read);
         const void *data = bufzero.get_data_read();
         known_size_ = *static_cast<const int64_t *>(data);
@@ -50,8 +49,7 @@
         return -1;
     }

-    // SAMRSI: Call a different txn constructor, instead of passing a NULL disk_ack_signal?
-    transaction_t txn(cache_.get(), rwi_read, 0, repli_timestamp_t::invalid, order_token_t::ignore, NULL);
+    transaction_t txn(cache_.get(), rwi_read, order_token_t::ignore);
     buf_lock_t block(&txn, block_number, rwi_read);
     const char *data = static_cast<const char *>(block.get_data_read());
     memcpy(p, data + block_offset, num_copied);


Avoid numerical stability issues in MEAN test

Fix flaky test in XNNPACK delegate

PiperOrigin-RevId: 316176756
Change-Id: I24ca84f807708f58971f3e29251734e5db8505fc

--- tensorflow/lite/delegates/xnnpack/reduce_tester.cc
+++ tensorflow/lite/delegates/xnnpack/reduce_tester.cc
@@ -37,8 +37,8 @@
                         TfLiteDelegate* delegate) const {
   std::random_device random_device;
   auto rng = std::mt19937(random_device());
-  auto input_rng = std::bind(
-      std::uniform_real_distribution<float>(-15.0f, 15.0f), std::ref(rng));
+  auto input_rng =
+      std::bind(std::uniform_real_distribution<float>(), std::ref(rng));

   std::vector<char> buffer = CreateTfLiteModel(reduce_op);
   const Model* model = GetModel(buffer.data());


debugger: partially rever Qml&C++ action enabling logic

--- src/plugins/debugger/debuggeruiswitcher.cpp
+++ src/plugins/debugger/debuggeruiswitcher.cpp
@@ -306,7 +306,8 @@
     d->m_mainWindow->setDockActionsVisible(d->m_inDebugMode);
     hideInactiveWidgets();

-    if (mode->id() != Constants::MODE_DEBUG || DebuggerPlugin::instance()->hasSnapsnots())
+    if (mode->id() != Constants::MODE_DEBUG)
+        //|| DebuggerPlugin::instance()->hasSnapsnots())
        return;

     DebuggerLanguages activeLangs;


CODA: Proper cleanup of CodaDevice in codagdbadapter

--- src/plugins/debugger/gdb/codagdbadapter.cpp
+++ src/plugins/debugger/gdb/codagdbadapter.cpp
@@ -1036,7 +1036,7 @@
     QSharedPointer<QTcpSocket> codaSocket;
     if (parameters.communicationChannel ==
             DebuggerStartParameters::CommunicationChannelTcpIp) {
-        m_codaDevice = QSharedPointer<CodaDevice>(new CodaDevice);
+        m_codaDevice = QSharedPointer<CodaDevice>(new CodaDevice, &CodaDevice::deleteLater);
         setupTrkDeviceSignals();
         codaSocket = QSharedPointer<QTcpSocket>(new QTcpSocket);
         m_codaDevice->setDevice(codaSocket);


fix BoxBOD in the first case : now all tests pass

--- unsupported/test/NonLinear.cpp
+++ unsupported/test/NonLinear.cpp
@@ -1372,28 +1372,23 @@
   Eigen::MatrixXd fjac;
   VectorXi ipvt;

-#if 0
   /*
    * First try
    */
   x<< 1., 1.;
   // do the computation
-  info = ei_lmder<BoxBOD_functor, double>(x, fvec, nfev, njev, fjac, ipvt, diag);
-          1, 100., 14000, Eigen::machine_epsilon<double>(), Eigen::machine_epsilon<double>());
-
-  // check return value
-  printf("info=%d, f,j: %d, %d\n", info, nfev, njev);
-  printf("norm2 =  %.50g\n", fvec.squaredNorm());
-  std::cout << x << std::endl;
-  VERIFY( 1 == info);
-  VERIFY( 10 == nfev);
-  VERIFY( 6 == njev);
+  info = ei_lmder<BoxBOD_functor, double>(x, fvec, nfev, njev, fjac, ipvt, diag,
+          1, 10., 400, 1E6*Eigen::machine_epsilon<double>(), 1E6*Eigen::machine_epsilon<double>());
+
+  // check return value
+  VERIFY( 1 == info);
+  VERIFY( 31 == nfev);
+  VERIFY( 25  == njev);
   // check norm^2
   VERIFY_IS_APPROX(fvec.squaredNorm(), 1.1680088766E+03);
   // check x
   VERIFY_IS_APPROX(x[0], 2.1380940889E+02);
   VERIFY_IS_APPROX(x[1], 5.4723748542E-01);
-#endif

   /*
    * Second try


Some minor cleaning up in our simulation plugin (#112).

--- src/plugins/misc/Core/src/centralwidget.cpp
+++ src/plugins/misc/Core/src/centralwidget.cpp
@@ -7,6 +7,7 @@
 #include "filemanager.h"
 #include "plugin.h"
 #include "usermessagewidget.h"
+#include "viewwidget.h"

 //==============================================================================

@@ -1108,7 +1109,7 @@
             // (should the view be of the right type) to keep track of any
             // request for a change in its corresponding file tab icon

-            Widget *newViewWidget = qobject_cast<Widget *>(newView);
+            ViewWidget *newViewWidget = qobject_cast<ViewWidget *>(newView);

             if (newViewWidget)
                 connect(newViewWidget, SIGNAL(fileTabIcon(const QString &, const QIcon &)),


small fix

small fix

--- src/monitor/provideInfoAction.cpp
+++ src/monitor/provideInfoAction.cpp
@@ -244,12 +244,14 @@
 	, m_nodeIndicator( _nodeIndicator )
 {
 	initiate();
+	process_event( CProvideInfoEvent() );
 }

 CProvideInfoAction::CProvideInfoAction( common::CInfoKind::Enum _infoKind )
 	: m_infoKind( _infoKind )
 {
 	initiate();
+	process_event( CAskForInfoEvent() );
 }

 void


NIMultiAnalog: Fix voltage range detection

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

--- DeviceAdapters/NIMultiAnalog/NIMultiAnalog.cpp
+++ DeviceAdapters/NIMultiAnalog/NIMultiAnalog.cpp
@@ -300,9 +300,9 @@
 int MultiAnalogOutHub::GetVoltageRangeForDevice(
    const std::string& device, double& minVolts, double& maxVolts)
 {
-   const int MAX_PORTS = 64;
-   float64 ranges[2 * MAX_PORTS];
-   for (int i = 0; i < MAX_PORTS; ++i)
+   const int MAX_RANGES = 64;
+   float64 ranges[2 * MAX_RANGES];
+   for (int i = 0; i < MAX_RANGES; ++i)
    {
       ranges[2 * i] = 0.0;
       ranges[2 * i + 1] = 0.0;
@@ -316,22 +316,26 @@
       return TranslateNIError(nierr);
    }

-   // Find the common min and max.
-   double commonMin = ranges[0];
-   double commonMax = ranges[1];
-   for (int i = 0; i < MAX_PORTS; ++i)
+   minVolts = ranges[0];
+   maxVolts = ranges[1];
+   for (int i = 0; i < MAX_RANGES; ++i)
    {
       if (ranges[2 * i] == 0.0 && ranges[2 * i + 1] == 0.0)
          break;
-
-      if (ranges[2 * i] != commonMin)
-         return ERR_NONUNIFORM_CHANNEL_VOLTAGE_RANGES;
-      if (ranges[2 * i + 1] != commonMax)
-         return ERR_NONUNIFORM_CHANNEL_VOLTAGE_RANGES;
-   }
-
-   minVolts = commonMin;
-   maxVolts = commonMax;
+      LogMessage(("Possible voltage range " +
+         boost::lexical_cast<std::string>(ranges[2 * i]) + " V to " +
+         boost::lexical_cast<std::string>(ranges[2 * i + 1]) + " V").c_str(),
+         true);
+      if (ranges[2 * i + 1] > maxVolts)
+      {
+         minVolts = ranges[2 * i];
+         maxVolts = ranges[2 * i + 1];
+      }
+   }
+      LogMessage(("Selected voltage range " +
+         boost::lexical_cast<std::string>(minVolts) + " V to " +
+         boost::lexical_cast<std::string>(maxVolts) + " V").c_str(),
+         true);

    return DEVICE_OK;
 }