bugfix: file_limit pointer cause Segmentation fault

--- src/rule.c
+++ src/rule.c
@@ -835,9 +835,8 @@
 		break;
 	case '$' :
 		sscanf(file_path + 1, "%s", a_rule->record_name);
-

-		if (*file_limit != '\0') {  /* record path exists */
+		if (file_limit) {  /* record path exists */
 			p = strchr(file_limit, '"');
 			if (!p) {
 				zc_error("record_path not start with \", [%s]", file_limit);


a cipher should not print

a cipher should not print

--- src/scmo.c
+++ src/scmo.c
@@ -1,6 +1,5 @@
 #include <stdint.h>
 #include <stddef.h>
-#include <stdio.h>

 #include "scmo.h"
 #include "util.h"
@@ -15,7 +14,6 @@
 		c = ((uint8_t*)&key)[j];

 		buffer[i] = c ^ data[i];
-		printf("%02X -> %02X (%c) -> %02X\n", c, data[i], data[i], buffer[i]);
 	}

 	return data;


Use the default delay before a handshake is sent when the local address is invalid

Sending it right away will make crossed handshakes more probable which is
especially painful when roaming, so it's better to add the delay.

--- src/send.c
+++ src/send.c
@@ -126,7 +126,7 @@
 		pr_debug2(ctx, "sendmsg failed, trying again without pktinfo");

 		if (peer && !fastd_peer_handshake_scheduled(ctx, peer))
-			fastd_peer_schedule_handshake(ctx, peer, 0);
+			fastd_peer_schedule_handshake_default(ctx, peer);

 		msg.msg_control = NULL;
 		msg.msg_controllen = 0;


include macro for including file location

for easier debugging

--- src/serr.h
+++ src/serr.h
@@ -1,5 +1,9 @@
 #ifndef SERR_H
 #define SERR_H
+
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define AT(x) "[" __FILE__ ":" TOSTRING(__LINE__) "] " x

 __dead void serr(int, int, const char *);
 __dead void serrx(int, int, const char *);


Move defines and define additional error condition

I haven't even attempted to compile, so be warned.

--- src/sha2.c
+++ src/sha2.c
@@ -73,6 +73,18 @@
 #endif

 #define ARRAY_SZ    1024*32
+
+#define RV_SUCCESS      0
+#define RV_INVALARG     1
+#define RV_NESTEDERR    2
+/* @note
+ * RV_UNKNOWN never is returned in any legitimate execution. It is only
+ * returned if something erraneous happens on the proccessor. If this is being
+ * used in a sensitive context, then you will want to assert that you never
+ * receive this.
+ */
+#define RV_UNKNOWN      255
+

 // TODO Include getopts and what not
 // TODO Adjust output depending on format switch, defines below to help with that
@@ -127,6 +139,29 @@
 const int16_t blk_sz = 64;
 const int16_t last_blk_sz = 56;

+typedef struct {
+    char *tv;
+    uint64_t len;
+    uint32_t hash[8];
+} testvector_t;
+
+typedef struct {
+    FILE *fp;
+    uint32_t hash[8];
+    char *filename;
+    uint32_t flags;
+} checkentry_t;
+
+typedef struct {
+    uint32_t h[8];      ///< SHA256 Hash
+    uint32_t blk[16];   ///< Block that is being worked on
+    uint32_t pos;       ///< Position in the block
+    uint64_t tot;       ///< Total bytes hashed in so far
+} sha256_ctx_t;
+
+typedef uint8_t rv_t;
+
+
 #define CH(x,y,z)   ((x&y)^(~x&z))
 #define MAJ(x,y,z)  ((x&y)^(x&z)^(y&z))
 #define ROTR(n,x)   ((x>>n)|(x<<(32-n)))
@@ -232,39 +267,6 @@

     return retval;
 }
-
-typedef struct {
-    char *tv;
-    uint64_t len;
-    uint32_t hash[8];
-} testvector_t;
-
-typedef struct {
-    FILE *fp;
-    uint32_t hash[8];
-    char *filename;
-    uint32_t flags;
-} checkentry_t;
-
-typedef struct {
-    uint32_t h[8];      ///< SHA256 Hash
-    uint32_t blk[16];   ///< Block that is being worked on
-    uint32_t pos;       ///< Position in the block
-    uint64_t tot;       ///< Total bytes hashed in so far
-} sha256_ctx_t;
-
-typedef uint8_t rv_t;
-
-#define RV_SUCCESS      0
-#define RV_INVALARG     1
-#define RV_NESTEDERR    2
-/* @note
- * RV_UNKNOWN never is returned in any legitimate execution. It is only
- * returned if something erraneous happens on the proccessor. If this is being
- * used in a sensitive context, then you will want to assert that you never
- * receive this.
- */
-#define RV_UNKNOWN      255

 #define NESSIE_TV_MAX 8


Use EUID instead of RUID for determining the socket to use.

This is due to the permissions of the socket being based on the EUID, as well
as what the spawned daemon can do.

--- src/shim.c
+++ src/shim.c
@@ -161,7 +161,7 @@
  */
 static void post_init(void) {
   /* Use a UNIX socket to talk to the daemon. The socket is located at
-   *   /tmp/prereashim:RUID:PROFILE
+   *   /tmp/prereashim:EUID:PROFILE
    * where PROFILE is the environment variable CHISTKA_PROFILE, or the
    * empty string if that is not defined. Any forward slashes in PROFILE are
    * replaced with backslashes.
@@ -198,7 +198,7 @@
   /* Construct the address */
   addr.sun_family = AF_UNIX;
   snprintf(addr.sun_path, sizeof(addr.sun_path), "/tmp/chistka:%d:%s",
-           getuid(), profile);
+           geteuid(), profile);
   if (!bind(sock, &addr,
             offsetof(struct sockaddr_un, sun_path) +
             strlen(addr.sun_path) + 1)) {


Fix a buffer overflow with long clude lists.

bk: 52152917fy7L72XwbMsB-siU4fFPfg

--- src/slib.c
+++ src/slib.c
@@ -14319,34 +14319,37 @@
 	return (0);
 }

-private void
-mkTag(char *rev, char *revM, pfile *pf, char *path, char tag[])
-{
+private char *
+mkTag(char *rev, char *revM, pfile *pf, char *path)
+{
+	FILE	*tag = fmem();
+
 	/*
 	 * 1.0 => create (or reverse create in a reverse pacth )
 	 * /dev/null => delete (i.e. sccsrm)
 	 */
 	if (streq(rev, "1.0") || streq(path, DEVNULL_RD)) {
-		sprintf(tag, "%s", "/dev/null");
+		fprintf(tag, "%s", "/dev/null");
 	} else {
-		strcpy(tag, rev);
-		if (revM) {
-			strcat(tag, "+");
-			strcat(tag, revM);
+		fputs(rev, tag);
+		if (revM) {
+			fputc('+', tag);
+			fputs(revM, tag);
 		}
 		if (pf) {
 			if (pf->iLst) {
-				strcat(tag, "+");
-				strcat(tag, pf->iLst);
+				fputc('+', tag);
+				fputs(pf->iLst, tag);
 			}
 			if (pf->xLst) {
-				strcat(tag, "-");
-				strcat(tag, pf->xLst);
-			}
-		}
-		strcat(tag, "/");
-		strcat(tag, path);
-	}
+				fputc('-', tag);
+				fputs(pf->xLst, tag);
+			}
+		}
+		fputc('/', tag);
+		fputs(path, tag);
+	}
+	return (fmem_close(tag, 0));
 }

@@ -14616,8 +14619,8 @@
 {
 	char	*lpath = 0, *rpath = 0;
 	int	rc = -1;
+	char	*ltag, *rtag;
 	char	lfile[MAXPATH], rfile[MAXPATH];
-	char	ltag[MAXPATH],	rtag[MAXPATH];

 	/*
 	 * Create the lfile & rfile for diff
@@ -14637,13 +14640,15 @@
 	 *
 	 * +++ bk.sh 1.34  Thu Jun 10 21:22:08 1999
 	 */
-	mkTag(lrev, lrevM, pf, lpath, ltag);
-	mkTag(rrev, NULL, NULL, rpath, rtag);
+	ltag = mkTag(lrev, lrevM, pf, lpath);
+	rtag = mkTag(rrev, NULL, NULL, rpath);

 	/*
 	 * Now diff the lfile & rfile
 	 */
 	rc = doDiff(s, dop, lfile, rfile, out, lrev, rrev, ltag, rtag);
+	free(ltag);
+	free(rtag);
 done:	unless (streq(lfile, DEVNULL_RD)) unlink(lfile);
 	unless (streq(rfile, s->gfile) || streq(rfile, DEVNULL_RD)) unlink(rfile);
 	if (lpath) free(lpath);


safety

safety

--- src/smap.c
+++ src/smap.c
@@ -507,7 +507,7 @@

 sbool_t sm_count_u(const sm_t *m, const uint32_t k)
 {
-	ASSERT_RETURN_IF(!m, S_FALSE);
+	ASSERT_RETURN_IF(!sm_chk_t(m, SM0_UU32) && !sm_chk_t(m, SM0_U32), S_FALSE);
 	struct SMapuu n;
 	n.x.k = k;
 	return st_locate(m, (const stn_t *)&n) ? S_TRUE : S_FALSE;


remove prototype of unused strm_obj_eq()

--- src/strm.h
+++ src/strm.h
@@ -81,8 +81,6 @@
   STRM_OBJ_HEADER;
 };

-int strm_obj_eq(struct strm_object*, struct strm_object *);
-
 void *strm_value_obj(strm_value, enum strm_obj_type);

 /* ----- Strings */


fix compil warning

fix compil warning

--- src/stun.c
+++ src/stun.c
@@ -1180,9 +1180,9 @@
       }
 #elif defined(__MACH__)
 	   {
-		   int fd=open("/dev/random",O_RDONLY);
-		   read(fd,&tick,sizeof(tick));
-		   closesocket(fd);
+			int fd=open("/dev/random",O_RDONLY);
+			int err=read(fd,&tick,sizeof(tick));
+			closesocket(fd);
 	   }
 #elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
       asm("rdtsc" : "=A" (tick));
@@ -1218,7 +1218,7 @@
            closesocket(fd);
 	   return random();
 	}
-	read(fd,&tick,sizeof(tick));
+	e=read(fd,&tick,sizeof(tick));
 	closesocket(fd);
       }
 #else


fixed segfault of using sync recv without sync send

--- src/sync.c
+++ src/sync.c
@@ -92,15 +92,16 @@
     engine->sync_hosts = List_create(destroy_sync_host);
     engine->port = Config_get_int(config, "port", "sync", GREYD_SYNC_PORT);

-    sync_hosts = Config_get_list(config, "hosts", "sync");
-    LIST_EACH(sync_hosts, entry) {
-        val = List_entry_value(entry);
-        if(cv_str(val) && Sync_add_host(engine, cv_str(val)) != 0) {
-            /*
-             * This was not a host address, so treat it as an
-             * interface name.
-             */
-            engine->iface = cv_str(val);
+    if((sync_hosts = Config_get_list(config, "hosts", "sync")) != NULL) {
+        LIST_EACH(sync_hosts, entry) {
+            val = List_entry_value(entry);
+            if(cv_str(val) && Sync_add_host(engine, cv_str(val)) != 0) {
+                /*
+                 * This was not a host address, so treat it as an
+                 * interface name.
+                 */
+                engine->iface = cv_str(val);
+            }
         }
     }


Update comment, we're no longer using boost::interprocess::scoped_lock

--- src/sync.h
+++ src/sync.h
@@ -31,7 +31,7 @@
 void PrintLockContention(const char* pszName, const char* pszFile, int nLine);
 #endif

-/** Wrapper around boost::interprocess::scoped_lock */
+/** Wrapper around boost::unique_lock<Mutex> */
 template<typename Mutex>
 class CMutexLock
 {


More task refactoring

More task refactoring

--- src/task.c
+++ src/task.c
@@ -2,6 +2,13 @@
 #include <string.h>
 #include <stdio.h>
 #include "pit.h"
+
+static void task_list(char *name, char *status, char *priority, time_t deadline);
+static void task_create(char *name, char *status, char *priority, time_t deadline);
+static void task_show(ulong number);
+static void task_delete(ulong number);
+static void task_update(ulong number, char *name, char *status, char *priority, time_t deadline);
+static void task_parse_options(char **arg, char **name, char **status, char **priority, time_t *deadline);

 /*
 ** CREATING TASKS:
@@ -14,13 +21,13 @@
 **   pit task -d [number]
 **
 ** VIEWING TASK:
-**   pit task [[-v] number]
+**   pit task [[-q] number]
 **
 ** LISTING TASKS:
-**   pit task -v [-s status] [-d deadline] [-p priority]
+**   pit task -q [-s status] [-d deadline] [-p priority]
 */

-static void list_tasks(char *name, char *status, char *priority, time_t deadline)
+static void task_list(char *name, char *status, char *priority, time_t deadline)
 {
     pit_db_load();

@@ -35,7 +42,7 @@
     }
 }

-static void create_task(char *name, char *status, char *priority, time_t deadline)
+static void task_create(char *name, char *status, char *priority, time_t deadline)
 {
     pit_db_load();

@@ -75,56 +82,39 @@
     }
 }

-static void show_task(ulong number)
+static void task_show(ulong number)
 {
-    printf("show_task(%lu)\n", number);
+    printf("task_show(%lu)\n", number);
 }

-static void delete_task(ulong number)
+static void task_delete(ulong number)
 {
-    printf("delete_task(%lu)\n", number);
+    printf("task_delete(%lu)\n", number);
 }

-static void update_task(ulong number, char *name, char *status, char *priority, time_t deadline)
+static void task_update(ulong number, char *name, char *status, char *priority, time_t deadline)
 {
-    printf("update_task: #%lu, name: %s, status: %s, priority: %s, deadline: %s", number, name, status, priority, ctime(&deadline));
+    printf("task_update: #%lu, name: %s, status: %s, priority: %s, deadline: %s", number, name, status, priority, ctime(&deadline));
 }

-static void get_status_priority_and_deadline(char **arg, char *status, char *priority, time_t *deadline)
+static void task_parse_options(char **arg, char **name, char **status, char **priority, time_t *deadline)
 {
     while(*++arg) {
         switch(pit_arg_option(arg)) {
         case 's':
-            status = pit_arg_string(++arg, "task status");
+            *status = pit_arg_string(++arg, "task status");
             break;
         case 'p':
-            priority = pit_arg_string(++arg, "task priority");
+            *priority = pit_arg_string(++arg, "task priority");
             break;
         case 'd':
             *deadline = pit_arg_time(++arg, "task deadline");
             break;
-        default:
-            die("invalid task option: %s", *arg);
-        }
-    }
-}
-
-static void get_name_status_priority_and_deadline(char **arg, char *name, char *status, char *priority, time_t *deadline)
-{
-    while(*++arg) {
-        switch(pit_arg_option(arg)) {
         case 'n':
-            name = pit_arg_string(++arg, "task name");
-            break;
-        case 's':
-            status = pit_arg_string(++arg, "task status");
-            break;
-        case 'p':
-            priority = pit_arg_string(++arg, "task priority");
-            break;
-        case 'd':
-            *deadline = pit_arg_time(++arg, "task deadline");
-            break;
+            if (name) {
+                *name = pit_arg_string(++arg, "task name");
+                break;
+            } /* else fall though */
         default:
             die("invalid task option: %s", *arg);
         }
@@ -139,42 +129,42 @@
     ulong number = 0L;

     if (!*arg) {
-        list_tasks(NULL, NULL, NULL, 0); /* List all tasks (with default paramaters). */
+        task_list(NULL, NULL, NULL, 0); /* List all tasks (with default paramaters). */
     } else { /* pit task [number] */
         number = pit_arg_number(arg, NULL);
         if (number) {
-            show_task(number);
+            task_show(number);
         } else {
             switch(pit_arg_option(arg)) {
             case 'c': /* pit task -c name [-s status] [-p priority] [-d deadline] */
                 name = pit_arg_string(++arg, "task name");
-                get_status_priority_and_deadline(arg, status, priority, &deadline);
-                create_task(name, status, priority, deadline);
+                task_parse_options(arg, NULL, &status, &priority, &deadline);
+                task_create(name, status, priority, deadline);
                 break;
             case 'u': /* pit task -u [number] [-n name] [-s status] [-d deadline] [-p priority] */
                 number = pit_arg_number(++arg, NULL);
                 if (!number) --arg;
-                get_name_status_priority_and_deadline(arg, name, status, priority, &deadline);
+                task_parse_options(arg, &name, &status, &priority, &deadline);
                 if (!name && !status && !priority && !deadline) {
                     die("nothing to update");
                 } else {
-                    update_task(number, name, status, priority, deadline);
+                    task_update(number, name, status, priority, deadline);
                 }
                 break;
             case 'd': /* pit task -d [number] */
                 number = pit_arg_number(++arg, NULL);
-                delete_task(number);
+                task_delete(number);
                 break;
-            case 'v': /* pit task -v [number | [-n name] [-s status] [-d deadline] [-p priority]] */
+            case 'q': /* pit task -q [number | [-n name] [-s status] [-d deadline] [-p priority]] */
                 number = pit_arg_number(++arg, NULL);
                 if (number) {
-                    show_task(number);
+                    task_show(number);
                 } else {
-                    get_name_status_priority_and_deadline(--arg, name, status, priority, &deadline);
+                    task_parse_options(--arg, &name, &status, &priority, &deadline);
                     if (!name && !status && !priority && !deadline) {
-                        show_task(0);
+                        task_show(0);
                     } else {
-                        list_tasks(name, status, priority, deadline);
+                        task_list(name, status, priority, deadline);
                     }
                 }
                 break;


fixing bug in load-file

fixing bug in load-file

--- src/test.c
+++ src/test.c
@@ -353,6 +353,7 @@
 void refresh_buffer() {
 	/*gets(buffer);*/
 	if (feof(readfile) != 0) {
+		printf("end of file reached. changing to reading from stdin\n");
 		fclose(readfile);
 		readfile = stdin;
 	}
@@ -627,7 +628,8 @@
 		string_upcase(word);
 		ret = (void *)intern(word);
 	}
-
+
+	printf("Read in "); print_val (ret); printf("\n");
 	return ret;
 }

@@ -692,7 +694,11 @@

 		do {
 			expr = next_expr();
-			eval(expr, &toplevel);
+			if (readfile == stdin) {
+				/* must've hit the end of the file */
+				break;
+			}
+			eval(expr, &toplevel);
 		} while (expr != NULL);

 		readfile = tmp;


more validity testing under load

more validity testing under load

--- src/tlsf.c
+++ src/tlsf.c
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
+#include <math.h>

 #define word_bytes sizeof(size_t)
 #define word_bits (word_bytes * 8)
@@ -425,6 +426,7 @@
 }

 struct roots * init_tlsf(const size_t bsize) {
+  if (bsize > max_alloc) return NULL;
   size_t size = word_bytes * (bsize/word_bytes + ((bsize & (word_bytes - 1)) > 0));
   if (size < 2*word_bytes) size = 2*word_bytes;
   const size_t get = size + sizeof(struct roots) + sizeof(struct block);
@@ -503,36 +505,58 @@
   }
 }

+void test_roots_valid(const struct roots * const x) {
+  test_roots_setbits(x);
+  test_roots_sizes(x);
+}
+
 void test_roots() {
-  for (size_t i = 0; i < big_buckets; ++i) {
-    for (size_t j = 0; j < word_bits; ++j) {
-      struct roots * foo = NULL;
-      while (1) {
-        size_t many = rword();
-        if (many > max_alloc) continue;
-        while (NULL == foo) {
-          foo = init_tlsf(many);
-          many >>= 1;
-        }
-        const size_t total = roots_contiguous_managed_size(foo);
-        void * bar = tlsf_malloc(foo, many/8);
-        assert (roots_contiguous_managed_size(foo) == total);
-        assert (NULL != bar);
-        test_roots_setbits(foo);
-        test_roots_sizes(foo);
-        tlsf_free(foo, bar);
-        assert (roots_contiguous_managed_size(foo) == total);
-        break;
+  {
+    struct roots * const foo = init_tlsf(1);
+    test_roots_setbits(foo);
+    test_roots_sizes(foo);
+    free(foo);
+  }
+  for (size_t i = 0; i < big_buckets * word_bits; ++i) {
+    struct roots * r = NULL;
+    size_t many = rword();
+    while (NULL == r) {
+      many >>= 1;
+      r = init_tlsf(many);
+    }
+    free(r);
+    many = 1000 * sqrt(many);
+    r = init_tlsf(many);
+    printf("many: %zu\n", many);
+    const size_t total = roots_contiguous_managed_size(r);
+    size_t used = 0;
+    const size_t most = sqrt(many);
+    struct block ** tracked = tlsf_malloc(r, most * sizeof(struct block *));
+    for (size_t i = 0; i < most; ++i) {
+      tracked[i] = NULL;
+    }
+    assert (roots_contiguous_managed_size(r) == total);
+    size_t top = 0;
+    for (size_t i = 0; i < most; ++i) {
+      size_t n = exp(rword() % (size_t)log(most));
+      tracked[top++] = tlsf_malloc(r, n);
+      assert (roots_contiguous_managed_size(r) == total);
+      test_roots_valid(r);
+      if (NULL == tracked[top-1]) {
+        tlsf_free(r,tracked[top-1]);
+        assert (roots_contiguous_managed_size(r) == total);
+        test_roots_valid(r);
+        if (top > 0) --top;
       }
-      test_roots_setbits(foo);
-      test_roots_sizes(foo);
-      free(foo);
-    }
-  }
-  struct roots * const foo = init_tlsf(1);
-  test_roots_setbits(foo);
-  test_roots_sizes(foo);
-  free(foo);
+    }
+    while (top > 0) {
+      tlsf_free(r, tracked[--top]);
+      assert (roots_contiguous_managed_size(r) == total);
+      test_roots_valid(r);
+    }
+    // TODO: test all is free, here
+    free(r);
+  }
 }

 int main() {


Apply removal adjustments for the spiral a. i. s.

Fixes #966.

--- src/tree.c
+++ src/tree.c
@@ -1254,7 +1254,13 @@
 		}

 		if (!n->vacant && removal_adjustment) {
-			if (automatic_scheme == SCHEME_LONGEST_SIDE || g == NULL) {
+			if (automatic_scheme == SCHEME_SPIRAL) {
+				if (is_first_child(n)) {
+					rotate_tree(b, 270);
+				} else {
+					rotate_tree(b, 90);
+				}
+			} else if (automatic_scheme == SCHEME_LONGEST_SIDE || g == NULL) {
 				if (p != NULL) {
 					if (p->rectangle.width > p->rectangle.height) {
 						b->split_type = TYPE_VERTICAL;


Bug #673529 Fix segmentation fault in --list option

--- src/tree.c
+++ src/tree.c
@@ -120,13 +120,13 @@

     string = g_string_new (NULL);

-    while (channel->is_readable != TRUE)
+    while (g_io_channel_get_flags(channel) != G_IO_FLAG_IS_READABLE)
       ;
     do {
       gint status;

       do {
-        if (channel->is_readable == TRUE)
+        if (g_io_channel_get_flags(channel) == G_IO_FLAG_IS_READABLE)
           status = g_io_channel_read_line_string (channel, string, NULL, &error);
         else
           return FALSE;
@@ -645,7 +645,7 @@
       zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
       break;
   }
-  if (channel->is_readable == TRUE)
+  if (channel != NULL && g_io_channel_get_flags (channel) == G_IO_FLAG_IS_READABLE)
     g_io_channel_shutdown (channel, TRUE, NULL);

   gtk_main_quit ();


added comment

added comment

--- src/uart.c
+++ src/uart.c
@@ -35,7 +35,7 @@
 }

-void USART1_IRQHandler(void)
+void USART1_IRQHandler(void) //FIXME: transmit complete interrupt fires after reset, not really a problem
 {
 	if(USART1->SR & USART_SR_TC) //transmission complete
 	{


various expansion to defined fixes

various expansion to defined fixes

--- src/unix.c
+++ src/unix.c
@@ -76,25 +76,25 @@
 #define __NetBSD_Prereq__(M, m, p) 0
 #endif

-#define GNUC_PREREQ(M, m) (defined __GNUC__ && ((__GNUC__ > M) || (__GNUC__ == M && __GNUC_MINOR__ >= m)))
+#define GNUC_PREREQ(M, m) (__GNUC__ && ((__GNUC__ > M) || (__GNUC__ == M && __GNUC_MINOR__ >= m)))

 #if defined __GLIBC_PREREQ
-#define GLIBC_PREREQ(M, m) (defined __GLIBC__ && __GLIBC_PREREQ(M, m) && !__UCLIBC__)
+#define GLIBC_PREREQ(M, m) (__GLIBC__ && __GLIBC_PREREQ(M, m) && !__UCLIBC__)
 #else
 #define GLIBC_PREREQ(M, m) 0
 #endif

-#define UCLIBC_PREREQ(M, m, p) (defined __UCLIBC__ && (__UCLIBC_MAJOR__ > M || (__UCLIBC_MAJOR__ == M && __UCLIBC_MINOR__ > m) || (__UCLIBC_MAJOR__ == M && __UCLIBC_MINOR__ == m && __UCLIBC_SUBLEVEL__ >= p)))
+#define UCLIBC_PREREQ(M, m, p) (__UCLIBC__ && (__UCLIBC_MAJOR__ > M || (__UCLIBC_MAJOR__ == M && __UCLIBC_MINOR__ > m) || (__UCLIBC_MAJOR__ == M && __UCLIBC_MINOR__ == m && __UCLIBC_SUBLEVEL__ >= p)))

 /* NB: uClibc defines __GLIBC__ */
 #define MUSL_MAYBE (__linux && !__BIONIC__ && !__GLIBC__ && !__UCLIBC__)

 #define NETBSD_PREREQ(M, m) __NetBSD_Prereq__(M, m, 0)

-#define FREEBSD_PREREQ(M, m) (defined __FreeBSD_version && __FreeBSD_version >= ((M) * 100000) + ((m) * 1000))
-
-#define SUNOS_PREREQ_5_10 (defined __sun && defined _DTRACE_VERSION)
-#define SUNOS_PREREQ_5_11 (defined __sun && defined F_DUPFD_CLOEXEC)
+#define FREEBSD_PREREQ(M, m) (__FreeBSD_version && __FreeBSD_version >= ((M) * 100000) + ((m) * 1000))
+
+#define SUNOS_PREREQ_5_10 (__sun && _DTRACE_VERSION)
+#define SUNOS_PREREQ_5_11 (__sun && F_DUPFD_CLOEXEC)
 #define SUNOS_PREREQ(M, m) SUNOS_PREREQ_ ## M ## _ ## m

 #define IPHONE_2VER(M, m) (((M) * 10000) + ((m) * 100))
@@ -141,40 +141,73 @@
 #endif
 #endif

+/* NOTE: <sys/stat.h> MUST already be included */
+#ifndef HAVE_DECL_ST_ATIME
+#if defined st_atime
+#define HAVE_DECL_ST_ATIME 1
+#else
+#define HAVE_DECL_ST_ATIME 0
+#endif
+#endif
+
+#ifndef HAVE_DECL_ST_ATIMENSEC
+#if defined st_atimensec
+#define HAVE_DECL_ST_ATIMENSEC 1
+#else
+#define HAVE_DECL_ST_ATIMENSEC 0
+#endif
+#endif
+
+#ifndef HAVE_DECL_ST_ATIMESPEC
+#if defined st_atimespec
+#define HAVE_DECL_ST_ATIMESPEC 1
+#else
+#define HAVE_DECL_ST_ATIMESPEC 0
+#endif
+#endif
+
+#ifndef HAVE_DECL_STATIC_ASSERT
+#if defined static_assert
+#define HAVE_DECL_STATIC_ASSERT 1
+#else
+#define HAVE_DECL_STATIC_ASSERT 0
+#endif
+#endif
+
 #ifndef HAVE_MACH_MACH_H
-#define HAVE_MACH_MACH_H (defined __APPLE__)
+#define HAVE_MACH_MACH_H (__APPLE__)
 #endif

 #ifndef HAVE_MACH_CLOCK_H
-#define HAVE_MACH_CLOCK_H (defined __APPLE__)
+#define HAVE_MACH_CLOCK_H (__APPLE__)
 #endif

 #ifndef HAVE_MACH_MACH_TIME_H
-#define HAVE_MACH_MACH_TIME_H (defined __APPLE__)
+#define HAVE_MACH_MACH_TIME_H (__APPLE__)
 #endif

 #ifndef HAVE_SYS_FEATURE_TESTS_H
-#define HAVE_SYS_FEATURE_TESTS_H (defined __sun)
+#define HAVE_SYS_FEATURE_TESTS_H (__sun)
 #endif

 #ifndef HAVE_SYS_PARAM_H
-#define HAVE_SYS_PARAM_H (defined __OpenBSD__ || defined __NetBSD__ || defined __FreeBSD__ || defined __APPLE__)
+#define HAVE_SYS_PARAM_H (__OpenBSD__ || __NetBSD__ || __FreeBSD__ || __APPLE__)
 #endif

 #ifndef HAVE_SYS_PROCFS_H
-#define HAVE_SYS_PROCFS_H (defined _AIX)
+#define HAVE_SYS_PROCFS_H (_AIX)
 #endif

 #ifndef HAVE_SYS_SOCKIO_H
-#define HAVE_SYS_SOCKIO_H (defined __sun)
+#define HAVE_SYS_SOCKIO_H (__sun)
 #endif

 #ifndef HAVE_SYS_SYSCALL_H
-#define HAVE_SYS_SYSCALL_H (defined BSD || __linux__ || __sun)
+#define HAVE_SYS_SYSCALL_H (BSD || __linux__ || __sun)
 #endif

 #ifndef HAVE_SYS_SYSCTL_H /* missing on musl libc */
-#define HAVE_SYS_SYSCTL_H (defined BSD || GLIBC_PREREQ(0,0) || UCLIBC_PREREQ(0,0,0))
+#define HAVE_SYS_SYSCTL_H (BSD || GLIBC_PREREQ(0,0) || UCLIBC_PREREQ(0,0,0))
 #endif

 #ifndef HAVE_STRUCT_IN_PKTINFO
@@ -190,7 +223,7 @@
 #endif

 #ifndef HAVE_STRUCT_PSINFO
-#define HAVE_STRUCT_PSINFO (defined _AIX)
+#define HAVE_STRUCT_PSINFO (_AIX)
 #endif

 #ifndef HAVE_STRUCT_PSINFO_PR_FNAME
@@ -214,7 +247,7 @@
 #endif

 #ifndef HAVE_STRUCT_STAT_ST_ATIM
-#define HAVE_STRUCT_STAT_ST_ATIM (defined st_atime)
+#define HAVE_STRUCT_STAT_ST_ATIM HAVE_DECL_ST_ATIME
 #endif

 #ifndef HAVE_STRUCT_STAT_ST_MTIM
@@ -226,7 +259,7 @@
 #endif

 #ifndef HAVE_STRUCT_STAT_ST_ATIMESPEC
-#define HAVE_STRUCT_STAT_ST_ATIMESPEC (defined __APPLE__ || defined st_atimespec || defined st_atimensec)
+#define HAVE_STRUCT_STAT_ST_ATIMESPEC (__APPLE__ || HAVE_DECL_ST_ATIMESPEC || HAVE_DECL_ST_ATIMENSEC)
 #endif

 #ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC
@@ -246,23 +279,43 @@
 #endif

 #ifndef HAVE_DECL_IP_PKTINFO
-#define HAVE_DECL_IP_PKTINFO (defined IP_PKTINFO)
+#if defined IP_PKTINFO
+#define HAVE_DECL_IP_PKTINFO 1
+#else
+#define HAVE_DECL_IP_PKTINFO 0
+#endif
 #endif

 #ifndef HAVE_DECL_IP_RECVDSTADDR
-#define HAVE_DECL_IP_RECVDSTADDR (defined IP_RECVDSTADDR)
+#if defined IP_RECVDSTADDR
+#define HAVE_DECL_IP_RECVDSTADDR 1
+#else
+#define HAVE_DECL_IP_RECVDSTADDR 0
+#endif
 #endif

 #ifndef HAVE_DECL_IP_SENDSRCADDR
-#define HAVE_DECL_IP_SENDSRCADDR (defined IP_SENDSRCADDR)
+#if defined IP_SENDSRCADDR
+#define HAVE_DECL_IP_SENDSRCADDR 1
+#else
+#define HAVE_DECL_IP_SENDSRCADDR 0
+#endif
 #endif

 #ifndef HAVE_DECL_IPV6_PKTINFO
-#define HAVE_DECL_IPV6_PKTINFO (defined IPV6_PKTINFO)
+#if defined IPV6_PKTINFO
+#define HAVE_DECL_IPV6_PKTINFO 1
+#else
+#define HAVE_DECL_IPV6_PKTINFO 0
+#endif
 #endif

 #ifndef HAVE_DECL_IPV6_RECVPKTINFO
-#define HAVE_DECL_IPV6_RECVPKTINFO (defined IPV6_RECVPKTINFO)
+#if defined IPV6_RECVPKTINFO
+#define HAVE_DECL_IPV6_RECVPKTINFO 1
+#else
+#define HAVE_DECL_IPV6_RECVPKTINFO 0
+#endif
 #endif

 #ifndef HAVE_DECL_RANDOM_UUID
@@ -270,31 +323,47 @@
 #endif

 #ifndef HAVE_DECL_RLIM_SAVED_CUR
-#define HAVE_DECL_RLIM_SAVED_CUR (defined RLIM_SAVED_CUR)
+#if defined RLIM_SAVED_CUR
+#define HAVE_DECL_RLIM_SAVED_CUR 1
+#else
+#define HAVE_DECL_RLIM_SAVED_CUR 0
+#endif
 #endif

 #ifndef HAVE_DECL_RLIM_SAVED_MAX
-#define HAVE_DECL_RLIM_SAVED_MAX (defined RLIM_SAVED_MAX)
-#endif
-
-#ifndef HAVE_DECL_RLIMIT_AS
-#define HAVE_DECL_RLIMIT_AS (defined RLIMIT_AS)
-#endif
-
-#ifndef HAVE_DECL_SYS_GETRANDOM
-#define HAVE_DECL_SYS_GETRANDOM (defined SYS_getrandom)
+#if defined RLIM_SAVED_MAX
+#define HAVE_DECL_RLIM_SAVED_MAX 1
+#else
+#define HAVE_DECL_RLIM_SAVED_MAX 0
+#endif
+#endif
+
+#ifndef HAVE_DECL_RLIM_AS
+#if defined RLIM_AS
+#define HAVE_DECL_RLIM_AS 1
+#else
+#define HAVE_DECL_RLIM_AS 0
+#endif
+#endif
+
+#ifndef HAVE_DECL_SOCK_CLOEXEC
+#if defined SOCK_CLOEXEC
+#define HAVE_DECL_SOCK_CLOEXEC 1
+#else
+#define HAVE_DECL_SOCK_CLOEXEC 0
+#endif
 #endif

 #ifndef HAVE_ACCEPT4
-#define HAVE_ACCEPT4 (defined SOCK_CLOEXEC && !__NetBSD__)
+#define HAVE_ACCEPT4 (HAVE_DECL_SOCK_CLOEXEC && !__NetBSD__)
 #endif

 #ifndef HAVE_ARC4RANDOM
-#define HAVE_ARC4RANDOM (defined __OpenBSD__ || defined __FreeBSD__ || defined __NetBSD__ || defined __MirBSD__ || defined __APPLE__)
+#define HAVE_ARC4RANDOM (__OpenBSD__ || __FreeBSD__ || __NetBSD__ || __MirBSD__ || __APPLE__)
 #endif

 #ifndef HAVE_ARC4RANDOM_STIR
-#define HAVE_ARC4RANDOM_STIR (HAVE_ARC4RANDOM && (!defined OpenBSD || OpenBSD < 201405))
+#define HAVE_ARC4RANDOM_STIR (HAVE_ARC4RANDOM && (!OpenBSD || OpenBSD < 201405))
 #endif

 #ifndef HAVE_ARC4RANDOM_ADDRANDOM
@@ -302,11 +371,11 @@
 #endif

 #ifndef HAVE_GETEXECNAME
-#define HAVE_GETEXECNAME (defined __sun)
+#define HAVE_GETEXECNAME (__sun)
 #endif

 #ifndef HAVE_GETPROGNAME
-#define HAVE_GETPROGNAME (defined __OpenBSD__ || defined __FreeBSD__ || defined __NetBSD__ || defined __MirBSD__ || defined __APPLE__)
+#define HAVE_GETPROGNAME (__OpenBSD__ || __FreeBSD__ || __NetBSD__ || __MirBSD__ || __APPLE__)
 #endif

 #ifndef HAVE_PIPE2
@@ -318,11 +387,11 @@
 #endif

 #ifndef HAVE_FDATASYNC
-#define HAVE_FDATASYNC (!defined __APPLE__ && !__FreeBSD__)
+#define HAVE_FDATASYNC (!__APPLE__ && !__FreeBSD__)
 #endif

 #ifndef HAVE_FDOPENDIR
-#define HAVE_FDOPENDIR ((!defined __APPLE__ || MACOS_PREREQ(10,10,0) || IPHONE_PREREQ(8,0)) && (!defined __NetBSD__ || NETBSD_PREREQ(6,0)))
+#define HAVE_FDOPENDIR ((!__APPLE__ || MACOS_PREREQ(10,10,0) || IPHONE_PREREQ(8,0)) && (!__NetBSD__ || NETBSD_PREREQ(6,0)))
 #endif

 #ifndef HAVE_FSTATAT
@@ -330,7 +399,7 @@
 #endif

 #ifndef HAVE_ISSETUGID
-#define HAVE_ISSETUGID (!defined __linux && !defined _AIX)
+#define HAVE_ISSETUGID (!__linux && !_AIX)
 #endif

 #ifndef HAVE_GETAUXVAL
@@ -342,7 +411,7 @@
 #endif

 #ifndef HAVE_IFADDRS_H
-#define HAVE_IFADDRS_H (!defined _AIX && (!defined __sun || SUNOS_PREREQ(5,11)))
+#define HAVE_IFADDRS_H (!_AIX && (!__sun || SUNOS_PREREQ(5,11)))
 #endif

 #ifndef HAVE_GETIFADDRS
@@ -350,11 +419,11 @@
 #endif

 #ifndef HAVE_SOCKADDR_SA_LEN
-#define HAVE_SOCKADDR_SA_LEN (!defined __linux && !defined __sun)
+#define HAVE_SOCKADDR_SA_LEN (!__linux && !__sun)
 #endif

 #ifndef HAVE_NETINET_IN6_VAR_H
-#define HAVE_NETINET_IN6_VAR_H (defined _AIX)
+#define HAVE_NETINET_IN6_VAR_H (_AIX)
 #endif

 /*
@@ -394,7 +463,7 @@
 #endif

 #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
-#define HAVE_PROGRAM_INVOCATION_SHORT_NAME (defined __linux)
+#define HAVE_PROGRAM_INVOCATION_SHORT_NAME (__linux)
 #endif

 #ifndef HAVE_PTSNAME_R
@@ -402,7 +471,7 @@
 #endif

 #ifndef HAVE_P_XARGV
-#define HAVE_P_XARGV (defined _AIX)
+#define HAVE_P_XARGV (_AIX)
 #endif

 #ifndef HAVE_DECL_P_XARGV
@@ -418,16 +487,16 @@
 #endif

 #ifndef HAVE_SIGTIMEDWAIT
-#define HAVE_SIGTIMEDWAIT (!defined __APPLE__ && !defined __OpenBSD__)
+#define HAVE_SIGTIMEDWAIT (!__APPLE__ && !__OpenBSD__)
 #endif

 #ifndef HAVE_SIGWAIT
-#define HAVE_SIGWAIT (!defined __minix)
+#define HAVE_SIGWAIT (!__minix)
 #endif

 #ifndef HAVE_STATIC_ASSERT
 #define HAVE_STATIC_ASSERT_ (!GLIBC_PREREQ(0,0) || HAVE__STATIC_ASSERT) /* glibc doesn't check GCC version */
-#define HAVE_STATIC_ASSERT (defined static_assert && HAVE_STATIC_ASSERT_)
+#define HAVE_STATIC_ASSERT (HAVE_DECL_STATIC_ASSERT && HAVE_STATIC_ASSERT_)
 #endif

 #ifndef HAVE_SYSCALL
@@ -517,6 +586,22 @@
 #include <mach/mach_time.h> /* mach_timebase_info() mach_absolute_time() */
 #endif

+/*
+ * F E A T U R E  D E T E C T I O N  (S T A G E  2)
+ *
+ * Macros which may require non-portable headers to be pre-included and
+ * cannot dely on lazy evluation (e.g. cannot utilize defined statement
+ * in macro expansion).
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef HAVE_DECL_SYS_GETRANDOM
+#if defined SYS_getrandom
+#define HAVE_DECL_SYS_GETRANDOM 1
+#else
+#define HAVE_DECL_SYS_GETRANDOM 0
+#endif
+#endif

 /*
  * L U A  C O M P A T A B I L I T Y
@@ -3258,7 +3343,7 @@
 #ifndef HAVE_MTSAFE_STRSIGNAL
 #define HAVE_MTSAFE_STRSIGNAL_ \
 	(__sun || GLIBC_PREREQ(0,0) || MUSL_MAYBE || \
-	 FREEBSD_PREREQ(8,1) || defined __APPLE__ || defined _AIX)
+	 FREEBSD_PREREQ(8,1) || __APPLE__ || _AIX)
 #define HAVE_MTSAFE_STRSIGNAL (HAVE_STRSIGNAL && HAVE_MTSAFE_STRSIGNAL_)
 #endif


writing ic_parse_stmt_let

writing ic_parse_stmt_let

--- src/parse/stmt.c
+++ src/parse/stmt.c
@@ -43,9 +43,70 @@

     /* out eventual return value */
     struct ic_stmt *stmt = 0;
-
-    puts("ic_parse_stmt_let: unimplemented");
-    return 0;
+    /* our internal let value */
+    struct ic_stmt_let *let = 0;
+
+    /* pointer and length for our identifier */
+    char *id_start = 0;
+    unsigned int id_len= 0;
+
+    /* pointer and length for our type */
+    char *type_start = 0;
+    unsigned int type_len = 0;
+
+    /* allocate and initialise */
+    stmt = ic_stmt_new(ic_stmt_type_let);
+    if( ! stmt ){
+        puts("ic_parse_stmt_let: call to ic_stmt_new failed");
+        return 0;
+    }
+
+    /* fetch and store out let to make things easier */
+    let = ic_stmt_get_let(stmt);
+
+    /* check for `let` */
+    if( ic_parse_check_token("let", 3, tokens->tokens, i) ){
+        puts("ic_parse_stmt_let: Failed to find `let` token");
+        return 0;
+    }
+
+    /* consume identifier */
+    id_start = &(tokens->tokens[*i]);
+    id_len = ic_parse_token_length(tokens->tokens, *i);
+    ic_parse_token_advance(i, id_len);
+
+    /* check for `::` */
+    if( ic_parse_check_token("::", 2, tokens->tokens, i) ){
+        puts("ic_parse_stmt_let: Failed to find `::` token");
+        return 0;
+    }
+
+    /* consume type */
+    type_start = &(tokens->tokens[*i]);
+    type_len = ic_parse_token_length(tokens->tokens, *i);
+    ic_parse_token_advance(i, type_len);
+
+    /* initialise our let */
+    if( ic_stmt_let_init(let, id_start, id_len, type_start, type_len) ){
+        puts("ic_parse_stmt_let: call to ic_stmt_let_init failed");
+        return 0;
+    }
+
+    /* check for `=` */
+    if( ic_parse_check_token("=", 1, tokens->tokens, i) ){
+        puts("ic_parse_stmt_let: Failed to find `=` token");
+        return 0;
+    }
+
+    /* consume initialisation expression */
+    let->init = ic_parse_expr(tokens, i);
+    if( ! let->init ){
+        puts("ic_parse_stmt_let: call to ic_parse_expr failed");
+        return 0;
+    }
+
+    /* victory */
+    return stmt;
 }

 /* consume token


removed test of file length in order to be able to use the indefinite-length code/

--- roa-lib/roa_serialize.c
+++ roa-lib/roa_serialize.c
@@ -1792,7 +1792,7 @@
       iReturn = 0;
       // did we use all of buf, no more and no less?
       int ret;
-      if ((ret = decode_casn(&rp->self, buf)) != iSize)
+      if ((ret = decode_casn_lth(&rp->self, buf, iSize)) < 0)
         {
         fprintf(stderr, "roaFromFile: scan failed at offset %d\n", -ret);
         delete_casn(&rp->self);


Add new map access functions

Add new map access functions

--- ionCore/ionStandardLibrary.h
+++ ionCore/ionStandardLibrary.h
@@ -22,7 +22,7 @@

 template <typename T, typename U>
-U * ConditionalMapAccess(map<T, U *> & Map, T const Key)
+U * ConditionalMapAccess(map<T, U *> const & Map, T const Key)
 {
 	auto Iterator = Map.find(Key);

@@ -30,6 +30,26 @@
 		return Iterator->second;

 	return 0;
+}
+
+template <typename T, typename U>
+bool CheckMapAccess(map<T, U> const & Map, T const Key)
+{
+	return Map.find(Key) != Map.end();
+}
+
+template <typename T, typename U>
+bool TryMapAccess(map<T, U> const & Map, T const Key, U & Value)
+{
+	auto Iterator = Map.find(Key);
+
+	if (Iterator != Map.end())
+	{
+		Value = Iterator->second;
+		return true;
+	}
+
+	return false;
 }

 class File


IntelFrameworkModule/LegacyBios: Avoid explicit comparison for BOOLEAN

Cc: Jian J Wang <01d7c53c587e21672fb6c249cfdc88bbd3aecc19@intel.com>
Cc: Liming Gao <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <1e8692d8ed8470b17e8ddd7612a0f029768dcb56@intel.com>
Reviewed-by: Jian J Wang <01d7c53c587e21672fb6c249cfdc88bbd3aecc19@intel.com>

--- IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
+++ IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
@@ -806,7 +806,7 @@

   if (((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT0) == 0)
       ||
-      ((mEndOfDxe == TRUE)  &&
+      ((mEndOfDxe)  &&
        ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT7|BIT0))
         == (BIT7|BIT0)))
      ) {
@@ -856,7 +856,7 @@

   if (((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT0) == 0)
       ||
-      ((mEndOfDxe == TRUE)  &&
+      ((mEndOfDxe)  &&
        ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT7|BIT0))
         == (BIT7|BIT0)))
      ) {


Fix warning for a missing nonnull

Fix warning for a missing nonnull

--- Hauth/HauthStreamsController.h
+++ Hauth/HauthStreamsController.h
@@ -20,6 +20,6 @@
 - (void)sendData:(nonnull NSData *)data;
 - (void)handleReceivedData:(nonnull NSData *)data;

-- (void)handleStreamEnd:(NSStream *)stream;
+- (void)handleStreamEnd:(nonnull NSStream *)stream;

 @end


removed superflous typedef which caused too many dependencies

--- core/ilwisobjects/domain/thematicitem.h
+++ core/ilwisobjects/domain/thematicitem.h
@@ -70,7 +70,7 @@
     QString _code;
 };

-typedef IlwisData<ItemDomain<ThematicItem> > IThematicDomain;
+//typedef IlwisData<ItemDomain<ThematicItem> > IThematicDomain;
 typedef QSharedPointer<ThematicItem> SPThematicItem;

 }


testing with PROGMEM

testing with PROGMEM

--- MID/lib/ShutDw.h
+++ MID/lib/ShutDw.h
@@ -2,6 +2,7 @@
 // Created by Angel Zaprianov on 11.10.2016 г..
 //
 #include <Arduino.h>
+#include <avr/pgmspace.h>

 #ifndef SHUTDOWN_SAVE_STATE
 #define SHUTDOWN_SAVE_STATE HIGH
@@ -21,6 +22,27 @@
 #ifndef ARDUINOMID_SHUTDOWN_H
 #define ARDUINOMID_SHUTDOWN_H

+char * const ShutDw_messages[12] PROGMEM = {
+        //
+        // Normal shutdown
+        "Goodbye ...     ",     // 0
+        "until next time!",     // 1
+        //
+        // Trip saving shutdown
+        "Hit \"S<\" to   ",     // 2
+        "skip saving TRIP",     // 3
+
+        "Shutting  down  ",     // 4
+        //
+        // Awaiting
+        "Waiting ",             // 5
+        " sec.  ",              // 6
+        " for ESC saving ",     // 7
+        "Trip data cancel",     // 8
+        "Erasing trip ...",     // 9
+        " Trip saved :)  ",     // 10
+        " Bye bye ...    "      // 11
+};

 class ShutDw {

@@ -34,6 +56,7 @@
     WhlSens *_whl;

 private :
+
     uint8_t pinCtrl, pinDtct, pinTone;

     int indexWait = 0;
@@ -42,7 +65,6 @@
     int alreadyShutdown = 0;
     bool entryUsbDetected = false;
     bool isShutdownActive = false;
-    bool isShutdownInactive = false;
     int detectorValue = 1000;
     int handlerCursorMenu;

@@ -53,6 +75,12 @@
     void displayCancel(LiquidCrystal *lcd);

     void melodySave(void);
+
+    char *getMsg(int index) {
+        return (char *) pgm_read_word (&ShutDw_messages[index]);
+    }
+
+
 public:
     static constexpr int MENU_SHUTDOWN = 99;

@@ -216,9 +244,9 @@

         lcd->clear();
         lcd->setCursor(0, 0);
-        lcd->print("Goodbye ...     ");
+        lcd->print(getMsg(0));
         lcd->setCursor(0, 1);
-        lcd->print("until next time!");
+        lcd->print(getMsg(1));
         melodySave();
         _eep->saveCurrentData();
         _whl->shutdownMode();
@@ -233,9 +261,9 @@
     if (entryDisplay == 0) {
         lcd->clear();
         lcd->setCursor(0, 0);
-        lcd->print("Hit \"S<\" to ");
+        lcd->print(getMsg(2));
         lcd->setCursor(0, 1);
-        lcd->print("skip saving TRIP");
+        lcd->print(getMsg(3));
         tone(pinTone, 800, 200);
         delay(200);
         tone(pinTone, 800, 200);
@@ -244,7 +272,7 @@
         delay(3600);
         lcd->clear();
         lcd->setCursor(1, 0);
-        lcd->print("Shutting  down");
+        lcd->print(getMsg(4));
         tone(pinTone, 2000, 600);
         delay(1000);
         entryDisplay = 1;
@@ -256,15 +284,15 @@
     if (_amp->isSec()) {

         lcd->setCursor(0, 0);
-        lcd->print("Waiting ");
+        lcd->print(getMsg(5));
         //
         // Convert data to human format
         sprintf(sec, "%02d", ((indexWait - SHUTDOWN_SAVE_LOOPS) / 200) * -1);

         lcd->print(sec);
-        lcd->print(" sec.  ");
+        lcd->print(getMsg(6));
         lcd->setCursor(1, 2);
-        lcd->print(" for ESC saving");
+        lcd->print(getMsg(7));
     }

     //
@@ -297,9 +325,9 @@
 void ShutDw::displayCancel(LiquidCrystal *lcd) {
     lcd->clear();
     lcd->setCursor(1, 0);
-    lcd->print("Trip data cancel");
+    lcd->print(getMsg(8));
     lcd->setCursor(1, 2);
-    lcd->print("Erasing trip ...");
+    lcd->print(getMsg(9));

     //
     // Erase trip data
@@ -314,6 +342,7 @@
     // Mark mid as shutdown
     alreadyShutdown = 1;
 }
+
 /**
  * Save melody play
  */
@@ -338,9 +367,9 @@
     alreadySaved = 1;
     lcd->clear();
     lcd->setCursor(1, 0);
-    lcd->print(" Data saved :)");
+    lcd->print(getMsg(10));
     lcd->setCursor(1, 2);
-    lcd->print(" Bye bye ...");
+    lcd->print(getMsg(11));
     //
     // Shutdown the system
     melodySave();


remove debug bits

remove debug bits

--- mount_slash/bmap_cli.c
+++ mount_slash/bmap_cli.c
@@ -1382,11 +1382,6 @@
 msl_bmap_final_cleanup(struct bmap *b)
 {
 	struct bmap_pagecache *bmpc = bmap_2_bmpc(b);
-#if 0
-	struct bmpc_ioreq *r;
-	struct bmap_cli_info *bci = bmap_2_bci(b);
-	struct bmap_pagecache_entry *e, *next;
-#endif

 	psc_assert(!(b->bcm_flags & BMAPF_FLUSHQ));

@@ -1399,14 +1394,6 @@
 	 * write back cache thread.
 	 */
 	psc_assert(psclist_disjoint(&b->bcm_lentry));
-
-#if 0
-	/* DIO rq's are allowed since no cached pages are involved. */
-	if (!pll_empty(&bmpc->bmpc_pndg_biorqs)) {
-		PLL_FOREACH(r, &bmpc->bmpc_pndg_biorqs)
-			psc_assert(r->biorq_flags & BIORQ_DIO);
-	}
-#endif

 	lc_remove(&bmpcLru, bmpc);
 	DEBUG_BMAP(PLL_DIAG, b, "done freeing");


COMP: missing typedef for traits

COMP: missing typedef for traits

--- Code/Common/itkVariableLengthVector.h
+++ Code/Common/itkVariableLengthVector.h
@@ -69,7 +69,8 @@
 public:

   /** The element type stored at each location in the Array. */
-  typedef TValueType  ValueType;
+  typedef TValueType           ValueType;
+  typedef TValueType           ComponentType;
   typedef VariableLengthVector Self;

   /** Typedef used to indicate the number of elements in the vector */


app/testpmd: remove unused field from port struct

Remove some leftover from a previous rework.

Fixes: c4bcc342c8ee ("app/testpmd: refactor ieee1588 forwarding")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <f28529695cfa9e3e1eb84e7072aa626af4abb18e@redhat.com>
Reviewed-by: Rami Rosen <d906574dd7f018d5d95e7b7a8107cdf708745f05@gmail.com>

--- app/test-pmd/testpmd.h
+++ app/test-pmd/testpmd.h
@@ -173,7 +173,6 @@
 	uint16_t                tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */
 	uint16_t                tx_vlan_id;/**< The tag ID */
 	uint16_t                tx_vlan_id_outer;/**< The outer tag ID */
-	void                    *fwd_ctx;   /**< Forwarding mode context */
 	uint64_t                rx_bad_ip_csum; /**< rx pkts with bad ip checksum  */
 	uint64_t                rx_bad_l4_csum; /**< rx pkts with bad l4 checksum */
 	uint64_t                rx_bad_outer_l4_csum;


IntegratorInstance flags

IntegratorInstance flags

--- examples/adj_sensitivity.c
+++ examples/adj_sensitivity.c
@@ -1,6 +1,6 @@
 /*
   Last changed Time-stamp: <2006-03-07 16:56:51 raim>
-  $Id: adj_sensitivity.c,v 1.4 2006/03/07 15:58:35 raimc Exp $
+  $Id: adj_sensitivity.c,v 1.5 2006/05/18 08:28:27 stefan_tbi Exp $
 */
 /*
  *
@@ -149,7 +149,7 @@

   /* forward quadrature */
   flag = IntegratorInstance_CVODEQuad(ii);
-  if (flag==1)
+  if (flag!=1)
     return(EXIT_FAILURE);

   fprintf(stderr, "\n### Printing Forward Sensitivities: int_0^T <x-x_delta, x_sens> dt \n");
@@ -210,7 +210,7 @@

   /* adjoint quadrature */
   flag = IntegratorInstance_CVODEQuad(ii);
-  if (flag==1) return(EXIT_FAILURE);
+  if (flag!=1) return(EXIT_FAILURE);

   fprintf(stderr, "\n### Printing Adjoint Sensitivities: int_0^T <df/dp, psi> dt   \n");
   for(i=0;i<om->n_adj_sens;i++)


Fixed some stuff in choose_ucc_threshold()

--- Code/C++/SamplerImpl.h
+++ Code/C++/SamplerImpl.h
@@ -131,24 +131,40 @@
             threshold_id_candidates.push_back(i);

     // Find the threshold that's closest to dividing the particles in half
+    std::vector<double> balance(threshold_id_candidates.size());
+    unsigned int threshold;
+    for(size_t i=0; i<threshold_id_candidates.size(); ++i)
+    {
+        threshold = particle_uccs_sorted[threshold_id_candidates[i]];
+
+        // Count interior and exterior particles
+        int num_interior = 0;
+        int num_exterior = 0;
+        for(int j=0; j<num_particles; ++j)
+        {
+            if(particle_uccs[j] < threshold)
+                ++num_exterior;
+            if(particle_uccs[j] > threshold)
+                ++num_interior;
+        }
+        balance[i] = static_cast<double>(num_interior + 1E-6)/
+                                        (num_interior + num_exterior + 1E-6);
+    }
     int best = 0;
-    for(size_t i=1; i<threshold_id_candidates.size(); ++i)
-    {
-        if(abs(threshold_id_candidates[i] - num_particles/2) <
-           abs(threshold_id_candidates[best] - num_particles/2))
+    for(size_t i=1; i<balance.size(); ++i)
+        if(std::abs(balance[i] - 0.5) < std::abs(balance[best] - 0.5))
             best = i;
-    }
-    unsigned short threshold = particle_uccs_sorted[threshold_id_candidates[best]];
+    threshold = particle_uccs_sorted[threshold_id_candidates[best]];

     // Calculate particle statuses
-    for(int i=0; i<num_particles; ++i)
-    {
-        if(particle_uccs[i] < threshold)
-            status[i] = 1;
-        if(particle_uccs[i] == threshold)
-            status[i] = 0;
-        if(particle_uccs[i] > threshold)
-            status[i] = -1;
+    for(int j=0; j<num_particles; ++j)
+    {
+        if(particle_uccs[j] < threshold)
+            status[j] = 1;
+        if(particle_uccs[j] == threshold)
+            status[j] = 0;
+        if(particle_uccs[j] > threshold)
+            status[j] = -1;
     }

     return threshold;


DTS: fix mono and dual-mono samples playback

--- modules/codec/dts.c
+++ modules/codec/dts.c
@@ -665,10 +665,12 @@
     {
         case 0x0:
             /* Mono */
+            *pi_channels = 1;
             *pi_channels_conf = AOUT_CHAN_CENTER;
             break;
         case 0x1:
             /* Dual-mono = stereo + dual-mono */
+            *pi_channels = 2;
             *pi_channels_conf = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
                            AOUT_CHAN_DUALMONO;
             break;


Remove double return statement in PlainObjectBase::_set()

--- Eigen/src/Core/PlainObjectBase.h
+++ Eigen/src/Core/PlainObjectBase.h
@@ -647,7 +647,6 @@
     {
       internal::call_assignment(this->derived(), other.derived());
       return this->derived();
-      return this->derived();
     }

     /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which


correction to allow network to be correctly defined for server creation message in xml

--- cocarrier/osclient.c
+++ cocarrier/osclient.c
@@ -26,6 +26,7 @@
 private	int	hack=0;			/* forces the use of the EUCA scripts		*/
 private	int	usejson=0;		/* forces use of json message for server create	*/
 private	int	quantum_xml=0;		/* use xml for quantum otherwise json		*/
+private	int	compute_v2=0;		/* allows use of nova compute v2 messages	*/
 private	int    	use_personality_file=1;	/* forces the use of PERSONALITY FILE in XML	*/

 public	void	os_use_json( int v )
@@ -1668,7 +1669,8 @@
 		char * resource,	/* the target personality file  */
 		char * group,		/* an eventual security group	*/
 		char * zone,		/* an eventual locality zone	*/
-		char * keyname )	/* an eventual key pair name	*/
+		char * keyname,		/* an eventual key pair name	*/
+		char * network )	/* quantum network identifier	*/
 {
 	char *	sptr=(char *) 0;
 	char *	tptr=(char *) 0;
@@ -1797,6 +1799,15 @@
 				fprintf(h,"</personality>\n");
 			}
 		}
+		if ( compute_v2 )
+		{
+			if ( rest_valid_string( network ) )
+			{
+				fprintf(h,"\t<networks>\n");
+				fprintf(h,"\t<network uuid=\"%s\"></network>\n",network);
+				fprintf(h,"\t</networks>\n");
+			}
+		}
 		fprintf(h,"</server>\n");
 		fclose(h);
 		return( filename );
@@ -1817,7 +1828,8 @@
 		char * resource,	/* the target personality file  */
 		char * group,		/* an eventual security group	*/
 		char * zone,		/* an eventual locality zone	*/
-		char * keyname )	/* an eventual key pair name	*/
+		char * keyname,		/* an eventual key pair name	*/
+		char * network) 	/* quantum network identifie	*/
 {
 	char *	sptr=(char *) 0;
 	char *	tptr=(char *) 0;
@@ -1849,6 +1861,11 @@
 		if (!( strncmp( image, "http", strlen("http") ) ))
 			fprintf(h,",\"imageRef\":%c%s%c",0x0022,image,0x0022);
 		else	fprintf(h,",\"imageRef\":%c%s/images/%s%c",0x0022,subptr->Os.base,image,0x0022);
+
+		if ( rest_valid_string( network ) )
+		{
+			fprintf(h,", \"networks\":[{\"uuid\":\"%s\"}]",network);
+		}

 		if (( rest_valid_string( keyname ) )
 		&&  (strcmp( keyname, "none" ) != 0 ))
@@ -1938,15 +1955,16 @@
 		char * resource,	/* the target personality file  */
 		char * group,		/* an eventual security group	*/
 		char * zone,		/* an eventual locality zone	*/
-		char * keyname )	/* an eventual key pair name	*/
+		char * keyname,		/* an eventual key pair name	*/
+		char * network )	/* quantum network identifier	*/
 {
 	if ( hack )
 		return( euca_data_hack( image, flavor, personality ) );
 	else if (!( strcmp( subptr->Os.version, "v2" ) ))
-		return( os_create_server_json_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname ));
+		return( os_create_server_json_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname, network ));
 	else if ( usejson )
-		return( os_create_server_json_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname ));
-	else	return( os_create_server_xml_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname ));
+		return( os_create_server_json_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname,network ));
+	else	return( os_create_server_xml_request( subptr, identity, image, flavor, address, personality, resource, group, zone, keyname, network ));
 }

 /*	------------------------------------------------------------	*/


The recursive definition of the determinant function, combined with the fact that no specialized function for the base case N==1 is given, leads to instantiation of this function for all 256 possible values of a uint8_t (even though these are not used in practice). Fix this by providing an explicit (inline) definition for N==1.

--- utility/matrix.h
+++ utility/matrix.h
@@ -192,15 +192,10 @@

     double determinant() const
     {
-        if(N == 1)
-            return cell(0, 0);
-
-        float det = 0.0;
-        for(int i = 0; i < N; i++ )
-        {
-            Matrix<N-1> minor = minor_matrix(0, i);
-            det += (i%2==1?-1.0:1.0) * cell(0, i) * minor.determinant();
-        }
+        // specialization for N == 1 given below this class
+        double det = 0.0, sign = 1.0;
+        for (int i = 0; i < N; ++i, sign = -sign)
+            det += sign * cell(0, i) * minor_matrix(0, i).determinant();
         return det;
     }

@@ -226,6 +221,12 @@
 };

+template<>
+inline double Matrix<1>::determinant() const
+{
+    return cell(0, 0);
+}
+
 };

 #endif


libusbg: Move mkdir functions

libusbg: Move mkdir functions

Call mkdir() function after successful memory allocation
and gadget function creation.

Signed-off-by: Stanislaw Wadas <45c1812d781e6eb1765fa6c6737751add3c95468@samsung.com>

--- src/usbg.c
+++ src/usbg.c
@@ -497,12 +497,6 @@

 	sprintf(gpath, "%s/%s", s->path, name);

-	ret = mkdir(gpath, S_IRWXU|S_IRWXG|S_IRWXO);
-	if (ret < 0) {
-		ERRORNO("%s\n", gpath);
-		return NULL;
-	}
-
 	g = malloc(sizeof(struct gadget));
 	if (!g) {
 		ERRORNO("allocating gadget\n");
@@ -519,6 +513,12 @@

 	usbg_write_hex16(s->path, name, "idVendor", vendor);
 	usbg_write_hex16(s->path, name, "idProduct", product);
+
+	ret = mkdir(gpath, S_IRWXU|S_IRWXG|S_IRWXO);
+	if (ret < 0) {
+		ERRORNO("%s\n", gpath);
+		return NULL;
+	}

 	/* Insert in string order */
 	if (TAILQ_EMPTY(&s->gadgets) ||
@@ -633,23 +633,23 @@

 	sprintf(fpath, "%s/%s/functions/%s", g->path, g->name, name);

+	f = malloc(sizeof(struct function));
+	if (!f) {
+		ERRORNO("allocating function\n");
+		return NULL;
+	}
+
+	strcpy(f->name, name);
+	sprintf(f->path, "%s/%s/%s", g->path, g->name, "functions");
+	f->type = type;
+
+	usbg_parse_function_attrs(f);
+
 	ret = mkdir(fpath, S_IRWXU|S_IRWXG|S_IRWXO);
 	if (ret < 0) {
 		ERRORNO("%s\n", fpath);
 		return NULL;
 	}
-
-	f = malloc(sizeof(struct function));
-	if (!f) {
-		ERRORNO("allocating function\n");
-		return NULL;
-	}
-
-	strcpy(f->name, name);
-	sprintf(f->path, "%s/%s/%s", g->path, g->name, "functions");
-	f->type = type;
-
-	usbg_parse_function_attrs(f);

 	/* Insert in string order */
 	if (TAILQ_EMPTY(&g->functions) ||
@@ -687,21 +687,21 @@

 	sprintf(cpath, "%s/%s/configs/%s", g->path, g->name, name);

+	c = malloc(sizeof(struct config));
+	if (!c) {
+		ERRORNO("allocating configuration\n");
+		return NULL;
+	}
+
+	TAILQ_INIT(&c->bindings);
+	strcpy(c->name, name);
+	sprintf(c->path, "%s/%s/%s/%s", g->path, g->name, "configs", name);
+
 	ret = mkdir(cpath, S_IRWXU|S_IRWXG|S_IRWXO);
 	if (ret < 0) {
 		ERRORNO("%s\n", cpath);
 		return NULL;
 	}
-
-	c = malloc(sizeof(struct config));
-	if (!c) {
-		ERRORNO("allocating configuration\n");
-		return NULL;
-	}
-
-	TAILQ_INIT(&c->bindings);
-	strcpy(c->name, name);
-	sprintf(c->path, "%s/%s/%s/%s", g->path, g->name, "configs", name);

 	/* Insert in string order */
 	if (TAILQ_EMPTY(&g->configs) ||


add system-stm32l4xx.h

add system-stm32l4xx.h

error: pathspec 'cmsis-core-stm32l4/system_stm32l4xx.h' did not match any file(s) known to git

--- cmsis-core-stm32l4/system_stm32l4xx.h
+++ cmsis-core-stm32l4/system_stm32l4xx.h
@@ -0,0 +1,124 @@
+/**
+  ******************************************************************************
+  * @file    system_stm32l4xx.h
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    25-November-2015
+  * @brief   CMSIS Cortex-M4 Device System Source File for STM32L4xx devices.
+  ******************************************************************************
+  * @attention
+  *
+  *
© COPYRIGHT(c) 2015 STMicroelectronics

+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. 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.
+  *   3. Neither the name of STMicroelectronics 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.
+  *
+  ******************************************************************************
+  */
+
+/** @addtogroup CMSIS
+  * @{
+  */
+
+/** @addtogroup stm32l4xx_system
+  * @{
+  */
+
+/**
+  * @brief Define to prevent recursive inclusion
+  */
+#ifndef __SYSTEM_STM32L4XX_H
+#define __SYSTEM_STM32L4XX_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/** @addtogroup STM32L4xx_System_Includes
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+
+/** @addtogroup STM32L4xx_System_Exported_types
+  * @{
+  */
+  /* This variable is updated in three ways:
+      1) by calling CMSIS function SystemCoreClockUpdate()
+      2) by calling HAL API function HAL_RCC_GetSysClockFreq()
+      3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
+         Note: If you use this function to configure the system clock; then there
+               is no need to call the 2 first functions listed above, since SystemCoreClock
+               variable is updated automatically.
+  */
+extern uint32_t SystemCoreClock;            /*!< System Clock Frequency (Core Clock) */
+
+extern const uint8_t AHBPrescTable[16];     /*!< AHB prescalers table values */
+extern const uint32_t MSIRangeTable[12];    /*!< MSI ranges table values     */
+
+/**
+  * @}
+  */
+
+/** @addtogroup STM32L4xx_System_Exported_Constants
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @addtogroup STM32L4xx_System_Exported_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @addtogroup STM32L4xx_System_Exported_Functions
+  * @{
+  */
+
+extern void SystemInit(void);
+extern void SystemCoreClockUpdate(void);
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SYSTEM_STM32L4XX_H */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


Reorder.

Reorder.

--- src/parser/srp.h
+++ src/parser/srp.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of DGD, https://github.com/dworkin/dgd
  * Copyright (C) 1993-2010 Dworkin B.V.
- * Copyright (C) 2010-2020 DGD Authors (see the commit log for details)
+ * Copyright (C) 2010-2021 DGD Authors (see the commit log for details)
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -32,6 +32,12 @@
     static Srp *load(char *grammar, char *str, Uint len);

 private:
+    Srp(char *grammar);
+
+    Int pack(unsigned short *check, unsigned short *from, unsigned short *to,
+	     unsigned short n);
+    class SrpState *expand(SrpState *state);
+
     char *grammar;		/* grammar */
     unsigned short nsstring;	/* # of source grammar strings */
     unsigned short ntoken;	/* # of tokens (regexp & string) */
@@ -68,11 +74,4 @@
     Uint shhsize;		/* shift hash table size */
     char *shtab;		/* shift (from/to) table */
     class ShLink **shhtab;	/* shift hash table */
-
-private:
-    Srp(char *grammar);
-
-    Int pack(unsigned short *check, unsigned short *from, unsigned short *to,
-	     unsigned short n);
-    SrpState *expand(SrpState *state);
 };


Patch from fraioli@dg-rtp.dg.com (Marc J. Fraioli) to unbreak DGUX.

--- dbm/include/mcom_db.h
+++ dbm/include/mcom_db.h
@@ -110,6 +110,11 @@
 #include <sys/byteorder.h>
 #endif

+#ifdef DGUX
+#include <sys/types.h>
+#include <sys/byteorder.h>
+#endif
+
 #ifdef NCR
 #include <sys/types.h>
 #include <sys/byteorder.h>


moved prototypes up

moved prototypes up

--- ipc/unix-socket-ipc-daemon.c
+++ ipc/unix-socket-ipc-daemon.c
@@ -41,6 +41,12 @@

 int setnonblock(int fd);
 static void not_blocked(EV_P_ ev_periodic *w, int revents);
+static void server_cb(EV_P_ ev_io *w, int revents);
+inline static struct sock_ev_client* client_new(int fd);
+static void client_cb(EV_P_ ev_io *w, int revents);
+int server_init(struct sock_ev_serv* server, char* sock_path, int max_queue);
+int unix_socket_init(struct sockaddr_un* socket_un, char* sock_path, int max_queue);
+

 // This callback is called when client data is available
 static void client_cb(EV_P_ ev_io *w, int revents) {


Fixed signature of trim_end_whitespace().

--- src/util/ascii_util.h
+++ src/util/ascii_util.h
@@ -922,7 +922,7 @@
  * @param s The string.
  */
 template<class StringType> inline
-void trim_end_whitespace( StringType &s, char const *chars ) {
+void trim_end_whitespace( StringType &s ) {
   trim_end( s, whitespace );
 }


Only take bmap reference for async lease operation: iozone -a + iozone -a + tar kernel source work

--- mount_slash/bmap_cli.c
+++ mount_slash/bmap_cli.c
@@ -209,7 +209,6 @@
  retry:
 	psc_assert(b->bcm_flags & BMAPF_MODECHNG);

-	bmap_op_start_type(b, BMAP_OPCNT_ASYNC);
 	if (b->bcm_flags & BMAPF_WR) {
 		/*
 		 * Write enabled bmaps are allowed to read with no
@@ -240,6 +239,7 @@
 	mq->prefios[0] = msl_pref_ios;

 	if (!blocking) {
+		bmap_op_start_type(b, BMAP_OPCNT_ASYNC);
 		rq->rq_async_args.pointer_arg[MSL_BMODECHG_CBARG_BMAP] = b;
 		rq->rq_async_args.pointer_arg[MSL_BMODECHG_CBARG_CSVC] = csvc;
 		rq->rq_interpret_reply = msl_rmc_bmodechg_cb;
@@ -323,7 +323,8 @@
 	}

 	b->bcm_flags &= ~BMAPF_MODECHNG;
-	bmap_op_done_type(b, BMAP_OPCNT_ASYNC);
+	bmap_wake_locked(b);
+	BMAP_ULOCK(b);
 	pscrpc_req_finished(rq);
 	if (csvc)
 		sl_csvc_decref(csvc);
@@ -553,7 +554,6 @@
 		b->bcm_flags &= ~BMAPF_LEASEEXPIRED;

 	b->bcm_flags |= BMAPF_LEASEEXTREQ;
-	bmap_op_start_type(b, BMAP_OPCNT_LEASEEXT);

 	BMAP_ULOCK(b);

@@ -570,6 +570,7 @@
 	mq->sbd = *sbd;

 	if (!blocking) {
+		bmap_op_start_type(b, BMAP_OPCNT_LEASEEXT);
 		rq->rq_async_args.pointer_arg[MSL_CBARG_BMAP] = b;
 		rq->rq_async_args.pointer_arg[MSL_CBARG_CSVC] = csvc;
 		rq->rq_interpret_reply = msl_rmc_bmltryext_cb;
@@ -610,7 +611,8 @@
 	b->bcm_flags &= ~BMAPF_LEASEEXTREQ;
 	DEBUG_BMAP(rc ? PLL_ERROR : PLL_DIAG, b,
 		"lease extension req (rc=%d) (secs=%d)", rc, secs);
-	bmap_op_done_type(b, BMAP_OPCNT_LEASEEXT);
+	bmap_wake_locked(b);
+	BMAP_ULOCK(b);
 	if (csvc)
 		sl_csvc_decref(csvc);

@@ -739,7 +741,6 @@

  retry:

-	bmap_op_start_type(b, BMAP_OPCNT_ASYNC);
 	rc = slc_rmc_getcsvc(fci->fci_resm, &csvc);
 	if (rc)
 		PFL_GOTOERR(out, rc);
@@ -760,6 +761,7 @@
 	DEBUG_BMAP(PLL_DIAG, b, "retrieving bmap");

 	if (flags & BMAPGETF_NONBLOCK) {
+		bmap_op_start_type(b, BMAP_OPCNT_ASYNC);
 		rq->rq_async_args.pointer_arg[MSL_BMLGET_CBARG_BMAP] = b;
 		rq->rq_async_args.pointer_arg[MSL_BMLGET_CBARG_CSVC] = csvc;
 		rq->rq_interpret_reply = msl_rmc_bmlget_cb;
@@ -826,7 +828,6 @@
 	if (blocking && rc && slc_rpc_retry(pfr, &rc)) {
 		pscrpc_req_finished(rq);
 		rq = NULL;
-		bmap_op_done_type(b, BMAP_OPCNT_ASYNC);
 		goto retry;
 	}

@@ -846,7 +847,8 @@
 		BMAP_LOCK(b);
 	}

-	bmap_op_done_type(b, BMAP_OPCNT_ASYNC);
+	bmap_wake_locked(b);
+	BMAP_ULOCK(b);
 	pscrpc_req_finished(rq);
 	rc = abs(rc);
 	return (rc);


BUG: fix inheritance

BUG: fix inheritance

--- Code/Core/otbWrapperStringParameter.h
+++ Code/Core/otbWrapperStringParameter.h
@@ -25,17 +25,15 @@
 namespace Wrapper
 {

-
-
 /** \class StringParameter
  *  \brief This class represent a string parameter for the wrapper framework
  */
 class StringParameter
-  : public itk::LightObject
+  : public Parameter
 {
 public:
   /** Standard class typedef */
-  typedef Parameter                     Self;
+  typedef StringParameter               Self;
   typedef itk::LightObject              Superclass;
   typedef itk::SmartPointer<Self>       Pointer;
   typedef itk::SmartPointer<const Self> ConstPointer;
@@ -44,8 +42,7 @@
   itkNewMacro(Self);

   /** RTTI support */
-  itkTypeMacro(Parameter,itk::LightObject);
-
+  itkTypeMacro(StringParameter, Parameter);

 protected:
   /** Constructor */


Improved blink example

Improved blink example

--- examples/blink/src/blink.c
+++ examples/blink/src/blink.c
@@ -3,7 +3,10 @@

 const uint32_t OscRateIn = 12000000;

-#define LED_PIN 10
+#define LED0 2, 5
+#define LED1 0, 6
+#define LED2 0, 7
+#define LED3 2, 9

 volatile uint32_t msTicks;

@@ -11,27 +14,22 @@
 	msTicks++;
 }

-__INLINE static void Delay(uint32_t dlyTicks) {
+static void Delay(uint32_t dlyTicks) {
 	uint32_t curTicks = msTicks;
 	while ((msTicks - curTicks) < dlyTicks);
 }

-__INLINE static void GPIO_Config(void) {
+static void GPIO_Config(void) {
 	Chip_GPIO_Init(LPC_GPIO);

 }

-__INLINE static void LED_Config(void) {
-	Chip_GPIO_WriteDirBit(LPC_GPIO, 2, LED_PIN, true);
-
+static void LED_Init(uint8_t port, uint8_t pin) {
+	Chip_GPIO_WriteDirBit(LPC_GPIO, port, pin, true);
 }

-__INLINE static void LED_On(void) {
-	Chip_GPIO_SetPinState(LPC_GPIO, 2, LED_PIN, true);
-}
-
-__INLINE static void LED_Off(void) {
-	Chip_GPIO_SetPinState(LPC_GPIO, 2, LED_PIN, false);
+static void LED_Write(uint8_t port, uint8_t pin, uint8_t val) {
+	Chip_GPIO_SetPinState(LPC_GPIO, port, pin, val);
 }

 int main (void) {
@@ -45,12 +43,23 @@
 	}

 	GPIO_Config();
-	LED_Config();
+	LED_Init(LED0);
+	LED_Init(LED1);
+	LED_Init(LED2);
+	LED_Init(LED3);

 	while(1) {
-		LED_On();
+		LED_Write(LED3, false);
+		LED_Write(LED0, true);
 		Delay(1000);
-		LED_Off();
+		LED_Write(LED0, false);
+		LED_Write(LED1, true);
+		Delay(1000);
+		LED_Write(LED1, false);
+		LED_Write(LED2, true);
+		Delay(1000);
+		LED_Write(LED2, false);
+		LED_Write(LED3, true);
 		Delay(1000);
 	}
 }


Fixed typos in message collection view cell header.

--- Code/LYRUIMessageCollectionViewCell.h
+++ Code/LYRUIMessageCollectionViewCell.h
@@ -14,13 +14,13 @@

 /**
  @abstract The `LYRUIMessageCollectionViewCell` class provides a lightweight, customizable collection
- view cell for presenting Layer message objects. The class is subclassed by by the LYRUIIncomingMessageCollectionViewCell`
- and the `LYRUIOutgoingMessageCollectionViewCell
+ view cell for presenting Layer message objects. The class is subclassed by `LYRUIIncomingMessageCollectionViewCell`
+ and `LYRUIOutgoingMessageCollectionViewCell`.
  */
 @interface LYRUIMessageCollectionViewCell : UICollectionViewCell <LYRUIMessagePresenting>

 /**
- @abstract Customization selectors for configuring cell appearance
+ @abstract Customization selectors for configuring cell appearance.
  */
 @property (nonatomic) UIFont *messageTextFont UI_APPEARANCE_SELECTOR;
 @property (nonatomic) UIColor *messageTextColor UI_APPEARANCE_SELECTOR;
@@ -28,13 +28,13 @@
 @property (nonatomic) UIColor *pendingBubbleViewColor UI_APPEARANCE_SELECTOR;

 /**
- @abstract The cell `Bubble View` which handles displaying the cell content
+ @abstract The view that handles displaying the cell content.
  */
 @property (nonatomic) LYRUIMessageBubbleView *bubbleView;

 /**
- @abstract The optional avatar image view representing a user
+ @abstract The optional avatar image view representing a user.
  */
 @property (nonatomic) LYRUIAvatarImageView *avatarImage;

-@end+@end


Bug 363 - check for integer overflow in size=rows*cols computations

--- Eigen/src/Core/PlainObjectBase.h
+++ Eigen/src/Core/PlainObjectBase.h
@@ -34,6 +34,24 @@

 namespace internal {

+template<typename Index>
+void check_rows_cols_for_overflow(Index rows, Index cols)
+{
+  #ifdef EIGEN_EXCEPTIONS
+    // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242
+    // we assume Index is signed
+    Index max_index = (Index(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed
+    bool error = (x < 0  || y < 0)  ? true
+               : (x == 0 || y == 0) ? false
+                                    : (x > max_index / y);
+    if (error)
+      throw std::bad_alloc();
+  #else
+    (void) rows;
+    (void) cols;
+  #endif
+}
+
 template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct conservative_resize_like_impl;

 template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct matrix_swap_impl;
@@ -200,11 +218,13 @@
     EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
     {
       #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO
+        internal::check_rows_cols_for_overflow(rows, cols);
         Index size = rows*cols;
         bool size_changed = size != this->size();
         m_storage.resize(size, rows, cols);
         if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
       #else
+        internal::check_rows_cols_for_overflow(rows, cols);
         m_storage.resize(rows*cols, rows, cols);
       #endif
     }
@@ -273,6 +293,7 @@
     EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other)
     {
       const OtherDerived& other = _other.derived();
+      internal::check_rows_cols_for_overflow(other.rows(), other.cols());
       const Index othersize = other.rows()*other.cols();
       if(RowsAtCompileTime == 1)
       {
@@ -417,6 +438,7 @@
       : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
     {
       _check_template_params();
+      internal::check_rows_cols_for_overflow((other.derived().rows(), other.derived().cols());
       Base::operator=(other.derived());
     }

@@ -581,6 +603,7 @@
     {
       eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
              && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
+      internal::check_rows_cols_for_overflow(rows, cols);
       m_storage.resize(rows*cols,rows,cols);
       EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
     }
@@ -638,6 +661,7 @@
     if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows
          (!Derived::IsRowMajor && _this.rows() == rows) )  // column-major and we change only the number of columns
     {
+      internal::check_rows_cols_for_overflow(rows, cols);
       _this.derived().m_storage.conservativeResize(rows*cols,rows,cols);
     }
     else


libusbg: Dereference pointer before switch

In each case in usbg_cleanup_function() we have
been using f_attrs->attrs. To make this shorter
and more readable add attrs pointer which is
equal to &f_attrs->attrs.

Signed-off-by: Krzysztof Opasiak <8064eda6f94b3817252b7d7649cf754592f63500@samsung.com>
Reviewed-by: Pawel Szewczyk <1691dcf8dab804b326e5e4b9ab228a1c3b23a2f2@samsung.com>

--- src/usbg.c
+++ src/usbg.c
@@ -2615,26 +2615,30 @@

 void usbg_cleanup_function_attrs(usbg_function_attrs *f_attrs)
 {
+	usbg_f_attrs *attrs;
+
 	if (!f_attrs)
 		return;

+	attrs = &f_attrs->attrs;
+
 	switch (f_attrs->header.attrs_type) {
 	case USBG_F_ATTRS_SERIAL:
 		break;

 	case USBG_F_ATTRS_NET:
-		free(f_attrs->attrs.net.ifname);
-		f_attrs->attrs.net.ifname = NULL;
+		free(attrs->net.ifname);
+		attrs->net.ifname = NULL;
 		break;

 	case USBG_F_ATTRS_PHONET:
-		free(f_attrs->attrs.phonet.ifname);
-		f_attrs->attrs.phonet.ifname = NULL;
+		free(attrs->phonet.ifname);
+		attrs->phonet.ifname = NULL;
 		break;

 	case USBG_F_ATTRS_FFS:
-		free(f_attrs->attrs.ffs.dev_name);
-		f_attrs->attrs.ffs.dev_name = NULL;
+		free(attrs->ffs.dev_name);
+		attrs->ffs.dev_name = NULL;
 		break;
 	default:
 		ERROR("Unsupported attrs type\n");


INTEGRATION: CWS warnings01 (1.4.8); FILE MERGED 2006/03/06 16:08:07 pl 1.4.8.1: #i55991# removed warnings for windows platform

--- rsc/source/rscpp/cpp2.c
+++ rsc/source/rscpp/cpp2.c
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: cpp2.c,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: rt $ $Date: 2005-09-08 13:58:32 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: hr $ $Date: 2006-06-20 05:49:41 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -327,8 +327,7 @@

 FILE_LOCAL
-void doif(hash)
-int             hash;
+void doif(int hash)
 /*
  * Process an #if, #ifdef, or #ifndef.  The latter two are straightforward,
  * while #if needs a subroutine of its own to evaluate the expression.
@@ -445,9 +444,7 @@

 FILE_LOCAL int
-openinclude(filename, searchlocal)
-char            *filename;              /* Input file name              */
-int             searchlocal;            /* TRUE if #include "file"      */
+openinclude(char* filename, int searchlocal)
 /*
  * Actually open an include file.  This routine is only called from
  * doinclude() above, but was written as a separate subroutine for
@@ -524,9 +521,7 @@

 FILE_LOCAL int
-hasdirectory(source, result)
-char            *source;        /* Directory to examine                 */
-char            *result;        /* Put directory stuff here             */
+hasdirectory(char* source, char* result)
 /*
  * If a device or directory is found in the source filename string, the
  * node/device/directory part of the string is copied to result and


Fix for QNX.  Need to tell it what uint is....

--- dbm/include/mcom_db.h
+++ dbm/include/mcom_db.h
@@ -307,7 +307,7 @@
 #endif

 /* if we're using gcc's -pedantic-errors, uint isn't defined */
-#ifdef __STRICT_ANSI__
+#if defined(__STRICT_ANSI__) || !defined(HAVE_UINT)
 typedef unsigned int uint;
 #endif


revert

revert

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@18368 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- mount_slash/dircache.c
+++ mount_slash/dircache.c
@@ -264,7 +264,7 @@
 	/* Clear more space if needed.
 	 */
 	while (m->dcm_alloc > m->dcm_maxsz && !lc_empty(&m->dcm_lc)) {
-		e = lc_peektail(&m->dcm_lc);
+		e = lc_peekhead(&m->dcm_lc);
 		if (!e)
 			break;


ia32: Use correct enum entry instead of 'true', which accidently has the same value.

--- ir/be/ia32/ia32_intrinsics.c
+++ ir/be/ia32/ia32_intrinsics.c
@@ -62,7 +62,7 @@

 	bitinfo *bi_left = get_bitinfo(left);
 	if (!bi_left) {
-		return true;
+		return can_carry;
 	}
 	bitinfo *bi_right = get_bitinfo(right);
 	// If we have bitinfo for one node, we should also have it for
@@ -96,7 +96,7 @@

 	bitinfo *bi_left = get_bitinfo(left);
 	if (!bi_left) {
-		return true;
+		return can_carry;
 	}
 	bitinfo *bi_right = get_bitinfo(right);
 	// If we have bitinfo for one node, we should also have it for


SCCS xml.c 10/09/30 08:29:53: Removed "comment in comment" warning

--- src/pbasis/xml.c
+++ src/pbasis/xml.c
@@ -735,7 +735,7 @@

 	e = s[len - 1]; /* save end uchar* s[len - 1]
 					 * '\0';
-					 * /* turn end uchar into null terminator */
+					 * turn end uchar into null terminator */

 	while( *s && *s != '<' )
 		s++;	/* find first tag */


Remove construct_path method

Remove construct_path method

--- src/util/file_utils.c
+++ src/util/file_utils.c
@@ -8,29 +8,6 @@

 #include "file_utils.h"

-
-char *construct_path(int pathparts, ...)
-{
-    va_list part;
-    int args;
-    char *path_part, *pathname;
-
-    pathname = NULL;
-    va_start(part, pathparts);
-
-    for (args=0; args < pathparts; args++) {
-        path_part = (char *) va_arg(part, char *);
-        if (pathname == NULL)
-            pathname = calloc(sizeof(char) * strlen(path_part) + 1, sizeof(char));
-        else
-            pathname = realloc(pathname, strlen(pathname) + strlen(path_part) + 1); // XXX fix
-        strcat(pathname, path_part);
-    }
-
-    va_end(part);
-
-    return pathname;
-}

 char *proc_parser(char *path, char *field)
 {


ogg demux: fill i_physical_channels

ogg demux: fill i_physical_channels

Refs: #8295

--- modules/demux/ogg.c
+++ modules/demux/ogg.c
@@ -145,6 +145,34 @@
 static void Ogg_ReadFlacHeader( demux_t *, logical_stream_t *, ogg_packet * );
 static void Ogg_ReadAnnodexHeader( demux_t *, logical_stream_t *, ogg_packet * );
 static bool Ogg_ReadDiracHeader( logical_stream_t *, ogg_packet * );
+
+static void fill_channels_info(audio_format_t *audio)
+{
+    static const int pi_channels_map[9] =
+    {
+        0,
+        AOUT_CHAN_CENTER,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
+        AOUT_CHAN_CENTER | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT
+            | AOUT_CHAN_REARRIGHT,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
+            | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
+            | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
+            | AOUT_CHAN_REARCENTER | AOUT_CHAN_MIDDLELEFT
+            | AOUT_CHAN_MIDDLERIGHT | AOUT_CHAN_LFE,
+        AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT
+            | AOUT_CHAN_REARRIGHT | AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT
+            | AOUT_CHAN_LFE,
+    };
+
+    unsigned chans = audio->i_channels;
+    if (chans < sizeof(pi_channels_map) / sizeof(pi_channels_map[0]))
+        audio->i_physical_channels =
+        audio->i_original_channels = pi_channels_map[chans];
+}

 /*****************************************************************************
  * Open: initializes ogg demux structures
@@ -1329,6 +1357,7 @@
                         i_format_tag = GetWLE((oggpacket.packet+124));
                         p_stream->fmt.audio.i_channels =
                             GetWLE((oggpacket.packet+126));
+                        fill_channels_info(&p_stream->fmt.audio);
                         p_stream->f_rate = p_stream->fmt.audio.i_rate =
                             GetDWLE((oggpacket.packet+128));
                         p_stream->fmt.i_bitrate =
@@ -1452,6 +1481,7 @@
                         p_buffer[4] = '\0';
                         i_format_tag = strtol(p_buffer,NULL,16);
                         p_stream->fmt.audio.i_channels = st->sh.audio.channels;
+                        fill_channels_info(&p_stream->fmt.audio);
                         if( st->time_unit <= 0 )
                             st->time_unit = 10000000;
                         p_stream->f_rate = p_stream->fmt.audio.i_rate = st->samples_per_unit * 10000000 / st->time_unit;
@@ -1987,6 +2017,7 @@
     oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes);
     oggpack_adv( &opb, 88 );
     p_stream->fmt.audio.i_channels = oggpack_read( &opb, 8 );
+    fill_channels_info(&p_stream->fmt.audio);
     p_stream->f_rate = p_stream->fmt.audio.i_rate =
         oggpack_read( &opb, 32 );
     oggpack_adv( &opb, 32 );
@@ -2022,6 +2053,7 @@
     oggpack_adv( &opb, 32 ); /* mode */
     oggpack_adv( &opb, 32 ); /* mode_bitstream_version */
     p_stream->fmt.audio.i_channels = oggpack_read( &opb, 32 );
+    fill_channels_info(&p_stream->fmt.audio);
     p_stream->fmt.i_bitrate = oggpack_read( &opb, 32 );
 }

@@ -2049,6 +2081,7 @@
     oggpack_adv( &opb, 64 );
     oggpack_adv( &opb, 8 ); /* version_id */
     p_stream->fmt.audio.i_channels = oggpack_read( &opb, 8 );
+    fill_channels_info(&p_stream->fmt.audio);
     p_stream->i_pre_skip = oggpack_read( &opb, 16 );

     if ( p_demux->p_sys->i_length < 0 )
@@ -2079,6 +2112,7 @@
         bs_skip( &s, 80 );
         p_stream->f_rate = p_stream->fmt.audio.i_rate = bs_read( &s, 20 );
         p_stream->fmt.audio.i_channels = bs_read( &s, 3 ) + 1;
+        fill_channels_info(&p_stream->fmt.audio);

         msg_Dbg( p_demux, "FLAC header, channels: %i, rate: %i",
                  p_stream->fmt.audio.i_channels, (int)p_stream->f_rate );


ADD: Landsat TM indices : Bright

ADD: Landsat TM indices : Bright

error: pathspec 'Code/Radiometry/otbLandsatTMIndices.h' did not match any file(s) known to git

--- Code/Radiometry/otbLandsatTMIndices.h
+++ Code/Radiometry/otbLandsatTMIndices.h
@@ -0,0 +1,262 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbLandsatTMIndices_h
+#define __otbLandsatTMIndices_h
+
+#include "otbMath.h"
+#include "itkVariableLengthVector.h"
+#include "otbBandName.h"
+
+namespace otb
+{
+
+namespace Functor
+{
+
+namespace LandsatTM
+{
+
+enum SATType {L5, L7}
+/**
+   * \class LandsatTMIndexBase
+   * \brief Base class for Landsat-TM indices
+   *
+   *  Implement operators for UnaryFunctorImageFilter templated with a
+   *  vector pixel having 8 components. The order of the components
+   *  defaults to the one of Lansat 7, but the Landsat 5 order is also
+   *  available. Any other order of bands can be manually selected.
+   *  Subclasses should overload operator().
+   *
+   * \ingroup Radiometry
+ */
+template<class TInput, class TOutput>
+class LandsatTMIndexBase
+{
+public:
+
+  //operators !=
+  bool operator !=(const LandsatTMIndexBase&) const
+  {
+    return false;
+  }
+  //operator ==
+  bool operator ==(const LandsatTMIndexBase& other) const
+  {
+    return !(*this != other);
+  }
+  // Operator performing the work
+  inline TOutput operator ()(const TInput& inputPixel) const = 0;
+
+  /// Constructor
+  LandsatTMIndexBase() :  m_EpsilonToBeConsideredAsZero(0.0000001), m_TM1(0), m_TM2(1), m_TM3(2), m_TM4(3), m_TM5(4), m_TM60(5), m_TM61(5), m_TM62(6), m_TM7{7}, m_SAT(L7) {}
+  /// Desctructor
+  virtual ~LandsatTMIndexBase() {}
+
+  /** Set index, generic method */
+  void SetIndex(BandName::LandsatTMBandNames band, unsigned int channel)
+  {
+    switch( band )
+      {
+      case BandName::TM1:
+        m_TM1 = channel;
+        break;
+      case BandName::TM2:
+        m_TM2 = channel;
+        break;
+      case BandName::TM3:
+        m_TM3 = channel;
+        break;
+      case BandName::TM4:
+        m_TM4 = channel;
+        break;
+      case BandName::TM5:
+        m_TM5 = channel;
+        break;
+      case BandName::TM60:
+        m_TM60 = channel;
+        break;
+      case BandName::TM61:
+        m_TM61 = channel;
+        break;
+      case BandName::TM62:
+        m_TM62 = channel;
+        break;
+      case BandName::TM7:
+        m_TM7 = channel;
+        break;
+      }
+  }
+  /** Get index, generic method */
+  unsigned int GetIndex(BandName::LandsatTMBandNames band) const
+  {
+    switch( band )
+      {
+      case BandName::TM1:
+        return m_TM1;
+        break;
+      case BandName::TM2:
+        return m_TM2;
+        break;
+      case BandName::TM3:
+        return m_TM3;
+        break;
+      case BandName::TM4:
+        return m_TM4;
+        break;
+      case BandName::TM5:
+        return m_TM5;
+        break;
+      case BandName::TM60:
+        return m_TM60;
+        break;
+      case BandName::TM61:
+        return m_TM61;
+        break;
+      case BandName::TM62:
+        return m_TM62;
+        break;
+      case BandName::TM7:
+        return m_TM7;
+        break;
+      }
+    return m_TM1;
+  }
+
+  itkSetMacro(TM1, unsigned int);
+  itkGetConstMacro(TM1, unsigned int);
+
+  itkSetMacro(TM2, unsigned int);
+  itkGetConstMacro(TM2, unsigned int);
+
+  itkSetMacro(TM3, unsigned int);
+  itkGetConstMacro(TM3, unsigned int);
+
+  itkSetMacro(TM4, unsigned int);
+  itkGetConstMacro(TM4, unsigned int);
+
+  itkSetMacro(TM5, unsigned int);
+  itkGetConstMacro(TM5, unsigned int);
+
+  itkSetMacro(TM60, unsigned int);
+  itkGetConstMacro(TM60, unsigned int);
+
+  itkSetMacro(TM61, unsigned int);
+  itkGetConstMacro(TM61, unsigned int);
+
+  itkSetMacro(TM62, unsigned int);
+  itkGetConstMacro(TM62, unsigned int);
+
+  itkSetMacro(TM7, unsigned int);
+  itkGetConstMacro(TM7, unsigned int);
+
+  void SetSAT(SATType sat)
+  {
+    if( sat == L5 )
+      {
+      m_TM1 = 0;
+      m_TM2 = 1;
+      m_TM3 = 2;
+      m_TM4 = 3;
+      m_TM5 = 4;
+      m_TM60 = 5;
+      m_TM7 = 6;
+      m_SAT = L5;
+      }
+    else
+      {
+      m_TM1 = 0;
+      m_TM2 = 1;
+      m_TM3 = 2;
+      m_TM4 = 3;
+      m_TM5 = 4;
+      m_TM61 = 5;
+      m_TM62 = 6;
+      m_TM7 = 7;
+      m_SAT = L7;
+      }
+  }
+  itkGetConstMacro(SAT, SATType);
+
+  /** Return the index name */
+  virtual std::string GetName() const = 0;
+
+protected:
+  // This method must be reimplemented in subclasses to actually
+  // compute the index value
+  double m_EpsilonToBeConsideredAsZero;
+
+private:
+  unsigned int m_TM1;
+  unsigned int m_TM2;
+  unsigned int m_TM3;
+  unsigned int m_TM4;
+  unsigned int m_TM5;
+  unsigned int m_TM60;
+  unsigned int m_TM61;
+  unsigned int m_TM62;
+  unsigned int m_TM7;
+
+  SATType m_SAT;
+
+};
+
+
+/** \class Bright
+ *  Brightness index for LandsatTM. Computes a weighted mean of the
+ *  non thermal bands as follows :
+ *  \f[
+ *    \frac{1}{8}\left( TM1 + TM2 + 2\times TM3 + 2\times TM4 + TM5 + TM7\right)
+ *  \f]
+ *  This expression is the one used in Baraldi et al. 2006, "Automatic
+ *  Spectral Rule-Based Preliminary Mapping of Calibrated Landsat TM
+ *  and ETMµ+ Images", IEEE Trans. on Geoscience and Remote Sensing,
+ *  vol 44, no 9.
+ *
+ * \ingroup Functor
+ * \ingroup Radiometry
+ * \ingroup LandsatTMIndices
+ */
+template <class TInput, class TOutput>
+class Bright : public LandsatTMIndexBase<TInput, TOutput>
+{
+public:
+  /** Return the index name */
+  virtual std::string GetName() const
+  {
+    return "Bright";
+  }
+
+  typedef NDVI<TInput, TOutput> NDVIFunctorType;
+  Bright() {}
+  virtual ~Bright() {}
+
+  inline TOutput operator ()(const TInput& inputPixel)
+  {
+
+    double result = inputPixel[TM1]+inputPixel[TM2]+2*inputPixel[TM3]+2*inputPixel[TM4]+inputPixel[TM5]+inputPixel[TM7];
+    return static_cast<TOutput>(result);
+  }
+
+
+};
+
+} // namespace LandsatTM
+} // namespace Functor
+} // namespace otb
+
+#endif


Use more explicit names.

Use more explicit names.

--- Eigen/src/Core/SolveTriangular.h
+++ Eigen/src/Core/SolveTriangular.h
@@ -115,17 +115,17 @@
 struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
   enum {
     IsLower = ((Mode&Lower)==Lower),
-    RowIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
-    S = IsLower ? 0     : RowIndex+1
+    DiagIndex  = IsLower ? LoopIndex : Size - LoopIndex - 1,
+    StartIndex = IsLower ? 0         : DiagIndex+1
   };
   static void run(const Lhs& lhs, Rhs& rhs)
   {
     if (LoopIndex>0)
-      rhs.coeffRef(RowIndex) -= lhs.row(RowIndex).template segment<LoopIndex>(S).transpose()
-                         .cwiseProduct(rhs.template segment<LoopIndex>(S)).sum();
+      rhs.coeffRef(DiagIndex) -= lhs.row(DiagIndex).template segment<LoopIndex>(StartIndex).transpose()
+                                .cwiseProduct(rhs.template segment<LoopIndex>(StartIndex)).sum();

     if(!(Mode & UnitDiag))
-      rhs.coeffRef(RowIndex) /= lhs.coeff(RowIndex,RowIndex);
+      rhs.coeffRef(DiagIndex) /= lhs.coeff(DiagIndex,DiagIndex);

     triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex+1,Size>::run(lhs,rhs);
   }


Add the .hasTime model entry feature flag (rather than explicitly test for an Active Braille). (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@8139 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Drivers/Braille/HandyTech/braille.c
+++ Drivers/Braille/HandyTech/braille.c
@@ -271,6 +271,7 @@
   unsigned char statusCells;

   unsigned hasATC:1; /* Active Tactile Control */
+  unsigned hasTime:1;
 } ModelEntry;

 static const ModelEntry modelTable[] = {
@@ -387,7 +388,8 @@
     .writeCells = writeCells_Evolution,
     .setFirmness = setFirmness,
     .setSensitivity = setSensitivity_ActiveBraille,
-    .hasATC = 1
+    .hasATC = 1,
+    .hasTime = 1
   },

 #define HT_BASIC_BRAILLE(cells)                     \
@@ -1155,7 +1157,7 @@
                   }

                   if (setTime) {
-                    if (brl->data->model->identifier == HT_MODEL_ActiveBraille) {
+                    if (brl->data->model->hasTime) {
                       requestDateTime(brl, synchronizeDateTime);
                     } else {
                       logMessage(LOG_INFO, "%s does not support setting the clock",


updated SpinLock class

updated SpinLock class

--- IntrOS/kernel/inc/osspinlock.h
+++ IntrOS/kernel/inc/osspinlock.h
@@ -2,7 +2,7 @@

     @file    IntrOS: osspinlock.h
     @author  Rajmund Szymanski
-    @date    02.05.2020
+    @date    09.05.2020
     @brief   This file contains definitions for IntrOS.

  ******************************************************************************
@@ -266,8 +266,13 @@

 struct SpinLock : private CriticalSection
 {
-	 SpinLock( spn_id _spn ): spn_(_spn) { core_spn_lock  (spn_); }
+	 SpinLock( spn_id _spn ): spn_{_spn} { core_spn_lock  (spn_); }
 	~SpinLock( void )                    { core_spn_unlock(spn_); }
+
+	SpinLock( SpinLock&& ) = delete;
+	SpinLock( const SpinLock& ) = delete;
+	SpinLock& operator=( SpinLock&& ) = delete;
+	SpinLock& operator=( const SpinLock& ) = delete;

 	private:
 	spn_id spn_;