cli CHANGE timeout param for all commands

Refs #498

--- cli/commands.c
+++ cli/commands.c
@@ -46,6 +46,7 @@
 #include "completion.h"

 #define CLI_CH_TIMEOUT 60 /* 1 minute */
+#define CLI_RPC_REPLY_TIMEOUT 5 /* 5 seconds */

 #define NC_CAP_WRITABLERUNNING_ID "urn:ietf:params:netconf:capability:writable-running"
 #define NC_CAP_CANDIDATE_ID       "urn:ietf:params:netconf:capability:candidate"
@@ -272,7 +273,7 @@
 }

 static int
-cli_send_recv(struct nc_rpc *rpc, FILE *output, NC_WD_MODE wd_mode)
+cli_send_recv(struct nc_rpc *rpc, FILE *output, NC_WD_MODE wd_mode, int timeout_s)
 {
     char *str, *model_data;
     int ret = 0, ly_wd, mono;
@@ -307,7 +308,7 @@
     }

 recv_reply:
-    msgtype = nc_recv_reply(session, rpc, msgid, 20000,
+    msgtype = nc_recv_reply(session, rpc, msgid, timeout_s * 1000,
                             LYD_OPT_DESTRUCT | LYD_OPT_NOSIBLINGS, &reply);
     if (msgtype == NC_MSG_ERROR) {
         ERROR(__func__, "Failed to receive a reply.");
@@ -724,7 +725,7 @@
     if (session && !nc_session_cpblt(session, NC_CAP_CONFIRMEDCOMMIT_ID)) {
         printf("cancel-commit is not supported by the current session.\n");
     } else {
-        printf("cancel-commit [--help] [--persist-id <commit-id>]\n");
+        printf("cancel-commit [--help] [--persist-id <commit-id>] [--rpc-timeout <seconds>]\n");
     }
 }

@@ -743,7 +744,7 @@
     } else {
         confirmed = "";
     }
-    printf("commit [--help]%s\n", confirmed);
+    printf("commit [--help]%s [--rpc-timeout <seconds>]\n", confirmed);
 }

 void
@@ -809,7 +810,7 @@
         }
     }

-    printf("copy-config [--help] --target %s%s%s%s (--source %s%s%s%s | --src-config[=<file>])%s\n",
+    printf("copy-config [--help] --target %s%s%s%s (--source %s%s%s%s | --src-config[=<file>])%s [--rpc-timeout <seconds>]\n",
            running, startup, candidate, url,
            running, startup, candidate, url, defaults);
 }
@@ -841,14 +842,14 @@
         return;
     }

-    printf("delete-config [--help] --target %s%s\n", startup, url);
+    printf("delete-config [--help] --target %s%s [--rpc-timeout <seconds>]\n", startup, url);
 }

 void
 cmd_discardchanges_help(void)
 {
     if (!session || nc_session_cpblt(session, NC_CAP_CANDIDATE_ID)) {
-        printf("discard-changes [--help]\n");
+        printf("discard-changes [--help] [--rpc-timeout <seconds>]\n");
     } else {
         printf("discard-changes is not supported by the current session.\n");
     }
@@ -903,7 +904,7 @@
     }

     printf("edit-config [--help] --target %s%s %s--config[=<file>]%s [--defop merge|replace|none] "
-           "%s[--error stop|continue%s]\n", running, candidate, bracket, url, validate, rollback);
+           "%s[--error stop|continue%s] [--rpc-timeout <seconds>]\n", running, candidate, bracket, url, validate, rollback);
 }

 void
@@ -923,7 +924,7 @@
         xpath = "";
     }

-    fprintf(stdout, "get [--help] [--filter-subtree[=<file>]%s] %s[--out <file>]\n", xpath, defaults);
+    fprintf(stdout, "get [--help] [--filter-subtree[=<file>]%s] %s[--out <file>] [--rpc-timeout <seconds>]\n", xpath, defaults);
 }

 void
@@ -956,14 +957,14 @@
         candidate = "";
     }

-    printf("get-config [--help] --source running%s%s [--filter-subtree[=<file>]%s] %s[--out <file>]\n",
+    printf("get-config [--help] --source running%s%s [--filter-subtree[=<file>]%s] %s[--out <file>] [--rpc-timeout <seconds>]\n",
            startup, candidate, xpath, defaults);
 }

 void
 cmd_killsession_help(void)
 {
-    printf("killsession [--help] --sid <sesion-ID>\n");
+    printf("killsession [--help] --sid <sesion-ID> [--rpc-timeout <seconds>]\n");
 }

 void
@@ -983,7 +984,7 @@
         candidate = "";
     }

-    printf("lock [--help] --target running%s%s\n", startup, candidate);
+    printf("lock [--help] --target running%s%s [--rpc-timeout <seconds>]\n", startup, candidate);
 }

 void
@@ -1003,7 +1004,7 @@
         candidate = "";
     }

-    printf("unlock [--help] --target running%s%s\n", startup, candidate);
+    printf("unlock [--help] --target running%s%s [--rpc-timeout <seconds>]\n", startup, candidate);
 }

 void
@@ -1039,7 +1040,7 @@
             url = "";
         }
     }
-    printf("validate [--help] (--source running%s%s%s | --src-config[=<file>])\n",
+    printf("validate [--help] (--source running%s%s%s | --src-config[=<file>]) [--rpc-timeout <seconds>]\n",
            startup, candidate, url);
 }

@@ -1059,7 +1060,8 @@
         xpath = "";
     }

-    printf("subscribe [--help] [--filter-subtree[=<file>]%s] [--begin <time>] [--end <time>] [--stream <stream>] [--out <file>]\n", xpath);
+    printf("subscribe [--help] [--filter-subtree[=<file>]%s] [--begin <time>] [--end <time>] [--stream <stream>] [--out <file>]"
+           " [--rpc-timeout <seconds>]\n", xpath);
     printf("\t<time> has following format:\n");
     printf("\t\t+<num>  - current time plus the given number of seconds.\n");
     printf("\t\t<num>   - absolute time as number of seconds since 1970-01-01.\n");
@@ -1074,7 +1076,7 @@
         return;
     }

-    printf("get-schema [--help] --model <identifier> [--version <version>] [--format <format>] [--out <file>]\n");
+    printf("get-schema [--help] --model <identifier> [--version <version>] [--format <format>] [--out <file>] [--rpc-timeout <seconds>]\n");
 }

 void
@@ -1108,7 +1110,7 @@
     }

     fprintf(stdout, "get-data [--help] --datastore running|startup|candidate|operational [--filter-subtree[=<file>]%s]"
-                    " [--config true|false]%s [--depth <subtree-depth>]%s%s [--out <file>]\n",
+                    " [--config true|false]%s [--depth <subtree-depth>]%s%s [--out <file>] [--rpc-timeout <seconds>]\n",
             xpath, origin ? " [--origin <origin>]* [--negated-origin]" : "", origin ? " [--with-origin]" : "", defaults);
 }

@@ -1132,13 +1134,13 @@
     }

     fprintf(stdout, "edit-data [--help] --datastore running|startup|candidate %s--config[=<file>]%s"
-                    " [--defop merge|replace|none]\n", bracket, url);
+                    " [--defop merge|replace|none] [--rpc-timeout <seconds>]\n", bracket, url);
 }

 void
 cmd_userrpc_help(void)
 {
-    printf("user-rpc [--help] [--content <file>] [--out <file>]\n");
+    printf("user-rpc [--help] [--content <file>] [--out <file>] [--rpc-timeout <seconds>]\n");
 }

 void
@@ -2856,12 +2858,13 @@
 cmd_cancelcommit(const char *arg, char **UNUSED(tmp_config_file))
 {
     struct nc_rpc *rpc;
-    int c, ret = EXIT_FAILURE;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     const char *persist_id = NULL;
     struct arglist cmd;
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
             {"persist-id", 1, 0, 'i'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -2875,7 +2878,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hi:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hi:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_cancelcommit_help();
@@ -2884,6 +2887,13 @@
         case 'i':
             persist_id = optarg;
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_cancelcommit_help();
@@ -2914,7 +2924,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -2927,7 +2937,7 @@
 cmd_commit(const char *arg, char **UNUSED(tmp_config_file))
 {
     struct nc_rpc *rpc;
-    int c, ret = EXIT_FAILURE, confirmed = 0;
+    int c, ret = EXIT_FAILURE, confirmed = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     int32_t confirm_timeout = 0;
     char *persist = NULL, *persist_id = NULL;
     struct arglist cmd;
@@ -2937,6 +2947,7 @@
             {"confirm-timeout", 1, 0, 't'},
             {"persist", 1, 0, 'p'},
             {"persist-id", 1, 0, 'i'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -2950,7 +2961,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hct:p:i:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hct:p:i:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_commit_help();
@@ -2968,6 +2979,13 @@
         case 'i':
             persist_id = optarg;
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_commit_help();
@@ -2997,7 +3015,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -3009,7 +3027,7 @@
 int
 cmd_copyconfig(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE;
+    int c, config_fd, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *src = NULL, *config_m = NULL, *src_start = NULL;
     const char *trg = NULL;
@@ -3023,6 +3041,7 @@
             {"source", 1, 0, 's'},
             {"src-config", 2, 0, 'c'},
             {"defaults", 1, 0, 'd'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3035,7 +3054,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:s:c::d:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:s:c::d:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_copyconfig_help();
@@ -3131,6 +3150,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_copyconfig_help();
@@ -3186,7 +3212,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -3200,7 +3226,7 @@
 int
 cmd_deleteconfig(const char *arg, char **UNUSED(tmp_config_file))
 {
-    int c, ret = EXIT_FAILURE;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     const char *trg = NULL;
     struct nc_rpc *rpc;
     NC_DATASTORE target = NC_DATASTORE_ERROR;;
@@ -3208,6 +3234,7 @@
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
             {"target", 1, 0, 't'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3220,7 +3247,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_deleteconfig_help();
@@ -3237,6 +3264,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_deleteconfig_help();
@@ -3273,7 +3307,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -3286,10 +3320,11 @@
 cmd_discardchanges(const char *arg, char **UNUSED(tmp_config_file))
 {
     struct nc_rpc *rpc;
-    int c, ret;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct arglist cmd;
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3303,55 +3338,62 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "h", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hr:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_discardchanges_help();
-            clear_arglist(&cmd);
-            return EXIT_SUCCESS;
+            ret = EXIT_SUCCESS;
+            goto fail;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_discardchanges_help();
-            clear_arglist(&cmd);
-            return EXIT_FAILURE;
+            goto fail;
         }
     }

     if (cmd.list[optind]) {
         ERROR(__func__, "Unparsed command arguments.");
         cmd_discardchanges_help();
-        clear_arglist(&cmd);
-        return EXIT_FAILURE;
-    }
-
-    clear_arglist(&cmd);
+        goto fail;
+    }

     if (!session) {
         ERROR(__func__, "Not connected to a NETCONF server, no RPCs can be sent.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!interleave) {
         ERROR(__func__, "NETCONF server does not support interleaving RPCs and notifications.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     rpc = nc_rpc_discard();
     if (!rpc) {
         ERROR(__func__, "RPC creation failed.");
-        return EXIT_FAILURE;
-    }
-
-    ret = cli_send_recv(rpc, stdout, 0);
+        goto fail;
+    }
+
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);
+
+fail:
+    clear_arglist(&cmd);
+
     return ret;
 }

 int
 cmd_editconfig(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, content_param = 0;
+    int c, config_fd, ret = EXIT_FAILURE, content_param = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *content = NULL, *config_m = NULL, *cont_start;
     NC_DATASTORE target = NC_DATASTORE_ERROR;
@@ -3365,9 +3407,10 @@
             {"target", 1, 0, 't'},
             {"defop", 1, 0, 'o'},
             {"test", 1, 0, 'e'},
-            {"error", 1, 0, 'r'},
+            {"error", 1, 0, 'E'},
             {"config", 2, 0, 'c'},
             {"url", 1, 0, 'u'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3380,7 +3423,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:o:e:r:c::u:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:o:E:r:c::u:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_editconfig_help();
@@ -3421,7 +3464,7 @@
                 goto fail;
             }
             break;
-        case 'r':
+        case 'E':
             if (!strcmp(optarg, "stop")) {
                 err = NC_RPC_EDIT_ERROPT_STOP;
             } else if (!strcmp(optarg, "continue")) {
@@ -3482,6 +3525,13 @@

             content = strdup(optarg);
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_editconfig_help();
@@ -3534,7 +3584,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -3547,7 +3597,7 @@
 int
 cmd_get(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0;
+    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *filter = NULL, *config_m = NULL;
     struct nc_rpc *rpc;
@@ -3560,6 +3610,7 @@
             {"filter-xpath", 1, 0, 'x'},
             {"defaults", 1, 0, 'd'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3572,7 +3623,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hs::x:d:o:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hs::x:d:o:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_get_help();
@@ -3653,6 +3704,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_get_help();
@@ -3694,9 +3752,9 @@
     }

     if (output) {
-        ret = cli_send_recv(rpc, output, wd);
+        ret = cli_send_recv(rpc, output, wd, timeout);
     } else {
-        ret = cli_send_recv(rpc, stdout, wd);
+        ret = cli_send_recv(rpc, stdout, wd, timeout);
     }

     nc_rpc_free(rpc);
@@ -3713,7 +3771,7 @@
 int
 cmd_getconfig(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0;
+    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *filter = NULL, *config_m = NULL;
     struct nc_rpc *rpc;
@@ -3728,6 +3786,7 @@
             {"filter-xpath", 1, 0, 'x'},
             {"defaults", 1, 0, 'd'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3740,7 +3799,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hu:s::x:d:o:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hu:s::x:d:o:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_getconfig_help();
@@ -3833,6 +3892,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_getconfig_help();
@@ -3880,9 +3946,9 @@
     }

     if (output) {
-        ret = cli_send_recv(rpc, output, wd);
+        ret = cli_send_recv(rpc, output, wd, timeout);
     } else {
-        ret = cli_send_recv(rpc, stdout, wd);
+        ret = cli_send_recv(rpc, stdout, wd, timeout);
     }

     nc_rpc_free(rpc);
@@ -3900,12 +3966,13 @@
 cmd_killsession(const char *arg, char **UNUSED(tmp_config_file))
 {
     struct nc_rpc *rpc;
-    int c, ret;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     uint32_t sid = 0;
     struct arglist cmd;
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
             {"sid", 1, 0, 's'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -3919,75 +3986,82 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hs:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hs:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_killsession_help();
-            clear_arglist(&cmd);
-            return EXIT_SUCCESS;
+            ret = EXIT_SUCCESS;
+            goto fail;
         case 's':
             sid = atoi(optarg);
+            break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
             break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_killsession_help();
-            clear_arglist(&cmd);
-            return EXIT_FAILURE;
+            goto fail;
         }
     }

     if (cmd.list[optind]) {
         ERROR(__func__, "Unparsed command arguments.");
         cmd_killsession_help();
-        clear_arglist(&cmd);
-        return EXIT_FAILURE;
-    }
-
-    clear_arglist(&cmd);
+        goto fail;
+    }

     if (!sid) {
         ERROR(__func__, "Mandatory command arguments missing.");
         cmd_killsession_help();
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!session) {
         ERROR(__func__, "Not connected to a NETCONF server, no RPCs can be sent.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!interleave) {
         ERROR(__func__, "NETCONF server does not support interleaving RPCs and notifications.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!sid) {
         ERROR(__func__, "Session ID was not specififed or not a number.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     rpc = nc_rpc_kill(sid);
     if (!rpc) {
         ERROR(__func__, "RPC creation failed.");
-        return EXIT_FAILURE;
-    }
-
-    ret = cli_send_recv(rpc, stdout, 0);
+        goto fail;
+    }
+
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);
+
+fail:
+    clear_arglist(&cmd);
     return ret;
 }

 int
 cmd_lock(const char *arg, char **UNUSED(tmp_config_file))
 {
-    int c, ret;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct nc_rpc *rpc;
     NC_DATASTORE target = NC_DATASTORE_ERROR;;
     struct arglist cmd;
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
             {"target", 1, 0, 't'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4000,12 +4074,12 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_lock_help();
-            clear_arglist(&cmd);
-            return EXIT_SUCCESS;
+            ret = EXIT_SUCCESS;
+            goto fail;
         case 't':
             if (!strcmp(optarg, "running")) {
                 target = NC_DATASTORE_RUNNING;
@@ -4015,66 +4089,72 @@
                 target = NC_DATASTORE_CANDIDATE;
             } else {
                 ERROR(__func__, "Invalid source datastore specified (%s).", optarg);
-                clear_arglist(&cmd);
-                return EXIT_FAILURE;
+                goto fail;
+            }
+            break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
             }
             break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_lock_help();
-            clear_arglist(&cmd);
-            return EXIT_FAILURE;
+            goto fail;
         }
     }

     if (cmd.list[optind]) {
         ERROR(__func__, "Unparsed command arguments.");
         cmd_lock_help();
-        clear_arglist(&cmd);
-        return EXIT_FAILURE;
-    }
-
-    clear_arglist(&cmd);
+        goto fail;
+    }

     if (!target) {
         ERROR(__func__, "Mandatory command arguments missing.");
         cmd_lock_help();
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!session) {
         ERROR(__func__, "Not connected to a NETCONF server, no RPCs can be sent.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!interleave) {
         ERROR(__func__, "NETCONF server does not support interleaving RPCs and notifications.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     /* create requests */
     rpc = nc_rpc_lock(target);
     if (!rpc) {
         ERROR(__func__, "RPC creation failed.");
-        return EXIT_FAILURE;
-    }
-
-    ret = cli_send_recv(rpc, stdout, 0);
+        goto fail;
+    }
+
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);
+
+fail:
+    clear_arglist(&cmd);
     return ret;
 }

 int
 cmd_unlock(const char *arg, char **UNUSED(tmp_config_file))
 {
-    int c, ret;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct nc_rpc *rpc;
     NC_DATASTORE target = NC_DATASTORE_ERROR;;
     struct arglist cmd;
     struct option long_options[] = {
             {"help", 0, 0, 'h'},
             {"target", 1, 0, 't'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4087,12 +4167,12 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_unlock_help();
-            clear_arglist(&cmd);
-            return EXIT_SUCCESS;
+            ret = EXIT_SUCCESS;
+            goto fail;
         case 't':
             if (!strcmp(optarg, "running")) {
                 target = NC_DATASTORE_RUNNING;
@@ -4102,60 +4182,65 @@
                 target = NC_DATASTORE_CANDIDATE;
             } else {
                 ERROR(__func__, "Invalid source datastore specified (%s).", optarg);
-                clear_arglist(&cmd);
-                return EXIT_FAILURE;
+                goto fail;
+            }
+            break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
             }
             break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_unlock_help();
-            clear_arglist(&cmd);
-            return EXIT_FAILURE;
+            goto fail;
         }
     }

     if (cmd.list[optind]) {
         ERROR(__func__, "Unparsed command arguments.");
         cmd_unlock_help();
-        clear_arglist(&cmd);
-        return EXIT_FAILURE;
-    }
-
-    clear_arglist(&cmd);
+        goto fail;
+    }

     if (!target) {
         ERROR(__func__, "Mandatory command arguments missing.");
         cmd_unlock_help();
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!session) {
         ERROR(__func__, "Not connected to a NETCONF server, no RPCs can be sent.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     if (!interleave) {
         ERROR(__func__, "NETCONF server does not support interleaving RPCs and notifications.");
-        return EXIT_FAILURE;
+        goto fail;
     }

     /* create requests */
     rpc = nc_rpc_unlock(target);
     if (!rpc) {
         ERROR(__func__, "RPC creation failed.");
-        return EXIT_FAILURE;
-    }
-
-    ret = cli_send_recv(rpc, stdout, 0);
+        goto fail;
+    }
+
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);
+
+fail:
+    clear_arglist(&cmd);
     return ret;
 }

 int
 cmd_validate(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE;
+    int c, config_fd, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *src = NULL, *config_m = NULL, *src_start;
     NC_DATASTORE source = NC_DATASTORE_ERROR;
@@ -4165,6 +4250,7 @@
             {"help", 0, 0, 'h'},
             {"source", 1, 0, 's'},
             {"src-config", 2, 0, 'c'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4177,7 +4263,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hs:c::", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hs:c::r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_validate_help();
@@ -4243,6 +4329,13 @@
                 close(config_fd);
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_validate_help();
@@ -4300,7 +4393,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -4313,7 +4406,7 @@
 int
 cmd_subscribe(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0;
+    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *filter = NULL, *config_m = NULL, *start = NULL, *stop = NULL;
     const char *stream = NULL;
@@ -4329,6 +4422,7 @@
             {"end", 1, 0, 'e'},
             {"stream", 1, 0, 't'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4341,7 +4435,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hs::x:b:e:t:o:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hs::x:b:e:t:o:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_subscribe_help();
@@ -4431,6 +4525,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_subscribe_help();
@@ -4471,7 +4572,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);
     nc_rpc_free(rpc);

     if (ret) {
@@ -4513,7 +4614,7 @@
 int
 cmd_getschema(const char *arg, char **UNUSED(tmp_config_file))
 {
-    int c, ret = EXIT_FAILURE;
+    int c, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     const char *model = NULL, *version = NULL, *format = NULL;
     struct nc_rpc *rpc;
     FILE *output = NULL;
@@ -4524,6 +4625,7 @@
             {"version", 1, 0, 'v'},
             {"format", 1, 0, 'f'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4536,7 +4638,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hm:v:f:o:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hm:v:f:o:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_getschema_help();
@@ -4563,6 +4665,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_getschema_help();
@@ -4599,9 +4708,9 @@
     }

     if (output) {
-        ret = cli_send_recv(rpc, output, 0);
+        ret = cli_send_recv(rpc, output, 0, timeout);
     } else {
-        ret = cli_send_recv(rpc, stdout, 0);
+        ret = cli_send_recv(rpc, stdout, 0, timeout);
     }

     nc_rpc_free(rpc);
@@ -4617,7 +4726,8 @@
 int
 cmd_getdata(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, filter_param = 0, origin_count = 0, negated_origin = 0, depth = 0, with_origin = 0;
+    int c, config_fd, ret = EXIT_FAILURE;
+    int filter_param = 0, origin_count = 0, negated_origin = 0, depth = 0, with_origin = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *filter = NULL, *config_m = NULL, *datastore = NULL, *config = NULL, **origin = NULL, *ptr;
     struct nc_rpc *rpc;
@@ -4630,12 +4740,13 @@
             {"filter-subtree", 2, 0, 's'},
             {"filter-xpath", 1, 0, 'x'},
             {"config", 1, 0, 'c'},
-            {"origin", 1, 0, 'r'},
+            {"origin", 1, 0, 'O'},
             {"negated-origin", 0, 0, 'n'},
             {"depth", 1, 0, 'e'},
             {"with-origin", 0, 0, 'w'},
             {"defaults", 1, 0, 'f'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4648,7 +4759,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hd:s::x:c:r:ne:wf:o:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hd:s::x:c:O:ne:wf:o:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_getconfig_help();
@@ -4735,7 +4846,7 @@
                 goto fail;
             }
             break;
-        case 'r':
+        case 'O':
             origin = realloc(origin, (origin_count + 1) * sizeof *origin);
             asprintf(&origin[origin_count], "ietf-origin:%s", optarg);
             ++origin_count;
@@ -4779,6 +4890,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_getconfig_help();
@@ -4827,9 +4945,9 @@
     }

     if (output) {
-        ret = cli_send_recv(rpc, output, wd);
+        ret = cli_send_recv(rpc, output, wd, timeout);
     } else {
-        ret = cli_send_recv(rpc, stdout, wd);
+        ret = cli_send_recv(rpc, stdout, wd, timeout);
     }

     nc_rpc_free(rpc);
@@ -4850,7 +4968,7 @@
 int
 cmd_editdata(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE, content_param = 0;
+    int c, config_fd, ret = EXIT_FAILURE, content_param = 0, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *content = NULL, *config_m = NULL, *cont_start, *datastore = NULL;
     struct nc_rpc *rpc;
@@ -4862,6 +4980,7 @@
             {"defop", 1, 0, 'o'},
             {"config", 2, 0, 'c'},
             {"url", 1, 0, 'u'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -4874,7 +4993,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "hd:o:c::u:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "hd:o:c::u:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_editconfig_help();
@@ -4960,6 +5079,13 @@

             content = strdup(optarg);
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_editconfig_help();
@@ -5012,7 +5138,7 @@
         goto fail;
     }

-    ret = cli_send_recv(rpc, stdout, 0);
+    ret = cli_send_recv(rpc, stdout, 0, timeout);

     nc_rpc_free(rpc);

@@ -5025,7 +5151,7 @@
 int
 cmd_userrpc(const char *arg, char **tmp_config_file)
 {
-    int c, config_fd, ret = EXIT_FAILURE;
+    int c, config_fd, ret = EXIT_FAILURE, timeout = CLI_RPC_REPLY_TIMEOUT;
     struct stat config_stat;
     char *content = NULL, *config_m = NULL;
     struct nc_rpc *rpc;
@@ -5035,6 +5161,7 @@
             {"help", 0, 0, 'h'},
             {"content", 1, 0, 'c'},
             {"out", 1, 0, 'o'},
+            {"rpc-timeout", 1, 0, 'r'},
             {0, 0, 0, 0}
     };
     int option_index = 0;
@@ -5047,7 +5174,7 @@
         return EXIT_FAILURE;
     }

-    while ((c = getopt_long(cmd.count, cmd.list, "ht:s:c::d:", long_options, &option_index)) != -1) {
+    while ((c = getopt_long(cmd.count, cmd.list, "ht:s:c::d:r:", long_options, &option_index)) != -1) {
         switch (c) {
         case 'h':
             cmd_userrpc_help();
@@ -5098,6 +5225,13 @@
                 goto fail;
             }
             break;
+        case 'r':
+            timeout = atoi(optarg);
+            if (!timeout) {
+                ERROR(__func__, "Invalid timeout \"%s\".", optarg);
+                goto fail;
+            }
+            break;
         default:
             ERROR(__func__, "Unknown option -%c.", c);
             cmd_userrpc_help();
@@ -5139,9 +5273,9 @@
     }

     if (output) {
-        ret = cli_send_recv(rpc, output, 0);
+        ret = cli_send_recv(rpc, output, 0, timeout);
     } else {
-        ret = cli_send_recv(rpc, stdout, 0);
+        ret = cli_send_recv(rpc, stdout, 0, timeout);
     }

     nc_rpc_free(rpc);


[Typography] Annotate mdc_adjustsFontForContentSizeCategory as to-be-deprecated. (#7619)

Pre work for https://github.com/material-components/material-components-ios/issues/7618

--- components/schemes/Typography/src/MDCTypographyScheme.h
+++ components/schemes/Typography/src/MDCTypographyScheme.h
@@ -178,7 +178,9 @@
  */
 - (nonnull instancetype)initWithDefaults:(MDCTypographySchemeDefaults)defaults;

-#pragma mark - To be deprecated
+@end
+
+@interface MDCTypographyScheme (ToBeDeprecated)

 /**
  @warning Will eventually be deprecated and removed. Please use


Add  another Quantum's LTO 6 into the list (#259)

--- src/tape_drivers/quantum_tape.c
+++ src/tape_drivers/quantum_tape.c
@@ -68,6 +68,7 @@
 	TAPEDRIVE( QUANTUM_VENDOR_ID, "ULTRIUM-HH7",  DRIVE_LTO7_HH, "[ULTRIUM-HH7]" ),  /* QUANTUM Ultrium Gen 7 Half-High */
 	TAPEDRIVE( QUANTUM_VENDOR_ID, "ULTRIUM-HH8",  DRIVE_LTO8_HH, "[ULTRIUM-HH8]" ),  /* QUANTUM Ultrium Gen 8 Half-High */
 	TAPEDRIVE( QUANTUM_VENDOR_ID, "ULTRIUM 5",    DRIVE_LTO5_HH, "[ULTRIUM-5]" ),    /* Another QUANTUM Ultrium Gen 5 Half-High */
+	TAPEDRIVE( QUANTUM_VENDOR_ID, "ULTRIUM 6",    DRIVE_LTO5_HH, "[ULTRIUM-6]" ),    /* Another QUANTUM Ultrium Gen 5 Half-High */
 	/* End of supported_devices */
 	NULL
 };


Extend the possible alignments of the 'AlignedStorage' to 128 and 256 bit

--- blaze/util/AlignedStorage.h
+++ blaze/util/AlignedStorage.h
@@ -131,6 +131,30 @@
 */
 template<>
 struct BLAZE_ALIGN( 64UL ) AlignedStorageHelper<64UL>
+{};
+/*! \endcond */
+//*************************************************************************************************
+
+
+//*************************************************************************************************
+/*! \cond BLAZE_INTERNAL */
+/*!\brief Specialization of AlignedStorage for 128-byte alignment.
+// \ingroup intrinsics
+*/
+template<>
+struct BLAZE_ALIGN( 128UL ) AlignedStorageHelper<128UL>
+{};
+/*! \endcond */
+//*************************************************************************************************
+
+
+//*************************************************************************************************
+/*! \cond BLAZE_INTERNAL */
+/*!\brief Specialization of AlignedStorage for 256-byte alignment.
+// \ingroup intrinsics
+*/
+template<>
+struct BLAZE_ALIGN( 256UL ) AlignedStorageHelper<256UL>
 {};
 /*! \endcond */
 //*************************************************************************************************
@@ -158,6 +182,12 @@
       T v_[N];
    };
    \endcode
+
+// Note that since AlignedStorage is designed as a base class proper alignment is depending on
+// the compiler's capacity to perform an empty base class optimization (EBO) and to transfer the
+// base class's alignment restriction to the deriving class. Currently, the only observed problem
+// in this context is that the Clang 4.1 compiler omits this optimization for optimization level
+// below \c -O2.
 */
 template< typename T >
 class AlignedStorage : private AlignedStorageHelper< AlignmentTrait<T>::value >


Updated libpq 7.3 sample header as well.

git-svn-id: 27238e37a5eae711b76ec703b45445819ea9563e@1671 c3353b84-d008-0410-9ed9-b55c4f7fa7e8

--- config/sample-headers/libpq/7.3/config-internal-libpq.h
+++ config/sample-headers/libpq/7.3/config-internal-libpq.h
@@ -22,3 +22,4 @@
 /* #undef PQXX_HAVE_PQSERVERVERSION */
 /* #undef PQXX_HAVE_PQSETERRORVERBOSITY */
 /* #undef PQXX_HAVE_PQUNESCAPEBYTEA */
+/* #undef PQXX_HAVE_PQUNESCAPEBYTEA_9 */


TODO-1033

--- content/OTRadioLink/utility/OTSIM900Link_OTSIM900Link.h
+++ content/OTRadioLink/utility/OTSIM900Link_OTSIM900Link.h
@@ -95,7 +95,7 @@
  */
 // If config is stored in SRAM...
 #define OTSIM900LinkConfig_DEFINED
-typedef struct OTSIM900LinkConfig {
+typedef struct OTSIM900LinkConfig final {
 //private:
     // Is in eeprom?
     const bool bEEPROM;


Add Destroy action for PlatformWindow

Add Destroy action for PlatformWindow

--- ImWindow/ImwWindowManager.h
+++ ImWindow/ImwWindowManager.h
@@ -34,10 +34,11 @@

 		enum EPlatformWindowAction
 		{
-			E_PLATFORM_WINDOW_ACTION_SHOW			= 1,
-			E_PLATFORM_WINDOW_ACTION_HIDE			= 2,
-			E_PLATFORM_WINDOW_ACTION_SET_POSITION	= 4,
-			E_PLATFORM_WINDOW_ACTION_SET_SIZE		= 8,
+			E_PLATFORM_WINDOW_ACTION_DESTOY			= 1,
+			E_PLATFORM_WINDOW_ACTION_SHOW			= 2,
+			E_PLATFORM_WINDOW_ACTION_HIDE			= 4,
+			E_PLATFORM_WINDOW_ACTION_SET_POSITION	= 8,
+			E_PLATFORM_WINDOW_ACTION_SET_SIZE		= 16,
 		};

 		struct PlatformWindowAction


Disable 3pX4 kernel on Altivec: despite this platform has 32 registers, this version seems significantly slower.

--- Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -188,7 +188,7 @@
     nr = 4,

     // register block size along the M direction (currently, this one cannot be modified)
-#ifdef EIGEN_HAS_FUSED_MADD
+#if defined(EIGEN_HAS_FUSED_MADD) && !defined(EIGEN_VECTORIZE_ALTIVEC)
     // we assume 16 registers
     mr = 3*LhsPacketSize,
 #else
@@ -296,7 +296,7 @@

     NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS,
     nr = 4,
-#ifdef EIGEN_HAS_FUSED_MADD
+#if defined(EIGEN_HAS_FUSED_MADD) && !defined(EIGEN_VECTORIZE_ALTIVEC)
     // we assume 16 registers
     mr = 3*LhsPacketSize,
 #else
@@ -759,29 +759,29 @@
           for(Index k=0; k<peeled_kc; k+=pk)
           {
             EIGEN_ASM_COMMENT("begin gegp micro kernel 3p x 4");
-            RhsPacket B_0;
+            RhsPacket B_0, T0;
             LhsPacket A2;
-
+
 #define EIGEN_GEBGP_ONESTEP(K) \
             internal::prefetch(blA+(3*K+16)*LhsProgress); \
             traits.loadLhs(&blA[(0+3*K)*LhsProgress], A0);  \
             traits.loadLhs(&blA[(1+3*K)*LhsProgress], A1);  \
             traits.loadLhs(&blA[(2+3*K)*LhsProgress], A2);  \
             traits.loadRhs(&blB[(0+4*K)*RhsProgress], B_0); \
-            traits.madd(A0, B_0, C0, B_0); \
-            traits.madd(A1, B_0, C4, B_0); \
+            traits.madd(A0, B_0, C0, T0); \
+            traits.madd(A1, B_0, C4, T0); \
             traits.madd(A2, B_0, C8, B_0); \
             traits.loadRhs(&blB[1+4*K*RhsProgress], B_0); \
-            traits.madd(A0, B_0, C1, B_0); \
-            traits.madd(A1, B_0, C5, B_0); \
+            traits.madd(A0, B_0, C1, T0); \
+            traits.madd(A1, B_0, C5, T0); \
             traits.madd(A2, B_0, C9, B_0); \
             traits.loadRhs(&blB[2+4*K*RhsProgress], B_0); \
-            traits.madd(A0, B_0, C2,  B_0); \
-            traits.madd(A1, B_0, C6,  B_0); \
+            traits.madd(A0, B_0, C2,  T0); \
+            traits.madd(A1, B_0, C6,  T0); \
             traits.madd(A2, B_0, C10, B_0); \
             traits.loadRhs(&blB[3+4*K*RhsProgress], B_0); \
-            traits.madd(A0, B_0, C3 , B_0); \
-            traits.madd(A1, B_0, C7,  B_0); \
+            traits.madd(A0, B_0, C3 , T0); \
+            traits.madd(A1, B_0, C7,  T0); \
             traits.madd(A2, B_0, C11, B_0)

             internal::prefetch(blB+(48+0));
@@ -802,7 +802,7 @@
           // process remaining peeled loop
           for(Index k=peeled_kc; k<depth; k++)
           {
-            RhsPacket B_0;
+            RhsPacket B_0, T0;
             LhsPacket A2;
             EIGEN_GEBGP_ONESTEP(0);
             blB += 4*RhsProgress;


Fix asm comments in 1px1 kernel

Fix asm comments in 1px1 kernel

--- Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -1481,17 +1481,17 @@

           for(Index k=0; k<peeled_kc; k+=pk)
           {
-            EIGEN_ASM_COMMENT("begin gebp micro kernel 2pX1");
+            EIGEN_ASM_COMMENT("begin gebp micro kernel 1pX1");
             RhsPacket B_0;

 #define EIGEN_GEBGP_ONESTEP(K) \
             do {                                                                \
-              EIGEN_ASM_COMMENT("begin step of gebp micro kernel 2pX1");        \
+              EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX1");        \
               EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \
               traits.loadLhs(&blA[(0+1*K)*LhsProgress], A0);                    \
               traits.loadRhs(&blB[(0+K)*RhsProgress], B_0);                     \
               traits.madd(A0, B_0, C0, B_0);                                    \
-              EIGEN_ASM_COMMENT("end step of gebp micro kernel 2pX1");          \
+              EIGEN_ASM_COMMENT("end step of gebp micro kernel 1pX1");          \
             } while(false);

             EIGEN_GEBGP_ONESTEP(0);
@@ -1506,7 +1506,7 @@
             blB += pk*RhsProgress;
             blA += pk*1*Traits::LhsProgress;

-            EIGEN_ASM_COMMENT("end gebp micro kernel 2pX1");
+            EIGEN_ASM_COMMENT("end gebp micro kernel 1pX1");
           }

           // process remaining peeled loop


어제 mmap 관련 코드 고친거 버그 수정

어제 mmap 관련 코드 고친거 버그 수정

--- modules/mod_sfs/mod_sfs.c
+++ modules/mod_sfs/mod_sfs.c
@@ -724,9 +724,10 @@
 		// HP-UX    2̻ mmap ϰ Ǹ   ִ.
 		// super_block  base_ptr    sizeof(super_block_t) byte ϱ
 		// ̷ .
+		int sfs_size = sfs->super_block->size;
 		if ( unmmap_memory(sfs->super_block, sizeof(super_block_t)) != SUCCESS )
 			warn("unmmap failed. but continue...");
-		sfs->base_ptr = (char*)get_shared_memory(sfs->seq, sfs->fd, sfs->base_offset, sfs->super_block->size);
+		sfs->base_ptr = (char*)get_shared_memory(sfs->seq, sfs->fd, sfs->base_offset, sfs_size);
 		sfs->super_block = (super_block_t*) sfs->base_ptr;

 		if(sfs->base_ptr == NULL) {


Factorized out conversion of return code

--- ngx_http_upload_module.c
+++ ngx_http_upload_module.c
@@ -1947,110 +1947,8 @@
     }
 } /* }}} */

-static ngx_int_t /* {{{ ngx_http_do_read_upload_client_request_body */
-ngx_http_do_read_upload_client_request_body(ngx_http_request_t *r)
-{
-    size_t                     size;
-    ssize_t                    n;
-    ngx_connection_t          *c;
-    ngx_http_request_body_t   *rb;
-    ngx_http_core_loc_conf_t  *clcf;
-    ngx_http_upload_ctx_t     *u = ngx_http_get_module_ctx(r, ngx_http_upload_module);
-    ngx_int_t                  rc;
-
-    c = r->connection;
-    rb = r->request_body;
-
-    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http read client request body");
-
-    for ( ;; ) {
-        for ( ;; ) {
-            if (rb->buf->last == rb->buf->end) {
-
-                rc = ngx_http_process_request_body(r, rb->to_write);
-
-                switch(rc) {
-                    case NGX_OK:
-                        break;
-                    case NGX_UPLOAD_MALFORMED:
-                        return NGX_HTTP_BAD_REQUEST;
-                    case NGX_UPLOAD_TOOLARGE:
-                        return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
-                    case NGX_UPLOAD_IOERROR:
-                        return NGX_HTTP_SERVICE_UNAVAILABLE;
-                    case NGX_UPLOAD_NOMEM: case NGX_UPLOAD_SCRIPTERROR:
-                    default:
-                        return NGX_HTTP_INTERNAL_SERVER_ERROR;
-                }
-
-                rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs;
-                rb->buf->last = rb->buf->start;
-            }
-
-            size = rb->buf->end - rb->buf->last;
-
-            if ((off_t)size > rb->rest) {
-                size = (size_t)rb->rest;
-            }
-
-            n = c->recv(c, rb->buf->last, size);
-
-            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                           "http client request body recv %z", n);
-
-            if (n == NGX_AGAIN) {
-                break;
-            }
-
-            if (n == 0) {
-                ngx_log_error(NGX_LOG_INFO, c->log, 0,
-                              "client closed prematurely connection");
-            }
-
-            if (n == 0 || n == NGX_ERROR) {
-                c->error = 1;
-                return NGX_HTTP_BAD_REQUEST;
-            }
-
-            rb->buf->last += n;
-            rb->rest -= n;
-            r->request_length += n;
-
-            if (rb->rest == 0) {
-                break;
-            }
-
-            if (rb->buf->last < rb->buf->end) {
-                break;
-            }
-        }
-
-        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                       "http client request body rest %uz", rb->rest);
-
-        if (rb->rest == 0) {
-            break;
-        }
-
-        if (!c->read->ready) {
-            clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-            ngx_add_timer(c->read, clcf->client_body_timeout);
-
-            if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
-                return NGX_HTTP_INTERNAL_SERVER_ERROR;
-            }
-
-            return NGX_AGAIN;
-        }
-    }
-
-    if (c->read->timer_set) {
-        ngx_del_timer(c->read);
-    }
-
-    rc = ngx_http_process_request_body(r, rb->to_write);
-
+static ngx_int_t
+ngx_http_upload_return_code(ngx_http_request_t *r, ngx_int_t rc) {
     switch(rc) {
         case NGX_OK:
             break;
@@ -2063,6 +1961,109 @@
         case NGX_UPLOAD_NOMEM: case NGX_UPLOAD_SCRIPTERROR:
         default:
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
+    }
+
+    return NGX_OK;
+}
+
+static ngx_int_t /* {{{ ngx_http_do_read_upload_client_request_body */
+ngx_http_do_read_upload_client_request_body(ngx_http_request_t *r)
+{
+    size_t                     size;
+    ssize_t                    n;
+    ngx_connection_t          *c;
+    ngx_http_request_body_t   *rb;
+    ngx_http_core_loc_conf_t  *clcf;
+    ngx_http_upload_ctx_t     *u = ngx_http_get_module_ctx(r, ngx_http_upload_module);
+    ngx_int_t                  rc;
+
+    c = r->connection;
+    rb = r->request_body;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
+                   "http read client request body");
+
+    for ( ;; ) {
+        for ( ;; ) {
+            if (rb->buf->last == rb->buf->end) {
+
+                rc = ngx_http_upload_return_code(r,
+                    ngx_http_process_request_body(r, rb->to_write));
+
+                if(rc != NGX_OK) {
+                    return rc;
+                }
+
+                rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs;
+                rb->buf->last = rb->buf->start;
+            }
+
+            size = rb->buf->end - rb->buf->last;
+
+            if ((off_t)size > rb->rest) {
+                size = (size_t)rb->rest;
+            }
+
+            n = c->recv(c, rb->buf->last, size);
+
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
+                           "http client request body recv %z", n);
+
+            if (n == NGX_AGAIN) {
+                break;
+            }
+
+            if (n == 0) {
+                ngx_log_error(NGX_LOG_INFO, c->log, 0,
+                              "client closed prematurely connection");
+            }
+
+            if (n == 0 || n == NGX_ERROR) {
+                c->error = 1;
+                return NGX_HTTP_BAD_REQUEST;
+            }
+
+            rb->buf->last += n;
+            rb->rest -= n;
+            r->request_length += n;
+
+            if (rb->rest == 0) {
+                break;
+            }
+
+            if (rb->buf->last < rb->buf->end) {
+                break;
+            }
+        }
+
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
+                       "http client request body rest %uz", rb->rest);
+
+        if (rb->rest == 0) {
+            break;
+        }
+
+        if (!c->read->ready) {
+            clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+            ngx_add_timer(c->read, clcf->client_body_timeout);
+
+            if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
+                return NGX_HTTP_INTERNAL_SERVER_ERROR;
+            }
+
+            return NGX_AGAIN;
+        }
+    }
+
+    if (c->read->timer_set) {
+        ngx_del_timer(c->read);
+    }
+
+    rc = ngx_http_upload_return_code(r,
+        ngx_http_process_request_body(r, rb->to_write));
+
+    if(rc != NGX_OK) {
+        return rc;
     }

     upload_shutdown_ctx(u);


Fix -Wundef warning under Ubuntu 14.04

Fix -Wundef warning under Ubuntu 14.04

--- cl_platform.h
+++ cl_platform.h
@@ -115,7 +115,7 @@
             #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED __attribute__((deprecated))
             #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
          #endif
-    #elif _WIN32
+    #elif defined(_WIN32)
         #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
             #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
             #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED


move debug print (and dereference of resp) inside null check

--- pam_yubico.c
+++ pam_yubico.c
@@ -382,9 +382,9 @@
     return retval;
   }

-  D(("conv returned: '%s'", resp->resp));
   if (resp)
     {
+      D(("conv returned: '%s'", resp->resp));
       if (resp->resp)
         free (resp->resp);
       free (resp);


packetizer: flac: apply demux pts offset to absolute offset

ref #14972
ref #10328

--- modules/packetizer/flac.c
+++ modules/packetizer/flac.c
@@ -84,6 +84,8 @@
      * Common properties
      */
     mtime_t i_pts;
+    mtime_t i_firstpts;
+    mtime_t i_firstframepts;
     mtime_t i_duration;

     int i_frame_length;
@@ -490,11 +492,18 @@

     if( pi_pts )
     {
+        /* Compute from frame absolute time */
         *pi_pts = VLC_TS_0;
         if ( (p_buf[1] & 0x01) == 0  ) /* Fixed blocksize stream / Frames */
             *pi_pts += CLOCK_FREQ * blocksize * i_fsnumber / samplerate;
         else /* Variable blocksize stream / Samples */
             *pi_pts += CLOCK_FREQ * i_fsnumber / samplerate;
+
+        if( p_sys->i_firstframepts == VLC_TS_INVALID )
+            p_sys->i_firstframepts = *pi_pts;
+
+        if( p_sys->i_firstpts > VLC_TS_INVALID )
+            *pi_pts += (p_sys->i_firstpts - p_sys->i_firstframepts);
     }

     if ( pi_duration )
@@ -546,6 +555,10 @@
             return NULL;
         }
         p_sys->i_rate = p_dec->fmt_out.audio.i_rate;
+    }
+    else if( in && p_sys->i_firstpts == VLC_TS_INVALID )
+    {
+         p_sys->i_firstpts = in->i_pts;
     }

     if ( in )
@@ -756,6 +769,8 @@

     p_sys->i_state       = STATE_NOSYNC;
     p_sys->b_stream_info = false;
+    p_sys->i_firstpts    = VLC_TS_INVALID;
+    p_sys->i_firstframepts   = VLC_TS_INVALID;
     p_sys->i_pts         = VLC_TS_INVALID;
     p_sys->i_buf         = 0;
     p_sys->p_buf         = NULL;


comment out debug info about get defualt puls sink, this resolves #337

--- input/pulse.c
+++ input/pulse.c
@@ -53,7 +53,7 @@
         exit(EXIT_FAILURE);
         break;
     case PA_CONTEXT_TERMINATED:
-        printf("TERMINATED\n");
+        //printf("TERMINATED\n");
         pa_mainloop_quit(m_pulseaudio_mainloop, 0);
         break;
     }


Fix a thread cache stats merging bug.

Fix a thread cache stats merging bug.

When a thread cache flushes objects to their arenas due to an abundance
of cached objects, it merges the allocation request count for the
associated size class, and increments a flush counter.  If none of the
flushed objects came from the thread's assigned arena, then the merging
wouldn't happen (though the counter would typically eventually be
merged), nor would the flush counter be incremented (a hard bug).  Fix
this via extra conditional code just after the flush loop.

--- jemalloc/src/tcache.c
+++ jemalloc/src/tcache.c
@@ -58,6 +58,9 @@
 	void *flush, *deferred, *ptr;
 	unsigned i, nflush, ndeferred;
 	bool first_pass;
+#ifdef JEMALLOC_STATS
+	bool merged_stats = false;
+#endif

 	assert(binind < nbins);
 	assert(rem <= tbin->ncached);
@@ -82,6 +85,8 @@
 		malloc_mutex_lock(&bin->lock);
 #ifdef JEMALLOC_STATS
 		if (arena == tcache->arena) {
+			assert(merged_stats == false);
+			merged_stats = true;
 			bin->stats.nflushes++;
 			bin->stats.nrequests += tbin->tstats.nrequests;
 			tbin->tstats.nrequests = 0;
@@ -119,6 +124,20 @@
 			first_pass = false;
 		}
 	}
+#ifdef JEMALLOC_STATS
+	if (merged_stats == false) {
+		/*
+		 * The flush loop didn't happen to flush to this thread's
+		 * arena, so the stats didn't get merged.  Manually do so now.
+		 */
+		arena_bin_t *bin = &tcache->arena->bins[binind];
+		malloc_mutex_lock(&bin->lock);
+		bin->stats.nflushes++;
+		bin->stats.nrequests += tbin->tstats.nrequests;
+		tbin->tstats.nrequests = 0;
+		malloc_mutex_unlock(&bin->lock);
+	}
+#endif

 	tbin->ncached = rem;
 	if (tbin->ncached < tbin->low_water)


debug

debug

--- integration.c
+++ integration.c
@@ -13,7 +13,7 @@
 static const int turn_power = 60;//turnするpower
 static const double target_latitude = 35.716956;//ido
 static const double target_longitude = 139.759936;//keido
-static const double PI = 3.14159265;
+static const double PI = 3.14159265359;
 static const double EARTH_RADIUS = 6378137;
 static const int gps_latency = 1500;//gps角度取得のための時間感覚
 time_t start_time;//開始時刻のグローバル変数宣言
@@ -126,7 +126,7 @@
     {
         delta_angle_cld = -360.0 + gps_angle_cld - going_angle_cld;
     }
-
+
     return delta_angle_cld;
 }
 /*


Update iothub_client_amqp_internal.h

Update iothub_client_amqp_internal.h

Inside the message sent to the CBS endpoint, there is a different token type if compared with C# implementation.
The C client uses "servicebus.windows.net:sastoken" as like all Service Bus services (queues, topics/subscriptions and event hubs).
The C# client uses "azure-devices.net:sastoken".
The two clients work fine (why?) but I think that the right token type should be "azure-devices.net:sastoken" for both.

--- c/iothub_client/inc/iothub_client_amqp_internal.h
+++ c/iothub_client/inc/iothub_client_amqp_internal.h
@@ -19,7 +19,7 @@
 #define PROTON_MAP_OPERATIONS_KEY "operation"
 #define PROTON_MAP_PUT_TOKEN_OPERATION "put-token"
 #define PROTON_MAP_TYPE_KEY "type"
-#define PROTON_MAP_TOKEN_TYPE "servicebus.windows.net:sastoken"
+#define PROTON_MAP_TOKEN_TYPE "azure-devices.net:sastoken"
 #define PROTON_MAP_NAME_KEY "name"
 #define PROTON_MAP_STATUS_CODE "status-code"
 #define PROTON_MAP_STATUS_DESCRIPTION "status-description"


Synced the Carbon installer with the Cocoa one in terms of strings

--HG--
extra : convert_revision : svn%3A99687598-2e92-11dd-8019-fe7b9d601d1b/trunk%403788

--- Framework/Source/GrowlInstallationPrompt-Carbon.c
+++ Framework/Source/GrowlInstallationPrompt-Carbon.c
@@ -380,12 +380,12 @@
 		if (message) message = CFRetain(message);
 		else {
 			if (isUpdate) {
-				message = CFCopyLocalizedStringFromTableInBundle(CFSTR("This program displays information via Growl, a centralized notification system.  A version of Growl is currently installed, but this program includes an updated version of Growl.  It is strongly recommended that you update now.  No download is required."),
+				message = CFCopyLocalizedStringFromTableInBundle(CFSTR("This program displays information via Growl, a centralized notification system that enables applications to unobtrusively inform the user about potentially important information.  A version of Growl is currently installed, but this program includes an updated version of Growl.  It is strongly recommended that you update now.  No download is required."),
 																 CFSTR("GrowlInstallation"),
 																 bundle,
 																 /*comment*/ NULL);
 			} else {
-				message = CFCopyLocalizedStringFromTableInBundle(CFSTR("This program displays information via Growl, a centralized notification system.  Growl is not currently installed; to see Growl notifications from this and other applications, you must install it.  No download is required."),
+				message = CFCopyLocalizedStringFromTableInBundle(CFSTR("This program displays information via Growl, a centralized notification system that enables applications to unobtrusively inform the user about potentially important information.  Growl is not currently installed; to see Growl notifications from this and other applications, you must install it.  No download is required."),
 																 CFSTR("GrowlInstallation"),
 																 bundle,
 																 /*comment*/ NULL);


Fix type conversion issue

Fix type conversion issue

--- dialogue.c
+++ dialogue.c
@@ -620,14 +620,14 @@
               "[%d] %s (%d gold)\n",
               num_options,
               GetItemName(i),
-              GetItemValue(i) * GetPriceModifier(merchant));
+              (int) (GetItemValue(i) * GetPriceModifier(merchant)));
       if (merchant->inventory[i] >= 10) {
         num_options++;
         sprintf(output + strlen(output),
                 "[%d] 10 %s (%d gold)",
                 num_options,
                 GetItemNamePlural(i),
-                10 * (GetItemValue(i) * GetPriceModifier(merchant)));
+                (int) (10 * (GetItemValue(i) * GetPriceModifier(merchant))));
       }
     }
   }


diff --no-index: do not forget to run diff_setup_done()

Code inspection by Linus found this.

Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- diff-lib.c
+++ diff-lib.c
@@ -298,6 +298,8 @@
 	revs->diffopt.nr_paths = 2;
 	revs->diffopt.no_index = 1;
 	revs->max_count = -2;
+	if (diff_setup_done(&revs->diffopt) < 0)
+		die("diff_setup_done failed");
 	return 0;
 }


multipath: fix offset for containted slices.

For contained slices, the offset of the new device should be from the start
of the containing device, which is what you are creating the new device on top
of.  It should not be the offset from the start of the entire disk.

Signed-off-by: Benjamin Marzinski <6b0cc3f70b3cc4298c6f98f9a6292b5ebe631572@redhat.com>

--- kpartx/kpartx.c
+++ kpartx/kpartx.c
@@ -488,6 +488,7 @@
 			d = c;
 			while (c) {
 				for (j = 0; j < n; j++) {
+					uint64_t start;
 					int k = slices[j].container - 1;

 					if (slices[j].size == 0)
@@ -498,7 +499,7 @@
 						continue;

 					/* Skip all simple slices */
-					if (k < 0)
+					if (slices[j].container == 0)
 						continue;

 					/* Check container slice */
@@ -513,10 +514,11 @@
 					}
 					strip_slash(partname);

+					start = slices[j].start - slices[k].start;
 					if (safe_sprintf(params, "%d:%d %" PRIu64,
 							 slices[k].major,
 							 slices[k].minor,
-							 slices[j].start)) {
+							 start)) {
 						fprintf(stderr, "params too small\n");
 						exit(1);
 					}


[NS] Valgrind issue fix for Notification service.

Bug: https://jira.iotivity.org/browse/IOT-2200
Change-Id: I4a4906f33dabdf46d616c1f5d6e83f25250264be
Signed-off-by: Jay Sharma <be3f38406483cc49cc88287dab3029bdbb2da347@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19781
Reviewed-by: Uze Choi <3a26c91d8a4a3c9e246e43339f4782bb2483aece@samsung.com>
Tested-by: Uze Choi <3a26c91d8a4a3c9e246e43339f4782bb2483aece@samsung.com>

--- service/notification/src/provider/NSProviderInterface.c
+++ service/notification/src/provider/NSProviderInterface.c
@@ -26,6 +26,7 @@
 #include "NSProviderCallbackResponse.h"
 #include "NSProviderMemoryCache.h"
 #include "NSProviderTopic.h"
+#include "NSProviderDiscovery.h"
 #include "oic_malloc.h"
 #include "oic_string.h"
 #include "cautilinterface.h"
@@ -103,8 +104,12 @@
         NSInitialize();
         NSInitScheduler();
         NSStartScheduler();
-
-        NSPushQueue(DISCOVERY_SCHEDULER, TASK_START_PRESENCE, NULL);
+        /* This call from different thread causes racing issue calling csdk stack.
+           This is monitored when Start/Stop are called sequentially.
+           Temporarily fix : call NSStartPresence() instead of call it thru NSPushQueue()
+           NSPushQueue(DISCOVERY_SCHEDULER, TASK_START_PRESENCE, NULL);
+        */
+        NSStartPresence();
         NSPushQueue(DISCOVERY_SCHEDULER, TASK_REGISTER_RESOURCE, NULL);
     }
     else
@@ -124,12 +129,12 @@

     if (initProvider)
     {
+        NSUnRegisterResource();
         CAUnregisterNetworkMonitorHandler((CAAdapterStateChangedCB)NSProviderAdapterStateListener,
                 (CAConnectionStateChangedCB)NSProviderConnectionStateListener);
         NSPushQueue(DISCOVERY_SCHEDULER, TASK_STOP_PRESENCE, NULL);
         NSRegisterSubscribeRequestCb((NSSubscribeRequestCallback)NULL);
         NSRegisterSyncCb((NSProviderSyncInfoCallback)NULL);
-        NSUnRegisterResource();
         NSDeinitProviderInfo();
         NSStopScheduler();
         NSDeinitailize();


[bouqueau] comply with gpac allocator

[bouqueau] comply with gpac allocator

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@3055 63c20433-aa62-49bd-875c-5a186b69a8fb

--- modules/widgetman/unzip.h
+++ modules/widgetman/unzip.h
@@ -114,10 +114,10 @@
 #endif

 #ifndef ALLOC
-# define ALLOC(size) (malloc(size))
+# define ALLOC(size) (gf_malloc(size))
 #endif
 #ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
+# define TRYFREE(p) {if (p) gf_free(p);}
 #endif

 #define SIZECENTRALDIRITEM (0x2e)


nucleo-f412zg: Check if AP is on when processing HOOK_INIT hooks

Call ap_deferred() function directly (not as deferred function) from
board_init(). This change causes CS pin interrupt to be enabled
while running board_init() init hook, just after SPI initialization.
It removes 43ms window when SPI is initialized but we are not able
to communicate because interrupt on CS line is not enabled. This
change only affects RW firmware.

After main(), only hook task is marked as ready, so we are switching to
it and start executing HOOK_INIT hooks (spi_init() and board_init() are
called). SPI initialization is performed, but CS interrupt is still not
enabled (spi_init() checks if chipset is on). The interrupt is enabled
on HOOK_CHIPSET_RESUME. For RW side HOOK_CHIPSET_RESUME is emitted when
SLP_L and SLP_ALT_L are set to 1 (see ap_deferred()). ap_deferred() is
a deferred function so it is called from hook task context. It is
scheduled always in board_init() or in slp_event() when SLP_L and
SLP_ALT_L changes.

When hook task finishes executing all HOOK_INIT hooks it enables other
tasks with task_enable_all_tasks(). Now task with higher priority is
scheduled (CONSOLE, HOSTCMD, FPSENSOR tasks have higher priority than
HOOK task). When all higher priority tasks are waiting for events hook
task is scheduled and we can finally run ap_deferred() function which
should enable interrupt on CS pin (if AP is running).

BUG=b:185467818
BRANCH=none
TEST=make -j buildall
TEST=Flash nucleo-f412zg board and check if it is fully functional

Signed-off-by: Patryk Duda <6aed17a362577cf10cb5675888c1635d522769c1@semihalf.com>
Change-Id: Ia71c30a1e738411f566a7f29354c04a337cdce6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2905655
Reviewed-by: Craig Hesling <383db090fd8ef907a606ac8a9eccd2962bc489cf@chromium.org>

--- board/nucleo-f412zg/board.c
+++ board/nucleo-f412zg/board.c
@@ -58,7 +58,12 @@
 	/* Enable interrupt on PCH power signals */
 	gpio_enable_interrupt(GPIO_PCH_SLP_S3_L);
 	gpio_enable_interrupt(GPIO_PCH_SLP_S0_L);
-	/* enable the SPI slave interface if the PCH is up */
-	hook_call_deferred(&ap_deferred_data, 0);
+
+	/*
+	 * Enable the SPI slave interface if the PCH is up.
+	 * Do not use hook_call_deferred(), because ap_deferred() will be
+	 * called after tasks with priority higher than HOOK task (very late).
+	 */
+	ap_deferred();
 }
 DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);


Quackingstick: fix orientation for accelgyro BMI160

Modify lid_standard_ref to
 0, 1, 0
-1, 0, 0
 0, 0, 1

BUG=b:208865381
BRANCH=none
TEST=The display orientation is correct on the BMI160
     board.

Signed-off-by: Sue Chen <7d23cdcf270f71747b77aeecc793a9342f6d5c9e@quanta.corp-partner.google.com>
Change-Id: Ica254ebe7e805771f7a6a2514196a7123a7908d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3316163
Reviewed-by: Wai-Hong Tam <04b587fdf5845741a0c5a8b9cd59ca72d73ef8fc@google.com>
Reviewed-by: Bob Moragues <f5049d5b5df4f96d121308a63d9e3c0dfa5ed2dc@chromium.org>
Commit-Queue: Bob Moragues <f5049d5b5df4f96d121308a63d9e3c0dfa5ed2dc@chromium.org>

--- board/quackingstick/board.c
+++ board/quackingstick/board.c
@@ -263,8 +263,8 @@

 /* Matrix to rotate accelerometer into standard reference frame */
 const mat33_fp_t lid_standard_ref = {
-	{ 0, FLOAT_TO_FP(-1), 0},
-	{ FLOAT_TO_FP(1), 0, 0},
+	{ 0, FLOAT_TO_FP(1), 0},
+	{ FLOAT_TO_FP(-1), 0, 0},
 	{ 0,  0, FLOAT_TO_FP(1)}
 };


Up again

Up again

--- dll_wifi.h
+++ dll_wifi.h
@@ -13,7 +13,7 @@
 #define WIFI_BROADCAST_ADDR_STRING ("ff:ff:ff:ff:ff:ff")
 #define WIFI_MAX_ASSOCIATED_CLIENTS (100)
 #define WIFI_INITIAL_CHECKSUM_VALUE ((uint32_t)0)
-#define WIFI_APP_LAYER_START_DELAY (10000000)
+#define WIFI_APP_LAYER_START_DELAY (20000000)

 #define WIFI_PROBE_PERIOD (500000) //how often to probe for APs
 #define WIFI_REASSOCIATE_PERIOD (1000000) //how long to wait after probing before reassociation


launch: Unconditionally declare environ

launch: Unconditionally declare environ

The header declaration in unistd.h is non-standard, and the portable
way to use it is just declare it explicitly everywhere.

--- launch/launch.c
+++ launch/launch.c
@@ -51,7 +51,6 @@
 #endif
 #ifdef __NetBSD__
 #include <dev/wscons/wsdisplay_usl_io.h>
-extern char **environ;
 #else
 #include <linux/input.h>
 #include <linux/kd.h>
@@ -425,6 +424,7 @@
 int
 main(int argc, char *argv[])
 {
+	extern char **environ;
 	int option;
 	char *vt = NULL, buf[64];
 	struct sigaction action = {


compilation warnings corrected (Theodor)

--- HLT/trigger/AliHLTTriggerTrdClusterMultiplicity.h
+++ HLT/trigger/AliHLTTriggerTrdClusterMultiplicity.h
@@ -91,6 +91,11 @@

   int Configure(const char* arguments);

+  /// Not implemented.
+  AliHLTTriggerTrdClusterMultiplicity(const AliHLTTriggerTrdClusterMultiplicity&);
+  /// Not implemented.
+  AliHLTTriggerTrdClusterMultiplicity& operator = (const AliHLTTriggerTrdClusterMultiplicity&);
+
   /// Variables for triggger configuration
   Int_t fClusterMult;
   TClonesArray* fClusterArray;


test/bundle.c: Add GError testing to bundle_test_resign

This eases identifying future issues.

Signed-off-by: Enrico Jorns <a2e5f936c390f36494e46e71bcfbe365bb1e8c49@pengutronix.de>

--- test/bundle.c
+++ test/bundle.c
@@ -7,6 +7,7 @@
 #include <bundle.h>
 #include <context.h>
 #include <manifest.h>
+#include <signature.h>
 #include <utils.h>

 #include "common.h"
@@ -172,13 +173,18 @@
 	 * the context's 'pending' flag which would cause a re-initialization
 	 * of context and thus overwrite content of 'config' member. */
 	r_context()->config->keyring_path = g_strdup("test/openssl-ca/rel-ca.pem");
-	g_assert_false(check_bundle(fixture->bundlename, &bundle, TRUE, NULL));
+	res = check_bundle(fixture->bundlename, &bundle, TRUE, &ierror);
+	g_assert_error(ierror, R_SIGNATURE_ERROR, R_SIGNATURE_ERROR_INVALID);
+	g_clear_error(&ierror);
+	g_assert_false(res);

 	g_clear_pointer(&bundle, free_bundle);

 	/* Verify input bundle with 'dev' keyring */
 	r_context()->config->keyring_path = g_strdup("test/openssl-ca/dev-ca.pem");
-	g_assert_true(check_bundle(fixture->bundlename, &bundle, TRUE, NULL));
+	res = check_bundle(fixture->bundlename, &bundle, TRUE, &ierror);
+	g_assert_no_error(ierror);
+	g_assert_true(res);

 	/* Use 'rel' key pair for resigning */
 	r_context_conf()->certpath = g_strdup("test/openssl-ca/rel/release-1.cert.pem");
@@ -196,13 +202,17 @@
 	 * installing development bundles as well as moving to production
 	 * bundles. */
 	r_context()->config->keyring_path = g_strdup("test/openssl-ca/dev-ca.pem");
-	g_assert_true(check_bundle(resignbundle, &bundle, TRUE, NULL));
+	res = check_bundle(resignbundle, &bundle, TRUE, &ierror);
+	g_assert_no_error(ierror);
+	g_assert_true(res);

 	g_clear_pointer(&bundle, free_bundle);

 	/* Verify resigned bundle with rel keyring */
 	r_context()->config->keyring_path = g_strdup("test/openssl-ca/rel-ca.pem");
-	g_assert_true(check_bundle(resignbundle, &bundle, TRUE, NULL));
+	res = check_bundle(resignbundle, &bundle, TRUE, &ierror);
+	g_assert_no_error(ierror);
+	g_assert_true(res);

 	g_clear_pointer(&bundle, free_bundle);
 }


Changed escape flush function to also handle any pending events.

svn path=/trunk/; revision=581

--- drivers/xwin.c
+++ drivers/xwin.c
@@ -1,6 +1,9 @@
 /* $Id$
  * $Log$
- * Revision 1.27  1993/11/15 08:29:56  mjl
+ * Revision 1.28  1993/12/06 07:42:31  mjl
+ * Changed escape flush function to also handle any pending events.
+ *
+ * Revision 1.27  1993/11/15  08:29:56  mjl
  * Added a cast to eliminate a warning.
  *
  * Revision 1.26  1993/11/07  09:02:33  mjl
@@ -423,6 +426,7 @@
 	break;

       case PLESC_FLUSH:
+	HandleEvents(pls);	/* Check for events */
 	XFlush(dev->display);
 	break;
     }
@@ -645,9 +649,7 @@
 * HandleEvents()
 *
 * Just a front-end to EventHandler(), for use when not actually waiting for
-* an event but only checking the event queue.  Right now the ONLY event we
-* check for is a KeyPress or ButtonPress, since the plot buffer logic does
-* not support multiple writes of the plot buffer in a single page.
+* an event but only checking the event queue.
 \*----------------------------------------------------------------------*/

 static void
@@ -656,7 +658,8 @@
     XwDev *dev = (XwDev *) pls->dev;
     XEvent event;

-    if (XCheckMaskEvent(dev->display, ButtonPressMask | KeyPressMask, &event))
+    if (XCheckMaskEvent(dev->display, ButtonPressMask | KeyPressMask |
+			ExposureMask | StructureNotifyMask, &event))
 	EventHandler(pls, &event);
 }


More conversion to check return values of allocation.

--- document.c
+++ document.c
@@ -966,48 +966,47 @@
 char_emphasis(struct lowdown_doc *doc,
 	char *data, size_t offset, size_t size)
 {
-	char c = data[0];
-	size_t ret;
+	char	 c = data[0];
+	ssize_t	 ret;

 	if (doc->ext_flags & LOWDOWN_NOINTEM)
 		if (offset > 0 && !xisspace(data[-1]) &&
 		    data[-1] != '>' && data[-1] != '(')
 			return 0;

+	/*
+	 * Spacing cannot follow an opening emphasis: strikethrough and
+	 * highlight only takes '~~'.
+	 * FIXME: don't depend upon the "ret =" as the last part of an
+	 * "or" chain---it's hard to read.
+	 */
+
 	if (size > 2 && data[1] != c) {
-		/*
-		 * Spacing cannot follow an opening emphasis;
-		 * strikethrough and highlight only takes '~~'.
-		 */
 		if (c == '~' || c == '=' || xisspace(data[1]) ||
-		    (ret = parse_emph1(doc,
-		     data + 1, size - 1, c)) == 0)
+		    (ret = parse_emph1
+		     (doc, data + 1, size - 1, c)) == 0)
 			return 0;
-
-		return ret + 1;
+		return ret > 0 ? ret + 1 : ret;
 	}

 	if (size > 3 && data[1] == c && data[2] != c) {
 		if (xisspace(data[2]) ||
-		    (ret = parse_emph2(doc,
-		     data + 2, size - 2, c)) == 0)
+		    (ret = parse_emph2
+		     (doc, data + 2, size - 2, c)) == 0)
 			return 0;
-
-		return ret + 2;
+		return ret > 0 ? ret + 2 : ret;
 	}

 	if (size > 4 && data[1] == c && data[2] == c && data[3] != c) {
 		if (c == '~' || c == '=' || xisspace(data[3]) ||
-		    (ret = parse_emph3(doc,
-		     data + 3, size - 3, c)) == 0)
+		    (ret = parse_emph3
+		     (doc, data + 3, size - 3, c)) == 0)
 			return 0;
-
-		return ret + 3;
+		return ret > 0 ? ret + 3 : ret;
 	}

 	return 0;
 }
-

 /*
  * '\n' preceded by two spaces (assuming linebreak != 0)
@@ -1025,9 +1024,9 @@

 	/* Removing the last space from nodes. */

-	assert(NULL != doc->current);
+	assert(doc->current != NULL);
 	n = TAILQ_LAST(&doc->current->children, lowdown_nodeq);
-	assert(NULL != n && LOWDOWN_NORMAL_TEXT == n->type);
+	assert(n != NULL && LOWDOWN_NORMAL_TEXT == n->type);
 	b = &n->rndr_normal_text.text;

 	while (b->size && b->data[b->size - 1] == ' ')
@@ -1039,14 +1038,14 @@
 	 */

 	for (w = 1; w < size; w++)
-		if (' ' != data[w])
+		if (data[w] != ' ')
 			break;

-	n = pushnode(doc, LOWDOWN_LINEBREAK);
+	if ((n = pushnode(doc, LOWDOWN_LINEBREAK)) == NULL)
+		return -1;
 	popnode(doc, n);
 	return w;
 }
-

 /*
  * '`' parsing a code span (assuming codespan != 0)
@@ -1056,8 +1055,8 @@
 	char *data, size_t offset, size_t size)
 {
 	struct lowdown_buf	 work;
+	struct lowdown_node 	*n;
 	size_t	 		 end, nb = 0, i, f_begin, f_end;
-	struct lowdown_node 	*n;

 	memset(&work, 0, sizeof(struct lowdown_buf));

@@ -1089,13 +1088,15 @@

 	/* Real code span. */

-	n = pushnode(doc, LOWDOWN_CODESPAN);
+	if ((n = pushnode(doc, LOWDOWN_CODESPAN)) == NULL)
+		return -1;

 	if (f_begin < f_end) {
 		work.data = data + f_begin;
 		work.size = f_end - f_begin;
-		pushbuffer(&n->rndr_codespan.text,
-			work.data, work.size);
+		if (!pushbuffer(&n->rndr_codespan.text,
+		    work.data, work.size))
+			return -1;
 	}

 	popnode(doc, n);
@@ -1114,6 +1115,7 @@
 		"\\`*_{}[]()#+-.!:|&<>^~=\"$";
 	struct lowdown_buf	 work;
 	size_t		 	 w;
+	ssize_t		 	 ret;
 	const char		*end;
 	struct lowdown_node 	*n;

@@ -1125,32 +1127,40 @@
 		    size > 2 &&
 		    (data[2] == '(' || data[2] == '[')) {
 			end = (data[2] == '[') ? "\\\\]" : "\\\\)";
-			w = parse_math(doc, data, offset,
+			ret = parse_math(doc, data, offset,
 				size, end, 3, data[2] == '[');
-			if (w)
-				return w;
-		}
+			if (ret != 0)
+				return ret;
+		}
+
+		/* Swallow leading white-space of next line. */

 		if (LOWDOWN_COMMONMARK & doc->ext_flags &&
 		    data[1] == '\n') {
-			/* Swallow leading white-space of next line. */
 			for (w = 2; w < size; w++)
-				if (' ' != data[w])
+				if (data[w] != ' ')
 					break;
 			n = pushnode(doc, LOWDOWN_LINEBREAK);
+			if (n == NULL)
+				return -1;
 			popnode(doc, n);
 			return w;
 		}

 		if (strchr(escape_chars, data[1]) == NULL)
 			return 0;
-
-		n = pushnode(doc, LOWDOWN_NORMAL_TEXT);
-		pushbuffer(&n->rndr_normal_text.text, data + 1, 1);
+		if ((n = pushnode(doc, LOWDOWN_NORMAL_TEXT)) == NULL)
+			return -1;
+		if (!pushbuffer
+		    (&n->rndr_normal_text.text, data + 1, 1))
+			return -1;
 		popnode(doc, n);
 	} else if (size == 1) {
-		n = pushnode(doc, LOWDOWN_NORMAL_TEXT);
-		pushbuffer(&n->rndr_normal_text.text, data, 1);
+		if ((n = pushnode(doc, LOWDOWN_NORMAL_TEXT)) == NULL)
+			return -1;
+		if (!pushbuffer
+		    (&n->rndr_normal_text.text, data, 1))
+			return -1;
 		popnode(doc, n);
 	}

@@ -1171,7 +1181,7 @@
 	if (end < size && data[end] == '#')
 		end++;

-	while (end < size && isalnum(data[end]))
+	while (end < size && isalnum((unsigned char)data[end]))
 		end++;

 	if (end < size && data[end] == ';')
@@ -1179,8 +1189,10 @@
 	else
 		return 0; /* lone '&' */

-	n = pushnode(doc, LOWDOWN_ENTITY);
-	pushbuffer(&n->rndr_entity.text, data, end);
+	if ((n = pushnode(doc, LOWDOWN_ENTITY)) == NULL)
+		return -1;
+	if (!pushbuffer(&n->rndr_entity.text, data, end))
+		return -1;
 	popnode(doc, n);
 	return end;
 }
@@ -1212,25 +1224,30 @@
 			unscape_text(u_link, &work);

 			n = pushnode(doc, LOWDOWN_LINK_AUTO);
+			if (n == NULL)
+				return -1;
 			n->rndr_autolink.type = altype;
-			pushbuffer(&n->rndr_autolink.link,
-				u_link->data, u_link->size);
-			pushbuffer(&n->rndr_autolink.text,
-				u_link->data, u_link->size);
+			if (!pushbuffer(&n->rndr_autolink.link,
+			    u_link->data, u_link->size))
+				return -1;
+			if (!pushbuffer(&n->rndr_autolink.text,
+			    u_link->data, u_link->size))
+				return -1;
 			popnode(doc, n);
 			hbuf_free(u_link);
 		} else {
 			n = pushnode(doc, LOWDOWN_RAW_HTML);
-			pushbuffer(&n->rndr_raw_html.text, data, end);
+			if (n == NULL)
+				return -1;
+			if (!pushbuffer(&n->rndr_raw_html.text,
+			    data, end))
+				return -1;
 			popnode(doc, n);
 		}
 		ret = 1;
 	}

-	if (!ret)
-		return 0;
-	else
-		return end;
+	return !ret ? 0 : end;
 }

 static ssize_t
@@ -1263,12 +1280,16 @@
 				n->rndr_normal_text.text.size = 0;
 		}

-		n = pushnode(doc, LOWDOWN_LINK);
-		pushbuffer(&n->rndr_link.link,
-			link_url->data, link_url->size);
-		nn = pushnode(doc, LOWDOWN_NORMAL_TEXT);
-		pushbuffer(&n->rndr_normal_text.text,
-			link->data, link->size);
+		if ((n = pushnode(doc, LOWDOWN_LINK)) == NULL)
+			return -1;
+		if (!pushbuffer(&n->rndr_link.link,
+		    link_url->data, link_url->size))
+			return -1;
+		if ((nn = pushnode(doc, LOWDOWN_NORMAL_TEXT)) == NULL)
+			return -1;
+		if (!pushbuffer(&n->rndr_normal_text.text,
+		    link->data, link->size))
+			return -1;
 		popnode(doc, nn);
 		popnode(doc, n);
 		hbuf_free(link_url);
@@ -1307,10 +1328,12 @@
 				n->rndr_normal_text.text.size = 0;
 		}

-		n = pushnode(doc, LOWDOWN_LINK_AUTO);
+		if ((n = pushnode(doc, LOWDOWN_LINK_AUTO)) == NULL)
+			return -1;
 		n->rndr_autolink.type = HALINK_EMAIL;
-		pushbuffer(&n->rndr_autolink.link,
-			link->data, link->size);
+		if (!pushbuffer(&n->rndr_autolink.link,
+		    link->data, link->size))
+			return -1;
 		popnode(doc, n);
 	}

@@ -1344,10 +1367,12 @@
 				n->rndr_normal_text.text.size = 0;
 		}

-		n = pushnode(doc, LOWDOWN_LINK_AUTO);
+		if ((n = pushnode(doc, LOWDOWN_LINK_AUTO)) == NULL)
+			return -1;
 		n->rndr_autolink.type = HALINK_NORMAL;
-		pushbuffer(&n->rndr_autolink.link,
-			link->data, link->size);
+		if (!pushbuffer(&n->rndr_autolink.link,
+		    link->data, link->size))
+			return -1;
 		popnode(doc, n);
 	}

@@ -1359,17 +1384,13 @@
 char_image(struct lowdown_doc *doc,
 	char *data, size_t offset, size_t size)
 {
-	size_t	 ret;
+	ssize_t	 ret;

 	if (size < 2 || data[1] != '[')
 		return 0;

 	ret = char_link(doc, data + 1, offset + 1, size - 1);
-
-	if (!ret)
-		return 0;
-
-	return ret + 1;
+	return ret <= 0 ? ret : ret + 1;
 }

 /*
@@ -1396,10 +1417,10 @@

 	is_img = offset && data[-1] == '!' &&
 		!is_escaped(data - offset, offset - 1);
-	is_footnote = (doc->ext_flags & LOWDOWN_FOOTNOTES &&
-			data[1] == '^');
-	is_metadata = (doc->ext_flags & LOWDOWN_METADATA &&
-			data[1] == '%');
+	is_footnote = (doc->ext_flags & LOWDOWN_FOOTNOTES) &&
+			data[1] == '^';
+	is_metadata = (doc->ext_flags & LOWDOWN_METADATA) &&
+			data[1] == '%';

 	/* Looking for the matching closing bracket. */


[t:2499] Set errno so that brtloader's bl_fwrite() function gets correct error return if the real fwrite() produces an error.

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

--- src/tests/loader-cleanup-test.c
+++ src/tests/loader-cleanup-test.c
@@ -93,6 +93,9 @@
 	r = -1;
     } else {
 	r = fwrite(ptr, size, nmemb, stream);
+	if (r!=nmemb) {
+	    errno = ferror(stream);
+	}
     }
     return r;
 }


kill printf in test

kill printf in test

--- src/tests/util/hashtable_test.c
+++ src/tests/util/hashtable_test.c
@@ -56,9 +56,11 @@
 	for(int i=0; i<3; i++)	{
 		if(NULL != hashtable_get(ht, (void *)key[i])){
 			ht_value[i] = (struct ht_element *) hashtable_get(ht, (void *)key[i]);
-			printf ("%d\n",(int) ht_value[i]->number);
+			/*printf ("%d\n",(int) ht_value[i]->number);*/
 		}
-		else printf ("NULL");
+		else {
+			/*printf ("NULL");*/
+		}
 	}

 	hashtable_destroy(ht);


Ensure function SHA1_TraceState is always defined, even when TRACING_SSL is not defined.

--- security/nss/lib/freebl/sha_fast.c
+++ security/nss/lib/freebl/sha_fast.c
@@ -35,6 +35,7 @@
 #include <memory.h>
 #include "blapi.h"
 #include "sha_fast.h"
+#include "prerror.h"

 #ifdef TRACING_SSL
 #include "ssl.h"
@@ -383,10 +384,10 @@
     return cx;
 }

-#ifdef TRACING_SSL
 void
 SHA1_TraceState(SHA1Context *ctx)
 {
+#ifdef TRACING_SSL
     uint32        W;
     int           i;
     int           len;
@@ -414,5 +415,7 @@

     PRINT_BUF(99, (0, "SHA1_TraceState: buffered input", buf, len));

-}
+#else
+    PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
 #endif
+}


Removed sized structs.

Removed sized structs.

--- size.h
+++ size.h
@@ -5,7 +5,7 @@

 #include <stdint.h>

-struct JBSize16 {
+struct JBSize {
 	union {
 		uint16_t width, w, columns, cols, col, c;
 		int16_t top, t;
@@ -15,23 +15,6 @@
 		uint16_t height, h, rows, r;
 		int16_t bottom, bot, b;
 		int16_t min;
-	};
-};
-
-struct JBSize8 {
-	union {
-		uint8_t width, w;
-		uint8_t cols, c;
-		int8_t ascent, a;
-		int8_t top, t;
-		int8_t max;
-	};
-	union {
-		uint8_t height, h;
-		uint8_t rows, r;
-		int8_t descent, d;
-		int8_t bottom, bot, b;
-		int8_t min;
 	};
 };

@@ -46,8 +29,7 @@

 union JBDim {
 	struct JBPoint p;
-	struct JBSize16 s16, s;
-	struct JBSize8 s8;
+	struct JBSize s;
 };

 #endif//!JB_STRUCT_H


Changed default error message.

Changed default error message.

--- skip.c
+++ skip.c
@@ -11,7 +11,7 @@

 	if(argc!=3)
 	{
-		fprintf(stderr, "error: skip BEGIN END expected, exiting.\n");
+		fprintf(stderr, "skip BEGIN END\n");
 		exit(1);
 	}


client: Add support for setting controller name

--- client/main.c
+++ client/main.c
@@ -304,6 +304,44 @@
 			power_callback, GUINT_TO_POINTER(powered), NULL);
 }

+static void name_callback(const DBusError *error, void *user_data)
+{
+	char *name = user_data;
+
+	begin_message();
+
+	if (dbus_error_is_set(error))
+		printf("Failed to set name \"%s\": %s\n", name, error->name);
+	else
+		printf("Changed name to \"%s\"\n", name);
+
+	end_message();
+}
+
+static void cmd_name(const char *arg)
+{
+	char *name;
+
+	if (!arg || !strlen(arg)) {
+		printf("Missing name argument\n");
+		return;
+	}
+
+	if (!default_ctrl) {
+		printf("No default controller available\n");
+		return;
+	}
+
+	name = g_strdup(arg);
+
+	if (g_dbus_proxy_set_property_basic(default_ctrl, "Name",
+					DBUS_TYPE_STRING, &name,
+					name_callback, name, g_free) == TRUE)
+		return;
+
+	g_free(name);
+}
+
 static void cmd_quit(const char *arg)
 {
 	g_main_loop_quit(main_loop);
@@ -353,7 +391,8 @@
 							ctrl_generator },
 	{ "select", "<ctrl>", cmd_select, "Select default controller",
 							ctrl_generator },
-	{ "power", "<on/off>",cmd_power,  "Power on/off" },
+	{ "power", "<on/off>",cmd_power,  "Set controller power" },
+	{ "name",  "<name",   cmd_name,   "Set controller name" },
 	{ "quit",   NULL,     cmd_quit,   "Quit program" },
 	{ "exit",   NULL,     cmd_quit },
 	{ "help" },


client: Make command info print TxPower and RSSI

This makes command info to also print TxPower and RSSI if available.

--- client/main.c
+++ client/main.c
@@ -952,6 +952,8 @@
 	print_property(proxy, "Modalias");
 	print_property(proxy, "ManufacturerData");
 	print_property(proxy, "ServiceData");
+	print_property(proxy, "RSSI");
+	print_property(proxy, "TxPower");
 }

 static void pair_reply(DBusMessage *message, void *user_data)


More robust error handling in client

More robust error handling in client

--- client/main.c
+++ client/main.c
@@ -40,6 +40,7 @@
 	int opt, i, ret;
 	long max_iterations;
 	int sockfd;
+	int failed = 0;

 	struct sockaddr_in servaddr;
 	struct client_details carg;
@@ -101,15 +102,21 @@

 		for (i = 0; i < clients; i++) {
 			ret = pthread_join(threads[i], (void**) &cret);
+
 			if (ret != 0) {
 				errno = ret;
-				perror("failed to spawn worker thread");
-				goto after;
+				perror("failed to join worker thread");
+				failed = 1;
 			}
 			if (cret == PTHREAD_CANCELED) {
 				fprintf(stderr, "thread cancelled...\n");
-				return EXIT_FAILURE;
+				failed = 1;
 			}
+			if (cret == NULL && failed == 0) {
+				fprintf(stderr, "thread aborted...\n");
+				failed = 1;
+			}
+			if (failed == 1) continue;

 			current_mean = mean;
 			mean = (n * current_mean + cret->n * cret->mean) / (n + cret->n);
@@ -147,9 +154,12 @@
 	}
 	close(sockfd);

+	if (failed == 1) {
+		return EXIT_FAILURE;
+	}

 	printf("%.2fus\n", mean/1000.0);
-	exit(EXIT_SUCCESS);
+	return EXIT_SUCCESS;
 }

 void * client(void * arg) {
@@ -167,7 +177,7 @@

 	uint32_t response, challenge = 0;

-	long i;
+	long i = 0;
 	int ret;

 	stats = malloc(sizeof(struct client_stats));
@@ -176,7 +186,9 @@
 	sockfd = socket(AF_INET,SOCK_STREAM, 0);
 	if (sockfd == -1) {
 		perror("failed to open outgoing socket");
-		return stats;
+		atomic_store(&wait_n, -1);
+		free(stats);
+		return NULL;
 	}

 	servaddr = (struct sockaddr *) config->servaddr;
@@ -184,8 +196,9 @@

 	if (ret != 0) {
 		perror("failed to connect to server");
-		printf("failed to connect to server\n");
-		return stats;
+		atomic_store(&wait_n, -1);
+		free(stats);
+		return NULL;
 	}

 	setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &ONE, sizeof(ONE));
@@ -200,7 +213,8 @@

 	if (ret == -1) {
 		perror("failed to send test challenge to server");
-		return stats;
+		atomic_store(&wait_n, -1);
+		goto thread_after;
 	}

 	do {
@@ -209,25 +223,30 @@

 	if (ret == -1) {
 		if (errno == ECONNRESET) {
+			fprintf(stderr, "reconnecting...");
 			free(stats);
 			return client(arg);
 		}
 		perror("failed to receive test response from server");
-		return stats;
+		goto thread_after;
 	}
 	if (ret == 0) {
 		perror("received no test data from server; connection closed");
-		return stats;
+		goto thread_after;
 	}

 	response = ntohl(response);
 	if (response != 2) {
 		fprintf(stderr, "server responded with incorrect test response (%u != 2)\n", response);
-		return stats;
+		goto thread_after;
 	}

 	atomic_fetch_sub(&wait_n, 1);
-	while (atomic_load(&wait_n) != 0) {}
+	while (atomic_load(&wait_n) > 0) usleep(1);
+
+	if (atomic_load(&wait_n) < 0) {
+		goto thread_after;
+	}

 	for (i = 0; i < config->iterations; i++) {
 		while (challenge == 0) {
@@ -277,6 +296,13 @@
 		stats->S = stats->S + (diff - stats->mean) * (diff - current_mean);
 	}

+thread_after:
 	close(sockfd);
+
+	if (i < config->iterations-1) {
+		atomic_store(&wait_n, -1);
+		free(stats);
+		return NULL;
+	}
 	return stats;
 }


i965: const buffer debug code (disabled)

--- src/mesa/drivers/dri/i965/brw_curbe.c
+++ src/mesa/drivers/dri/i965/brw_curbe.c
@@ -353,6 +353,14 @@
       map = const_buffer->virtual;
       memcpy(map, params->ParameterValues, size);
       dri_bo_unmap(const_buffer);
+
+      if (0) {
+         int i;
+         for (i = 0; i < params->NumParameters; i++) {
+            float *p = params->ParameterValues[i];
+            printf("%d: %f %f %f %f\n", i, p[0], p[1], p[2], p[3]);
+         }
+      }
    }
 }

@@ -363,6 +371,10 @@
 {
    struct brw_vertex_program *vp =
       (struct brw_vertex_program *) brw->vertex_program;
+   if (0) {
+      printf("update VS constants in buffer %p\n", vp->const_buffer);
+      printf("program %u\n", vp->program.Base.Id);
+   }
    update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
 }


i965: Fix all non-snb regression in the snb attribute interpolation commit.

This apparently had never been tested elsewhere before being merged to
master.

--- src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -342,7 +342,7 @@
    if (c->func.brw->intel.gen >= 6)
       return src_undef();

-   if (!src_is_undef(c->pixel_w)) {
+   if (src_is_undef(c->pixel_w)) {
       struct prog_dst_register pixel_w = get_temp(c);
       struct prog_src_register deltas = get_delta_xy(c);
       struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS);


r300: check if blitting for given format is supported earlier

Prevents failing assertions at later stage.

--- src/mesa/drivers/dri/r300/r300_blit.c
+++ src/mesa/drivers/dri/r300/r300_blit.c
@@ -492,6 +492,27 @@
     OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT));
     OUT_BATCH_REGVAL(R300_RB3D_CCTL, 0);
     END_BATCH();
+}
+
+static unsigned is_blit_supported(gl_format dst_format)
+{
+    switch (dst_format) {
+        case MESA_FORMAT_RGB565:
+        case MESA_FORMAT_ARGB1555:
+        case MESA_FORMAT_RGBA8888:
+        case MESA_FORMAT_RGBA8888_REV:
+        case MESA_FORMAT_ARGB8888:
+        case MESA_FORMAT_ARGB8888_REV:
+        case MESA_FORMAT_XRGB8888:
+            break;
+        default:
+            return 0;
+    }
+
+    if (_mesa_get_format_bits(dst_format, GL_DEPTH_BITS) > 0)
+        return 0;
+
+    return 1;
 }

 /**
@@ -541,7 +562,7 @@
 {
     r300ContextPtr r300 = R300_CONTEXT(ctx);

-    if (_mesa_get_format_bits(src_mesaformat, GL_DEPTH_BITS) > 0)
+    if (!is_blit_supported(dst_mesaformat))
         return 0;

     /* Make sure that colorbuffer has even width - hw limitation */


TMath can't be here otherwise libMathCore is no longer autoloader

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@22807 27541ba8-7e3a-0410-8455-c3a389f83636

--- base/inc/LinkDef1.h
+++ base/inc/LinkDef1.h
@@ -162,6 +162,4 @@

 #pragma link C++ class TVirtualFFT;

-#pragma link C++ namespace TMath;
-
 #endif


TView is now declared TView-. The TView::Streamer is now part
of TView.cxx to cope with schema evolution.

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

--- base/inc/LinkDef1.h
+++ base/inc/LinkDef1.h
@@ -1,4 +1,4 @@
-/* @(#)root/base:$Name$:$Id$ */
+/* @(#)root/base:$Name:  $:$Id: LinkDef1.h,v 1.1.1.1 2000/05/16 17:00:39 rdm Exp $ */

 /*************************************************************************
  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
@@ -92,7 +92,7 @@
 #pragma link C++ class TGuiFactory;
 #pragma link C++ class TPadView3D;
 #pragma link C++ class TStyle+;
-#pragma link C++ class TView;
+#pragma link C++ class TView-;
 #pragma link C++ class TVirtualX;
 #pragma link C++ class TVirtualFitter;
 #pragma link C++ class TVirtualPad;


ncrement version number from 3 to 4

ncrement version number from 3 to 4

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

--- base/inc/TAttAxis.h
+++ base/inc/TAttAxis.h
@@ -1,4 +1,4 @@
-// @(#)root/base:$Name$:$Id$
+// @(#)root/base:$Name:  $:$Id: TAttAxis.h,v 1.1.1.1 2000/05/16 17:00:39 rdm Exp $
 // Author: Rene Brun   12/12/94

 /*************************************************************************
@@ -80,7 +80,7 @@
         virtual void     SetTitleColor(Color_t color=1);       // *MENU*
         virtual void     SetTitleFont(Style_t font=62);        // *MENU*

-        ClassDef(TAttAxis,3)  //Axis attributes
+        ClassDef(TAttAxis,4)  //Axis attributes
 };

 #endif


cosmetic

cosmetic

--- Library/Sources/Stroika/Foundation/Containers/Sequence.h
+++ Library/Sources/Stroika/Foundation/Containers/Sequence.h
@@ -580,8 +580,8 @@
     bool operator< (const Sequence<T>& lhs, const Sequence<T>& rhs);

     /**
-         *  operator indirects to Sequence<>::Compare()
-         */
+     *  operator indirects to Sequence<>::Compare()
+     */
     template <typename T>
     bool operator<= (const Sequence<T>& lhs, const Sequence<T>& rhs);


Added non-NULL DCHECK to MessageLoopForUI::current.

Having spent a little while tracking down a crash caused by not having a
message loop when calling this function, it seems that this is worth having.
I'm in two minds as to whether I prefer this approach to one where NULL is
a valid return value in debug builds as it is in release builds.

BUG=
TEST=

Review URL: http://codereview.chromium.org/9705073

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

--- base/message_loop.h
+++ base/message_loop.h
@@ -554,6 +554,7 @@
   // Returns the MessageLoopForUI of the current thread.
   static MessageLoopForUI* current() {
     MessageLoop* loop = MessageLoop::current();
+    DCHECK(loop);
     DCHECK_EQ(MessageLoop::TYPE_UI, loop->type());
     return static_cast<MessageLoopForUI*>(loop);
   }


Fixed a bug

Fixed a bug

--- ir/be/beabi.c
+++ ir/be/beabi.c
@@ -1124,8 +1124,7 @@
 {
 	be_abi_irg_t *env = malloc(sizeof(env[0]));

-	int i;
-	ir_node **nodes;
+	ir_node *dummy;
 	pmap_entry *ent;

 	env->isa           = birg->main_env->arch_env->isa;
@@ -1137,7 +1136,7 @@
 	env->birg             = birg;
 	env->dbg              = firm_dbg_register("firm.be.abi");
 	env->stack_phis       = pset_new_ptr(16);
-	env->init_sp          = new_r_Unknown(birg->irg, env->isa->sp->reg_class->mode);
+	env->init_sp = dummy  = new_r_Unknown(birg->irg, env->isa->sp->reg_class->mode);

 	obstack_init(&env->obst);

@@ -1147,29 +1146,16 @@
 	/* Lower all call nodes in the IRG. */
 	process_calls(env);

-#if 0
-	/* search for stack allocation nodes and record them */
-	irg_walk_graph(env->birg->irg, collect_alloca_walker, NULL, env);
-	obstack_ptr_grow(&env->obst, NULL);
-	nodes = obstack_finish(&env->obst);
-
-	/* If there are stack allocations in the irg, we need a frame pointer */
-	if(nodes[0] != NULL)
-		env->call->flags.bits.try_omit_fp = 0;
-#endif
-
+	/* Process the IRG */
 	modify_irg(env);
+
+	/* reroute the stack origin of the calls to the true stack origin. */
+	exchange(dummy, env->init_sp);

 	/* Make some important node pointers survive the dead node elimination. */
 	survive_dce_register_irn(env->dce_survivor, &env->init_sp);
 	for(ent = pmap_first(env->regs); ent; ent = pmap_next(env->regs))
 		survive_dce_register_irn(env->dce_survivor, (ir_node **) &ent->value);
-
-	/* Fix the alloca-style allocations */
-#if 0
-	for(i = 0; nodes[i] != NULL; ++i)
-		implement_stack_alloc(env, nodes[i]);
-#endif

 	arch_env_push_irn_handler(env->birg->main_env->arch_env, &env->irn_handler);