tools/smp-tester: Add initial code for accessing AF_ALG

--- tools/smp-tester.c
+++ tools/smp-tester.c
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <stdbool.h>
+#include <sys/socket.h>

 #include <glib.h>

@@ -41,6 +42,40 @@
 #include "src/shared/tester.h"
 #include "src/shared/mgmt.h"
 #include "src/shared/hciemu.h"
+
+#ifndef SOL_ALG
+#define SOL_ALG 279
+#endif
+
+#ifndef AF_ALG
+#define AF_ALG  38
+#define PF_ALG  AF_ALG
+
+#include <linux/types.h>
+
+struct sockaddr_alg {
+        __u16   salg_family;
+        __u8    salg_type[14];
+        __u32   salg_feat;
+        __u32   salg_mask;
+        __u8    salg_name[64];
+};
+
+struct af_alg_iv {
+        __u32   ivlen;
+        __u8    iv[0];
+};
+
+#define ALG_SET_KEY                     1
+#define ALG_SET_IV                      2
+#define ALG_SET_OP                      3
+
+#define ALG_OP_DECRYPT                  0
+#define ALG_OP_ENCRYPT                  1
+
+#else
+#include <linux/if_alg.h>
+#endif

 #define SMP_CID 0x0006

@@ -53,6 +88,7 @@
 	unsigned int io_id;
 	uint16_t handle;
 	size_t counter;
+	int alg_sk;
 };

 struct smp_req_rsp {
@@ -71,6 +107,31 @@
 	const struct smp_req_rsp *req;
 	size_t req_count;
 };
+
+static int alg_setup(void)
+{
+	struct sockaddr_alg salg;
+	int sk;
+
+	sk = socket(PF_ALG, SOCK_SEQPACKET | SOCK_CLOEXEC, 0);
+	if (sk < 0) {
+		fprintf(stderr, "socket(AF_ALG): %s\n", strerror(errno));
+		return -1;
+	}
+
+	memset(&salg, 0, sizeof(salg));
+	salg.salg_family = AF_ALG;
+	strcpy((char *) salg.salg_type, "skcipher");
+	strcpy((char *) salg.salg_name, "ecb(aes)");
+
+	if (bind(sk, (struct sockaddr *) &salg, sizeof(salg)) < 0) {
+		fprintf(stderr, "bind(AF_ALG): %s\n", strerror(errno));
+		close(sk);
+		return -1;
+	}
+
+	return sk;
+}

 static void mgmt_debug(const char *str, void *user_data)
 {
@@ -184,6 +245,13 @@
 {
 	struct test_data *data = tester_get_data();

+	data->alg_sk = alg_setup();
+	if (data->alg_sk < 0) {
+		tester_warn("Failed to setup AF_ALG socket");
+		tester_pre_setup_failed();
+		return;
+	}
+
 	data->mgmt = mgmt_new_default();
 	if (!data->mgmt) {
 		tester_warn("Failed to setup management interface");
@@ -205,6 +273,11 @@
 	if (data->io_id > 0) {
 		g_source_remove(data->io_id);
 		data->io_id = 0;
+	}
+
+	if (data->alg_sk >= 0) {
+		close(data->alg_sk);
+		data->alg_sk = -1;
 	}

 	hciemu_unref(data->hciemu);
@@ -227,6 +300,7 @@
 		user->hciemu_type = HCIEMU_TYPE_LE; \
 		user->io_id = 0; \
 		user->counter = 0; \
+		user->alg_sk = -1; \
 		user->test_data = data; \
 		tester_add_full(name, data, \
 				test_pre_setup, setup, func, NULL, \


vts-server: Add M2TS_H264BASE_AAC stream type

--- tools/vts-server.c
+++ tools/vts-server.c
@@ -39,7 +39,8 @@
 #include <string.h>

 //#define STREAM_TYPE GSS_STREAM_TYPE_OGG_THEORA_VORBIS
-#define STREAM_TYPE GSS_STREAM_TYPE_WEBM
+//#define STREAM_TYPE GSS_STREAM_TYPE_WEBM
+#define STREAM_TYPE GSS_STREAM_TYPE_M2TS_H264BASE_AAC

 #define GETTEXT_PACKAGE "ew-stream-server"
@@ -389,28 +390,41 @@
   GError *error = NULL;
   char *s;

-#if STREAM_TYPE == GSS_STREAM_TYPE_WEBM
-  s = g_strdup_printf ("videotestsrc is-live=true pattern=%d ! "
-      "video/x-raw-yuv,format=(fourcc)I420,width=640,height=360 ! "
-      "timeoverlay ! "
-      "vp8enc ! queue ! "
-      "webmmux streamable=true name=mux ! %s name=multifdsink "
-      "audiotestsrc is-live=true wave=ticks volume=0.2 ! "
-      "audioconvert ! vorbisenc ! "
-      "queue ! mux.audio_%%d ",
-      vts->pattern, gss_server_get_multifdsink_string ());
-#elif STREAM_TYPE == GSS_STREAM_TYPE_OGG_THEORA_VORBIS
-  s = g_strdup_printf ("videotestsrc is-live=true pattern=%d ! "
-      "video/x-raw-yuv,format=(fourcc)I420,width=640,height=360 ! "
-      "timeoverlay ! "
-      "theoraenc ! queue ! "
-      "oggmux name=mux ! %s name=multifdsink "
-      "audiotestsrc is-live=true wave=ticks volume=0.2 ! "
-      "audioconvert ! vorbisenc ! "
-      "queue ! mux. ", vts->pattern, gss_server_get_multifdsink_string ());
-#else
-#error FIXME
-#endif
+  if (STREAM_TYPE == GSS_STREAM_TYPE_WEBM) {
+    s = g_strdup_printf ("videotestsrc is-live=true pattern=%d ! "
+        "video/x-raw-yuv,format=(fourcc)I420,width=640,height=360 ! "
+        "timeoverlay ! "
+        "vp8enc ! queue ! "
+        "webmmux streamable=true name=mux ! %s name=multifdsink "
+        "audiotestsrc is-live=true wave=ticks volume=0.2 ! "
+        "audioconvert ! vorbisenc ! "
+        "queue ! mux.audio_%%d ",
+        vts->pattern, gss_server_get_multifdsink_string ());
+  } else if (STREAM_TYPE == GSS_STREAM_TYPE_OGG_THEORA_VORBIS) {
+    s = g_strdup_printf ("videotestsrc is-live=true pattern=%d ! "
+        "video/x-raw-yuv,format=(fourcc)I420,width=640,height=360 ! "
+        "timeoverlay ! "
+        "theoraenc ! queue ! "
+        "oggmux name=mux ! %s name=multifdsink "
+        "audiotestsrc is-live=true wave=ticks volume=0.2 ! "
+        "audioconvert ! vorbisenc ! "
+        "queue ! mux. ", vts->pattern, gss_server_get_multifdsink_string ());
+  } else if (STREAM_TYPE == GSS_STREAM_TYPE_M2TS_H264BASE_AAC) {
+    s = g_strdup_printf ("videotestsrc is-live=true pattern=%d ! "
+        "video/x-raw-yuv,format=(fourcc)I420,width=320,height=180,framerate=30/1 ! "
+        "timeoverlay ! "
+        //"x264enc tune=zerolatency profile=baseline sync-lookahead=0 "
+        //"pass=cbr rc-lookahead=0 bitrate=600 key-int-max=4000 ! "
+        "ewh264enc speed=10 profile=baseline queue-size=1 keyframe-interval=300 "
+        "bitrate=600000 buffer-size=600000 ! "
+        "queue ! "
+        "mpegtsmux name=mux ! queue ! %s name=multifdsink "
+        "audiotestsrc is-live=true wave=ticks volume=0.2 ! "
+        "audioconvert ! ewaacenc ! "
+        "queue ! mux. ", vts->pattern, gss_server_get_multifdsink_string ());
+  } else {
+    g_assert_not_reached ();
+  }
   pipe = gst_parse_launch (s, &error);
   if (error) {
     GST_INFO_OBJECT (vts, "pipeline parsing error: %s", error->message);


remove debug messages

remove debug messages

--- src/data/batch_generator.h
+++ src/data/batch_generator.h
@@ -58,7 +58,7 @@

     std::unique_ptr<sample_queue> maxiBatch;

-    if(options_->has("maxi-batch-sort")) {
+    if(shuffle && options_->has("maxi-batch-sort")) {
       if(options_->get<std::string>("maxi-batch-sort") == "src")
         maxiBatch.reset(new sample_queue(cmpSrc));
       else if(options_->get<std::string>("maxi-batch-sort") == "none")
@@ -172,6 +172,7 @@

     {
       std::unique_lock<std::mutex> lock(loadMutex_);
+
       loadCondition_.wait(lock, [this]{
         return loadReady_ || !bufferedBatches_.empty();
       });
@@ -195,11 +196,12 @@
       };

       std::thread d(detach);
+      d.detach();
     }

     std::unique_lock<std::mutex> lock(loadMutex_);
     bufferedBatches_.pop_front();
-
+
     return currentBatch_;
   }


Added "Basic ECC" and "Extended ECC" to the NSS version string.

--- security/nss/lib/nss/nss.h
+++ security/nss/lib/nss/nss.h
@@ -52,7 +52,15 @@
  * The format of the version string should be
  *     "<major version>.<minor version>[.<patch level>] [<Beta>]"
  */
+#ifdef NSS_ENABLE_ECC
+#ifdef NSS_ECC_MORE_THAN_SUITE_B
+#define NSS_VERSION  "3.12 Extended ECC Beta"
+#else
+#define NSS_VERSION  "3.12 Basic ECC Beta"
+#endif
+#else
 #define NSS_VERSION  "3.12 Beta"
+#endif
 #define NSS_VMAJOR   3
 #define NSS_VMINOR   12
 #define NSS_VPATCH   0


Smack: ignore private inode for smack_file_receive

The dmabuf fd can be shared between processes via unix domain
socket. The file of dmabuf fd is came from anon_inode. The inode
has no set and get xattr operations, so it can not be shared
between processes with smack. This patch fixes just to ignore
private inode including anon_inode for smack_file_receive.

Signed-off-by: Seung-Woo Kim <f0452ad01023e1e19deb03356bab8e3b5dbc61a6@samsung.com>


Add a mutable accesssor for Ruleset.media

--- src/third_party/css_parser/src/webutil/css/parser.h
+++ src/third_party/css_parser/src/webutil/css/parser.h
@@ -605,6 +605,7 @@
   const Declaration& declaration(int i) const { return *declarations_->at(i); }

   Selectors& mutable_selectors() { return *selectors_; }
+  std::vector<UnicodeText>& mutable_media() { return media_; }
   Declarations& mutable_declarations() { return *declarations_; }

   // set_media copies input media.


Fixed to include correct headers in src/data/functional_hash.h.

--- src/data/functional_hash.h
+++ src/data/functional_hash.h
@@ -35,9 +35,9 @@
 #include "../pfi-config.h"

 #if HAVE_UNORDERED_MAP
-#include <utility>
+#include <functional>
 #elif HAVE_TR1_UNORDERED_MAP
-#include <tr1/unordered_map>
+#include <tr1/functional>
 #else
 #error "There is no hash implementation."
 #endif


Added uviewbitmap.c

Added uviewbitmap.c

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

--- uviewbitmap.c
+++ uviewbitmap.c
@@ -0,0 +1,109 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_MEMALIGN
+    #include <malloc.h> // for memalign
+#endif
+
+unsigned char *read_bmp_file(char *file_name, int* _width, int* _height) {
+    unsigned char head[54];
+    FILE *f = fopen(file_name,"rb");
+
+    // BMP header is 54 bytes
+    fread(head, 1, 54, f);
+
+    int width = head[18] + ( ((int)head[19]) << 8) + ( ((int)head[20]) << 16) + ( ((int)head[21]) << 24);
+    int height = head[22] + ( ((int)head[23]) << 8) + ( ((int)head[24]) << 16) + ( ((int)head[25]) << 24);
+
+    // lines are aligned on 4-byte boundary
+    int line_size = (width / 8 + (width / 8) % 4);
+    int file_size = line_size * height;
+
+    unsigned char *img = malloc(width * height), *data = malloc(file_size);
+
+    // skip the header
+    fseek(f,54,SEEK_SET);
+
+    // skip palette - two rgb quads, 8 bytes
+    fseek(f, 8, SEEK_CUR);
+
+    // read data
+    fread(data,1,file_size,f);
+
+    // decode bits
+    int i, rev_i, j, k;
+    for(i = 0, rev_i = height - 1; i < height ; i++, rev_i--) {
+        for(j = 0 ; j < width / 8; j++) {
+            int fpos = i * line_size + j, pos = rev_i * width + j * 8;
+            for(k = 0 ; k < 8 ; k++)
+                img[pos + (7 - k)] = (data[fpos] >> k ) & 1;
+        }
+    }
+
+    free(data);
+    *_width = width; *_height = height;
+    return img;
+}
+
+void print_usage() {
+    printf("Usage: uviewbitmap [-a] bmp_file\n");
+}
+
+int main(int argc, char *argv[]) {
+    FILE *file;
+    int i, j, width, height;
+    char* file_name;
+    unsigned char* bmp;
+
+    if (argc < 2 || argc > 3) {
+        print_usage();
+        exit(0);
+    }
+    else {
+        if(argc == 3)
+            file_name = argv[2];
+        else
+            file_name = argv[1];
+
+        file = fopen(file_name, "r");
+
+        if (file == 0) { // fopen returns 0, the NULL pointer, on failure
+            printf( "No such file\n" );
+            exit(0);
+        }
+
+        bmp = read_bmp_file(file_name, &width, &height);
+
+        if(strcmp(argv[1], "-a")) {
+            printf("static const unsigned char bmp [] PROGMEM = {\n");
+            printf("  ");
+        }
+
+        int new_line = 0;
+
+        for(i = 0 ; i < height ; i++) {
+            for(j = 0 ; j < width ; j++) {
+                if(!strcmp(argv[1], "-a")) {
+                    printf("%c ", bmp[i * width + j] ? '.' : ' ' );
+                }
+                else {
+                    if(bmp[i * width + j] == 1) {
+                        printf("0x%02x, 0x%02x, ", j, i);
+                        new_line += 1;
+                    }
+
+                    if(new_line == 15) {
+                        new_line = 0;
+                        printf("\n  ");
+                    }
+                }
+            }
+            if(!strcmp(argv[1], "-a"))
+                printf("\n");
+        }
+        if(strcmp(argv[1], "-a"))
+            printf("};\n");
+    }
+
+    return 0;
+}


Remove incorrect comment.

Remove incorrect comment.

--- KERN/netinet/sctp_input.c
+++ KERN/netinet/sctp_input.c
@@ -6262,7 +6262,7 @@
 #if defined(__FreeBSD__) && __FreeBSD_version >= 900001
 		if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0)
 			goto bad;
-#endif				/* ICMP_BANDLIM */
+#endif
 		SCTPDBG(SCTP_DEBUG_INPUT1,
 			"Sending a ABORT from packet entry!\n");
 		if (ch->chunk_type == SCTP_INITIATION) {


Small fix for 2 typos introduced in one of the last patches.

git-svn-id: bb0627f6f70d46b61088c62c6186faa4b96a9496@8435 91ce42f0-d328-0410-95d8-f526ca767f89

--- bacula/src/dird/ua_tree.c
+++ bacula/src/dird/ua_tree.c
@@ -129,7 +129,7 @@
       if (ua->api) user->signal(BNET_CMD_BEGIN);
       parse_args_only(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
       if (ua->argc == 0) {
-         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n")
+         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n"), ua->cmd);
          if (ua->api) user->signal(BNET_CMD_FAILED);
          continue;
       }
@@ -139,13 +139,12 @@
       stat = false;
       for (i=0; i<comsize; i++)       /* search for command */
          if (strncasecmp(ua->argk[0],  _(commands[i].key), len) == 0) {
-            ua->cmd);
             stat = (*commands[i].func)(ua, tree);   /* go execute command */
             found = 1;
             break;
          }
       if (!found) {
-         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n")
+         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n"), ua->cmd);
          if (ua->api) user->signal(BNET_CMD_FAILED);
          continue;
       }


Cluster: don't forget yourself with CLUSTER FORGET.

--- src/cluster.c
+++ src/cluster.c
@@ -2875,7 +2875,10 @@
         /* CLUSTER FORGET <NODE ID> */
         clusterNode *n = clusterLookupNode(c->argv[2]->ptr);

-        if (!n) {
+        if (n == server.cluster->myself) {
+            addReplyErrorFormat(c,"I tried hard but I can't forget myself...");
+            return;
+        } else if (!n) {
             addReplyErrorFormat(c,"Unknown node %s", (char*)c->argv[2]->ptr);
             return;
         }


representRedisNodeFlags() moved into right code section.

The funciton was also modified in order to be more standalone and
produce an output without trailing spaces, making the reuse simpler.
The global variable was renamed in cammel case as most other Redis
globals, except the main ones we refer too many times, like 'server'.

--- src/cluster.c
+++ src/cluster.c
@@ -72,39 +72,7 @@
 void clusterCloseAllSlots(void);
 void clusterSetNodeAsMaster(clusterNode *n);
 void clusterDelNode(clusterNode *delnode);
-
-struct redisNodeFlags {
-    uint16_t flag;
-    char     *attr;
-};
-
-static struct redisNodeFlags nodeflags[] = {
-    {REDIS_NODE_MYSELF,    "myself,"},
-    {REDIS_NODE_MASTER,    "master,"},
-    {REDIS_NODE_SLAVE,     "slave,"},
-    {REDIS_NODE_PFAIL,     "fail?,"},
-    {REDIS_NODE_FAIL,      "fail,"},
-    {REDIS_NODE_HANDSHAKE, "handshake,"},
-    {REDIS_NODE_NOADDR,    "noaddr,"}
-};
-
-sds representRedisNodeFlags(sds ci, uint16_t flags) {
-    if (flags == 0) {
-        ci = sdscat(ci,"noflags");
-    } else {
-        int size = sizeof(nodeflags) / sizeof(struct redisNodeFlags);
-        for (int i=0; i < size; i++) {
-            struct redisNodeFlags *nodeflag = nodeflags + i;
-            if (flags & nodeflag->flag) {
-                ci = sdscat(ci, nodeflag->attr);
-            }
-        }
-
-        if (ci[sdslen(ci)-1] == ',') ci[sdslen(ci)-1] = ' ';
-    }
-
-    return ci;
-}
+sds representRedisNodeFlags(sds ci, uint16_t flags);

 /* -----------------------------------------------------------------------------
  * Initialization
@@ -1180,9 +1148,9 @@
     while(count--) {
         uint16_t flags = ntohs(g->flags);
         clusterNode *node;
-
-        sds ci = sdsempty();
-        ci = representRedisNodeFlags(ci, flags);
+        sds ci;
+
+        ci = representRedisNodeFlags(sdsempty(), flags);
         redisLog(REDIS_DEBUG,"GOSSIP %.40s %s:%d %s",
             g->nodename,
             g->ip,
@@ -3361,8 +3329,39 @@
 }

 /* -----------------------------------------------------------------------------
- * CLUSTER command
+ * Nodes to string representation functions.
  * -------------------------------------------------------------------------- */
+
+struct redisNodeFlags {
+    uint16_t flag;
+    char *name;
+};
+
+static struct redisNodeFlags redisNodeFlagsTable[] = {
+    {REDIS_NODE_MYSELF,    "myself,"},
+    {REDIS_NODE_MASTER,    "master,"},
+    {REDIS_NODE_SLAVE,     "slave,"},
+    {REDIS_NODE_PFAIL,     "fail?,"},
+    {REDIS_NODE_FAIL,      "fail,"},
+    {REDIS_NODE_HANDSHAKE, "handshake,"},
+    {REDIS_NODE_NOADDR,    "noaddr,"}
+};
+
+/* Concatenate the comma separated list of node flags to the given SDS
+ * string 'ci'. */
+sds representRedisNodeFlags(sds ci, uint16_t flags) {
+    if (flags == 0) {
+        ci = sdscat(ci,"noflags,");
+    } else {
+        int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
+        for (i = 0; i < size; i++) {
+            struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
+            if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
+        }
+    }
+    sdsIncrLen(ci,-1); /* Remove trailing comma. */
+    return ci;
+}

 /* Generate a csv-alike representation of the specified cluster node.
  * See clusterGenNodesDescription() top comment for more information.
@@ -3383,9 +3382,9 @@

     /* Slave of... or just "-" */
     if (node->slaveof)
-        ci = sdscatprintf(ci,"%.40s ",node->slaveof->name);
+        ci = sdscatprintf(ci," %.40s ",node->slaveof->name);
     else
-        ci = sdscatprintf(ci,"- ");
+        ci = sdscatlen(ci," - ",3);

     /* Latency from the POV of this node, link status */
     ci = sdscatprintf(ci,"%lld %lld %llu %s",
@@ -3462,6 +3461,10 @@
     dictReleaseIterator(di);
     return ci;
 }
+
+/* -----------------------------------------------------------------------------
+ * CLUSTER command
+ * -------------------------------------------------------------------------- */

 int getSlotOrReply(redisClient *c, robj *o) {
     long long slot;


#3344 sync the shutdown test refs[t:3344]

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@30475 c7de825b-a66e-492c-adef-691d508d4ae1

--- src/tests/shutdown-3344.c
+++ src/tests/shutdown-3344.c
@@ -39,24 +39,24 @@
     DBT value = { .data = val_buffer, .size = sizeof val_buffer };
     //uint32_t put_flags = DB_YESOVERWRITE | (txn ? (DB_PRELOCKED_FILE_READ | DB_PRELOCKED_WRITE) : 0);
     uint32_t put_flags = DB_YESOVERWRITE;
-    r = db->put(db, txn, &key, &value, put_flags); assert(r == 0);
+    r = db->put(db, txn, &key, &value, put_flags); assert_zero(r);
 }

 static void
 populate(DB_ENV *env, DB_TXN *txn, DB *db, uint64_t nrows) {
     int r;
     struct timeval tstart;
-    r = gettimeofday(&tstart, NULL); assert(r == 0);
+    r = gettimeofday(&tstart, NULL); assert_zero(r);
     struct timeval tlast = tstart;

     for (uint64_t rowi = 0; rowi < nrows; rowi++) {
         insert_row(env, txn, db, rowi);

         // maybe report performance
-        uint64_t rows_per_report = 1000;
+        uint64_t rows_per_report = 100000;
         if (((rowi + 1) % rows_per_report) == 0) {
             struct timeval tnow;
-            r = gettimeofday(&tnow, NULL); assert(r == 0);
+            r = gettimeofday(&tnow, NULL); assert_zero(r);
             float last_time = tdiff(&tnow, &tlast);
             float total_time = tdiff(&tnow, &tstart);
             if (verbose) {
@@ -71,72 +71,67 @@
 run_test(DB_ENV *env, int ndbs, int do_txn, uint32_t pagesize, uint64_t nrows) {
     int r;

-    DB_TXN *txn0 = NULL;
-    if (do_txn) {
-        r = env->txn_begin(env, NULL, &txn0, 0); assert(r == 0);
-    }
-
     DB *dbs[ndbs];
-    int i = 0;
-    {
+    for (int i = 0; i < ndbs; i++) {
         DB *db = NULL;
-        if (verbose) fprintf(stderr, "creating %d\n", i);
-        r = db_create(&db, env, 0); assert(r == 0);
+        if (verbose) {
+            time_t now = time(0); fprintf(stderr, "%.24s creating %d\n", ctime(&now), i);
+        }
+        r = db_create(&db, env, 0); assert_zero(r);
         if (pagesize) {
-            r = db->set_pagesize(db, pagesize); assert(r == 0);
+            r = db->set_pagesize(db, pagesize); assert_zero(r);
+        }
+        DB_TXN *txn1 = NULL;
+        if (do_txn) {
+            r = env->txn_begin(env, NULL, &txn1, 0); assert_zero(r);
         }
         char db_filename[32]; sprintf(db_filename, "test%d", i);
-        r = db->open(db, txn0, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
+        r = db->open(db, txn1, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert_zero(r);
         if (do_txn) {
-            r = db->pre_acquire_table_lock(db, txn0); assert(r == 0);
+            r = txn1->commit(txn1, 0); assert_zero(r);
         }
         dbs[i] = db;
     }

-    for (i = 1; i < ndbs; i++) {
-        DB *db = NULL;
-        if (verbose) fprintf(stderr, "creating %d\n", i);
-        r = db_create(&db, env, 0); assert(r == 0);
-        if (pagesize) {
-            r = db->set_pagesize(db, pagesize); assert(r == 0);
+        if (verbose) {
+            time_t now = time(0); fprintf(stderr, "%.24s populating\n", ctime(&now));
         }
-        DB_TXN *txn1 = NULL;
-        if (do_txn) {
-            r = env->txn_begin(env, NULL, &txn1, 0); assert(r == 0);
-        }
-        char db_filename[32]; sprintf(db_filename, "test%d", i);
-        r = db->open(db, txn1, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
-        if (do_txn) {
-            r = txn1->commit(txn1, 0); assert(r == 0);
-        }
-        dbs[i] = db;
+
+    DB_TXN *txn0 = NULL;
+    if (do_txn) {
+        r = env->txn_begin(env, NULL, &txn0, 0); assert_zero(r);
     }

-    if (verbose) fprintf(stderr, "populating\n");
-    populate(env, txn0, dbs[0], nrows);
+    populate(env, txn0, dbs[ndbs-1], nrows);

-    for (i = 1; i < ndbs; i++) {
-        DB *db = dbs[i];
-        if (verbose) fprintf(stderr, "closing %d\n", i);
-        r = db->close(db, 0); assert(r == 0);
+    if (do_txn) {
+        if (verbose) {
+            time_t now = time(0); fprintf(stderr, "%.24s commit txn0\n", ctime(&now));
+        }
+        r = txn0->commit(txn0, 0); assert_zero(r);
     }

-    if (verbose) fprintf(stderr, "closing %d\n", 0);
-    r = dbs[0]->close(dbs[0], 0); assert(r == 0);
-    if (do_txn) {
-        if (verbose) fprintf(stderr, "abort txn0\n");
-        r = txn0->abort(txn0); assert(r == 0);
+    for (int i = 0; i < ndbs; i++) {
+        DB *db = dbs[i];
+        if (verbose) {
+            time_t now = time(0); fprintf(stderr, "%.24s closing %d\n", ctime(&now), i);
+        }
+        r = db->close(db, 0); assert_zero(r);
+    }
+
+    if (verbose) {
+        time_t now = time(0); fprintf(stderr, "%.24s done\n", ctime(&now));
     }
 }

 int
 test_main(int argc, char * const argv[]) {
     char *env_dir = "dir.shutdown.ca";
-    int ndbs = 1;
+    int ndbs = 500;
     int do_txn = 1;
-    u_int32_t pagesize = 4096;
+    u_int32_t pagesize = 1024;
     u_int64_t cachesize = 1000000000;
-    u_int64_t nrows = 500000;
+    u_int64_t nrows = 50000;

     for (int i = 1; i < argc ; i++) {
         char * const arg = argv[i];
@@ -176,24 +171,24 @@
     char rm_cmd[strlen(env_dir) + strlen("rm -rf ") + 1];
     snprintf(rm_cmd, sizeof(rm_cmd), "rm -rf %s", env_dir);
     int r;
-    r = system(rm_cmd); assert(r == 0);
-    r = toku_os_mkdir(env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); assert(r == 0);
+    r = system(rm_cmd); assert_zero(r);
+    r = toku_os_mkdir(env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); assert_zero(r);

     DB_ENV *env = NULL;
-    r = db_env_create(&env, 0); assert(r == 0);
+    r = db_env_create(&env, 0); assert_zero(r);
     if (cachesize) {
         const u_int64_t gig = 1 << 30;
-        r = env->set_cachesize(env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
+        r = env->set_cachesize(env, cachesize / gig, cachesize % gig, 1); assert_zero(r);
     }
     int env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG;
     if (!do_txn)
         env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
-    r = env->open(env, env_dir, env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
+    r = env->open(env, env_dir, env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert_zero(r);

     run_test(env, ndbs, do_txn, pagesize, nrows);

     if (verbose) fprintf(stderr, "closing env\n");
-    r = env->close(env, 0); assert(r == 0);
+    r = env->close(env, 0); assert_zero(r);

     return 0;
 }


new fields

new fields

--- voo_plugin.h
+++ voo_plugin.h
@@ -230,14 +230,14 @@
 	int chroma_subsampling_hor;
 	int chroma_subsampling_ver;

-    // narrow signal range
-    int b_narrow;
-
-    // transfer function
-    voo_transferFunction_t transfer;
-
-    // max nits
-    float max_nits, min_nits;
+	// narrow signal range
+	int b_narrow;
+
+	// transfer function
+	voo_transferFunction_t transfer;
+
+	// max nits
+	float max_nits, min_nits;

 	char reserved[4];


gc_merge should be interruptible too

gc_merge should be interruptible too

--- server/src/common/hashfs.c
+++ server/src/common/hashfs.c
@@ -6224,7 +6224,7 @@
     return NULL;
 }

-static rc_ty sx_hashfs_gc_merge(sx_hashfs_t *h, sxi_db_t *db)
+static rc_ty sx_hashfs_gc_merge(sx_hashfs_t *h, sxi_db_t *db, int *terminate)
 {
     sqlite3_stmt *q = NULL, *q_iter = NULL, *q_queue_del = NULL, *q_del_gc = NULL, *q_truncate_tmp = NULL;
     sqlite3_stmt *q_insert = NULL, *q_get_maxidx = NULL, *q_update_maxidx = NULL;
@@ -6244,7 +6244,7 @@
           )
             break;
         sqlite3_reset(q_iter);
-        while((r = qstep(q_iter)) == SQLITE_ROW) {
+        while((r = qstep(q_iter)) == SQLITE_ROW && !*terminate) {
             sxi_db_t *dbsource = NULL;
             const char *key = (const char *)sqlite3_column_text(q_iter, 0);
             const char *path = (const char*)sqlite3_column_text(q_iter, 1);
@@ -6277,7 +6277,7 @@
                 if(qprep(dbsource, &q, "SELECT groupid, hash, hs, op, idx FROM moduse WHERE idx > :previdx ORDER BY idx ASC") ||
                    qbind_int64(q, ":previdx", previdx))
                     break;
-                while((r2 = qstep(q)) == SQLITE_ROW) {
+                while((r2 = qstep(q)) == SQLITE_ROW && !*terminate) {
                     sqlite3_reset(q_insert);
                     if (qbind_blob(q_insert, ":groupid", sqlite3_column_blob(q, 0), sqlite3_column_bytes(q, 0)) ||
                         qbind_blob(q_insert, ":hash", sqlite3_column_blob(q, 1), sqlite3_column_bytes(q, 1)) ||
@@ -6603,7 +6603,7 @@
         qnullify(q);
         gettimeofday(&tv0, NULL);
         do {
-            if (sx_hashfs_gc_merge(h, db) ||
+            if (sx_hashfs_gc_merge(h, db, terminate) ||
                 qbegin(db))
                 break;
             if (*terminate)


CLUSTER MEET: better error messages when address is invalid.

Fixes issue #1734.

--- src/cluster.c
+++ src/cluster.c
@@ -3287,17 +3287,19 @@
     }

     if (!strcasecmp(c->argv[1]->ptr,"meet") && c->argc == 4) {
-        long port;
-
-        if (getLongFromObjectOrReply(c, c->argv[3], &port, NULL) != REDIS_OK) {
-            addReplyError(c,"Invalid TCP port specified");
+        long long port;
+
+        if (getLongLongFromObject(c->argv[3], &port) != REDIS_OK) {
+            addReplyErrorFormat(c,"Invalid TCP port specified: %s",
+                                (char*)c->argv[3]->ptr);
             return;
         }

         if (clusterStartHandshake(c->argv[2]->ptr,port) == 0 &&
             errno == EINVAL)
         {
-            addReplyError(c,"Invalid node address specified");
+            addReplyErrorFormat(c,"Invalid node address specified: %s:%s",
+                            (char*)c->argv[2]->ptr, (char*)c->argv[3]->ptr);
         } else {
             addReply(c,shared.ok);
         }


adapt native callbakc to the new Gegebenheiten.

--- voo_plugin.h
+++ voo_plugin.h
@@ -330,11 +330,13 @@

 		// For type == vooCallback_Native:
 		// Called by vooya for each video frame with native data before color
-		// conversion to RGB 8bit, and without image adjustments. Can be used to
+		// conversion to display format, and without image adjustments. Can be used to
 		// feed the data outside of vooya. Properties like resolution
 		// and data format are given beforehand in on_load_video( ... ); you can
 		// save them in p_metadata->p_user_video. "p_data" is the image data.
-		void (*method_native)( unsigned char *p_data,
+		// Data format is 32bit float planar, with equal stride for all planes,
+		// but chroma subsampling of the input.
+		void (*method_native)( float *ch1, float *ch2, float *ch3, int stride,
 							  voo_video_frame_metadata_t *p_metadata );

 		// For type == vooCallback_EOTF:


Two cluster.c comments improved.

Two cluster.c comments improved.

--- src/cluster.c
+++ src/cluster.c
@@ -917,7 +917,8 @@
  * CLUSTER config epoch handling
  * -------------------------------------------------------------------------- */

-/* Return the greatest configEpoch found in the cluster. */
+/* Return the greatest configEpoch found in the cluster, or the current
+ * epoch if greater than any node configEpoch. */
 uint64_t clusterGetMaxEpoch(void) {
     uint64_t max = 0;
     dictIterator *di;
@@ -3634,7 +3635,7 @@
     else
         ci = sdscatlen(ci," - ",3);

-    /* Latency from the POV of this node, link status */
+    /* Latency from the POV of this node, config epoch, link status */
     ci = sdscatprintf(ci,"%lld %lld %llu %s",
         (long long) node->ping_sent,
         (long long) node->pong_received,


cstool: use switch

cstool: use switch

--- cstool/cstool.c
+++ cstool/cstool.c
@@ -356,43 +356,41 @@
 			printf("  %s\t%s\n", insn[i].mnemonic, insn[i].op_str);

 			if (detail_flag) {
-				if (arch == CS_ARCH_X86) {
-					print_insn_detail_x86(handle, md, &insn[i]);
+				switch(arch) {
+					default: break;
+
+					case CS_ARCH_X86:
+							 print_insn_detail_x86(handle, md, &insn[i]);
+							 break;
+
+					case CS_ARCH_ARM:
+							 print_insn_detail_arm(handle, &insn[i]);
+							 break;
+					case CS_ARCH_ARM64:
+							 print_insn_detail_arm64(handle,&insn[i]);
+							 break;
+					case CS_ARCH_MIPS:
+							 print_insn_detail_mips(handle, &insn[i]);
+							 break;
+					case CS_ARCH_PPC:
+							 print_insn_detail_ppc(handle, &insn[i]);
+							 break;
+					case CS_ARCH_SPARC:
+							 print_insn_detail_sparc(handle, &insn[i]);
+							 break;
+					case CS_ARCH_SYSZ:
+							 print_insn_detail_sysz(handle, &insn[i]);
+							 break;
+					case CS_ARCH_XCORE:
+							 print_insn_detail_xcore(handle, &insn[i]);
+							 break;
+					case CS_ARCH_M68K:
+							 print_insn_detail_m68k(handle, &insn[i]);
+							 break;
 				}
-
-				if (arch == CS_ARCH_ARM) {
-					print_insn_detail_arm(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_ARM64) {
-					print_insn_detail_arm64(handle,&insn[i]);
-				}
-
-				if (arch == CS_ARCH_MIPS) {
-					print_insn_detail_mips(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_PPC) {
-					print_insn_detail_ppc(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_SPARC) {
-					print_insn_detail_sparc(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_SYSZ) {
-					print_insn_detail_sysz(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_XCORE) {
-					print_insn_detail_xcore(handle, &insn[i]);
-				}
-
-				if (arch == CS_ARCH_M68K) {
-					print_insn_detail_m68k(handle, &insn[i]);
-				}
-			}
-		}
+			}
+		}
+
 		cs_free(insn, count);
 	} else {
 		printf("ERROR: invalid assembly code\n");


refine variabe redefinitino error message

--- src/codegen.c
+++ src/codegen.c
@@ -253,7 +253,7 @@
   analyze_scope *scope = state->scope;

   if (lookup_scope(scope, sym)) {
-    pic_warn(pic, "redefining variable");
+    pic_warnf(pic, "redefining variable: ~s", pic_sym_value(sym));
     return;
   }


Assign socket descriptor to 's' after reconnecting to recorder socket.

--- src/collect.c
+++ src/collect.c
@@ -67,7 +67,7 @@
                 while ((output_write(s, -1, addr, nb, mb_mapping->tab_registers + addr) == -1) && !stop) {
                     usleep(1000000);
                     output_close(s);
-                    output_connect(opt->socket_file, opt->verbose);
+                    s = output_connect(opt->socket_file, opt->verbose);
                 }
             }
         }
@@ -135,7 +135,7 @@
                     while ((output_write(s, client->id, client->addresses[n], nb_reg, tab_reg) == -1) && !stop) {
                         usleep(1000000);
                         output_close(s);
-                        output_connect(opt->socket_file, opt->verbose);
+                        s = output_connect(opt->socket_file, opt->verbose);
                     }
                 }
             }


thetvdb: Update for key ID registration mem handling

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

--- src/thetvdb/grl-thetvdb.c
+++ src/thetvdb/grl-thetvdb.c
@@ -214,7 +214,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_THETVDB_ID =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-imdb-id",
                               "thetvdb-imdb-id",
@@ -223,7 +222,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_IMDB_ID =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-zap2it-id",
                               "thetvdb-zap2it-id",
@@ -232,7 +230,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_ZAP2IT_ID =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-guest-stars",
                               "thetvdb-guest-stars",
@@ -241,7 +238,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_GUEST_STARS =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-fanart",
                               "thetvdb-fanart",
@@ -250,7 +246,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_FANART =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-banner",
                               "thetvdb-banner",
@@ -259,7 +254,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_BANNER =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-poster",
                               "thetvdb-poster",
@@ -268,7 +262,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_POSTER =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   spec = g_param_spec_string ("thetvdb-episode-screenshot",
                               "thetvdb-episode-screenshot",
@@ -277,7 +270,6 @@
                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
   GRL_THETVDB_METADATA_KEY_EPISODE_SS =
     grl_registry_register_metadata_key (registry, spec, NULL);
-  g_param_spec_unref (spec);

   source = grl_thetvdb_source_new (api_key);
   grl_registry_register_source (registry,


Add the boot time testing code

Add the boot time testing code

--- program/system/communication.c
+++ program/system/communication.c
@@ -156,6 +156,12 @@
 		toRad( system.variable[TRUE_YAW].value ),
 		0.0, 0.0, 0.0
 	);
+	pbuf += mavlink_msg_to_send_buffer(pbuf, &msg);
+
+	mavlink_msg_named_value_int_pack(1, 0, &msg,
+		(uint32_t)boot_time, "boot time", (uint32_t)boot_time
+	);
+
 	pbuf += mavlink_msg_to_send_buffer(pbuf, &msg);

 	int i;


Annotations are now const

Annotations are now const

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

--- lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h
+++ lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h
@@ -32,7 +32,7 @@
 // CreateMethodInfo - Factory function to allow MethodInfo annotations to be
 // created on demand.
 //
-inline static Annotation *CreateMethodInfo(AnnotationID AID, Annotable *O,
+inline static Annotation *CreateMethodInfo(AnnotationID AID, const Annotable *O,
 					   void *) {
   assert(AID == MethodInfoAID);
   return new MethodInfo((Method*)O);  // Simply invoke the ctor


Check that sourceURL and destURL are both URLs and not file name strings. Print error if not.

--- gass/copy/source/globus_url_copy.c
+++ gass/copy/source/globus_url_copy.c
@@ -68,6 +68,7 @@
     int                              err;
     char *                           sourceURL;
     char *                           destURL;
+    globus_url_t		     test_url;

     int                              fd_source =-1;
     int                              fd_dest   =-1;
@@ -155,6 +156,23 @@
 	}
     }
     */
+
+    /* Verify that the source and destination are valid URLs */
+    rc = globus_url_parse(sourceURL, &test_url);
+    if(rc != GLOBUS_SUCCESS)
+    {
+	fprintf(stderr, "can not parse sourceURL \"%s\"\n", sourceURL);
+	exit(GLOBUS_SUCCESS);
+    }
+    globus_url_destroy(&test_url);
+
+    rc = globus_url_parse(destURL, &test_url);
+    if(rc != GLOBUS_SUCCESS)
+    {
+	fprintf(stderr, "can not parse destURL \"%s\"\n", destURL);
+	exit(GLOBUS_SUCCESS);
+    }
+    globus_url_destroy(&test_url);

     /* end of argument parsing */


dabbad: move up thread settings msg initialisation.

Signed-off-by: Emmanuel Roullit <e51ad7dcb99c77ecf30f537962c562ac80636eba@gmail.com>

--- dabbad/thread.c
+++ dabbad/thread.c
@@ -383,13 +383,14 @@
 		if (!settings_list.list[a])
 			goto out;

+		dabba__thread_settings__init(settings_list.list[a]);
+
 		settings_list.list[a]->id =
 		    malloc(sizeof(*settings_list.list[a]->id));

 		if (!settings_list.list[a]->id)
 			goto out;

-		dabba__thread_settings__init(settings_list.list[a]);
 		dabba__thread_id__init(settings_list.list[a]->id);
 	}


Updated documentation following Window's implementation of lock()/unlock()

--- dashel/dashel.h
+++ dashel/dashel.h
@@ -468,12 +468,10 @@
 		void stop();

 		/** Block any hub processing so another thread can access the streams safely.
-			Currently only implemented on POSIX platform, no-op on others.
 		 */
 		void lock();

 		/** Release the lock aquired by lock().
-			Currently only implemented on POSIX platform, no-op on others.
 		*/
 		void unlock();


sqlite: Query: Add a make_query_with_count function

That will spawn a query with its dedicated count request. This will help
fixing some requests with aggregation.
It also can improve performances when the listing request uses many
joins that aren't required when counting the results

--- src/database/SqliteQuery.h
+++ src/database/SqliteQuery.h
@@ -124,6 +124,49 @@
     std::string m_groupAndOrderBy;
 };

+/**
+ * Alternate query implementation, with 2 full blown requests for counting & listing
+ * This can be more efficient if the listing query needs to join with multiple tables
+ * while counting can be achieved by a simple SELECT COUNT(*) FROM Table;
+ */
+template <typename Impl, typename Intf = Impl, typename... RequestParams>
+class SqliteQueryWithCount : public SqliteQueryBase<Impl, Intf, RequestParams...>
+{
+public:
+    using Base = SqliteQueryBase<Impl, Intf, RequestParams...>;
+    using Result = typename Base::Result;
+
+    template <typename... Args>
+    SqliteQueryWithCount( MediaLibraryPtr ml, std::string countReq,
+                          std::string req, Args&&... args )
+        : SqliteQueryBase<Impl, Intf, Args...>( ml, std::forward<Args>( args )... )
+        , m_countReq( std::move( countReq ) )
+        , m_req ( std::move( req ) )
+    {
+    }
+
+    virtual size_t count() override
+    {
+        return Base::count( m_countReq );
+    }
+
+    virtual Result items( uint32_t nbItems, uint32_t offset ) override
+    {
+        if ( nbItems == 0 && offset == 0 )
+            return all();
+        return Base::items( m_req + " LIMIT ? OFFSET ?", nbItems, offset );
+    }
+
+    virtual Result all() override
+    {
+        return Base::all( m_req );
+    }
+
+private:
+    std::string m_countReq;
+    std::string m_req;
+};
+
 template <typename Impl, typename Intf = Impl, typename... Args>
 Query<Intf> make_query( MediaLibraryPtr ml, std::string field, std::string base,
                         std::string orderAndGroupBy, Args&&... args )
@@ -136,4 +179,18 @@
     );
 }

+template <typename Impl, typename Intf = Impl, typename... Args>
+Query<Intf> make_query_with_count( MediaLibraryPtr ml, std::string countReq,
+                                   std::string req, Args&&... args )
+{
+    return std::unique_ptr<IQuery<Intf>>(
+        new SqliteQueryWithCount<Impl, Intf, Args...>(
+                    ml, std::move( countReq ), std::move( req ),
+                    std::forward<Args>( args )... )
+    );
 }
+
+
+
+
+}


Create boolexp.h

Create boolexp.h

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

--- boolexp.h
+++ boolexp.h
@@ -0,0 +1,171 @@
+#ifndef BOOLEXP_H
+#define BOOLEXP_H
+
+/*
+expr:		(expr) expr2 | left op1 right expr2
+expr2:		op2 expr expr2 | e
+op1:		'=' | '!=' | '<' | '<=' | '>' | '>=' | '=~' | '!~'
+op2:		'or' | 'and'
+left:		'req''.''code' | 'req''['string']'
+right:		string | number | regular
+*/
+
+#include <stdio.h>
+#include "str.h"
+
+enum token_t
+{
+	T_TOKEN_INVALID = 0,
+	T_EOL, // end of line
+	T_OP_EQ, // =
+	T_OP_NE, // !=
+	T_OP_LT, // <
+	T_OP_LE, // <=
+	T_OP_GT, // >
+	T_OP_GE, // >=
+	T_OP_REG_EQ, // =~
+	T_OP_REG_NE, // !~
+	T_LBRACE, // (
+	T_RBRACE, // )
+	T_LZBRACE, // [
+	T_RZBRACE, // ]
+	T_DOT, // .
+	T_NUM,
+	T_STRING,
+	T_BAREWORD,
+	T_REG,
+	T_OP_OR,
+	T_OP_AND,
+	T_TOKEN_LAST
+};
+
+struct token_name_number
+{
+	const char *name;
+	enum token_t number;
+};
+
+class Exp
+{
+public:
+	//enum BOOL_OP {AND, OR};
+	//enum OPRAND_OP {EQUAL, NOTEQUAL, GREAT, LESS, GREATEQUAL, LESSEQUAL, REGULAR};
+
+	Exp()
+	{
+		left = right = NULL;
+	}
+
+	virtual ~Exp()
+	{
+	}
+
+	virtual bool Result() = 0;
+
+protected:
+	Exp *left;
+	Exp *right;
+};
+
+class OPLeft
+{
+public:
+	enum obj_type {OBJ_REQ};
+	enum op_type {OP_CODE, OP_ATTRIB};
+
+	OPLeft(obj_type t, op_type o, const char *att)
+		:obj(t), op(o)
+	{
+		if (att) {
+			attrib = att;
+		}
+	}
+
+	obj_type GetObj()
+	{
+		return obj;
+	}
+
+	op_type GetOp()
+	{
+		return op;
+	}
+
+	const String &GetAttrib()
+	{
+		return attrib;
+	}
+protected:
+	obj_type obj;
+	op_type op;
+	String attrib;
+};
+
+class OPRight
+{
+public:
+	enum val_type {VAL_STRING, VAL_NUM, VAL_REG};
+
+	OPRight(val_type t, const char *val)
+		:type(t), value(val)
+	{
+	}
+
+	val_type GetType()
+	{
+		return type;
+	}
+
+	const String &GetValue()
+	{
+		return value;
+	}
+protected:
+	val_type type;
+	String value;
+};
+
+class Operation : public Exp
+{
+public:
+	Operation(OPLeft *op1, token_t op, OPRight *op2);
+
+	bool Result();
+
+protected:
+	OPLeft *oprand1;
+	token_t op;
+	OPRight *oprand2;
+};
+
+class BoolExp : public Exp
+{
+public:
+	BoolExp(Exp *op1, token_t op, Exp *op2);
+	bool Result();
+
+protected:
+	token_t op;
+};
+
+class Expression
+{
+public:
+	Expression();
+	~Expression();
+
+	int Parse(const char *text);
+
+	bool Result();
+
+protected:
+	OPLeft *left(const char **p);
+	OPRight *right(const char **p);
+	Exp *expr(const char **p);
+	Exp *expr2(const char **p, Exp *ex);
+
+protected:
+	Exp *root;
+};
+
+#endif


Fix a bug in HistoryContainer by adding early-outs

--- plugins/unifiedvideoinertialtracker/HistoryContainer.h
+++ plugins/unifiedvideoinertialtracker/HistoryContainer.h
@@ -223,6 +223,9 @@
             /// than the given timestamp.
             /// @return number of elements removed.
             size_type pop_before(timestamp_type const &tv) {
+                if (empty()) {
+                    return 0;
+                }
                 auto lastIt = lower_bound(tv);
                 if (end() == lastIt) {
                     // If we got end() back, that's ambiguous: is the last entry
@@ -257,6 +260,9 @@
             /// than the given timestamp.
             /// @return number of elements removed.
             size_type pop_after(timestamp_type const &tv) {
+                if (empty()) {
+                    return 0;
+                }
                 auto firstIt = upper_bound(tv);
                 if (end() == firstIt) {
                     // If we got end() back, nothing found after our timestamp.


Add a presumably-required include.

Add a presumably-required include.

--- plugins/unifiedvideoinertialtracker/HistoryContainer.h
+++ plugins/unifiedvideoinertialtracker/HistoryContainer.h
@@ -34,6 +34,7 @@
 // Standard includes
 #include <deque>
 #include <stdexcept>
+#include <iterator>

 namespace osvr {
 namespace vbtracker {


Added plaintext example.

Added plaintext example.

--- onion/hello.c
+++ onion/hello.c
@@ -222,6 +222,12 @@
 	}
 }

+onion_connection_status return_plaintext(onion_request *req, onion_response *res){
+	onion_response_set_header(res, "Content-Type","plain/text");
+	onion_response_write0(res, "Hello, World!");
+	return OCS_PROCESSED;
+}
+
 /// Multiplexes to the proper handler depending on the path.
 /// As there is no proper database connection pool, take one connection randomly, and uses it.
 onion_connection_status muxer(struct test_data *data, onion_request *req, onion_response *res){
@@ -243,6 +249,9 @@
 		free_connection(data, db);
 		return ret;
 	}
+	if (strcmp(path, "plaintext")==0){
+		return return_plaintext(req, res);
+	}

 	return OCS_INTERNAL_ERROR;
 }


Fix flow_mod add with OUTPUT:IN_PORT.

Fix flow_mod add with OUTPUT:IN_PORT.

Pointed out by Terao-san.  Thanks.

--- src/dataplane/mgr/flowdb.c
+++ src/dataplane/mgr/flowdb.c
@@ -604,6 +604,7 @@
               /* is exist specified port? */
               output = (struct ofp_action_output *)&action->ofpat;
               switch (output->port) {
+                case OFPP_IN_PORT:
                 case OFPP_TABLE:
                 case OFPP_NORMAL:
                 case OFPP_FLOOD:


iso compatibility?

iso compatibility?

git-svn-id: 88e1a00e4eab3b0bb0c09889526309a3e2f5bd8a@336 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

--- opcode_spec.h
+++ opcode_spec.h
@@ -28,7 +28,7 @@
 	OPSPEC(ASSIGN)

 #define OPSPECS_DEF_ENUM(name) OPSPEC_##name,
-typedef enum { OPSPECS(OPSPECS_DEF_ENUM) } xc_op_spec_t;
+typedef enum { OPSPECS(OPSPECS_DEF_ENUM) OPSPEC_DUMMY } xc_op_spec_t;

 typedef struct {
 	xc_op_spec_t ext;


NaCl: Remove declaration of IrtInit(), which is no longer defined anywhere

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3186
TEST=build

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

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

--- ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
+++ ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
@@ -12,11 +12,6 @@

 EXTERN_C_BEGIN

-// Initialize srpc connection to the browser. Some APIs like manifest file
-// opening do not need full ppapi initialization and so can be used after
-// this function returns.
-int IrtInit(void);
-
 // The entry point for the main thread of the PPAPI plugin process.
 int PpapiPluginMain(void);


schema BUGFIX ext leafref path detection

--- src/tree_schema_compile.c
+++ src/tree_schema_compile.c
@@ -2638,7 +2638,6 @@
 lys_compile_leafref_has_dep_flag(const struct lysc_node *startnode, const struct lys_module *local_mod,
                                  const struct lysc_node *first_node, int abs_path)
 {
-    int dep1, dep2;
     const struct lysc_node *op_node, *node;

     /* find operation schema we are in */
@@ -2656,10 +2655,9 @@
         if (abs_path) {
             return 1;
         } else {
-            /* compare depth of both nodes */
-            for (dep1 = 0, node = op_node; node->parent; node = node->parent);
-            for (dep2 = 0, node = first_node; node->parent; node = node->parent);
-            if ((dep2 > dep1) || ((dep2 == dep1) && (op_node != first_node))) {
+            /* if first_node parent is not op_node, it is external */
+            for (node = first_node; node && (node != op_node); node = node->parent);
+            if (!node) {
                 return 1;
             }
         }


dashbot++

dashbot++

svn path=/trunk/KDE/kdenetwork/kopete/; revision=636309

--- protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.h
+++ protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.h
@@ -67,6 +67,6 @@
 	void readBoolAttribute(QDomElement e, const QString &name, bool *v);

 	//QString tagContent(const QDomElement &e); // obsolete;
-};
+}

 #endif


Create ﬁndGroupPart1.c

Create ﬁndGroupPart1.c

error: pathspec 'ActionLog/scripts/specific-action-log/ﬁndGroupPart1.c' did not match any file(s) known to git

--- ActionLog/scripts/specific-action-log/ﬁndGroupPart1.c
+++ ActionLog/scripts/specific-action-log/ﬁndGroupPart1.c
@@ -0,0 +1,31 @@
+speciﬁc action log: ﬁndGroupPart1
+Allow User Abort [ Off ]
+Set Error Capture [ On ]
+#
+#Stop script if user is process of picking a speciﬁc action group.
+If [ $$pick = 1 ]
+Show Custom Dialog [ Message: "Pick a speciﬁc-action group. After you do this you can ﬁnd speciﬁc act records by group."; Buttons:
+“OK” ]
+Exit Script [ ]
+End If
+#
+#Find all speciﬁc actions with this key.
+Go to Layout [ “IssuesAndObservationsFIND” (brainstate) ]
+Scroll Window
+[ Home ]
+Set Variable [ $$found ]
+#
+#Find all speciﬁc actions with this key.
+Select Window [ Name: "Speciﬁc Action"; Current ﬁle ]
+Enter Find Mode [ ]
+Set Field [ issue::_keyCategory; "nothing" ]
+Perform Find [ ]
+#
+#If user selected the same category that was already
+#selected then stop this script.
+Select Window [ Name: "Tag"; Current ﬁle ]
+Go to Layout [ “IssuesAndObservationsFIND” (brainstate) ]
+Scroll Window
+[ Home ]
+#
+January 6, 平成26 11:22:02 ActionLog.fp7 - ﬁndGroupPart1 -1-


Truncate status messages before converting to gRPC.

PiperOrigin-RevId: 179736746

--- tensorflow/core/distributed_runtime/rpc/grpc_util.h
+++ tensorflow/core/distributed_runtime/rpc/grpc_util.h
@@ -23,6 +23,7 @@
 #include "grpc++/support/byte_buffer.h"
 #include "tensorflow/core/distributed_runtime/tensor_coding.h"
 #include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/lib/strings/stringprintf.h"
 #include "tensorflow/core/platform/mutex.h"
 #include "tensorflow/core/platform/protobuf.h"

@@ -61,6 +62,13 @@
   if (s.ok()) {
     return ::grpc::Status::OK;
   } else {
+    if (s.error_message().size() > 3072 /* 3k bytes */) {
+      // TODO(b/62947679): Remove truncation once the gRPC issue is resolved.
+      string scratch =
+          strings::Printf("%.3072s ... [truncated]", s.error_message().c_str());
+      LOG(ERROR) << "Truncated error message: " << s;
+      return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()), scratch);
+    }
     return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()),
                           s.error_message());
   }


renamed main.c ot bsdrngd.c; refactored some code; using capsicum now

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

--- bsdrngd.c
+++ bsdrngd.c
@@ -0,0 +1,241 @@
+/*
+ *	Copyright (c) 2017, W. Dean Freeman
+ *	All rights reserved.
+ *
+ * 	Redistribution and use in source and binary forms, with or without
+ * 	modification, are permitted provided that the following conditions are met:
+ *		* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *		* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *       	* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ *      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *      DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ *      FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ *      DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *      SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *      CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ *      OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/capsicum.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
+
+#define MAX_DEV_NAME_LEN	16
+#define MAX_CONF_LINE_BUF	24
+#define MAX_BYTES 		64
+#define DELIMETER		"="
+
+/* structure containing configuration file items */
+typedef struct conf {
+	char		entropy_device[MAX_DEV_NAME_LEN];
+	char		read_bytes[2];
+	char		sleep_seconds[1];
+
+} conf_t;
+
+void write_pid(pid_t);
+
+void
+usage(void)
+{
+	fprintf(stderr,"USAGE: bsdrngd [-d -c /path/to/config]\nBy default, will run in the foreground and load its config from /usr/local/etc/bsd-rngd.conf\n");
+	exit(1);
+}
+
+
+
+
+/* read entropy from the trng device */
+void
+read_entropy(int fd, char *buf, uint32_t n)
+{
+	ssize_t rv;
+
+	flock(fd, LOCK_EX);
+	rv = read(fd,buf,n);
+	if ( rv < 0 )
+	{
+		syslog(LOG_ERR, "Error reading bytes from entropy source: %s", strerror(errno));
+		exit(-1);
+	}
+	flock(fd, LOCK_UN);
+}
+
+void
+write_entropy(int d, char *buf, int n)
+{
+	ssize_t rv = 0;
+	rv = write(d,buf,n);
+	if ( rv < 0 )
+	{
+		syslog(LOG_ERR, "Unable to write to /dev/random: %s", strerror(errno));
+		exit(-1);
+	}
+}
+
+/* main daemon child loop */
+void entropy_feed(char *dev, uint32_t n, uint32_t s)
+{
+
+	cap_rights_t rights;
+	write_pid(getpid());
+
+	FILE *trng = fopen(dev,"r");
+	if (trng == NULL)
+	{
+		syslog(LOG_ERR, "Unable to open trng device for read: %s", strerror(errno));
+		exit(-1);
+	}
+	cap_rights_init(&rights, CAP_FSTAT, CAP_READ);
+	if (cap_rights_limit(fileno(trng), &rights) < 0 && errno != ENOSYS)
+	{
+		syslog(LOG_ERR, "Unable to set capsicum rights limit on trng file handle: %s", strerror(errno));
+		exit(-1);
+	}
+	FILE *rnd = fopen("/dev/random", "w");
+	if (rnd == NULL)
+	{
+		syslog(LOG_ERR, "Unable to open /dev/random for writing: %s", strerror(errno));
+		exit(-1);
+	}
+	cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE);
+	if (cap_rights_limit(fileno(rnd), &rights) < 0 && errno != ENOSYS)
+	{
+		syslog(LOG_ERR, "Unable to set capsicum rights limut on /dev/random file handle: %s", strerror(errno));
+		exit(-1);
+	}
+	cap_enter();
+	syslog(LOG_NOTICE, "bsd-rngd: entropy gathering daemon started for device %s", dev);
+	char buf[n];
+	explicit_bzero(buf,n);
+	/* main loop to do the thing */
+	while(1)
+	{
+		read_entropy(fileno(trng),buf,n);
+		fpurge(trng);
+		write_entropy(fileno(rnd),buf,n);
+		explicit_bzero(buf,n);
+		sleep(s);
+	}
+}
+
+/* Perl-like utility function */
+void
+chomp(char *s)
+{
+	int i = 0;
+	for (i = 0; i < strlen(s); i++)
+	{
+		if (s[i] == '\n')
+			s[i] = '\0';
+	}
+
+}
+
+/* read in the configuration file */
+void
+read_config(conf_t *c, char *f)
+{
+	FILE *fh = fopen(f,"r");
+	if (fh == NULL)
+	{
+		syslog(LOG_ERR, "Unable to open bsd-rngd.conf for read: %s", strerror(errno));
+		exit(-1);
+	}
+	flock(fileno(fh), LOCK_EX);
+	char line[MAX_CONF_LINE_BUF];
+	while(fgets(line,sizeof(line), fh) != NULL)
+	{
+		chomp(line);
+		char *conf_item;
+		conf_item = strstr((char*)line,DELIMETER);
+		conf_item = conf_item + strlen(DELIMETER);
+		if (strstr(line, "DEVICE") !=0)
+		{
+			memcpy(c->entropy_device, conf_item, MAX_DEV_NAME_LEN);
+		}
+		if (strstr(line, "BYTES") != 0)
+		{
+			memcpy(c->read_bytes, conf_item, 2);
+		}
+		if (strstr(line, "INTERVAL") != 0)
+		{
+			memcpy(c->sleep_seconds, conf_item, 1);
+
+		}
+	}
+	flock(fileno(fh),LOCK_UN);
+	fclose(fh);
+
+}
+
+
+
+
+/* write pid file to /var/run */
+void
+write_pid(pid_t p)
+{
+	FILE *fh = fopen("/var/run/bsd-rngd.pid", "w");
+	if (fh == NULL)
+	{
+		syslog(LOG_WARNING, "Unable to write pid file /var/run/bsd-rngd: %s", strerror(errno));
+		exit(-1);
+	}
+	flock(fileno(fh), LOCK_EX);
+	fprintf(fh,"%d\n",p);
+	flock(fileno(fh), LOCK_UN);
+	fclose(fh);
+}
+
+int
+main(int argc, char *argv[])
+{
+	int ch;
+	conf_t config;
+	int c = 0;
+	int daemonize = 0;
+
+
+	while((ch = getopt(argc, argv, "hdc:")) != -1)
+	{
+		switch(ch)
+		{
+			case 'h':
+				usage();
+				break;
+			case 'd':
+				daemonize = 1;
+				break;
+			case 'c':
+				read_config(&config,optarg);
+				c = 1;
+				break;
+			default:
+				usage();
+		}
+
+	}
+	if (c == 0)
+		read_config(&config, "/usr/local/etc/bsd-rngd.conf");
+
+	if (daemonize == 1)
+		daemon(0,0);
+	/* get to doing work */
+	entropy_feed(config.entropy_device, (uint32_t)atoi(config.read_bytes), (uint32_t)atoi(config.sleep_seconds));
+}


fix debug leftover

fix debug leftover

--- src/ua_transport_binary.c
+++ src/ua_transport_binary.c
@@ -2,7 +2,6 @@
 #include "ua_transport_binary.h"
 #include "ua_transport.h"
 #include "ua_transport_binary_secure.h"
-#include <stdio.h>

 static UA_Int32 TL_check(TL_Connection* connection, UA_ByteString* msg) {
 	if(msg->length > (UA_Int32) connection->localConf.maxMessageSize || msg->length > (UA_Int32) connection->remoteConf.maxMessageSize) {


Tidy up duplicate resource ID usage for bitmaps

git-svn-id: 6fc9ba494899942902f7488ac93c4c58960a7ec4@3684 1f79f812-37fb-46fe-a122-30589dd2bf55

--- src/ui/Windows/resource.h
+++ src/ui/Windows/resource.h
@@ -321,18 +321,18 @@
 #define IDB_DRAGEMAIL_CLASSIC           476
 #define IDB_DRAGEMAILX_CLASSIC          477
 #define IDB_UNDO_CLASSIC                478
-#define IDD_ALIAS_PSWDCHANGE            478
-#define IDB_REDO_CLASSIC                479
-#define IDB_UNDO_NEW                    480
-#define IDB_REDO_NEW                    481
-#define IDB_UNDO_NEW_D                  482
-#define IDB_REDO_NEW_D                  483
-#define IDB_SYNCHRONIZE_CLASSIC         484
-#define IDB_SYNCHRONIZE_NEW             485
-#define IDB_SYNCHRONIZE_NEW_D           486
-#define IDB_ADDGROUP_CLASSIC            487
-#define IDB_ADDGROUP_NEW                488
-#define IDB_ADDGROUP_NEW_D              489
+#define IDD_ALIAS_PSWDCHANGE            479
+#define IDB_REDO_CLASSIC                480
+#define IDB_UNDO_NEW                    481
+#define IDB_REDO_NEW                    482
+#define IDB_UNDO_NEW_D                  483
+#define IDB_REDO_NEW_D                  484
+#define IDB_SYNCHRONIZE_CLASSIC         485
+#define IDB_SYNCHRONIZE_NEW             486
+#define IDB_SYNCHRONIZE_NEW_D           487
+#define IDB_ADDGROUP_CLASSIC            488
+#define IDB_ADDGROUP_NEW                489
+#define IDB_ADDGROUP_NEW_D              490
 #define IDC_APPVERSION                  1000
 #define IDC_VERSION                     1001
 #define IDC_BROWSE                      1002
@@ -716,7 +716,7 @@
 //
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        490
+#define _APS_NEXT_RESOURCE_VALUE        491
 #define _APS_NEXT_COMMAND_VALUE         30001
 #define _APS_NEXT_CONTROL_VALUE         1427
 #define _APS_NEXT_SYMED_VALUE           166


eal/arm64: fix precise TSC

eal/arm64: fix precise TSC

In order to get more accurate the cntvct_el0 reading,
SW must invoke isb.

Fixes: ccad39ea0712 ("eal/arm: add cpu cycle operations for ARMv8")
Cc: stable@dpdk.org

Reviewed-by: Gavin Hu <207ee22c2cf71e20c5b5df8395050c07c07d8709@arm.com>
Acked-by: Jerin Jacob <352c4d4f9291b869992ddb67daa45ddc149fed30@marvell.com>
Signed-off-by: Haifeng Lin <351bc4a0be590fdcc599a4ec346bcb664bf047e8@huawei.com>

--- lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
+++ lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
@@ -62,7 +62,7 @@
 static inline uint64_t
 rte_rdtsc_precise(void)
 {
-	rte_mb();
+	asm volatile("isb" : : : "memory");
 	return rte_rdtsc();
 }


adding a counter for detecting ringbuffer corruption

--- prototype2/common/RingBuffer.h
+++ prototype2/common/RingBuffer.h
@@ -101,7 +101,7 @@
 template <const unsigned int N>
 void RingBuffer<N>::setdatalength(unsigned int index, unsigned int length) {
   assert(length <= N);
-  assert(length > 0);
+  //assert(length > 0);
   assert(index < max_entries_);
   data[index].length = length;
 }


doveadm: force-resync now fails if mailbox name isn't valid UTF-8

--- src/doveadm/doveadm-mail.c
+++ src/doveadm/doveadm-mail.c
@@ -79,8 +79,9 @@
 	const char *orig_mailbox = mailbox;

 	str = t_str_new(128);
-	if (imap_utf8_to_utf7(mailbox, str) == 0)
-		mailbox = str_c(str);
+	if (imap_utf8_to_utf7(mailbox, str) < 0)
+		i_fatal("Mailbox name not valid UTF-8: %s", mailbox);
+	mailbox = str_c(str);

 	ns = mail_namespace_find(user->namespaces, &mailbox);
 	if (ns == NULL)


Use // for single-line comments.

Use // for single-line comments.

--- psutil/arch/bsd/netbsd_socks.c
+++ psutil/arch/bsd/netbsd_socks.c
@@ -23,7 +23,7 @@
 // a signaler for connections without an actual status
 int PSUTIL_CONN_NONE = 128;

-/* Address family filter */
+// Address family filter
 enum af_filter {
     INET,
     INET4,
@@ -38,23 +38,23 @@
     ALL,
 };

-/* kinfo_file results */
+// kinfo_file results
 struct kif {
     SLIST_ENTRY(kif) kifs;
     struct kinfo_file *kif;
 };

-/* kinfo_file results list */
+// kinfo_file results list
 SLIST_HEAD(kifhead, kif) kihead = SLIST_HEAD_INITIALIZER(kihead);

-/* kinfo_pcb results */
+// kinfo_pcb results
 struct kpcb {
     SLIST_ENTRY(kpcb) kpcbs;
     struct kinfo_pcb *kpcb;
 };

-/* kinfo_pcb results list */
+// kinfo_pcb results list
 SLIST_HEAD(kpcbhead, kpcb) kpcbhead = SLIST_HEAD_INITIALIZER(kpcbhead);

 static void kiflist_init(void);
@@ -65,7 +65,7 @@
 static int get_sockets(const char *name);
 static void get_info(int aff);

-/* Initialize kinfo_file results list */
+// Initialize kinfo_file results list
 static void
 kiflist_init(void)
 {
@@ -73,7 +73,7 @@
     return;
 }

-/* Clear kinfo_file results list */
+// Clear kinfo_file results list
 static void
 kiflist_clear(void)
 {
@@ -84,7 +84,7 @@
     return;
 }

-/* Initialize kinof_pcb result list */
+// Initialize kinof_pcb result list
 static void
 kpcblist_init(void)
 {
@@ -92,7 +92,7 @@
     return;
 }

-/* Clear kinof_pcb result list */
+// Clear kinof_pcb result list
 static void
 kpcblist_clear(void)
 {
@@ -104,9 +104,7 @@
 }

-/*
- * Get all open files including socket
- */
+// Get all open files including socket
 static int
 get_files(void)
 {
@@ -144,7 +142,7 @@
     }

 #if 0
-    /* debug */
+    // debug
     struct kif *k;
     SLIST_FOREACH(k, &kihead, kifs) {
             printf("%d\n", k->kif->ki_pid);
@@ -154,9 +152,7 @@
     return 0;
 }

-/*
- * Get open sockets
- */
+// Get open sockets
 static int
 get_sockets(const char *name)
 {
@@ -197,7 +193,7 @@
     }

 #if 0
-    /* debug */
+    // debug
     struct kif *k;
     struct kpcb *k;
     SLIST_FOREACH(k, &kpcbhead, kpcbs) {
@@ -210,9 +206,7 @@
 }

-/*
- * Collect connections by PID
- */
+// Collect connections by PID
 PyObject *
 psutil_proc_connections(PyObject *self, PyObject *args)
 {
@@ -353,9 +347,7 @@
 }

-/*
- * Collect open file and connections
- */
+// Collect open file and connections
 static void
 get_info(int aff)
 {
@@ -414,9 +406,7 @@
     return;
 }

-/*
- * Collect system wide connections by address family filter
- */
+// Collect system wide connections by address family filter
 PyObject *
 psutil_net_connections(PyObject *self, PyObject *args)
 {


Add additional flags to RC topic, not used yet.

--- src/drivers/drv_rc_input.h
+++ src/drivers/drv_rc_input.h
@@ -92,6 +92,34 @@
 	/** receive signal strength indicator (RSSI): < 0: Undefined, 0: no signal, 255: full reception */
 	int32_t			rssi;

+	/**
+	 * explicit failsafe flag: true on TX failure or TX out of range , false otherwise.
+	 * Only the true state is reliable, as there are some (PPM) receivers on the market going
+	 * into failsafe without telling us explicitly.
+	 * */
+	bool			rc_failsafe;
+
+	/**
+	 * RC receiver connection status: True,if no frame has arrived in the expected time, false otherwise.
+	 * True usally means that the receiver has been disconnected, but can also indicate a radio link loss on "stupid" systems.
+	 * Will remain false, if a RX with failsafe option continues to transmit frames after a link loss.
+	 * */
+	bool			rc_lost;
+
+	/**
+	 * Number of lost RC frames.
+	 * Note: intended purpose: observe the radio link quality if RSSI is not available
+	 * This value must not be used to trigger any failsafe-alike funtionality.
+	 * */
+	uint16_t		rc_lost_frame_count;
+
+	/**
+	 * Number of total RC frames.
+	 * Note: intended purpose: observe the radio link quality if RSSI is not available
+	 * This value must not be used to trigger any failsafe-alike funtionality.
+	 * */
+	uint16_t		rc_total_frame_count;
+
 	/** Input source */
 	enum RC_INPUT_SOURCE 	input_source;


zos: write-protect message queue

zos: write-protect message queue

PR-URL: https://github.com/libuv/libuv/pull/1868
Reviewed-By: Ben Noordhuis <59bd0a3ff43b32849b319e645d4798d8a5d1e889@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <838f779c91673db29b8572ea3f54d191d3878ae2@gmail.com>

--- src/unix/os390-syscalls.c
+++ src/unix/os390-syscalls.c
@@ -141,7 +141,7 @@
   } msg;

   /* initialize message queue */
-  lst->msg_queue = msgget(IPC_PRIVATE, 0622 | IPC_CREAT);
+  lst->msg_queue = msgget(IPC_PRIVATE, 0600 | IPC_CREAT);
   if (lst->msg_queue == -1)
     abort();

@@ -255,7 +255,7 @@
     lst->items[fd].events = event->events;
     lst->items[fd].revents = 0;
   } else if (op == EPOLL_CTL_MOD) {
-    if (fd >= lst->size || lst->items[fd].fd == -1) {
+    if (fd >= lst->size - 1 || lst->items[fd].fd == -1) {
       uv_mutex_unlock(&global_epoll_lock);
       errno = ENOENT;
       return -1;


ws2812 mix: add all, then divide (#2032)

This achieves rounding between multiple summed frame buffers

--- app/modules/ws2812.c
+++ app/modules/ws2812.c
@@ -399,17 +399,19 @@

   size_t i;
   for (i = 0; i < cells; i++) {
-    int val = 0;
+    int32_t val = 0;
     for (src = 0; src < n_sources; src++) {
-      val += ((int)(source[src].values[i] * source[src].factor) >> 8);
-    }
+      val += (int32_t)(source[src].values[i] * source[src].factor);
+    }
+
+    val >>= 8;

     if (val < 0) {
       val = 0;
     } else if (val > 255) {
       val = 255;
     }
-    buffer->values[i] = val;
+    buffer->values[i] = (uint8_t)val;
   }

   return 0;


	* gphoto2-port-version.c: Mention resmgr in debug output.

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@5858 67ed7778-7388-44ab-90cf-0a291f65f57c

--- libgphoto2_port/libgphoto2_port/gphoto2-port-version.c
+++ libgphoto2_port/libgphoto2_port/gphoto2-port-version.c
@@ -42,6 +42,9 @@
 #endif
 #ifdef HAVE_SERIAL
 			"serial "
+#ifdef HAVE_RESMGR
+			"resmgr locking",
+#endif
 #ifdef HAVE_BAUDBOY
 			"baudboy locking",
 #elif HAVE_TTYLOCK
@@ -78,6 +81,11 @@
 			"serial (for serial cameras)",
 #else
 			"no serial (for serial cameras)",
+#endif
+#ifdef HAVE_RESMGR
+			"resmgr (serial port access and locking)",
+#else
+			"no resmgr (serial port access and locking)",
 #endif
 #ifdef HAVE_BAUDBOY
 			"baudboy (serial port locking)",


Use new ldns_buffer_copy();

Use new ldns_buffer_copy();

git-svn-id: 606cd7bb7c4874b1f27fc28ef6a6d76dca18f877@416 be551aaa-1e26-0410-a405-d3ace91eadb9

--- services/outside_network.c
+++ services/outside_network.c
@@ -1020,22 +1020,12 @@
 		 * may send outgoing queries that overwrite the buffer.
 		 * use secondary buffer to store the query.
 		 * This is a data copy, but faster than packet to server */
-		log_assert(ldns_buffer_capacity(sq->outnet->udp_second) >=
-			ldns_buffer_limit(c->buffer));
-		ldns_buffer_clear(sq->outnet->udp_second);
-		ldns_buffer_write(sq->outnet->udp_second,
-			ldns_buffer_begin(c->buffer),
-			ldns_buffer_limit(c->buffer));
-		ldns_buffer_flip(sq->outnet->udp_second);
+		ldns_buffer_copy(sq->outnet->udp_second, c->buffer);
 	}
 	while(p) {
 		n = p->next;
 		if(dobackup && c) {
-			ldns_buffer_clear(c->buffer);
-			ldns_buffer_write(c->buffer,
-			ldns_buffer_begin(sq->outnet->udp_second),
-			ldns_buffer_limit(sq->outnet->udp_second));
-			ldns_buffer_flip(c->buffer);
+			ldns_buffer_copy(c->buffer, sq->outnet->udp_second);
 		}
 		(void)(*p->cb)(c, p->cb_arg, error, rep);
 		p = n;


KVM: PPC: BOOK3S: Always use the saved DAR value

Although it's optional, IBM POWER cpus always had DAR value set on
alignment interrupt. So don't try to compute these values.

Signed-off-by: Aneesh Kumar K.V <f511f818e8a0748edef6b9ee378967da9ed0c78f@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <3ad82b0c937b9aa51276120cedd545efc822be04@suse.de>


sh: Fix up ctrl_read/write stragglers in migor setup.

ctrl_read/writeX are deprecated, this converts them over to their
__raw_read/write() counterparts.

Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>

--- arch/sh/boards/mach-migor/setup.c
+++ arch/sh/boards/mach-migor/setup.c
@@ -633,7 +633,7 @@
 	 * The original driver sets SIUB OLR/OBT, ILR/IBT, and SIUA OLR/OBT to
 	 * output. Need only SIUB, set to output for master mode (table 34.2)
 	 */
-	ctrl_outw(ctrl_inw(PORT_MSELCRA) | 1, PORT_MSELCRA);
+	__raw_writew(__raw_readw(PORT_MSELCRA) | 1, PORT_MSELCRA);

 	i2c_register_board_info(0, migor_i2c_devices,
 				ARRAY_SIZE(migor_i2c_devices));


Dump non-printable chars as hex instead of octal

--- bin/varnishtest/vtc_log.c
+++ bin/varnishtest/vtc_log.c
@@ -227,7 +227,8 @@
 		if (len < 0)
 			len = strlen(str);
 		VSB_quote_pfx(vl->vsb, buf, str,
-		    len > MAX_DUMP ? MAX_DUMP : len, VSB_QUOTE_UNSAFE);
+		    len > MAX_DUMP ? MAX_DUMP : len,
+		    VSB_QUOTE_UNSAFE | VSB_QUOTE_ESCHEX);
 		if (len > MAX_DUMP)
 			VSB_printf(vl->vsb, "%s [...] (%d)\n",
 			    buf, len - MAX_DUMP);


Remove debugging.

Remove debugging.

--- bin/varnishtest/vtc_log.c
+++ bin/varnishtest/vtc_log.c
@@ -106,10 +106,9 @@
 {

 	vtc_error = 2;
-	if (pthread_self() != vtc_thread) {
-		fprintf(stderr, "FAIL thread %p\n", pthread_self());
+	if (pthread_self() != vtc_thread)
 		pthread_exit(NULL);
-	} else
+	else
 		exit(fail_out());
 }


fix calculation of width and height

fix calculation of width and height

and make the padding relative to the overall size,
like it is done for the stroke-width

--- packCircles.c
+++ packCircles.c
@@ -58,25 +58,25 @@

 static void printSVG(node_t * first, node_t * a_, node_t * bb_topright, node_t * bb_bottomleft, int debug) {
-	double spacing = 5.0;
-	double height = (bb_topright->y + abs(bb_bottomleft->y)) + 2* spacing;
-	double width = (bb_topright->x + abs(bb_bottomleft->x)) + 2* spacing;
+	double spacing = MAX(bb_topright->y + fabs(bb_bottomleft->y), bb_topright->x + fabs(bb_bottomleft->x)) / 400.0;
+	double height = (bb_topright->y + fabs(bb_bottomleft->y)) + 2 * spacing;
+	double width = (bb_topright->x + fabs(bb_bottomleft->x)) + 2 * spacing;
 	int viewport_width = 640;
 	int viewport_height = 480;
 	// scaling of stroke-width with the size of the image
-	float stroke_width = viewport_width / 400 * (width/viewport_width);
-
-	printf("<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"%i\" width=\"%i\" viewBox=\"0 0 %.3f %.3f\" preserveAspectRatio=\"xMidYMid meet\">\n",viewport_height,viewport_width,width,height);
+	double stroke_width = viewport_width / 400 * (width/viewport_width);
+
+	printf("<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"%i\" width=\"%i\" viewBox=\"0 0 %.5f %.5f\" preserveAspectRatio=\"xMidYMid meet\">\n",viewport_height,viewport_width,width,height);
 	printf("<defs>\n");
 	printf("<style type=\"text/css\"><![CDATA[\n");
 	printf("  .circle_c { fill:#eee; stroke: #444; stroke-width: %.2f }\n",stroke_width);
 	// optionally:  printf("  .circle_c:hover { stroke: #444; stroke-width: %.2f }\n",2*stroke_width);
 	printf("]]></style>\n");
 	printf("</defs>\n");
-	printf("<g transform=\"translate(%.3f,%.3f)\">\n",(width)/2,(height)/2);
-
-	double offset_x = (bb_bottomleft->x + bb_topright->x) / 2;
-	double offset_y = (bb_bottomleft->y + bb_topright->y) / 2;
+	printf("<g transform=\"translate(%.5f,%.5f)\">\n",(width)/2.0,(height)/2.0);
+
+	double offset_x = (bb_bottomleft->x + bb_topright->x) / 2.0;
+	double offset_y = (bb_bottomleft->y + bb_topright->y) / 2.0;

 	node_t * n = first;
 	while(n) {
@@ -314,11 +314,11 @@
 	node_t * lastinsertednode = NULL;

   node_t * bb_bottomleft = alloc_node(0,-1);
-	bb_bottomleft->y = INT_MAX;
-	bb_bottomleft->x = INT_MAX;
+	bb_bottomleft->y = (double)INT_MAX;
+	bb_bottomleft->x = (double)INT_MAX;
   node_t * bb_topright = alloc_node(0,-1);
-	bb_topright->y = INT_MIN;
-	bb_topright->x = INT_MIN;
+	bb_topright->y = (double)INT_MIN;
+	bb_topright->x = (double)INT_MIN;

 	/* parse command line */
   opterr = 0;


Don't update added team abbreviation in career data

--- NHL95DBEditor/src/teams.c
+++ NHL95DBEditor/src/teams.c
@@ -219,7 +219,6 @@
   write_db_file(&team_data->teams, FILE_TEAMS);

   /* Overwrite team career data */
-  sprintf(new_team_career->abbreviation, "NEW");
   sprintf(new_team_career->short_name, "New Team");
   sprintf(new_team_career->long_name, "New Team Katit");
   new_team_career->division = 1;


Fix wrong printf type specifications.

Fix wrong printf type specifications.

--- tests/common/omxil_utils.c
+++ tests/common/omxil_utils.c
@@ -676,9 +676,9 @@
 		p->pMarkData,
 		(int)p->nTickCount,
 #ifndef OMX_SKIP64BIT
-		p->nTimeStamp,
+		(unsigned long long)p->nTimeStamp,
 #else
-		(uint64_t)(nTimeStamp.nHighPart << 32) | nTimeStamp.nLowPart,
+		(unsigned long long)(nTimeStamp.nHighPart << 32) | nTimeStamp.nLowPart,
 #endif
 		(int)p->nFlags,
 		(int)p->nOutputPortIndex,


WebPPictureDistortion: fix big-endian results order

match the little-endian BGRA order

Change-Id: Ie8f1ae3100fac478bae13e53121a6af5b2443374

--- src/enc/picture_psnr_enc.c
+++ src/enc/picture_psnr_enc.c
@@ -18,6 +18,7 @@
 #include <math.h>
 #include <stdlib.h>

+#include "src/dsp/dsp.h"
 #include "src/enc/vp8i_enc.h"
 #include "src/utils/utils.h"

@@ -169,6 +170,12 @@
   return 1;
 }

+#ifdef WORDS_BIGENDIAN
+#define BLUE_OFFSET 3   // uint32_t 0x000000ff is 0x00,00,00,ff in memory
+#else
+#define BLUE_OFFSET 0   // uint32_t 0x000000ff is 0xff,00,00,00 in memory
+#endif
+
 int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
                           int type, float results[5]) {
   int w, h, c;
@@ -195,8 +202,10 @@
     float distortion;
     const size_t stride0 = 4 * (size_t)p0.argb_stride;
     const size_t stride1 = 4 * (size_t)p1.argb_stride;
-    if (!WebPPlaneDistortion((const uint8_t*)p0.argb + c, stride0,
-                             (const uint8_t*)p1.argb + c, stride1,
+    // results are reported as BGRA
+    const int offset = c ^ BLUE_OFFSET;
+    if (!WebPPlaneDistortion((const uint8_t*)p0.argb + offset, stride0,
+                             (const uint8_t*)p1.argb + offset, stride1,
                              w, h, 4, type, &distortion, results + c)) {
       goto Error;
     }
@@ -213,6 +222,8 @@
   WebPPictureFree(&p1);
   return ok;
 }
+
+#undef BLUE_OFFSET

 #else  // defined(WEBP_DISABLE_STATS)
 int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,


refactor error checking

refactor error checking

--- src/context.c
+++ src/context.c
@@ -61,14 +61,14 @@
 	ctx->destroy_func = destroy_func;
         R_SetExternalPtrAddr(ans, ctx);

+	ctx = NULL;
+	obj = NULL;
+	UNPROTECT(1);
 out:
-	if (err) {
-		corpus_free(ctx);
-		corpus_free(obj);
-		error("failed allocating memory for context");
-	}
+	corpus_free(ctx);
+	corpus_free(obj);
+	CHECK_ERROR(err);

-	UNPROTECT(1);
 	return ans;
 }

@@ -85,7 +85,7 @@
 	struct context *ctx;

 	if (!is_context(x)) {
-		error("invalid 'context' object");
+		error("invalid context object");
 	}

 	ctx = R_ExternalPtrAddr(x);


context FEATURE use explicit compilation for context creation

Because recompilation would be needed otherwise
if LY_CTX_ALL_IMPLEMENTED is used.

--- src/context.c
+++ src/context.c
@@ -269,6 +269,11 @@
     }
     ctx->change_count = 1;

+    if (!(options & LY_CTX_EXPLICIT_COMPILE)) {
+        /* use it for creating the initial context */
+        ctx->flags |= LY_CTX_EXPLICIT_COMPILE;
+    }
+
     /* create dummy in */
     rc = ly_in_new_memory(internal_modules[0].data, &in);
     LY_CHECK_GOTO(rc, error);
@@ -282,6 +287,12 @@

     /* resolve global unres */
     LY_CHECK_GOTO(rc = lys_compile_unres_glob(ctx, &unres), error);
+
+    if (!(options & LY_CTX_EXPLICIT_COMPILE)) {
+        /* compile now */
+        LY_CHECK_GOTO(rc = ly_ctx_compile(ctx), error);
+        ctx->flags &= ~LY_CTX_EXPLICIT_COMPILE;
+    }

     ly_in_free(in, 0);
     lys_compile_unres_glob_erase(ctx, &unres);


Added SPI bit bang

Added SPI bit bang

--- bioloid/wln-cli/wln-cli.c
+++ bioloid/wln-cli/wln-cli.c
@@ -58,6 +58,10 @@
 #define INT_PIN     PINB
 #define INT_MASK    ( 1 << 1 )

+#define RESET_DDR   DDRD
+#define RESET_PORT  PORTD
+#define RESET_MASK  ( 1 << 2 )
+
 #define SetDirectionIn(x)   x ## _DDR &= ~ x ## _MASK
 #define SetDirectionOut(x)  x ## _DDR |=   x ## _MASK

@@ -80,6 +84,68 @@

 //***************************************************************************
 /**
+*   Activates the SS signal that goes to the slave
+*/
+
+static inline void ActivateSlave( void )
+{
+    // SS is active low
+
+    SS_PORT &= ~SS_MASK;
+
+} // ActivateSlave
+
+//***************************************************************************
+/**
+*   Deactivates the SS signal that goes to the slave
+*/
+
+static inline void DeactivateSlave( void )
+{
+    // SS is active low
+
+    SS_PORT |= SS_MASK;
+
+} // DeactivateSlave
+
+#if SPI_BIT_BANG
+
+//***************************************************************************
+/**
+*   Functions for manipulating SCK, MOSI and MISO
+*/
+
+static inline void SPI_ClockLow( void )
+{
+    SCK_PORT &= ~SCK_MASK;
+}
+
+static inline void SPI_ClockHigh( void )
+{
+    SCK_PORT |= ~SCK_MASK;
+}
+
+static inline void SPI_DataOut( uint8_t bit )
+{
+    if ( bit )
+    {
+        MOST_PORT |= MOSI_MASK;
+    }
+    else
+    {
+        MOSI_PORT &= ~MOSI_MASK;
+    }
+}
+
+static inline uint8_t SPI_DataIn( uint8_t )
+{
+    return ( MISO_PORT & MISO_MASK ) != 0;
+}
+
+#endif
+
+//***************************************************************************
+/**
 *   Initialize the SPI for Master mode
 */

@@ -87,7 +153,9 @@
 {
 #if SPI_BIT_BANG

-
+    // SCK idles low
+
+    SPI_ClockLow();

 #else
     // The Airborne WLAN only supports mode = 1
@@ -104,7 +172,7 @@
          | ( 1 << SPR0 );
 #endif

-    SS_PORT |= SS_MASK;
+    DeactivateSlave();

 } // SPI_MasterInit

@@ -115,6 +183,21 @@

 static uint8_t SPI_XferByte( uint8_t b )
 {
+#if SPI_BIT_BANG
+
+    uint8_t i;
+
+    for ( i = 0; i < 8; i++ )
+    {
+        SPI_DataOut( b & 0x80 );
+        SPI_ClockHigh();
+        b <<= 1;
+        SPI_ClockLow();
+        b |= SPI_DataIn();
+    }
+
+    return b;
+#else
     // Kick off the transmission

     SPDR = b;
@@ -129,6 +212,7 @@
     // Read (and return) the read byte

     return SPDR;
+#endif

 } // SPI_XferByte

@@ -157,12 +241,12 @@
 {
     uint8_t status;

-    SS_PORT &= ~SS_MASK;
+    ActivateSlave();

     SPI_XferByte( WLN_CMD_READ_CONFIG );
     status = SPI_XferByte( 0 );

-    SS_PORT |= SS_MASK;
+    DeactivateSlave();

     return status;

@@ -179,14 +263,14 @@
     uint8_t lenLo;
     uint8_t data;

-    SS_PORT &= ~SS_MASK;
+    ActivateSlave();

     SPI_XferByte( WLN_CMD_READ_DATA );
     lenHi = SPI_XferByte( 0 );
     lenLo = SPI_XferByte( 0 );
     data  = SPI_XferByte( 0 );

-    SS_PORT |= SS_MASK;
+    DeactivateSlave();

     Log( "ReadData: 0x%02x 0x%02x 0x%02x\n", lenHi, lenLo, data );

@@ -249,11 +333,17 @@

             if ( UART0_IsCharAvailable() )
             {
-                char    ch =
-                UART0_GetChar();
+                char    ch = UART0_GetChar();
+
+                if ( ch == '*' )
+                {
+                    Log( "Reset\n" );
+
+                    SetDirectionOut( RESET );
+                    RESET_PORT &= ~RESET_MASK;
+                }

                 Log( "Read: '%c'\n", ch );
-
                 WLN_ReadData();
             }
         }


schema parsers CHANGE ignore 0-length revision and handle it as NULL

--- src/context.c
+++ src/context.c
@@ -679,7 +679,7 @@
         return NULL;
     }

-    return ly_ctx_load_sub_module(ctx, NULL, name, revision, 1, NULL);
+    return ly_ctx_load_sub_module(ctx, NULL, name, revision && revision[0] ? revision : NULL, 1, NULL);
 }

 /*


unit: Add SDP Service Search Attribute Requests attribute responses


vppinfra: fix memory leak in sparse_vec_free()

Type: fix

Signed-off-by: Ivan Shvedunov <5ce0144c68fb318882064dd935e03a1fcc537ac0@gmail.com>
Signed-off-by: Sergey Matov <f1f0f18ac19a52f2b0254e1d6b566b47a3bdb1b1@travelping.com>
Change-Id: I4ec1a68b7266f05ab7c543cd8207afb29e740743

--- src/vppinfra/sparse_vec.h
+++ src/vppinfra/sparse_vec.h
@@ -225,7 +225,10 @@
     {                                                                         \
       if (V)                                                                  \
 	{                                                                     \
-	  clib_mem_free (sparse_vec_header (V));                              \
+	  sparse_vec_header_t *_h = sparse_vec_header (V);                    \
+	  vec_free (_h->is_member_bitmap);                                    \
+	  vec_free (_h->member_counts);                                       \
+	  clib_mem_free (_h);                                                 \
 	  V = 0;                                                              \
 	}                                                                     \
     }                                                                         \


Cleaned up some comments.

Cleaned up some comments.

--- src/vw/Math/EulerAngles.h
+++ src/vw/Math/EulerAngles.h
@@ -131,17 +131,13 @@
   inline vw::Matrix<double,3,3> euler_to_rotation_matrix(double phi, double omega, double kappa, std::string const& sequence) {

     VW_ASSERT(sequence.size() == 3,
-              vw::ArgumentErr() << "euler_to_quaternion: rotation sequence must be a three character sequence composed of \'x\', \'y\', and \'z\'.");
+              vw::ArgumentErr() << "euler_to_rotation_matrix: rotation sequence must be a three character sequence composed of \'x\', \'y\', and \'z\'.");

     vw::Matrix<double,3,3> e_phi = euler_rotation_helper(phi, sequence[0]);
     vw::Matrix<double,3,3> e_omega = euler_rotation_helper(omega, sequence[1]);
     vw::Matrix<double,3,3> e_kappa = euler_rotation_helper(kappa, sequence[2]);

-    // Re-enabled 09-11-08 - mbroxton
     return e_kappa*e_omega*e_phi;
-
-    // Dis-enabled 09-11-08 pending further discussion with Zach - mbroxton
-    //    return e_phi*e_omega*e_kappa;
   }

   /// Quaternion variant of euler_to_rotation_matrix()


server: move include directives before extern "C" wrapper

Analogous to previous commit but for the server(-core) header.

Signed-off-by: Emil Velikov <4c996f2f093ddd0585a556460b4cc3ba555546ef@gmail.com>
Reviewed-by: Pekka Paalanen <0f6ae7001e34c37b02fb2c1c2573ddf8f442136a@collabora.co.uk>
Reviewed-by: Quentin Glidic <241385a0e41ea713327e189bce1062decf7c1eb5@sardemff7.net>

--- src/wayland-server-core.h
+++ src/wayland-server-core.h
@@ -26,14 +26,14 @@
 #ifndef WAYLAND_SERVER_CORE_H
 #define WAYLAND_SERVER_CORE_H

-#ifdef  __cplusplus
-extern "C" {
-#endif
-
 #include <sys/types.h>
 #include <stdint.h>
 #include "wayland-util.h"
 #include "wayland-version.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif

 enum {
 	WL_EVENT_READABLE = 0x01,


app/procinfo: add device registers dump

app/procinfo: add device registers dump

This patch add support for dump the device registers from a running
application. It can help developers locate the problem.

Signed-off-by: Chengchang Tang <c3ddc20cc64e98ec759ab2989e2da0f93b89cab6@huawei.com>
Signed-off-by: Min Hu (Connor) <f02e10cb0a484c51b0f8634f83fbb4ab9ded1c6a@huawei.com>
Acked-by: Reshma Pattan <4d9eb35579760ed1c2db754a6b402039c9c8a1cb@intel.com>

--- app/proc-info/main.c
+++ app/proc-info/main.c
@@ -94,6 +94,9 @@
 /**< Enable iter mempool. */
 static uint32_t enable_iter_mempool;
 static char *mempool_iter_name;
+/**< Enable dump regs. */
+static uint32_t enable_dump_regs;
+static char *dump_regs_file_prefix;

 /**< display usage */
 static void
@@ -119,7 +122,8 @@
 		"  --show-crypto: to display crypto information\n"
 		"  --show-ring[=name]: to display ring information\n"
 		"  --show-mempool[=name]: to display mempool information\n"
-		"  --iter-mempool=name: iterate mempool elements to display content\n",
+		"  --iter-mempool=name: iterate mempool elements to display content\n"
+		"  --dump-regs=file-prefix: dump registers to file with the file-prefix\n",
 		prgname);
 }

@@ -226,6 +230,7 @@
 		{"show-ring", optional_argument, NULL, 0},
 		{"show-mempool", optional_argument, NULL, 0},
 		{"iter-mempool", required_argument, NULL, 0},
+		{"dump-regs", required_argument, NULL, 0},
 		{NULL, 0, 0, 0}
 	};

@@ -288,6 +293,10 @@
 					"iter-mempool", MAX_LONG_OPT_SZ)) {
 				enable_iter_mempool = 1;
 				mempool_iter_name = optarg;
+			} else if (!strncmp(long_option[option_index].name,
+					"dump-regs", MAX_LONG_OPT_SZ)) {
+				enable_dump_regs = 1;
+				dump_regs_file_prefix = optarg;
 			}
 			break;
 		case 1:
@@ -1349,6 +1358,85 @@
 	}
 }

+static void
+dump_regs(char *file_prefix)
+{
+#define MAX_FILE_NAME_SZ (MAX_LONG_OPT_SZ + 10)
+	char file_name[MAX_FILE_NAME_SZ];
+	struct rte_dev_reg_info reg_info;
+	struct rte_eth_dev_info dev_info;
+	unsigned char *buf_data;
+	size_t buf_size;
+	FILE *fp_regs;
+	uint16_t i;
+	int ret;
+
+	snprintf(bdr_str, MAX_STRING_LEN, " dump - Port REG");
+	STATS_BDR_STR(10, bdr_str);
+
+	RTE_ETH_FOREACH_DEV(i) {
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+
+		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		STATS_BDR_STR(5, bdr_str);
+
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret) {
+			printf("Error getting device info: %d\n", ret);
+			continue;
+		}
+
+		memset(&reg_info, 0, sizeof(reg_info));
+		ret = rte_eth_dev_get_reg_info(i, &reg_info);
+		if (ret) {
+			printf("Error getting device reg info: %d\n", ret);
+			continue;
+		}
+
+		buf_size = reg_info.length * reg_info.width;
+		buf_data = malloc(buf_size);
+		if (buf_data == NULL) {
+			printf("Error allocating %zu bytes buffer\n", buf_size);
+			continue;
+		}
+
+		reg_info.data = buf_data;
+		reg_info.length = 0;
+		ret = rte_eth_dev_get_reg_info(i, &reg_info);
+		if (ret) {
+			printf("Error getting regs from device: %d\n", ret);
+			free(buf_data);
+			continue;
+		}
+
+		snprintf(file_name, MAX_FILE_NAME_SZ, "%s-port%u",
+				file_prefix, i);
+		fp_regs = fopen(file_name, "wb");
+		if (fp_regs == NULL) {
+			printf("Error during opening '%s' for writing: %s\n",
+					file_name, strerror(errno));
+		} else {
+			size_t nr_written;
+
+			nr_written = fwrite(buf_data, 1, buf_size, fp_regs);
+			if (nr_written != buf_size)
+				printf("Error during writing %s: %s\n",
+						file_prefix, strerror(errno));
+			else
+				printf("Device (%s) regs dumped successfully, "
+					"driver:%s version:0X%08X\n",
+					dev_info.device->name,
+					dev_info.driver_name, reg_info.version);
+
+			fclose(fp_regs);
+		}
+
+		free(buf_data);
+	}
+}
+
 int
 main(int argc, char **argv)
 {
@@ -1454,6 +1542,8 @@
 		show_mempool(mempool_name);
 	if (enable_iter_mempool)
 		iter_mempool(mempool_iter_name);
+	if (enable_dump_regs)
+		dump_regs(dump_regs_file_prefix);

 	RTE_ETH_FOREACH_DEV(i)
 		rte_eth_dev_close(i);


CITE tests not allows such a thing (cf #51). Revert r338 behaviour.  Few code styling.

git-svn-id: 3d54f09c3274966c78a0b0842e411ae2b9b02a46@409 5b3c568a-86f9-4a59-a47a-7be284f604b4

--- src/wfs/wfs_get_feature.c
+++ src/wfs/wfs_get_feature.c
@@ -99,6 +99,7 @@
     /* No Pkey display in GML (default behaviour) */
     if (pkey && pkey->buf && !strcmp(prop_name, pkey->buf) && !o->expose_pk) return;

+    if (!strlen(value)) return;
 #if 0
     /* Don't handle boundedBy column (CITE 1.0 Unit test)) */
     if (!strcmp(prop_name, "boundedBy")) return;
@@ -154,8 +155,7 @@
 /*
  * Display in GML all feature members returned by the request
  */
-void wfs_gml_feature_member(ows * o, wfs_request * wr, buffer * layer_name,
-                            list * properties, PGresult * res)
+void wfs_gml_feature_member(ows * o, wfs_request * wr, buffer * layer_name, list * properties, PGresult * res)
 {
     int i, j, number, end, nb_fields;
     buffer *id_name, *ns_prefix, *prop_type;
@@ -389,11 +389,7 @@
             wfs_gml_feature_member(o, wr, layer_name, mln_property->value, res);
         else
             /* Use NULL if propertynames not defined */
-            wfs_gml_feature_member(
-o,
-wr,
-layer_name, NULL,
-res);
+            wfs_gml_feature_member(o, wr, layer_name, NULL, res);

         PQclear(res);


Some JPEG fixes for out of bound image access

--- src/wholeslide-ops-jpeg.c
+++ src/wholeslide-ops-jpeg.c
@@ -44,12 +44,12 @@
 			uint32_t w, uint32_t h) {
   struct _ws_jpegopsdata *data = wsd->data;

-  if (layer >= 4) {
-    return;
-  }
-
   // clear
   memset(dest, 0, w * h * sizeof(uint32_t));
+
+  if (layer >= 4 || x >= data->widths[0] || y >= data->heights[0]) {
+    return;
+  }

   // select downsample
   uint32_t downsample = 1 << layer;
@@ -60,14 +60,18 @@
   uint32_t tile_y = y / data->tile_height;
   uint32_t tile_x = x / data->tile_width;

+  uint32_t stride_in_tiles = data->widths[0] / data->tile_width;
+  uint32_t img_height_in_tiles = data->heights[0] / data->tile_height;
+
   imaxdiv_t divtmp;
-  divtmp = imaxdiv(data->widths[0], data->tile_width);
-  uint32_t stride_in_tiles = divtmp.quot + !!divtmp.rem;  // integer ceil
   divtmp = imaxdiv((w * downsample) + (x % data->tile_width), data->tile_width);
-  uint32_t width_in_tiles = divtmp.quot + !!divtmp.rem;
-
-  // clamp width
-  width_in_tiles = MIN(width_in_tiles, tile_x + stride_in_tiles);
+  uint32_t width_in_tiles = divtmp.quot + !!divtmp.rem;  // integer ceil
+  divtmp = imaxdiv((h * downsample) + (y % data->tile_height), data->tile_height);
+  uint32_t height_in_tiles = divtmp.quot + !!divtmp.rem;
+
+  // clamp width and height
+  width_in_tiles = MIN(width_in_tiles, stride_in_tiles - tile_x);
+  height_in_tiles = MIN(height_in_tiles, img_height_in_tiles - tile_y);

   printf("width_in_tiles: %d, stride_in_tiles: %d\n", width_in_tiles, stride_in_tiles);
   printf("tile_x: %d, tile_y: %d\n", tile_x, tile_y);
@@ -85,6 +89,7 @@
   jpeg_read_header(&data->cinfo, TRUE);
   data->cinfo.scale_denom = downsample;
   data->cinfo.image_width = width_in_tiles * data->tile_width;  // cunning
+  data->cinfo.image_height = height_in_tiles * data->tile_height;

   jpeg_start_decompress(&data->cinfo);
   g_assert(data->cinfo.output_components == 3);
@@ -120,7 +125,7 @@
     while (rows_read > 0 && rows_left > 0) {
       // copy a row
       if (rows_to_skip == 0) {
-	for (uint32_t i = 0; i < w && i < data->cinfo.output_width; i++) {
+	for (uint32_t i = 0; i < w && i < (data->cinfo.output_width - d_x); i++) {
 	  dest[i] = 0xFF000000 |                          // A
 	    buffer[cur_buffer][(d_x + i) * 3 + 0] << 16 | // R
 	    buffer[cur_buffer][(d_x + i) * 3 + 1] << 8 |  // G


Corrected how much memory needs to be allocated for a task list entry
and renamed the local variable "task" to "task_entry" to avoid build problems
on the MTA and XMT, as it appears "task" is some sort of reserved word.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@13886 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

--- runtime/src/chplthreads.c
+++ runtime/src/chplthreads.c
@@ -7,11 +7,11 @@
 #include "chplmem.h"

 void chpl_add_to_task_list (chpl_threadfp_t fun, chpl_threadarg_t arg, chpl_task_list_p *task_list) {
-  chpl_task_list_p task = (chpl_task_list_p)_chpl_malloc(1, sizeof(chpl_task_list_p), "task list entry", 0, 0);
-  task->fun = fun;
-  task->arg = arg;
-  task->next = *task_list;
-  *task_list = task;
+  chpl_task_list_p task_entry = (chpl_task_list_p)_chpl_malloc(1, sizeof(struct chpl_task_list), "task list entry", 0, 0);
+  task_entry->fun = fun;
+  task_entry->arg = arg;
+  task_entry->next = *task_list;
+  *task_list = task_entry;
 }

 void chpl_process_task_list (chpl_task_list_p task_list) {


Proxy task fix: task_state stack push condition on fork

The problem is that the master's thread state was not saved before entering a
parallel region so it does not remember tasks when it returns.

git-svn-id: f99161ee8ccfe2101cbe1bdda2220bce2ed25485@260306 91177308-0d34-0410-b5e6-96231b3b80d8

--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -2093,7 +2093,8 @@
         KA_TRACE( 20, ( "__kmp_fork_call: Master T#%d pushing task_team %p / team %p, new task_team %p / team %p\n",
                       __kmp_gtid_from_thread( master_th ), master_th->th.th_task_team,
                       parent_team, team->t.t_task_team[master_th->th.th_task_state], team ) );
-        if (level) {
+
+        if ( level || master_th->th.th_task_team ) {
             // Take a memo of master's task_state
             KMP_DEBUG_ASSERT(master_th->th.th_task_state_memo_stack);
             if (master_th->th.th_task_state_top >= master_th->th.th_task_state_stack_sz) { // increase size


forgot an include file

forgot an include file

error: pathspec 'bl2/incl/stm32/iwdg_reg.h' did not match any file(s) known to git

--- bl2/incl/stm32/iwdg_reg.h
+++ bl2/incl/stm32/iwdg_reg.h
@@ -0,0 +1,14 @@
+
+
+#define IWDG_KR_KICK	0xaaaa
+#define IWDG_KR_START	0xcccc
+#define IWDG_KR_UNLOCK	0x5555
+
+
+
+struct IWDG {
+	unsigned int KR;    // 0x00
+	unsigned int PR;    // 0x04
+	unsigned int RLR;   // 0x08
+	unsigned int SR;	 // 0x0c
+};


Fix warnings when CP_DATA_POINTER_TYPE is defined.

--- src/cpSpace.c
+++ src/cpSpace.c
@@ -63,27 +63,27 @@
 // Default collision functions.

 static cpBool
-DefaultBegin(cpArbiter *arb, cpSpace *space, void *data){
+DefaultBegin(cpArbiter *arb, cpSpace *space, cpDataPointer data){
 	cpBool retA = cpArbiterCallWildcardBeginA(arb, space);
 	cpBool retB = cpArbiterCallWildcardBeginB(arb, space);
 	return retA && retB;
 }

 static cpBool
-DefaultPreSolve(cpArbiter *arb, cpSpace *space, void *data){
+DefaultPreSolve(cpArbiter *arb, cpSpace *space, cpDataPointer data){
 	cpBool retA = cpArbiterCallWildcardPreSolveA(arb, space);
 	cpBool retB = cpArbiterCallWildcardPreSolveB(arb, space);
 	return retA && retB;
 }

 static void
-DefaultPostSolve(cpArbiter *arb, cpSpace *space, void *data){
+DefaultPostSolve(cpArbiter *arb, cpSpace *space, cpDataPointer data){
 	cpArbiterCallWildcardPostSolveA(arb, space);
 	cpArbiterCallWildcardPostSolveB(arb, space);
 }

 static void
-DefaultSeparate(cpArbiter *arb, cpSpace *space, void *data){
+DefaultSeparate(cpArbiter *arb, cpSpace *space, cpDataPointer data){
 	cpArbiterCallWildcardSeparateA(arb, space);
 	cpArbiterCallWildcardSeparateB(arb, space);
 }
@@ -94,8 +94,8 @@
 	DefaultBegin, DefaultPreSolve, DefaultPostSolve, DefaultSeparate, NULL
 };

-static cpBool AlwaysCollide(cpArbiter *arb, cpSpace *space, void *data){return cpTrue;}
-static void DoNothing(cpArbiter *arb, cpSpace *space, void *data){}
+static cpBool AlwaysCollide(cpArbiter *arb, cpSpace *space, cpDataPointer data){return cpTrue;}
+static void DoNothing(cpArbiter *arb, cpSpace *space, cpDataPointer data){}

 cpCollisionHandler cpCollisionHandlerDoNothing = {
 	CP_WILDCARD_COLLISION_TYPE, CP_WILDCARD_COLLISION_TYPE,


UPD: reduce variable scope

UPD: reduce variable scope

--- src/worker/worker_utils.c
+++ src/worker/worker_utils.c
@@ -98,12 +98,12 @@

 static int32_t worker_log_fill_last_dir(char *path, size_t max_len, gru_status_t *status) {
 	int32_t ret = 0;
-	bool exists;

 	do {
+
 		snprintf(path, max_len, "%s/%"PRId32"", options_get_log_dir(), ret);

-		exists = gru_path_exists(path, status);
+		bool exists = gru_path_exists(path, status);
 		if (!exists) {
 			return ret;
 		}