One more - TB_DEFAULT for fg as well now

--- src/termbox.c
+++ src/termbox.c
@@ -53,7 +53,7 @@
 static int cursor_y = -1;

 static uint16_t background = TB_DEFAULT;
-static uint16_t foreground = TB_WHITE;
+static uint16_t foreground = TB_DEFAULT;

 static void write_cursor(unsigned x, unsigned y);
 static void write_sgr(uint32_t fg, uint32_t bg);


Switch to using wnoutrefresh and dorefresh

--- src/termwin.c
+++ src/termwin.c
@@ -69,7 +69,6 @@
     VTerm *vt;
     WINDOW *win;
     int numcolors;
-    int resized;
     VTermRect damage_rect;
     int pairid_count;
     short pair_table[ MAX_ANSI_COLORS * MAX_ANSI_COLORS ];
@@ -114,7 +113,6 @@
     twin->win = win;
     twin->vt = NULL;
     twin->numcolors = 0;
-    twin->resized = 0;

     memset( &twin->damage_rect, 0, sizeof( twin->damage_rect ) );
     memset( twin->ansi_colors, 0, sizeof( twin->ansi_colors ) );
@@ -459,13 +457,9 @@

     if ( termwin_draw( twin ) )
     {
-        if ( twin->resized )
-        {
-            refresh();
-            twin->resized = 0;
-        }
-
-        NCURSES_CHECK( ret, wrefresh, twin->win );
+        NCURSES_CHECK( ret, wnoutrefresh, stdscr );
+        NCURSES_CHECK( ret, wnoutrefresh, twin->win );
+        NCURSES_CHECK( ret, doupdate );
     }
 }

@@ -540,6 +534,4 @@
     twin->damage_rect.start_col = 0;
     twin->damage_rect.end_row = maxy;
     twin->damage_rect.end_col = maxx;
-
-    twin->resized = 1;
-}
+}


shifted scrollbar to the right

shifted scrollbar to the right

--- src/textbox.c
+++ src/textbox.c
@@ -26,7 +26,7 @@
 	tb->f = fonts[0]; // default font
 	tb->data = calloc(data_len,1);

-	tb->sb = add_scrollbar(tb->x+(tb->f->w*tb->line_width), tb->y, tb->f->h, (unsigned int)tb->lines);
+	tb->sb = add_scrollbar(tb->x+(tb->f->w*tb->line_width)+6., tb->y, tb->f->h, (unsigned int)tb->lines);
 	add_object_2d(tb, &draw_textbox, NULL, &free_textbox);

 	return tb;


updated version strings.

updated version strings.

--- src/tglobal.h
+++ src/tglobal.h
@@ -1,7 +1,7 @@
 #pragma once
-constexpr auto TF_VERSION_STR = "2.3.0";
-constexpr auto TF_VERSION_NUMBER = 0x020300;
-constexpr auto TF_SRC_REVISION = 2468;
+constexpr auto TF_VERSION_STR = "2.3.1";
+constexpr auto TF_VERSION_NUMBER = 0x020301;
+constexpr auto TF_SRC_REVISION = 2498;

 #include <QMetaType>
 #include <QIODevice>


Begin outline of TIB type functions

Begin outline of TIB type functions

--- src/tibtype.h
+++ src/tibtype.h
@@ -18,6 +18,7 @@
 #ifndef DELWINK_TIB_TIBTYPE_H
 #define DELWINK_TIB_TIBTYPE_H

+#include <stdlib.h>
 #include <stdint.h>

 #define TIB_TYPE_REAL      1
@@ -30,19 +31,103 @@

 #define TIB_TYPE_MATRIX    5

-union variant
+#define TIB_TYPE_COMPLEX   6
+
+struct complex
 {
   double real;
   double imaginary;
+};
+
+struct list
+{
+  void *values;
+  size_t len;
+};
+
+struct matrix
+{
+  void **values;
+  size_t width;
+  size_t height;
+};
+
+union variant
+{
+  struct complex number;
   char *string;
-  char **list;
-  char ***matrix;
+  struct list list;
+  struct matrix matrix;
 };

 typedef struct
 {
   int8_t type;
   union variant value;
+  size_t refs;
 } TIB;

+TIB *
+tib_empty (void);
+
+TIB *
+tib_copy (const TIB *t);
+
+void
+tib_incref (TIB *t);
+
+void
+tib_decref (TIB *t);
+
+TIB *
+tib_new_real (double value);
+
+TIB *
+tib_new_imaginary (double value);
+
+TIB *
+tib_new_str (const char *value);
+
+TIB *
+tib_new_list (const TIB **value, size_t len);
+
+TIB *
+tib_new_matrix (const TIB ***value, size_t w, size_t h);
+
+void
+tib_set_type (TIB *t, int8_t type);
+
+int8_t
+tib_type (const TIB *t);
+
+bool
+tib_isreal (const TIB *t);
+
+bool
+tib_isimaginary (const TIB *t);
+
+bool
+tib_iscomplex (const TIB *t);
+
+bool
+tib_isnum (const TIB *t);
+
+bool
+tib_isstr (const TIB *t);
+
+bool
+tib_islist (const TIB *t);
+
+bool
+tib_ismatrix (const TIB *t);
+
+int
+tib_real_value (const TIB *t, double *out);
+
+int
+tib_imaginary_value (const TIB *t, double *out);
+
+int
+tib_complex_value (const TIB *t, double *real_out, double *imaginary_out);
+
 #endif


trivial: fix warnings

trivial: fix warnings

--- src/trivial.c
+++ src/trivial.c
@@ -27,9 +27,9 @@
             /* Match */
             matched++;
             if (matched == 1) {
-                printf("trivial: match at %u", t);
+                printf("trivial: match at %zu", t);
             } else {
-                printf(", %u", t);
+                printf(", %zu", t);
             }
         }
     }


Removed unused variables from turbine.c

Removed unused variables from turbine.c

--- src/turbine.c
+++ src/turbine.c
@@ -2,8 +2,6 @@

 static double r_univ = 8.314;		// in SI units.
 static int num_stages = 8;
-static double eta_isen = 0.92;		//Isentropic efficiency
-static double eta_comb = 0.98;		//Efficiency of combustion
 static double p_final = 108000;		//Final pressure.
 /*
  * Prints the details of the turbine


Always remove temps, and -save-temps opens local filenames instead

--- src/ucc/ucc.c
+++ src/ucc/ucc.c
@@ -5,6 +5,7 @@
 #include <errno.h>
 #include <assert.h>
 #include <unistd.h>
+#include <fcntl.h>

 /* umask */
 #include <sys/types.h>
@@ -77,8 +78,7 @@
 {
 	int i;
 	for(i = 0; remove_these[i]; i++){
-		if(!save_temps)
-			remove(remove_these[i]);
+		remove(remove_these[i]);
 		free(remove_these[i]);
 	}
 	free(remove_these);
@@ -111,18 +111,30 @@
 	return new;
 }

-static void tmpfilenam(struct fd_name_pair *pair)
+static void tmpfilenam(
+		struct fd_name_pair *pair,
+		enum mode const mode,
+		const char *in)
 {
 	char *path;
-	int fd = tmpfile_prefix_out("ucc.", &path);
-
-	if(fd == -1)
-		die("tmpfile(%s):", path);
-
-	if(!remove_these) /* only register once */
-		atexit(unlink_files);
-
-	dynarray_add(&remove_these, path);
+	int fd;
+
+	if(save_temps){
+		path = expected_filename(in, mode);
+		fd = open(path, O_RDWR | O_TRUNC | O_CREAT, 0600);
+		if(fd < 0)
+			die("open (for -save-temps) %s:", path);
+
+	}else{
+		fd = tmpfile_prefix_out("ucc.", &path);
+
+		if(fd == -1)
+			die("tmpfile(%s):", path);
+
+		if(!remove_these) /* only register once */
+			atexit(unlink_files);
+		dynarray_add(&remove_these, path);
+	}

 	pair->fname = path;
 	pair->fd = fd;
@@ -152,7 +164,7 @@

 #define FILL_WITH_TMP(x)         \
 			if(!file->x.fname){        \
-				tmpfilenam(&file->x);    \
+				tmpfilenam(&file->x, mode_##x, in); \
 				if(mode == mode_ ## x){  \
 					file->out = file->x;   \
 					return;                \


linux: add futimes() fallback

linux: add futimes() fallback

The utimensat() syscall was added in 2.6.22. Add a fallback mode for
older kernels that uses utimes("/proc/self/fd/<fd>").

Fixes #687.

--- src/unix/fs.c
+++ src/unix/fs.c
@@ -113,12 +113,39 @@
   /* utimesat() has nanosecond resolution but we stick to microseconds
    * for the sake of consistency with other platforms.
    */
+  static int no_utimesat;
   struct timespec ts[2];
+  struct timeval tv[2];
+  char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)];
+  int r;
+
+  if (no_utimesat)
+    goto skip;
+
   ts[0].tv_sec  = req->atime;
   ts[0].tv_nsec = (unsigned long)(req->atime * 1000000) % 1000000 * 1000;
   ts[1].tv_sec  = req->mtime;
   ts[1].tv_nsec = (unsigned long)(req->mtime * 1000000) % 1000000 * 1000;
-  return uv__utimesat(req->file, NULL, ts, 0);
+
+  r = uv__utimesat(req->file, NULL, ts, 0);
+  if (r == 0)
+    return r;
+
+  if (errno != ENOSYS)
+    return r;
+
+  no_utimesat = 1;
+
+skip:
+
+  tv[0].tv_sec  = req->atime;
+  tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000;
+  tv[1].tv_sec  = req->mtime;
+  tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000;
+  snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file);
+
+  return utimes(path, tv);
+
 #elif defined(__APPLE__)                                                      \
     || defined(__DragonFly__)                                                 \
     || defined(__FreeBSD__)                                                   \


update uoj1107

update uoj1107


uv-unix: uv_pipe_bind: raise UV_EACCESS on inaccessible socket

Fixes failing test pipe_bind_error_addrnotavail.

--- src/uv-unix.c
+++ src/uv-unix.c
@@ -1831,7 +1831,7 @@
      * on EADDRINUSE. Unlinking and trying to bind again opens
      * a window for races with other threads and processes.
      */
-    uv_err_new((uv_handle_t*)handle, errno);
+    uv_err_new((uv_handle_t*)handle, (errno == ENOENT) ? EACCES : errno);
     goto out;
 #else
     /*
@@ -1840,7 +1840,8 @@
     if (errno != EADDRINUSE
         || unlink(pipe_fname) == -1
         || bind(sockfd, (struct sockaddr*)&sun, sizeof sun) == -1) {
-      uv_err_new((uv_handle_t*)handle, errno);
+      /* Convert ENOENT to EACCES for compatibility with Windows. */
+      uv_err_new((uv_handle_t*)handle, (errno == ENOENT) ? EACCES : errno);
       goto out;
     }
 #endif


update uva1339

update uva1339


Bump version to 0.2.4

Bump version to 0.2.4

--- src/version.h
+++ src/version.h
@@ -29,7 +29,7 @@
 // ppcoin version - intended for display purpose ONLY
 #define PPCOIN_VERSION_MAJOR       0
 #define PPCOIN_VERSION_MINOR       2
-#define PPCOIN_VERSION_REVISION    2
+#define PPCOIN_VERSION_REVISION    4
 #define PPCOIN_VERSION_BUILD       0

 //


Update version.h

Update version.h

--- src/version.h
+++ src/version.h
@@ -25,7 +25,7 @@
 // network protocol versioning
 //

-static const int PROTOCOL_VERSION = 1000000;
+static const int PROTOCOL_VERSION = 1010000;

 // earlier versions not supported as of 11 2017, and are disconnected
 static const int MIN_PROTO_VERSION = 999999;
@@ -45,8 +45,8 @@
 static const int MEMPOOL_GD_VERSION = 60002;

 #define DISPLAY_VERSION_MAJOR       2
-#define DISPLAY_VERSION_MINOR       0
-#define DISPLAY_VERSION_REVISION    1
+#define DISPLAY_VERSION_MINOR       2
+#define DISPLAY_VERSION_REVISION    0
 #define DISPLAY_VERSION_BUILD       0

 #endif


Bump version to 0.8.1.

Bump version to 0.8.1.

--- src/version.h
+++ src/version.h
@@ -22,7 +22,7 @@

 #define MC_VERSION_MAJOR              0
 #define MC_VERSION_MINOR              8
-#define MC_VERSION_RELEASE            0
+#define MC_VERSION_RELEASE            1

 /* Stringize given expression */


Bumped version number to 0.2.2.238. #244

--- src/version.h
+++ src/version.h
@@ -10,7 +10,7 @@
 # define PROGRAM_MAJOR_VERSION 0
 # define PROGRAM_MINOR_VERSION 2
 # define PROGRAM_MAJOR_REVISION 2
-# define PROGRAM_MINOR_REVISION 237
+# define PROGRAM_MINOR_REVISION 238
 # define PROGRAM_PATCH_LEVEL 0

 # define TITLE_BAR_STRING_SIZE 256


1.6.3

--- src/version.h
+++ src/version.h
@@ -17,4 +17,4 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

-# define VERSION	"DGD 1.6.2"
+# define VERSION	"DGD 1.6.3"


In our driver in order to support both KMS and UMS we can't call drmmode_set_mode_major directly but instead call xf86CrtcSetMode or alike functions. All those xorg methods are wrappers around xf86CrtcSetModeTransform which does the handling of restoring the mode in failure cases. If you look at drmmode_set_mode_major it also does the the same error handling because the was copied from drivers that directly called it. Since this is not the case for us we can make drmmode_set_mode_major much simpler and depend on xf86CrtcSetModeTransform to handle failures for us.

--- src/via_kms.c
+++ src/via_kms.c
@@ -160,120 +160,79 @@
 drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
                         Rotation rotation, int x, int y)
 {
-    ScrnInfoPtr pScrn = crtc->scrn;
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
     drmmode_ptr drmmode = drmmode_crtc->drmmode;
-    int saved_x, saved_y;
-    Rotation saved_rotation;
-    DisplayModeRec saved_mode;
-    uint32_t *output_ids;
-    int output_count = 0;
-    Bool ret = TRUE;
-    int i;
-    int fb_id;
+    ScrnInfoPtr pScrn = crtc->scrn;
+    int output_count = 0, ret, i;
+    uint32_t *output_ids = NULL;
     drmModeModeInfo kmode;
-    int height;
-
-    height = pScrn->virtualY;
+
+    if (!mode || !xf86CrtcRotate(crtc))
+        return FALSE;
+
+    output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+    if (!output_ids)
+        return FALSE;
+
+    for (i = 0; i < xf86_config->num_output; i++) {
+        xf86OutputPtr output = xf86_config->output[i];
+        drmmode_output_private_ptr drmmode_output;
+
+        if (output->crtc != crtc)
+            continue;
+
+        drmmode_output = output->driver_private;
+        output_ids[output_count] = drmmode_output->mode_output->connector_id;
+        output_count++;
+    }
+
+    xf86SetModeDefaultName(mode);
+    drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);

     if (drmmode->fb_id == 0) {
-        ret = drmModeAddFB(drmmode->fd, pScrn->virtualX, height,
+        ret = drmModeAddFB(drmmode->fd, pScrn->virtualX, pScrn->virtualY,
                             pScrn->depth, pScrn->bitsPerPixel,
                             drmmode->front_bo->pitch,
                             drmmode->front_bo->handle,
                             &drmmode->fb_id);
         if (ret < 0) {
             ErrorF("failed to add fb %d\n", ret);
-            return FALSE;
-        }
-    }
-
-    saved_mode = crtc->mode;
-    saved_x = crtc->x;
-    saved_y = crtc->y;
-    saved_rotation = crtc->rotation;
-
-    if (mode) {
-        crtc->mode = *mode;
-        crtc->x = x;
-        crtc->y = y;
-        crtc->rotation = rotation;
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,5,99,0,0)
-        crtc->transformPresent = FALSE;
-#endif
-    }
-
-    output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
-    if (!output_ids) {
-        ret = FALSE;
-        goto done;
-    }
-
-    if (mode) {
-        for (i = 0; i < xf86_config->num_output; i++) {
-            xf86OutputPtr output = xf86_config->output[i];
-            drmmode_output_private_ptr drmmode_output;
-
-            if (output->crtc != crtc)
-                continue;
-
-            drmmode_output = output->driver_private;
-            output_ids[output_count] = drmmode_output->mode_output->connector_id;
-            output_count++;
-        }
-
-        if (!xf86CrtcRotate(crtc)) {
             goto done;
         }
+    }
+
+    ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+                         drmmode->fb_id, x, y, output_ids, output_count, &kmode);
+    if (ret) {
+        xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "failed to set mode: %s",
+                   strerror(-ret));
+        goto done;
+    }
+
+    if (crtc->scrn->pScreen)
+        xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen);
+
+    /* go through all the outputs and force DPMS them back on? */
+    for (i = 0; i < xf86_config->num_output; i++) {
+        xf86OutputPtr output = xf86_config->output[i];
+
+        if (output->crtc != crtc)
+            continue;
+
+        output->funcs->dpms(output, DPMSModeOn);
+    }

 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,0,0,0)
-        crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
-                                crtc->gamma_blue, crtc->gamma_size);
+    crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+                           crtc->gamma_blue, crtc->gamma_size);
 #endif
-        drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
-
-        fb_id = drmmode->fb_id;
-        if (drmmode_crtc->rotate_fb_id) {
-            fb_id = drmmode_crtc->rotate_fb_id;
-            x = y = 0;
-        }
-        ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
-                            fb_id, x, y, output_ids, output_count, &kmode);
-        if (ret)
-            xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "failed to set mode: %s",
-                        strerror(-ret));
-        else
-            ret = TRUE;
-
-        if (crtc->scrn->pScreen)
-            xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen);
-
-        /* go through all the outputs and force DPMS them back on? */
-        for (i = 0; i < xf86_config->num_output; i++) {
-            xf86OutputPtr output = xf86_config->output[i];
-
-            if (output->crtc != crtc)
-			    continue;
-
-            output->funcs->dpms(output, DPMSModeOn);
-        }
-    }

     if (pScrn->pScreen && drmmode->hwcursor)
         xf86_reload_cursors(pScrn->pScreen);
 done:
-    if (!ret) {
-        crtc->x = saved_x;
-        crtc->y = saved_y;
-        crtc->rotation = saved_rotation;
-        crtc->mode = saved_mode;
-    }
-#if defined(XF86_CRTC_VERSION) && XF86_CRTC_VERSION >= 3
-    else
-        crtc->active = TRUE;
-#endif
-	return ret;
+    free(output_ids);
+    return (ret < 0 ? FALSE : TRUE);
 }

 static void


Update list of includes

Update list of includes

--- lib/node_modules/@stdlib/strided/napi/include/stdlib/strided/napi.h
+++ lib/node_modules/@stdlib/strided/napi/include/stdlib/strided/napi.h
@@ -21,10 +21,14 @@

 // Note: keep in alphabetical order...
 #include "stdlib/strided/base/dmap.h"
+#include "stdlib/strided/base/dmskmap.h"
 #include "stdlib/strided/base/function_object.h"
 #include "stdlib/strided/base/smap.h"
+#include "stdlib/strided/base/smskmap.h"
 #include "stdlib/strided/base/unary.h"
+
 #include "stdlib/strided/dtypes.h"
+
 #include "stdlib/strided/napi/dmap.h"
 #include "stdlib/strided/napi/smap.h"
 #include "stdlib/strided/napi/unary.h"


Update includes

Update includes

--- lib/node_modules/@stdlib/strided/napi/include/stdlib/strided/napi.h
+++ lib/node_modules/@stdlib/strided/napi/include/stdlib/strided/napi.h
@@ -32,6 +32,7 @@
 #include "stdlib/strided/napi/dmap.h"
 #include "stdlib/strided/napi/dmskmap.h"
 #include "stdlib/strided/napi/smap.h"
+#include "stdlib/strided/napi/smskmap.h"
 #include "stdlib/strided/napi/unary.h"

 #endif // !STDLIB_STRIDED_NAPI_H


inline-checker-gtv: listen to ::apply-tag and ::remove-tag

--- gspell/gspell-inline-checker-gtv.c
+++ gspell/gspell-inline-checker-gtv.c
@@ -807,6 +807,21 @@
 }

 static void
+apply_or_remove_tag_cb (GtkTextBuffer          *buffer,
+			GtkTextTag             *tag,
+			GtkTextIter            *start,
+			GtkTextIter            *end,
+			GspellInlineCheckerGtv *spell)
+{
+	if (spell->no_spell_check_tag != NULL &&
+	    spell->no_spell_check_tag == tag)
+	{
+		add_subregion_to_scan (spell, start, end);
+		install_timeout (spell, TIMEOUT_DURATION_BUFFER_MODIFIED);
+	}
+}
+
+static void
 tag_added_cb (GtkTextTagTable        *table,
 	      GtkTextTag             *tag,
 	      GspellInlineCheckerGtv *spell)
@@ -869,6 +884,18 @@
 	g_signal_connect_object (buffer,
 				 "delete-range",
 				 G_CALLBACK (delete_range_after_cb),
+				 spell,
+				 G_CONNECT_AFTER);
+
+	g_signal_connect_object (buffer,
+				 "apply-tag",
+				 G_CALLBACK (apply_or_remove_tag_cb),
+				 spell,
+				 G_CONNECT_AFTER);
+
+	g_signal_connect_object (buffer,
+				 "remove-tag",
+				 G_CALLBACK (apply_or_remove_tag_cb),
 				 spell,
 				 G_CONNECT_AFTER);


Update version

Update version

--- bacula/src/version.h
+++ bacula/src/version.h
@@ -1,8 +1,8 @@

 #undef  VERSION
 #define VERSION "5.2.0"
-#define BDATE   "22 October 2011"
-#define LSMDATE "22Oct11"
+#define BDATE   "23 October 2011"
+#define LSMDATE "23Oct11"

 #define PROG_COPYRIGHT "Copyright (C) %d-2011 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2011"       /* year for copyright messages in progs */


Add USE_LOCKMGR_SAFEKILL in version.h

Add USE_LOCKMGR_SAFEKILL in version.h

--- bacula/src/version.h
+++ bacula/src/version.h
@@ -81,6 +81,14 @@
  *  deadlock, so turn this on only for debugging.
  */
 #define USE_LOCKMGR_PRIORITY
+
+/*
+ * Enable thread verification before kill
+ *
+ * Note, this extra check have a high cost when using
+ * dozens of thread, so turn this only for debugging.
+ */
+/* #define USE_LOCKMGR_SAFEKILL */
 #endif  /* DEVELOPER */

 #if !HAVE_LINUX_OS && !HAVE_SUN_OS && !HAVE_DARWIN_OS && !HAVE_FREEBSD_OS


CORE-491: Announce EWM events related to connect/disconnect/sync.

--- ethereum/ewm/BREthereumEWM.c
+++ ethereum/ewm/BREthereumEWM.c
@@ -30,6 +30,17 @@
 // When using a BRD sync, offset the start block by N days of Ethereum blocks
 #define EWM_BRD_SYNC_START_BLOCK_OFFSET        (3 * 24 * 60 * 4)   /* 4 per minute (every 15 seconds) */

+// An ongoing sync is one that has a `end - beg` block difference of
+// EWM_BRD_SYNC_START_BLOCK_OFFSET or so (with some slop).  If the block difference is large
+// enough we'll transition to an EWM state of SYNCING; otherwise we'll consider the sync as an
+// ongoing sync (as when the blockchain is extended).
+static int
+ewmIsNotAnOngoingSync (BREthereumEWM ewm) {
+    return ewm->brdSync.endBlockNumber - ewm->brdSync.begBlockNumber >
+    (EWM_BRD_SYNC_START_BLOCK_OFFSET + EWM_BRD_SYNC_START_BLOCK_OFFSET/10);
+}
+
+
 #define EWM_INITIAL_SET_SIZE_DEFAULT         (25)

 /* Forward Declaration */
@@ -707,9 +718,13 @@

     ewmLock (ewm);

+    BREthereumEWMState oldState = ewm->state;
+    BREthereumEWMState newState = ewm->state;
+
     // Nothing to do if already connected
     if (ETHEREUM_BOOLEAN_IS_FALSE (ewmIsConnected(ewm))) {
-        // Set ewm {client,state} prior to bcs/event start.  Avoid race conditions, particularly
+
+         // Set ewm {client,state} prior to bcs/event start.  Avoid race conditions, particularly
         // with `ewmPeriodicDispatcher`.
         ewm->state = EWM_STATE_CONNECTED;

@@ -727,6 +742,14 @@
     }

     ewmUnlock (ewm);
+
+    if (oldState != newState)
+        ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+            EWM_EVENT_CHANGED,
+            SUCCESS,
+            { .changed = { oldState, newState }}
+        });
+
     return result;
 }

@@ -742,10 +765,40 @@

     ewmLock (ewm);

+    BREthereumEWMState oldState = ewm->state;
+    BREthereumEWMState newState = ewm->state;
+
     if (ETHEREUM_BOOLEAN_IS_TRUE (ewmIsConnected(ewm))) {
         // Set ewm->state thereby stopping handlers (in a race with bcs/event calls).
         ewm->state = EWM_STATE_DISCONNECTED;

+        // Stop an ongoing sync
+        switch (ewm->mode) {
+            case BRD_ONLY:
+            case BRD_WITH_P2P_SEND:
+                // If we are in the middle of a sync, the end it.
+                if (!ewm->brdSync.completedTransaction || !ewm->brdSync.completedLog) {
+
+                    // but only announce if it is not an 'ongoing' sync
+                    if (ewmIsNotAnOngoingSync(ewm)) {
+                        ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+                            EWM_EVENT_CHANGED,
+                            SUCCESS,
+                            { .changed = { EWM_STATE_SYNCING, EWM_STATE_CONNECTED }}
+                        });
+                        oldState = EWM_STATE_CONNECTED;
+                    }
+
+                    ewm->brdSync.begBlockNumber = 0;
+                    ewm->brdSync.endBlockNumber = ewm->blockHeight;
+                    ewm->brdSync.completedTransaction = 0;
+                    ewm->brdSync.completedLog = 0;
+                }
+                break;
+            default: break;
+        }
+
+        // Stop BCS
         switch (ewm->mode) {
             case BRD_ONLY:
                 break;
@@ -760,6 +813,14 @@
     }

     ewmUnlock(ewm);
+
+    if (oldState != newState)
+        ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+            EWM_EVENT_CHANGED,
+            SUCCESS,
+            { .changed = { oldState, newState }}
+        });
+
     return result;
 }

@@ -2283,6 +2344,13 @@

     // 1) check if the prior sync has completed.
     if (ewm->brdSync.completedTransaction && ewm->brdSync.completedLog) {
+        // If this was not an 'ongoing' sync, then signal back to 'connected'
+        if (ewmIsNotAnOngoingSync(ewm))
+            ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+                EWM_EVENT_CHANGED,
+                SUCCESS,
+                { .changed = { EWM_STATE_SYNCING, EWM_STATE_CONNECTED }}
+            });

         // 1a) if so, advance the sync range by updating `begBlockNumber`
         ewm->brdSync.begBlockNumber = (ewm->brdSync.endBlockNumber >=  EWM_BRD_SYNC_START_BLOCK_OFFSET
@@ -2296,6 +2364,14 @@
     // 3) if the `endBlockNumber` differs from the `begBlockNumber` then perform a 'sync'
     if (ewm->brdSync.begBlockNumber != ewm->brdSync.endBlockNumber) {

+        // If this is not an 'ongoing' sync, then signal 'syncing'
+        if (ewmIsNotAnOngoingSync(ewm))
+            ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+                EWM_EVENT_CHANGED,
+                SUCCESS,
+                { .changed = { EWM_STATE_CONNECTED, EWM_STATE_SYNCING }}
+            });
+
         // 3a) We'll query all transactions for this ewm's account.  That will give us a shot at
         // getting the nonce for the account's address correct.  We'll save all the transactions and
         // then process them into wallet as wallets exist.
@@ -2304,6 +2380,15 @@
         // Record an 'update transaction' as in progress
         ewm->brdSync.ridTransaction = ewm->requestId;
         ewm->brdSync.completedTransaction = 0;
+
+        // If this is not an 'ongoing' sync, then arbitrarily report progress - half way
+        // between transactions and logs
+        if (ewmIsNotAnOngoingSync(ewm))
+            ewmSignalEWMEvent (ewm, (BREthereumEWMEvent) {
+                EWM_EVENT_SYNC_PROGRESS,
+                SUCCESS,
+                { .syncProgress = { 50.0 }}
+            });

         // 3b) Similarly, we'll query all logs for this ewm's account.  We'll process these into
         // (token) transactions and associate with their wallet.


RStipples also activated for qt---------------------------------------------

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@12317 27541ba8-7e3a-0410-8455-c3a389f83636


branches/zip:

branches/zip:

Merge joerg@mysql.com-20100322150231-vdq0afbqtmbs6phy from BZR,

Including univ.i before mysql/plugin.h is needed to avoid this
compiler error:

o  This is how gcc puts it:
o  > > ccache /usr/local/gcc-4.3.2/bin/gcc -static-libgcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I./include -I../../sql -I. -I../../zlib    -g -O3 -march=i686   -DUNIV_LINUX -MT libinnobase_a-trx0i_s.o -MD -MP -MF .deps/libinnobase_a-trx0i_s.Tpo -c -o libinnobase_a-trx0i_s.o `test -f 'trx/trx0i_s.c' || echo './'`trx/trx0i_s.c
o  > > In file included from ./include/univ.i:114,
o  > >                  from trx/trx0i_s.c:36:
o  > > ../../include/my_pthread.h:628: error: expected ')' before '*' token
o  > > In file included from ../../include/my_pthread.h:732,
o  > >                  from ./include/univ.i:114,
o  > >                  from trx/trx0i_s.c:36:
o  > > ../../include/mysql/psi/mysql_thread.h:100: error: expected specifier-qualifier-list before 'pthread_rwlock_t'
o  > > ../../include/mysql/psi/mysql_thread.h:116: error: expected specifier-qualifier-list before 'pthread_rwlock_t'
o  > > ../../include/mysql/psi/mysql_thread.h: In function 'inline_mysql_rwlock_init':
o  > > ../../include/mysql/psi/mysql_thread.h:711: error: 'mysql_rwlock_t' has no member named 'm_psi'
o  > > ../../include/mysql/psi/mysql_thread.h:716: error: 'mysql_rwlock_t' has no member named 'm_rwlock'
o  > > .... ((continued))
o
o  Intel's icc gives slightly clearer messages:
o  > > icc -static-intel -static-libgcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I./include -I../../sql -I. -I../../zlib    -O3 -g -unroll2 -ip -mp -restrict -no-ftz -no-prefetch   -DUNIV_LINUX -MT libinnobase_a-trx0i_s.o -MD -MP -MF .deps/libinnobase_a-trx0i_s.Tpo -c -o libinnobase_a-trx0i_s.o `test -f 'trx/trx0i_s.c' || echo './'`trx/trx0i_s.c
o  > > ../../include/my_pthread.h(628): error: identifier "pthread_rwlock_t" is undefined
o  > >   extern int rw_pr_init(rw_pr_lock_t *);
o  > >                         ^
o  > >
o  > > ../../include/mysql/psi/mysql_thread.h(100): error: identifier "pthread_rwlock_t" is undefined
o  > >     rw_lock_t m_rwlock;
o  > >     ^
o  > >
o  > > ../../include/mysql/psi/mysql_thread.h(116): error: identifier "pthread_rwlock_t" is undefined
o  > >     rw_pr_lock_t m_prlock;
o  > >     ^

--- trx/trx0i_s.c
+++ trx/trx0i_s.c
@@ -28,11 +28,18 @@
 Created July 17, 2007 Vasil Dimov
 *******************************************************/

+/* Found during the build of 5.5.3 on Linux 2.4 and early 2.6 kernels:
+   The includes "univ.i" -> "my_global.h" cause a different path
+   to be taken further down with pthread functions and types,
+   so they must come first.
+   From the symptoms, this is related to bug#46587 in the MySQL bug DB.
+*/
+#include "univ.i"
+
 #include <mysql/plugin.h>

 #include "mysql_addons.h"

-#include "univ.i"
 #include "buf0buf.h"
 #include "dict0dict.h"
 #include "ha0storage.h"


Add a few more comments.

Add a few more comments.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@17349 27541ba8-7e3a-0410-8455-c3a389f83636

--- base/inc/TMathBase.h
+++ base/inc/TMathBase.h
@@ -1,4 +1,4 @@
-// @(#)root/base:$Name:  $:$Id: TMathBase.h,v 1.2 2007/01/15 14:27:07 brun Exp $
+// @(#)root/base:$Name:  $:$Id: TMathBase.h,v 1.3 2007/01/15 22:11:37 rdm Exp $
 // Authors: Rene Brun, Fons Rademakers   29/07/95

 /*************************************************************************
@@ -20,6 +20,9 @@
 // Define the functions Min, Max, Abs, Sign, Range for all types.       //
 // NB: These functions are unfortunately not available in a portable    //
 // way in std::.                                                        //
+//                                                                      //
+// More functions are defined in TMath.h. TMathBase.h is designed to be //
+// a stable file and used in place of TMath.h in the ROOT miniCore.     //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////


ocl_utilities ppcg

ocl_utilities ppcg

Former-commit-id: 03365dbad6810a3b44afc25ca0fc09eb9ab9e4a3

error: pathspec 'base/ocl_utilities.c' did not match any file(s) known to git

--- base/ocl_utilities.c
+++ base/ocl_utilities.c
@@ -0,0 +1,157 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined(__APPLE__)
+#include <OpenCL/opencl.h>
+#else
+#include <CL/opencl.h>
+#endif
+
+/* Find a GPU or a CPU associated with the first available platform.
+ * This function tries first to look for a GPU in the first available platform,
+ * if it fails, it tries to use CPU.
+ */
+cl_device_id opencl_create_device()
+{
+	cl_platform_id platform;
+	cl_device_id dev;
+	int err;
+
+	err = clGetPlatformIDs(1, &platform, NULL);
+	if (err < 0) {
+		fprintf(stderr, "Could not find a platform.\n");
+		exit(1);
+	}
+
+	err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &dev, NULL);
+	if (err == CL_DEVICE_NOT_FOUND)
+		err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 1, &dev,
+				NULL);
+	if (err < 0) {
+		fprintf(stderr, "Error while looking for a device.\n");
+		exit(1);
+	}
+	return dev;
+}
+
+/* Create an OpenCL program from a source file and compile it.
+ */
+cl_program opencl_build_program(cl_context ctx, cl_device_id dev,
+	const char* filename, const char* opencl_options)
+{
+	cl_program program;
+	FILE *program_file;
+	char *program_source, *program_log;
+	size_t program_size, log_size, read;
+	int err;
+
+	program_file = fopen(filename, "r");
+	if (program_file == NULL) {
+		fprintf(stderr, "Could not find the source file.\n");
+		exit(1);
+	}
+	fseek(program_file, 0, SEEK_END);
+	program_size = ftell(program_file);
+	rewind(program_file);
+	program_source = (char *) malloc(program_size + 1);
+	program_source[program_size] = '\0';
+	read = fread(program_source, sizeof(char), program_size, program_file);
+	if (read != program_size) {
+		fprintf(stderr, "Error while reading the kernel.\n");
+		exit(1);
+	}
+	fclose(program_file);
+
+	program = clCreateProgramWithSource(ctx, 1,
+		(const char **)&program_source, &program_size, &err);
+	if (err < 0) {
+		fprintf(stderr, "Could not create the program\n");
+		exit(1);
+	}
+	free(program_source);
+	err = clBuildProgram(program, 0, NULL, opencl_options, NULL, NULL);
+	if (err < 0) {
+		fprintf(stderr, "Could not build the program.\n");
+		clGetProgramBuildInfo(program, dev, CL_PROGRAM_BUILD_LOG, 0,
+				NULL, &log_size);
+		program_log = (char *) malloc(log_size + 1);
+		program_log[log_size] = '\0';
+		clGetProgramBuildInfo(program, dev, CL_PROGRAM_BUILD_LOG,
+				log_size + 1, program_log, NULL);
+		fprintf(stderr, "%s\n", program_log);
+		free(program_log);
+		exit(1);
+	}
+	return program;
+}
+
+/* Return the OpenCL error string for a given error number.
+ */
+const char *opencl_error_string(cl_int error)
+{
+	int errorCount;
+	int index;
+
+	static const char *errorString[] = {
+		[CL_SUCCESS] = "CL_SUCCESS",
+		[-CL_DEVICE_NOT_FOUND] = "CL_DEVICE_NOT_FOUND",
+		[-CL_DEVICE_NOT_AVAILABLE] = "CL_DEVICE_NOT_AVAILABLE",
+		[-CL_COMPILER_NOT_AVAILABLE] = "CL_COMPILER_NOT_AVAILABLE",
+		[-CL_MEM_OBJECT_ALLOCATION_FAILURE] =
+			"CL_MEM_OBJECT_ALLOCATION_FAILURE",
+		[-CL_OUT_OF_RESOURCES] = "CL_OUT_OF_RESOURCES",
+		[-CL_OUT_OF_HOST_MEMORY] = "CL_OUT_OF_HOST_MEMORY",
+		[-CL_PROFILING_INFO_NOT_AVAILABLE] =
+			"CL_PROFILING_INFO_NOT_AVAILABLE",
+		[-CL_MEM_COPY_OVERLAP] = "CL_MEM_COPY_OVERLAP",
+		[-CL_IMAGE_FORMAT_MISMATCH] = "CL_IMAGE_FORMAT_MISMATCH",
+		[-CL_IMAGE_FORMAT_NOT_SUPPORTED] =
+			"CL_IMAGE_FORMAT_NOT_SUPPORTED",
+		[-CL_BUILD_PROGRAM_FAILURE] = "CL_BUILD_PROGRAM_FAILURE",
+		[-CL_MAP_FAILURE] = "CL_MAP_FAILURE",
+		[-CL_INVALID_VALUE] = "CL_INVALID_VALUE",
+		[-CL_INVALID_DEVICE_TYPE] = "CL_INVALID_DEVICE_TYPE",
+		[-CL_INVALID_PLATFORM] = "CL_INVALID_PLATFORM",
+		[-CL_INVALID_DEVICE] = "CL_INVALID_DEVICE",
+		[-CL_INVALID_CONTEXT] = "CL_INVALID_CONTEXT",
+		[-CL_INVALID_QUEUE_PROPERTIES] = "CL_INVALID_QUEUE_PROPERTIES",
+		[-CL_INVALID_COMMAND_QUEUE] = "CL_INVALID_COMMAND_QUEUE",
+		[-CL_INVALID_HOST_PTR] = "CL_INVALID_HOST_PTR",
+		[-CL_INVALID_MEM_OBJECT] = "CL_INVALID_MEM_OBJECT",
+		[-CL_INVALID_IMAGE_FORMAT_DESCRIPTOR] =
+			"CL_INVALID_IMAGE_FORMAT_DESCRIPTOR",
+		[-CL_INVALID_IMAGE_SIZE] = "CL_INVALID_IMAGE_SIZE",
+		[-CL_INVALID_SAMPLER] = "CL_INVALID_SAMPLER",
+		[-CL_INVALID_BINARY] = "CL_INVALID_BINARY",
+		[-CL_INVALID_BUILD_OPTIONS] = "CL_INVALID_BUILD_OPTIONS",
+		[-CL_INVALID_PROGRAM] = "CL_INVALID_PROGRAM",
+		[-CL_INVALID_PROGRAM_EXECUTABLE] =
+			"CL_INVALID_PROGRAM_EXECUTABLE",
+		[-CL_INVALID_KERNEL_NAME] = "CL_INVALID_KERNEL_NAME",
+		[-CL_INVALID_KERNEL_DEFINITION] =
+			"CL_INVALID_KERNEL_DEFINITION",
+		[-CL_INVALID_KERNEL] = "CL_INVALID_KERNEL",
+		[-CL_INVALID_ARG_INDEX] = "CL_INVALID_ARG_INDEX",
+		[-CL_INVALID_ARG_VALUE] = "CL_INVALID_ARG_VALUE",
+		[-CL_INVALID_ARG_SIZE] = "CL_INVALID_ARG_SIZE",
+		[-CL_INVALID_KERNEL_ARGS] = "CL_INVALID_KERNEL_ARGS",
+		[-CL_INVALID_WORK_DIMENSION] = "CL_INVALID_WORK_DIMENSION",
+		[-CL_INVALID_WORK_GROUP_SIZE] = "CL_INVALID_WORK_GROUP_SIZE",
+		[-CL_INVALID_WORK_ITEM_SIZE] = "CL_INVALID_WORK_ITEM_SIZE",
+		[-CL_INVALID_GLOBAL_OFFSET] = "CL_INVALID_GLOBAL_OFFSET",
+		[-CL_INVALID_EVENT_WAIT_LIST] = "CL_INVALID_EVENT_WAIT_LIST",
+		[-CL_INVALID_EVENT] = "CL_INVALID_EVENT",
+		[-CL_INVALID_OPERATION] = "CL_INVALID_OPERATION",
+		[-CL_INVALID_GL_OBJECT] = "CL_INVALID_GL_OBJECT",
+		[-CL_INVALID_BUFFER_SIZE] = "CL_INVALID_BUFFER_SIZE",
+		[-CL_INVALID_MIP_LEVEL] = "CL_INVALID_MIP_LEVEL",
+		[-CL_INVALID_GLOBAL_WORK_SIZE] = "CL_INVALID_GLOBAL_WORK_SIZE",
+		[-CL_INVALID_PROPERTY] = "CL_INVALID_PROPERTY"
+	};
+
+	errorCount = sizeof(errorString) / sizeof(errorString[0]);
+	index = -error;
+
+	return (index >= 0 && index < errorCount) ?
+		errorString[index] : "Unspecified Error";
+}


fixed template syntax

fixed template syntax

--- Engine/Source/Core/Renderer/PM/TSPPMRadianceEvaluator.h
+++ Engine/Source/Core/Renderer/PM/TSPPMRadianceEvaluator.h
@@ -226,7 +226,7 @@
 	}
 	tauM.mulLocal(m_viewpoint->template get<EViewpointData::VIEW_THROUGHPUT>());

-	const SpectralStrength tauN   = m_viewpoint->get<EViewpointData::TAU>();
+	const SpectralStrength tauN   = m_viewpoint->template get<EViewpointData::TAU>();
 	const SpectralStrength newTau = (N + M) != 0.0_r ? (tauN + tauM) * (newN / (N + M)) : SpectralStrength(0);

 	m_viewpoint->template set<EViewpointData::RADIUS>(newR);


demo: remove gtk_adjustment_value_changed()

I do not remember what is the purpose of the stripped code, if any.
Removed as it seems to be a no-op.

--- demo/adg-demo.c
+++ demo/adg-demo.c
@@ -400,11 +400,6 @@
     g_object_ref(widget);
     g_hash_table_insert(part->widgets, data, widget);

-    if (GTK_IS_SPIN_BUTTON(widget)) {
-        GtkSpinButton *spin_button = GTK_SPIN_BUTTON(widget);
-        gtk_adjustment_value_changed(gtk_spin_button_get_adjustment(spin_button));
-    }
-
     edit_signal = GTK_IS_TOGGLE_BUTTON(widget) ? "toggled" : "changed";
     g_signal_connect_swapped(widget, edit_signal,
                              G_CALLBACK(_adg_part_unlock), part);


created testcases for parallel states handling tests - some still fail due to incomplete implementation

--- TestScenarios/test-c/Test_ParallelRegions/main.c
+++ TestScenarios/test-c/Test_ParallelRegions/main.c
@@ -313,11 +313,11 @@
 	/*@Desc: run an explicit cycle */
 	test_ParallelRegionsStatemachine_runCycle(&machine);

-	/*@Desc: check the initial state at position 0 to be State3 */
+	/*@Desc: check the initial state at position 0 to be State5 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)), "State5") == 0);

-	/*@Desc: check the initial state at position 1 to be no State */
+	/*@Desc: check the initial state at position 1 to be State9 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 1)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 1)), "State9") == 0);

@@ -363,15 +363,15 @@
 	/*@Desc: run an explicit cycle */
 	test_ParallelRegionsStatemachine_runCycle(&machine);

-	/*@Desc: check the initial state at position 0 to be State3 */
+	/*@Desc: check the initial state at position 0 to be State6 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)), "State6") == 0);

-	/*@Desc: check the initial state at position 1 to be no State */
+	/*@Desc: check the initial state at position 1 to be State9 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 1)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 1)), "State9") == 0);

-	/*@Desc: check the initial state at position 2 to be State7 */
+	/*@Desc: check the initial state at position 2 to be State8 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 2)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 2)), "State8") == 0);

@@ -408,7 +408,7 @@
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 0)), "State3") == 0);

-	/*@Desc: check the initial state at position 0 to be State3 */
+	/*@Desc: check the initial state at position 0 to be State7 */
 	printf("%s\n", getStateString(statemachineBase_getState((StatemachineBase*)&machine, 2)));
 	assert( strcmp(getStateString(statemachineBase_getState((StatemachineBase*)&machine, 2)), "State7") == 0);


Handles stat(), lstat()

Handles stat(), lstat()

--- reprozip/native/tracer.c
+++ reprozip/native/tracer.c
@@ -208,6 +208,35 @@
             if(db_add_file_open(process->identifier,
                                 pathname,
                                 mode) != 0)
+                return -1;
+        }
+        free(pathname);
+    }
+    /* ********************
+     * stat(), lstat()
+     */
+    else if(process->in_syscall && (syscall == SYS_stat ||
+                                    syscall == SYS_lstat) )
+    {
+        char *pathname = tracee_strdup(pid, (void*)process->params[0]);
+        if(pathname[0] != '/')
+        {
+            char *oldpath = pathname;
+            pathname = abspath(process->wd, oldpath);
+            free(oldpath);
+        }
+#ifdef DEBUG
+        fprintf(stderr, "%s(\"%s\") = %d (%s)\n",
+                (syscall == SYS_stat)?"stat":"lstat",
+                pathname,
+                (int)process->retvalue,
+                (process->retvalue >= 0)?"success":"failure");
+#endif
+        if(process->retvalue >= 0)
+        {
+            if(db_add_file_open(process->identifier,
+                                pathname,
+                                FILE_STAT) != 0)
                 return -1;
         }
         free(pathname);


r6059/sofa-dev :

r6059/sofa-dev :

--- modules/sofa/component/constraint/PrecomputedConstraintCorrection.h
+++ modules/sofa/component/constraint/PrecomputedConstraintCorrection.h
@@ -28,6 +28,8 @@
 #include <sofa/core/componentmodel/behavior/BaseConstraintCorrection.h>
 #include <sofa/core/componentmodel/behavior/MechanicalState.h>
 #include <sofa/component/forcefield/TetrahedronFEMForceField.h>
+#include <sofa/component/forcefield/TriangularFEMForceField.h>
+#include <sofa/component/forcefield/TetrahedralCorotationalFEMForceField.h>

 #include <sofa/component/linearsolver/FullMatrix.h>
 #include <sofa/defaulttype/Mat.h>
@@ -131,8 +133,8 @@
         return DataTypes::Name();
     }

-
-protected:
+//protected:
+public:
     behavior::MechanicalState<DataTypes> *mstate;

     struct InverseStorage
@@ -143,7 +145,7 @@
     };
     std::string invName;
     InverseStorage* invM;
-    const Real* appCompliance;
+    Real* appCompliance;
     unsigned int dimensionAppCompliance;

     static std::map<std::string, InverseStorage>& getInverseMap()
@@ -183,6 +185,16 @@
     sofa::helper::vector<unsigned int>* localConstraintId;
     linearsolver::FullMatrix<Real> localW;
     double* constraint_force;
+
+public:
+    Real* getInverse()
+    {
+        if(invM->data)
+            return invM->data;
+        else
+            serr<<"Inverse is not computed yet"<<sendl;
+        return NULL;
+    }

 };


more fixes for split multicast socket case

--- ccnd/udplink/udplink.c
+++ ccnd/udplink/udplink.c
@@ -217,16 +217,12 @@
             memcpy((void *)&mreq.imr_interface.s_addr, &((struct sockaddr_in *)options->multicastaddrinfo->ai_addr)->sin_addr, sizeof(mreq.imr_interface.s_addr));
         }
         result = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
-        if (result == -1) {
-            udplink_fatal("setsockopt(..., IP_ADD_MEMBERSHIP, ...): %s\n", strerror(errno));
-        }
+        if (result == -1) udplink_fatal("setsockopt(..., IP_ADD_MEMBERSHIP, ...): %s\n", strerror(errno));
 #endif
 #ifdef IP_MULTICAST_LOOP
         csockopt = 0;
         result = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_LOOP, &csockopt, sizeof(csockopt));
-        if (result == -1) {
-            udplink_fatal("setsockopt(..., IP_MULTICAST_LOOP, ...): %s\n", strerror(errno));
-        }
+        if (result == -1) udplink_fatal("setsockopt(..., IP_MULTICAST_LOOP, ...): %s\n", strerror(errno));
 #endif
 #ifdef IP_MULTICAST_TTL
         if (options->multicastttl > 0) {
@@ -286,9 +282,9 @@
 int
 main (int argc, char * const argv[]) {
     int result;
-    int localsock = 0;
-    int remotesock = 0;
-    int remotesock_multirecv = 0;
+    int localsock_rw = 0;
+    int remotesock_w = 0;
+    int remotesock_r = 0;
     char canonical_remote[NI_MAXHOST] = "";
     struct addrinfo *raddrinfo = NULL;
     struct addrinfo *laddrinfo = NULL;
@@ -317,8 +313,8 @@

     /* connect to the local ccn socket */
     ccn = ccn_create();
-    localsock = ccn_connect(ccn, options.localsockname);
-    if (localsock == -1) {
+    localsock_rw = ccn_connect(ccn, options.localsockname);
+    if (localsock_rw == -1) {
         udplink_fatal("ccn_connect: %s\n", strerror(errno));
     }

@@ -336,11 +332,14 @@

     getnameinfo(raddrinfo->ai_addr, raddrinfo->ai_addrlen, canonical_remote, sizeof(canonical_remote), NULL, 0, 0);

-    remotesock = socket(raddrinfo->ai_family, raddrinfo->ai_socktype, 0);
-    if (remotesock == -1) {
+    remotesock_r = socket(raddrinfo->ai_family, raddrinfo->ai_socktype, 0);
+    if (remotesock_r == -1) {
         udplink_fatal("socket: %s\n", strerror(errno));
     }
-
+    result = setsockopt(remotesock_r, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+    if (result == -1) {
+        udplink_fatal("setsockopt(remotesock_r, ..., SO_REUSEADDR, ...): %s\n", strerror(errno));
+    }
     hints.ai_family = raddrinfo->ai_family;
     hints.ai_flags = AI_PASSIVE;
 #ifdef AI_NUMERICSERV
@@ -350,55 +349,46 @@
     if (result != 0 || laddrinfo == NULL) {
         udplink_fatal("getaddrinfo(NULL, %s, ...): %s\n", options.localport, gai_strerror(result));
     }
-
     if (options.multicastaddrinfo != NULL) {
 	/* We have a specific interface to bind to.  multicastaddrinfo
- 	   is actually the unicast ipv4 address of this interface.
-           In this case, we need a separate socket for receiving the multicast packets */
-        result = setsockopt(remotesock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+ 	   is actually the unicast ipv4 address of this interface. */
+
+        remotesock_w = socket(raddrinfo->ai_family, raddrinfo->ai_socktype, 0);
+        if (remotesock_w == -1) {
+            udplink_fatal("socket: %s\n", strerror(errno));
+        }
+	result = bind(remotesock_w, options.multicastaddrinfo->ai_addr, options.multicastaddrinfo->ai_addrlen);
         if (result == -1) {
-            udplink_fatal("setsockopt(remotesock, ..., SO_REUSEADDR, ...): %s\n", strerror(errno));
-        }
-        remotesock_multirecv = socket(raddrinfo->ai_family, raddrinfo->ai_socktype, 0);
-        if (remotesock_multirecv == -1) {
-            udplink_fatal("socket: %s\n", strerror(errno));
-        }
-        result = bind(remotesock_multirecv, laddrinfo->ai_addr, laddrinfo->ai_addrlen);
-        if (result == -1) {
-            udplink_fatal("bind(remotesock_multirecv, local...): %s\n", strerror(errno));
-        }
-	result = bind(remotesock, options.multicastaddrinfo->ai_addr, options.multicastaddrinfo->ai_addrlen);
-    } else {
-	/* Default case with no specific interface: bind to laddrinfo
-           address obtained above, which should be unspecific network
-           address based on AI_PASSIVE hint */
-        result = bind(remotesock, laddrinfo->ai_addr, laddrinfo->ai_addrlen);
-    }
+            udplink_fatal("bind(remotesock_w, local...): %s\n", strerror(errno));
+        }
+
+    }
+    result = bind(remotesock_r, laddrinfo->ai_addr, laddrinfo->ai_addrlen);
     if (result == -1) {
-        udplink_fatal("bind(remotesock, local...): %s\n", strerror(errno));
+        udplink_fatal("bind(remotesock_r, local...): %s\n", strerror(errno));
     }

     udplink_note("connected to %s:%s\n", canonical_remote, options.remoteport);

-    set_multicast_sockopt(remotesock, raddrinfo, &options);
+    set_multicast_sockopt(remotesock_r, raddrinfo, &options);

     /* announce our presence to ccnd and request CCN PDU encapsulation */
-    result = send(localsock, CCN_EMPTY_PDU, CCN_EMPTY_PDU_LENGTH, 0);
+    result = send(localsock_rw, CCN_EMPTY_PDU, CCN_EMPTY_PDU_LENGTH, 0);
     if (result == -1) {
         udplink_fatal("initial send: %s\n", strerror(errno));
     }

     charbuf = ccn_charbuf_create();

-    fds[0].fd = localsock;
+    fds[0].fd = localsock_rw;
     fds[0].events = POLLIN;
-    if (remotesock_multirecv != 0) {
-        fds[1].fd = remotesock_multirecv;
+    if (remotesock_r != 0) {
+        fds[1].fd = remotesock_r;
         fds[1].events = POLLIN;
     } else {
         /* no need to split the sockets for send and receive */
-        remotesock_multirecv = remotesock;
-        fds[1].fd = remotesock;
+        remotesock_w = remotesock_r;
+        fds[1].fd = remotesock_r;
         fds[1].events = POLLIN;
     }
     for (;;) {
@@ -412,7 +402,7 @@
             fds[1].events |= POLLIN;
             fds[0].events &= ~POLLOUT;
             if (deferredlen > 0) {
-                result = send(localsock, deferredbuf, deferredlen, 0);
+                result = send(localsock_rw, deferredbuf, deferredlen, 0);
                 if (result != deferredlen && options.logging > 1)
                     udplink_note("sendto(local, deferredbuf, %ld): %s (deferred)\n", (long) deferredlen, strerror(errno));
                 deferredlen = 0;
@@ -425,10 +415,10 @@
             if (charbuf->length == 0) {
                 memset(ld, 0, sizeof(*ld));
             }
-            recvlen = recv(localsock, lbuf , charbuf->limit - charbuf->length, 0);
+            recvlen = recv(localsock_rw, lbuf , charbuf->limit - charbuf->length, 0);
             if (recvlen == -1) {
                 if (errno == EAGAIN) continue;
-                udplink_fatal("recv(localsock, ...): %s\n", strerror(errno));
+                udplink_fatal("recv(localsock_rw, ...): %s\n", strerror(errno));
             }
             if (recvlen == 0) {
                 break;
@@ -439,10 +429,10 @@
                 if (options.logging > 1) {
                     udplink_print_data("local", charbuf->buf, msgstart, ld->index - msgstart);
                 }
-                result = send_remote_unencapsulated(remotesock, raddrinfo, charbuf->buf, msgstart, ld->index - msgstart);
+                result = send_remote_unencapsulated(remotesock_w, raddrinfo, charbuf->buf, msgstart, ld->index - msgstart);
                 if (result == -1) {
                     if (errno == EAGAIN) continue;
-                    udplink_fatal("sendto(remotesock, rbuf, %ld): %s\n", (long)ld->index - msgstart, strerror(errno));
+                    udplink_fatal("sendto(remotesock_w, rbuf, %ld): %s\n", (long)ld->index - msgstart, strerror(errno));
                 }
                 else if (result == -2) {
                     udplink_note("protocol error, missing CCN PDU encapsulation. Message dropped\n");
@@ -479,7 +469,7 @@

             memmove(rbuf, CCN_EMPTY_PDU, CCN_EMPTY_PDU_LENGTH - 1);
             recvbuf = &rbuf[CCN_EMPTY_PDU_LENGTH - 1];
-            recvlen = recvfrom(remotesock_multirecv, recvbuf, sizeof(rbuf) - CCN_EMPTY_PDU_LENGTH,
+            recvlen = recvfrom(remotesock_r, recvbuf, sizeof(rbuf) - CCN_EMPTY_PDU_LENGTH,
                                0, &from, &fromlen);
             if (options.logging > 0) {
                 if (from.sa_family == AF_INET) {
@@ -502,7 +492,7 @@
                 continue;
             }

-            result = send(localsock, rbuf, recvlen + CCN_EMPTY_PDU_LENGTH, 0);
+            result = send(localsock_rw, rbuf, recvlen + CCN_EMPTY_PDU_LENGTH, 0);
             if (result == -1) {
                 if (errno == EAGAIN) {
                     fds[1].events &= ~POLLIN;
@@ -511,10 +501,10 @@
                     deferredlen = recvlen + CCN_EMPTY_PDU_LENGTH;
                     memcpy(deferredbuf, rbuf, deferredlen);
                     if (options.logging > 0)
-                        udplink_note("sendto(localsock, rbuf, %ld): %s (deferred)\n", (long) deferredlen, strerror(errno));
+                        udplink_note("sendto(localsock_rw, rbuf, %ld): %s (deferred)\n", (long) deferredlen, strerror(errno));
                     continue;
                 } else {
-                    udplink_fatal("sendto(localsock, rbuf, %ld): %s\n", (long) recvlen + CCN_EMPTY_PDU_LENGTH, strerror(errno));
+                    udplink_fatal("sendto(localsock_rw, rbuf, %ld): %s\n", (long) recvlen + CCN_EMPTY_PDU_LENGTH, strerror(errno));
                 }
             }
             if (result != recvlen + CCN_EMPTY_PDU_LENGTH) abort();


fix comment about default PSM

fix comment about default PSM

--- ccstruct/publictypes.h
+++ ccstruct/publictypes.h
@@ -153,11 +153,11 @@
   PSM_AUTO_OSD,       ///< Automatic page segmentation with orientation and
                       ///< script detection. (OSD)
   PSM_AUTO_ONLY,      ///< Automatic page segmentation, but no OSD, or OCR.
-  PSM_AUTO,           ///< Fully automatic page segmentation, but no OSD.
+  PSM_AUTO,           ///< Fully automatic page segmentation, but no OSD. (Default)
   PSM_SINGLE_COLUMN,  ///< Assume a single column of text of variable sizes.
   PSM_SINGLE_BLOCK_VERT_TEXT,  ///< Assume a single uniform block of vertically
                                ///< aligned text.
-  PSM_SINGLE_BLOCK,   ///< Assume a single uniform block of text. (Default.)
+  PSM_SINGLE_BLOCK,   ///< Assume a single uniform block of text.
   PSM_SINGLE_LINE,    ///< Treat the image as a single text line.
   PSM_SINGLE_WORD,    ///< Treat the image as a single word.
   PSM_CIRCLE_WORD,    ///< Treat the image as a single word in a circle.


cogl-atlas-texture: Don't create atlas textures with the premult bit

Previously the atlas textures were being created with whatever format
the first sub texture is in. Only three formats are supported so this
only matters if the first texture is a premultiplied alpha
texture. Instead it now masks out the premultiplied bit so that the
textures are always either RGB_888 or RGBA_8888.

--- cogl/cogl-atlas-texture.c
+++ cogl/cogl-atlas-texture.c
@@ -1015,7 +1015,8 @@
   atlas_tex->rectangle.height = upload_data.bitmap.height + 2;

   /* Try to make some space in the atlas for the texture */
-  if (!_cogl_atlas_texture_reserve_space (internal_format,
+  if (!_cogl_atlas_texture_reserve_space (internal_format &
+                                          ~COGL_PREMULT_BIT,
                                           atlas_ptr,
                                           atlas_tex_ptr,
                                           atlas_tex,


bitmap-pixbuf: Fix the bitmap loader on Quartz

The code for loading a CoglBitmap from a file was missed when
upgrading to the new cogl_bitmap_new_for_data function in commit
d18b59d9e6 so it wouldn't compile. This changes it to use
_cogl_bitmap_new_with_malloc_buffer to allocate the buffer.

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

Reviewed-by: Robert Bragg <12e9293ec6b30c7fa8a0926af42807e929c1684f@linux.intel.com>

--- cogl/cogl-bitmap-pixbuf.c
+++ cogl/cogl-bitmap-pixbuf.c
@@ -68,6 +68,9 @@
   guint8 *out_data;
   CGColorSpaceRef color_space;
   CGContextRef bitmap_context;
+  CoglBitmap *bmp;
+
+  _COGL_GET_CONTEXT (ctx, NULL);

   g_assert (filename != NULL);
   g_assert (error == NULL || *error == NULL);
@@ -123,8 +126,13 @@
     }

   /* allocate buffer big enough to hold pixel data */
-  rowstride = 4 * width;
-  out_data = g_malloc0 (height * rowstride);
+  bmp = _cogl_bitmap_new_with_malloc_buffer (ctx,
+                                             width, height,
+                                             COGL_PIXEL_FORMAT_ARGB_8888);
+  rowstride = cogl_bitmap_get_rowstride (bmp);
+  out_data = _cogl_bitmap_map (bmp,
+                               COGL_BUFFER_ACCESS_WRITE,
+                               COGL_BUFFER_MAP_HINT_DISCARD);

   /* render to buffer */
   color_space = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
@@ -143,13 +151,10 @@
   CGImageRelease (image);
   CGContextRelease (bitmap_context);

+  _cogl_bitmap_unmap (bmp);
+
   /* store bitmap info */
-  return _cogl_bitmap_new_from_data (out_data,
-                                     COGL_PIXEL_FORMAT_ARGB_8888,
-                                     width, height,
-                                     rowstride,
-                                     (CoglBitmapDestroyNotify) g_free,
-                                     NULL);
+  return bmp;
 }

 #elif defined(USE_GDKPIXBUF)


actually set the filename, so we can play this thing

--- vivified/ui/main.c
+++ vivified/ui/main.c
@@ -44,6 +44,7 @@
   ViviApplication *app;

   app = vivi_application_new ();
+  vivi_application_set_filename (app, filename);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   box = vivi_vdock_new ();
   gtk_container_add (GTK_CONTAINER (window), box);


set a somewhat sane default size

set a somewhat sane default size

--- vivified/ui/main.c
+++ vivified/ui/main.c
@@ -67,6 +67,7 @@
   vivi_application_set_filename (app, filename);
   vivi_application_set_variables (app, variables);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_default_size (GTK_WINDOW (window), 400, 450);
   g_signal_connect_swapped (app, "notify::quit", G_CALLBACK (gtk_widget_destroy), window);
   g_signal_connect (app, "notify::filename", G_CALLBACK (set_title), window);
   set_title (app, NULL, GTK_WINDOW (window));


Fix build fail.

Fix build fail.

Signed-off-by: Eric Dong <eric.dong@intel.com>

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@13697 6f19259b-4bc3-4df7-8a09-765794883524

--- ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
+++ ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
@@ -32,7 +32,7 @@
   IN CONST UINT32 Atts
   )
 {
-  UINT32 BufLen;
+  UINTN  BufLen;
   CHAR16 *RetString;

   BufLen      = 0;


Share the trace session start logic used for kernel tracing.

Now we autostart the user traces we're interested in as well.

--- src/pmdas/etw/tdhconsume.c
+++ src/pmdas/etw/tdhconsume.c
@@ -21,6 +21,8 @@
 #include <inttypes.h>
 #include "util.h"

+#define MAX_SESSIONS	64
+
 USHORT globalPointerSize;	/* TODO: make local & on-stack */

 /* Get the event metadata */
@@ -630,54 +632,84 @@
 	free(pInfo);
 }

-static TRACEHANDLE kernelSession = INVALID_PROCESSTRACE_HANDLE;
-static EVENT_TRACE_PROPERTIES *kernelProperties;
+static struct {
+    EVENT_TRACE_PROPERTIES *properties;
+    TRACEHANDLE session;
+    LPTSTR name;
+} sessions[MAX_SESSIONS];
+static int sCount;
+
+static void
+stopSession(TRACEHANDLE session, LPTSTR name,
+	    PEVENT_TRACE_PROPERTIES properties)
+{
+    if (session != INVALID_PROCESSTRACE_HANDLE) {
+	    ULONG sts = ControlTrace(session, name, properties,
+				EVENT_TRACE_CONTROL_STOP);
+	if (sts != ERROR_SUCCESS)
+	    fprintf(stderr, "ControlTrace failed (%s): %s\n", name,
+		    tdherror(sts));
+	else
+	    fprintf(stderr, "Stopped %s event tracing session\n", name);
+    }
+}
+
+static void __attribute__((constructor)) initTracing()
+{
+    int	i;
+
+    for (i = 0; i < sizeof(sessions) / sizeof(sessions[0]); i++)
+	sessions[i].session = INVALID_PROCESSTRACE_HANDLE;
+}

 static void __attribute__((destructor)) stopTracing()
 {
-    int	sts;
-
-    if (kernelSession != INVALID_PROCESSTRACE_HANDLE) {
-	sts = ControlTrace(kernelSession, KERNEL_LOGGER_NAME,
-			    kernelProperties, EVENT_TRACE_CONTROL_STOP);
-	if (sts != ERROR_SUCCESS)
-	    fprintf(stderr, "ControlTrace failed: %s\n", tdherror(sts));
-	fprintf(stderr, "Stopped kernel event tracing session\n");
-    } else {
-	fprintf(stderr, "No kernel event tracing session to stop\n");
-    }
+    int	i;
+
+    for (i = 0; i < sCount; i++)
+	stopSession(sessions[i].session, sessions[i].name, sessions[i].properties);
 }

 void
-enableKernelTrace(ULONG enableFlags, BOOL useGlobalSequence)
-{
+enableEventTrace(LPTSTR name, ULONG namelen, const GUID *guid,
+		 ULONG enableFlags, BOOL useGlobalSequence)
+{
+    TRACEHANDLE session;
+    EVENT_TRACE_PROPERTIES *properties;
     ULONG size, sts = ERROR_SUCCESS;
     int retryStartTrace = 0;

-    size = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(KERNEL_LOGGER_NAME);
-    kernelProperties = malloc(size);
-    if (kernelProperties == NULL) {
+    size = sizeof(EVENT_TRACE_PROPERTIES) + namelen;
+    properties = malloc(size);
+    if (properties == NULL) {
 	fprintf(stderr, "Insufficient memory: %lu bytes\n", size);
 	exit(1);
     }
+
+    sessions[sCount].properties = properties;
+    sessions[sCount].session = session;
+    sessions[sCount].name = name;
+    sCount++;
+
 retrySession:
-    ZeroMemory(kernelProperties, size);
-    kernelProperties->Wnode.BufferSize = size;
-    kernelProperties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
-    kernelProperties->Wnode.ClientContext = 1;
-    kernelProperties->Wnode.Guid = SystemTraceControlGuid;
-    kernelProperties->EnableFlags = enableFlags;
-    kernelProperties->LogFileMode = EVENT_TRACE_REAL_TIME_MODE;
+    ZeroMemory(properties, size);
+    properties->Wnode.BufferSize = size;
+    properties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
+    properties->Wnode.ClientContext = 1;
+    if (guid != NULL)
+	properties->Wnode.Guid = *(guid);
+    properties->EnableFlags = enableFlags;
+    properties->LogFileMode = EVENT_TRACE_REAL_TIME_MODE;
     if (useGlobalSequence == TRUE)
-	kernelProperties->LogFileMode |= EVENT_TRACE_USE_GLOBAL_SEQUENCE;
-    kernelProperties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
-
-    sts = StartTrace(&kernelSession, KERNEL_LOGGER_NAME, kernelProperties);
+	properties->LogFileMode |= EVENT_TRACE_USE_GLOBAL_SEQUENCE;
+    properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
+
+    sts = StartTrace(&session, name, properties);
     if (sts != ERROR_SUCCESS) {
 	if (retryStartTrace == 1) {
-	    fprintf(stderr, "Cannot start Kernel Logger session (in use)\n");
+	    fprintf(stderr, "Cannot start %s session (in use)\n", name);
 	} else if (sts == ERROR_ALREADY_EXISTS) {
-	    fprintf(stderr, "Kernel Logger session is in use - retry ...\n");
+	    fprintf(stderr, "%s session is in use - retry ...\n", name);
 	    stopTracing();
 	    retryStartTrace = 1;
 	    goto retrySession;
@@ -700,7 +732,6 @@
     eventsLost += mode->EventsLost;
     sysCount += mode->IsKernelTrace;
     bufferCount++;
-
     printf("Event BUFFER (size=%lu) all reads=%lu bytes=%lu lost=%lu sys=%lu\n",
 		mode->Filled, buffersRead, bufferBytes, eventsLost, sysCount);
     return TRUE;
@@ -739,9 +770,8 @@
 main(int argc, LPTSTR *argv)
 {
     BOOL useGlobalSequence = FALSE;
-    TRACEHANDLE handles[64];
-    ULONG sts, sysFlags = 0;
-    int hCount = 0;
+    TRACEHANDLE handles[MAX_SESSIONS];
+    ULONG sts, hCount = 0, sysFlags = 0;
     int c;

     while ((c = getopt(argc, argv, options)) != EOF) {
@@ -760,12 +790,17 @@
     }

     if (sysFlags) {
-	enableKernelTrace(sysFlags, useGlobalSequence);
+	enableEventTrace(KERNEL_LOGGER_NAME, sizeof(KERNEL_LOGGER_NAME),
+			 &SystemTraceControlGuid, sysFlags, useGlobalSequence);
 	handles[hCount++] = openTraceHandle(KERNEL_LOGGER_NAME);
+    } else if (optind == argc) {
+	fprintf(stderr, "No traces requested, exiting\n");
+	exit(0);
     }

     while (optind < argc) {
 	LPTSTR name = argv[optind++];
+	enableEventTrace(name, strlen(name)+1, NULL, 0, useGlobalSequence);
 	handles[hCount++] = openTraceHandle(name);
     }


Enable urlconv for cc2538

Enable urlconv for cc2538

--- examples/6lbr/project-conf.h
+++ examples/6lbr/project-conf.h
@@ -357,7 +357,7 @@

 #define WEBSERVER_CONF_CFS_PATHLEN 1000

-#define WEBSERVER_CONF_CFS_URLCONV	0
+#define WEBSERVER_CONF_CFS_URLCONV	1

 #define WEBSERVER_CONF_CFS_CONNS	1


Document on complex matrix power.

Document on complex matrix power.

--- unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
@@ -513,7 +513,7 @@
      * \brief Constructor.
      *
      * \param[in] A  %Matrix (expression), the base of the matrix power.
-     * \param[in] p  scalar, the exponent of the matrix power.
+     * \param[in] p  real scalar, the exponent of the matrix power.
      */
     MatrixPowerReturnValue(const Derived& A, RealScalar p) : m_A(A), m_p(p)
     { }
@@ -536,6 +536,19 @@
     const RealScalar m_p;
 };

+/**
+ * \ingroup MatrixFunctions_Module
+ *
+ * \brief Proxy for the matrix power of some matrix (expression).
+ *
+ * \tparam Derived  type of the base, a matrix (expression).
+ *
+ * This class holds the arguments to the matrix power until it is
+ * assigned or evaluated for some other reason (so the argument
+ * should not be changed in the meantime). It is the return type of
+ * MatrixBase::pow() and related functions and most of the
+ * time this is the only way it is used.
+ */
 template<typename Derived>
 class MatrixComplexPowerReturnValue : public ReturnByValue< MatrixComplexPowerReturnValue<Derived> >
 {
@@ -544,9 +557,24 @@
     typedef typename std::complex<typename Derived::RealScalar> ComplexScalar;
     typedef typename Derived::Index Index;

+    /**
+     * \brief Constructor.
+     *
+     * \param[in] A  %Matrix (expression), the base of the matrix power.
+     * \param[in] p  complex scalar, the exponent of the matrix power.
+     */
     MatrixComplexPowerReturnValue(const Derived& A, const ComplexScalar& p) : m_A(A), m_p(p)
     { }

+    /**
+     * \brief Compute the matrix power.
+     *
+     * Because \p p is complex, \f$ A^p \f$ is simply evaluated as \f$
+     * \exp(p \log(A)) \f$.
+     *
+     * \param[out] result  \f$ A^p \f$ where \p A and \p p are as in the
+     * constructor.
+     */
     template<typename ResultType>
     inline void evalTo(ResultType& res) const
     { res = (m_p * m_A.log()).exp(); }


Fix doc. (It is also used by computeFracPower)

--- unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
@@ -389,7 +389,7 @@
     /** \brief Reference to the base of matrix power. */
     typename MatrixType::Nested m_A;

-    /** \brief Temporary storage for computing integral power. */
+    /** \brief Temporary storage. */
     MatrixType m_tmp;

     /** \brief Store the result of Schur decomposition. */


Fix the new ARMv8 CRC code for short and unaligned input.

The code before the main loop, to handle the possible 1-7 unaligned bytes
at the beginning of the input, was broken, and read past the input, if the
the input was very short.

--- src/port/pg_crc32c_armv8.c
+++ src/port/pg_crc32c_armv8.c
@@ -29,17 +29,17 @@
 	 * significantly faster. Process leading bytes so that the loop below
 	 * starts with a pointer aligned to eight bytes.
 	 */
-	if (!PointerIsAligned(p, uint16) && p < pend)
+	if (!PointerIsAligned(p, uint16) && p + 1 <= pend)
 	{
 		crc = __crc32cb(crc, *p);
 		p += 1;
 	}
-	if (!PointerIsAligned(p, uint32) && p < pend)
+	if (!PointerIsAligned(p, uint32) && p + 2 <= pend)
 	{
 		crc = __crc32ch(crc, *(uint16 *) p);
 		p += 2;
 	}
-	if (!PointerIsAligned(p, uint64) && p < pend)
+	if (!PointerIsAligned(p, uint64) && p + 4 <= pend)
 	{
 		crc = __crc32cw(crc, *(uint32 *) p);
 		p += 4;


fixed tls recv bug

fixed tls recv bug

--- src/port/tls/wolfssl/tls.c
+++ src/port/tls/wolfssl/tls.c
@@ -71,6 +71,8 @@
 		// wolfSSL_ERR_error_string(err, buffer);
 		break;
 	    }
+	} else if (read == 0) {
+	    break;  // client did normal close
 	} else {
 	    read += bytes;
 	}


impl ppb_flash_fullscreen_get_screen_size

--- src/ppb_flash_fullscreen.c
+++ src/ppb_flash_fullscreen.c
@@ -23,8 +23,10 @@
  */

 #include "ppb_flash_fullscreen.h"
-#include <stddef.h>
+#include <stdlib.h>
 #include "trace.h"
+#include "tables.h"
+#include "pp_resource.h"

 PP_Bool
@@ -42,9 +44,16 @@
 PP_Bool
 ppb_flash_fullscreen_get_screen_size(PP_Instance instance, struct PP_Size *size)
 {
-    size->width = 1366;
-    size->height = 768;
-    return PP_TRUE;
+    struct pp_instance_s *pp_i = tables_get_pp_instance(instance);
+    XWindowAttributes xw_attrs;
+
+    if (XGetWindowAttributes(pp_i->dpy, DefaultRootWindow(pp_i->dpy), &xw_attrs)) {
+        size->width = xw_attrs.width;
+        size->height = xw_attrs.height;
+        return PP_TRUE;
+    }
+
+    return PP_FALSE;
 }

 // trace wrappers
@@ -68,7 +77,7 @@
 PP_Bool
 trace_ppb_flash_fullscreen_get_screen_size(PP_Instance instance, struct PP_Size *size)
 {
-    trace_info("[PPB] {fake} %s instance=%d\n", __func__+6, instance);
+    trace_info("[PPB] {full} %s instance=%d\n", __func__+6, instance);
     return ppb_flash_fullscreen_get_screen_size(instance, size);
 }


rsc: remove LATTICE support

rsc: remove LATTICE support

Change-Id: I904a6ec522ae4a97eefebf1f1ec6554e8e66747d

--- rsc/source/rscpp/cppdef.h
+++ rsc/source/rscpp/cppdef.h
@@ -35,7 +35,6 @@
  */
 #define SYS_UNKNOWN             0
 #define SYS_UNIX                1
-#define SYS_LATTICE             5
 #define SYS_ONYX                6
 #define SYS_68000               7

@@ -101,15 +100,6 @@
  *              which is to be searched *before* the operating-system
  *              specific directories.
  */
-
-#if TARGET == SYS_LATTICE
-/*
- * We assume the operating system is pcdos for the IBM-PC.
- * We also assume the small model (just like the PDP-11)
- */
-#define MACHINE                 "i8086"
-#define SYSTEM                  "pcdos"
-#endif

 #if TARGET == SYS_ONYX
 #define MACHINE                 "z8000"


[pirc/new] add another error check; errors can occur during code generation. (not that we're generating code yet, for those who are wondering... just printing them)

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

--- compilers/pirc/new/main.c
+++ compilers/pirc/new/main.c
@@ -159,7 +159,9 @@
             check_unused_symbols(lexer);

     }
-    else
+
+    /* there may have been errors during the instruction generation, check again here. */
+    if (lexer->parse_errors > 0)
         fprintf(stderr, "There were %d errors\n", lexer->parse_errors);

     fclose(infile);


solved conflict with c323d83234279b78ee3a9ed6b5b27492aee93add

--- userland/snort/pfring-daq-module-zc/daq_pfring_zc.c
+++ userland/snort/pfring-daq-module-zc/daq_pfring_zc.c
@@ -325,7 +325,7 @@
     } else if (!strcmp(entry->key, "bindcpu")) {
       char *end = entry->value;
       context->bindcpu = (int) strtol(entry->value, &end, 0);
-      if(*end
+      if (*end
 	 || (context->bindcpu >= numCPU)) {
 	snprintf(errbuf, len, "%s: bad bindcpu(%s)\n", __FUNCTION__, entry->value);
 	return DAQ_ERROR;
@@ -381,7 +381,7 @@
     context->num_devices = 0;

     twins = strtok_r(context->devices[DAQ_PF_RING_PASSIVE_DEV_IDX], ",", &twins_pos);
-    while(twins != NULL) {
+    while (twins != NULL) {
       char *dev, *dev_pos = NULL, *tx_dev;
       int last_twin = 0;

@@ -425,7 +425,7 @@

       twins = strtok_r(NULL, ",", &twins_pos);
     }
-  } else if(context->mode == DAQ_MODE_PASSIVE) {
+  } else if (context->mode == DAQ_MODE_PASSIVE) {
     /* zc:ethX,zc:ethY */
     char *dev, *dev_pos = NULL;
     context->num_devices = 0;
@@ -501,8 +501,8 @@

     context->ipc_pool = pfring_zc_ipc_attach_buffer_pool(context->cluster_id, context->ipc_queues[0]);

-    if(context->ipc_pool == NULL) {
-      DPE(context->errbuf, "%s: pfring_zc_ipc_attach_buffer_pool error %s(%d), please check that cluster %d is running\n",
+    if (context->ipc_pool == NULL) {
+      snprintf(errbuf, len, "%s: pfring_zc_ipc_attach_buffer_pool error %s(%d), please check that cluster %d is running\n",
           __FUNCTION__, strerror(errno), errno, context->cluster_id);
       return -1;
     }
@@ -623,7 +623,7 @@

   verdict = context->analysis_func(user, &hdr, pkt_buffer);

-  if(verdict >= MAX_DAQ_VERDICT)
+  if (verdict >= MAX_DAQ_VERDICT)
     verdict = DAQ_VERDICT_PASS;

   switch(verdict) {
@@ -871,7 +871,7 @@
     len
   );

-  if(pfring_zc_send_pkt(context->tx_queues[tx_ring_idx],
+  if (pfring_zc_send_pkt(context->tx_queues[tx_ring_idx],
 		        &context->buffer_inject, 1 /* flush packet */) < 0) {
     DPE(context->errbuf, "%s", "pfring_zc_send_pkt() error");
     return DAQ_ERROR;
@@ -903,10 +903,20 @@
 }

 static void pfring_zc_daq_shutdown(void *handle) {
-  Pfring_Context_t *context =(Pfring_Context_t *) handle;
-
-  if (context->cluster)
-    pfring_zc_destroy_cluster(context->cluster);
+  Pfring_Context_t *context = (Pfring_Context_t *) handle;
+  int i;
+
+  if (!context->ipc_attach) {
+    if (context->cluster)
+      pfring_zc_destroy_cluster(context->cluster);
+  } else {
+    for (i = 0; i < context->num_devices; i++)
+      if (context->rx_queues[i])
+        pfring_zc_ipc_detach_queue(context->rx_queues[i]);
+
+    if (context->ipc_pool)
+      pfring_zc_ipc_detach_buffer_pool(context->ipc_pool);
+  }

   if (context->devices[DAQ_PF_RING_PASSIVE_DEV_IDX])
     free(context->devices[DAQ_PF_RING_PASSIVE_DEV_IDX]);


include參數GPC檢測

include參數GPC檢測

--- agent/php/hook/include.h
+++ agent/php/hook/include.h
@@ -78,7 +78,16 @@
     case IS_VAR:
     {
         // whether the parameter is the user input data
-        eval_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+        if (openrasp_zval_in_request(OPENRASP_T(OPENRASP_OP1_VAR(opline)).var.ptr TSRMLS_CC))
+        {
+            zval *attack_params;
+            MAKE_STD_ZVAL(attack_params);
+            ZVAL_STRING(attack_params, "", 1);
+            zval *plugin_message = NULL;
+            MAKE_STD_ZVAL(plugin_message);
+            ZVAL_STRING(plugin_message, _("File inclusion"), 1);
+            openrasp_buildin_php_risk_handle(1, "include", 100, attack_params, plugin_message TSRMLS_CC);
+        }
         op1 = OPENRASP_T(OPENRASP_OP1_VAR(opline)).var.ptr;
         break;
     }


Squashed 'lib/cpp-library/' changes from 25f1c19..3b7e055

3b7e055 Adjust default smoothing value

git-subtree-dir: lib/cpp-library
git-subtree-split: 3b7e0556f71f896c668cdfb3c6fadcf21634a9e9

--- progressbar.h
+++ progressbar.h
@@ -232,7 +232,7 @@
   public:
     const std::size_t total;
     std::string description;
-    float smoothing = 0.3;
+    float smoothing = 0.75;
     char bar_open = '[';
     char bar_close = ']';
     char bar_done = '=';


legion: fix gcc warnings in the C interface

--- runtime/legion/legion_c.h
+++ runtime/legion/legion_c.h
@@ -2008,7 +2008,7 @@
    * @see Legion::ArgumentMap::ArgumentMap()
    */
   legion_argument_map_t
-  legion_argument_map_create();
+  legion_argument_map_create(void);

   /**
    * @see Legion::ArgumentMap::set_point()
@@ -2963,7 +2963,7 @@
    * @return Caller takes ownership of return value.
    */
   legion_field_map_t
-  legion_field_map_create();
+  legion_field_map_create(void);

   /**
    * @param handle Caller must have ownership of parameter `handle`.
@@ -3678,7 +3678,7 @@
    * @see Legion::Runtime::get_runtime()
    */
   legion_runtime_t
-  legion_runtime_get_runtime();
+  legion_runtime_get_runtime(void);

   /**
    * @see Legion::Runtime::get_executing_processor()
@@ -3688,10 +3688,10 @@
                                          legion_context_t ctx);

   void
-  legion_runtime_enable_scheduler_lock();
-
-  void
-  legion_runtime_disable_scheduler_lock();
+  legion_runtime_enable_scheduler_lock(void);
+
+  void
+  legion_runtime_disable_scheduler_lock(void);

   /**
    * @see Legion::Runtime::print_once()
@@ -4655,7 +4655,7 @@
    * @see Realm::Machine::get_machine()
    */
   legion_machine_t
-  legion_machine_create();
+  legion_machine_create(void);

   /**
    * @param handle Caller must have ownership of parameter `handle`.


fixed fbconfig selection bug

fixed fbconfig selection bug

--- spu/render/renderspu_glx.c
+++ spu/render/renderspu_glx.c
@@ -317,9 +317,12 @@
 		attribs[attrCount++] = 1;
 	}

+	attribs[attrCount++] = GLX_DOUBLEBUFFER;
 	if (visAttribs & CR_DOUBLE_BIT) {
-		attribs[attrCount++] = GLX_DOUBLEBUFFER;
 		attribs[attrCount++] = True;
+	}
+	else {
+		attribs[attrCount++] = False;
 	}

 	if (visAttribs & CR_STENCIL_BIT) {
@@ -460,7 +463,8 @@
 		int id;
 		render_spu.ws.glXGetFBConfigAttrib(visual->dpy, visual->fbconfig,
 																			 GLX_FBCONFIG_ID, &id);
-		crDebug("Render SPU: Chose FBConfig 0x%x", id);
+		crDebug("Render SPU: Chose FBConfig 0x%x, visBits=0x%x",
+						id, visual->visAttribs);
 	}

 	return GL_TRUE;


Making fasta/fastq record compile on g++4.1 and 4.2, possibly a bit slower, need to look into this further.

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@9051 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/seqan/stream/read_fasta_fastq.h
+++ seqan/projects/library/seqan/stream/read_fasta_fastq.h
@@ -361,11 +361,9 @@
     // Second Pass: Actually read data.
     // ------------------------------------------------------------------------
     startSecondPass(reader);
+    Pair<TIdString, TSeqString> record;
     while (hasMore(reader)) {
-        appendValue(sequenceIds, TIdString());
-        appendValue(sequences, TSeqString());
-        Pair<TIdString &, TSeqString &> record(back(sequenceIds), back(sequences));
-        FastaReaderLambdaContextSinglePass_<TIdString &, TSeqString &> lambdaContextSecond(record);
+        FastaReaderLambdaContextSinglePass_<TIdString, TSeqString> lambdaContextSecond(record);
         res = _readRecordFastAQMeta(lambdaContextSecond, reader, Fasta());
         // std::cerr << "SECOND PASS DONE 1/2 res == " << res << std::endl;
         if (res)
@@ -373,6 +371,8 @@
         // Compute sequence field length.
         res = _readRecordFastAQSequence(lambdaContextSecond, reader, Fasta());
         // std::cerr << "SECOND PASS DONE 2/2" << std::endl;
+        appendValue(sequenceIds, record.i1); // TODO(holtgrew): Move-construction/appending?
+        appendValue(sequences, record.i2);
     }
     return res;
 }


links seem not to be handle correctly by cvs

--- sql/src/parser/statement.h
+++ sql/src/parser/statement.h
@@ -7,15 +7,18 @@
 #include "catalog.h"

 typedef enum statement_type {
+	st_dummy,
+	st_create_schema,
+	st_drop_schema,
 	st_create_table,
 	st_drop_table,
 	st_create_column,
 	st_not_null,
 	st_default,
-	st_table,
 	st_column,
 	st_reverse,
 	st_atom,
+	st_insert_atom,		/* special insert_atom for optimization */
 	st_cast,
 	st_join,
 	st_semijoin,
@@ -43,6 +46,7 @@
 	st_pearl,
 	/* used internally only */
 	st_list,
+	st_insert_list,
 	st_output,
 } st_type;

@@ -69,13 +73,15 @@
 	int refcnt;
 } statement;

-extern statement *statement_create_table( char *name, int temp, char *sql );
+extern statement *statement_create_schema( schema *s );
+extern statement *statement_drop_schema( schema *s );
+
+extern statement *statement_create_table( table *t );
 extern statement *statement_drop_table( table *t, int drop_action );
-extern statement *statement_create_column( column *c, statement *table );
+extern statement *statement_create_column( column *c );
 extern statement *statement_not_null( statement *col );
 extern statement *statement_default( statement *col, statement *def );

-extern statement *statement_table( table *t );
 extern statement *statement_column( column *c );
 extern statement *statement_reverse( statement *s );
 extern statement *statement_atom( atom *op1 );
@@ -91,7 +97,10 @@
 extern statement *statement_diamond( statement *s1 );
 extern statement *statement_pearl( list *s1 );

+extern statement *statement_insert_atom( atom *op1 );
+extern statement *statement_insert_list( list *l );
 extern statement *statement_insert( column *c, statement *id, statement *v );
+
 extern statement *statement_insert_column( statement *c, statement *a );
 extern statement *statement_update( column *col, statement *values );
 extern statement *statement_delete( column *col, statement *where );


Fix comparison when the numbers are denormals

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@32784 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/include/deal.II/lac/parallel_vector.templates.h
+++ deal.II/include/deal.II/lac/parallel_vector.templates.h
@@ -451,7 +451,7 @@
               for (size_type j=my_imports->first; j<my_imports->second;
                    j++, read_position++)
                 Assert(*read_position == 0. ||
-                       std::abs(local_element(j) - *read_position) <
+                       std::abs(local_element(j) - *read_position) <=
                        std::abs(local_element(j)) * 1000. *
                        std::numeric_limits<Number>::epsilon(),
                        ExcNonMatchingElements(*read_position, local_element(j),


undo commit 28489 which screwed up multigrid for DG methods

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@28551 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/include/deal.II/multigrid/multigrid.templates.h
+++ deal.II/include/deal.II/multigrid/multigrid.templates.h
@@ -156,16 +156,6 @@
 //  std::cout<<std::endl;
 //  t[level].print(std::cout, 2,false);

-  if (edge_out != 0)
-    {
-      edge_out->vmult_add(level, t[level], solution[level]);
-      if (debug>2)
-        deallog << "Norm t[" << level << "] " << t[level].l2_norm() << std::endl;
-    }
-
-  if (edge_down != 0)
-    edge_down->vmult(level, t[level-1], solution[level]);
-
   // make t rhs of lower level The
   // non-refined parts of the
   // coarse-level defect already
@@ -174,6 +164,15 @@
   for (unsigned int l = level; l>minlevel; --l)
     {
       t[l-1] = 0.;
+      if (l==level && edge_out != 0)
+        {
+          edge_out->vmult_add(level, t[level], solution[level]);
+          if (debug>2)
+            deallog << "Norm t[" << level << "] " << t[level].l2_norm() << std::endl;
+        }
+
+      if (l==level && edge_down != 0)
+        edge_down->vmult(level, t[level-1], solution[level]);

       transfer->restrict_and_add (l, t[l-1], t[l]);
       if (debug>3)


Buffer::deallocate() needs to null alloc and buf.host

Otherwise explicitly calling deallocate() could lead to double-frees
later.

(Note: do we need a similar fix in device_deallocate()?)

Former-commit-id: 459e6c36d558de2115c9a11aa7e81bd0798fe6d2

--- src/runtime/HalideBuffer.h
+++ src/runtime/HalideBuffer.h
@@ -618,6 +618,10 @@
      * own memory. */
     void deallocate() {
         decref();
+        if (manages_memory()) {
+            buf.host = nullptr;
+            alloc = nullptr;
+        }
     }

     /** Drop reference to any owned device memory, possibly freeing it


don't set CLONE_PTRACE -- it confuses strace

R=r
DELTA=4  (3 added, 1 deleted, 0 changed)
OCL=28063
CL=28065

--- src/runtime/linux/thread.c
+++ src/runtime/linux/thread.c
@@ -237,12 +237,14 @@
 	int64 ret;
 	int32 flags;

+	/*
+	 * note: strace gets confused if we use CLONE_PTRACE here.
+	 */
 	flags = CLONE_PARENT	/* getppid doesn't change in child */
 		| CLONE_VM	/* share memory */
 		| CLONE_FS	/* share cwd, etc */
 		| CLONE_FILES	/* share fd table */
 		| CLONE_SIGHAND	/* share sig handler table */
-		| CLONE_PTRACE	/* revisit - okay for now */
 		| CLONE_THREAD	/* revisit - okay for now */
 		;


SAS decompressor: Improve bounds checking

--- src/sas/readstat_sas_rle.c
+++ src/sas/readstat_sas_rle.c
@@ -21,11 +21,14 @@

 ssize_t sas_rle_decompress(void *output_buf, size_t output_len,
         const void *input_buf, size_t input_len) {
-    /* TODO bounds checking */
     unsigned char *buffer = (unsigned char *)output_buf;
     unsigned char *output = buffer;

     const unsigned char *input = (const unsigned char *)input_buf;
+
+    size_t command_lengths[] = {
+        1, 0, 0, 0, 2, 1, 1, 1,
+        0, 0, 0, 0, 1, 0, 0, 0 };

     while (input < (const unsigned char *)input_buf + input_len) {
         unsigned char control = *input++;
@@ -34,6 +37,9 @@
         int copy_len = 0;
         int insert_len = 0;
         unsigned char insert_byte = '\0';
+        if (input + command_lengths[command] >= (const unsigned char *)input_buf + input_len) {
+            return -1;
+        }
         switch (command) {
             case SAS_RLE_COMMAND_COPY64:
                 copy_len = (*input++) + 64 + length * 256;


fixed bugs with SMJS version 1.8.0

fixed bugs with SMJS version 1.8.0

--- src/scenegraph/vrml_smjs.c
+++ src/scenegraph/vrml_smjs.c
@@ -128,7 +128,7 @@
 /*define this macro to force Garbage Collection after each input to JS (script initialize/shutdown and all eventIn)
 on latest SM, GC will crash if called from a different thread than the thread creating the contex, no clue why
 */
-#if (JS_VERSION<185)
+#if (JS_VERSION<180)
 #define FORCE_GC
 #endif

@@ -824,7 +824,7 @@
 		r->ToField.on_event_in = on_route_to_object;
 		r->ToField.eventType = GF_SG_EVENT_IN;
 		r->ToField.far_ptr = NULL;
-		r->ToField.name = NULL;	//JS_GetFunctionName( JS_ValueToFunction(c, argv[3] ) );
+		r->ToField.name = JS_GetFunctionName( JS_ValueToFunction(c, argv[3] ) );

 		r->obj = JSVAL_TO_OBJECT( argv[2] ) ;
 //		gf_js_add_root(c, & r->obj);
@@ -4742,7 +4742,9 @@
 		gf_mx_p(js_rt->mx);
 #ifdef JS_THREADSAFE
 		if (cx) {
+#if (JS_VERSION>=185)
 			JS_SetContextThread(cx);
+#endif
 			JS_BeginRequest(cx);
 		}
 #endif
@@ -4750,7 +4752,9 @@
 #ifdef JS_THREADSAFE
 		if (cx) {
 			JS_EndRequest(cx);
+#if (JS_VERSION>=185)
 			JS_ClearContextThread(cx);
+#endif
 		}
 #endif
 		gf_mx_v(js_rt->mx);
@@ -4760,6 +4764,14 @@
 Bool gf_sg_try_lock_javascript(struct JSContext *cx)
 {
 	if (gf_mx_try_lock(js_rt->mx)) {
+#ifdef JS_THREADSAFE
+		if (cx) {
+#if (JS_VERSION>=185)
+			JS_SetContextThread(cx);
+#endif
+			JS_BeginRequest(cx);
+		}
+#endif
 		return 1;
 	}
 	return 0;


fix indentation

fix indentation

--- vic/drivers/shared_all/src/generate_default_state.c
+++ vic/drivers/shared_all/src/generate_default_state.c
@@ -64,6 +64,7 @@
     cell_data_struct       **cell;
     energy_bal_struct      **energy;
     veg_var_struct         **veg_var;
+    gridcell_avg_struct      gc_avg;

     cell = all_vars->cell;
     energy = all_vars->energy;
@@ -141,16 +142,16 @@
     for (veg = 0; veg <= Nveg; veg++) {
         Cv = veg_con[veg].Cv;
         if (Cv > 0) {
-        	// TO-DO: account for treeline and lake factors
-        	AreaFactor = Cv * TreeAdjustFactor * lakefactor;
-                // cold start, so assuming bare (free of snow) albedo
-                if (veg != Nveg) {
-                	albedo_sum += AreaFactor * veg_var[veg][band].albedo;
-                }
-                else {
-                	// this is the bare soil class, so use bare soil albedo parameter
-                    	albedo_sum += AreaFactor * param.ALBEDO_BARE_SOIL;
-                }
+            // TO-DO: account for treeline and lake factors
+            AreaFactor = Cv * TreeAdjustFactor * lakefactor;
+            // cold start, so assuming bare (free of snow) albedo
+            if (veg != Nveg) {
+                albedo_sum += AreaFactor * veg_var[veg][band].albedo;
+            }
+            else {
+                // this is the bare soil class, so use bare soil albedo parameter
+                albedo_sum += AreaFactor * param.ALBEDO_BARE_SOIL;
+            }
         }
     }
     gc_avg.avg_albedo = albedo_sum;


Defined serialization targets for fundamental integer types

--- wallet/serialize.h
+++ wallet/serialize.h
@@ -106,45 +106,57 @@
 #define WRITEDATA(s, obj)   s.write((char*)&(obj), sizeof(obj))
 #define READDATA(s, obj)    s.read((char*)&(obj), sizeof(obj))

-inline unsigned int GetSerializeSize(char a,               int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(signed char a,        int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(unsigned char a,      int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(signed short a,       int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(unsigned short a,     int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(signed int a,         int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(unsigned int a,       int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(signed long /*a*/,        int, int=0) { return sizeof(int64_t); }
-inline unsigned int GetSerializeSize(unsigned long /*a*/,      int, int=0) { return sizeof(uint64_t); }
-inline unsigned int GetSerializeSize(signed long long a,   int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(unsigned long long a, int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(float a,              int, int=0) { return sizeof(a); }
-inline unsigned int GetSerializeSize(double a,             int, int=0) { return sizeof(a); }
-
-template<typename Stream> inline void Serialize(Stream& s, char a,               int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, signed char a,        int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, unsigned char a,      int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, signed short a,       int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, unsigned short a,     int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, signed int a,         int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, unsigned int a,       int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, signed long a,        int, int=0) { int64_t al =  static_cast<int64_t>(a);  WRITEDATA(s, al); }
-template<typename Stream> inline void Serialize(Stream& s, unsigned long a,      int, int=0) { uint64_t al = static_cast<uint64_t>(a); WRITEDATA(s, al); }
-template<typename Stream> inline void Serialize(Stream& s, signed long long a,   int, int=0) { WRITEDATA(s, a); }
-template<typename Stream> inline void Serialize(Stream& s, unsigned long long a, int, int=0) { WRITEDATA(s, a); }
+using SCharT     = int8_t;
+using CharT      = char;
+using UCharT     = uint8_t;
+using ShortT     = int16_t;
+using UShortT    = uint16_t;
+using IntT       = int32_t;
+using UIntT      = uint32_t;
+using LongT      = int64_t;
+using ULongT     = uint64_t;
+using LongLongT  = int64_t;
+using ULongLongT = uint64_t;
+
+inline unsigned int GetSerializeSize(char /*a*/,               int, int=0) { return sizeof(CharT);      }
+inline unsigned int GetSerializeSize(signed char /*a*/,        int, int=0) { return sizeof(SCharT);     }
+inline unsigned int GetSerializeSize(unsigned char /*a*/,      int, int=0) { return sizeof(UCharT);     }
+inline unsigned int GetSerializeSize(signed short /*a*/,       int, int=0) { return sizeof(ShortT);     }
+inline unsigned int GetSerializeSize(unsigned short /*a*/,     int, int=0) { return sizeof(UShortT);    }
+inline unsigned int GetSerializeSize(signed int /*a*/,         int, int=0) { return sizeof(IntT);       }
+inline unsigned int GetSerializeSize(unsigned int /*a*/,       int, int=0) { return sizeof(UIntT);      }
+inline unsigned int GetSerializeSize(signed long /*a*/,        int, int=0) { return sizeof(LongT);      }
+inline unsigned int GetSerializeSize(unsigned long /*a*/,      int, int=0) { return sizeof(ULongT);     }
+inline unsigned int GetSerializeSize(signed long long /*a*/,   int, int=0) { return sizeof(LongLongT);  }
+inline unsigned int GetSerializeSize(unsigned long long /*a*/, int, int=0) { return sizeof(ULongLongT); }
+inline unsigned int GetSerializeSize(float a,                  int, int=0) { return sizeof(a);          }
+inline unsigned int GetSerializeSize(double a,                 int, int=0) { return sizeof(a);          }
+
+template<typename Stream> inline void Serialize(Stream& s, char a,               int, int=0) { CharT al      = static_cast<CharT>(a);      WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, signed char a,        int, int=0) { SCharT al     = static_cast<SCharT>(a);     WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, unsigned char a,      int, int=0) { UCharT al     = static_cast<UCharT>(a);     WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, signed short a,       int, int=0) { ShortT al     = static_cast<ShortT>(a);     WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, unsigned short a,     int, int=0) { UShortT al    = static_cast<UShortT>(a);    WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, signed int a,         int, int=0) { IntT al       = static_cast<IntT>(a);       WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, unsigned int a,       int, int=0) { UIntT al      = static_cast<UIntT>(a);      WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, signed long a,        int, int=0) { LongT al      = static_cast<LongT>(a);      WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, unsigned long a,      int, int=0) { ULongT al     = static_cast<ULongT>(a);     WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, signed long long a,   int, int=0) { LongLongT al  = static_cast<LongLongT>(a);  WRITEDATA(s, al); }
+template<typename Stream> inline void Serialize(Stream& s, unsigned long long a, int, int=0) { ULongLongT al = static_cast<ULongLongT>(a); WRITEDATA(s, al); }
 template<typename Stream> inline void Serialize(Stream& s, float a,              int, int=0) { WRITEDATA(s, a); }
 template<typename Stream> inline void Serialize(Stream& s, double a,             int, int=0) { WRITEDATA(s, a); }

-template<typename Stream> inline void Unserialize(Stream& s, char& a,               int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, signed char& a,        int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, unsigned char& a,      int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, signed short& a,       int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, unsigned short& a,     int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, signed int& a,         int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, unsigned int& a,       int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, signed long& a,        int, int=0) { int64_t al =  0;  READDATA(s, al); a = static_cast<int64_t>(al); }
-template<typename Stream> inline void Unserialize(Stream& s, unsigned long& a,      int, int=0) { uint64_t al =  0; READDATA(s, al); a = static_cast<uint64_t>(al); }
-template<typename Stream> inline void Unserialize(Stream& s, signed long long& a,   int, int=0) { READDATA(s, a); }
-template<typename Stream> inline void Unserialize(Stream& s, unsigned long long& a, int, int=0) { READDATA(s, a); }
+template<typename Stream> inline void Unserialize(Stream& s, char& a,               int, int=0) { CharT al = 0;      READDATA(s, al); a = static_cast<CharT>(al);      }
+template<typename Stream> inline void Unserialize(Stream& s, signed char& a,        int, int=0) { SCharT al = 0;     READDATA(s, al); a = static_cast<SCharT>(al);     }
+template<typename Stream> inline void Unserialize(Stream& s, unsigned char& a,      int, int=0) { UCharT al = 0;     READDATA(s, al); a = static_cast<UCharT>(al);     }
+template<typename Stream> inline void Unserialize(Stream& s, signed short& a,       int, int=0) { ShortT al = 0;     READDATA(s, al); a = static_cast<ShortT>(al);     }
+template<typename Stream> inline void Unserialize(Stream& s, unsigned short& a,     int, int=0) { UShortT al = 0;    READDATA(s, al); a = static_cast<UShortT>(al);    }
+template<typename Stream> inline void Unserialize(Stream& s, signed int& a,         int, int=0) { IntT al = 0;       READDATA(s, al); a = static_cast<IntT>(al);       }
+template<typename Stream> inline void Unserialize(Stream& s, unsigned int& a,       int, int=0) { UIntT al = 0;      READDATA(s, al); a = static_cast<UIntT>(al);      }
+template<typename Stream> inline void Unserialize(Stream& s, signed long& a,        int, int=0) { LongT al = 0;      READDATA(s, al); a = static_cast<LongT>(al);      }
+template<typename Stream> inline void Unserialize(Stream& s, unsigned long& a,      int, int=0) { ULongT al = 0;     READDATA(s, al); a = static_cast<ULongT>(al);     }
+template<typename Stream> inline void Unserialize(Stream& s, signed long long& a,   int, int=0) { LongLongT al = 0;  READDATA(s, al); a = static_cast<LongLongT>(al);  }
+template<typename Stream> inline void Unserialize(Stream& s, unsigned long long& a, int, int=0) { ULongLongT al = 0; READDATA(s, al); a = static_cast<ULongLongT>(al); }
 template<typename Stream> inline void Unserialize(Stream& s, float& a,              int, int=0) { READDATA(s, a); }
 template<typename Stream> inline void Unserialize(Stream& s, double& a,             int, int=0) { READDATA(s, a); }


secret: Use g_strdup_printf() instead of virAsprintf()

Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>
Reviewed-by: Daniel Henrique Barboza <627b089ad62deae9aaf06ccfa2c9056df28927e0@gmail.com>

--- src/secret/secret_driver.c
+++ src/secret/secret_driver.c
@@ -469,25 +469,19 @@
     driver->privileged = privileged;

     if (privileged) {
-        if (virAsprintf(&driver->configDir,
-                        "%s/libvirt/secrets", SYSCONFDIR) < 0)
-            goto error;
-        if (virAsprintf(&driver->stateDir,
-                        "%s/libvirt/secrets", RUNSTATEDIR) < 0)
-            goto error;
+        driver->configDir = g_strdup_printf("%s/libvirt/secrets", SYSCONFDIR);
+        driver->stateDir = g_strdup_printf("%s/libvirt/secrets", RUNSTATEDIR);
     } else {
         g_autofree char *rundir = NULL;
         g_autofree char *cfgdir = NULL;

         if (!(cfgdir = virGetUserConfigDirectory()))
             goto error;
-        if (virAsprintf(&driver->configDir, "%s/secrets/", cfgdir) < 0)
-            goto error;
+        driver->configDir = g_strdup_printf("%s/secrets/", cfgdir);

         if (!(rundir = virGetUserRuntimeDirectory()))
             goto error;
-        if (virAsprintf(&driver->stateDir, "%s/secrets/run", rundir) < 0)
-            goto error;
+        driver->stateDir = g_strdup_printf("%s/secrets/run", rundir);
     }

     if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {


[DFS] Add protection for pt->triggered

[DFS] Add protection for pt->triggered

--- components/dfs/src/poll.c
+++ components/dfs/src/poll.c
@@ -20,6 +20,7 @@
  * Change Logs:
  * Date           Author       Notes
  * 2016-12-28     Bernard      first version
+ * 2018-03-09     Bernard      Add protection for pt->triggered.
  */
 #include <stdint.h>

@@ -118,13 +119,12 @@
         rt_hw_interrupt_enable(level);

         rt_schedule();
-    }
-    else
-    {
-        rt_hw_interrupt_enable(level);
+
+        level = rt_hw_interrupt_disable();
     }

     ret = !pt->triggered;
+    rt_hw_interrupt_enable(level);

     return ret;
 }


Fixed print_long_text line iteration code

Recent refactorings broke it.

--- walls-of-doom/io.c
+++ walls-of-doom/io.c
@@ -454,7 +454,6 @@
  * Prints the provided string after formatting it to increase readability.
  */
 void print_long_text(char *string, SDL_Renderer *renderer) {
-  size_t lines_copied = 0;
   char line[COLUMNS + 1];
   char *cursor;
   int width = COLUMNS - PADDING;
@@ -463,14 +462,14 @@
   normalize_whitespaces(string);
   wrap_at_right_margin(string, width);
   line_count = count_lines(string);
-  y = (LINES - line_count) / 2 + lines_copied;
   clear(renderer);
   /* Print each line. */
   cursor = string;
+  y = (LINES - line_count) / 2;
   while (*cursor != '\0') {
     cursor = copy_first_line(cursor, line);
     print(PADDING, y, line, DEFAULT_COLOR, renderer);
-    lines_copied++;
+    y++;
   }
   present(renderer);
 }