Account better for planning cost when choosing whether to use custom plans.

The previous coding in plancache.c essentially used 10% of the estimated
runtime as its cost estimate for planning.  This can be pretty bogus,
especially when the estimated runtime is very small, such as in a simple
expression plan created by plpgsql, or a simple INSERT ... VALUES.

While we don't have a really good handle on how planning time compares
to runtime, it seems reasonable to use an estimate based on the number of
relations referenced in the query, with a rather large multiplier.  This
patch uses 1000 * cpu_operator_cost * (nrelations + 1), so that even a
trivial query will be charged 1000 * cpu_operator_cost for planning.
This should address the problem reported by Marc Cousin and others that
9.2 and up prefer custom plans in cases where the planning time greatly
exceeds what can be saved.

--- src/backend/utils/cache/plancache.c
+++ src/backend/utils/cache/plancache.c
@@ -54,6 +54,7 @@
 #include "executor/executor.h"
 #include "executor/spi.h"
 #include "nodes/nodeFuncs.h"
+#include "optimizer/cost.h"
 #include "optimizer/planmain.h"
 #include "optimizer/prep.h"
 #include "parser/analyze.h"
@@ -91,7 +92,7 @@
 				ParamListInfo boundParams);
 static bool choose_custom_plan(CachedPlanSource *plansource,
 				   ParamListInfo boundParams);
-static double cached_plan_cost(CachedPlan *plan);
+static double cached_plan_cost(CachedPlan *plan, bool include_planner);
 static void AcquireExecutorLocks(List *stmt_list, bool acquire);
 static void AcquirePlannerLocks(List *stmt_list, bool acquire);
 static void ScanQueryForLocks(Query *parsetree, bool acquire);
@@ -998,15 +999,16 @@
 	avg_custom_cost = plansource->total_custom_cost / plansource->num_custom_plans;

 	/*
-	 * Prefer generic plan if it's less than 10% more expensive than average
-	 * custom plan.  This threshold is a bit arbitrary; it'd be better if we
-	 * had some means of comparing planning time to the estimated runtime cost
-	 * differential.
+	 * Prefer generic plan if it's less expensive than the average custom
+	 * plan.  (Because we include a charge for cost of planning in the
+	 * custom-plan costs, this means the generic plan only has to be less
+	 * expensive than the execution cost plus replan cost of the custom
+	 * plans.)
 	 *
 	 * Note that if generic_cost is -1 (indicating we've not yet determined
 	 * the generic plan cost), we'll always prefer generic at this point.
 	 */
-	if (plansource->generic_cost < avg_custom_cost * 1.1)
+	if (plansource->generic_cost < avg_custom_cost)
 		return false;

 	return true;
@@ -1014,9 +1016,13 @@

 /*
  * cached_plan_cost: calculate estimated cost of a plan
+ *
+ * If include_planner is true, also include the estimated cost of constructing
+ * the plan.  (We must factor that into the cost of using a custom plan, but
+ * we don't count it for a generic plan.)
  */
 static double
-cached_plan_cost(CachedPlan *plan)
+cached_plan_cost(CachedPlan *plan, bool include_planner)
 {
 	double		result = 0;
 	ListCell   *lc;
@@ -1029,6 +1035,34 @@
 			continue;			/* Ignore utility statements */

 		result += plannedstmt->planTree->total_cost;
+
+		if (include_planner)
+		{
+			/*
+			 * Currently we use a very crude estimate of planning effort based
+			 * on the number of relations in the finished plan's rangetable.
+			 * Join planning effort actually scales much worse than linearly
+			 * in the number of relations --- but only until the join collapse
+			 * limits kick in.	Also, while inheritance child relations surely
+			 * add to planning effort, they don't make the join situation
+			 * worse.  So the actual shape of the planning cost curve versus
+			 * number of relations isn't all that obvious.  It will take
+			 * considerable work to arrive at a less crude estimate, and for
+			 * now it's not clear that's worth doing.
+			 *
+			 * The other big difficulty here is that we don't have any very
+			 * good model of how planning cost compares to execution costs.
+			 * The current multiplier of 1000 * cpu_operator_cost is probably
+			 * on the low side, but we'll try this for awhile before making a
+			 * more aggressive correction.
+			 *
+			 * If we ever do write a more complicated estimator, it should
+			 * probably live in src/backend/optimizer/ not here.
+			 */
+			int			nrelations = list_length(plannedstmt->rtable);
+
+			result += 1000.0 * cpu_operator_cost * (nrelations + 1);
+		}
 	}

 	return result;
@@ -1104,7 +1138,7 @@
 								MemoryContextGetParent(plansource->context));
 			}
 			/* Update generic_cost whenever we make a new generic plan */
-			plansource->generic_cost = cached_plan_cost(plan);
+			plansource->generic_cost = cached_plan_cost(plan, false);

 			/*
 			 * If, based on the now-known value of generic_cost, we'd not have
@@ -1133,7 +1167,7 @@
 		/* Accumulate total costs of custom plans, but 'ware overflow */
 		if (plansource->num_custom_plans < INT_MAX)
 		{
-			plansource->total_custom_cost += cached_plan_cost(plan);
+			plansource->total_custom_cost += cached_plan_cost(plan, true);
 			plansource->num_custom_plans++;
 		}
 	}


Added if statements to TBTKExit and TBTKAssert, checking whether log is open or not before attempting to close it.

--- TBTK/calc/TightBindingLib/include/TBTKMacros.h
+++ TBTK/calc/TightBindingLib/include/TBTKMacros.h
@@ -34,7 +34,8 @@
 		if(std::strcmp(hint, "") != 0)	\
 			TBTK::Util::Streams::err << "\tHint: " << hint << "\n";	\
 		TBTK::Util::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n";	\
-		Util::Streams::closeLog();	\
+		if(Util::Streams::logIsOpen())	\
+			Util::Streams::closeLog();	\
 		exit(1);	\
 	}

@@ -44,7 +45,8 @@
 	if(std::strcmp(hint, "") != 0)	\
 		TBTK::Util::Streams::err << "\tHint: " << hint << "\n";	\
 	TBTK::Util::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n";	\
-	Util::Streams::closeLog();	\
+	if(Util::Streams::logIsOpen())	\
+		Util::Streams::closeLog();	\
 	exit(1);

 #endif


coda: cleanup coda_lookup, use dsplice_alias

Signed-off-by: Jan Harkes <4f1a5e5a56d3352d4f3e456b1f2cee6192a5a7a3@cs.cmu.edu>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- fs/coda/dir.c
+++ fs/coda/dir.c
@@ -97,58 +97,45 @@
 /* access routines: lookup, readlink, permission */
 static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
 {
-	struct inode *res_inode = NULL;
+	struct inode *inode = NULL;
 	struct CodaFid resfid = { { 0, } };
-	int dropme = 0; /* to indicate entry should not be cached */
 	int type = 0;
 	int error = 0;
 	const char *name = entry->d_name.name;
 	size_t length = entry->d_name.len;
-
-	if ( length > CODA_MAXNAMLEN ) {
-	        printk("name too long: lookup, %s (%*s)\n",
+
+	if (length > CODA_MAXNAMLEN) {
+		printk(KERN_ERR "name too long: lookup, %s (%*s)\n",
 		       coda_i2s(dir), (int)length, name);
 		return ERR_PTR(-ENAMETOOLONG);
 	}

-	lock_kernel();
-        /* control object, create inode on the fly */
-        if (coda_isroot(dir) && coda_iscontrol(name, length)) {
-	        error = coda_cnode_makectl(&res_inode, dir->i_sb);
-		dropme = 1;
-                goto exit;
-        }
-
-	error = venus_lookup(dir->i_sb, coda_i2f(dir),
-			     (const char *)name, length, &type, &resfid);
-
-	res_inode = NULL;
-	if (!error) {
-		if (type & CODA_NOCACHE) {
-			type &= (~CODA_NOCACHE);
-			dropme = 1;
-		}
-
-	    	error = coda_cnode_make(&res_inode, &resfid, dir->i_sb);
-		if (error) {
-			unlock_kernel();
-			return ERR_PTR(error);
-		}
-	} else if (error != -ENOENT) {
-		unlock_kernel();
+	/* control object, create inode on the fly */
+	if (coda_isroot(dir) && coda_iscontrol(name, length)) {
+		error = coda_cnode_makectl(&inode, dir->i_sb);
+		type = CODA_NOCACHE;
+		goto exit;
+	}
+
+	lock_kernel();
+
+	error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length,
+			     &type, &resfid);
+	if (!error)
+		error = coda_cnode_make(&inode, &resfid, dir->i_sb);
+
+	unlock_kernel();
+
+	if (error && error != -ENOENT)
 		return ERR_PTR(error);
-	}

 exit:
-	entry->d_time = 0;
 	entry->d_op = &coda_dentry_operations;
-	d_add(entry, res_inode);
-	if ( dropme ) {
-		d_drop(entry);
-		coda_flag_inode(res_inode, C_VATTR);
-	}
-	unlock_kernel();
-        return NULL;
+
+	if (inode && (type & CODA_NOCACHE))
+		coda_flag_inode(inode, C_VATTR | C_PURGE);
+
+	return d_splice_alias(inode, entry);
 }


lgc: restore built-ins list to alphabetical order

Also reformat the table in a way that clang-format does not mess up.

Change-Id: I8490445f8cd2cb663ebfe9922162f85732fede19

--- lgc/interface/lgc/BuiltInDefs.h
+++ lgc/interface/lgc/BuiltInDefs.h
@@ -51,60 +51,55 @@
 //
 // If this file is included without the BUILTIN macro defined, then it declares the BuiltInKind enum.

-BUILTIN(BaryCoordNoPersp, 4992, N, P, v2f32)         // Linearly-interpolated (I,J) at pixel center
-BUILTIN(BaryCoordNoPerspCentroid, 4993, N, P, v2f32) // Linearly-interpolated (I,J) at pixel centroid
-BUILTIN(BaryCoordNoPerspSample, 4994, N, P, v2f32)   // Linearly-interpolated (I,J) at each covered sample
-BUILTIN(BaryCoordPullModel, 4998, N, P, v3f32)       // (1/w,1/I,1/J) at pixel center
-BUILTIN(BaryCoordSmooth, 4995, N, P, v2f32)          // Perspective-interpolated (I,J) at pixel center
-BUILTIN(BaryCoordSmoothCentroid, 4996, N, P, v2f32)  // Perspective-interpolated (I,J) at pixel centroid
-BUILTIN(BaryCoordSmoothSample, 4997, N, P, v2f32)    // Perspective-interpolated (I,J) at each covered sample
-BUILTIN(BaseInstance, 4425, N, V, i32)               // Base instance ID
-BUILTIN(BaseVertex, 4424, N, V, i32)                 // Base vertex
-BUILTIN(ClipDistance, 3, MVHDG, HDGP, af32)          // Array of clip distances
-BUILTIN(CullDistance, 4, MVHDG, HDGP, af32)          // Array of cull distances
-BUILTIN(DeviceIndex, 4438, N, TMVHDGPC, i32)         // Device index of the physical device
-BUILTIN(DrawIndex, 4426, N, TMV, i32)                // Draw index
-BUILTIN(FragCoord, 15, N, P, v4f32)                  // (x,y,z,1/w) of the current fragment
-BUILTIN(FragDepth, 22, P, N, f32)                    // Fragment depth
-BUILTIN(FragStencilRef, 5014, P, N, i32)             // Stencil reference value
-BUILTIN(FrontFacing, 17, N, P, i1)                   // Front-facing fragment flag
-BUILTIN(GlobalInvocationId, 28, N, TMC, v3i32)       // Invocation ID within global workgroup
-BUILTIN(HelperInvocation, 23, N, P, i1)              // Helper invocation flag
-BUILTIN(InstanceIndex, 43, N, V, i32)                // Instance index
-BUILTIN(InvocationId, 8, N, HG, i32)                 // Invocation ID
-BUILTIN(Layer, 9, MVDG, P, i32)                      // Layer of multi-layer framebuffer attachment
-BUILTIN(LocalInvocationId, 27, N, TMC, v3i32)        // Invocation location within local workgroup
-BUILTIN(LocalInvocationIndex, 29, N, TMC, i32)       // Linearized LocalInvocationId
-BUILTIN(NumSubgroups, 38, N, TMC, i32)               // Number of subgroups in the local workgroup
-BUILTIN(NumWorkgroups, 24, N, TMC, v3i32)            // Number of local workgroups in the dispatch
-BUILTIN(PatchVertices, 14, N, HD, i32)               // Number of vertices in the input patch
-BUILTIN(PointCoord, 16, N, P, v2f32)                 // Coord of current fragment within the point
-BUILTIN(PointSize, 1, MVHDG, HDG, f32)               // Size of point primitives
-BUILTIN(Position, 0, MVHDG, HDG, v4f32)              // Vertex position
-BUILTIN(PrimitiveId, 7, MG, HDGP, i32)               // Index of the current primitive
-BUILTIN(SampleId, 18, N, P, i32)         // Sample ID
-BUILTIN(SampleMask, 20, P, P, ai32)      // Sample mask coverage
-BUILTIN(SamplePosition, 19, N, P, v2f32) // Sub-pixel position of the sample being shaded
-BUILTIN(SubgroupEqMask, 4416, N, TMVHDGPC,
-        v4i32) // Subgroup invocations bitmask where bit index == SubgroupLocalInvocationId
-BUILTIN(SubgroupGeMask, 4417, N, TMVHDGPC,
-        v4i32) // Subgroup invocations bitmask where bit index >= SubgroupLocalInvocationId
-BUILTIN(SubgroupGtMask, 4418, N, TMVHDGPC,
-        v4i32)                       // Subgroup invocations bitmask where bit index > SubgroupLocalInvocationId
-BUILTIN(SubgroupId, 40, N, TMC, i32) // Index of subgroup within local workgroup
-BUILTIN(SubgroupLeMask, 4419, N, TMVHDGPC,
-        v4i32) // Subgroup invocations bitmask where bit index <= SubgroupLocalInvocationId
+BUILTIN(BaryCoordNoPersp, 4992, N, P, v2f32)             // Linearly-interpolated (I,J) at pixel center
+BUILTIN(BaryCoordNoPerspCentroid, 4993, N, P, v2f32)     // Linearly-interpolated (I,J) at pixel centroid
+BUILTIN(BaryCoordNoPerspSample, 4994, N, P, v2f32)       // Linearly-interpolated (I,J) at each covered sample
+BUILTIN(BaryCoordPullModel, 4998, N, P, v3f32)           // (1/w,1/I,1/J) at pixel center
+BUILTIN(BaryCoordSmooth, 4995, N, P, v2f32)              // Perspective-interpolated (I,J) at pixel center
+BUILTIN(BaryCoordSmoothCentroid, 4996, N, P, v2f32)      // Perspective-interpolated (I,J) at pixel centroid
+BUILTIN(BaryCoordSmoothSample, 4997, N, P, v2f32)        // Perspective-interpolated (I,J) at each covered sample
+BUILTIN(BaseInstance, 4425, N, V, i32)                   // Base instance ID
+BUILTIN(BaseVertex, 4424, N, V, i32)                     // Base vertex
+BUILTIN(ClipDistance, 3, MVHDG, HDGP, af32)              // Array of clip distances
+BUILTIN(CullDistance, 4, MVHDG, HDGP, af32)              // Array of cull distances
+BUILTIN(DeviceIndex, 4438, N, TMVHDGPC, i32)             // Device index of the physical device
+BUILTIN(DrawIndex, 4426, N, TMV, i32)                    // Draw index
+BUILTIN(FragCoord, 15, N, P, v4f32)                      // (x,y,z,1/w) of the current fragment
+BUILTIN(FragDepth, 22, P, N, f32)                        // Fragment depth
+BUILTIN(FragStencilRef, 5014, P, N, i32)                 // Stencil reference value
+BUILTIN(FrontFacing, 17, N, P, i1)                       // Front-facing fragment flag
+BUILTIN(GlobalInvocationId, 28, N, TMC, v3i32)           // Invocation ID within global workgroup
+BUILTIN(HelperInvocation, 23, N, P, i1)                  // Helper invocation flag
+BUILTIN(InstanceIndex, 43, N, V, i32)                    // Instance index
+BUILTIN(InvocationId, 8, N, HG, i32)                     // Invocation ID
+BUILTIN(Layer, 9, MVDG, P, i32)                          // Layer of multi-layer framebuffer attachment
+BUILTIN(LocalInvocationId, 27, N, TMC, v3i32)            // Invocation location within local workgroup
+BUILTIN(LocalInvocationIndex, 29, N, TMC, i32)           // Linearized LocalInvocationId
+BUILTIN(NumSubgroups, 38, N, TMC, i32)                   // Number of subgroups in the local workgroup
+BUILTIN(NumWorkgroups, 24, N, TMC, v3i32)                // Number of local workgroups in the dispatch
+BUILTIN(PatchVertices, 14, N, HD, i32)                   // Number of vertices in the input patch
+BUILTIN(PointCoord, 16, N, P, v2f32)                     // Coord of current fragment within the point
+BUILTIN(PointSize, 1, MVHDG, HDG, f32)                   // Size of point primitives
+BUILTIN(Position, 0, MVHDG, HDG, v4f32)                  // Vertex position
+BUILTIN(PrimitiveId, 7, MG, HDGP, i32)                   // Index of the current primitive
+BUILTIN(PrimitiveShadingRate, 4432, MVG, N, i32)         // Shading rate used for fragments generated for this primitive
+BUILTIN(SampleId, 18, N, P, i32)                         // Sample ID
+BUILTIN(SampleMask, 20, P, P, ai32)                      // Sample mask coverage
+BUILTIN(SamplePosition, 19, N, P, v2f32)                 // Sub-pixel position of the sample being shaded
+BUILTIN(ShadingRate, 4444, N, P, i32)                    // Current fragment's shading rate
+BUILTIN(SubgroupEqMask, 4416, N, TMVHDGPC, v4i32)        // Subgroup mask where bit index == SubgroupLocalInvocationId
+BUILTIN(SubgroupGeMask, 4417, N, TMVHDGPC, v4i32)        // Subgroup mask where bit index >= SubgroupLocalInvocationId
+BUILTIN(SubgroupGtMask, 4418, N, TMVHDGPC, v4i32)        // Subgroup mask where bit index > SubgroupLocalInvocationId
+BUILTIN(SubgroupId, 40, N, TMC, i32)                     // Index of subgroup within local workgroup
+BUILTIN(SubgroupLeMask, 4419, N, TMVHDGPC, v4i32)        // Subgroup mask where bit index <= SubgroupLocalInvocationId
 BUILTIN(SubgroupLocalInvocationId, 41, N, TMVHDGPC, i32) // Index of invocation within subgroup
-BUILTIN(SubgroupLtMask, 4420, N, TMVHDGPC,
-        v4i32)                              // Subgroup invocations bitmask where bit index < SubgroupLocalInvocationId
-BUILTIN(SubgroupSize, 36, N, TMVHDGPC, i32) // Number of invocations in the subgroup
-BUILTIN(TessCoord, 13, N, D, v3f32)         // (u,v,w) coord of tessellated vertex in patch
-BUILTIN(TessLevelInner, 12, H, D, a2f32)    // Tessellation inner levels
-BUILTIN(TessLevelOuter, 11, H, D, a4f32)    // Tessellation outer levels
-BUILTIN(VertexIndex, 42, N, V, i32)         // Index of current vertex
-BUILTIN(ViewIndex, 4440, N, VHDGP, i32)     // View index
-BUILTIN(ViewportIndex, 10, MVDG, P, i32)    // Viewport index
-BUILTIN(WorkgroupId, 26, N, TMC, v3i32)     // ID of global workgroup
-BUILTIN(WorkgroupSize, 25, N, C, v3i32)     // Size of global workgroup
-BUILTIN(PrimitiveShadingRate, 4432, MVG, N, i32) // Shading rate used for fragments generated for this primitive
-BUILTIN(ShadingRate, 4444, N, P, i32)            // Current fragment's shading rate
+BUILTIN(SubgroupLtMask, 4420, N, TMVHDGPC, v4i32)        // Subgroup mask where bit index < SubgroupLocalInvocationId
+BUILTIN(SubgroupSize, 36, N, TMVHDGPC, i32)              // Number of invocations in the subgroup
+BUILTIN(TessCoord, 13, N, D, v3f32)                      // (u,v,w) coord of tessellated vertex in patch
+BUILTIN(TessLevelInner, 12, H, D, a2f32)                 // Tessellation inner levels
+BUILTIN(TessLevelOuter, 11, H, D, a4f32)                 // Tessellation outer levels
+BUILTIN(VertexIndex, 42, N, V, i32)                      // Index of current vertex
+BUILTIN(ViewIndex, 4440, N, VHDGP, i32)                  // View index
+BUILTIN(ViewportIndex, 10, MVDG, P, i32)                 // Viewport index
+BUILTIN(WorkgroupId, 26, N, TMC, v3i32)                  // ID of global workgroup
+BUILTIN(WorkgroupSize, 25, N, C, v3i32)                  // Size of global workgroup


Fix d304f98

Fix d304f98

--- src/service/jsp_service.c
+++ src/service/jsp_service.c
@@ -149,5 +149,5 @@
 }

 int new_service_is_started;
-d
+
 EMBOX_WEB_SERVICE("new.html", &new_service_is_started, entry_point);


Update malloc.c to define AK_EXTERN_C* only if not already defined

--- include/akmalloc/malloc.c
+++ include/akmalloc/malloc.c
@@ -197,12 +197,14 @@

 /********************** setup begin ************************/
-#if defined(__cplusplus)
-#  define AK_EXTERN_C_BEGIN extern "C"  {
-#  define AK_EXTERN_C_END   }/*extern C*/
-#else
-#  define AK_EXTERN_C_BEGIN
-#  define AK_EXTERN_C_END
+#if !defined(AK_EXTERN_C_BEGIN)
+#  if defined(__cplusplus)
+#    define AK_EXTERN_C_BEGIN extern "C"  {
+#    define AK_EXTERN_C_END   }/*extern C*/
+#  else
+#    define AK_EXTERN_C_BEGIN
+#    define AK_EXTERN_C_END
+#  endif
 #endif

 #if !defined(AKMALLOC_INCLUDE_ONLY)


Drop redundant test with isnumchar

Drop redundant test with isnumchar

fix pvs-studio error 'V501 There are identical sub-expressions '(c) == '_'' to
the left and to the right of the '||' operator.'. isnumchar() is a macro
defined as (nasm_isalnum(c) || (c) == '_')

Signed-off-by: Martin Lindhe <00944ce1c725c065da4fa2c73a16f47748a35b96@ubique.se>
Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@gmail.com>

--- asm/stdscan.c
+++ asm/stdscan.c
@@ -223,7 +223,7 @@
                 is_float = true;
                 if (*stdscan_bufptr == '+' || *stdscan_bufptr == '-')
                     stdscan_bufptr++;
-            } else if (isnumchar(c) || c == '_')
+            } else if (isnumchar(c))
                 ; /* just advance */
             else if (c == '.')
                 is_float = true;


last_read should not be static

last_read should not be static

--- audio_engine.c
+++ audio_engine.c
@@ -185,7 +185,8 @@
 ao_play_file()
 {
 	int buf_len, buf_size;
-	static bool paused = false, shifted = false, last_read = false;
+	static bool paused = false, shifted = false;
+	bool last_read = false;
 	sfinfo.format = 0;
 	int read_cnt = 0;
 	int i, play_chunk;


Removed reserved COM and LPT check.

Removed reserved COM and LPT check.

--- winpr/libwinpr/comm/comm.c
+++ winpr/libwinpr/comm/comm.c
@@ -993,49 +993,6 @@
 	return FALSE;
 }

-
-/* Extended API */
-
-static BOOL _IsReservedCommDeviceName(LPCTSTR lpName)
-{
-	int i;
-
-	if (!CommInitialized())
-		return FALSE;
-
-	/* Serial ports, COM1-9 */
-	for (i = 1; i < 10; i++)
-	{
-		TCHAR genericName[5];
-
-		if (_stprintf_s(genericName, 5, _T("COM%d"), i) < 0)
-		{
-			return FALSE;
-		}
-
-		if (_tcscmp(genericName, lpName) == 0)
-			return TRUE;
-	}
-
-	/* Parallel ports, LPT1-9 */
-	for (i = 1; i < 10; i++)
-	{
-		TCHAR genericName[5];
-
-		if (_stprintf_s(genericName, 5, _T("LPT%d"), i) < 0)
-		{
-			return FALSE;
-		}
-
-		if (_tcscmp(genericName, lpName) == 0)
-			return TRUE;
-	}
-
-	/* FIXME: what about PRN ? */
-	return FALSE;
-}
-
-
 /**
  * Returns TRUE on success, FALSE otherwise. To get extended error
  * information, call GetLastError.
@@ -1061,15 +1018,6 @@
 	{
 		SetLastError(ERROR_DLL_INIT_FAILED);
 		goto error_handle;
-	}
-
-	if (_tcsncmp(lpDeviceName, _T("\\\\.\\"), 4) != 0)
-	{
-		if (_IsReservedCommDeviceName(lpDeviceName))
-		{
-			SetLastError(ERROR_INVALID_DATA);
-			goto error_handle;
-		}
 	}

 	storedDeviceName = _tcsdup(lpDeviceName);


Don't free opt because it is inserted into the hash table as-is

--- extensions/adblock.c
+++ extensions/adblock.c
@@ -805,7 +805,6 @@
     g_free (patt);
     g_free (fixed_patt);
     g_free (format_patt);
-    g_free (opts);
 }

 static void


kinetis: mark closing #endif for MODULE_PERIPH_GPIO_IRQ

--- cpu/kinetis/periph/gpio.c
+++ cpu/kinetis/periph/gpio.c
@@ -115,7 +115,7 @@
 static uint32_t isr_map[ISR_MAP_SIZE];

 static const uint8_t port_irqs[] = PORT_IRQS;
-#endif
+#endif /* MODULE_PERIPH_GPIO_IRQ */

 static inline PORT_Type *port(gpio_t pin)
 {
@@ -176,7 +176,7 @@
     int ctx = get_ctx(port, pin);
     write_map(port, pin, ctx);
 }
-#endif
+#endif /* MODULE_PERIPH_GPIO_IRQ */

 static inline void clk_en(gpio_t pin)
 {
@@ -211,7 +211,7 @@
      * need to free its interrupt context. We to this only after we
      * re-configured the pin in case an event is happening just in between... */
     uint32_t isr_state = port(pin)->PCR[pin_num(pin)];
-#endif
+#endif /* MODULE_PERIPH_GPIO_IRQ */

     /* set new PCR value */
     port(pin)->PCR[pin_num(pin)] = pcr;
@@ -221,7 +221,7 @@
     if (isr_state & PORT_PCR_IRQC_MASK) {
         ctx_clear(port_num(pin), pin_num(pin));
     }
-#endif
+#endif /* MODULE_PERIPH_GPIO_IRQ */
 }

 int gpio_read(gpio_t pin)


cssvalue: Add transition support for images

--- gtk/gtkcssimagevalue.c
+++ gtk/gtkcssimagevalue.c
@@ -19,7 +19,7 @@

 #include "gtkcssimagevalueprivate.h"

-#include "gtkstylepropertyprivate.h"
+#include "gtkcssimagecrossfadeprivate.h"

 struct _GtkCssValue {
   GTK_CSS_VALUE_BASE
@@ -45,7 +45,13 @@
                                 GtkCssValue *end,
                                 double       progress)
 {
-  return NULL;
+  GtkCssImage *fade;
+
+  fade = _gtk_css_image_cross_fade_new (_gtk_css_image_value_get_image (start),
+                                        _gtk_css_image_value_get_image (end),
+                                        progress);
+
+  return _gtk_css_image_value_new (fade);
 }

 static void


eal/ppc: prefetch operations for IBM Power

This patch add architecture specific prefetch operations for IBM Power
architecture.

Signed-off-by: Chao Zhu <fb95c043d5fa3fcf28eb07d8ee8ac9e1289ed03b@linux.vnet.ibm.com>
Acked-by: David Marchand <f28529695cfa9e3e1eb84e7072aa626af4abb18e@6wind.com>

error: pathspec 'lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h' did not match any file(s) known to git

--- lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h
+++ lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h
@@ -0,0 +1,61 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2014.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of IBM Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_PREFETCH_PPC_64_H_
+#define _RTE_PREFETCH_PPC_64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_prefetch.h"
+
+static inline void rte_prefetch0(volatile void *p)
+{
+	asm volatile ("dcbt 0,%[p],1" : : [p] "r" (p));
+}
+
+static inline void rte_prefetch1(volatile void *p)
+{
+	asm volatile ("dcbt 0,%[p],1" : : [p] "r" (p));
+}
+
+static inline void rte_prefetch2(volatile void *p)
+{
+	asm volatile ("dcbt 0,%[p],1" : : [p] "r" (p));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PREFETCH_PPC_64_H_ */


dlm: cleanup remove unused code

dlm: cleanup remove unused code

Smatch complains because "lkb" is never NULL.  Looking at it, the original
code actually adds the new element to the end of the list fine, so we can
just get rid of the if condition.  This code is four years old and no one
has complained so it must work.

Signed-off-by: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Signed-off-by: David Teigland <cf7ba74ea50525d3d47fcd7a6d69b51121a9f873@redhat.com>

--- fs/dlm/lock.c
+++ fs/dlm/lock.c
@@ -733,10 +733,7 @@
 		if (lkb->lkb_rqmode < mode)
 			break;

-	if (!lkb)
-		list_add_tail(new, head);
-	else
-		__list_add(new, lkb->lkb_statequeue.prev, &lkb->lkb_statequeue);
+	__list_add(new, lkb->lkb_statequeue.prev, &lkb->lkb_statequeue);
 }

 /* add/remove lkb to rsb's grant/convert/wait queue */


intel_edison_fab_c.c: remove uart_init_post hook for miniboard

use uart_init_pre hook instead. Fixes #39

Signed-off-by: Brendan Le Foll <3e0e8c4069934e8b47d99704927a85c66c0ceb33@intel.com>
Signed-off-by: Thomas Ingleby <cea8b9d820e871fd22532c955ca84ff867a004a3@intel.com>

--- src/intel_edison_fab_c.c
+++ src/intel_edison_fab_c.c
@@ -620,7 +620,7 @@
     advance_func->i2c_init_pre = &mraa_intel_edison_i2c_init_pre;
     advance_func->spi_init_pre = &mraa_intel_edison_spi_init_pre;
     advance_func->gpio_mode_replace = &mraa_intel_edsion_mb_gpio_mode;
-    advance_func->uart_init_post = &mraa_intel_edison_uart_init_post;
+    advance_func->uart_init_pre = &mraa_intel_edison_uart_init_pre;
     advance_func->gpio_mmap_setup = &mraa_intel_edison_mmap_setup;

     int pos = 0;


Add BCLog::Logger::m_category_log_levels data member and getter/setter

Co-authored-by: "klementtan <a9a0f6dd3507a47c3a14cd6d4b94f0a9ec6ba1ee@gmail.com>"

--- src/logging.h
+++ src/logging.h
@@ -17,6 +17,7 @@
 #include <list>
 #include <mutex>
 #include <string>
+#include <unordered_map>
 #include <vector>

 static const bool DEFAULT_LOGTIMEMICROS = false;
@@ -92,6 +93,9 @@
          */
         std::atomic_bool m_started_new_line{true};

+        //! Category-specific log level. Overrides `m_log_level`.
+        std::unordered_map<LogFlags, Level> m_category_log_levels GUARDED_BY(m_cs);
+
         //! If there is no category-specific log level, all logs with a severity
         //! level lower than `m_log_level` will be ignored.
         std::atomic<Level> m_log_level{DEFAULT_LOG_LEVEL};
@@ -147,6 +151,17 @@
         void DisconnectTestLogger();

         void ShrinkDebugFile();
+
+        std::unordered_map<LogFlags, Level> CategoryLevels() const
+        {
+            StdLockGuard scoped_lock(m_cs);
+            return m_category_log_levels;
+        }
+        void SetCategoryLogLevel(const std::unordered_map<LogFlags, Level>& levels)
+        {
+            StdLockGuard scoped_lock(m_cs);
+            m_category_log_levels = levels;
+        }

         Level LogLevel() const { return m_log_level.load(); }
         void SetLogLevel(Level level) { m_log_level = level; }


cleanup and tfidf_by_words bug fix

cleanup and tfidf_by_words bug fix

--- include/asap/word_count.h
+++ include/asap/word_count.h
@@ -93,18 +93,7 @@
     }
 };

-/*
-template<typename IndexTy, typename CountTy>
-struct word_catalog_reducer {
-    typedef IndexTy index_type;
-    typedef CountTy count_type;
-    typedef typename index_type::?;
-
-    void operator() ( mapped_type & left, mapped_type & right ) {
-    }
-};
-*/
-
+#if 0
 template<typename MapTy, typename Reducer>
 class map_reducer {
     typedef MapTy type;
@@ -182,6 +171,7 @@
 	return imp_.view()[key];
     }
 };
+#endif

 template<typename WordListTy>
 class word_list_reducer {
@@ -251,6 +241,7 @@
 		// TODO: check performance with std::for_each and std::find
 		// but with optimized codes in functors.
 		// *I = std::toupper( *I );
+		// TODO: vectorize this expression
 		if( *I >= 'a' && *I <= 'z' )
 		    *I = ( *I - 'a' ) + 'A';
 	    }
@@ -612,7 +603,7 @@

 	    size_t fcount = F->second.first; // Number of files involved in.
 	    value_type norm
-		= log10(value_type(num_points + 1) / value_type(fcount + 1));
+		= log10(value_type(num_dimensions + 1) / value_type(fcount + 1));
 	    size_t id = F->second.second; // Word ID

 	    size_t pos = __sync_fetch_and_add( &word_ctr[id], 1 );


change getchar to use %al instead of %rax

--- brainfuc.c
+++ brainfuc.c
@@ -128,7 +128,7 @@
 			b = append(b, &p, &len, "push %rdi\n\t"
 						"call getchar\n\t"
 						"pop %rdi\n\t"
-						"movb %rax, (%rdi)\n\t");
+						"movb %al, (%rdi)\n\t");
 		} else if (currsymbol == '[') {
 			int bnum = cb;
 			if (bi > blen) {


opal-gard: Account for ECC size when clearing partition

When 'opal-gard clear all' is run, it works by erasing the GUARD then
using blockevel_smart_write() to write nothing to the partition. This
second write call is needed because we rely on libflash to set the ECC
bits appropriately when the partition contained ECCed data.

The API for this is a little odd with the caller specifying how much
actual data to write, and libflash writing size + size/8 bytes
since there is one additional ECC byte for every eight bytes of data.

We currently do not account for the extra space consumed by the ECC data
in reset_partition() which is used to handle the 'clear all' command.
Which results in the paritition following the GUARD partition being
partially overwritten when the command is used. This patch fixes the
problem by reducing the length we would normally write by the number
of ECC bytes required.

Signed-off-by: Oliver O'Halloran <3dfaff8fa6ae977f042064a112a6aac576279b9b@gmail.com>
Tested-by: Joel Stanley <4816dabf8db1bc6cac35b3a24cab2ff844b5b0c7@jms.id.au>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.ibm.com>

--- external/gard/gard.c
+++ external/gard/gard.c
@@ -598,6 +598,7 @@

 static int reset_partition(struct gard_ctx *ctx)
 {
+	int no_ecc_len = (ctx->gard_data_len / 9) * 8;
 	struct gard_record *gard;
 	int rc = 0;

@@ -613,7 +614,7 @@
 		goto out;
 	}

-	rc = blocklevel_write(ctx->bl, ctx->gard_data_pos, gard, ctx->gard_data_len);
+	rc = blocklevel_write(ctx->bl, ctx->gard_data_pos, gard, no_ecc_len);
 	if (rc)
 		fprintf(stderr, "Couldn't reset the entire gard partition. Bailing out\n");


gtkplacesidebar: remove obsolete drop state

We didn't use those for some time now.

--- gtk/gtkplacessidebar.c
+++ gtk/gtkplacessidebar.c
@@ -106,22 +106,14 @@
 #define TIMEOUT_EXPAND 500

 /* These are used when a destination-side DND operation is taking place.
- * Normally, when a file is being hovered directly over a bookmark,
- * we’ll be in DROP_STATE_NORMAL.
- *
- * But when a file is being hovered between bookmarks, this means the user
- * may want to create a new bookmark for that file between those bookmarks.
- * In that case, the drop state will be *not* DROP_STATE_NORMAL.
- *
- * When the drop state is FADING_OUT, it means that the user is hovering
- * directly over an existing bookmark and an immediate drop will cause the
- * file being dragged to be dropped on the bookmark, instead of causing
- * a new bookmark to be created.
+ * Normally, when a common drag action is taking place, the state will be
+ * DROP_STATE_NEW_BOOKMARK_ARMED, however, if the client of GtkPlacesSidebar
+ * wants to show hints about the valid targets, we sill set it as
+ * DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT, so the sidebar will show drop hints
+ * until the client says otherwise
  */
 typedef enum {
   DROP_STATE_NORMAL,
-  DROP_STATE_NEW_BOOKMARK_FADING_IN,
-  DROP_STATE_NEW_BOOKMARK_FADING_OUT,
   DROP_STATE_NEW_BOOKMARK_ARMED,
   DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT,
 } DropState;


dlm: fix rcom_names message to self

dlm: fix rcom_names message to self

The recent patch to validate data lengths in rcom_names messages
failed to account for fake messages a node directs to itself before
ever sending it.  In this case we need to fill in the message length
in the header for the validation code to use.

Signed-off-by: David Teigland <cf7ba74ea50525d3d47fcd7a6d69b51121a9f873@redhat.com>

--- fs/dlm/rcom.c
+++ fs/dlm/rcom.c
@@ -215,6 +215,8 @@
 	ls->ls_recover_nodeid = nodeid;

 	if (nodeid == dlm_our_nodeid()) {
+		ls->ls_recover_buf->rc_header.h_length =
+			dlm_config.ci_buffer_size;
 		dlm_copy_master_names(ls, last_name, last_len,
 		                      ls->ls_recover_buf->rc_buf,
 		                      max_size, nodeid);


[CUDA] Fix query for maximum local memory size

--- lib/CL/devices/cuda/pocl-cuda.c
+++ lib/CL/devices/cuda/pocl-cuda.c
@@ -197,7 +197,7 @@
                             CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, data->device);
       cuDeviceGetAttribute (
           (int *)&dev->local_mem_size,
-          CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR, data->device);
+          CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, data->device);
       cuDeviceGetAttribute ((int *)&dev->max_compute_units,
                             CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT,
                             data->device);


x86: fix compat-vdso

x86: fix compat-vdso

Jeff Chua reported that this patch:

> -#define PTE_IDENT_ATTR  0x007          /* PRESENT+RW+USER */
> -#define PDE_IDENT_ATTR  0x067          /* PRESENT+RW+USER+DIRTY+ACCESSED */
> +#define PTE_IDENT_ATTR  0x003          /* PRESENT+RW */
> +#define PDE_IDENT_ATTR  0x063          /* PRESENT+RW+DIRTY+ACCESSED */

broke kernels with CONFIG_COMPAT_VDSO set with this init segfault:

init[1]: segfault at ffffe01c up b7f0dc28 sp bfc26628 error 5 in ld-2.7.90.so[b7f0b000+1c000]

Include USER bit in the PDE_IDENT_ATTR only, as the protection bits
are combined from the PDE and PTE entries. This will allow the high
mapped VDSO page in the case of CONFIG_COMPAT_VDSO to be user
readable.

Reported-by: Jeff Chua <3708ee8170374b692e14ff7040142b373ec55f83@gmail.com>
Signed-off-by: Suresh Siddha <a42fd12510d3895be740fb89f87586733ee62f57@intel.com>
Tested-by: Jeff Chua <3708ee8170374b692e14ff7040142b373ec55f83@gmail.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- include/asm-x86/pgtable.h
+++ include/asm-x86/pgtable.h
@@ -138,8 +138,13 @@
 #ifdef CONFIG_X86_64
 #define __PAGE_KERNEL_IDENT_LARGE_EXEC	__PAGE_KERNEL_LARGE_EXEC
 #else
+/*
+ * For PDE_IDENT_ATTR include USER bit. As the PDE and PTE protection
+ * bits are combined, this will alow user to access the high address mapped
+ * VDSO in the presence of CONFIG_COMPAT_VDSO
+ */
 #define PTE_IDENT_ATTR	 0x003		/* PRESENT+RW */
-#define PDE_IDENT_ATTR	 0x063		/* PRESENT+RW+DIRTY+ACCESSED */
+#define PDE_IDENT_ATTR	 0x067		/* PRESENT+RW+USER+DIRTY+ACCESSED */
 #define PGD_IDENT_ATTR	 0x001		/* PRESENT (no other attributes) */
 #endif


fix SmDm and CoLL declarations

fix SmDm and CoLL declarations

--- src/isomedia/box_funcs.c
+++ src/isomedia/box_funcs.c
@@ -1045,8 +1045,8 @@
 	FBOX_DEFINE_FLAGS_S( GF_ISOM_BOX_TYPE_VPCC, vpcc, "vp08 vp09 encv resv", 1, 0, "vp"),
 	BOX_DEFINE_S( GF_ISOM_BOX_TYPE_VP08, video_sample_entry, "stsd", "vp"),
 	BOX_DEFINE_S( GF_ISOM_BOX_TYPE_VP09, video_sample_entry, "stsd", "vp"),
-	BOX_DEFINE_S(GF_ISOM_BOX_TYPE_SMDM, video_sample_entry, "SmDm", "vp"),
-	BOX_DEFINE_S(GF_ISOM_BOX_TYPE_COLL, video_sample_entry, "CoLL", "vp"),
+	FBOX_DEFINE_FLAGS_S(GF_ISOM_BOX_TYPE_SMDM, SmDm, "vp08 vp09 encv resv", 1, 0, "vp"),
+	FBOX_DEFINE_FLAGS_S(GF_ISOM_BOX_TYPE_COLL, CoLL, "vp08 vp09 encv resv", 1, 0, "vp"),

 	//part20 boxes
 	BOX_DEFINE_S( GF_ISOM_BOX_TYPE_LSR1, lsr1, "stsd", "p20"),


extmod/machine_i2c: Add clock stretching support.

When the clock is too fast for the i2c slave, it can temporarily hold
down the scl line to signal to the master that it needs to wait. The
master should check the scl line when it is releasing it after
transmitting data, and wait for it to be released.

This change has been tested with a logic analyzer and an i2c slace
implemented on an atmega328p using its twi peripheral, clocked at 8Mhz.
Without the change, the i2c communication works up to aboy 150kHz
frequency, and above that results in the slave stuck in an unresponsive
state. With this change, communication has been tested to work up to
400kHz.

--- extmod/machine_i2c.c
+++ extmod/machine_i2c.c
@@ -34,6 +34,9 @@

 #if MICROPY_PY_MACHINE_I2C

+// Clock stretching limit, so that we don't get stuck.
+#define I2C_STRETCH_LIMIT 255
+
 typedef struct _machine_i2c_obj_t {
     mp_obj_base_t base;
     uint32_t us_delay;
@@ -53,6 +56,11 @@

 STATIC void mp_hal_i2c_scl_release(machine_i2c_obj_t *self) {
     mp_hal_pin_od_high(self->scl);
+    mp_hal_i2c_delay(self);
+    // For clock stretching, wait for the SCL pin to be released, with timeout.
+    for (int count = I2C_STRETCH_LIMIT; mp_hal_pin_read(self->scl) == 0 && count; --count) {
+        mp_hal_delay_us_fast(1);
+    }
 }

 STATIC void mp_hal_i2c_sda_low(machine_i2c_obj_t *self) {
@@ -71,7 +79,6 @@
     mp_hal_i2c_sda_release(self);
     mp_hal_i2c_delay(self);
     mp_hal_i2c_scl_release(self);
-    mp_hal_i2c_delay(self);
     mp_hal_i2c_sda_low(self);
     mp_hal_i2c_delay(self);
 }
@@ -81,7 +88,6 @@
     mp_hal_i2c_sda_low(self);
     mp_hal_i2c_delay(self);
     mp_hal_i2c_scl_release(self);
-    mp_hal_i2c_delay(self);
     mp_hal_i2c_sda_release(self);
     mp_hal_i2c_delay(self);
 }
@@ -108,14 +114,12 @@
         }
         mp_hal_i2c_delay(self);
         mp_hal_i2c_scl_release(self);
-        mp_hal_i2c_delay(self);
         mp_hal_i2c_scl_low(self);
     }

     mp_hal_i2c_sda_release(self);
     mp_hal_i2c_delay(self);
     mp_hal_i2c_scl_release(self);
-    mp_hal_i2c_delay(self);

     int ret = mp_hal_i2c_sda_read(self);
     mp_hal_i2c_delay(self);
@@ -150,7 +154,6 @@
     uint8_t data = 0;
     for (int i = 7; i >= 0; i--) {
         mp_hal_i2c_scl_release(self);
-        mp_hal_i2c_delay(self);
         data = (data << 1) | mp_hal_i2c_sda_read(self);
         mp_hal_i2c_scl_low(self);
         mp_hal_i2c_delay(self);
@@ -163,7 +166,6 @@
     }
     mp_hal_i2c_delay(self);
     mp_hal_i2c_scl_release(self);
-    mp_hal_i2c_delay(self);
     mp_hal_i2c_scl_low(self);
     mp_hal_i2c_sda_release(self);


some cleanups

some cleanups

Signed-off-by: Jens Nyberg <7200009990a46d4bb36e24284136c70d739d75fd@gmail.com>

--- src/modules/arch/x86/pit/main.c
+++ src/modules/arch/x86/pit/main.c
@@ -39,16 +39,15 @@
 void pit_wait(unsigned int ms)
 {

-    unsigned short x = 1193 * ms;
+    unsigned short d = ms * (FREQUENCY / 1000);

     io_outb(io + REGISTERCOMMAND, COMMANDCHANNEL0 | COMMANDBOTH | COMMANDMODE0);
-    io_outb(io + REGISTERCHANNEL0, x >> 8);
-    io_outb(io + REGISTERCHANNEL0, x);
-    io_outb(io + REGISTERCOMMAND, 0xE2);
+    io_outb(io + REGISTERCHANNEL0, d >> 8);
+    io_outb(io + REGISTERCHANNEL0, d);
+    io_outb(io + REGISTERCOMMAND, COMMANDREADBACK | 0x22);

     while (!(io_inb(io + REGISTERCHANNEL0) & (1 << 7)));

-    /* Return old values */
     io_outb(io + REGISTERCOMMAND, COMMANDCHANNEL0 | COMMANDBOTH | COMMANDMODE3);
     io_outb(io + REGISTERCHANNEL0, divisor);
     io_outb(io + REGISTERCHANNEL0, divisor >> 8);
@@ -94,7 +93,7 @@

     io = platform_getbase(id);

-    io_outb(io + REGISTERCOMMAND, COMMANDCHANNEL0 | COMMANDBOTH | COMMANDMODE3 | COMMANDBINARY);
+    io_outb(io + REGISTERCOMMAND, COMMANDCHANNEL0 | COMMANDBOTH | COMMANDMODE3);
     io_outb(io + REGISTERCHANNEL0, divisor);
     io_outb(io + REGISTERCHANNEL0, divisor >> 8);


ENH : correct warnings

ENH : correct warnings

--- Code/FeatureExtraction/otbSimplePointCountStrategy.h
+++ Code/FeatureExtraction/otbSimplePointCountStrategy.h
@@ -1,16 +1,17 @@
 /*=========================================================================

-  Program:   Insight Segmentation & Registration Toolkit
-  Module:    $RCSfile: itkAcosImageFilter.h,v $
+  Program:   ORFEO Toolbox
   Language:  C++
-  Date:      $Date: 2008-10-07 14:09:10 $
-  Version:   $Revision: 1.24 $
+  Date:      $Date$
+  Version:   $Revision$

-  Copyright (c) Insight Software Consortium. All rights reserved.
-  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      PURPOSE.  See the above copyright notices for more information.

 =========================================================================*/
@@ -46,7 +47,7 @@
     {

       int accu = 0;
-      float surface = 3.14*size*size;
+      double surface = M_PI*size*size;

       typedef typename TPointSet::PointsContainer::ConstIterator         iteratorType;

@@ -64,7 +65,7 @@
 	  ++it;
 	}

-      return static_cast<float>(accu)/surface;
+      return static_cast<float>(accu/surface);
     }
 };


fuse: use iov_iter_get_pages() for non-splice path

store reference to iter instead of that to iovec

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>


GetPot - a bugfix for the const char* interface

git-svn-id: ffc1bc5b3feaf8644044862cc38c386ade156493@3592 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- include/base/getpot-roy.h
+++ include/base/getpot-roy.h
@@ -458,7 +458,10 @@
                const char* CommentStart  /* = 0x0 */, const char* CommentEnd /* = 0x0 */,
                const char* FieldSeparator/* = 0x0 */)
 {
-  this->parse_file(FileName, CommentStart, CommentEnd, FieldSeparator);
+  const std::string& StrCommentStart   = CommentStart   ? CommentStart   : std::string("#");
+  const std::string& StrCommentEnd     = CommentEnd     ? CommentEnd     : std::string("\n");
+  const std::string& StrFieldSeparator = FieldSeparator ? FieldSeparator : std::string(" \t\n");
+  this->parse_file(FileName, StrCommentStart, StrCommentEnd, StrFieldSeparator);
 }


Warn from json_gobject_deserialize() if a listed property cannot be deserialized.

--- json-glib/json-gobject.c
+++ json-glib/json-gobject.c
@@ -324,6 +324,9 @@
                      g_type_name (G_VALUE_TYPE (&value)));
           g_object_set_property (retval, pspec->name, &value);
         }
+      else
+	g_warning ("Failed to deserialize \"%s\" property of type \"%s\" for an object of type \"%s\"",
+		   pspec->name, g_type_name (G_VALUE_TYPE (&value)), g_type_name (gtype));

       g_value_unset (&value);
     }


fix SmDm and CoLL declarations

fix SmDm and CoLL declarations


LOLWUT: version 6: change text message & credits.

--- src/lolwut6.c
+++ src/lolwut6.c
@@ -32,10 +32,11 @@
  * fun and interesting, and should be replaced by a new implementation at
  * each new version of Redis.
  *
+ * Thanks to Michele Hiki Falcone for the original image that ispired
+ * the image, part of his game, Plaguemon.
+ *
  * Thanks to the Shhh computer art collective for the help in tuning the
- * output to have a better artistic effect. Also thanks to Michele Hiki Falcone
- * for sending me the original gameboy image that this LOLWUT makes
- * generative.
+ * output to have a better artistic effect.
  */

 #include "server.h"
@@ -189,7 +190,8 @@
     generateSkyline(canvas);
     sds rendered = renderCanvas(canvas);
     rendered = sdscat(rendered,
-        "\nDedicated to the 8 bit game developers of the past. Redis ver. ");
+        "\nDedicated to the 8 bit game developers of past and present.\n"
+        "Original 8 bit image from Plaguemon by hikikomori. Redis ver. ");
     rendered = sdscat(rendered,REDIS_VERSION);
     rendered = sdscatlen(rendered,"\n",1);
     addReplyVerbatim(c,rendered,sdslen(rendered),"txt");


initialize queue as CLOSED

initialize queue as CLOSED

--- src/modules/coinjoin/coinjoin.h
+++ src/modules/coinjoin/coinjoin.h
@@ -155,7 +155,7 @@
         nDenom(0),
         masternodeOutpoint(COutPoint()),
         nHeight(0),
-        status(STATUS_OPEN),
+        status(STATUS_CLOSED),
         vchSig(std::vector<unsigned char>()),
         fTried(false)
     {


GTDiffDelta nullability

GTDiffDelta nullability

--- ObjectiveGit/GTDiffDelta.h
+++ ObjectiveGit/GTDiffDelta.h
@@ -40,6 +40,8 @@
 	GTDiffFileDeltaTypeChange = GIT_DELTA_TYPECHANGE,
 };

+NS_ASSUME_NONNULL_BEGIN
+
 /// A class representing a single change within a diff.
 ///
 /// The change may not be simply a change of text within a given file, it could
@@ -81,7 +83,7 @@
 /// error       - If not NULL, set to any error that occurs.
 ///
 /// Returns a diff delta, or nil if an error occurs.
-+ (instancetype)diffDeltaFromBlob:(GTBlob *)oldBlob forPath:(NSString *)oldBlobPath toBlob:(GTBlob *)newBlob forPath:(NSString *)newBlobPath options:(NSDictionary *)options error:(NSError **)error;
++ (nullable instancetype)diffDeltaFromBlob:(nullable GTBlob *)oldBlob forPath:(nullable NSString *)oldBlobPath toBlob:(nullable GTBlob *)newBlob forPath:(nullable NSString *)newBlobPath options:(nullable NSDictionary *)options error:(NSError **)error;

 /// Diffs the given blob and data buffer.
 ///
@@ -96,7 +98,7 @@
 /// error    - If not NULL, set to any error that occurs.
 ///
 /// Returns a diff delta, or nil if an error occurs.
-+ (instancetype)diffDeltaFromBlob:(GTBlob *)blob forPath:(NSString *)blobPath toData:(NSData *)data forPath:(NSString *)dataPath options:(NSDictionary *)options error:(NSError **)error;
++ (nullable instancetype)diffDeltaFromBlob:(nullable GTBlob *)blob forPath:(nullable NSString *)blobPath toData:(nullable NSData *)data forPath:(nullable NSString *)dataPath options:(nullable NSDictionary *)options error:(NSError **)error;

 /// Diffs the given data buffers.
 ///
@@ -111,10 +113,15 @@
 /// error       - If not NULL, set to any error that occurs.
 ///
 /// Returns a diff delta, or nil if an error occurs.
-+ (instancetype)diffDeltaFromData:(NSData *)oldData forPath:(NSString *)oldDataPath toData:(NSData *)newData forPath:(NSString *)newDataPath options:(NSDictionary *)options error:(NSError **)error;
++ (nullable instancetype)diffDeltaFromData:(nullable NSData *)oldData forPath:(nullable NSString *)oldDataPath toData:(nullable NSData *)newData forPath:(nullable NSString *)newDataPath options:(nullable NSDictionary *)options error:(NSError **)error;

 /// Initializes the receiver to wrap the delta at the given index.
-- (instancetype)initWithDiff:(GTDiff *)diff deltaIndex:(NSUInteger)deltaIndex;
+///
+/// diff       - The diff which contains the delta to wrap. Must not be nil.
+/// deltaIndex - The index of the delta within the diff.
+///
+/// Returns a diff delta, or nil if an error occurs.
+- (nullable instancetype)initWithDiff:(GTDiff *)diff deltaIndex:(NSUInteger)deltaIndex;

 /// Creates a patch from a text delta.
 ///
@@ -123,6 +130,8 @@
 /// error - If not NULL, set to any error that occurs.
 ///
 /// Returns a new patch, or nil if an error occurs.
-- (GTDiffPatch *)generatePatch:(NSError **)error;
+- (nullable GTDiffPatch *)generatePatch:(NSError **)error;

 @end
+
+NS_ASSUME_NONNULL_END


Add a 'value' GObject property to GtkPrinterOption so that it can be used with g_object_bind_property()

--- gtk/gtkprinteroption.c
+++ gtk/gtkprinteroption.c
@@ -22,6 +22,8 @@
 #include <string.h>
 #include <gmodule.h>

+#include "gtkintl.h"
+#include "gtkprivate.h"
 #include "gtkprinteroption.h"

 /*****************************************
@@ -33,7 +35,21 @@
   LAST_SIGNAL
 };

+enum {
+  PROP_0,
+  PROP_VALUE
+};
+
 static guint signals[LAST_SIGNAL] = { 0 };
+
+static void gtk_printer_option_set_property (GObject      *object,
+                                             guint         prop_id,
+                                             const GValue *value,
+                                             GParamSpec   *pspec);
+static void gtk_printer_option_get_property (GObject      *object,
+                                             guint         prop_id,
+                                             GValue       *value,
+                                             GParamSpec   *pspec);

 G_DEFINE_TYPE (GtkPrinterOption, gtk_printer_option, G_TYPE_OBJECT)

@@ -71,6 +87,8 @@
   GObjectClass *gobject_class = (GObjectClass *)class;

   gobject_class->finalize = gtk_printer_option_finalize;
+  gobject_class->set_property = gtk_printer_option_set_property;
+  gobject_class->get_property = gtk_printer_option_get_property;

   signals[CHANGED] =
     g_signal_new ("changed",
@@ -80,6 +98,14 @@
 		  NULL, NULL,
 		  g_cclosure_marshal_VOID__VOID,
 		  G_TYPE_NONE, 0);
+
+  g_object_class_install_property (G_OBJECT_CLASS (class),
+                                   PROP_VALUE,
+                                   g_param_spec_string ("value",
+                                                        P_("Option Value"),
+                                                        P_("Value of the option"),
+                                                        "",
+                                                        GTK_PARAM_READWRITE));
 }

 GtkPrinterOption *
@@ -95,6 +121,44 @@
   option->type = type;

   return option;
+}
+
+static void
+gtk_printer_option_set_property (GObject         *object,
+                                 guint            prop_id,
+                                 const GValue    *value,
+                                 GParamSpec      *pspec)
+{
+  GtkPrinterOption *option = GTK_PRINTER_OPTION (object);
+
+  switch (prop_id)
+    {
+    case PROP_VALUE:
+      gtk_printer_option_set (option, g_value_get_string (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_printer_option_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  GtkPrinterOption *option = GTK_PRINTER_OPTION (object);
+
+  switch (prop_id)
+    {
+    case PROP_VALUE:
+      g_value_set_string (value, option->value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
 }

 static void


Attempt to clean up PulseAudio dynamic loading support.

git-svn-id: 75429ccc2030f235ccf16e6b9b7f8e83d5edd22e@5513 c70aab31-4412-0410-b14c-859654838e24

--- src/audio/pulseaudio/SDL_pulseaudio.c
+++ src/audio/pulseaudio/SDL_pulseaudio.c
@@ -45,18 +45,10 @@
 #include "../SDL_audiomem.h"
 #include "../SDL_audio_c.h"
 #include "SDL_pulseaudio.h"
-
-#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
-#include "SDL_name.h"
 #include "SDL_loadso.h"
-#else
-#define SDL_NAME(X)	X
-#endif

 /* The tag name used by pulse audio */
 #define PULSEAUDIO_DRIVER_NAME         "pulseaudio"
-
-#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC

 #if (PA_API_VERSION < 12)
 /** Return non-zero if the passed state is one of the connected states */
@@ -75,157 +67,159 @@
 }
 #endif /* pulseaudio <= 0.9.10 */

-static const char *pulse_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
-static void *pulse_handle = NULL;
-
-/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
-static pa_simple *(*SDL_NAME(pa_simple_new)) (const char *server,
-                                              const char *name,
-                                              pa_stream_direction_t dir,
-                                              const char *dev,
-                                              const char *stream_name,
-                                              const pa_sample_spec * ss,
-                                              const pa_channel_map * map,
-                                              const pa_buffer_attr * attr,
-                                              int *error);
-static void (*SDL_NAME(pa_simple_free)) (pa_simple * s);
-static pa_channel_map *(*SDL_NAME(pa_channel_map_init_auto)) (pa_channel_map *
-                                                              m,
-                                                              unsigned
-                                                              channels,
-                                                              pa_channel_map_def_t
-                                                              def);
-static const char *(*SDL_NAME(pa_strerror)) (int error);
-static pa_mainloop * (*SDL_NAME(pa_mainloop_new))(void);
-static pa_mainloop_api * (*SDL_NAME(pa_mainloop_get_api))(pa_mainloop *m);
-static int (*SDL_NAME(pa_mainloop_iterate))(pa_mainloop *m, int block, int *retval);
-static void (*SDL_NAME(pa_mainloop_free))(pa_mainloop *m);
-
-static pa_operation_state_t (*SDL_NAME(pa_operation_get_state))(pa_operation *o);
-static void (*SDL_NAME(pa_operation_cancel))(pa_operation *o);
-static void (*SDL_NAME(pa_operation_unref))(pa_operation *o);
-
-static pa_context * (*SDL_NAME(pa_context_new))(
-    pa_mainloop_api *m, const char *name);
-static int (*SDL_NAME(pa_context_connect))(
-    pa_context *c, const char *server,
-    pa_context_flags_t flags, const pa_spawn_api *api);
-static pa_context_state_t (*SDL_NAME(pa_context_get_state))(pa_context *c);
-static void (*SDL_NAME(pa_context_disconnect))(pa_context *c);
-static void (*SDL_NAME(pa_context_unref))(pa_context *c);
-
-static pa_stream * (*SDL_NAME(pa_stream_new))(pa_context *c,
-    const char *name, const pa_sample_spec *ss, const pa_channel_map *map);
-static int (*SDL_NAME(pa_stream_connect_playback))(pa_stream *s, const char *dev,
-    const pa_buffer_attr *attr, pa_stream_flags_t flags,
-    pa_cvolume *volume, pa_stream *sync_stream);
-static pa_stream_state_t (*SDL_NAME(pa_stream_get_state))(pa_stream *s);
-static size_t (*SDL_NAME(pa_stream_writable_size))(pa_stream *s);
-static int (*SDL_NAME(pa_stream_write))(pa_stream *s, const void *data, size_t nbytes,
-    pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
-static pa_operation * (*SDL_NAME(pa_stream_drain))(pa_stream *s,
-    pa_stream_success_cb_t cb, void *userdata);
-static int (*SDL_NAME(pa_stream_disconnect))(pa_stream *s);
-static void (*SDL_NAME(pa_stream_unref))(pa_stream *s);
-
-
-#define SDL_PULSEAUDIO_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
-static struct
-{
-    const char *name;
-    void **func;
-} pulse_functions[] = {
-/* *INDENT-OFF* */
-    SDL_PULSEAUDIO_SYM(pa_simple_new),
-    SDL_PULSEAUDIO_SYM(pa_simple_free),
-    SDL_PULSEAUDIO_SYM(pa_mainloop_new),
-    SDL_PULSEAUDIO_SYM(pa_mainloop_get_api),
-    SDL_PULSEAUDIO_SYM(pa_mainloop_iterate),
-    SDL_PULSEAUDIO_SYM(pa_mainloop_free),
-    SDL_PULSEAUDIO_SYM(pa_operation_get_state),
-    SDL_PULSEAUDIO_SYM(pa_operation_cancel),
-    SDL_PULSEAUDIO_SYM(pa_operation_unref),
-    SDL_PULSEAUDIO_SYM(pa_context_new),
-    SDL_PULSEAUDIO_SYM(pa_context_connect),
-    SDL_PULSEAUDIO_SYM(pa_context_get_state),
-    SDL_PULSEAUDIO_SYM(pa_context_disconnect),
-    SDL_PULSEAUDIO_SYM(pa_context_unref),
-    SDL_PULSEAUDIO_SYM(pa_stream_new),
-    SDL_PULSEAUDIO_SYM(pa_stream_connect_playback),
-    SDL_PULSEAUDIO_SYM(pa_stream_get_state),
-    SDL_PULSEAUDIO_SYM(pa_stream_writable_size),
-    SDL_PULSEAUDIO_SYM(pa_stream_write),
-    SDL_PULSEAUDIO_SYM(pa_stream_drain),
-    SDL_PULSEAUDIO_SYM(pa_stream_disconnect),
-    SDL_PULSEAUDIO_SYM(pa_stream_unref),
-    SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto),
-    SDL_PULSEAUDIO_SYM(pa_strerror),
-/* *INDENT-ON* */
-};
-
-#undef SDL_PULSEAUDIO_SYM
-
-static void
-UnloadPulseLibrary()
-{
-    if (pulse_handle != NULL) {
-        SDL_UnloadObject(pulse_handle);
-        pulse_handle = NULL;
-    }
-}
+
+static pa_simple *(*PULSEAUDIO_pa_simple_new) (const char *, const char *,
+    pa_stream_direction_t, const char *, const char *, const pa_sample_spec *,
+    const pa_channel_map *, const pa_buffer_attr *, int *);
+static void (*PULSEAUDIO_pa_simple_free) (pa_simple *);
+static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto) (
+    pa_channel_map *, unsigned, pa_channel_map_def_t);
+static const char * (*PULSEAUDIO_pa_strerror) (int);
+static pa_mainloop * (*PULSEAUDIO_pa_mainloop_new) (void);
+static pa_mainloop_api * (*PULSEAUDIO_pa_mainloop_get_api) (pa_mainloop *);
+static int (*PULSEAUDIO_pa_mainloop_iterate) (pa_mainloop *, int, int *);
+static void (*PULSEAUDIO_pa_mainloop_free) (pa_mainloop *);
+
+static pa_operation_state_t (*PULSEAUDIO_pa_operation_get_state) (
+    pa_operation *);
+static void (*PULSEAUDIO_pa_operation_cancel) (pa_operation *);
+static void (*PULSEAUDIO_pa_operation_unref) (pa_operation *);
+
+static pa_context * (*PULSEAUDIO_pa_context_new) (pa_mainloop_api *,
+    const char *);
+static int (*PULSEAUDIO_pa_context_connect) (pa_context *, const char *,
+    pa_context_flags_t, const pa_spawn_api *);
+static pa_context_state_t (*PULSEAUDIO_pa_context_get_state) (pa_context *);
+static void (*PULSEAUDIO_pa_context_disconnect) (pa_context *);
+static void (*PULSEAUDIO_pa_context_unref) (pa_context *);
+
+static pa_stream * (*PULSEAUDIO_pa_stream_new) (pa_context *, const char *,
+    const pa_sample_spec *, const pa_channel_map *);
+static int (*PULSEAUDIO_pa_stream_connect_playback) (pa_stream *, const char *,
+    const pa_buffer_attr *, pa_stream_flags_t, pa_cvolume *, pa_stream *);
+static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (pa_stream *);
+static size_t (*PULSEAUDIO_pa_stream_writable_size) (pa_stream *);
+static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t,
+    pa_free_cb_t, int64_t, pa_seek_mode_t);
+static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
+    pa_stream_success_cb_t, void *);
+static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
+static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);
+
+static int load_pulseaudio_syms(void);
+
+
+#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
+
+static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
+static void *pulseaudio_handle = NULL;

 static int
-LoadPulseLibrary(void)
-{
-    int i, retval = -1;
-
-    if (pulse_handle == NULL) {
-        pulse_handle = SDL_LoadObject(pulse_library);
-        if (pulse_handle != NULL) {
-            retval = 0;
-            for (i = 0; i < SDL_arraysize(pulse_functions); ++i) {
-                *pulse_functions[i].func =
-                    SDL_LoadFunction(pulse_handle, pulse_functions[i].name);
-                if (!*pulse_functions[i].func) {
-                    retval = -1;
-                    UnloadPulseLibrary();
-                    break;
-                }
+load_pulseaudio_sym(const char *fn, void **addr)
+{
+    *addr = SDL_LoadFunction(pulseaudio_handle, fn);
+    if (*addr == NULL) {
+        /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+        return 0;
+    }
+
+    return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_PULSEAUDIO_SYM(x) \
+    if (!load_pulseaudio_sym(#x, (void **) (char *) &PULSEAUDIO_##x)) return -1
+
+static void
+UnloadPulseAudioLibrary(void)
+{
+    if (pulseaudio_handle != NULL) {
+		SDL_UnloadObject(pulseaudio_handle);
+        pulseaudio_handle = NULL;
+    }
+}
+
+static int
+LoadPulseAudioLibrary(void)
+{
+    int retval = 0;
+    if (pulseaudio_handle == NULL) {
+        pulseaudio_handle = SDL_LoadObject(pulseaudio_library);
+        if (pulseaudio_handle == NULL) {
+            retval = -1;
+            /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+        } else {
+            retval = load_pulseaudio_syms();
+            if (retval < 0) {
+                UnloadPulseAudioLibrary();
             }
         }
     }
-
     return retval;
 }

 #else

-static void
-UnloadPulseLibrary()
-{
-    return;
+#define SDL_PULSEAUDIO_SYM(x) PULSEAUDIO_##x = x
+
+static void
+UnloadPulseAudioLibrary(void)
+{
 }

 static int
-LoadPulseLibrary(void)
-{
+LoadPulseAudioLibrary(void)
+{
+    load_pulseaudio_syms();
     return 0;
 }

 #endif /* SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */

+
+static int
+load_pulseaudio_syms(void)
+{
+    SDL_PULSEAUDIO_SYM(pa_simple_new);
+    SDL_PULSEAUDIO_SYM(pa_simple_free);
+    SDL_PULSEAUDIO_SYM(pa_mainloop_new);
+    SDL_PULSEAUDIO_SYM(pa_mainloop_get_api);
+    SDL_PULSEAUDIO_SYM(pa_mainloop_iterate);
+    SDL_PULSEAUDIO_SYM(pa_mainloop_free);
+    SDL_PULSEAUDIO_SYM(pa_operation_get_state);
+    SDL_PULSEAUDIO_SYM(pa_operation_cancel);
+    SDL_PULSEAUDIO_SYM(pa_operation_unref);
+    SDL_PULSEAUDIO_SYM(pa_context_new);
+    SDL_PULSEAUDIO_SYM(pa_context_connect);
+    SDL_PULSEAUDIO_SYM(pa_context_get_state);
+    SDL_PULSEAUDIO_SYM(pa_context_disconnect);
+    SDL_PULSEAUDIO_SYM(pa_context_unref);
+    SDL_PULSEAUDIO_SYM(pa_stream_new);
+    SDL_PULSEAUDIO_SYM(pa_stream_connect_playback);
+    SDL_PULSEAUDIO_SYM(pa_stream_get_state);
+    SDL_PULSEAUDIO_SYM(pa_stream_writable_size);
+    SDL_PULSEAUDIO_SYM(pa_stream_write);
+    SDL_PULSEAUDIO_SYM(pa_stream_drain);
+    SDL_PULSEAUDIO_SYM(pa_stream_disconnect);
+    SDL_PULSEAUDIO_SYM(pa_stream_unref);
+    SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto);
+    SDL_PULSEAUDIO_SYM(pa_strerror);
+    return 0;
+}
+
+
 /* This function waits until it is possible to write a full sound buffer */
 static void
 PULSEAUDIO_WaitDevice(_THIS)
 {
     while(1) {
-        if (SDL_NAME(pa_context_get_state)(this->hidden->context) != PA_CONTEXT_READY ||
-            SDL_NAME(pa_stream_get_state)(this->hidden->stream) != PA_STREAM_READY ||
-            SDL_NAME(pa_mainloop_iterate)(this->hidden->mainloop, 1, NULL) < 0) {
+        if (PULSEAUDIO_pa_context_get_state(this->hidden->context) != PA_CONTEXT_READY ||
+            PULSEAUDIO_pa_stream_get_state(this->hidden->stream) != PA_STREAM_READY ||
+            PULSEAUDIO_pa_mainloop_iterate(this->hidden->mainloop, 1, NULL) < 0) {
             this->enabled = 0;
             return;
         }
-        if (SDL_NAME(pa_stream_writable_size)(this->hidden->stream) >= this->hidden->mixlen) {
+        if (PULSEAUDIO_pa_stream_writable_size(this->hidden->stream) >= this->hidden->mixlen) {
             return;
         }
     }
@@ -235,7 +229,7 @@
 PULSEAUDIO_PlayDevice(_THIS)
 {
     /* Write the audio data */
-    if (SDL_NAME(pa_stream_write) (this->hidden->stream, this->hidden->mixbuf,
+    if (PULSEAUDIO_pa_stream_write(this->hidden->stream, this->hidden->mixbuf,
                                    this->hidden->mixlen, NULL, 0LL,
                                    PA_SEEK_RELATIVE) < 0) {
         this->enabled = 0;
@@ -253,21 +247,21 @@
 {
     pa_operation *o;

-    o = SDL_NAME(pa_stream_drain)(this->hidden->stream, stream_drain_complete, NULL);
+    o = PULSEAUDIO_pa_stream_drain(this->hidden->stream, stream_drain_complete, NULL);
     if (!o) {
         return;
     }

-    while (SDL_NAME(pa_operation_get_state)(o) != PA_OPERATION_DONE) {
-        if (SDL_NAME(pa_context_get_state)(this->hidden->context) != PA_CONTEXT_READY ||
-            SDL_NAME(pa_stream_get_state)(this->hidden->stream) != PA_STREAM_READY ||
-            SDL_NAME(pa_mainloop_iterate)(this->hidden->mainloop, 1, NULL) < 0) {
-            SDL_NAME(pa_operation_cancel)(o);
+    while (PULSEAUDIO_pa_operation_get_state(o) != PA_OPERATION_DONE) {
+        if (PULSEAUDIO_pa_context_get_state(this->hidden->context) != PA_CONTEXT_READY ||
+            PULSEAUDIO_pa_stream_get_state(this->hidden->stream) != PA_STREAM_READY ||
+            PULSEAUDIO_pa_mainloop_iterate(this->hidden->mainloop, 1, NULL) < 0) {
+            PULSEAUDIO_pa_operation_cancel(o);
             break;
         }
     }

-    SDL_NAME(pa_operation_unref)(o);
+    PULSEAUDIO_pa_operation_unref(o);
 }

@@ -288,17 +282,17 @@
             this->hidden->mixbuf = NULL;
         }
         if (this->hidden->stream) {
-            SDL_NAME(pa_stream_disconnect)(this->hidden->stream);
-            SDL_NAME(pa_stream_unref)(this->hidden->stream);
+            PULSEAUDIO_pa_stream_disconnect(this->hidden->stream);
+            PULSEAUDIO_pa_stream_unref(this->hidden->stream);
             this->hidden->stream = NULL;
         }
         if (this->hidden->context != NULL) {
-            SDL_NAME(pa_context_disconnect)(this->hidden->context);
-            SDL_NAME(pa_context_unref)(this->hidden->context);
+            PULSEAUDIO_pa_context_disconnect(this->hidden->context);
+            PULSEAUDIO_pa_context_unref(this->hidden->context);
             this->hidden->context = NULL;
         }
         if (this->hidden->mainloop != NULL) {
-            SDL_NAME(pa_mainloop_free)(this->hidden->mainloop);
+            PULSEAUDIO_pa_mainloop_free(this->hidden->mainloop);
             this->hidden->mainloop = NULL;
         }
         SDL_free(this->hidden);
@@ -427,37 +421,37 @@

     /* The SDL ALSA output hints us that we use Windows' channel mapping */
     /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
-    SDL_NAME(pa_channel_map_init_auto) (&pacmap, this->spec.channels,
+    PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels,
                                         PA_CHANNEL_MAP_WAVEEX);

     /* Set up a new main loop */
-    if (!(this->hidden->mainloop = SDL_NAME(pa_mainloop_new)())) {
+    if (!(this->hidden->mainloop = PULSEAUDIO_pa_mainloop_new())) {
         PULSEAUDIO_CloseDevice(this);
         SDL_SetError("pa_mainloop_new() failed");
         return 0;
     }

-    this->hidden->mainloop_api = SDL_NAME(pa_mainloop_get_api)(this->hidden->mainloop);
-    if (!(this->hidden->context = SDL_NAME(pa_context_new)(this->hidden->mainloop_api, get_progname()))) {
+    this->hidden->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(this->hidden->mainloop);
+    if (!(this->hidden->context = PULSEAUDIO_pa_context_new(this->hidden->mainloop_api, get_progname()))) {
         PULSEAUDIO_CloseDevice(this);
         SDL_SetError("pa_context_new() failed");
         return 0;
     }

     /* Connect to the PulseAudio server */
-    if (SDL_NAME(pa_context_connect)(this->hidden->context, NULL, 0, NULL) < 0) {
+    if (PULSEAUDIO_pa_context_connect(this->hidden->context, NULL, 0, NULL) < 0) {
         PULSEAUDIO_CloseDevice(this);
         SDL_SetError("Could not setup connection to PulseAudio");
         return 0;
     }

     do {
-        if (SDL_NAME(pa_mainloop_iterate)(this->hidden->mainloop, 1, NULL) < 0) {
+        if (PULSEAUDIO_pa_mainloop_iterate(this->hidden->mainloop, 1, NULL) < 0) {
             PULSEAUDIO_CloseDevice(this);
             SDL_SetError("pa_mainloop_iterate() failed");
             return 0;
         }
-        state = SDL_NAME(pa_context_get_state)(this->hidden->context);
+        state = PULSEAUDIO_pa_context_get_state(this->hidden->context);
         if (!PA_CONTEXT_IS_GOOD(state)) {
             PULSEAUDIO_CloseDevice(this);
             SDL_SetError("Could not connect to PulseAudio");
@@ -465,7 +459,7 @@
         }
     } while (state != PA_CONTEXT_READY);

-    this->hidden->stream = SDL_NAME(pa_stream_new)(
+    this->hidden->stream = PULSEAUDIO_pa_stream_new(
         this->hidden->context,
         "Simple DirectMedia Layer", /* stream description */
         &paspec,    /* sample format spec */
@@ -478,7 +472,7 @@
         return 0;
     }

-    if (SDL_NAME(pa_stream_connect_playback)(this->hidden->stream, NULL, &paattr, flags,
+    if (PULSEAUDIO_pa_stream_connect_playback(this->hidden->stream, NULL, &paattr, flags,
             NULL, NULL) < 0) {
         PULSEAUDIO_CloseDevice(this);
         SDL_SetError("Could not connect PulseAudio stream");
@@ -486,12 +480,12 @@
     }

     do {
-        if (SDL_NAME(pa_mainloop_iterate)(this->hidden->mainloop, 1, NULL) < 0) {
+        if (PULSEAUDIO_pa_mainloop_iterate(this->hidden->mainloop, 1, NULL) < 0) {
             PULSEAUDIO_CloseDevice(this);
             SDL_SetError("pa_mainloop_iterate() failed");
             return 0;
         }
-        state = SDL_NAME(pa_stream_get_state)(this->hidden->stream);
+        state = PULSEAUDIO_pa_stream_get_state(this->hidden->stream);
         if (!PA_STREAM_IS_GOOD(state)) {
             PULSEAUDIO_CloseDevice(this);
             SDL_SetError("Could not create to PulseAudio stream");
@@ -507,14 +501,14 @@
 static void
 PULSEAUDIO_Deinitialize(void)
 {
-    UnloadPulseLibrary();
+    UnloadPulseAudioLibrary();
 }

 static int
 PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
 {
-    if (LoadPulseLibrary() < 0) {
+    if (LoadPulseAudioLibrary() < 0) {
         return 0;
     }


branches/zip: Enclose some #error checks inside #ifndef DOXYGEN to prevent bogus Doxygen errors.

--- fsp/fsp0fsp.c
+++ fsp/fsp0fsp.c
@@ -647,14 +647,16 @@
 				0 for uncompressed pages */
 	ulint	offset)		/*!< in: page offset */
 {
-#if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
+#ifndef DOXYGEN /* Doxygen gets confused of these */
+# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
 		+ (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
-# error
-#endif
-#if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
+#  error
+# endif
+# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
 		+ (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
-# error
-#endif
+#  error
+# endif
+#endif /* !DOXYGEN */
 	ut_ad(ut_is_2pow(zip_size));

 	if (!zip_size) {


trivial: move ksKernelEntry definition

trivial: move ksKernelEntry definition

so debug builds can see it. Not sure how this built previously?

--- include/benchmark_track.h
+++ include/benchmark_track.h
@@ -22,6 +22,7 @@

 #if defined(DEBUG) || defined(CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES)
 #define TRACK_KERNEL_ENTRIES 1
+extern kernel_entry_t ksKernelEntry;
 #ifdef CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES
 /**
  *  Calculate the maximum number of kernel entries that can be tracked,
@@ -34,7 +35,6 @@
 extern timestamp_t ksEnter;
 extern word_t ksLogIndex;
 extern uint32_t ksLogIndexFinalized;
-extern kernel_entry_t ksKernelEntry;

 /**
  * @brief Fill in logging info for kernel entries


Move params to kernels/internal/types.h.

PiperOrigin-RevId: 208877784

--- tensorflow/contrib/lite/kernels/internal/types.h
+++ tensorflow/contrib/lite/kernels/internal/types.h
@@ -660,6 +660,19 @@
   kGenericBroadcast,           // Fall-back.
 };

+struct MinMax {
+  float min;
+  float max;
+};
+static_assert(sizeof(MinMax) == 8, "");
+
+struct ActivationParams {
+  FusedActivationFunctionType activation_type;
+  // Quantized inference params.
+  int32 activation_min;
+  int32 activation_max;
+};
+
 // For Add, Sub, Mul ops.
 struct ArithmeticParams {
   // Shape dependent / common to data / op types.
@@ -695,29 +708,122 @@
   int broadcast_shape[5];
 };

-template <typename T>
-inline void SetActivationParams(T min, T max, ArithmeticParams* params);
-
-template <>
-inline void SetActivationParams(float min, float max,
-                                ArithmeticParams* params) {
-  params->float_activation_min = min;
-  params->float_activation_max = max;
-}
-
-template <>
-inline void SetActivationParams(int32 min, int32 max,
-                                ArithmeticParams* params) {
-  params->quantized_activation_min = min;
-  params->quantized_activation_max = max;
-}
+struct ConcatenationParams {
+  int8 axis;
+};
+
+struct ComparisonParams {
+  // uint8 inference params.
+  int left_shift;
+  int32 input0_offset;
+  int32 input0_multiplier;
+  int input0_shift;
+  int32 input1_offset;
+  int32 input1_multiplier;
+  int input1_shift;
+  // Shape dependent / common to inference types.
+  bool is_broadcast;
+};
+
+struct ConvParams {
+  PaddingType padding_type;
+  PaddingValues padding_values;
+  // TODO(starka): This was just "stride", so check that width+height is OK.
+  int8 stride_width;
+  int8 stride_height;
+  int8 dilation_width_factor;
+  int8 dilation_height_factor;
+  // uint8 inference params.
+  // TODO(b/65838351): Use smaller types if appropriate.
+  int32 input_offset;
+  int32 weights_offset;
+  int32 output_offset;
+  int32 output_multiplier;
+  int output_shift;
+  int32 output_activation_min;
+  int32 output_activation_max;
+};
+
+struct DepthToSpaceParams {
+  int16 block_size;
+};
+
+struct DepthwiseParams {
+  PaddingType padding_type;
+  PaddingValues padding_values;
+  int8 stride;
+  int8 depth_multiplier;
+  // uint8 inference params.
+  // TODO(b/65838351): Use smaller types if appropriate.
+  int32 input_offset;
+  int32 weights_offset;
+  int32 output_offset;
+  int32 output_multiplier;
+  int output_shift;
+  int32 output_activation_min;
+  int32 output_activation_max;
+};
+
+struct FakeQuantParams {
+  MinMax minmax;
+  int32 num_bits;
+};
+
+struct FullyConnectedParams {
+  // uint8 inference params.
+  // TODO(b/65838351): Use smaller types if appropriate.
+  int32 input_offset;
+  int32 weights_offset;
+  int32 output_offset;
+  int32 output_multiplier;
+  int output_shift;
+  int32 output_activation_min;
+  int32 output_activation_max;
+  FullyConnectedWeightsFormat weights_format;
+};
+
+struct GatherParams {
+  int8 input_rank;
+  int16 axis;
+};
+
+struct L2NormalizationParams {
+  // uint8 inference params.
+  int32 input_zero_point;
+};
+
+struct LocalResponseNormalizationParams {
+  int32 range;
+  double bias;
+  double alpha;
+  double beta;
+};
+
+struct LogisticParams {
+  // uint8 inference params.
+  int32 input_zero_point;
+  int32 input_range_radius;
+  int32 input_multiplier;
+  int input_left_shift;
+};
+
+struct LstmCellParams {
+  int32 weights_zero_point;
+  int32 accum_multiplier;
+  int accum_shift;
+  int state_integer_bits;
+};
+
+struct MeanParams {
+  int8 axis_count;
+  int16 axis[4];
+};

 struct PadParams {
   int8 left_padding_count;
   int32 left_padding[4];
   int8 right_padding_count;
   int32 right_padding[4];
-  // FloatOrInt pad_value;
 };

 struct PoolParams {
@@ -736,6 +842,15 @@
   float float_activation_max;
 };

+struct ReshapeParams {
+  int8 shape_count;
+  int32 shape[4];
+};
+
+struct ResizeBilinearParams {
+  bool align_corners;
+};
+
 struct SliceParams {
   int8 begin_count;
   int32 begin[4];
@@ -743,6 +858,73 @@
   int32 size[4];
 };

+struct SoftmaxParams {
+  // beta is not really used (not a Tensorflow parameter) and not implemented
+  // for LogSoftmax.
+  double beta;
+  // uint8 inference params.  Used even when beta defaults to 1.0.
+  int32 input_beta_multiplier;
+  int32 input_beta_left_shift;
+  // Reverse scaling is only used by LogSoftmax.
+  int32 reverse_scaling_divisor;
+  int32 reverse_scaling_right_shift;
+  int diff_min;
+};
+
+struct SpaceToDepthParams {
+  int16 block_size;
+};
+
+struct SplitParams {
+  // Graphs that split into, say, 2000 nodes are encountered.  The indices in
+  // OperatorEdges are of type uint16.
+  uint16 num_split;
+};
+
+struct SqueezeParams {
+  int8 squeeze_dims_count;
+  int32 squeeze_dims[4];
+};
+
+struct StridedSliceParams {
+  int8 start_indices_count;
+  int16 start_indices[4];
+  int8 stop_indices_count;
+  int16 stop_indices[4];
+  int8 strides_count;
+  int16 strides[4];
+
+  int16 begin_mask;
+  int16 ellipsis_mask;
+  int16 end_mask;
+  int16 new_axis_mask;
+  int16 shrink_axis_mask;
+};
+
+struct TanhParams {
+  int32 input_zero_point;
+  int32 input_range_radius;
+  int32 input_multiplier;
+  int input_left_shift;
+};
+
+template <typename T>
+inline void SetActivationParams(T min, T max, ArithmeticParams* params);
+
+template <>
+inline void SetActivationParams(float min, float max,
+                                ArithmeticParams* params) {
+  params->float_activation_min = min;
+  params->float_activation_max = max;
+}
+
+template <>
+inline void SetActivationParams(int32 min, int32 max,
+                                ArithmeticParams* params) {
+  params->quantized_activation_min = min;
+  params->quantized_activation_max = max;
+}
+
 }  // namespace tflite

 #endif  // TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_TYPES_H_


machine.h comments

machine.h comments

--- src/machine.h
+++ src/machine.h
@@ -50,10 +50,10 @@
   bool exitsWithIO() const;  // true if this has any transitions with input and/or output
   bool exitsWithoutIO() const;  // true if this has any transitions without input or output
   bool terminates() const;  // true if this has no outgoing transitions. Note that the end state is not required to have this property
-  bool waits() const;  // !exitsWithoutInput()
-  bool continues() const;  // !exitsWithInput() && !terminates()
-  bool isSilent() const;  // !exitsWithIO()
-  bool isLoud() const;  // exitsWithIO() && !exitsWithoutIO()
+  bool waits() const;  // !exitsWithoutInput()                     ["input" or "end" state: machine only leaves this state if it receives input]
+  bool continues() const;  // !exitsWithInput() && !terminates()   ["insert" state: can't accept input, and has at least one outgoing transition]
+  bool isSilent() const;  // !exitsWithIO()                        ["null" state]
+  bool isLoud() const;  // exitsWithIO() && !exitsWithoutIO()      ["emit" state]
 };

 struct Machine {


conditionalize including cpu-features.h, since at the moment it is only available for arm.

--- src/core/SkBitmapProcState_filter.h
+++ src/core/SkBitmapProcState_filter.h
@@ -14,7 +14,9 @@
  * limitations under the License.
  */

-#include <machine/cpu-features.h>
+#ifdef __arm__
+    #include <machine/cpu-features.h>
+#endif
 #include "SkColorPriv.h"

 #if defined(__ARM_HAVE_NEON) && !defined(SK_CPU_BENDIAN)


Fix Font atlas expansion;

Fix Font atlas expansion;

--- src/modules/graphics/graphics.c
+++ src/modules/graphics/graphics.c
@@ -1776,21 +1776,21 @@
   map_init(&font->glyphLookup, 36);
   map_init(&font->kerning, 36);

+  font->pixelDensity = lovrRasterizerGetHeight(info->rasterizer);
+  font->lineSpacing = 1.f;
+  font->padding = (uint32_t) ceil(info->spread / 2.);
+
   // Initial atlas size must be big enough to hold any of the glyphs
   float box[4];
   font->atlasWidth = 1;
   font->atlasHeight = 1;
   lovrRasterizerGetBoundingBox(info->rasterizer, box);
-  uint32_t width = (uint32_t) ceilf(box[2] - box[0]);
-  uint32_t height = (uint32_t) ceilf(box[3] - box[1]);
-  while (font->atlasWidth < 2 * width || font->atlasHeight < 2 * height) {
+  uint32_t maxWidth = (uint32_t) ceilf(box[2] - box[0]) + 2 * font->padding;
+  uint32_t maxHeight = (uint32_t) ceilf(box[3] - box[1]) + 2 * font->padding;
+  while (font->atlasWidth < 2 * maxWidth || font->atlasHeight < 2 * maxHeight) {
     font->atlasWidth <<= 1;
     font->atlasHeight <<= 1;
   }
-
-  font->pixelDensity = lovrRasterizerGetHeight(info->rasterizer);
-  font->lineSpacing = 1.f;
-  font->padding = (uint32_t) ceil(info->spread / 2.);

   return font;
 }
@@ -1853,21 +1853,24 @@
   uint32_t pixelWidth = 2 * font->padding + (uint32_t) ceilf(width);
   uint32_t pixelHeight = 2 * font->padding + (uint32_t) ceilf(height);

+  // If the glyph exceeds the width, start a new row
   if (font->atlasX + pixelWidth > font->atlasWidth) {
     font->atlasX = font->atlasWidth == font->atlasHeight ? 0 : font->atlasWidth >> 1;
     font->atlasY += font->rowHeight;
-    if (font->atlasY + pixelHeight > font->atlasHeight) {
-      if (font->atlasWidth == font->atlasHeight) {
-        font->atlasX = font->atlasWidth;
-        font->atlasY = 0;
-        font->atlasWidth <<= 1;
-        font->rowHeight = 0;
-      } else {
-        font->atlasX = 0;
-        font->atlasY = font->atlasHeight;
-        font->atlasHeight <<= 1;
-        font->rowHeight = 0;
-      }
+  }
+
+  // If the glyph exceeds the height, expand the atlas
+  if (font->atlasY + pixelHeight > font->atlasHeight) {
+    if (font->atlasWidth == font->atlasHeight) {
+      font->atlasX = font->atlasWidth;
+      font->atlasY = 0;
+      font->atlasWidth <<= 1;
+      font->rowHeight = 0;
+    } else {
+      font->atlasX = 0;
+      font->atlasY = font->atlasHeight;
+      font->atlasHeight <<= 1;
+      font->rowHeight = 0;
     }
   }

@@ -1879,7 +1882,7 @@
   glyph->uv[3] = (uint16_t) ((float) (glyph->y + height) / font->atlasHeight * 65535.f + .5f);

   font->atlasX += pixelWidth;
-  font->rowHeight = MAX(font->rowHeight, font->atlasY + pixelHeight);
+  font->rowHeight = MAX(font->rowHeight, pixelHeight);

   return glyph;
 }


Fix bug with getting the wrong config firmware partition

This was a copy and past mistake. 'cfg0' should have been 'cfg1' in the
DAT1 case.

--- lib/platform/windows.c
+++ lib/platform/windows.c
@@ -622,7 +622,7 @@

 	case SWITCHTEC_FW_TYPE_DAT1:
 		active_addr = gas_read32(&fi->active_cfg.address);
-		set_fw_info_part(info, &fi->cfg0);
+		set_fw_info_part(info, &fi->cfg1);

 		if (gas_read16(&si->cfg_running) == SWITCHTEC_CFG1_RUNNING)
 			info->active |= SWITCHTEC_FW_PART_RUNNING;


Restore the SSL_set_session_id_context() call to OpenSSL renegotiation.

This reverts the removal of the call in commit (272923a0). It turns out it
wasn't superfluous after all: without it, renegotiation fails if a client
certificate was used. The rest of the changes in that commit are still OK
and not reverted.

Per investigation of bug #12769 by Arne Scheffer, although this doesn't fix
the reported bug yet.

--- src/backend/libpq/be-secure-openssl.c
+++ src/backend/libpq/be-secure-openssl.c
@@ -595,6 +595,10 @@
 		 */
 		SSL_clear_num_renegotiations(port->ssl);

+		/* without this, renegotiation fails when a client cert is used */
+		SSL_set_session_id_context(port->ssl, (void *) &SSL_context,
+								   sizeof(SSL_context));
+
 		if (SSL_renegotiate(port->ssl) <= 0)
 			ereport(COMMERROR,
 					(errcode(ERRCODE_PROTOCOL_VIOLATION),


default to /bin/cat command

default to /bin/cat command

--- paracat.c
+++ paracat.c
@@ -455,6 +455,7 @@
     char* end = NULL;
     char** command;
     char** argv_copy;
+    char* default_command[] = { "/bin/cat", NULL };
     int status;

     pid_t recombine_pid = 0;
@@ -534,12 +535,10 @@
     }

     if (optind >= argc) {
-        fputs("Please specify a command after the -- separator.\n", stderr);
-        fputs(USAGE_STRING, stderr);
-        return 5;
-    }
-
-    command = argv + optind;
+        command = default_command;
+    } else {
+        command = argv + optind;
+    }

     pids = (pid_t*)malloc(sizeof(pid_t) * numpids);
     fds = (int*)malloc(sizeof(int) * numpids);


Add missing function fd_is_shutdown

Add missing function fd_is_shutdown

--- src/core/lib/iomgr/ev_epoll_linux.c
+++ src/core/lib/iomgr/ev_epoll_linux.c
@@ -942,6 +942,13 @@
   return notifier;
 }

+static bool fd_is_shutdown(grpc_fd *fd) {
+  gpr_mu_lock(&fd->mu);
+  const bool r = fd->shutdown;
+  gpr_mu_unlock(&fd->mu);
+  return r;
+}
+
 /* Might be called multiple times */
 static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd) {
   gpr_mu_lock(&fd->mu);
@@ -1659,6 +1666,7 @@
     .fd_wrapped_fd = fd_wrapped_fd,
     .fd_orphan = fd_orphan,
     .fd_shutdown = fd_shutdown,
+    .fd_is_shutdown = fd_is_shutdown,
     .fd_notify_on_read = fd_notify_on_read,
     .fd_notify_on_write = fd_notify_on_write,
     .fd_get_read_notifier_pollset = fd_get_read_notifier_pollset,


Fix clear alpha;

Fix clear alpha;

--- src/modules/graphics/graphics.c
+++ src/modules/graphics/graphics.c
@@ -2841,7 +2841,7 @@
     target.color[i].clear[0] = lovrMathGammaToLinear(canvas->clears[i][0]);
     target.color[i].clear[1] = lovrMathGammaToLinear(canvas->clears[i][1]);
     target.color[i].clear[2] = lovrMathGammaToLinear(canvas->clears[i][2]);
-    target.color[i].clear[3] = canvas->clears[i][2];
+    target.color[i].clear[3] = canvas->clears[i][3];

     if (info->canvas.mipmap && canvas->textures[i]->info.mipmaps > 1) {
       trackTexture(pass, canvas->textures[i], GPU_PHASE_TRANSFER, GPU_CACHE_TRANSFER_WRITE);


themingengine: Don't draw 0px borders

themingengine: Don't draw 0px borders

Theming code gets confused when computing the spacing for 0px wide dots
and then divides by 0. And then cairo complains and stops drawing
anything forever out of spite and then we end up with a single color
screen.

https://bugzilla.gnome.org/show_bug.cgi?id=721800

--- gtk/gtkthemingengine.c
+++ gtk/gtkthemingengine.c
@@ -1591,6 +1591,13 @@
       if (hidden_side & (1 << i))
         continue;

+      /* NB: code below divides by this value */
+      /* a border smaller than this will not noticably modify
+       * pixels on screen, and since we don't compare with 0,
+       * we'll use this value */
+      if (border_width[i] < 1.0 / 1024)
+        continue;
+
       switch (border_style[i])
         {
         case GTK_BORDER_STYLE_NONE:


Fix choose_bitmap_and() so that partial index predicates are considered when deciding whether a potential additional indexscan is redundant or not.  As now coded, any use of a partial index that was already used in a previous AND arm will be rejected as redundant.  This might be overly restrictive, but not considering the point at all is definitely bad, as per example in bug #2441 from Arjen van der Meijden.  In particular, a clauseless scan of a partial index was *never* considered redundant by the previous coding, and that's surely wrong.  Being more flexible would also require some consideration of how not to double-count the index predicate's selectivity.

--- src/backend/optimizer/path/indxpath.c
+++ src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.205 2006/05/18 17:12:10 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.206 2006/05/18 19:56:46 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -616,10 +616,10 @@
 	 * non-selective.  In any case, we'd surely be drastically misestimating
 	 * the selectivity if we count the same condition twice.
 	 *
-	 * XXX is there any risk of throwing away a useful partial index here
-	 * because we don't explicitly look at indpred?  At least in simple cases,
-	 * the partial index will sort before competing non-partial indexes and so
-	 * it makes the right choice, but perhaps we need to work harder.
+	 * We include index predicate conditions in the redundancy test.  Because
+	 * the test is just for pointer equality and not equal(), the effect is
+	 * that use of the same partial index in two different AND elements is
+	 * considered redundant.  (XXX is this too strong?)
 	 *
 	 * Note: outputting the selected sub-paths in selectivity order is a good
 	 * thing even if we weren't using that as part of the selection method,
@@ -732,14 +732,14 @@
 /*
  * pull_indexpath_quals
  *
- * Given the Path structure for a plain or bitmap indexscan, extract a
- * list of RestrictInfo nodes for all the indexquals used in the Path.
+ * Given the Path structure for a plain or bitmap indexscan, extract a list
+ * of all the indexquals and index predicate conditions used in the Path.
  *
  * This is sort of a simplified version of make_restrictinfo_from_bitmapqual;
  * here, we are not trying to produce an accurate representation of the AND/OR
  * semantics of the Path, but just find out all the base conditions used.
  *
- * The result list contains pointers to the RestrictInfos used in the Path,
+ * The result list contains pointers to the expressions used in the Path,
  * but all the list cells are freshly built, so it's safe to destructively
  * modify the list (eg, by concat'ing it with other lists).
  */
@@ -777,7 +777,8 @@
 	{
 		IndexPath  *ipath = (IndexPath *) bitmapqual;

-		result = list_copy(ipath->indexclauses);
+		result = get_actual_clauses(ipath->indexclauses);
+		result = list_concat(result, list_copy(ipath->indexinfo->indpred));
 	}
 	else
 		elog(ERROR, "unrecognized node type: %d", nodeTag(bitmapqual));


remove unnecessary errno variables

remove unnecessary errno variables

--- paracat.c
+++ paracat.c
@@ -73,8 +73,7 @@

             execv(args[0], args);

-            int err = errno;
-            fprintf(stderr, "Error: Could not spawn program: %s, %s\n", args[0], strerror(err));
+            fprintf(stderr, "Error: Could not spawn program: %s, %s\n", args[0], strerror(errno));
             exit(3);

         } else {
@@ -95,8 +94,7 @@
         int written = write(fd, buf, count);

         if (written < GOOD) {
-            int err = errno;
-            fprintf(stderr, "Error: Could not write from parent to fd: %d, %s\n", fd, strerror(err));
+            fprintf(stderr, "Error: Could not write from parent to fd: %d, %s\n", fd, strerror(errno));
             return written;
         }
         buf += written;
@@ -197,8 +195,7 @@

     for (i = 0; i < numpids; ++i) {
         if (close(fds[i]) < GOOD) {
-            int err = errno;
-            fprintf(stderr, "Error: Could not close child stdin fd: %d, %s\n", fds[i], strerror(err));
+            fprintf(stderr, "Error: Could not close child stdin fd: %d, %s\n", fds[i], strerror(errno));
             /* continue anyway */
         }
     }
@@ -207,8 +204,7 @@
         int status;

         if (waitpid(pids[i], &status, 0) < GOOD) {
-            int err = errno;
-            fprintf(stderr, "Error: Could not wait for child pid: %d, %s\n", pids[i], strerror(err));
+            fprintf(stderr, "Error: Could not wait for child pid: %d, %s\n", pids[i], strerror(errno));
             /* continue anyway */
         }