SpatialData: Re added the index matrix shift, Closes inviwo/inviwo-dev#728

--- include/inviwo/core/datastructures/spatialdata.h
+++ include/inviwo/core/datastructures/spatialdata.h
@@ -149,6 +149,15 @@
     Vector<N, unsigned int> getDimensions() const;
     void setDimensions(const Vector<N, unsigned int>& dimensions);

+
+    /**
+     * Returns the matrix transformation mapping from texture coordinates
+     * to voxel index coordinates, i.e. from [0,1] to [-0.5, number of voxels-0.5]
+     * @note Data is centered on the voxel, see OpenGL specifications, figure 8.3
+     * http://www.opengl.org/registry/doc/glspec43.core.20120806.pdf
+     * or for instance http://bpeers.com/articles/glpixel/
+     * @see CoordinateTransformer::getTextureToIndexMatrix
+     */
     Matrix<N + 1, float> getIndexMatrix() const;

     virtual const StructuredCoordinateTransformer<N>& getCoordinateTransformer() const;
@@ -351,6 +360,11 @@
     for (int i = 0; i < N; ++i) {
         indexMatrix[i][i] = dimensions_[i];
     }
+
+    // Offset to coordinates to center them in the middle of the texel/voxel.
+    for (int i = 0; i < N; i++) {
+        indexMatrix[N][i] = -0.5f;
+    }
     return indexMatrix;
 }


Working scrollbars

Working scrollbars

--- src/champlain_widget.c
+++ src/champlain_widget.c
@@ -50,6 +50,7 @@
     GtkAdjustment* horizontalAdjustment;
     GtkAdjustment* verticalAdjustment;
     GdkPoint scrollOffset;
+    ClutterActor* bg;
 };

 G_DEFINE_TYPE(ChamplainWidget, champlain_widget, GTK_TYPE_ALIGNMENT)
@@ -65,9 +66,10 @@
     else if (adjustment == priv->verticalAdjustment)
         priv->scrollOffset.y = (int)gtk_adjustment_get_value(adjustment);

+	g_print("value: (%d,%d) \n", priv->scrollOffset.x, priv->scrollOffset.y);
 	// Check if the offset is empty

-
+	clutter_actor_set_position(priv->bg, -priv->scrollOffset.x, -priv->scrollOffset.y);
 }

 static void
@@ -93,9 +95,7 @@
 		g_object_ref_sink(priv->verticalAdjustment);

 		gdouble val = gtk_adjustment_get_value(hadjustment);
-		g_print("value: %f \n", val);
 		val = gtk_adjustment_get_value(vadjustment);
-		g_print("value: %f \n", val);
     	// Connect the signals

 		g_object_set(G_OBJECT(priv->horizontalAdjustment), "lower", 0.0, NULL);
@@ -103,6 +103,16 @@
 		g_object_set(G_OBJECT(priv->horizontalAdjustment), "page-size", 20.0, NULL);
 		g_object_set(G_OBJECT(priv->horizontalAdjustment), "step-increment", 5.0, NULL);
 		g_object_set(G_OBJECT(priv->horizontalAdjustment), "page-increment", 15.0, NULL);
+
+		g_object_set(G_OBJECT(priv->verticalAdjustment), "lower", 0.0, NULL);
+		g_object_set(G_OBJECT(priv->verticalAdjustment), "upper", 100.0, NULL);
+		g_object_set(G_OBJECT(priv->verticalAdjustment), "page-size", 20.0, NULL);
+		g_object_set(G_OBJECT(priv->verticalAdjustment), "step-increment", 5.0, NULL);
+		g_object_set(G_OBJECT(priv->verticalAdjustment), "page-increment", 15.0, NULL);
+
+
+		g_signal_connect(G_OBJECT(priv->horizontalAdjustment), "value-changed", (gpointer)champlain_widget_adjustement_changed, champlainWidget);
+		g_signal_connect(G_OBJECT(priv->verticalAdjustment), "value-changed", (gpointer)champlain_widget_adjustement_changed, champlainWidget);
 	}

@@ -152,8 +162,8 @@
 {
 	ChamplainWidgetPrivate* priv = CHAMPLAIN_WIDGET_GET_PRIVATE(champlainWidget);

-    priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 100.0, 10.0, 50.0, 20.0));
-    priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 100.0, 10.0, 50.0, 20.0));
+    priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
+    priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));

     g_object_ref_sink(priv->horizontalAdjustment);
     g_object_ref_sink(priv->verticalAdjustment);
@@ -169,30 +179,34 @@
 	clutter_color_parse("white", &white);
 	ClutterColor blue;
 	clutter_color_parse("blue", &blue);
-
-	ClutterActor * rect = clutter_rectangle_new_with_color(&blue);
-	clutter_container_add(CLUTTER_CONTAINER(stage), rect, NULL);
+	ClutterActor* group = clutter_group_new();
+
+	ClutterActor* rect = clutter_rectangle_new_with_color(&blue);
   	clutter_actor_set_position (rect, 100, 100);
   	clutter_actor_set_size (rect, 100, 100);
 	clutter_actor_show(rect);
+	clutter_container_add(CLUTTER_CONTAINER(group), rect, NULL);

 	rect = clutter_rectangle_new_with_color(&white);
-	clutter_container_add(CLUTTER_CONTAINER(stage), rect, NULL);
   	clutter_actor_set_position (rect, 100, 200);
   	clutter_actor_set_size (rect, 100, 100);
 	clutter_actor_show(rect);
+	clutter_container_add(CLUTTER_CONTAINER(group), rect, NULL);

 	rect = clutter_rectangle_new_with_color(&blue);
-	clutter_container_add(CLUTTER_CONTAINER(stage), rect, NULL);
   	clutter_actor_set_position (rect, 200, 200);
   	clutter_actor_set_size (rect, 100, 100);
 	clutter_actor_show(rect);
+	clutter_container_add(CLUTTER_CONTAINER(group), rect, NULL);

 	rect = clutter_rectangle_new_with_color(&white);
-	clutter_container_add(CLUTTER_CONTAINER(stage), rect, NULL);
   	clutter_actor_set_position (rect, 200, 100);
   	clutter_actor_set_size (rect, 100, 100);
 	clutter_actor_show(rect);
+	clutter_container_add(CLUTTER_CONTAINER(group), rect, NULL);
+
+	priv->bg = group;
+	clutter_container_add(CLUTTER_CONTAINER(stage), group, NULL);

 }


Put QUICHE_EXPORT_PRIVATE before strut in quiche_text_utils.h to fix merge.

PiperOrigin-RevId: 405363763

--- common/quiche_text_utils.h
+++ common/quiche_text_utils.h
@@ -17,7 +17,7 @@

 namespace quiche {

-QUICHE_EXPORT_PRIVATE struct StringPieceCaseHash {
+struct QUICHE_EXPORT_PRIVATE StringPieceCaseHash {
   size_t operator()(absl::string_view data) const {
     std::string lower = absl::AsciiStrToLower(data);
     absl::Hash<absl::string_view> hasher;
@@ -25,7 +25,7 @@
   }
 };

-QUICHE_EXPORT_PRIVATE struct StringPieceCaseEqual {
+struct QUICHE_EXPORT_PRIVATE StringPieceCaseEqual {
   bool operator()(absl::string_view piece1, absl::string_view piece2) const {
     return absl::EqualsIgnoreCase(piece1, piece2);
   }


compile fix

compile fix

--- common/simd/vboolf4_sse2.h
+++ common/simd/vboolf4_sse2.h
@@ -38,7 +38,7 @@
     __forceinline vboolf4& operator =(const vboolf4& other) { v = other.v; return *this; }

     __forceinline vboolf(__m128 input) : v(input) {}
-    __forceinline vboolf(__m128i input) : v(_mm_castps_si128(input)) {}
+    __forceinline vboolf(__m128i input) : v(_mm_castsi128_ps(input)) {}
     __forceinline operator const __m128&() const { return v; }
     __forceinline operator const __m128i() const { return _mm_castps_si128(v); }
     __forceinline operator const __m128d() const { return _mm_castps_pd(v); }


use nested structs instead of typedefs

use nested structs instead of typedefs

--- src/ccc/dllst.h
+++ src/ccc/dllst.h
@@ -7,143 +7,104 @@

-/* dllst container node */
-
-
-#define _cc_dllst_node(_cc_dllst)                                              \
+/* dllst container create */
+
+
+typedef void* _link_t;
+
+#define cc_dllst(_elem_t)                                                      \
                                                                                \
     struct                                                                     \
     {                                                                          \
-        _cc_dllst##_element_t val;                                             \
-        void *link;                                                            \
+        _elem_t *head;                                                         \
+        _elem_t *tail;                                                         \
+        _elem_t *avsp;                                                         \
+                                                                               \
+        struct                                                                 \
+        {                                                                      \
+            _link_t next;                                                      \
+                                                                               \
+            struct                                                             \
+            {                                                                  \
+                _elem_t val;                                                   \
+                _link_t xorl;                                                  \
+            }   nodes[CCC_DLLST_BLOCK_SIZE], *pnode;                           \
+                                                                               \
+        }   block, *pool;                                                      \
+                                                                               \
+        size_t    size, vcnt;                                                  \
+        ptrdiff_t val_offset, link_offset;                                     \
     }

-
-/* dllst container block */
-
-
-#if (CCC_DLLST_BLOCK_SIZE - 0 <= 0)
-    #undef  CCC_DLLST_BLOCK_SIZE
-    #define CCC_DLLST_BLOCK_SIZE 16
-#endif
-
-
-#define _cc_dllst_block(_cc_dllst)                                             \
+#define cc_dllst_init(_cc_dllst)                                               \
+                                                                               \
+CCC_VOID_EXPR_                                                                 \
+((                                                                             \
+    (_cc_dllst).head = (_link_t)&((_cc_dllst).tail),                           \
+    (_cc_dllst).tail = (_link_t)&((_cc_dllst).head),                           \
+    (_cc_dllst).avsp = NULL,                                                   \
+    (_cc_dllst).pool = &((_cc_dllst).block),                                   \
+                                                                               \
+    (_cc_dllst).size = 0,                                                      \
+    (_cc_dllst).vcnt = CCC_DLLST_BLOCK_SIZE,                                   \
+    (_cc_dllst).link_offset = (char*)&((_cc_dllst).block.pnode->xorl) -        \
+                              (char*)&((_cc_dllst).block.pnode->val),          \
+    (_cc_dllst).val_offset  = (_cc_dllst).link_offset * (-1) /                 \
+                              sizeof((_cc_dllst).block.pnode->val)             \
+))
+
+
+
+/* bitwise operations */
+
+
+#define _cc_xor_2(_cc_addr_a, _cc_addr_b)                                      \
+(                                                                              \
+    (_link_t)((uintptr_t)(_link_t)(_cc_addr_a) ^                               \
+              (uintptr_t)(_link_t)(_cc_addr_b))                                \
+)
+
+
+#define _cc_xor_3(_cc_addr_a, _cc_addr_b, _cc_addr_c)                          \
+(                                                                              \
+    (_link_t)((uintptr_t)(_link_t)(_cc_addr_a) ^                               \
+              (uintptr_t)(_link_t)(_cc_addr_b) ^                               \
+              (uintptr_t)(_link_t)(_cc_addr_c))                                \
+)
+
+
+
+/* dllst container iterators */
+
+
+#define cc_dllst_iter(_elem_t)                                                 \
                                                                                \
     struct                                                                     \
     {                                                                          \
-        void *next;                                                            \
-        _cc_dllst##_node_t arr[CCC_DLLST_BLOCK_SIZE];                          \
+        _elem_t *prev;                                                         \
+        _elem_t *curr;                                                         \
+        _elem_t *next;                                                         \
+                                                                               \
+        cc_dllst(_elem_t) *pobj;                                               \
     }

-
-/* dllst container constructor */
-
-
-#define _cc_dllst_struct(_cc_dllst)                                            \
-                                                                               \
-    struct                                                                     \
-    {                                                                          \
-        void *pool;                                                            \
-        _cc_dllst##_element_t *avsp, *head, *tail;                             \
-                                                                               \
-        int size, vcnt;                                                        \
-        size_t node_size, block_size;                                          \
-        ptrdiff_t val_offset, link_offset, arr_offset;                         \
-                                                                               \
-        _cc_dllst##_node_t *pnode;                                             \
-    }
-
-
-#define _cc_dllst_struct_init {NULL, NULL, NULL, NULL,                         \
-                               0, 0, 0, 0, 0, 0, 0, NULL}
-
-
-#define cc_dllst(_cc_dllst, _cc_dllst_element_t)                               \
-                                                                               \
-    typedef _cc_dllst_element_t         _cc_dllst##_element_t;                 \
-    typedef _cc_dllst_node  (_cc_dllst) _cc_dllst##_node_t;                    \
-    typedef _cc_dllst_block (_cc_dllst) _cc_dllst##_block_t;                   \
-    typedef _cc_dllst_struct(_cc_dllst) _cc_dllst##_t;                         \
-                                                                               \
-    _cc_dllst##_t       _cc_dllst = _cc_dllst_struct_init;                     \
-    _cc_dllst##_node_t  _cc_dllst##_node;                                      \
-    _cc_dllst##_block_t _cc_dllst##_block;                                     \
-                                                                               \
-    _cc_dllst.head = (void*)&(_cc_dllst.tail);                                 \
-    _cc_dllst.tail = (void*)&(_cc_dllst.head);                                 \
-                                                                               \
-    _cc_dllst.node_size  = sizeof(_cc_dllst##_node);                           \
-    _cc_dllst.block_size = sizeof(_cc_dllst##_block);                          \
-                                                                               \
-    _cc_dllst.val_offset  = &(_cc_dllst##_node.val) -                          \
-                            (_cc_dllst##_element_t*)&(_cc_dllst##_node.link);  \
-    _cc_dllst.link_offset = (char*)&(_cc_dllst##_node.link) -                  \
-                            (char*)&(_cc_dllst##_node.val);                    \
-    _cc_dllst.arr_offset  = (char*)&(_cc_dllst##_block.arr) -                  \
-                            (char*)&(_cc_dllst##_block.next);
-
-
-#define cc_dllst_packed(_cc_dllst, _cc_dllst_element_t)                        \
-                                                                               \
-    _Pragma("pack(push,1)")                                                    \
-                                                                               \
-    cc_dllst(_cc_dllst, _cc_dllst_element_t);                                  \
-                                                                               \
-    _Pragma("pack(pop)")
-
-
-
-/* bitwise operations */
-
-
-#define _cc_xor_2_addrs(_cc_addr_a, _cc_addr_b)                                \
-(                                                                              \
-    (void*)((uintptr_t)(void*)(_cc_addr_a) ^                                   \
-            (uintptr_t)(void*)(_cc_addr_b))                                    \
-)
-
-
-#define _cc_xor_3_addrs(_cc_addr_a, _cc_addr_b, _cc_addr_c)                    \
-(                                                                              \
-    (void*)((uintptr_t)(void*)(_cc_addr_a) ^                                   \
-            (uintptr_t)(void*)(_cc_addr_b) ^                                   \
-            (uintptr_t)(void*)(_cc_addr_c))                                    \
-)
-
-
-
-/* dllst container iterators */
-
-
-#define _cc_dllst_iter_struct(_cc_dllst_iter)                                  \
-                                                                               \
-    struct                                                                     \
-    {                                                                          \
-        _cc_dllst_iter##_object_t  *pobj;                                      \
-        _cc_dllst_iter##_element_t *prev, *curr, *next;                        \
-    }
-
-
-#define _cc_dllst_iter_struct_init {NULL, NULL, NULL, NULL}
-
-
-#define cc_dllst_iter(_cc_dllst_iter, _cc_dllst)                               \
-                                                                               \
-    typedef _cc_dllst##_t                         _cc_dllst_iter##_object_t;   \
-    typedef _cc_dllst##_element_t                 _cc_dllst_iter##_element_t;  \
-    typedef _cc_dllst_iter_struct(_cc_dllst_iter) _cc_dllst_iter##_t;          \
-                                                                               \
-    _cc_dllst_iter##_t _cc_dllst_iter = _cc_dllst_iter_struct_init;            \
-                                                                               \
-    _cc_dllst_iter.pobj = &(_cc_dllst);
+#define cc_dllst_iter_init(_cc_dllst_iter, _cc_dllst)                          \
+                                                                               \
+CCC_VOID_EXPR_                                                                 \
+((                                                                             \
+    (_cc_dllst_iter).prev = NULL,                                              \
+    (_cc_dllst_iter).curr = NULL,                                              \
+    (_cc_dllst_iter).next = NULL,                                              \
+                                                                               \
+    (_cc_dllst_iter).pobj = (void*)&(_cc_dllst)                                \
+))

 #define cc_dllst_iter_dref(_cc_dllst_iter)                                     \
 (                                                                              \
-    *(_cc_dllst_iter.curr + _cc_dllst_iter.pobj->val_offset)                   \
+    *((_cc_dllst_iter).curr + (_cc_dllst_iter).pobj->val_offset)               \
 )

@@ -151,9 +112,9 @@
                                                                                \
 CCC_VOID_EXPR_                                                                 \
 ((                                                                             \
-    _cc_dllst_iter_dst.prev = _cc_dllst_iter_src.prev,                         \
-    _cc_dllst_iter_dst.curr = _cc_dllst_iter_src.curr,                         \
-    _cc_dllst_iter_dst.next = _cc_dllst_iter_src.next                          \
+    (_cc_dllst_iter_dst).prev = (_cc_dllst_iter_src).prev,                     \
+    (_cc_dllst_iter_dst).curr = (_cc_dllst_iter_src).curr,                     \
+    (_cc_dllst_iter_dst).next = (_cc_dllst_iter_src).next                      \
 ))

@@ -161,9 +122,9 @@
                                                                                \
 CCC_VOID_EXPR_                                                                 \
 ((                                                                             \
-    _cc_dllst_iter.prev = NULL,                                                \
-    _cc_dllst_iter.curr = (void*)&(_cc_dllst.head),                            \
-    _cc_dllst_iter.next = _cc_dllst.head                                       \
+    (_cc_dllst_iter).prev = NULL,                                              \
+    (_cc_dllst_iter).curr = (_link_t)&((_cc_dllst).head),                      \
+    (_cc_dllst_iter).next = (_cc_dllst).head                                   \
 ))

@@ -171,9 +132,9 @@
                                                                                \
 CCC_VOID_EXPR_                                                                 \
 ((                                                                             \
-    _cc_dllst_iter.next = NULL,                                                \
-    _cc_dllst_iter.curr = (void*)&(_cc_dllst.tail),                            \
-    _cc_dllst_iter.prev = _cc_dllst.tail                                       \
+    (_cc_dllst_iter).next = NULL,                                              \
+    (_cc_dllst_iter).curr = (_link_t)&((_cc_dllst).tail),                      \
+    (_cc_dllst_iter).prev = (_cc_dllst).tail                                   \
 ))

@@ -181,10 +142,10 @@
                                                                                \
 CCC_VOID_EXPR_                                                                 \
 ((                                                                             \
-    _cc_dllst_iter.prev = (void*)&(_cc_dllst.head),                            \
-    _cc_dllst_iter.curr = _cc_dllst.head,                                      \
-    _cc_dllst_iter.next = _cc_xor_2_addrs(&(_cc_dllst.head),                   \
-                                          *(void**)_cc_dllst.head)             \
+    (_cc_dllst_iter).prev = (_link_t)&((_cc_dllst).head),                      \
+    (_cc_dllst_iter).curr = (_cc_dllst).head,                                  \
+    (_cc_dllst_iter).next = _cc_xor_2(&((_cc_dllst).head),                     \
+                                      *(_link_t*)(_cc_dllst).head)             \
 ))

@@ -192,33 +153,33 @@
                                                                                \
 CCC_VOID_EXPR_                                                                 \
 ((                                                                             \
-    _cc_dllst_iter.next = (void*)&(_cc_dllst.tail),                            \
-    _cc_dllst_iter.curr = _cc_dllst.tail,                                      \
-    _cc_dllst_iter.prev = _cc_xor_2_addrs(&(_cc_dllst.tail),                   \
-                                          *(void**)_cc_dllst.tail)             \
+    (_cc_dllst_iter).next = (_link_t)&((_cc_dllst).tail),                      \
+    (_cc_dllst_iter).curr = (_cc_dllst).tail,                                  \
+    (_cc_dllst_iter).prev = _cc_xor_2(&((_cc_dllst).tail),                     \
+                                      *(_link_t*)(_cc_dllst).tail)             \
 ))

 #define cc_dllst_iter_incr(_cc_dllst_iter)                                     \
 (                                                                              \
-    (_cc_dllst_iter.next != NULL) ?                                            \
+    ((_cc_dllst_iter).next != NULL) ?                                          \
     (                                                                          \
-        _cc_dllst_iter.prev = _cc_dllst_iter.curr,                             \
-        _cc_dllst_iter.curr = _cc_dllst_iter.next,                             \
-        _cc_dllst_iter.next = _cc_xor_2_addrs(_cc_dllst_iter.prev,             \
-                                              *(void**)_cc_dllst_iter.curr)    \
+        (_cc_dllst_iter).prev = (_cc_dllst_iter).curr,                         \
+        (_cc_dllst_iter).curr = (_cc_dllst_iter).next,                         \
+        (_cc_dllst_iter).next = _cc_xor_2((_cc_dllst_iter).prev,               \
+                                          *(_link_t*)(_cc_dllst_iter).curr)    \
     ) : (void*)NULL                                                            \
 )

 #define cc_dllst_iter_decr(_cc_dllst_iter)                                     \
 (                                                                              \
-    (_cc_dllst_iter.prev != NULL) ?                                            \
+    ((_cc_dllst_iter).prev != NULL) ?                                          \
     (                                                                          \
-        _cc_dllst_iter.next = _cc_dllst_iter.curr,                             \
-        _cc_dllst_iter.curr = _cc_dllst_iter.prev,                             \
-        _cc_dllst_iter.prev = _cc_xor_2_addrs(_cc_dllst_iter.next,             \
-                                              *(void**)_cc_dllst_iter.curr)    \
+        (_cc_dllst_iter).next = (_cc_dllst_iter).curr,                         \
+        (_cc_dllst_iter).curr = (_cc_dllst_iter).prev,                         \
+        (_cc_dllst_iter).prev = _cc_xor_2((_cc_dllst_iter).next,               \
+                                          *(_link_t*)(_cc_dllst_iter).curr)    \
     ) : (void*)NULL                                                            \
 )

@@ -229,16 +190,16 @@

 #define cc_dllst_trav(_cc_dllst, _cc_dllst_iter)                               \
                                                                                \
-    cc_dllst_iter_head(_cc_dllst_iter, _cc_dllst);                             \
-                                                                               \
-    while (cc_dllst_iter_incr(_cc_dllst_iter))
-
-
-#define cc_dllst_trav_backward(_cc_dllst, _cc_dllst_iter)                      \
-                                                                               \
-    cc_dllst_iter_tail(_cc_dllst_iter, _cc_dllst);                             \
-                                                                               \
-    while (cc_dllst_iter_decr(_cc_dllst_iter))
+    cc_dllst_iter_head((_cc_dllst_iter), (_cc_dllst));                         \
+                                                                               \
+    while (cc_dllst_iter_incr((_cc_dllst_iter)))
+
+
+#define cc_dllst_trav_back(_cc_dllst, _cc_dllst_iter)                          \
+                                                                               \
+    cc_dllst_iter_tail((_cc_dllst_iter), (_cc_dllst));                         \
+                                                                               \
+    while (cc_dllst_iter_decr((_cc_dllst_iter)))

@@ -247,13 +208,13 @@

 #define cc_dllst_front(_cc_dllst)                                              \
 (                                                                              \
-    *(_cc_dllst.head + _cc_dllst.val_offset)                                   \
+    *((_cc_dllst).head + (_cc_dllst).val_offset)                               \
 )

 #define cc_dllst_back(_cc_dllst)                                               \
 (                                                                              \
-    *(_cc_dllst.tail + _cc_dllst.val_offset)                                   \
+    *((_cc_dllst).tail + (_cc_dllst).val_offset)                               \
 )

@@ -263,13 +224,13 @@

 #define cc_dllst_size(_cc_dllst)                                               \
 (                                                                              \
-    _cc_dllst.size                                                             \
+    (_cc_dllst).size                                                           \
 )

 #define cc_dllst_empty(_cc_dllst)                                              \
 (                                                                              \
-    cc_dllst_size(_cc_dllst) == 0                                              \
+    cc_dllst_size((_cc_dllst)) == 0                                            \
 )

@@ -277,51 +238,47 @@
 /* dllst container node operations */

-#define _cc_dllst_node_alloc(_cc_dllst_node_ptr, _cc_dllst)                    \
-                                                                               \
-CCC_STATEMENT_                                                                 \
-({                                                                             \
-    if (_cc_dllst.avsp == NULL)                                                \
-    {                                                                          \
-        if (_cc_dllst.vcnt == 0)                                               \
+#define _cc_dllst_node_alloc(_cc_dllst_pnode, _cc_dllst)                       \
+                                                                               \
+CCC_STATEMENT_                                                                 \
+({                                                                             \
+    if ((_cc_dllst).avsp == NULL)                                              \
+    {                                                                          \
+        if ((_cc_dllst).vcnt == 0)                                             \
         {                                                                      \
-            void *pool_dup = _cc_dllst.pool;                                   \
-            _cc_dllst.pool = malloc(_cc_dllst.block_size);                     \
-            *(void**)_cc_dllst.pool = pool_dup;                                \
-                                                                               \
-            _cc_dllst.vcnt = CCC_DLLST_BLOCK_SIZE;                             \
+            _link_t pool_dup = (_cc_dllst).pool;                               \
+            (_cc_dllst).pool = malloc(sizeof((_cc_dllst).block));              \
+            *(_link_t*)(_cc_dllst).pool = pool_dup;                            \
+            (_cc_dllst).vcnt = CCC_DLLST_BLOCK_SIZE;                           \
         }                                                                      \
                                                                                \
-        _cc_dllst_node_ptr = (void*)((char*)_cc_dllst.pool +                   \
-                                     _cc_dllst.arr_offset  +                   \
-                                     _cc_dllst.node_size   * --_cc_dllst.vcnt);\
+        (_cc_dllst_pnode) = &((_cc_dllst).pool->nodes[--(_cc_dllst).vcnt]);    \
     }                                                                          \
     else                                                                       \
     {                                                                          \
-        _cc_dllst_node_ptr = (void*)(_cc_dllst.avsp + _cc_dllst.val_offset);   \
-                                                                               \
-        _cc_dllst.avsp = *(void**)_cc_dllst.avsp;                              \
+        (_cc_dllst_pnode) = (void*)((_cc_dllst).avsp + (_cc_dllst).val_offset);\
+        (_cc_dllst).avsp = *(_link_t*)(_cc_dllst).avsp;                        \
     }                                                                          \
 })

-#define _cc_dllst_node_clear(_cc_dllst_node_link_ptr, _cc_dllst)               \
-                                                                               \
-CCC_STATEMENT_                                                                 \
-({                                                                             \
-    *(void**)_cc_dllst_node_link_ptr = _cc_dllst.avsp;                         \
-    _cc_dllst.avsp = _cc_dllst_node_link_ptr;                                  \
-})
-
-
-#define _cc_dllst_all_nodes_free(_cc_dllst)                                    \
-                                                                               \
-CCC_STATEMENT_                                                                 \
-({                                                                             \
-    while (_cc_dllst.pool != NULL)                                             \
-    {                                                                          \
-        void *pool_dup = _cc_dllst.pool;                                       \
-        _cc_dllst.pool = *(void**)_cc_dllst.pool;                              \
+#define _cc_dllst_node_clear(_cc_dllst_node_pxorl, _cc_dllst)                  \
+                                                                               \
+CCC_STATEMENT_                                                                 \
+({                                                                             \
+    *(_link_t*)(_cc_dllst_node_pxorl) = (_cc_dllst).avsp;                      \
+    (_cc_dllst).avsp = (_cc_dllst_node_pxorl);                                 \
+})
+
+
+#define _cc_dllst_blocks_free(_cc_dllst)                                       \
+                                                                               \
+CCC_STATEMENT_                                                                 \
+({                                                                             \
+    while ((_cc_dllst).pool != &((_cc_dllst).block))                           \
+    {                                                                          \
+        _link_t pool_dup = (_cc_dllst).pool;                                   \
+        (_cc_dllst).pool = *(_link_t*)(_cc_dllst).pool;                        \
         free(pool_dup);                                                        \
     }                                                                          \
 })
@@ -335,17 +292,19 @@
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    _cc_dllst_node_alloc(_cc_dllst.pnode, _cc_dllst);                          \
-                                                                               \
-    _cc_dllst.pnode->val  = _cc_dllst_push_front_value;                        \
-    _cc_dllst.pnode->link = _cc_xor_2_addrs(&(_cc_dllst.head), _cc_dllst.head);\
-                                                                               \
-    *(void**)_cc_dllst.head = _cc_xor_3_addrs(&(_cc_dllst.head),               \
-                                              &(_cc_dllst.pnode->link),        \
-                                              *(void**)_cc_dllst.head);        \
-    _cc_dllst.head = (void*)&(_cc_dllst.pnode->link);                          \
-                                                                               \
-    _cc_dllst.size++;                                                          \
+    _cc_dllst_node_alloc((_cc_dllst).block.pnode, (_cc_dllst));                \
+                                                                               \
+    (_cc_dllst).block.pnode->val  = (_cc_dllst_push_front_value);              \
+    (_cc_dllst).block.pnode->xorl = _cc_xor_2(&((_cc_dllst).head),             \
+                                                (_cc_dllst).head);             \
+                                                                               \
+    *(_link_t*)                                                                \
+    (_cc_dllst).head = _cc_xor_3(&((_cc_dllst).head),                          \
+                                 &((_cc_dllst).block.pnode->xorl),             \
+                                 *(_link_t*)(_cc_dllst).head);                 \
+    (_cc_dllst).head = (_link_t)&((_cc_dllst).block.pnode->xorl);              \
+                                                                               \
+    (_cc_dllst).size++;                                                        \
 })

@@ -353,17 +312,19 @@
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    _cc_dllst_node_alloc(_cc_dllst.pnode, _cc_dllst);                          \
-                                                                               \
-    _cc_dllst.pnode->val  = _cc_dllst_push_back_value;                         \
-    _cc_dllst.pnode->link = _cc_xor_2_addrs(&(_cc_dllst.tail), _cc_dllst.tail);\
-                                                                               \
-    *(void**)_cc_dllst.tail = _cc_xor_3_addrs(&(_cc_dllst.tail),               \
-                                              &(_cc_dllst.pnode->link),        \
-                                              *(void**)_cc_dllst.tail);        \
-    _cc_dllst.tail = (void*)&(_cc_dllst.pnode->link);                          \
-                                                                               \
-    _cc_dllst.size++;                                                          \
+    _cc_dllst_node_alloc((_cc_dllst).block.pnode, (_cc_dllst));                \
+                                                                               \
+    (_cc_dllst).block.pnode->val  = (_cc_dllst_push_back_value);               \
+    (_cc_dllst).block.pnode->xorl = _cc_xor_2(&((_cc_dllst).tail),             \
+                                                (_cc_dllst).tail);             \
+                                                                               \
+    *(_link_t*)                                                                \
+    (_cc_dllst).tail = _cc_xor_3(&((_cc_dllst).tail),                          \
+                                 &((_cc_dllst).block.pnode->xorl),             \
+                                 *(_link_t*)(_cc_dllst).tail);                 \
+    (_cc_dllst).tail = (_link_t)&((_cc_dllst).block.pnode->xorl);              \
+                                                                               \
+    (_cc_dllst).size++;                                                        \
 })

@@ -371,18 +332,19 @@
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    if (!(cc_dllst_empty(_cc_dllst)))                                          \
-    {                                                                          \
-        void *head = _cc_dllst.head;                                           \
-                                                                               \
-        _cc_dllst.head = _cc_xor_2_addrs(&(_cc_dllst.head),                    \
-                                         *(void**)_cc_dllst.head);             \
-        *(void**)_cc_dllst.head = _cc_xor_3_addrs(&(_cc_dllst.head), head,     \
-                                                  *(void**)_cc_dllst.head);    \
-                                                                               \
-        _cc_dllst_node_clear(head, _cc_dllst);                                 \
-                                                                               \
-        _cc_dllst.size--;                                                      \
+    if (!(cc_dllst_empty((_cc_dllst))))                                        \
+    {                                                                          \
+        _link_t head = (_cc_dllst).head;                                       \
+                                                                               \
+        (_cc_dllst).head = _cc_xor_2(&((_cc_dllst).head),                      \
+                                     *(_link_t*)(_cc_dllst).head);             \
+        *(_link_t*)                                                            \
+        (_cc_dllst).head = _cc_xor_3(&((_cc_dllst).head), head,                \
+                                     *(_link_t*)(_cc_dllst).head);             \
+                                                                               \
+        _cc_dllst_node_clear(head, (_cc_dllst));                               \
+                                                                               \
+        (_cc_dllst).size--;                                                    \
     }                                                                          \
 })

@@ -391,18 +353,19 @@
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    if (!(cc_dllst_empty(_cc_dllst)))                                          \
-    {                                                                          \
-        void *tail = _cc_dllst.tail;                                           \
-                                                                               \
-        _cc_dllst.tail = _cc_xor_2_addrs(&(_cc_dllst.tail),                    \
-                                         *(void**)_cc_dllst.tail);             \
-        *(void**)_cc_dllst.tail = _cc_xor_3_addrs(&(_cc_dllst.tail), tail,     \
-                                                  *(void**)_cc_dllst.tail);    \
-                                                                               \
-        _cc_dllst_node_clear(tail, _cc_dllst);                                 \
-                                                                               \
-        _cc_dllst.size--;                                                      \
+    if (!(cc_dllst_empty((_cc_dllst))))                                        \
+    {                                                                          \
+        _link_t tail = (_cc_dllst).tail;                                       \
+                                                                               \
+        (_cc_dllst).tail = _cc_xor_2(&((_cc_dllst).tail),                      \
+                                     *(_link_t*)(_cc_dllst).tail);             \
+        *(_link_t*)                                                            \
+        (_cc_dllst).tail = _cc_xor_3(&((_cc_dllst).tail), tail,                \
+                                     *(_link_t*)(_cc_dllst).tail);             \
+                                                                               \
+        _cc_dllst_node_clear(tail, (_cc_dllst));                               \
+                                                                               \
+        (_cc_dllst).size--;                                                    \
     }                                                                          \
 })

@@ -427,8 +390,8 @@
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    do cc_dllst_pop_back(_cc_dllst);                                           \
-    while (!(cc_dllst_empty(_cc_dllst)));                                      \
+    do cc_dllst_pop_back((_cc_dllst));                                         \
+    while (!(cc_dllst_empty((_cc_dllst))));                                    \
 })

@@ -446,19 +409,20 @@

-/* dllst container destructor */
+/* dllst container destroy */

 #define cc_dllst_free(_cc_dllst)                                               \
                                                                                \
 CCC_STATEMENT_                                                                 \
 ({                                                                             \
-    _cc_dllst_all_nodes_free(_cc_dllst);                                       \
-                                                                               \
-    _cc_dllst.size = 0;                                                        \
-    _cc_dllst.vcnt = 0;                                                        \
-    _cc_dllst.head = (void*)&(_cc_dllst.tail);                                 \
-    _cc_dllst.tail = (void*)&(_cc_dllst.head);                                 \
+    _cc_dllst_blocks_free((_cc_dllst));                                        \
+                                                                               \
+    (_cc_dllst).size = 0;                                                      \
+    (_cc_dllst).vcnt = 0;                                                      \
+    (_cc_dllst).avsp = NULL;                                                   \
+    (_cc_dllst).head = (_link_t)&((_cc_dllst).tail);                           \
+    (_cc_dllst).tail = (_link_t)&((_cc_dllst).head);                           \
 })


minor code reordering.

minor code reordering.

--- src/appleseed/renderer/kernel/shading/shadingpoint.h
+++ src/appleseed/renderer/kernel/shading/shadingpoint.h
@@ -698,8 +698,8 @@
     cache_source_geometry();

     const double du0 = static_cast<double>(m_v0_uv[0] - m_v2_uv[0]);
+    const double dv0 = static_cast<double>(m_v0_uv[1] - m_v2_uv[1]);
     const double du1 = static_cast<double>(m_v1_uv[0] - m_v2_uv[0]);
-    const double dv0 = static_cast<double>(m_v0_uv[1] - m_v2_uv[1]);
     const double dv1 = static_cast<double>(m_v1_uv[1] - m_v2_uv[1]);

     const double det = du0 * dv1 - dv0 * du1;
@@ -713,9 +713,10 @@
     }
     else
     {
+        const double rcp_det = 1.0 / det;
+
         const foundation::Vector3d dp0 = get_vertex(0) - get_vertex(2);
         const foundation::Vector3d dp1 = get_vertex(1) - get_vertex(2);
-        const double rcp_det = 1.0 / det;

         m_dpdu = (dv1 * dp0 - dv0 * dp1) * rcp_det;
         m_dpdv = (du0 * dp1 - du1 * dp0) * rcp_det;


add res-i2c-gpio.c

add res-i2c-gpio.c

error: pathspec 'src/arch/arm32/mach-realview/resource/res-i2c-gpio.c' did not match any file(s) known to git

--- src/arch/arm32/mach-realview/resource/res-i2c-gpio.c
+++ src/arch/arm32/mach-realview/resource/res-i2c-gpio.c
@@ -0,0 +1,87 @@
+/*
+ * resource/res-i2c-gpio.c
+ *
+ * Copyright(c) 2007-2013 jianjun jiang <jerryjianjun@gmail.com>
+ * official site: http://xboot.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <xboot.h>
+#include <bus/i2c-gpio.h>
+#include <realview/reg-gpio.h>
+
+static struct i2c_gpio_data_t i2c_gpio_datas[] = {
+	[0] = {
+		.sda_pin			= REALVIEW_GPIO2(0),
+		.scl_pin			= REALVIEW_GPIO2(1),
+		.udelay				= 50,
+		.timeout			= 100,
+		.sda_is_open_drain	= 0,
+		.scl_is_open_drain	= 0,
+		.scl_is_output_only	= 0,
+	},
+	[1] = {
+		.sda_pin			= REALVIEW_GPIO2(2),
+		.scl_pin			= REALVIEW_GPIO2(3),
+		.udelay				= 50,
+		.timeout			= 100,
+		.sda_is_open_drain	= 0,
+		.scl_is_open_drain	= 0,
+		.scl_is_output_only	= 0,
+	},
+};
+
+static struct resource_t res_i2c_gpios[] = {
+	{
+		.name		= "i2c-gpio",
+		.id			= 0,
+		.data		= &i2c_gpio_datas[0],
+	}, {
+		.name		= "i2c-gpio",
+		.id			= 1,
+		.data		= &i2c_gpio_datas[1],
+	},
+};
+
+static __init void resource_i2c_gpio_init(void)
+{
+	u32_t i;
+
+	for(i = 0; i < ARRAY_SIZE(res_i2c_gpios); i++)
+	{
+		if(register_resource(&res_i2c_gpios[i]))
+			LOG("Register resource '%s.%d'", res_i2c_gpios[i].name, res_i2c_gpios[i].id);
+		else
+			LOG("Failed to register resource '%s.%d'", res_i2c_gpios[i].name, res_i2c_gpios[i].id);
+	}
+}
+
+static __exit void resource_i2c_gpio_exit(void)
+{
+	u32_t i;
+
+	for(i = 0; i < ARRAY_SIZE(res_i2c_gpios); i++)
+	{
+		if(unregister_resource(&res_i2c_gpios[i]))
+			LOG("Unregister resource '%s.%d'", res_i2c_gpios[i].name, res_i2c_gpios[i].id);
+		else
+			LOG("Failed to unregister resource '%s.%d'", res_i2c_gpios[i].name, res_i2c_gpios[i].id);
+	}
+}
+
+resource_initcall(resource_i2c_gpio_init);
+resource_exitcall(resource_i2c_gpio_exit);


Fix a use after free in adaptive executor

--- src/backend/distributed/executor/adaptive_executor.c
+++ src/backend/distributed/executor/adaptive_executor.c
@@ -1171,16 +1171,15 @@
 				elog(WARNING, "unexpected transaction state at the end of execution: %d",
 					 transactionState);
 			}
+
+			/* get ready for the next executions if we need use the same connection */
+			connection->waitFlags = WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE;
 		}
 		else
 		{
 			elog(WARNING, "unexpected connection state at the end of execution: %d",
 				 connection->connectionState);
 		}
-
-		/* get ready for the next executions if we need use the same connection */
-		connection->waitFlags = WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE;
-		execution->waitFlagsChanged = true;
 	}
 }


avoid warnings when building the "mirror" invoker

--- tst/usr/local/inv/mirror/src/mirror.c
+++ tst/usr/local/inv/mirror/src/mirror.c
@@ -26,6 +26,8 @@
 #define _POSIX_C_SOURCE 200809L

 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>

 static char *escape(char *s)


Until newlib gets updated

Until newlib gets updated

--- nx/source/system/newlib.c
+++ nx/source/system/newlib.c
@@ -27,9 +27,11 @@
     __syscalls.lock_init              = mutexInit;
     __syscalls.lock_acquire           = mutexLock;
     __syscalls.lock_release           = mutexUnlock;
+/*
     __syscalls.lock_init_recursive    = rmutexInit;
     __syscalls.lock_acquire_recursive = rmutexLock;
     __syscalls.lock_release_recursive = rmutexUnlock;
+*/

     // Initialize thread vars for the main thread
     ThreadVars* tv = getThreadVars();


Clang miscompiles what ICC requires for proper code-gen

Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- common/writemaskedvector.h
+++ common/writemaskedvector.h
@@ -120,7 +120,15 @@
     }

 private:
+#ifdef Vc_ICC
+    // If ICC gets a by-value copy of Mask here, it'll generate a lot of superfluous
+    // stack-register copies.
     const Mask &mask;
+#else
+    // If Clang gets a const-ref Mask here, it'll miscompile some of the masked assignment
+    // statements.
+    const Mask mask;
+#endif
     V &vec;
 };
 }  // namespace Common


back to one cambri -.-

back to one cambri -.-

--- communication/src/cambri.c
+++ communication/src/cambri.c
@@ -11,8 +11,10 @@
 #include "event.h"

+enum { NUM_CAMBRIS = 1 };

-static int cambri_fds[2];
+
+static int cambri_fds[NUM_CAMBRIS];
 static FILE* cambri_log_file;

@@ -33,7 +35,7 @@
 	int ret = 0;

 	int c, i;
-	for (c = 0; c < 2; c++) {
+	for (c = 0; c < NUM_CAMBRIS; c++) {
 		const char* name = get_tty_name(c);
 		int fd = -1;
 		if (name) fd = open(name, O_RDWR | O_NOCTTY);
@@ -71,10 +73,10 @@

 	cambri_log_file = fopen("cambri.log", "w");
 	fprintf(cambri_log_file, " time      ");
-	for (i = 0; i < 16; i++) fprintf(cambri_log_file, " | %4d", (i/8+1) * 1000 + i%8+1);
+	for (i = 0; i < NUM_CAMBRIS * 8; i++) fprintf(cambri_log_file, " | %4d", (i/8+1) * 1000 + i%8+1);
 	fprintf(cambri_log_file, "\n");
 	fprintf(cambri_log_file, "-----------");
-	for (i = 0; i < 16; i++) fprintf(cambri_log_file, "-+-----");
+	for (i = 0; i < NUM_CAMBRIS * 8; i++) fprintf(cambri_log_file, "-+-----");
 	fprintf(cambri_log_file, "\n");
 	fflush(cambri_log_file);

@@ -84,7 +86,7 @@

 void cambri_kill(void) {
 	int c;
-	for (c = 0; c < 2; c++) {
+	for (c = 0; c < NUM_CAMBRIS; c++) {
 		if (cambri_fds[c]) close(cambri_fds[c]);
 	}
 	fclose(cambri_log_file);
@@ -92,7 +94,7 @@

 void cambri_write(int c, const char* fmt, ...) {
-	if (c < 0 || c >= 2 || !cambri_fds[c]) return;
+	if (c < 0 || c >= NUM_CAMBRIS || !cambri_fds[c]) return;

 	char buf[1024];
 	va_list args;
@@ -105,7 +107,7 @@

 int cambri_read(int c, char* buf, int len) {
-	if (c < 0 || c >= 2 || !cambri_fds[c]) return 0;
+	if (c < 0 || c >= NUM_CAMBRIS || !cambri_fds[c]) return 0;

 	int p = 0;
 	int i = 0;
@@ -127,7 +129,7 @@
 void cambri_log_current(double time) {
 	int i;

-	static int current_acc[16] = {};
+	static int current_acc[NUM_CAMBRIS * 8] = {};
 	static int sample_counter = 0;

 	static int next_second = -1;
@@ -138,7 +140,7 @@
 		while (time > next_second) {
 			fprintf(cambri_log_file, "%s", format_timestamp(next_second));
 			next_second++;
-			for (i = 0; i < 16; i++) {
+			for (i = 0; i < NUM_CAMBRIS * 8; i++) {
 				fprintf(cambri_log_file, " | %4d", current_acc[i] / sample_counter);
 			}
 			fprintf(cambri_log_file, "\n");
@@ -148,14 +150,14 @@
 		fflush(cambri_log_file);

-		for (i = 0; i < 16; i++) current_acc[i] = 0;
+		for (i = 0; i < NUM_CAMBRIS * 8; i++) current_acc[i] = 0;
 		sample_counter = 0;
 	}
 	sample_counter++;

 	int c;
-	for (c = 0; c < 2; c++) {
+	for (c = 0; c < NUM_CAMBRIS; c++) {
 		if (!cambri_fds[c]) continue;

 		char buf[1024] = {};
@@ -168,7 +170,7 @@
 			p = strchr(p, '\n');
 			if (!p) error(1, 0, "cambri_log_current2");
 			int current = atoi(p += 5);
-			current_acc[c*8 + i] += current;
+			current_acc[c * 8 + i] += current;
 		}
 	}
 }
@@ -176,7 +178,7 @@

 void cambri_set_mode(int id, int mode) {
 	int c = id / 1000 - 1;
-	if (c < 0 || c >= 2 || !cambri_fds[c]) return;
+	if (c < 0 || c >= NUM_CAMBRIS || !cambri_fds[c]) return;
 	cambri_write(c, "mode %c %d 4", mode, id % 10);
 	char buf[1024] = {};
 	cambri_read(c, buf, sizeof(buf));


remove programming_by_contract_pretty.h

remove programming_by_contract_pretty.h

--- include/hurchalla/programming_by_contract/programming_by_contract_pretty.h
+++ include/hurchalla/programming_by_contract/programming_by_contract_pretty.h
@@ -1,54 +0,0 @@
-/* --- This file is distributed under the MIT Open Source License, as detailed
-   in "LICENSE.TXT" in the root of the programming_by_contract repository --- */
-
-#ifndef HURCHALLA_PROGRAMMING_BY_CONTRACT_PRETTY_H_INCLUDED
-#define HURCHALLA_PROGRAMMING_BY_CONTRACT_PRETTY_H_INCLUDED
-
-
-#include "hurchalla/programming_by_contract/programming_by_contract.h"
-
-/*
-This header file is intended for inclusion ONLY by source files. It is NOT
-  intended to be included by other header files.
-This header file defines "pretty" and non-obtrusive macro names for the contract
-  assertions. Using these names generally looks and feels more natural than
-  using the longer, all-caps, and a bit ugly macro names defined by
-  programming_by_contract.h. However, like all macros, the macros here 'pollute'
-  the global namespace with macro names that could potentially conflict with a
-  variable or function (or possibly another macro) using the same name. These
-  "pretty" macro names are particularly dangerous due to the fact that they are
-  uncapitalized common names- such as 'precondition' (the use of non-caps is in
-  keeping with the standard 'assert' macro, with the intention that these macros
-  not be overly distracting in code). Consequently, you must carefully treat all
-  the assertion macro names from this header as if they were reserved keywords,
-  throughout any source file that includes it.  Note: most macro names limit the
-  chances of name collisions by using all upper case and unusual names, and
-  furthermore most macros are not defined in headers (or they are #undef'ed by
-  the end of the header).
-When you include this header in one of your source files, you can probably
-  manage the danger of name conflicts without too much difficulty. It is quite
-  problematic to include this header in one of your own header files though.
-  Doing so would mean implicitly passing on to the rest of the world (that
-  #includes your header) the requirement to treat these assertion macro names as
-  reserved keywords. And unfortunately, users of your header may be completely
-  unaware of this requirement, and of the name collision danger these macros
-  invisibly introduce. Or users may be aware, but unable or unwilling to manage
-  the danger. It's best to keep any name space issue locally limited to your
-  own source files, where you are the only one responsible for handling it.
-*/
-
-#define precondition(...) HPBC_PRECONDITION(__VA_ARGS__)
-#define precondition2(...) HPBC_PRECONDITION2(__VA_ARGS__)
-#define precondition3(...) HPBC_PRECONDITION3(__VA_ARGS__)
-#define postcondition(...) HPBC_POSTCONDITION(__VA_ARGS__)
-#define postcondition2(...) HPBC_POSTCONDITION2(__VA_ARGS__)
-#define postcondition3(...) HPBC_POSTCONDITION3(__VA_ARGS__)
-#define invariant(...) HPBC_INVARIANT(__VA_ARGS__)
-#define invariant2(...) HPBC_INVARIANT2(__VA_ARGS__)
-#define invariant3(...) HPBC_INVARIANT3(__VA_ARGS__)
-#define assert_logic(...) HPBC_ASSERT(__VA_ARGS__)
-#define assert_logic2(...) HPBC_ASSERT2(__VA_ARGS__)
-#define assert_logic3(...) HPBC_ASSERT3(__VA_ARGS__)
-
-
-#endif


リリース用にバージョン番号を変更

リリース用にバージョン番号を変更

--- src/chess_def.h
+++ src/chess_def.h
@@ -35,7 +35,7 @@
   /******************/
   /* エンジン情報。 */
   /******************/
-  constexpr const char* ID_NAME = "Sayuri 2014.05.20 devel";
+  constexpr const char* ID_NAME = "Sayuri 2014.05.20";
   constexpr const char* ID_AUTHOR = "Hironori Ishibashi";

   /*******************/


開発用にバージョン番号を変更

開発用にバージョン番号を変更

--- src/chess_def.h
+++ src/chess_def.h
@@ -42,7 +42,7 @@
   // エンジン情報 //
   // ============ //
   /** Sayuriのバージョン番号。 */
-  constexpr const char* ID_NAME = "Sayuri 2015.06.22";
+  constexpr const char* ID_NAME = "Sayuri 2015.06.22 devel";
   /** Sayuriの作者名。 */
   constexpr const char* ID_AUTHOR = "Hironori Ishibashi";


ちょっと修正

ちょっと修正

--- src/chess_def.h
+++ src/chess_def.h
@@ -205,8 +205,8 @@
     struct {
       unsigned int from_ : 6;  // 駒の位置。
       unsigned int to_ : 6;  // 移動先の位置。
+      unsigned int promotion_ : 3;  // 昇格する駒の種類。
       unsigned int captured_piece_ : 3;  // 取った駒の種類。
-      unsigned int promotion_ : 3;  // 昇格する駒の種類。
       // 動かす前のキャスリングのフラグ。
       unsigned int last_castling_rights_ : 4;
       // 動かす前のアンパッサンの位置。


mk_server: scheduler: improve drop connection routine with new socket flags

Signed-off-by: Eduardo Silva <81f705dc2ce1a61a2621e0e4b442a9474e1d0c70@monkey.io>

--- mk_server/mk_scheduler.c
+++ mk_server/mk_scheduler.c
@@ -508,7 +508,6 @@
 int mk_sched_drop_connection(struct mk_sched_conn *conn,
                              struct mk_sched_worker *sched)
 {
-
     return mk_sched_remove_client(conn, sched);
 }

@@ -653,8 +652,11 @@
                          int type)
 {
     MK_TRACE("[FD %i] Connection Handler, closed", conn->event.fd);
-    conn->protocol->cb_close(conn, sched, type);
-
+    mk_event_del(sched->loop, &conn->event);
+
+    if (type != MK_EP_SOCKET_DONE) {
+        conn->protocol->cb_close(conn, sched, type);
+    }
     /*
      * Remove the socket from the scheduler and make sure
      * to disable all notifications.


Updated TC_tester and compiler dlls

Updated TC_tester and compiler dlls

--- src/cl_command_queue.c
+++ src/cl_command_queue.c
@@ -109,6 +109,7 @@
 } cl_local_id_t;

 #define SURFACE_SZ 32
+
 static cl_int
 cl_command_queue_bind_surface(cl_command_queue queue,
                               cl_kernel k,


protected items.

protected items.

--- RoleBase.h
+++ RoleBase.h
@@ -39,6 +39,10 @@

 	float	GetRoleRadius();
 	float	GetRoleHeight();
-
+protected:
+	void		UpdateMove(float ifps);
+	vec3		TestRoleZ(vec3& vPosition);
+	CNode*	GetAssemblyNode(const CUtilStr& strAssembly);
+	CNode*	GetAssemblyNode(int nAssembly);
 private:
 }


fix OCD with recurring comments on recurring spec var names

--- Rsp_#1.1.h
+++ Rsp_#1.1.h
@@ -49,8 +49,8 @@

 typedef struct {
     struct_p* hInst;
-    int MemoryBswaped;    /* If this is set to TRUE, then the memory has been
-                              pre-byte-swapped on a DWORD (32 bits) boundary */
+    int MemoryBswaped;
+
     u8* RDRAM;
     u8* DMEM;
     u8* IMEM;


fixed bug with print exec_path the second time through

--- compiled/xalt_initialize.c
+++ compiled/xalt_initialize.c
@@ -158,7 +158,6 @@
           time_t    now    = (time_t) epoch();
           char      dateStr[DATESZ];
           strftime(dateStr, DATESZ, "%c", localtime(&now));
-          abspath(exec_path,sizeof(exec_path));
           errno = 0;
           if (uname(&u) != 0)
             {
@@ -178,6 +177,7 @@
                   dateStr, XALT_GIT_VERSION, u.nodename, u.sysname, u.release,
                   u.version, u.machine, xalt_syshost());
         }
+      abspath(exec_path,sizeof(exec_path));
       fprintf(stderr,"myinit(%s,%s){\n", STR(STATE),exec_path);
     }

@@ -505,16 +505,17 @@
 /* works for Linux and Mac OS X */
 void abspath(char * path, int sz)
 {
+  int iret;
   path[0] = '\0';
   #ifdef __MACH__
-    int iret = proc_pidpath(getpid(), path, sz-1);
+    iret = proc_pidpath(getpid(), path, sz-1);
     if (iret <= 0)
       {
 	fprintf(stderr,"PID %ud: proc_pid();\n",getpid());
 	fprintf(stderr,"    %s:\n", strerror(errno));
       }
   #else
-    readlink("/proc/self/exe",path,sz-1);
+    iret = readlink("/proc/self/exe",path,sz-1);
   #endif
 }


Remove reference to rejected ticket.

Remove reference to rejected ticket.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@42260 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/imcc/optimizer.c
+++ compilers/imcc/optimizer.c
@@ -244,7 +244,6 @@
             return 1;
         if (branch_reorg(interp, unit))
             return 1;
-        /* RT #46283 cfg / loop detection breaks e.g. in t/compiler/5_3 */
         if (unused_label(interp, unit))
             return 1;
         if (dead_code_remove(interp, unit))


[pirc] implement parts of generate_multi_signature().

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@34564 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/pirc/new/bcgen.c
+++ compilers/pirc/new/bcgen.c
@@ -419,6 +419,8 @@
 static PMC *
 generate_multi_signature(bytecode * const bc, multi_type * const types, unsigned type_count) {
     unsigned i;
+    multi_type *iter;
+
     /* create a FixedPMCArray to store all multi types */
     PMC * const multi_signature = pmc_new(bc->interp, enum_class_FixedPMCArray);
     /* set its size as specified in type_count */
@@ -435,12 +437,37 @@
         return multi_signature;
     }

+    iter = types;
     /* add all multi types to the PMC array */
     for (i = 0; i < type_count; ++i) {
-
-
+        PMC *sig_pmc;
+
+        switch (iter->entry_type) {
+            case MULTI_TYPE_IDENT: {
+                /* add the string to the constant table, retrieve a pointer to the STRING */
+                STRING * typestring = add_string_const_from_cstring(bc, iter->u.ident);
+                /* create a new String PMC. */
+                sig_pmc = pmc_new(bc->interp, enum_class_String);
+                /* set the STRING in the String PMC */
+                VTABLE_set_string_native(bc->interp, sig_pmc, typestring);
+                break;
+            }
+            case MULTI_TYPE_KEYED:
+                /* XXX implement this */
+                break;
+            default:
+                fprintf(stderr, "invalid multi entry type");
+                break; /* XXX fatal; throw excpetion? */
+        }
+
+        /* store the signature PMC in the array */
+        VTABLE_set_pmc_keyed_int(bc->interp, multi_signature, i, sig_pmc);
+
+        /* go to next :multi type */
+        iter = iter->next;
     }
     return multi_signature;
+
 }

 /*


wrapper container

wrapper container

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

--- SMMacros.h
+++ SMMacros.h
@@ -0,0 +1,43 @@
+///
+/// SymbolicMath toolkit
+/// (c) 2017-2020 by Daniel Schwen
+///
+
+#pragma once
+
+// declare a C linkage wrpper for an overloaded binary arithmetic operator
+#define SM_BINARY_OP_WRAPPER(type, op, name)                                                       \
+  extern "C" name##_wrapper_##type(type * o, type * l, type * r)                                   \
+  {                                                                                \
+    *o = *l op(*r);                                                                                \
+  }
+
+// declare a C linkage wrpper for an overloaded binary logic operator
+#define SM_BINARY_OP_WRAPPER(type, op, name)                                                       \
+  extern "C" name##_wrapper_##type(type * o, type * l, type * r)                                   \
+  {                                                                                \
+    *o = *l op(*r);                                                                                \
+  }
+
+// generate all wrappers
+#define SM_OP_WRAPPERS(type)                                                                       \
+  SM_BINARY_OP_WRAPPER(type, +, add)                                                               \
+  SM_BINARY_OP_WRAPPER(type, -, sub)                                                               \
+  SM_BINARY_OP_WRAPPER(type, *, mul)                                                               \
+  SM_BINARY_OP_WRAPPER(type, +, div)                                                               \
+  SM_BINARY_OP_WRAPPER(type, %, mod)
+
+template <typename T>
+struct SMWrapperContainer;
+
+// generate a specialization for the container template holding all operator wrapper pointers
+#define SM_WRAPPER_CONTAINER(type)                                                                 \
+  template <>                                                                                \
+  struct SMWrapperContainer<type>                                                                  \
+  {                                                                                \
+    typedef type (*const BinaryWrapperPtr)(type *, type *, type *);                                \
+    BinaryWrapperPtr _add = add_wrapper_##type;                                                    \
+    BinaryWrapperPtr _sub = add_wrapper_##type;                                                    \
+    BinaryWrapperPtr _mul = mul_wrapper_##type;                                                    \
+    BinaryWrapperPtr _div = div_wrapper_##type;                                                    \
+  };


[pirc] add a missing prototype.

[pirc] add a missing prototype.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@35683 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/pirc/src/bcgen.h
+++ compilers/pirc/src/bcgen.h
@@ -79,6 +79,7 @@

 bytecode *new_bytecode(Interp *interp, char const * const filename);

+void destroy_bytecode(bytecode * bc);

 void create_codesegment(bytecode * const bc, int codesize);


add 'extern C' in header files

add 'extern C' in header files

--- components/bt/include/bt.h
+++ components/bt/include/bt.h
@@ -17,6 +17,11 @@

 #include "freertos/FreeRTOS.h"
 #include "esp_err.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+

 typedef void (* bt_app_startup_cb_t)(void *param);

@@ -54,4 +59,8 @@
  */
 void API_vhci_host_register_callback(const vhci_host_callback_t *callback);

+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __BT_H__ */


Refactor DerivativeMaterialInterface (#5264)

--- framework/include/materials/DerivativeMaterialInterface.h
+++ framework/include/materials/DerivativeMaterialInterface.h
@@ -44,7 +44,7 @@

 /**
  * Interface class ("Veneer") to provide generator methods for derivative
- * material property names, and guarded getMaterialPropertyPointer calls
+ * material property names
  */
 template<class T>
 class DerivativeMaterialInterface :
@@ -54,23 +54,16 @@
 public:
   DerivativeMaterialInterface(const std::string & name, InputParameters parameters);

-  // Interface style (1)
-  // return null pointers for non-existing material properties
-
-  /**
-   * Fetch a pointer to a material property if it exists, otherwise return null
-   */
-  template<typename U>
-  MaterialProperty<U> * getMaterialPropertyPointer(const std::string & name);
-
-  // Interface style (2)
-  // return references to a zero material property for non-existing material properties
-
-  /**
-   * Fetch a material property if it exists, otherwise return a constant zero property
+  /**
+   * Fetch a material property if it exists, otherwise return getZeroMaterialProperty.
+   * @param name The input parameter key of type MaterialPropertyName
    */
   template<typename U>
   const MaterialProperty<U> & getDefaultMaterialProperty(const std::string & name);
+
+  /// Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty
+  template<typename U>
+  const MaterialProperty<U> & getDefaultMaterialPropertyByName(const std::string & name);

   ///@{
   /**
@@ -124,6 +117,14 @@
   ///@}

 private:
+  /// Return a constant zero property
+  template<typename U>
+  const MaterialProperty<U> & getZeroMaterialProperty(const std::string & prop_name);
+
+  /// Check if a material property is present with the applicable restrictions
+  template<typename U>
+  bool haveMaterialProperty(const std::string & prop_name);
+
   /// Reference to FEProblem
   FEProblem & _dmi_fe_problem;

@@ -140,25 +141,11 @@
 {
 }

-template<class T>
-template<typename U>
-MaterialProperty<U> *
-DerivativeMaterialInterface<T>::getMaterialPropertyPointer(const std::string & name)
-{
-  mooseDeprecated("getMaterialPropertyPointer is deprecated because it is construction order dependent. Use getDefaultMaterialProperty instead.");
-  return this->template hasMaterialProperty<U>(name) ? &(this->template getMaterialProperty<U>(name)) : NULL;
-}
-
 template<>
 template<typename U>
 const MaterialProperty<U> &
-DerivativeMaterialInterface<Material>::getDefaultMaterialProperty(const std::string & prop_name)
-{
-  // if found return the requested property
-  if ((this->boundaryRestricted() && this->template hasBoundaryMaterialProperty<U>(prop_name)) ||
-      (this->template hasBlockMaterialProperty<U>(prop_name)))
-    return this->template getMaterialProperty<U>(prop_name);
-
+DerivativeMaterialInterface<Material>::getZeroMaterialProperty(const std::string & prop_name)
+{
   // declare this material property
   MaterialProperty<U> & preload_with_zero = this->template declareProperty<U>(prop_name);

@@ -176,17 +163,9 @@
 template<class T>
 template<typename U>
 const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getDefaultMaterialProperty(const std::string & prop_name)
+DerivativeMaterialInterface<T>::getZeroMaterialProperty(const std::string & /* prop_name */)
 {
   static MaterialProperty<U> _zero;
-
-  // Call the correct method to test for material property declarations
-  BlockRestrictable * blk = dynamic_cast<BlockRestrictable *>(this);
-  BoundaryRestrictable * bnd = dynamic_cast<BoundaryRestrictable *>(this);
-  if ((bnd && bnd->boundaryRestricted() && bnd->template hasBoundaryMaterialProperty<U>(prop_name)) ||
-      (blk && blk->template hasBlockMaterialProperty<U>(prop_name)) ||
-      (this->template hasMaterialProperty<U>(prop_name)))
-    return this->template getMaterialProperty<U>(prop_name);

   // make sure _zero is in a sane state
   unsigned int nqp = _dmi_fe_problem.getMaxQps();
@@ -204,6 +183,59 @@
   return _zero;
 }

+template<>
+template<typename U>
+bool
+DerivativeMaterialInterface<Material>::haveMaterialProperty(const std::string & prop_name)
+{
+  return ((this->boundaryRestricted() && this->template hasBoundaryMaterialProperty<U>(prop_name)) ||
+         (this->template hasBlockMaterialProperty<U>(prop_name)));
+}
+
+template<class T>
+template<typename U>
+bool
+DerivativeMaterialInterface<T>::haveMaterialProperty(const std::string & prop_name)
+{
+  // Call the correct method to test for material property declarations
+  BlockRestrictable * blk = dynamic_cast<BlockRestrictable *>(this);
+  BoundaryRestrictable * bnd = dynamic_cast<BoundaryRestrictable *>(this);
+  return ((bnd && bnd->boundaryRestricted() && bnd->template hasBoundaryMaterialProperty<U>(prop_name)) ||
+         (blk && blk->template hasBlockMaterialProperty<U>(prop_name)) ||
+         (this->template hasMaterialProperty<U>(prop_name)));
+}
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getDefaultMaterialProperty(const std::string & name)
+{
+  // Check if it's just a constant
+  const MaterialProperty<U> * default_property = this->template defaultMaterialProperty<U>(name);
+  if (default_property)
+    return *default_property;
+
+  // if found return the requested property
+  MaterialPropertyName prop_name = this->deducePropertyName(name);
+  if (haveMaterialProperty<U>(prop_name))
+    return this->template getMaterialProperty<U>(prop_name);
+
+  return getZeroMaterialProperty<U>(prop_name);
+}
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getDefaultMaterialPropertyByName(const std::string & prop_name)
+{
+  // if found return the requested property
+  if (haveMaterialProperty<U>(prop_name))
+    return this->template getMaterialPropertyByName<U>(prop_name);
+
+  return getZeroMaterialProperty<U>(prop_name);
+}
+
+
 template<class T>
 template<typename U>
 MaterialProperty<U> &
@@ -242,13 +274,46 @@
 const MaterialProperty<U> &
 DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const std::vector<VariableName> &c)
 {
+  return getDefaultMaterialPropertyByName<U>(propertyName(this->deducePropertyName(base), c));
+}
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1)
+{
+  return getDefaultMaterialPropertyByName<U>(propertyNameFirst(this->deducePropertyName(base), c1));
+}
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1, const VariableName &c2)
+{
+  return getDefaultMaterialPropertyByName<U>(propertyNameSecond(this->deducePropertyName(base), c1, c2));
+}
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1, const VariableName &c2, const VariableName &c3)
+{
+  return getDefaultMaterialPropertyByName<U>(propertyNameThird(this->deducePropertyName(base), c1, c2, c3));
+}
+
+
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector<VariableName> &c)
+{
   return getDefaultMaterialProperty<U>(propertyName(base, c));
 }

 template<class T>
 template<typename U>
 const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1)
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1)
 {
   return getDefaultMaterialProperty<U>(propertyNameFirst(base, c1));
 }
@@ -256,50 +321,17 @@
 template<class T>
 template<typename U>
 const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1, const VariableName &c2)
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2)
 {
   return getDefaultMaterialProperty<U>(propertyNameSecond(base, c1, c2));
 }

-
-template<class T>
-template<typename U>
-const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivative(const std::string &base, const VariableName &c1, const VariableName &c2, const VariableName &c3)
+template<class T>
+template<typename U>
+const MaterialProperty<U> &
+DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3)
 {
   return getDefaultMaterialProperty<U>(propertyNameThird(base, c1, c2, c3));
 }

-template<class T>
-template<typename U>
-const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector<VariableName> &c)
-{
-  return getDefaultMaterialProperty<U>(propertyName(base, c));
-}
-
-template<class T>
-template<typename U>
-const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1)
-{
-  return getDefaultMaterialProperty<U>(propertyNameFirst(base, c1));
-}
-
-template<class T>
-template<typename U>
-const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2)
-{
-  return getDefaultMaterialProperty<U>(propertyNameSecond(base, c1, c2));
-}
-
-template<class T>
-template<typename U>
-const MaterialProperty<U> &
-DerivativeMaterialInterface<T>::getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3)
-{
-  return getDefaultMaterialProperty<U>(propertyNameThird(base, c1, c2, c3));
-}
-
 #endif //DERIVATIVEMATERIALINTERFACE_H


fixed tilemap component layer freeing in view

--- opengl/src/view/tilemap.c
+++ opengl/src/view/tilemap.c
@@ -166,7 +166,7 @@
 {
 	ComponentData *componentData = componentDataPointer;

-	for(int i = 0; i < componentData->configuration.numLayers; i++) {
+	for(int i = 0; i < componentData->numLayers; i++) {
 		shovelerTextureFree(componentData->layers[i]);
 	}
 	free(componentData->layers);
@@ -184,7 +184,7 @@
 {
 	ComponentData *componentData = componentDataPointer;

-	for(int i = 0; i < componentData->configuration.numLayers; i++) {
+	for(int i = 0; i < componentData->numLayers; i++) {
 		shovelerTextureFree(componentData->layers[i]);
 	}


Force IP unit tests to run as super user.

--- openpgm/pgm/ip_unittest.c
+++ openpgm/pgm/ip_unittest.c
@@ -351,6 +351,11 @@
 int
 main (void)
 {
+	if (0 != getuid()) {
+		fprintf (stderr, "This test requires super-user privileges to run.\n");
+		return EXIT_FAILURE;
+	}
+
 	SRunner* sr = srunner_create (make_master_suite ());
 	srunner_add_suite (sr, make_test_suite ());
 	srunner_run_all (sr, CK_ENV);


Fixed another bug.

Fixed another bug.

--- vic/drivers/python/src/display_current_settings.c
+++ vic/drivers/python/src/display_current_settings.c
@@ -227,12 +227,6 @@
     }
     else {
         fprintf(LOG_DEST, "TFALLBACK\t\tFALSE\n");
-    }
-    if (options.VP_INTERP) {
-        fprintf(LOG_DEST, "VP_INTERP\t\tTRUE\n");
-    }
-    else {
-        fprintf(LOG_DEST, "VP_INTERP\t\tFALSE\n");
     }
     fprintf(LOG_DEST, "WIND_H\t\t\t%f\n", global_param.wind_h);
     fprintf(LOG_DEST, "MEASURE_H\t\t%f\n", global_param.measure_h);


fix(client): Restore the AuthenticationToken supplied by the user

--- src/client/ua_client.c
+++ src/client/ua_client.c
@@ -167,26 +167,26 @@
     /* Adjusting the request header. The const attribute is violated, but we
      * only touch the following members: */
     UA_RequestHeader *rr = (UA_RequestHeader*)(uintptr_t)request;
-    rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */
+    UA_NodeId oldToken = rr->authenticationToken; /* Put back in place later */
+    rr->authenticationToken = client->authenticationToken;
     rr->timestamp = UA_DateTime_now();
     rr->requestHandle = ++client->requestHandle;
-
-    /* Send the request */
     UA_UInt32 rqId = ++client->requestId;

 #ifdef UA_ENABLE_TYPEDESCRIPTION
-    UA_LOG_DEBUG(&client->config.logger, UA_LOGCATEGORY_CLIENT,
-                 "Sending a request of type %s", requestType->typeName);
+    UA_LOG_DEBUG_CHANNEL(&client->config.logger, &client->channel,
+                         "Sending request with RequestId %u of type %s",
+                         (unsigned)rqId, requestType->typeName);
 #else
-    UA_LOG_DEBUG(&client->config.logger, UA_LOGCATEGORY_CLIENT,
-                 "Sending a request of type %" PRIi16, requestType->binaryEncodingId);
+    UA_LOG_DEBUG_CHANNEL(&client->config.logger, channel,
+                         "Sending request with RequestId %u of type %" PRIi16,
+                         (unsigned)rqId, requestType->binaryEncodingId);
 #endif

-    retval = UA_SecureChannel_sendSymmetricMessage(&client->channel, rqId, UA_MESSAGETYPE_MSG,
-                                                   rr, requestType);
-    UA_NodeId_init(&rr->authenticationToken); /* Do not return the token to the user */
-    if(retval != UA_STATUSCODE_GOOD)
-        return retval;
+    /* Send the message */
+    retval = UA_SecureChannel_sendSymmetricMessage(&client->channel, rqId,
+                                                   UA_MESSAGETYPE_MSG, rr, requestType);
+    rr->authenticationToken = oldToken; /* Set the original token */

     *requestId = rqId;
     return UA_STATUSCODE_GOOD;


fix: fix #851 memleak in client; improve handling of timeouts

--- src/client/ua_client.c
+++ src/client/ua_client.c
@@ -10,6 +10,25 @@
 #include "ua_transport_generated.h"
 #include "ua_transport_generated_handling.h"
 #include "ua_transport_generated_encoding_binary.h"
+
+/* Listen with a timeout until at least one complete message is received */
+static UA_StatusCode
+Connection_receiveChunk(UA_Connection *connection, UA_ByteString * UA_RESTRICT message,
+                        UA_Boolean * UA_RESTRICT realloced, UA_UInt32 timeout) {
+    UA_StatusCode retval = UA_STATUSCODE_GOOD;
+    *realloced = false;
+    UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (timeout * UA_MSEC_TO_DATETIME);
+    /* Receive packets until one complete message is assembled */
+    do {
+        UA_DateTime now = UA_DateTime_nowMonotonic();
+        if(now > maxDate)
+            return UA_STATUSCODE_GOODNONCRITICALTIMEOUT;
+        UA_UInt32 thisTimeout = (UA_UInt32)((maxDate - UA_DateTime_nowMonotonic()) / UA_MSEC_TO_DATETIME);
+        retval = connection->recv(connection, message, thisTimeout);
+        retval |= UA_Connection_completeMessages(connection, message, realloced);
+    } while(retval == UA_STATUSCODE_GOOD && message->length == 0);
+    return retval;
+}

 /*********************/
 /* Create and Delete */
@@ -146,18 +165,15 @@
                  "Sent HEL message");

     /* Loop until we have a complete chunk */
-    /* TODO: quit after a total wait time of client->config.timeout */
     UA_ByteString reply = UA_BYTESTRING_NULL;
     UA_Boolean realloced = false;
-    do {
-        retval = client->connection->recv(client->connection, &reply, client->config.timeout);
-        retval |= UA_Connection_completeMessages(client->connection, &reply, &realloced);
-        if(retval != UA_STATUSCODE_GOOD) {
-            UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
-                        "Receiving ACK message failed");
-            return retval;
-        }
-    } while(reply.length == 0);
+    retval = Connection_receiveChunk(client->connection, &reply,
+                                     &realloced, client->config.timeout);
+    if(retval != UA_STATUSCODE_GOOD) {
+        UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
+                    "Receiving ACK message failed");
+        return retval;
+    }

     /* Decode the message */
     offset = 0;
@@ -273,19 +289,16 @@
     if(retval != UA_STATUSCODE_GOOD)
         return retval;

-    UA_ByteString reply;
-    UA_ByteString_init(&reply);
+    UA_ByteString reply = UA_BYTESTRING_NULL;
     UA_Boolean realloced = false;
-    do {
-        retval = c->recv(c, &reply, client->config.timeout);
-        retval |= UA_Connection_completeMessages(c, &reply, &realloced);
-        if(retval != UA_STATUSCODE_GOOD) {
-            UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
-                         "Receiving OpenSecureChannelResponse failed");
-            return retval;
-        }
-    } while(reply.length == 0);
-
+    retval = Connection_receiveChunk(c, &reply, &realloced, client->config.timeout);
+    if(retval != UA_STATUSCODE_GOOD) {
+        UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
+                     "Receiving OpenSecureChannelResponse failed");
+        return retval;
+    }
+
+    /* Decode the header */
     offset = 0;
     UA_SecureConversationMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
     UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply, &offset, &asymHeader);
@@ -302,16 +315,18 @@
         return UA_STATUSCODE_BADINTERNALERROR;
     }

+    /* Save the sequence number from server */
+    client->channel->receiveSequenceNumber = seqHeader.sequenceNumber;
+
+    /* Decode the response */
     UA_OpenSecureChannelResponse response;
     retval = UA_OpenSecureChannelResponse_decodeBinary(&reply, &offset, &response);
+
+    /* Free the message */
     if(!realloced)
         c->releaseRecvBuffer(c, &reply);
     else
         UA_ByteString_deleteMembers(&reply);
-
-    /* save the sequence number from server */
-    client->channel->receiveSequenceNumber = seqHeader.sequenceNumber;
-

     if(retval != UA_STATUSCODE_GOOD) {
         UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
@@ -717,6 +732,13 @@
     UA_ResponseHeader *respHeader = (UA_ResponseHeader*)rd->response;
     rd->processed = true;

+    if(messageType != UA_MESSAGETYPE_MSG) {
+        UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
+                     "Server replied with the wrong message type");
+        retval = UA_STATUSCODE_BADTCPMESSAGETYPEINVALID;
+        goto finish;
+    }
+
     /* Check that the request id matches */
     /* Todo: we need to demux async responses since a publish responses may come
        at any time */
@@ -803,32 +825,40 @@
         else
             respHeader->serviceResult = retval;
         client->state = UA_CLIENTSTATE_ERRORED;
-        goto finish;
-    }
-
-    /* Requests always begin witih a RequestHeader, therefore we can cast. */
+        UA_NodeId_deleteMembers(&request->authenticationToken);
+        return;
+    }
+
+    /* Prepare the response and the structure we give into processServiceResponse */
     UA_init(response, responseType);
     struct ResponseDescription rd = (struct ResponseDescription){
         client, false, requestId, response, responseType};

     /* Retrieve the response */
-    UA_ByteString reply;
-    UA_ByteString_init(&reply);
-    UA_Boolean realloced = false;
+    UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_MSEC_TO_DATETIME);
     do {
-        retval = client->connection->recv(client->connection, &reply, client->config.timeout);
-        retval |= UA_Connection_completeMessages(client->connection, &reply, &realloced);
+        /* Retrieve complete chunks */
+        UA_ByteString reply = UA_BYTESTRING_NULL;
+        UA_Boolean realloced = false;
+        UA_DateTime now = UA_DateTime_nowMonotonic();
+        if(now < maxDate) {
+            UA_UInt32 timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
+            retval = Connection_receiveChunk(client->connection, &reply, &realloced, timeout);
+        } else {
+            retval = UA_STATUSCODE_GOODNONCRITICALTIMEOUT;
+        }
         if(retval != UA_STATUSCODE_GOOD) {
             respHeader->serviceResult = retval;
-            client->state = UA_CLIENTSTATE_ERRORED;
-            goto finish;
+            break;
         }
-        if(!reply.data)
-            break;
+        /* ProcessChunks and call processServiceResponse for complete messages */
         UA_SecureChannel_processChunks(client->channel, &reply,
                      (UA_ProcessMessageCallback*)processServiceResponse, &rd);
+        /* Free the received buffer */
+        if(!realloced)
+            client->connection->releaseRecvBuffer(client->connection, &reply);
+        else
+            UA_ByteString_deleteMembers(&reply);
     } while(!rd.processed);
-
- finish:
     UA_NodeId_deleteMembers(&request->authenticationToken);
 }


minor cleanups. 3 LEDs are now displaying state of media keys and mouse/gamepad mode.


Nie marudzimy, jeśli dostaniemy pusty blok atrybutów w GG_RECV_MSG80. (wojtekka/r744 w new-api)

--- src/events.c
+++ src/events.c
@@ -476,11 +476,15 @@
 		goto ignore;
 	}

-	if (offset_attr <= sizeof(struct gg_recv_msg80) || offset_attr >= h->length) {
+	if (offset_attr < sizeof(struct gg_recv_msg80) || offset_attr > h->length) {
 		gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg80() malformed packet, attr out of bounds (1)\n");
 		offset_attr = 0;	/* nie parsuj attr. */
 		/* goto ignore; */
 	}
+
+	/* Normalna sytuacja, więc nie podpada pod powyższy warunek. */
+	if (offset_attr == h->length)
+		offset_attr = 0;

 	if (gg_find_null(packet, offset_plain, h->length) == NULL) {
 		gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg80() malformed packet, message out of bounds (2)\n");


exe-pe: Fixed missing errno.h include

exe-pe: Fixed missing errno.h include

--- src/exe-pe.c
+++ src/exe-pe.c
@@ -24,6 +24,7 @@
 #include "exe.h"
 #include "common.h"

+#include <errno.h>
 #include <tlhelp32.h>

 #ifdef _MSC_VER


Add a case for ths sig handler for Cray X1. Still some problems with overflow/profile on this platform.

--- src/extras.c
+++ src/extras.c
@@ -460,6 +460,10 @@
    action.sa_sigaction = (void (*)(int, siginfo_t *, void *)) _papi_hwd_dispatch_timer;
    if (need_context)
      action.sa_flags |= SIGPWR;
+#elif defined(__crayx1)
+   action.sa_handler = (void (*)(int)) _papi_hwd_dispatch_timer;
+   if (need_context)
+      action.sa_flags |= SA_SIGINFO;
 #else
    action.sa_sigaction = (void (*)(int, siginfo_t *, void *)) _papi_hwd_dispatch_timer;
    if (need_context)


* Keep an internal palette, which is used by FBc24_to_cnative() and   FBcnative_to_c24().

--- src/fbcmap.c
+++ src/fbcmap.c
@@ -10,6 +10,7 @@
 	static int	length=0;	/* length of colourmap */
 	struct fb_cmap	cmap;
 	FBCMAP		*fbcmap;	/* new colourmap */
+	int i;

 	fbcmap = (FBCMAP *) FBalloc( sizeof(FBCMAP) );

@@ -23,6 +24,7 @@
 		length = 0;
 	}
 	if ( length == 0 )*/
+
 	{
 	length = 1<<f->vinf.bits_per_pixel;
 	cmap.red=(unsigned short *) FBalloc( length * sizeof(unsigned short) );
@@ -46,7 +48,16 @@
 	fbcmap->red=cmap.red;
 	fbcmap->green=cmap.green;
 	fbcmap->blue=cmap.blue;
-	f->cmap=fbcmap;
+
+	/* Update the internal palette. */
+	f->cmap->start = fbcmap->start;
+	f->cmap->end = fbcmap->end;
+	for(i = fbcmap->start ; i <= fbcmap->end ; i++) {
+	  f->cmap->red[i] = fbcmap->red[i];
+	  f->cmap->green[i] = fbcmap->green[i];
+	  f->cmap->blue[i] = fbcmap->blue[i];
+	}
+
 	return fbcmap;
 }

@@ -54,6 +65,7 @@
 FBputcmap( FB *f, FBCMAP *fbcmap )
 {
 	struct fb_cmap	cmap;
+	int i;

 	cmap.start=fbcmap->start;
 	cmap.len=fbcmap->end-fbcmap->start+1;
@@ -65,7 +77,13 @@
 	{
 		FBerror( FATAL | SYSERR, "FBputcmap: Put colourmap failed" );
 	}
-	f->cmap=fbcmap;
+
+	/* Update the internal palette too. */
+	for(i = fbcmap->start ; i <= fbcmap->end ; i++) {
+	  f->cmap->red[i] = fbcmap->red[i];
+	  f->cmap->green[i] = fbcmap->green[i];
+	  f->cmap->blue[i] = fbcmap->blue[i];
+	}
 }

 void
@@ -82,7 +100,6 @@
 {
   int nr_of_colours, best_diff, best_match, i, diff;
   int red, green, blue;
-  FBCMAP *fbcmap;
   u_int32_t pval;

   /* For palette based modes, we try to find the best matching
@@ -90,24 +107,19 @@
    */
   if(f->finf.visual == FB_VISUAL_PSEUDOCOLOR) {
     nr_of_colours = 1 << f->vinf.bits_per_pixel;
-    fbcmap = FBgetcmap(f);
-    if(fbcmap == NULL)
-      return 0;

     best_diff = 1024;
     best_match = nr_of_colours - 1;
     for(i = 0 ; i < nr_of_colours ; i++) {
-      red   = ((col24 >> 16) & 0xff) - (fbcmap->red[i] >> 8);
-      green = ((col24 >>  8) & 0xff) - (fbcmap->green[i] >> 8);
-      blue  = ((col24      ) & 0xff) - (fbcmap->blue[i] >> 8);
+      red   = ((col24 >> 16) & 0xff) - (f->cmap->red[i] >> 8);
+      green = ((col24 >>  8) & 0xff) - (f->cmap->green[i] >> 8);
+      blue  = ((col24      ) & 0xff) - (f->cmap->blue[i] >> 8);
       diff = red * red + green * green + blue * blue;
       if(diff < best_diff) {
 	best_diff = diff;
 	best_match = i;
       }
     }
-
-    FBfreecmap(fbcmap);

     return best_match;
   }
@@ -122,22 +134,17 @@
 u_int32_t
 FBcnative_to_c24( FB *f, u_int32_t col )
 {
-  FBCMAP *fbcmap;
   int index, nr_of_colours;
   u_int32_t colour;

   /* This picks out the colour from the palette. */
   if(f->finf.visual == FB_VISUAL_PSEUDOCOLOR) {
-    fbcmap = FBgetcmap(f);
-    if(fbcmap == NULL)
-      return 0;
     nr_of_colours = 1 << f->vinf.bits_per_pixel;
     index = col < nr_of_colours ? col : nr_of_colours-1;
     index = index >= 0 ? index : 0;
-    colour = ((((fbcmap->red[index] >> 8) & 0xff) << 16) |
-	      (((fbcmap->green[index] >> 8) & 0xff) <<  8) |
-	      (((fbcmap->blue[index] >> 8) & 0xff) <<  0));
-    FBfreecmap(fbcmap);
+    colour = ((((f->cmap->red[index] >> 8) & 0xff) << 16) |
+	      (((f->cmap->green[index] >> 8) & 0xff) <<  8) |
+	      (((f->cmap->blue[index] >> 8) & 0xff) <<  0));
     return colour;
   }


5l: handle jump to middle of floating point sequence

R=ken2
CC=golang-dev
http://codereview.appspot.com/2473042

--- src/cmd/5l/softfloat.c
+++ src/cmd/5l/softfloat.c
@@ -19,8 +19,11 @@
 	if(symsfloat->type == STEXT)
 		psfloat = symsfloat->text;

-	wasfloat = 0;
 	for(cursym = textp; cursym != nil; cursym = cursym->next) {
+		wasfloat = 0;
+		for(p = cursym->text; p != P; p = p->link)
+			if(p->cond != P)
+				p->cond->mark |= LABEL;
 		for(p = cursym->text; p != P; p = p->link) {
 			switch(p->as) {
 			case AMOVWD:
@@ -43,7 +46,7 @@
 			case ADIVD:
 				if (psfloat == P)
 					diag("floats used with _sfloat not defined");
-				if (!wasfloat) {
+				if (!wasfloat || (p->mark&LABEL)) {
 					next = prg();
 					*next = *p;


Fix horizon

Fix horizon

--- optimizer/tsptw_data_dt.h
+++ optimizer/tsptw_data_dt.h
@@ -335,6 +335,11 @@
   for (int32 i = 0; i < size_; ++i) {
     horizon_ = std::max(horizon_, tsptw_clients_[i].first_due_time);
   }
+  v = 0;
+  for (const ortools_vrp::Vehicle& vehicle: problem.vehicles()) {
+    horizon_ = std::max(horizon_, (int64)vehicle.time_window().end());
+    ++v;
+  }
 }

 }  //  namespace operations_research


more debug info on bad packets

more debug info on bad packets

--- os/frisbee.redux/server.c
+++ os/frisbee.redux/server.c
@@ -554,16 +554,14 @@
 		if (! PacketValid(p, FileInfo.chunks)) {
 			struct in_addr ipaddr = { p->hdr.srcip };
 			DOSTAT(badpackets++);
-			log("received bad packet %d/%d from %s, ignored",
+			log("bad packet %d/%d from %s, ignored",
 			    p->hdr.type, p->hdr.subtype, inet_ntoa(ipaddr));
-#if 0
 			if (p->hdr.type == PKTTYPE_REQUEST &&
-			    p->hdr.subtype == PKTSUBTYPE_REQUEST)
-				log("  len=%d, chunk=%d(%d), block=%d@%d\n",
+			    (p->hdr.subtype == PKTSUBTYPE_REQUEST ||
+			     p->hdr.subtype == PKTSUBTYPE_PREQUEST))
+				log("  len=%d, chunk=%d(%d), word2=%d",
 				    p->hdr.datalen, p->msg.request.chunk,
-				    FileInfo.chunks, p->msg.request.count,
-				    p->msg.request.block);
-#endif
+				    FileInfo.chunks, p->msg.request.block);
 			continue;
 		}
 		gettimeofday(&LastReq, 0);


Fix compiler when used with NSS

Fix compiler when used with NSS

algorithm.c:54: error: conflicting types for ‘Alg_get_digest_by_name’
./alg_st.h:50: note: previous declaration of ‘Alg_get_digest_by_name’ was here

--- src/common/algorithm.c
+++ src/common/algorithm.c
@@ -51,7 +51,7 @@
     return hashOIDTag;
 }

-ALGDIGEST *Alg_get_digest_by_name(ALGORITHM_TYPE hash)
+const ALGDIGEST *Alg_get_digest_by_name(ALGORITHM_TYPE hash)
 {
     return HASH_GetHashObjectByOidTag(hash);
 }