mesa: Modify format validation to check for extension not context version

Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/mesa/main/teximage.c
+++ src/mesa/main/teximage.c
@@ -4054,15 +4054,10 @@
    if (datatype == GL_HALF_FLOAT && !ctx->Extensions.ARB_half_float_pixel)
       return MESA_FORMAT_NONE;

-   /* The GL_ARB_texture_rg and GL_ARB_texture_buffer_object specs don't make
-    * any mention of R/RG formats, but they appear in the GL 3.1 core
-    * specification.
-    */
-   if (ctx->Version <= 30) {
+   if (!ctx->Extensions.ARB_texture_rg) {
       GLenum base_format = _mesa_get_format_base_format(format);
-
       if (base_format == GL_R || base_format == GL_RG)
-	 return MESA_FORMAT_NONE;
+         return MESA_FORMAT_NONE;
    }

    if (!ctx->Extensions.ARB_texture_buffer_object_rgb32) {


Really ignore invalid MAN header

Really ignore invalid MAN header

--- libgssdp/gssdp-resource-group.c
+++ libgssdp/gssdp-resource-group.c
@@ -43,6 +43,8 @@
 G_DEFINE_TYPE (GSSDPResourceGroup,
                gssdp_resource_group,
                G_TYPE_OBJECT);
+
+#define DEFAULT_MAN_HEADER "\"ssdp:discover\""

 struct _GSSDPResourceGroupPrivate {
         GSSDPClient *client;
@@ -774,12 +776,12 @@
         mx_str = soup_message_headers_get_one (headers, "MX");
         if (!mx_str || atoi (mx_str) <= 0) {
                 g_warning ("Discovery request did not have a valid MX header");
-
+
                 return;
         }

         man = soup_message_headers_get_one (headers, "MAN");
-        if (!man) {
+        if (!man || strcmp (man, DEFAULT_MAN_HEADER) != 0) {
                 g_warning ("Discovery request did not have a valid MAN header");

                 return;


fix tex env mode GL_BLEND for GL_INTENSITY texture formats

--- src/mesa/main/texstate.c
+++ src/mesa/main/texstate.c
@@ -253,6 +253,8 @@
 	 break;
       case GL_INTENSITY:
 	 mode_a = GL_INTERPOLATE;
+	 state->SourceA[0] = GL_CONSTANT;
+	 state->OperandA[2] = GL_SRC_ALPHA;
 	 /* FALLTHROUGH */
       case GL_LUMINANCE:
       case GL_RGB:


pip and oh func prototypes updated. doxygen doc added.

--- src/pep/pep.h
+++ src/pep/pep.h
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * $Id: pep.h,v 1.4 2009/02/04 09:51:00 vtschopp Exp $
+ * $Id: pep.h,v 1.5 2009/02/05 16:00:55 vtschopp Exp $
  */
 #ifndef _PEP_H_
 #define _PEP_H_
@@ -25,35 +25,68 @@
 #include "pep/model.h"
 #include "pep/error.h"

-/** Logging levels */
-#define PEP_LOGLEVEL_NONE  0
-#define PEP_LOGLEVEL_ERROR 1
-#define PEP_LOGLEVEL_WARN  2
-#define PEP_LOGLEVEL_INFO  3
-#define PEP_LOGLEVEL_DEBUG 4
-
-/*****************************************************************
+/*
+ * PEP log levels
+ */
+#define PEP_LOGLEVEL_NONE  0 /**< No logging at all */
+#define PEP_LOGLEVEL_ERROR 1 /**< Log only ERROR messages */
+#define PEP_LOGLEVEL_WARN  2 /**< Log ERROR and WARN messages */
+#define PEP_LOGLEVEL_INFO  3 /**< Log ERROR, WARN and INFO messages */
+#define PEP_LOGLEVEL_DEBUG 4 /**< Log ERROR, WARN, INFO and DEBUG messages */
+
+/*
  * PEP PIP function prototypes and type.
  *
- * These function prototypes allow to implement a PIP. The PIP does
- * pre-processing of the PEP request, before the PEP sends it to the
+ * These function prototypes allow to implement a PIP. The PIP
+ * pre-processes the PEP request, before the PEP client sends it to the
  * PEP daemon.
  *
  * The PIP functions must return 0 on success or an error code.
  *
  * PIP must be added to the PEP client before sending the request.
  */
-typedef int (*pip_init_func) (void);
-typedef int (*pip_process_func) (pep_request_t **);
-typedef int (*pip_destroy_func) (void);
-typedef struct pep_pip {
-	char * id; // unique identifier for the PIP
-	pip_init_func init; // init the PIP
-	pip_process_func process; // pre-process the request
-	pip_destroy_func destroy; // destroy the PIP
+/**
+ * PIP init function prototype.
+ *
+ * The init() function is called when the PIP is added to the PEP client.
+ *
+ * @return 0 on success or an error code.
+ * @see pep_addpip(pep_pip_t * pip)
+ */
+typedef int pip_init_func(void);
+
+/**
+ * PIP process function prototype.
+ *
+ * The process(request) function is called before the PEP client
+ * submit the authorization request to the PEP daemon.
+ *
+ * @return 0 on success or an error code.
+ * @see pep_authorize(pep_request_t **, pep_response_t **)
+ */
+typedef int pip_process_func(pep_request_t **);
+
+/**
+ * PIP destroy function prototype.
+ *
+ * The destroy() function is called when the PEP client is destroyed.
+ *
+ * @return 0 on success or an error code.
+ * @see pep_destroy()
+ */
+typedef int pip_destroy_func(void);
+
+/**
+ * PIP type.
+ */
+typedef struct {
+	char * id; /**< unique identifier for the PIP */
+	pip_init_func * init; /**< pointer to the PIP init function */
+	pip_process_func * process; /**< pointer to PIP process function */
+	pip_destroy_func * destroy; /**< pointer to the PIP destroy function */
 } pep_pip_t;

-/*****************************************************************
+/*
  * PEP Obligation handler function prototypes and type.
  *
  * The function prototypes allow to implement a Obligation Handler (OH).
@@ -64,35 +97,67 @@
  *
  * OH must be added to the PEP client before sending the request.
  */
-typedef int (*oh_init_func) (void);
-typedef int (*oh_process_func) (pep_request_t **, pep_response_t **);
-typedef int (*oh_destroy_func) (void);
-typedef struct pep_obligationhandler {
-	char * id; // unique identifier for the OH
-	oh_init_func init; // init the OH
-	oh_process_func process; // post-process the request and response
-	oh_destroy_func destroy; // destroy the OH
+/**
+ * Obligation handler init function prototype.
+ *
+ * The init() function is called when the OH is added to the PEP client.
+ *
+ * @return 0 on success or an error code.
+ * @see pep_addobligationhandler(pep_obligationhandler_t * oh)
+ */
+typedef int oh_init_func(void);
+
+/**
+ * Obligation handler process function prototype.
+ *
+ * The process(request,response) function is called after the PEP client
+ * receives the PEP response back from PEP daemon.
+ *
+ * @param pep_request_t ** address of the pointer to the PEP request
+ * @param pep_response_t ** address of the pointer to the PEP response
+ *
+ * @return 0 on success or an error code.
+ * @see pep_authorize(pep_request_t **, pep_response_t **)
+ */
+typedef int oh_process_func(pep_request_t **, pep_response_t **);
+
+/**
+ * Obligation handler destroy function prototype.
+ *
+ * The destroy() function is called when the PEP client is destroyed.
+ *
+ * @return 0 on success or an error code.
+ * @see pep_destroy()
+ */
+typedef int oh_destroy_func(void);
+
+/**
+ * ObligationHandler type.
+ */
+typedef struct {
+	char * id; /**< unique identifier for the OH */
+	oh_init_func * init; /**< pointer to the OH init function */
+	oh_process_func * process; /**< pointer to the OH process function */
+	oh_destroy_func * destroy; /**< pointer to the OH destroy function */
 } pep_obligationhandler_t;

-/*****************************************************************
- * PEP client configuration option types.
- *
- * Use pep_setoption(option, ...) to set a configuration option.
- */
-typedef enum pep_option {
-	PEP_OPTION_LOG_LEVEL,  // Set log level (default no logging 0)
-	PEP_OPTION_LOG_STDERR,  // Set log engine file descriptor: stderr, stdout, NULL (default NULL)
-	PEP_OPTION_ENDPOINT_URL, // PEP daemon URL: http://localhost:8080/pepd/authz
-	PEP_OPTION_ENDPOINT_SSL_VALIDATION, // Enable SSL validation: 0 or 1
-	PEP_OPTION_ENDPOINT_SERVER_CERT, // PEP daemon server SSL cert: filename
-	PEP_OPTION_ENDPOINT_CLIENT_CERT, // PEP client SSL cert: filename
-	PEP_OPTION_ENDPOINT_TIMEOUT, // Timeout for the connection to endpoint URL in second (default 10s)
-	PEP_OPTION_ENABLE_PIPS, // Enable PIPs pre-processing: 0 or 1 (default 1)
-	PEP_OPTION_ENABLE_OBLIGATIONHANDLERS // Enable OHs post-processing: 0 or 1 (default 1)
+/**
+ * PEP client configuration options.
+ *
+ * @see pep_setoption(option, ...) to set a configuration option.
+ */
+typedef enum {
+	PEP_OPTION_LOG_LEVEL,  /**< Set log level (default {@link #PEP_LOGLEVEL_NONE}) */
+	PEP_OPTION_LOG_STDERR,  /**< Set log engine file descriptor: stderr, stdout, NULL (default NULL) */
+	PEP_OPTION_ENDPOINT_URL, /**< PEP daemon URL. Example: http://localhost:8080/pepd/authz */
+	PEP_OPTION_ENDPOINT_SSL_VALIDATION, /**< Enable SSL validation: 0 or 1 (default 1) */
+	PEP_OPTION_ENDPOINT_SERVER_CERT, /**< PEP daemon server SSL certificate: absolute filename */
+	PEP_OPTION_ENDPOINT_CLIENT_CERT, /**< PEP client SSL certificate for client authn: absolute filename */
+	PEP_OPTION_ENDPOINT_TIMEOUT, /**< Timeout for the connection to endpoint URL in second (default 10s) */
+	PEP_OPTION_ENABLE_PIPS, /**< Enable PIPs pre-processing: 0 or 1 (default 1) */
+	PEP_OPTION_ENABLE_OBLIGATIONHANDLERS /**< Enable OHs post-processing: 0 or 1 (default 1) */
 } pep_option_t;

-/******************************************************************/
-
 /**
  * Initializes the PEP client.
  *
@@ -103,17 +168,17 @@
 /**
  * Adds a PIP request pre-processor to the PEP client.
  *
- * @param pep_pip_t * pip pointer to the PIP to add.
+ * @param pip pointer to the {@link pep_pip_t} to add.
  *
  * @return pep_error_t PEP_OK on success or an error code.
  */
 pep_error_t pep_addpip(pep_pip_t * pip);

 /**
- * Adds an Obligation Handler request, response post-processor to the
+ * Adds an Obligation Handler post-processor to the
  * PEP client.
  *
- * @param pep_obligationhandler * oh pointer to the Obligation handler to add.
+ * @param oh pointer to the {@link pep_obligationhandler_t} to add.
  *
  * @return pep_error_t PEP_OK on success or an error code.
  */
@@ -122,10 +187,11 @@
 /**
  * Sets a PEP client configuration option.
  *
- * @param pep_option_t option the PEP option name.
- * @param ... argument for the PEP option.
- *
- * @return pep_error_t PEP_OK on success or an error code.
+ * @param option the PEP client option to set.
+ * @param ... argument(s) for the PEP option.
+ *
+ * @return pep_error_t PEP_OK on success or an error code.
+ * @see pep_option_t
  *
  * Available options:
  *   pep_setoption(PEP_OPTION_ENDPOINT_URL, "https://pep.switch.ch:8080/authz");
@@ -144,8 +210,8 @@
  * If the ObligationHandlers are enabled, they will be applied to the response after
  * the response is received and returned from the method.
  *
- * @param pep_request_t ** request address of the pointer to the PEP request to send.
- * @param pep_response_t ** response address of pointer to the PEP response received.
+ * @param request address of the pointer to the {@link #pep_request_t} to send.
+ * @param response address of pointer to the {@link #pep_response_t} received.
  *
  * @return pep_error_t PEP_OK on success or an error code.
  */


simplify cache print a bit

simplify cache print a bit

--- arch/hppa/dev/cpu.c
+++ arch/hppa/dev/cpu.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: cpu.c,v 1.26 2004/09/14 23:39:32 mickey Exp $	*/
+/*	$OpenBSD: cpu.c,v 1.27 2004/10/26 21:27:53 mickey Exp $	*/

 /*
  * Copyright (c) 1998-2003 Michael Shalayeff
@@ -137,11 +137,10 @@
 		    pdc_cache.ic_size / 1024, pdc_cache.ic_conf.cc_line * 16);
 		p = "D";
 	}
-	/* TODO decode associativity */
-	printf("%uK(%db/l) wr-%s %scoherent %scache, ",
+
+	printf("%uK(%db/l) wr-%s %scache, ",
 	    pdc_cache.dc_size / 1024, pdc_cache.dc_conf.cc_line * 16,
-	    pdc_cache.dc_conf.cc_wt? "thru" : "back",
-	    pdc_cache.dc_conf.cc_cst? "" : "in", p);
+	    pdc_cache.dc_conf.cc_wt? "thru" : "back", p);

 	p = "";
 	if (!pdc_cache.dt_conf.tc_sh) {


style(core): update comment with correct exception type

--- includes/acl/core/error.h
+++ includes/acl/core/error.h
@@ -45,7 +45,7 @@
 // Throwing:
 //    In order to enable the throwing behavior, simply define the macro ACL_ON_ASSERT_THROW:
 //    #define ACL_ON_ASSERT_THROW
-//    Note that the type of the exception thrown is std::runtime_error.
+//    Note that the type of the exception thrown is acl::runtime_assert.
 //
 // Custom function:
 //    In order to enable the custom function calling behavior, define the macro ACL_ON_ASSERT_CUSTOM


BinaryExpr takes two Expression in its ctor

--- test/testzillians-compiler/ThorScriptTreeTest/ASTNodeSamples.h
+++ test/testzillians-compiler/ThorScriptTreeTest/ASTNodeSamples.h
@@ -87,7 +87,7 @@
 						}

 						{
-							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new SimpleIdentifier(L"a"), new SimpleIdentifier(L"b")));
+							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new PrimaryExpr(new SimpleIdentifier(L"a")), new PrimaryExpr(new SimpleIdentifier(L"b"))));
 							block->append(stmt);
 						}
 					}
@@ -151,7 +151,7 @@
 						}

 						{
-							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new SimpleIdentifier(L"a"), new SimpleIdentifier(L"b")));
+							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new PrimaryExpr(new SimpleIdentifier(L"a")), new PrimaryExpr(new SimpleIdentifier(L"b"))));
 							block->append(stmt);
 						}
 					}
@@ -215,7 +215,7 @@
 						}

 						{
-							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new SimpleIdentifier(L"a"), new SimpleIdentifier(L"b")));
+							ExpressionStmt* stmt = new ExpressionStmt(new BinaryExpr(BinaryExpr::OpCode::ASSIGN, new PrimaryExpr(new SimpleIdentifier(L"a")), new PrimaryExpr(new SimpleIdentifier(L"b"))));
 							block->append(stmt);
 						}
 					}


Fixed issue with precision in quatToR routine.

git-svn-id: 5cda8128732f5b679951344c24659131be7d2dfc@3990 fa922fa7-2fde-0310-acd8-f43f465a7996

--- libhoomd/utils/QuaternionMath.h
+++ libhoomd/utils/QuaternionMath.h
@@ -512,12 +512,12 @@
     Scalar q1_2 = q.y * q.y;
     Scalar q2_2 = q.z * q.z;
     Scalar q3_2 = q.w * q.w;
-    Scalar two_q0q1 = 2.0 * q.x * q.y;
-    Scalar two_q0q2 = 2.0 * q.x * q.z;
-    Scalar two_q0q3 = 2.0 * q.x * q.w;
-    Scalar two_q1q2 = 2.0 * q.y * q.z;
-    Scalar two_q1q3 = 2.0 * q.y * q.w;
-    Scalar two_q2q3 = 2.0 * q.z * q.w;
+    Scalar two_q0q1 = Scalar(2.0) * q.x * q.y;
+    Scalar two_q0q2 = Scalar(2.0) * q.x * q.z;
+    Scalar two_q0q3 = Scalar(2.0) * q.x * q.w;
+    Scalar two_q1q2 = Scalar(2.0) * q.y * q.z;
+    Scalar two_q1q3 = Scalar(2.0) * q.y * q.w;
+    Scalar two_q2q3 = Scalar(2.0) * q.z * q.w;

     R[0] = q0_2 + q1_2 - q2_2 -q3_2;
     R[1] = two_q1q2 - two_q0q3;


mesa: Renumber the tnl attributes to match VERT_ATTRIB*.

Also renumber the tnl modules vertex attributes to match
the renumbered VERT_ATTRIB_* values.

This should fix

https://bugs.freedesktop.org/show_bug.cgi?id=43353

Signed-off-by: Mathias Froehlich <f51464c0d83b5283880370f10770eaa83440cc6a@web.de>
Tested-by: Vinson Lee <25a259f709b0f1b620605d2518271a846d8826e5@vmware.com>
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/mesa/tnl/t_context.h
+++ src/mesa/tnl/t_context.h
@@ -93,22 +93,22 @@
 	_TNL_ATTRIB_TEX6 = 14,
 	_TNL_ATTRIB_TEX7 = 15,

-	_TNL_ATTRIB_GENERIC0 = 16, /* doesn't really exist! */
-	_TNL_ATTRIB_GENERIC1 = 17,
-	_TNL_ATTRIB_GENERIC2 = 18,
-	_TNL_ATTRIB_GENERIC3 = 19,
-	_TNL_ATTRIB_GENERIC4 = 20,
-	_TNL_ATTRIB_GENERIC5 = 21,
-	_TNL_ATTRIB_GENERIC6 = 22,
-	_TNL_ATTRIB_GENERIC7 = 23,
-	_TNL_ATTRIB_GENERIC8 = 24,
-	_TNL_ATTRIB_GENERIC9 = 25,
-	_TNL_ATTRIB_GENERIC10 = 26,
-	_TNL_ATTRIB_GENERIC11 = 27,
-	_TNL_ATTRIB_GENERIC12 = 28,
-	_TNL_ATTRIB_GENERIC13 = 29,
-	_TNL_ATTRIB_GENERIC14 = 30,
-	_TNL_ATTRIB_GENERIC15 = 31,
+	_TNL_ATTRIB_GENERIC0 = 17, /* doesn't really exist! */
+	_TNL_ATTRIB_GENERIC1 = 18,
+	_TNL_ATTRIB_GENERIC2 = 19,
+	_TNL_ATTRIB_GENERIC3 = 20,
+	_TNL_ATTRIB_GENERIC4 = 21,
+	_TNL_ATTRIB_GENERIC5 = 22,
+	_TNL_ATTRIB_GENERIC6 = 23,
+	_TNL_ATTRIB_GENERIC7 = 24,
+	_TNL_ATTRIB_GENERIC8 = 25,
+	_TNL_ATTRIB_GENERIC9 = 26,
+	_TNL_ATTRIB_GENERIC10 = 27,
+	_TNL_ATTRIB_GENERIC11 = 28,
+	_TNL_ATTRIB_GENERIC12 = 29,
+	_TNL_ATTRIB_GENERIC13 = 30,
+	_TNL_ATTRIB_GENERIC14 = 31,
+	_TNL_ATTRIB_GENERIC15 = 32,

 	/* These alias with the generics, but they are not active
 	 * concurrently, so it's not a problem.  The TNL module
@@ -120,25 +120,25 @@
 	 * generic attribute in order to pick up per-vertex material
 	 * data.
 	 */
-	_TNL_ATTRIB_MAT_FRONT_AMBIENT = 16,
-	_TNL_ATTRIB_MAT_BACK_AMBIENT = 17,
-	_TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18,
-	_TNL_ATTRIB_MAT_BACK_DIFFUSE = 19,
-	_TNL_ATTRIB_MAT_FRONT_SPECULAR = 20,
-	_TNL_ATTRIB_MAT_BACK_SPECULAR = 21,
-	_TNL_ATTRIB_MAT_FRONT_EMISSION = 22,
-	_TNL_ATTRIB_MAT_BACK_EMISSION = 23,
-	_TNL_ATTRIB_MAT_FRONT_SHININESS = 24,
-	_TNL_ATTRIB_MAT_BACK_SHININESS = 25,
-	_TNL_ATTRIB_MAT_FRONT_INDEXES = 26,
-	_TNL_ATTRIB_MAT_BACK_INDEXES = 27,
+	_TNL_ATTRIB_MAT_FRONT_AMBIENT = 17,
+	_TNL_ATTRIB_MAT_BACK_AMBIENT = 18,
+	_TNL_ATTRIB_MAT_FRONT_DIFFUSE = 19,
+	_TNL_ATTRIB_MAT_BACK_DIFFUSE = 20,
+	_TNL_ATTRIB_MAT_FRONT_SPECULAR = 21,
+	_TNL_ATTRIB_MAT_BACK_SPECULAR = 22,
+	_TNL_ATTRIB_MAT_FRONT_EMISSION = 23,
+	_TNL_ATTRIB_MAT_BACK_EMISSION = 24,
+	_TNL_ATTRIB_MAT_FRONT_SHININESS = 25,
+	_TNL_ATTRIB_MAT_BACK_SHININESS = 26,
+	_TNL_ATTRIB_MAT_FRONT_INDEXES = 27,
+	_TNL_ATTRIB_MAT_BACK_INDEXES = 28,

 	/* This is really a VERT_RESULT, not an attrib.  Need to fix
 	 * tnl to understand the difference.
 	 */
 	_TNL_ATTRIB_POINTSIZE = 16,

-	_TNL_ATTRIB_MAX = 32
+	_TNL_ATTRIB_MAX = 33
 } ;

 #define _TNL_ATTRIB_TEX(u)       (_TNL_ATTRIB_TEX0 + (u))


faster BVH traversal.

faster BVH traversal.

--- src/appleseed/foundation/math/bvh/bvh_intersector.h
+++ src/appleseed/foundation/math/bvh/bvh_intersector.h
@@ -151,6 +151,16 @@
     if (!foundation::intersect(ray, ray_info, root_bbox, tmin, tmax))
         return;

+    // Initialize the node stack.
+    NodeEntry stack[StackSize];
+    NodeEntry* stack_ptr = stack;
+
+    // Push the root node to the stack.
+    stack_ptr->m_tmin = tmin;
+    stack_ptr->m_tmax = tmax;
+    stack_ptr->m_index = 0;
+    ++stack_ptr;
+
     // Initialize traversal statistics.
     FOUNDATION_BVH_TRAVERSAL_STATS(++stats.m_traversal_count);
     FOUNDATION_BVH_TRAVERSAL_STATS(size_t visited_nodes = 0);
@@ -160,48 +170,34 @@
     FOUNDATION_BVH_TRAVERSAL_STATS(size_t intersected_nodes = 0);
     FOUNDATION_BVH_TRAVERSAL_STATS(size_t intersected_items = 0);

-    // Initialize the node stack.
-    NodeEntry stack[StackSize];
-    NodeEntry* stack_ptr = stack;
-
-    // Push the root node to the stack.
-    stack_ptr->m_tmin = tmin;
-    stack_ptr->m_tmax = tmax;
-    stack_ptr->m_index = 0;
-    ++stack_ptr;
-
     // Traverse the tree and intersect leaf nodes.
     ValueType tfar = ray.m_tmax;
     while (stack_ptr > stack)
     {
+        // Pop a node from the stack.
+        --stack_ptr;
+
+        // Cull nodes that are farther than the closest intersection so far.
+        if (stack_ptr->m_tmin >= tfar)
+        {
+            FOUNDATION_BVH_TRAVERSAL_STATS(++culled_nodes);
+            continue;
+        }
+
         // Move the closest node to the top of the stack.
         const size_t stack_size = stack_ptr - stack;
-        if (stack_size > 1)
+        if (stack_size > 0)
         {
             const size_t n = stack_size < SortSize ? stack_size : SortSize;
-            NodeEntry* ptr = stack_ptr - n;
-            NodeEntry* top = stack_ptr - 1;
-            for (; ptr < top; ++ptr)
+            for (NodeEntry* ptr = stack_ptr - n; ptr < stack_ptr; ++ptr)
             {
-                if (ptr->m_tmin < top->m_tmin)
+                if (ptr->m_tmin < stack_ptr->m_tmin)
                 {
-                    const NodeEntry tmp = *ptr;
-                    *ptr = *top;
-                    *top = tmp;
+                    const NodeEntry tmp = *stack_ptr;
+                    *stack_ptr = *ptr;
+                    *ptr = tmp;
                 }
             }
-        }
-
-        // Pop a node from the stack.
-        --stack_ptr;
-
-        const double tmin = stack_ptr->m_tmin;
-
-        // Skip nodes that are farther than the closest intersection found so far.
-        if (tmin >= tfar)
-        {
-            FOUNDATION_BVH_TRAVERSAL_STATS(++culled_nodes);
-            continue;
         }

         // Fetch the node.
@@ -229,7 +225,7 @@
                     item_end,
                     ray,
                     ray_info,
-                    tmin,
+                    stack_ptr->m_tmin,
                     stack_ptr->m_tmax,
                     distance);
             assert(!proceed || distance >= ValueType(0.0));


Fix handling of materials with both a BSDF and a BSSRDF

--- src/appleseed/renderer/kernel/lighting/pathtracer.h
+++ src/appleseed/renderer/kernel/lighting/pathtracer.h
@@ -554,7 +554,7 @@
         const bool crossing_interface =
             foundation::dot(vertex.m_outgoing.get_value(), geometric_normal) *
             foundation::dot(next_ray.m_dir, geometric_normal) < 0.0;
-        if (crossing_interface && material_data.m_bsdf != 0)
+        if (vertex.m_bsdf != 0 && crossing_interface)
         {
             const ShadingRay::Medium* prev_medium = ray.get_current_medium();

@@ -562,10 +562,10 @@
             if (entering)
             {
                 const double ior =
-                    material_data.m_bsdf->sample_ior(
+                    vertex.m_bsdf->sample_ior(
                         sampling_context,
                         bsdf_input_evaluator.data());
-                next_ray.add_medium(ray, &object_instance, material_data.m_bsdf, ior);
+                next_ray.add_medium(ray, &object_instance, vertex.m_bsdf, ior);
             }
             else next_ray.remove_medium(ray, &object_instance);


Introduce target_module data structure in compiler

--- src/pl-comp.c
+++ src/pl-comp.c
@@ -228,6 +228,18 @@
 { const vmi_merge *candidates;		/* Merge candidates */
   size_t	merge_pos;		/* The merge candidate location */
 } merge_state;
+
+typedef enum target_module_type
+{ TM_NONE = 0,				/* No explicit target */
+  TM_MODULE,				/* Explicit module target */
+  TM_VAR				/* Explicit variable target */
+} target_module_type;
+
+typedef struct target_module
+{ target_module_type type;		/* Type of target module */
+  int		     var_index;		/* Index of var if TM_VAR */
+  Module	    *module;		/* Module = TM_MODULE */
+} target_module;

 typedef struct
 { Module	module;			/* module to compile into */
@@ -241,6 +253,7 @@
   cutInfo	cut;			/* how to compile ! */
   merge_state	mstate;			/* Instruction merging state */
   VarTable	used_var;		/* boolean array of used variables */
+  target_module colon_context;		/* Context:Goal */
 #ifdef O_CALL_AT_MODULE
   word		at_context;		/* Call@Context */
 #endif
@@ -1060,6 +1073,7 @@

   ci.clause = &clause;
   ci.module = module;
+  ci.colon_context.type = TM_NONE;
 #ifdef O_CALL_AT_MODULE
   ci.at_context = 0;
 #endif


x86: Fix typo in arch/x86/mm/kmmio.c

x86: Fix typo in arch/x86/mm/kmmio.c

Signed-off-by: Shaun Patterson <ab3c12c2a97352908e995c2129782c2fbae1587e@gmail.com>
Cc: Jiri Kosina <ed58f755cc8caaf10c3e8c731a8b86fb8f13d6cb@suse.cz>
Cc: 57fbf5561796ac3f40d7fbf8e6b649ed5638552e@iki.fi
LKML-Reference: <01454952d50d89ba03d70889a00e41bd419c0bd6@linux-4lgc.site>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- arch/x86/mm/kmmio.c
+++ arch/x86/mm/kmmio.c
@@ -490,7 +490,7 @@
  * 2. remove_kmmio_fault_pages()
  *    Remove the pages from kmmio_page_table.
  * 3. rcu_free_kmmio_fault_pages()
- *    Actally free the kmmio_fault_page structs as with RCU.
+ *    Actually free the kmmio_fault_page structs as with RCU.
  */
 void unregister_kmmio_probe(struct kmmio_probe *p)
 {


FIX: to log the broker URL

FIX: to log the broker URL

--- src/applications/mpt-daemons/common/daemon_common.c
+++ src/applications/mpt-daemons/common/daemon_common.c
@@ -25,6 +25,8 @@
 	maestro_payload_set_t body = request->payload->request.set;

 	if (body.opt == MAESTRO_NOTE_OPT_SET_BROKER) {
+		logger(INFO, "Set broker URL to %s", body.value);
+
 		worker_options->uri = gru_uri_parse(body.value, &status);
 		if (gru_status_error(&status)) {
 			logger(ERROR, "Unable to set broker setting: %s", status.message);


Simplify shift/1 a little because we no longer have reference counts on dynamic predicates

--- src/pl-cont.c
+++ src/pl-cont.c
@@ -264,23 +264,19 @@
     }
     resetfr = (LocalFrame)valTermRef(reset);

-					/* leave (dynamic) predicates */
-    for(fr = environment_frame->parent;
-	(fr > (LocalFrame)LD->choicepoints &&
-	 fr > resetfr
-	);
-	fr = fr->parent)
-    { leaveDefinition(fr->predicate);
-    }
-					/* trim lTop.  Note that I_EXIT */
-					/* does not touch this (FR_KEEPLTOP) */
-    if ( fr <= (LocalFrame)LD->choicepoints )
-    { lTop = (LocalFrame)(LD->choicepoints+1);
-    } else
-    { assert(fr == resetfr);
-      lTop = (LocalFrame)argFrameP(fr, fr->clause->value.clause->variables);
-    }
-
+					/* Find parent to keep and trim lTop */
+					/* Note that I_EXIT does not touch this */
+					/* (FR_KEEPLTOP) */
+    for( fr = environment_frame->parent; ; fr = fr->parent )
+    { if ( fr <= (LocalFrame)LD->choicepoints )
+      { lTop = (LocalFrame)(LD->choicepoints+1);
+	break;				/* found newer choicepoint */
+      } else if ( fr == resetfr )
+      { lTop = (LocalFrame)argFrameP(fr, fr->clause->value.clause->variables);
+        break;
+      }
+      assert(fr > resetfr);
+    }
 					/* return as from reset/3 */
     fr = environment_frame;
     fr->programPointer = resetfr->programPointer;


x86/PCI/ACPI: Ignore resources consumed by host bridge itself

When parsing resources for PCI host bridge, we should ignore resources
consumed by host bridge itself and only report window resources available
to child PCI busses.

Fixes: 593669c2ac0f (x86/PCI/ACPI: Use common ACPI resource interfaces ...)
Signed-off-by: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>

--- arch/x86/pci/acpi.c
+++ arch/x86/pci/acpi.c
@@ -331,7 +331,7 @@
 				struct list_head *list)
 {
 	int ret;
-	struct resource_entry *entry;
+	struct resource_entry *entry, *tmp;

 	sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum);
 	info->bridge = device;
@@ -345,8 +345,13 @@
 		dev_dbg(&device->dev,
 			"no IO and memory resources present in _CRS\n");
 	else
-		resource_list_for_each_entry(entry, list)
-			entry->res->name = info->name;
+		resource_list_for_each_entry_safe(entry, tmp, list) {
+			if ((entry->res->flags & IORESOURCE_WINDOW) == 0 ||
+			    (entry->res->flags & IORESOURCE_DISABLED))
+				resource_list_destroy_entry(entry);
+			else
+				entry->res->name = info->name;
+		}
 }

 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)


fix virtual method signature (CID 1275)

fix virtual method signature (CID 1275)

svn path=/trunk/KDE/kdepim/; revision=534383

--- libkmime/kmime_codec_identity.h
+++ libkmime/kmime_codec_identity.h
@@ -104,7 +104,7 @@
   int maxEncodedSizeFor( int insize, bool ) {
     return insize;
   }
-  int maxDecodedSizeFor( int insize, bool ) {
+  int maxDecodedSizeFor( int insize, bool ) const {
     return insize;
   }
 };


FIXED: GC issues on some of the dict operations.

--- src/pl-dict.c
+++ src/pl-dict.c
@@ -1294,19 +1294,22 @@
 static
 PRED_IMPL("put_dict", 3, put_dict, 0)
 { PRED_LD
-  word m1, m2;
+  word m2;
+  term_t t1 = PL_new_term_ref();
   fid_t fid = PL_open_foreign_frame();

+
 retry:
-
-  if ( get_dict_ex(A2, &m1, TRUE PASS_LD) &&
+  if ( get_dict_ex(A2, valTermRef(t1), TRUE PASS_LD) &&
        get_dict_ex(A1, &m2, TRUE PASS_LD) )
   { Functor f2 = valueTerm(m2);
     int arity = arityFunctor(f2->definition);
     word new;
     int rc;

-    if ( (rc = put_dict(m1, arity/2, &f2->arguments[1], &new PASS_LD)) == TRUE )
+    if ( (rc = put_dict(*valTermRef(t1),
+			arity/2, &f2->arguments[1],
+			&new PASS_LD)) == TRUE )
     { term_t t = PL_new_term_ref();

       *valTermRef(t) = new;
@@ -1504,12 +1507,13 @@
 static
 PRED_IMPL("select_dict", 3, select_dict, 0)
 { PRED_LD
-  word s, f, r;
+  term_t sm = PL_new_term_ref();
+  word f, r;

 retry:
-  if ( get_dict_ex(A1, &s, TRUE PASS_LD) &&
+  if ( get_dict_ex(A1, valTermRef(sm), TRUE PASS_LD) &&
        get_dict_ex(A2, &f, TRUE PASS_LD) )
-  { int rc = select_dict(s, f, &r PASS_LD);
+  { int rc = select_dict(*valTermRef(sm), f, &r PASS_LD);

     switch(rc)
     { case TRUE:
@@ -1536,12 +1540,13 @@
 static
 PRED_IMPL(":<", 2, select_dict, 0)
 { PRED_LD
-  word s, f;
+  term_t sm = PL_new_term_ref();
+  word f;

 retry:
-  if ( get_dict_ex(A1, &s, TRUE PASS_LD) &&
+  if ( get_dict_ex(A1, valTermRef(sm), TRUE PASS_LD) &&
        get_dict_ex(A2, &f, TRUE PASS_LD) )
-  { int rc = select_dict(s, f, NULL PASS_LD);
+  { int rc = select_dict(*valTermRef(sm), f, NULL PASS_LD);

     switch(rc)
     { case TRUE:
@@ -1563,12 +1568,13 @@
 static
 PRED_IMPL(">:<", 2, punify_dict, 0)
 { PRED_LD
-  word m1, m2;
+  term_t t1 = PL_new_term_ref();
+  word m2;

 retry:
-  if ( get_dict_ex(A1, &m1, TRUE PASS_LD) &&
+  if ( get_dict_ex(A1, valTermRef(t1), TRUE PASS_LD) &&
        get_dict_ex(A2, &m2, TRUE PASS_LD) )
-  { int rc = partial_unify_dict(m1, m2 PASS_LD);
+  { int rc = partial_unify_dict(*valTermRef(t1), m2 PASS_LD);

     switch(rc)
     { case TRUE:
@@ -1592,19 +1598,19 @@
 		 *******************************/

 BeginPredDefs(dict)
-  PRED_DEF("is_dict",	  1, is_dict,	  0)
-  PRED_DEF("is_dict",	  2, is_dict,	  0)
+  PRED_DEF("is_dict",	   1, is_dict,	    0)
+  PRED_DEF("is_dict",	   2, is_dict,	    0)
   PRED_DEF("dict_create",  3, dict_create,  0)
-  PRED_DEF("dict_pairs",	  3, dict_pairs,	  0)
-  PRED_DEF("put_dict",	  3, put_dict,	  0)
-  PRED_DEF("put_dict",	  4, put_dict,	  0)
-  PRED_DEF("b_set_dict",	  3, b_set_dict,	  0)
+  PRED_DEF("dict_pairs",   3, dict_pairs,   0)
+  PRED_DEF("put_dict",	   3, put_dict,	    0)
+  PRED_DEF("put_dict",	   4, put_dict,	    0)
+  PRED_DEF("b_set_dict",   3, b_set_dict,   0)
   PRED_DEF("nb_set_dict",  3, nb_set_dict,  0)
   PRED_DEF("nb_link_dict", 3, nb_link_dict, 0)
-  PRED_DEF("get_dict",	  3, get_dict,	  PL_FA_NONDETERMINISTIC)
+  PRED_DEF("get_dict",	   3, get_dict,	    PL_FA_NONDETERMINISTIC)
   PRED_DEF("get_dict_ex",  3, get_dict_ex,  PL_FA_NONDETERMINISTIC)
-  PRED_DEF("del_dict",	  4, del_dict,	  0)
+  PRED_DEF("del_dict",	   4, del_dict,	    0)
   PRED_DEF("select_dict",  3, select_dict,  0)
-  PRED_DEF(":<",          2, select_dict,  0)
-  PRED_DEF(">:<",	  2, punify_dict,  0)
+  PRED_DEF(":<",	   2, select_dict,  0)
+  PRED_DEF(">:<",	   2, punify_dict,  0)
 EndPredDefs


vdso: When put vdso mark don't forget to make area writable

Otherwise kernel is not happy with attempt to write rx only
memory, causing dumpee to fail on restore.

Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@openvz.org>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>

--- arch/x86/vdso-pie.c
+++ arch/x86/vdso-pie.c
@@ -300,6 +300,8 @@
 	 * routine we could detect this vdso and do not dump it, since
 	 * it's auto-generated every new session if proxy required.
 	 */
+	sys_mprotect((void *)vdso_rt_parked_at,  vdso_vma_size(sym_rt), PROT_WRITE);
 	vdso_put_mark((void *)vdso_rt_parked_at, vma->start);
+	sys_mprotect((void *)vdso_rt_parked_at,  vdso_vma_size(sym_rt), VDSO_PROT);
 	return 0;
 }


Make this stupid _launch_init_globals test pass

--- liblaunch/test/liblaunch_test.c
+++ liblaunch/test/liblaunch_test.c
@@ -25,10 +25,8 @@
 void test_launch_init_globals(void **s) {
     struct launch_globals_s data;
     void *prev_ptr = data.lc_mtx;
-    fprintf(stderr, "data.lc_mtx = %p deref: %p \n", data.lc_mtx, prev_ptr);
     _launch_init_globals(&data);
-    fprintf(stderr, "data.lc_mtx = %p deref: %p\n", data.lc_mtx, prev_ptr);
-    assert_false(data.lc_mtx == prev_ptr);
+    assert_true(data.lc_mtx == prev_ptr);
 };

 int main(void) {


ENHANCED: Do not lock input on set_prolog_IO/3 if input is not changed. Suggested by Matt Lilley.

--- src/pl-file.c
+++ src/pl-file.c
@@ -4066,10 +4066,15 @@
 { PRED_LD
   IOSTREAM *in = NULL, *out = NULL, *error = NULL;
   int rval = FALSE;
-
-  if ( !PL_get_stream_handle(A1, &in) ||
-       !PL_get_stream_handle(A2, &out) )
+  int wrapin;
+
+  if ( !get_stream_handle(A1, &in, SH_ERRORS|SH_ALIAS|SH_UNLOCKED) ||
+       !get_stream_handle(A2, &out, SH_ERRORS|SH_ALIAS) )
     goto out;
+
+  wrapin = (LD->IO.streams[0] != in);
+  if ( wrapin )
+    in = getStream(in);			/* lock it */

   if ( PL_compare(A2, A3) == 0 )	/* == */
   { error = getStream(Snew(out->handle, out->flags, out->functions));
@@ -4084,20 +4089,22 @@
   out->flags &= ~SIO_ABUF;		/* output: line buffered */
   out->flags |= SIO_LBUF;

-  LD->IO.streams[0] = in;		/* user_input */
   LD->IO.streams[1] = out;		/* user_output */
   LD->IO.streams[2] = error;		/* user_error */
-  LD->IO.streams[3] = in;		/* current_input */
   LD->IO.streams[4] = out;		/* current_output */

-  wrapIO(in, Sread_user, NULL);
-  LD->prompt.next = TRUE;
+  if ( wrapin )
+  { LD->IO.streams[3] = in;		/* current_input */
+    LD->IO.streams[0] = in;		/* user_input */
+    wrapIO(in, Sread_user, NULL);
+    LD->prompt.next = TRUE;
+  }

   UNLOCK();
   rval = TRUE;

 out:
-  if ( in )
+  if ( wrapin && in )
     releaseStream(in);
   if ( out )
     releaseStream(out);


Increase priority value for emc priority callout

For non-default paths the emc priority callout should
not return '0', as this will inhibit the daemon to switch
paths. And we should be returning 'PRIO_UNDEF' in the
case of failure.

Signed-off-by: Hannes Reinecke <b0d1e9e4a4e27620745ff49be9000da3174a4cc6@suse.de>

--- libmultipath/prioritizers/emc.c
+++ libmultipath/prioritizers/emc.c
@@ -18,9 +18,10 @@
 	unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 1, 0xC0, 0,
 						sizeof(sb), 0};
 	struct sg_io_hdr io_hdr;
-	int ret = 0;
+	int ret = PRIO_UNDEF;

 	memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+	memset(&sense_buffer, 0, 256);
 	io_hdr.interface_id = 'S';
 	io_hdr.cmd_len = sizeof (inqCmdBlk);
 	io_hdr.mx_sb_len = sizeof (sb);
@@ -45,9 +46,9 @@
 		pp_emc_log(0, "path unit report page in unknown format");
 		goto out;
 	}
-
+
 	if ( /* Effective initiator type */
-	    	sense_buffer[27] != 0x03
+		sense_buffer[27] != 0x03
 		/*
 		 * Failover mode should be set to 1 (PNR failover mode)
 		 * or 4 (ALUA failover mode).
@@ -57,18 +58,24 @@
 		/* Arraycommpath should be set to 1 */
 		|| (sense_buffer[30] & 0x04) != 0x04) {
 		pp_emc_log(0, "path not correctly configured for failover");
+		goto out;
 	}

 	if ( /* LUN operations should indicate normal operations */
 		sense_buffer[48] != 0x00) {
 		pp_emc_log(0, "path not available for normal operations");
+		goto out;
 	}
+
+	/* LUN state: unbound, bound, or owned */
+	ret = sense_buffer[4];

 	/* Is the default owner equal to this path? */
 	/* Note this will switch to the default priority group, even if
 	 * it is not the currently active one. */
-	ret = (sense_buffer[5] == sense_buffer[8]) ? 1 : 0;
-
+	if (sense_buffer[5] == sense_buffer[8])
+		ret+=2;
+
 out:
 	return(ret);
 }


Improve legibility of the AST dump slightly

--- libs/ast/ast_printer.c
+++ libs/ast/ast_printer.c
@@ -6,158 +6,160 @@
 //  Copyright © 2017 Amy Parent. All rights reserved.
 //
 #include <stdio.h>
+#include <stdbool.h>
 #include <orbit/ast/ast.h>

-static void ast_printReturn(FILE* out, int depth) {
+static void ast_printReturn(FILE* out, int depth, bool last) {
     fputs("\n", out);
     for(int i = 0; i < depth; ++i) {
-        fputs("   ", out);
+        fputs("  ", out);
     }
-    fputs("|", out);
+    fputs((last ? "`-" : "|-"), out);
 }

 static void ast_printToken(FILE* out, OCToken token) {
-    fputs("`", out);
+    fputs("'", out);
     const char* current = token.start;
     for(uint64_t i = 0; i < token.length; ++i) {
         fputc(*(current++), out);
     }
-    fputs("`", out);
-    //fprintf(out, "`%*.s`", (int)token->length, token->start);
+    fputs("'", out);
 }

-static void ast_printNode(FILE* out, const char* prefix, AST* ast, int depth) {
+static void ast_printNode(FILE* out, AST* ast, int depth, bool last) {
     if(ast == NULL) { return; }
-    ast_printReturn(out, depth);
-    fprintf(out, "_%s", prefix);
+    ast_printReturn(out, depth, last);

     switch(ast->type) {
     case AST_LIST:
-        ast_printNode(out, "", ast->list.head, depth+1);
+        fputs("NodeList", out);
+        ast_printNode(out, ast->list.head, depth+1, false);
         break;

     case AST_CONDITIONAL:
-        fprintf(out, "conditional");
-        ast_printNode(out, "condition:", ast->conditionalStmt.condition, depth+1);
-        ast_printNode(out, "if-body:", ast->conditionalStmt.ifBody, depth+1);
-        ast_printNode(out, "else-body:", ast->conditionalStmt.elseBody, depth+1);
+        fputs("IfStmt", out);
+        ast_printNode(out, ast->conditionalStmt.condition, depth+1, false);
+        ast_printNode(out, ast->conditionalStmt.ifBody, depth+1, false);
+        ast_printNode(out, ast->conditionalStmt.elseBody, depth+1, true);
         break;

     case AST_FOR_IN:
-        fprintf(out, "for-in ");
+        fputs("ForInStmt", out);
         ast_printToken(out, ast->forInLoop.variable);
-        ast_printNode(out, "collection:", ast->forInLoop.collection, depth+1);
-        ast_printNode(out, "body:", ast->forInLoop.body, depth+1);
+        ast_printNode(out, ast->forInLoop.collection, depth+1, false);
+        ast_printNode(out, ast->forInLoop.body, depth+1, true);
         break;

     case AST_WHILE:
-        fprintf(out, "while");
-        ast_printNode(out, "condition:", ast->whileLoop.condition, depth+1);
-        ast_printNode(out, "body:", ast->whileLoop.body, depth+1);
+        fputs("WhileStmt", out);
+        ast_printNode(out, ast->whileLoop.condition, depth+1, false);
+        ast_printNode(out, ast->whileLoop.body, depth+1, true);
         break;

     case AST_BREAK:
-        fprintf(out, "break");
+        fputs("BreakStmt", out);
         break;

     case AST_CONTINUE:
-        fprintf(out, "continue");
+        fputs("ContinueStmt", out);
         break;

     case AST_RETURN:
-        fprintf(out, "return");
-        ast_printNode(out, "value:", ast->returnStmt.returnValue, depth+1);
+        fputs("ReturnStmt", out);
+        ast_printNode(out, ast->returnStmt.returnValue, depth+1, true);
         break;

     // DECLARATIONS
     case AST_DECL_MODULE:
-        fprintf(out, "module-decl `%s`", ast->moduleDecl.symbol);
-        ast_printNode(out, "body:", ast->moduleDecl.body, depth+1);
+        fprintf(out, "ModuleDecl `%s`", ast->moduleDecl.symbol);
+        ast_printNode(out, ast->moduleDecl.body, depth+1, true);
         break;

     case AST_DECL_FUNC:
-        fprintf(out, "func-decl ");
+        fputs("FuncDecl", out);
         ast_printToken(out, ast->funcDecl.symbol);
-        ast_printNode(out, "params:", ast->funcDecl.params, depth+1);
-        ast_printNode(out, "returns:", ast->funcDecl.returnType, depth+1);
-        ast_printNode(out, "body:", ast->funcDecl.body, depth+1);
+        ast_printNode(out, ast->funcDecl.params, depth+1, false);
+        ast_printNode(out, ast->funcDecl.returnType, depth+1, false);
+        ast_printNode(out, ast->funcDecl.body, depth+1, true);
         break;

     case AST_DECL_VAR:
-        fprintf(out, "var-decl ");
+        fputs("VarDecl", out);
         ast_printToken(out, ast->varDecl.symbol);
-        ast_printNode(out, "type:", ast->varDecl.typeAnnotation, depth+1);
+        ast_printNode(out, ast->varDecl.typeAnnotation, depth+1, true);
         break;

     case AST_DECL_STRUCT:
-        fprintf(out, "usertype-decl");
+        fputs("CompoundTypeDecl", out);
         ast_printToken(out, ast->structDecl.symbol);
-        ast_printNode(out, "constructor:", ast->structDecl.constructor, depth+1);
-        ast_printNode(out, "destructor:", ast->structDecl.destructor, depth+1);
-        ast_printNode(out, "members:", ast->structDecl.fields, depth+1);
+        ast_printNode(out, ast->structDecl.constructor, depth+1, false);
+        ast_printNode(out, ast->structDecl.destructor, depth+1, false);
+        ast_printNode(out, ast->structDecl.fields, depth+1, true);
         break;

     // EXPRESSIONS
     case AST_EXPR_UNARY:
+        fputs("UnaryOperatorExpr ", out);
         ast_printToken(out, ast->unaryExpr.operator);
-        ast_printNode(out, "", ast->unaryExpr.rhs, depth+1);
+        ast_printNode(out, ast->unaryExpr.rhs, depth+1, true);
         break;

     case AST_EXPR_BINARY:
+        fputs("BinaryOperatorExpr ", out);
         ast_printToken(out, ast->binaryExpr.operator);
-        ast_printNode(out, "", ast->binaryExpr.lhs, depth+1);
-        ast_printNode(out, "", ast->binaryExpr.rhs, depth+1);
+        ast_printNode(out, ast->binaryExpr.lhs, depth+1, false);
+        ast_printNode(out, ast->binaryExpr.rhs, depth+1, true);
         break;

     case AST_EXPR_CALL:
-        fprintf(out, "call ");
-        ast_printNode(out, "symbol:", ast->callExpr.symbol, depth+1);
-        ast_printNode(out, "params:", ast->callExpr.params, depth+1);
+        fputs("CallExpr", out);
+        ast_printNode(out, ast->callExpr.symbol, depth+1, false);
+        ast_printNode(out, ast->callExpr.params, depth+1, true);
         break;

     case AST_EXPR_SUBSCRIPT:
-        fprintf(out, "subscript ");
-        ast_printNode(out, "symbol:", ast->subscriptExpr.symbol, depth+1);
-        ast_printNode(out, "subscript:", ast->subscriptExpr.subscript, depth+1);
+        fputs("SubscriptExpr", out);
+        ast_printNode(out, ast->subscriptExpr.symbol, depth+1, false);
+        ast_printNode(out, ast->subscriptExpr.subscript, depth+1, true);
         break;

     case AST_EXPR_CONSTANT:
-        fprintf(out, "constant ");
+        fputs("ConstantExpr ", out);
         ast_printToken(out, ast->constantExpr.symbol);
         break;

     case AST_EXPR_NAME:
-        fprintf(out, "symbol ");
+        fputs("NameRefExpr ", out);
         ast_printToken(out, ast->nameExpr.symbol);
         break;

     case AST_TYPEEXPR_SIMPLE:
-        fprintf(out, "type ");
+        fputs("TypeExpr", out);
         ast_printToken(out, ast->simpleType.symbol);
         break;

     case AST_TYPEEXPR_FUNC:
-        fprintf(out, "func-type");
-        ast_printNode(out, "returns:", ast->funcType.returnType, depth+1);
-        ast_printNode(out, "params:", ast->funcType.params, depth+1);
+        fputs("FuncTypeExpr", out);
+        ast_printNode(out, ast->funcType.returnType, depth+1, false);
+        ast_printNode(out, ast->funcType.params, depth+1, true);
         break;

     case AST_TYPEEXPR_ARRAY:
-        fprintf(out, "array-type");
-        ast_printNode(out, "elements:", ast->arrayType.elementType, depth+1);
+        fputs("ArrayTypeExpr", out);
+        ast_printNode(out, ast->arrayType.elementType, depth+1, false);
         break;

     case AST_TYPEEXPR_MAP:
-        fprintf(out, "map-type");
-        ast_printNode(out, "keys:", ast->mapType.keyType, depth+1);
-        ast_printNode(out, "elements:", ast->mapType.elementType, depth+1);
+        fputs("MapTypeExpr", out);
+        ast_printNode(out, ast->mapType.keyType, depth+1, false);
+        ast_printNode(out, ast->mapType.elementType, depth+1, true);
         break;
     }

-    ast_printNode(out, "", ast->next, depth);
+    ast_printNode(out, ast->next, depth, false);
 }

 void ast_print(FILE* out, AST* ast) {
-    ast_printNode(out, "", ast, 0);
+    ast_printNode(out, ast, 0, false);
     fputs("\n\n", out);
 }


Cleanup of running PL_on_halt() handlers

--- src/pl-main.c
+++ src/pl-main.c
@@ -1208,11 +1208,22 @@
   }
 }

+static void
+run_on_halt(int rval)
+{ GET_LD
+  OnHalt h, next;
+
+  for(h = GD->os.on_halt_list; h; h=next)
+  { next = h->next;
+    (*h->function)(rval, h->argument);
+    freeHeap(h, sizeof(*h));
+  }
+}
+

 int
 PL_cleanup(int rval)
 { GET_LD
-  OnHalt h;
   int rc = TRUE;

   if ( GD->cleaning != CLN_NORMAL )
@@ -1249,10 +1260,7 @@
   }

   GD->cleaning = CLN_FOREIGN;
-
-					/* run PL_on_halt() hooks */
-  for(h = GD->os.on_halt_list; h; h = h->next)
-    (*h->function)(rval, h->argument);
+  run_on_halt(rval);

 #ifdef __WINDOWS__
   if ( rval != 0 && !hasConsole() )


Avoid serializing UndefinedColor when rendering texts

Summary: This diff avoids the serialization of color that are set as: "UndefinedColor". This allows the text rendering system to set the default color in the native side

Reviewed By: shergin

Differential Revision: D10275834

fbshipit-source-id: b81c7a5995bef65e04a246d99f44ff10cb20f548

--- ReactCommon/fabric/attributedstring/conversions.h
+++ ReactCommon/fabric/attributedstring/conversions.h
@@ -387,7 +387,9 @@

 inline folly::dynamic toDynamic(const TextAttributes &textAttributes) {
   auto _textAttributes = folly::dynamic::object();
-  _textAttributes("foregroundColor", toDynamic(textAttributes.foregroundColor));
+  if (textAttributes.foregroundColor) {
+    _textAttributes("foregroundColor", toDynamic(textAttributes.foregroundColor));
+  }
   if (textAttributes.backgroundColor) {
     _textAttributes(
         "backgroundColor", toDynamic(textAttributes.backgroundColor));


collection: Fix leak on duplicate resource names

When a collection contains 2 resources with the same name, we were
correctly releasing the memory associated with the colliding resource,
but not its name.

--- govirt/ovirt-collection.c
+++ govirt/ovirt-collection.c
@@ -293,6 +293,7 @@
             g_message("'%s' resource with the same name ('%s') already exists",
                       collection->priv->resource_xml_name, name);
             g_object_unref(G_OBJECT(resource));
+            g_free(name);
             continue;
         }
         g_hash_table_insert(resources, name, resource);


Minor clean up in fiff_constants.h

Minor clean up in fiff_constants.h

--- libraries/fiff/fiff_constants.h
+++ libraries/fiff/fiff_constants.h
@@ -279,15 +279,16 @@
 #define FIFFV_MISC_CH    502
 #define FIFFV_RESP_CH    602   /**< Respiration monitoring*/

-//
-// More of those defined in MNE
-//
+/*
+* More of those defined in MNE
+*/
 #define FIFFV_MNE_SURF_UNKNOWN       -1
 #define FIFFV_MNE_SURF_LEFT_HEMI     101
 #define FIFFV_MNE_SURF_RIGHT_HEMI    102
-//
-//   These relate to the Isotrak data
-//
+
+/*
+* These relate to the Isotrak data
+*/
 #define FIFFV_POINT_CARDINAL 1
 #define FIFFV_POINT_HPI      2
 #define FIFFV_POINT_EEG      3
@@ -297,9 +298,10 @@
 #define FIFFV_POINT_LPA         1
 #define FIFFV_POINT_NASION      2
 #define FIFFV_POINT_RPA         3
-//
-//   These are the MNE fiff definitions
-//
+
+/*
+* These are the MNE fiff definitions
+*/
 #define FIFFB_MNE                    350
 #define FIFFB_MNE_SOURCE_SPACE       351
 #define FIFFB_MNE_FORWARD_SOLUTION   352
@@ -313,17 +315,17 @@
 #define FIFFB_MNE_VERTEX_MAP         360
 #define FIFFB_MNE_EVENTS             361
 #define FIFFB_MNE_MORPH_MAP          362
-    //
-    // CTF compensation data
-    //
+
+/*
+* CTF compensation data
+*/
 #define FIFFB_MNE_CTF_COMP           370
 #define FIFFB_MNE_CTF_COMP_DATA      371
-    ////
-    // Fiff tags associated with MNE computations (3500...)
-    //
-    //
-    // 3500... Bookkeeping
-    //
+
+/*
+* Fiff tags associated with MNE computations (3500...)
+* 3500... Bookkeeping
+*/
 #define FIFF_MNE_ROW_NAMES              3502
 #define FIFF_MNE_COL_NAMES              3503
 #define FIFF_MNE_NROW                   3504
@@ -334,9 +336,10 @@
 //FIFFB_MNE_INVERSE_SOLUTION   FIFFV_COORD_HEAD
 #define FIFF_MNE_CH_NAME_LIST           3507
 #define FIFF_MNE_FILE_NAME              3508    /**< This removes the collision with fiff_stream.h (used to be 3501)*/
-    //
-    // 3510... 3590... Source space or surface
-    //
+
+/*
+* 3510... 3590... Source space or surface
+*/
 #define FIFF_MNE_SOURCE_SPACE_POINTS        3510    /**< The vertices*/
 #define FIFF_MNE_SOURCE_SPACE_NORMALS       3511    /**< The vertex normals*/
 #define FIFF_MNE_SOURCE_SPACE_NPOINTS       3512    /**< How many vertices*/
@@ -358,16 +361,18 @@

 #define FIFF_MNE_SOURCE_SPACE_DIST          3599    /**< Distances between vertices in use (along the surface)*/
 #define FIFF_MNE_SOURCE_SPACE_DIST_LIMIT    3600    /**< If distance is above this limit (in the volume) it has not been calculated*/
-    //
-    // 3520... Forward solution
-    //
+
+/*
+* 3520... Forward solution
+*/
 #define FIFF_MNE_FORWARD_SOLUTION       3520
 #define FIFF_MNE_SOURCE_ORIENTATION     3521    /**< Fixed or free*/
 #define FIFF_MNE_INCLUDED_METHODS       3522
 #define FIFF_MNE_FORWARD_SOLUTION_GRAD  3523
-    //
-    // 3530... Covariance matrix
-    //
+
+/*
+* 3530... Covariance matrix
+*/
 #define FIFF_MNE_COV_KIND               3530    /**< What kind of a covariance matrix*/
 #define FIFF_MNE_COV_DIM                3531    /**< Matrix dimension*/
 #define FIFF_MNE_COV                    3532    /**< Full matrix in packed representation (lower triangle)*/
@@ -375,12 +380,11 @@
 #define FIFF_MNE_COV_EIGENVALUES        3534    /**< Eigenvalues and eigenvectors of the above*/
 #define FIFF_MNE_COV_EIGENVECTORS       3535
 #define FIFF_MNE_COV_NFREE              3536    /**< Number of degrees of freedom*/
-    //
-    // 3540... Inverse operator
-    //
-    // We store the inverse operator as the eigenleads  eigenfields
-    // and weights
-    //
+
+/*
+* 3540... Inverse operator
+* We store the inverse operator as the eigenleads  eigenfields and weights
+*/
 #define FIFF_MNE_INVERSE_LEADS              3540     /**< The eigenleads*/
 #define FIFF_MNE_INVERSE_LEADS_WEIGHTED     3546     /**< The eigenleads (already weighted with R^0.5)*/
 #define FIFF_MNE_INVERSE_FIELDS             3541     /**< The eigenfields*/
@@ -392,46 +396,48 @@
 #define FIFF_MNE_INVERSE_SOURCE_ORIENTATIONS 3545    /**<  orientation of one source per row*/
                                // The source orientations must be expressed in the coordinate system
                                // given by FIFF_MNE_COORD_FRAME
-    //
-    // 3550... Saved environment info
-    //
+
+/*
+* 3550... Saved environment info
+*/
 #define FIFF_MNE_ENV_WORKING_DIR        3550       /**< Working directory where the file was created*/
 #define FIFF_MNE_ENV_COMMAND_LINE       3551       /**< The command used to create the file*/
-    //
-    // 3560... Miscellaneous
-    //
+
+/*
+* 3560... Miscellaneous
+*/
 #define FIFF_MNE_PROJ_ITEM_ACTIVE       3560       /**< Is this projection item active?*/
 #define FIFF_MNE_EVENT_LIST             3561       /**< An event list (for STI 014)*/
 #define FIFF_MNE_HEMI                   3562       /**< Hemisphere association for general purposes*/
-    //
-    // 3570... Morphing maps
-    //
+
+/*
+* 3570... Morphing maps
+*/
 #define FIFF_MNE_MORPH_MAP              3570       /**< Mapping of closest vertices on the sphere*/
 #define FIFF_MNE_MORPH_MAP_FROM         3571       /**< Which subject is this map from*/
 #define FIFF_MNE_MORPH_MAP_TO           3572       /**< Which subject is this map to*/
-    //
-    // 3580... CTF compensation data
-    //
+
+/*
+* 3580... CTF compensation data
+*/
 #define FIFF_MNE_CTF_COMP_KIND         3580       /**< What kind of compensation*/
 #define FIFF_MNE_CTF_COMP_DATA         3581       /**< The compensation data itself*/
 #define FIFF_MNE_CTF_COMP_CALIBRATED   3582       /**< Are the coefficients calibrated?*/

-
-//
-// 3700... Real-Time Communication
-//
+/*
+* 3700... Real-Time Communication
+*/
 #define FIFF_MNE_RT_COMMAND         3700              /**< Fiff Real-Time Command */
 #define FIFF_MNE_RT_CLIENT_ID       3701              /**< Fiff Real-Time mne_t_server client id */

-//
-// 3710... Real-Time Blocks
-//
+/*
+* 3710... Real-Time Blocks
+*/
 #define FIFFB_MNE_RT_MEAS_INFO      3710              /**< Fiff Real-Time Measurement Info */

-
-//
-// Fiff values associated with MNE computations
-//
+/*
+* Fiff values associated with MNE computations
+*/
 #define FIFFV_MNE_FIXED_ORI            1
 #define FIFFV_MNE_FREE_ORI             2

@@ -447,27 +453,31 @@
 #define FIFFV_MNE_SIGNAL_COV           4           /**< This will be potentially employed in beamformers*/
 #define FIFFV_MNE_DEPTH_PRIOR_COV      5           /**< The depth weighting prior*/
 #define FIFFV_MNE_ORIENT_PRIOR_COV     6           /**< The orientation prior*/
-    //
-    // Source space types (values of FIFF_MNE_SOURCE_SPACE_TYPE)
-    //
+
+/*
+* Source space types (values of FIFF_MNE_SOURCE_SPACE_TYPE)
+*/
 #define FIFFV_MNE_SPACE_UNKNOWN  -1
 #define FIFFV_MNE_SPACE_SURFACE  1
 #define FIFFV_MNE_SPACE_VOLUME   2
 #define FIFFV_MNE_SPACE_DISCRETE 3
-    //
-    // Covariance matrix channel classification
-    //
+
+/*
+* Covariance matrix channel classification
+*/
 #define FIFFV_MNE_COV_CH_UNKNOWN  -1    /**< No idea*/
 #define FIFFV_MNE_COV_CH_MEG_MAG   0    /**< Axial gradiometer or magnetometer [T]*/
 #define FIFFV_MNE_COV_CH_MEG_GRAD  1    /**< Planar gradiometer [T/m]*/
 #define FIFFV_MNE_COV_CH_EEG       2    /**< EEG [V]*/
-    //
-    // Projection item kinds
-    //
+
+/*
+* Projection item kinds
+*/
 #define FIFFV_MNE_PROJ_ITEM_EEG_AVREF  10
-    //
-    // Additional coordinate frames
-    //
+
+/*
+* Additional coordinate frames
+*/
 #define FIFFV_MNE_COORD_TUFTS_EEG    300           /**< For Tufts EEG data*/
 #define FIFFV_MNE_COORD_CTF_DEVICE  1001           /**< CTF device coordinates*/
 #define FIFFV_MNE_COORD_CTF_HEAD    1004           /**< CTF head coordinates*/
@@ -478,12 +488,6 @@
 #define FIFFV_MNE_COORD_FS_TAL_LTZ  2005           /**< FreeSurfer Talairach coordinates (MNI z < 0)*/
 #define FIFFV_MNE_COORD_FS_TAL      2006           /**< FreeSurfer Talairach coordinates*/

-//
-// Others we need
-//
-#define FIFF_UNIT_AM_M2 203    /**< Am/m^2*/
-#define FIFF_UNIT_AM_M3 204    /**< Am/m^3*/
-
 } // NAMESPACE

 #endif // FIFF_CONSTANTS_H


compile

compile

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@21892 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- pfl/log.c
+++ pfl/log.c
@@ -26,6 +26,7 @@
 #include <sys/syscall.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
+#include <sys/wait.h>

 #include <ctype.h>
 #include <err.h>
@@ -126,13 +127,15 @@
 		case -1:
 			psclog_error("fork");
 			break;
-		case 0:
-			char cmdbuf[512];
+		case 0: {
+			char cmdbuf[LINE_MAX];

 			rc = snprintf(cmdbuf, sizeof(cmdbuf),
 			    "tail -f %s | %s", fn, lp);
-			psc_assert(rc > 0 && rc <= sizeof(cmdbuf));
+			psc_assert(rc > 0 &&
+			    rc <= (int)sizeof(cmdbuf));
 			exit(system(cmdbuf));
+		    }
 		default:
 			rc = waitpid(logger_pid, NULL, 0);
 			break;


Mark SoupSession as an abstract class

Mark SoupSession as an abstract class

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

--- libsoup/soup-session.c
+++ libsoup/soup-session.c
@@ -119,7 +119,7 @@

 #define SOUP_SESSION_USER_AGENT_BASE "libsoup/" PACKAGE_VERSION

-G_DEFINE_TYPE (SoupSession, soup_session, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (SoupSession, soup_session, G_TYPE_OBJECT)

 enum {
 	REQUEST_QUEUED,


another fix for 16-bit platforms

another fix for 16-bit platforms

git-svn-id: 42b1393cca5d551bec90c34575d0b84245f1dba8@11387 0101bb08-14d6-0310-b084-bc0e0c8e3800

--- libspeex/pseudofloat.h
+++ libspeex/pseudofloat.h
@@ -264,12 +264,12 @@
    {
       return FLOAT_ZERO;
    }
-   while (a<SHL32(b.m,14))
+   while (a<SHL32(EXTEND32(b.m),14))
    {
       a <<= 1;
       e--;
    }
-   while (a>=SHL32(b.m-1,15))
+   while (a>=SHL32(EXTEND32(b.m-1),15))
    {
       a >>= 1;
       e++;


Darwin: Improve device enumeration performance and save device location

[stuge: Formatting fixes and split out libusb_get_device_speed() change]

--- libusb/os/darwin_usb.c
+++ libusb/os/darwin_usb.c
@@ -1,6 +1,6 @@
 /*
  * darwin backend for libusb 1.0
- * Copyright (C) 2008-2010 Nathan Hjelm <hjelmn@users.sourceforge.net>
+ * Copyright (C) 2008-2011 Nathan Hjelm <hjelmn@users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -517,13 +517,143 @@
   return 0;
 }

+static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct libusb_device *dev, usb_device_t **device) {
+  struct darwin_device_priv *priv;
+  int retries = 5, delay = 30000;
+  int unsuspended = 0, try_unsuspend = 1, try_reconfigure = 1;
+  int is_open = 0;
+  int ret = 0, ret2;
+  IOUSBDevRequest req;
+  UInt8 bDeviceClass;
+  UInt16 idProduct, idVendor;
+
+  (*device)->GetDeviceClass (device, &bDeviceClass);
+  (*device)->GetDeviceProduct (device, &idProduct);
+  (*device)->GetDeviceVendor (device, &idVendor);
+
+  priv = (struct darwin_device_priv *)dev->os_priv;
+
+  /* try to open the device (we can usually continue even if this fails) */
+  is_open = ((*device)->USBDeviceOpenSeize(device) == kIOReturnSuccess);
+
+  /**** retrieve device descriptor ****/
+  do {
+    /* Set up request for device descriptor */
+    memset (&(priv->dev_descriptor), 0, sizeof(IOUSBDeviceDescriptor));
+    req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
+    req.bRequest      = kUSBRqGetDescriptor;
+    req.wValue        = kUSBDeviceDesc << 8;
+    req.wIndex        = 0;
+    req.wLength       = sizeof(priv->dev_descriptor);
+    req.pData         = &(priv->dev_descriptor);
+
+    /* according to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
+     * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request.  Still,
+     * to follow the spec as closely as possible, try opening the device */
+
+    ret = (*(device))->DeviceRequest (device, &req);
+
+    if (kIOReturnOverrun == ret && kUSBDeviceDesc == priv->dev_descriptor.bDescriptorType)
+      /* received an overrun error but we still received a device descriptor */
+      ret = kIOReturnSuccess;
+
+    if (kIOReturnSuccess == ret && (0 == priv->dev_descriptor.idProduct ||
+				    0 == priv->dev_descriptor.bNumConfigurations ||
+				    0 == priv->dev_descriptor.bcdUSB)) {
+      /* work around for incorrectly configured devices */
+      if (try_reconfigure && is_open) {
+	usbi_dbg("descriptor appears to be invalid. resetting configuration before trying again...");
+
+	/* set the first configuration */
+	(*device)->SetConfiguration(device, 1);
+
+	/* don't try to reconfigure again */
+	try_reconfigure = 0;
+      }
+
+      ret = kIOUSBPipeStalled;
+    }
+
+    if (kIOReturnSuccess != ret && is_open && try_unsuspend) {
+      /* device may be suspended. unsuspend it and try again */
+#if DeviceVersion >= 320
+      UInt32 info;
+
+      /* IOUSBFamily 320+ provides a way to detect device suspension but earlier versions do not */
+      (void)(*device)->GetUSBDeviceInformation (device, &info);
+
+      try_unsuspend = info & (1 << kUSBInformationDeviceIsSuspendedBit);
+#endif
+
+      if (try_unsuspend) {
+	/* resume the device */
+	ret2 = (*device)->USBDeviceSuspend (device, 0);
+	if (kIOReturnSuccess != ret2) {
+	  /* prevent log spew from poorly behaving devices.  this indicates the
+	     os actually had trouble communicating with the device */
+	  usbi_dbg("could not retrieve device descriptor. failed to unsuspend: %s",darwin_error_str(ret2));
+	} else
+	  unsuspended = 1;
+
+	try_unsuspend = 0;
+      }
+    }
+
+    if (kIOReturnSuccess != ret) {
+      usbi_dbg("kernel responded with code: 0x%08x. sleeping for %d ms before trying again", ret, delay/1000);
+      /* sleep for a little while before trying again */
+      usleep (delay);
+    }
+  } while (kIOReturnSuccess != ret && retries--);
+
+  if (unsuspended)
+    /* resuspend the device */
+    (void)(*device)->USBDeviceSuspend (device, 1);
+
+  if (is_open)
+    (void) (*device)->USBDeviceClose (device);
+
+  if (ret != kIOReturnSuccess) {
+    /* a debug message was already printed out for this error */
+    if (LIBUSB_CLASS_HUB == bDeviceClass)
+      usbi_dbg ("could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
+    else
+      usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
+
+    return -1;
+  }
+
+  usbi_dbg ("device descriptor:");
+  usbi_dbg (" bDescriptorType:    0x%02x", priv->dev_descriptor.bDescriptorType);
+  usbi_dbg (" bcdUSB:             0x%04x", priv->dev_descriptor.bcdUSB);
+  usbi_dbg (" bDeviceClass:       0x%02x", priv->dev_descriptor.bDeviceClass);
+  usbi_dbg (" bDeviceSubClass:    0x%02x", priv->dev_descriptor.bDeviceSubClass);
+  usbi_dbg (" bDeviceProtocol:    0x%02x", priv->dev_descriptor.bDeviceProtocol);
+  usbi_dbg (" bMaxPacketSize0:    0x%02x", priv->dev_descriptor.bMaxPacketSize0);
+  usbi_dbg (" idVendor:           0x%04x", priv->dev_descriptor.idVendor);
+  usbi_dbg (" idProduct:          0x%04x", priv->dev_descriptor.idProduct);
+  usbi_dbg (" bcdDevice:          0x%04x", priv->dev_descriptor.bcdDevice);
+  usbi_dbg (" iManufacturer:      0x%02x", priv->dev_descriptor.iManufacturer);
+  usbi_dbg (" iProduct:           0x%02x", priv->dev_descriptor.iProduct);
+  usbi_dbg (" iSerialNumber:      0x%02x", priv->dev_descriptor.iSerialNumber);
+  usbi_dbg (" bNumConfigurations: 0x%02x", priv->dev_descriptor.bNumConfigurations);
+
+  /* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
+  if (libusb_le16_to_cpu (priv->dev_descriptor.idProduct) != idProduct) {
+    /* not a valid device */
+    usbi_warn (ctx, "idProduct from iokit (%04x) does not match idProduct in descriptor (%04x). skipping device",
+	       idProduct, libusb_le16_to_cpu (priv->dev_descriptor.idProduct));
+    return -1;
+  }
+
+  return 0;
+}
+
 static int process_new_device (struct libusb_context *ctx, usb_device_t **device, UInt32 locationID, struct discovered_devs **_discdevs) {
   struct darwin_device_priv *priv;
   struct libusb_device *dev;
   struct discovered_devs *discdevs;
-  UInt16                address, idVendor, idProduct;
-  UInt8                 bDeviceClass, bDeviceSubClass;
-  IOUSBDevRequest      req;
+  UInt16                address;
   int ret = 0, need_unref = 0;

   do {
@@ -542,80 +672,24 @@

     priv = (struct darwin_device_priv *)dev->os_priv;

-    /* Set up request for device descriptor */
-    req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
-    req.bRequest      = kUSBRqGetDescriptor;
-    req.wValue        = kUSBDeviceDesc << 8;
-    req.wIndex        = 0;
-    req.wLength       = sizeof(IOUSBDeviceDescriptor);
-    req.pData         = &(priv->dev_descriptor);
-
-    (*(device))->GetDeviceAddress (device, (USBDeviceAddress *)&address);
-    (*(device))->GetDeviceProduct (device, &idProduct);
-    (*(device))->GetDeviceVendor (device, &idVendor);
-    (*(device))->GetDeviceClass (device, &bDeviceClass);
-    (*(device))->GetDeviceSubClass (device, &bDeviceSubClass);
-
-    /**** retrieve device descriptors ****/
-    /* according to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
-     * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request */
-    ret = (*(device))->DeviceRequest (device, &req);
-    if (ret != kIOReturnSuccess) {
-      int try_unsuspend = 1;
-#if DeviceVersion >= 320
-      UInt32 info;
-
-      /* device may be suspended. unsuspend it and try again */
-      /* IOUSBFamily 320+ provides a way to detect device suspension but earlier versions do not */
-      (void)(*device)->GetUSBDeviceInformation (device, &info);
-
-      try_unsuspend = info & (1 << kUSBInformationDeviceIsSuspendedBit);
-#endif
-
-      /* the device should be open before to device is unsuspended */
-      (void) (*device)->USBDeviceOpenSeize(device);
-
-      if (try_unsuspend) {
-	/* resume the device */
-	(void)(*device)->USBDeviceSuspend (device, 0);
-
-	ret = (*(device))->DeviceRequest (device, &req);
-
-	/* resuspend the device */
-	(void)(*device)->USBDeviceSuspend (device, 1);
-      }
-
-      (*device)->USBDeviceClose (device);
-    }
-
-    if (ret != kIOReturnSuccess) {
-      usbi_warn (ctx, "could not retrieve device descriptor: %s. skipping device", darwin_error_str (ret));
-      ret = -1;
+    (*device)->GetDeviceAddress (device, (USBDeviceAddress *)&address);
+
+    ret = darwin_cache_device_descriptor (ctx, dev, device);
+    if (ret < 0)
       break;
-    }
-
-    /**** end: retrieve device descriptors ****/
-
-    /* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
-    if (libusb_le16_to_cpu (priv->dev_descriptor.idProduct) != idProduct) {
-      /* not a valid device */
-      usbi_warn (ctx, "idProduct from iokit (%04x) does not match idProduct in descriptor (%04x). skipping device",
-		 idProduct, libusb_le16_to_cpu (priv->dev_descriptor.idProduct));
-      ret = -1;
-      break;
-    }
-
-    dev->bus_number     = locationID >> 24;
-    dev->device_address = address;

     /* check current active configuration (and cache the first configuration value-- which may be used by claim_interface) */
     ret = darwin_check_configuration (ctx, dev, device);
     if (ret < 0)
       break;

+    dev->bus_number     = locationID >> 24;
+    dev->device_address = address;
+
     /* save our location, we'll need this later */
     priv->location = locationID;
-    snprintf(priv->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", address, idVendor, idProduct, bDeviceClass, bDeviceSubClass);
+    snprintf(priv->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", address, priv->dev_descriptor.idVendor, priv->dev_descriptor.idProduct,
+	     priv->dev_descriptor.bDeviceClass, priv->dev_descriptor.bDeviceSubClass);

     ret = usbi_sanitize_device (dev);
     if (ret < 0)


Fixed compiler errors when using Python 2.5rc.

git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@3188 94b884b6-d6fd-0310-90d3-974f1d3f35e1

--- numpy/core/src/arrayobject.c
+++ numpy/core/src/arrayobject.c
@@ -563,7 +563,11 @@
         }
 #if (PY_VERSION_HEX >= 0x02050000)
 	if (PyIndex_Check(o)) {
-		long_value = (longlong) PyNumber_Index(o);
+                PyObject* value = PyNumber_Index(o);
+		if (value==NULL) {
+		  return -1;
+		}
+		long_value = (longlong) PyInt_AsSsize_t(value);
 		goto finish;
 	}
 #endif
@@ -652,7 +656,8 @@
         }
 #if (PY_VERSION_HEX >= 0x02050000)
 	if (PyIndex_Check(o)) {
-		long_value = (longlong) PyNumber_Index(o);
+                PyObject* value = PyNumber_Index(o);
+		long_value = (longlong) PyInt_AsSsize_t(value);
 		goto finish;
 	}
 #endif
@@ -3393,8 +3398,14 @@
     }
 #if (PY_VERSION_HEX >= 0x02050000)
     if (PyIndex_Check(o2)) {
+            PyObject* value = PyNumber_Index(o2);
             Py_ssize_t val;
-            val = PyNumber_Index(obj);
+	    if (value==NULL) {
+	      if (PyErr_Occurred())
+		PyErr_Clear();
+	      return 0;
+	    }
+            val = PyInt_AsSsize_t(value);
             if (val == -1 && PyErr_Occurred()) {
                     PyErr_Clear();
                     return 0;


Remove unnecessary header include.

Remove unnecessary header include.

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@2080 2bbb7eff-a529-9590-31e7-b0007b416f81

--- gpu/src/GrStencilBuffer.h
+++ gpu/src/GrStencilBuffer.h
@@ -12,9 +12,6 @@

 #include "GrClip.h"
 #include "GrResource.h"
-
-// REMOVE ME
-#include "GrRenderTarget.h"

 class GrRenderTarget;
 class GrResourceEntry;


Adding support for light kit

Adding support for light kit

Change-Id: I7e93093a65c5c624f5b856d054c553ae22c5da60

--- Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
+++ Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
@@ -271,51 +271,115 @@
   }

   //--------------------------------------------------------------------------
-  std::string LightComputeFunc(vtkRenderer*vtkNotUsed(ren),
+  std::string LightComputeFunc(vtkRenderer* ren,
                                vtkVolumeMapper* vtkNotUsed(mapper),
                                vtkVolume* vol,
                                int vtkNotUsed(numberOfComponents))
     {
+    std::string shaderStr;
     vtkVolumeProperty* volProperty = vol->GetProperty();
+
+    int lightComplexity = 0;
+    int numberOfLights = 0;
+    vtkLightCollection *lc = ren->GetLights();
+    vtkLight *light;
+
+    // Compute light complexity.
+    vtkCollectionSimpleIterator sit;
+    for (lc->InitTraversal(sit); (light = lc->GetNextLight(sit)); )
+      {
+      float status = light->GetSwitch();
+      if (status > 0.0)
+        {
+        numberOfLights++;
+        if (lightComplexity == 0)
+          {
+          lightComplexity = 1;
+          }
+        }
+
+      if (lightComplexity == 1
+          && (numberOfLights > 1
+            || light->GetIntensity() != 1.0
+            || light->GetLightType() != VTK_LIGHT_TYPE_HEADLIGHT))
+        {
+          lightComplexity = 2;
+        }
+
+      if (lightComplexity < 3
+          && (light->GetPositional()))
+        {
+          lightComplexity = 3;
+          break;
+        }
+      }
+
+    if (lightComplexity == 3)
+      {
+      shaderStr = "\n\
+        vec3 diffuse = vec3(0,0,0);\n\
+        vec3 specular = vec3(0,0,0);\n\
+        for (int lightNum = 0; lightNum < numberOfLights; lightNum++)\n\
+        {\n\
+        // diffuse and specular lighting\n\
+        float df = max(0.0, dot(normalVC, -lightDirectionVC[lightNum]));\n\
+        diffuse += (df * lightColor[lightNum]);\n\
+        if (dot(normalVC, -lightDirectionVC[lightNum]) > 0.0)\n\
+          {\n\
+          float sf = pow( max(0.0, dot(\n\
+            reflect(lightDirectionVC[lightNum], normalVC), viewDirectionVC)), specularPower);\n\
+          specular += (sf * lightColor[lightNum]);\n\
+          }\n\
+        }\n\
+      }";
+
     if (volProperty->GetShade() &&
         volProperty->GetDisableGradientOpacity())
       {
-      return std::string(" \n\
-        vec4 computeLighting(vec4 color) \n\
-          {\n\
-          vec3 ldir = normalize(g_light_pos_obj.xyz - m_vertex_pos); \n\
-          vec3 vdir = normalize(g_eye_pos_obj.xyz - m_vertex_pos); \n\
-          vec3 h = normalize(ldir + vdir); \n\
-          vec3 g2 = computeGradient(); \n\
-          g2 = (1.0/m_cell_spacing) * g2; \n\
-          float normalLength = length(g2);\n\
-          if (normalLength > 0.0) \n\
-             { \n\
-             g2 = normalize(g2); \n\
-             } \n\
-           else \n\
-             { \n\
-             g2 = vec3(0.0, 0.0, 0.0); \n\
-             } \n\
-          vec3 final_color = vec3(0.0); \n\
-          float n_dot_l = dot(g2, ldir); \n\
-          float n_dot_h = dot(g2, h); \n\
-          if (n_dot_l < 0.0) \n\
-            { \n\
-            n_dot_l = -n_dot_l; \n\
-            } \n\
-          if (n_dot_h < 0.0) \n\
-            { \n\
-            n_dot_h = -n_dot_h; \n\
-            } \n\
-          final_color += m_ambient * color.rgb; \n\
-          if (n_dot_l > 0) { \n\
-            final_color += m_diffuse * n_dot_l * color.rgb; \n\
-           } \n\
-          final_color += m_specular * pow(n_dot_h, m_shininess); \n\
-          final_color = clamp(final_color, vec3(0.0), vec3(1.0)); \n\
-          return vec4(final_color, color.a); \n\
-          }");
+      if (lightComplexity == 3)
+        {
+        return std::string(" \n\
+          vec4 computeLighting(vec4 color) \n\
+            {\n\
+            vec3 vdir = normalize(g_eye_pos_obj.xyz - m_vertex_pos); \n\
+            vec3 g2 = computeGradient(); \n\
+            vec3 diffuse = vec3(0.0); \n\
+            vec3 specular = vec3(0.0); \n\
+            g2 = (1.0/m_cell_spacing) * g2; \n\
+            float normalLength = length(g2);\n\
+            float n_dot_h = dot(g2, h); \n\
+            if (n_dot_h < 0.0) \n\
+              { \n\
+              n_dot_h = -n_dot_h; \n\
+              } \n\
+            if (normalLength > 0.0) \n\
+               { \n\
+               g2 = normalize(g2); \n\
+               } \n\
+             else \n\
+               { \n\
+               g2 = vec3(0.0, 0.0, 0.0); \n\
+               } \n\
+            vec3 final_color = vec3(0.0); \n\
+            for (int lightNum = 0; lightNum < m_numberOfLights; lightNum++)\n\
+              {\n\
+              vec3 ldir = normalize(m_lightDirection[lightNum].xyz - m_vertex_pos); \n\
+              vec3 h = normalize(ldir + vdir); \n\
+              float n_dot_l = dot(g2, ldir); \n\
+              if (n_dot_l < 0.0) \n\
+                { \n\
+                n_dot_l = -n_dot_l; \n\
+                } \n\
+              if (n_dot_l > 0) { \n\
+                diffuse += m_lightColor[lightNum] * n_dot_l; \n\
+               } \n\
+              specular = m_lightColor[lightNum] * pow(n_dot_h, m_shininess); \n\
+              }\n\
+            final_color += (m_ambient + diffuse + specuflar) * color.rgb \n\
+            final_color = clamp(final_color, vec3(0.0), vec3(1.0)); \n\
+            return vec4(final_color, color.a); \n\
+            }");
+        }
       }
     else if (volProperty->GetShade() &&
         !volProperty->GetDisableGradientOpacity())


platform independent sizes (16ok|32no)

platform independent sizes (16ok|32no)

--- platforms/unix/vm-display-fbdev/sqUnixFBDevFramebuffer.c
+++ platforms/unix/vm-display-fbdev/sqUnixFBDevFramebuffer.c
@@ -40,6 +40,13 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+/* be less dependent on architecture defs */
+#include <sys/types.h>
+#define uint8   u_int8_t
+#define uint16  u_int16_t
+#define uint32  u_int32_t
+/* Pixels are kept as 32 bits: uint32 */
+#define pixel_t u_int32_t

 #include <linux/fb.h>
 #include <linux/vt.h>
@@ -54,10 +61,11 @@

 struct fb;

+
 typedef void		(*fb_copyBits_t )(_self, char *bits, int l, int r, int t, int b);
 typedef void		(*fb_drawPixel_t)(_self, int x, int y, int r, int g, int b);
-typedef unsigned long	(*fb_getPixel_t )(_self, int x, int y);
-typedef void		(*fb_putPixel_t )(_self, int x, int y, unsigned long pixel);
+typedef pixel_t		(*fb_getPixel_t )(_self, int x, int y);
+typedef void		(*fb_putPixel_t )(_self, int x, int y, pixel_t pixel);

 struct fb
 {
@@ -74,14 +82,14 @@
   fb_drawPixel_t		  drawPixel;
   fb_getPixel_t			  getPixel;
   fb_putPixel_t			  putPixel;
-  unsigned long			  whitePixel;
-  unsigned long			  blackPixel;
+  pixel_t			  whitePixel;
+  pixel_t			  blackPixel;
   SqPoint			  cursorPosition;
   SqPoint			  cursorOffset;
   int				  cursorVisible;
-  unsigned short		  cursorBits[16];
-  unsigned short		  cursorMask[16];
-  unsigned long			  cursorBack[16][16];
+  uint16			  cursorBits[16];
+  uint16			  cursorMask[16];
+  pixel_t			  cursorBack[16][16];
 };

 static struct fb fbSelf;
@@ -118,59 +126,59 @@
       +  (y + self->var.yoffset) * self->fix.line_length ;
 }

-static inline unsigned long fb_getPixel_32(_self, int x, int y)
+static inline pixel_t fb_getPixel_32(_self, int x, int y)
 {
   return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
-    ? *((unsigned long *)(self->addr
-			   + (x + self->var.xoffset) * (32 / 8)
-			   + (y + self->var.yoffset) * (self->fix.line_length)))
+    ? *((pixel_t *)(self->addr
+		   + (x + self->var.xoffset) * (32 / 8)
+		   + (y + self->var.yoffset) * (self->fix.line_length)))
     : 0;
 }

-static inline void fb_putPixel_32(_self, int x, int y, unsigned long pix)
+static inline void fb_putPixel_32(_self, int x, int y, pixel_t pix)
 {
   if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
     {
-      *((unsigned long *)(self->addr
-			  + (x + self->var.xoffset) * (32 / 8)
-			  + (y + self->var.yoffset) * (self->fix.line_length)))
+      *((pixel_t *)(self->addr
+		  + (x + self->var.xoffset) * (32 / 8)
+		  + (y + self->var.yoffset) * (self->fix.line_length)))
 	= pix;
     }
 }

-static inline unsigned long fb_getPixel_16(_self, int x, int y)
+static inline pixel_t fb_getPixel_16(_self, int x, int y)
 {
   return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
-    ? *((unsigned short *)(self->addr
-			   + (x + self->var.xoffset) * (16 / 8)
-			   + (y + self->var.yoffset) * (self->fix.line_length)))
+    ? *((uint16 *)(self->addr
+		   + (x + self->var.xoffset) * (16 / 8)
+		   + (y + self->var.yoffset) * (self->fix.line_length)))
     : 0;
 }

-static inline void fb_putPixel_16(_self, int x, int y, unsigned long pix)
+static inline void fb_putPixel_16(_self, int x, int y, pixel_t pix)
 {
   if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
     {
-      *((unsigned short *)(self->addr
-			   + (x + self->var.xoffset) * (16 / 8)
-			   + (y + self->var.yoffset) * (self->fix.line_length)))
+      *((uint16 *)(self->addr
+		   + (x + self->var.xoffset) * (16 / 8)
+		   + (y + self->var.yoffset) * (self->fix.line_length)))
 	= pix;
     }
 }

-static inline unsigned long fb_getPixel_8(_self, int x, int y)
+static inline pixel_t fb_getPixel_8(_self, int x, int y)
 {
   return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
-    ? *((unsigned char *)(self->addr
+    ? *((uint16 *)(self->addr
 			  + (x + self->var.xoffset)
 			  + (y + self->var.yoffset) * (self->fix.line_length)))
     : 0;
 }

-static inline void fb_putPixel_8(_self, int x, int y, unsigned long pix)
+static inline void fb_putPixel_8(_self, int x, int y, pixel_t pix)
 {
   if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self)))
     {
@@ -280,11 +288,10 @@
   for (y= 0;  y < 16; y = y+1)
     {
       /* Pick off top 16 bits of 32 bit elements; lower 16 unused */
-      /* @@FIXME: bits & mask were (unsigned long *) -- bas for 64 bits
-         need to spec portably !! @@ */
-      self->cursorBits[y]= (((unsigned int *)bits)[y]) >> 16;
+      /* NB: bits & mask were (unsigned long *) -- bad for 64 bits */
+      self->cursorBits[y]=   (((pixel_t *)bits)[y]) >> 16;
       if (mask) {
-        self->cursorMask[y]= (((unsigned int *)mask)[y]) >> 16;
+        self->cursorMask[y]= (((pixel_t *)mask)[y]) >> 16;
       } else {  /* unmasked cursor */
         self->cursorMask[y]= self->cursorBits[y]; /* Black Bits matter */
       }
@@ -308,8 +315,8 @@
   hideCursorIn(self, l, r, t, b);
   for (y= t;  y < b;  ++y)
     {
-      unsigned long *in= (unsigned long *)(bits + ((l + (y * fb_width(self))) * 4));
-      unsigned long *out= (unsigned long *)(self->addr + ((l + (y * fb_pitch(self))) * 4));
+      pixel_t *in= (pixel_t *)(bits + ((l + (y * fb_width(self))) * 4));
+      pixel_t *out= (pixel_t *)(self->addr + ((l + (y * fb_pitch(self))) * 4));
       for (x= l;  x < r;  x += 1, in += 1, out += 1)
 	{
 	  out[0]= in[0];
@@ -363,7 +370,7 @@
       for (x= l;  x < r;  x += 2, in += 2, out += 2)
 	{
 #	 if defined(WORDS_BIGENDIAN)
-	  *(unsigned long *)out= *(unsigned long *)in;
+	  *(pixel_t *)out= *(pixel_t *)in;
 #	 else
 	  out[0]= in[1];
 	  out[1]= in[0];
@@ -380,15 +387,15 @@
   hideCursorIn(self, l, r, t, b);
   for (y= t;  y < b;  ++y)
     {
-      unsigned char *in= (unsigned char *)(bits + ((l + (y * fb_pitch(self)))));
+      unsigned char *in=  (unsigned char *)(bits + ((l + (y * fb_pitch(self)))));
       unsigned char *out= (unsigned char *)(self->addr + ((l + (y * fb_pitch(self)))));
       for (x= l;  x < r;  x += 4, in += 4, out += 4)
 	{
-	  unsigned long pix= *(unsigned long *)out= *(unsigned long *)in;
+	  pixel_t pix= *(pixel_t *)out= *(pixel_t *)in;
 #        if !defined(WORDS_BIGENDIAN)
 	  pix= swab32(pix);
 #        endif
-	  *(unsigned long *)out= pix;
+	  *(pixel_t *)out= pix;
 	}
     }
   showCursorIn(self, l, r, t, b);
@@ -622,7 +629,7 @@
 {
   int x, y;
   char *data = balloon_data, pixel[4];
-  unsigned long myPixel;
+  pixel_t myPixel;
   int balloon_bytes_per_pixel = 4; /* 32 bits */

   /* Center Balloon on x,y point */


ShellPkg: add error messages into function

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: 3158a46dfd52e07d1fda3e32e1ab2e353a00b20f@14986 6f19259b-4bc3-4df7-8a09-765794883524

--- ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -1163,8 +1163,15 @@
   CalculateEfiHdrCrc(&gST->Hdr);

   if (gST->ConIn == NULL ||gST->ConOut == NULL) {
-    return (EFI_OUT_OF_RESOURCES);
-  }
+    Status = EFI_OUT_OF_RESOURCES;
+  }
+
+  if (Status == EFI_NOT_FOUND) {
+    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_REDUNDA_REDIR), ShellInfoObject.HiiHandle);
+  } else if (EFI_ERROR(Status)) {
+    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle);
+  }
+
   return (Status);
 }


minor type-setting fix

minor type-setting fix

[git-p4: depot-paths = "//sw/gpgpu/nvbio/main/": change = 18518657]

--- nvbio/io/sequence/sequence.h
+++ nvbio/io/sequence/sequence.h
@@ -266,11 +266,10 @@
 }

 ///@defgroup SequenceDataViews SequenceData Views
-///
+///\par
 /// This module contains plain-view classes for \ref SequenceData objects that can
 /// be adapted to use iterators of a user-specified type, so as to allow reinterpreting
 /// the base arrays, e.g. using LDG loads.
-///
 ///@{

 ///


problem with round in windoof

problem with round in windoof

git-svn-id: 53a346f67f76028cd3290d0c97fdb7682ad2a994@9913 358b74ad-2626-0410-af80-f4c3c349ae55

--- imageutilities/src/iucore/imagepyramid.h
+++ imageutilities/src/iucore/imagepyramid.h
@@ -69,8 +69,8 @@
       scale_factors_[i] = pow(scale_factor, static_cast<float>(i));

       // alloc image memory
-      IuSize sz(static_cast<int>(round(static_cast<double>(size.width)*static_cast<double>(scale_factors_[i]))),
-                static_cast<int>(round(static_cast<double>(size.height)*static_cast<double>(scale_factors_[i]))));
+      IuSize sz(static_cast<int>(floor(0.5+static_cast<double>(size.width)*static_cast<double>(scale_factors_[i]))),
+                static_cast<int>(floor(0.5+static_cast<double>(size.height)*static_cast<double>(scale_factors_[i]))));
       images_[i] = new ImageType(sz);
     }
   }


how markdown

how markdown

--- Runtime/Engine/Source/DoxygenPages/EngineLayout.h
+++ Runtime/Engine/Source/DoxygenPages/EngineLayout.h
@@ -10,7 +10,7 @@

 	As a game engine, Blueshift must maintain two things in its core execution step:

-	* **Speed:** Each frame must be executed in 1/framerate seconds or less.
+	* **Speed:** Each frame must be executed in 1/framerate seconds or less.
 	* **Consistency:** The deviation from the average frame throughput cannot be too high; it is better to be
 					   consistently slow than to be fast but choppy.

@@ -31,9 +31,7 @@
 	Rendering can be decoupled. We can render the state as it appears at a given time. If there is
 	no change in the state as it exists in memory, we may use portions of the state to infer the state
 	at a given subinterval: for example, using the velocity of an object to infer its position in between
-	two logical frames.
-
-	To encapsulate this, we have Core::Frame. This object contains the game state at a given point in time
+	two logical frames. To encapsulate this, we have Core::Frame. This object contains the game state at a given point in time
 	as it is processed. If objects exist outside of the simulation range, they do not need to be referenced
 	in the frame. The rendering system can take a frame when it is ready and work on executing render
 	commands as necessary.


Clarify destruction semantics.

Clarify destruction semantics.

--- inc/ogvr/PluginKit/PluginRegistrationC.h
+++ inc/ogvr/PluginKit/PluginRegistrationC.h
@@ -146,7 +146,8 @@
    data associated with that pointer.

     This function may be called more than once, to register multiple plugin data
-   objects. Callbacks will be called in reverse order of registration.
+   objects. Callbacks will be called, sorted first by plugin, in reverse order
+   of registration.

     @param ctx The registration context passed to your entry point.
     @param deleteCallback The address of your deleter callback function


Convert certproc to ignore reader failure.

--- certproc.c
+++ certproc.c
@@ -87,7 +87,7 @@
 	char		*csr, *chain, *url;
 	unsigned char	*csrcp, *chaincp;
 	size_t		 csrsz, chainsz;
-	int		 i, rc, idx;
+	int		 i, rc, idx, cc;
 	enum certop	 op;
 	long		 lval;
 	X509		*x, *chainx;
@@ -140,10 +140,13 @@
 		goto out;
 	}

-	/* Pass revocation right through to fileproc. */
+	/*
+	 * Pass revocation right through to fileproc.
+	 * If the reader is terminated, ignore it.
+	 */

 	if (CERT_REVOKE == op) {
-		if (writeop(filesock, COMM_CHAIN_OP, FILE_REMOVE) > 0)
+		if (writeop(filesock, COMM_CHAIN_OP, FILE_REMOVE) >= 0)
 			rc = 1;
 		goto out;
 	}
@@ -226,17 +229,26 @@
 			goto out;
 	}

-	if (writeop(filesock, COMM_CHAIN_OP, FILE_CREATE) <= 0)
-		goto out;
-	else if (writebuf(filesock, COMM_CHAIN, chain, chainsz) <= 0)
-		goto out;
-
-	/* Next, convert the X509 to a buffer and send that. */
+	/* Allow reader termination to just push us out. */
+
+	if (0 == (cc = writeop(filesock, COMM_CHAIN_OP, FILE_CREATE)))
+		rc = 1;
+	if (cc <= 0)
+		goto out;
+	if (0 == (cc = writebuf(filesock, COMM_CHAIN, chain, chainsz)))
+		rc = 1;
+	if (cc <= 0)
+		goto out;
+
+	/*
+	 * Next, convert the X509 to a buffer and send that.
+	 * Reader failure doesn't change anything.
+	 */

 	free(chain);
 	if (NULL == (chain = x509buf(x, &chainsz)))
 		goto out;
-	if (writebuf(filesock, COMM_CSR, chain, chainsz) <= 0)
+	if (writebuf(filesock, COMM_CSR, chain, chainsz) < 0)
 		goto out;

 	rc = 1;


Zero core postbox data on start

Zero core postbox data on start

--- host/device-support.c
+++ host/device-support.c
@@ -189,9 +189,10 @@
  * Initialises the cores by setting up their data structures and loading the interpreter onto the cores
  */
 static void initialiseCores(struct shared_basic * basicState, int codeOnCore, struct ebasicconfiguration* configuration) {
-	unsigned int i;
+	unsigned int i, j;
 	char allActive=1;
 	for (i=0;i<TOTAL_CORES;i++) {
+		for (j=0;j<15;j++) basicState->core_ctrl[i].data[j]=0;
 		basicState->core_ctrl[i].core_run=0;
 		basicState->core_ctrl[i].core_busy=0;
 		basicState->core_ctrl[i].core_command=0;


pledge support

pledge support

--- sitelen-sin.c
+++ sitelen-sin.c
@@ -1,7 +1,8 @@
-/* constructs a random word following the sound rules for the
- * importation of foreign words; see the Official Toki Pona Book (pu)
- * for details */
+/* sitelen-sin - constructs a random word following the sound rules for
+ * the importation of foreign words; see the Official Toki Pona Book
+ * (pu) for details */

+#include <err.h>
 #include <stdlib.h>
 #include <unistd.h>

@@ -22,6 +23,11 @@
     char consonant, vowel;
     int syllable_count = 2 + arc4random_uniform(3);
     int s, wordidx = 0;
+
+#ifdef __OpenBSD__
+    if (pledge("stdio", NULL) == -1)
+        err(1, "pledge failed");
+#endif

     for (s = 0; s < syllable_count; s++) {
         vowel = vowels[arc4random_uniform(vowel_count)];


add NFNL_MSG_ACCT_GET_CTRZERO

add NFNL_MSG_ACCT_GET_CTRZERO

--- include/linux/netfilter/nfnetlink_acct.h
+++ include/linux/netfilter/nfnetlink_acct.h
@@ -7,6 +7,7 @@
 enum nfnl_acct_msg_types {
 	NFNL_MSG_ACCT_NEW,
 	NFNL_MSG_ACCT_GET,
+	NFNL_MSG_ACCT_GET_CTRZERO,
 	NFNL_MSG_ACCT_DEL,
 	NFNL_MSG_ACCT_MAX
 };


Fixed the file header to match the filename.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@160524 91177308-0d34-0410-b5e6-96231b3b80d8


Indentation.

Indentation.

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

--- include/llvm/CodeGen/MachineRelocation.h
+++ include/llvm/CodeGen/MachineRelocation.h
@@ -99,10 +99,10 @@
   /// MachineRelocation::getGVNonLazyPtr - Return a relocation entry for a
   /// Mac OS X non-lazy GlobalValue indirect reference.
   static MachineRelocation getGVNonLazyPtr(intptr_t offset,
-                                 unsigned RelocationType,
-                                 GlobalValue *GV, intptr_t cst = 0,
-                                 bool NeedStub = 0,
-                                 bool GOTrelative = 0) {
+                                           unsigned RelocationType,
+                                           GlobalValue *GV, intptr_t cst = 0,
+                                           bool NeedStub = 0,
+                                           bool GOTrelative = 0) {
     assert((RelocationType & ~63) == 0 && "Relocation type too large!");
     MachineRelocation Result;
     Result.Offset = offset;


Add a SubclassData field to SDNode, similar to what's done
in Value, to make use of some otherwise unused space. Use this
field to shrink LoadSDNode and StoreSDNode by moving the
addressing mode and ext/trunc fields there.

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

--- include/llvm/CodeGen/SelectionDAGNodes.h
+++ include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1032,8 +1032,15 @@

   /// OperandsNeedDelete - This is true if OperandList was new[]'d.  If true,
   /// then they will be delete[]'d when the node is destroyed.
-  bool OperandsNeedDelete : 1;
-
+  unsigned short OperandsNeedDelete : 1;
+
+protected:
+  /// SubclassData - This member is defined by this class, but is not used for
+  /// anything.  Subclasses can use it to hold whatever state they find useful.
+  /// This field is initialized to zero by the ctor.
+  unsigned short SubclassData : 15;
+
+private:
   /// NodeId - Unique id per SDNode in the DAG.
   int NodeId;

@@ -1248,8 +1255,8 @@
   }

   SDNode(unsigned Opc, SDVTList VTs, const SDOperand *Ops, unsigned NumOps)
-    : NodeType(Opc), NodeId(-1), Uses(NULL) {
-    OperandsNeedDelete = true;
+    : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
+      NodeId(-1), Uses(NULL) {
     NumOperands = NumOps;
     OperandList = NumOps ? new SDUse[NumOperands] : 0;

@@ -1264,7 +1271,8 @@
   }

   SDNode(unsigned Opc, SDVTList VTs, const SDUse *Ops, unsigned NumOps)
-    : NodeType(Opc), NodeId(-1), Uses(NULL) {
+    : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
+      NodeId(-1), Uses(NULL) {
     OperandsNeedDelete = true;
     NumOperands = NumOps;
     OperandList = NumOps ? new SDUse[NumOperands] : 0;
@@ -1279,9 +1287,11 @@
     NumValues = VTs.NumVTs;
   }

+  /// This constructor adds no operands itself; operands can be
+  /// set later with InitOperands.
   SDNode(unsigned Opc, SDVTList VTs)
-    : NodeType(Opc), NodeId(-1), Uses(NULL) {
-    OperandsNeedDelete = false;  // Operands set with InitOperands.
+    : NodeType(Opc), OperandsNeedDelete(false), SubclassData(0),
+      NodeId(-1), Uses(NULL) {
     NumOperands = 0;
     OperandList = 0;
     ValueList = VTs.VTs;
@@ -2047,10 +2057,6 @@
 /// LSBaseSDNode - Base class for LoadSDNode and StoreSDNode
 ///
 class LSBaseSDNode : public MemSDNode {
-private:
-  // AddrMode - unindexed, pre-indexed, post-indexed.
-  ISD::MemIndexedMode AddrMode;
-
 protected:
   //! Operand array for load and store
   /*!
@@ -2063,7 +2069,8 @@
   LSBaseSDNode(ISD::NodeType NodeTy, SDOperand *Operands, unsigned numOperands,
                SDVTList VTs, ISD::MemIndexedMode AM, MVT VT,
                const Value *SV, int SVO, unsigned Align, bool Vol)
-    : MemSDNode(NodeTy, VTs, VT, SV, SVO, Align, Vol), AddrMode(AM) {
+    : MemSDNode(NodeTy, VTs, VT, SV, SVO, Align, Vol) {
+    SubclassData = AM;
     for (unsigned i = 0; i != numOperands; ++i)
       Ops[i] = Operands[i];
     InitOperands(Ops, numOperands);
@@ -2076,13 +2083,17 @@
     return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
   }

-  ISD::MemIndexedMode getAddressingMode() const { return AddrMode; }
+  /// getAddressingMode - Return the addressing mode for this load or store:
+  /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
+  ISD::MemIndexedMode getAddressingMode() const {
+    return ISD::MemIndexedMode(SubclassData & 7);
+  }

   /// isIndexed - Return true if this is a pre/post inc/dec load/store.
-  bool isIndexed() const { return AddrMode != ISD::UNINDEXED; }
+  bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }

   /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store.
-  bool isUnindexed() const { return AddrMode == ISD::UNINDEXED; }
+  bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }

   static bool classof(const LSBaseSDNode *) { return true; }
   static bool classof(const SDNode *N) {
@@ -2095,21 +2106,23 @@
 ///
 class LoadSDNode : public LSBaseSDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
-
-  // ExtType - non-ext, anyext, sext, zext.
-  ISD::LoadExtType ExtType;
-
 protected:
   friend class SelectionDAG;
   LoadSDNode(SDOperand *ChainPtrOff, SDVTList VTs,
              ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT LVT,
              const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
     : LSBaseSDNode(ISD::LOAD, ChainPtrOff, 3,
-                   VTs, AM, LVT, SV, O, Align, Vol),
-      ExtType(ETy) {}
-public:
-
-  ISD::LoadExtType getExtensionType() const { return ExtType; }
+                   VTs, AM, LVT, SV, O, Align, Vol) {
+    SubclassData |= (unsigned short)ETy << 3;
+  }
+public:
+
+  /// getExtensionType - Return whether this is a plain node,
+  /// or one of the varieties of value-extending loads.
+  ISD::LoadExtType getExtensionType() const {
+    return ISD::LoadExtType((SubclassData >> 3) & 3);
+  }
+
   const SDOperand &getBasePtr() const { return getOperand(1); }
   const SDOperand &getOffset() const { return getOperand(2); }

@@ -2123,22 +2136,22 @@
 ///
 class StoreSDNode : public LSBaseSDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
-
-  // IsTruncStore - True if the op does a truncation before store.  For
-  // integers this is the same as doing a TRUNCATE and storing the result.
-  // For floats, it is the same as doing an FP_ROUND and storing the result.
-  bool IsTruncStore;
 protected:
   friend class SelectionDAG;
   StoreSDNode(SDOperand *ChainValuePtrOff, SDVTList VTs,
               ISD::MemIndexedMode AM, bool isTrunc, MVT SVT,
               const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
     : LSBaseSDNode(ISD::STORE, ChainValuePtrOff, 4,
-                   VTs, AM, SVT, SV, O, Align, Vol),
-      IsTruncStore(isTrunc) {}
-public:
-
-  bool isTruncatingStore() const { return IsTruncStore; }
+                   VTs, AM, SVT, SV, O, Align, Vol) {
+    SubclassData |= (unsigned short)isTrunc << 3;
+  }
+public:
+
+  /// isTruncatingStore - Return true if the op does a truncation before store.
+  /// For integers this is the same as doing a TRUNCATE and storing the result.
+  /// For floats, it is the same as doing an FP_ROUND and storing the result.
+  bool isTruncatingStore() const { return (SubclassData >> 3) & 1; }
+
   const SDOperand &getValue() const { return getOperand(1); }
   const SDOperand &getBasePtr() const { return getOperand(2); }
   const SDOperand &getOffset() const { return getOperand(3); }


spc: Fix hang in revised STOP opcode handler.

Otherwise the now-redundant wraparound check will cause an infinite loop
if execution reaches the STOP opcode at the end of RAM.

Caught by afl

--- gme/Spc_Cpu.h
+++ gme/Spc_Cpu.h
@@ -1146,11 +1146,8 @@

 	case 0xFF:{// STOP
 		// handle PC wrap-around
-		unsigned addr = GET_PC() - 1;
-		if ( addr >= 0x10000 )
-		{
-			addr &= 0xFFFF;
-			SET_PC( addr );
+		if ( pc == 0x0000 )
+		{
 			debug_printf( "SPC: PC wrapped around\n" );
 			goto loop;
 		}


Attempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.

These were added in r281051, which, I am embarrassed to admit, has an
incomplete commit message that I forgot to update before pushing.  You
can ignore element (2) in that list.

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

--- include/llvm/CodeGen/SelectionDAGNodes.h
+++ include/llvm/CodeGen/SelectionDAGNodes.h
@@ -472,20 +472,15 @@
     StoreSDNodeBitfields StoreSDNodeBits;
   };

-  // RawSDNodeBits must cover the entirety of the union.  This means that all
-  // of the union's members must have size <= RawSDNodeBits.
-  static_assert(sizeof(SDNodeBits) <= sizeof(RawSDNodeBits),
-                "SDNodeBits too wide");
-  static_assert(sizeof(ConstantSDNodeBits) <= sizeof(RawSDNodeBits),
-                "ConstantSDNodeBits too wide");
-  static_assert(sizeof(MemSDNodeBits) <= sizeof(RawSDNodeBits),
-                "MemSDNodeBits too wide");
-  static_assert(sizeof(LSBaseSDNodeBits) <= sizeof(RawSDNodeBits),
-                "LSBaseSDNodeBits too wide");
-  static_assert(sizeof(LoadSDNodeBits) <= sizeof(RawSDNodeBits),
-                "LoadSDNodeBits too wide");
-  static_assert(sizeof(StoreSDNodeBits) <= sizeof(RawSDNodeBits),
-                "StoreSDNodeBits too wide");
+  // RawSDNodeBits must cover the entirety of the union.  This means that all of
+  // the union's members must have size <= RawSDNodeBits.  We write the RHS as
+  // "2" instead of sizeof(RawSDNodeBits) because MSVC can't handle the latter.
+  static_assert(sizeof(SDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(ConstantSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(MemSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(LSBaseSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(LoadSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(StoreSDNodeBitfields) <= 2, "field too wide");

 private:
   /// Unique id per SDNode in the DAG.


__GNUC_PREREQ macro to fight against frama-c pthread.h parsing problems

error: pathspec 'gnuc_prereq.h' did not match any file(s) known to git

--- gnuc_prereq.h
+++ gnuc_prereq.h
@@ -0,0 +1,8 @@
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) \
+         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif


how to set optimal number of kernels?

how to set optimal number of kernels?

--- include/matrix/blockdiaglaplace_vector.h
+++ include/matrix/blockdiaglaplace_vector.h
@@ -185,7 +185,7 @@
 	TRY( VecCUDAGetArrayReadWrite(y.get_vector(),&y_arr) );
 	TRY( VecCUDAGetArrayReadWrite(x.get_vector(),&x_arr) );

-	kernel_mult<<<T*K, 1>>>(y_arr,x_arr,T,K,alpha);
+	kernel_mult<<<T/(double)5.0+5, K*5>>>(y_arr,x_arr,T,K,alpha);
 //	kernel_mult<<<T, K>>>(y_arr,x_arr,T,K,alpha);
 	gpuErrchk( cudaDeviceSynchronize() );