author | Michael Froman <mfroman@mozilla.com> |
Thu, 21 Sep 2017 08:56:34 -0500 | |
changeset 793141 | 670845aa7ccb49e3c040bb654b51a26c109ed756 |
parent 793140 | 8791bcda9e64d7dc25fef48b917a9f8d1fa37eeb |
child 793142 | 875245ac8535225790a66ff49b2ed6efb493d983 |
push id | 109292 |
push user | bmo:mfroman@nostrum.com |
push date | Wed, 09 May 2018 15:18:16 +0000 |
reviewers | ekr |
bugs | 1374699 |
milestone | 62.0a1 |
--- a/media/mtransport/third_party/moz.build +++ b/media/mtransport/third_party/moz.build @@ -47,16 +47,18 @@ nICEr_non_unified_sources = [ 'nICEr/src/stun/stun_util.c', 'nICEr/src/stun/turn_client_ctx.c', 'nICEr/src/util/cb_args.c', 'nICEr/src/util/ice_util.c', ] nrappkit_non_unified_sources = [ 'nrappkit/src/log/r_log.c', + 'nrappkit/src/registry/registry.c', + 'nrappkit/src/registry/registry_local.c', 'nrappkit/src/util/byteorder.c', 'nrappkit/src/util/hex.c', 'nrappkit/src/util/libekr/debug.c', 'nrappkit/src/util/libekr/r_assoc.c', 'nrappkit/src/util/libekr/r_crc32.c', 'nrappkit/src/util/libekr/r_data.c', 'nrappkit/src/util/libekr/r_errors.c', 'nrappkit/src/util/libekr/r_list.c',
--- a/media/mtransport/third_party/nICEr/src/stun/stun_util.c +++ b/media/mtransport/third_party/nICEr/src/stun/stun_util.c @@ -207,28 +207,28 @@ nr_stun_find_local_addresses(nr_local_ad int nr_stun_different_transaction(UCHAR *msg, size_t len, nr_stun_message *req) { int _status; nr_stun_message_header header; char reqid[44]; char msgid[44]; - int len2; + size_t unused; if (sizeof(header) > len) ABORT(R_FAILED); assert(sizeof(header.id) == sizeof(UINT12)); memcpy(&header, msg, sizeof(header)); if (memcmp(&req->header.id, &header.id, sizeof(header.id))) { - nr_nbin2hex((UCHAR*)&req->header.id, sizeof(req->header.id), reqid, sizeof(reqid), &len2); - nr_nbin2hex((UCHAR*)&header.id, sizeof(header.id), msgid, sizeof(msgid), &len2); + nr_nbin2hex((UCHAR*)&req->header.id, sizeof(req->header.id), reqid, sizeof(reqid), &unused); + nr_nbin2hex((UCHAR*)&header.id, sizeof(header.id), msgid, sizeof(msgid), &unused); r_log(NR_LOG_STUN, LOG_DEBUG, "Mismatched message IDs %s/%s", reqid, msgid); ABORT(R_NOT_FOUND); } _status=0; abort: return _status; }
--- a/media/mtransport/third_party/nrappkit/src/log/r_log.c +++ b/media/mtransport/third_party/nrappkit/src/log/r_log.c @@ -190,24 +190,24 @@ int r_log_register(char *facility_name,i *log_facility=log_type_ct; log_type_ct++; for(j=0; j<LOG_NUM_DESTINATIONS; j++){ log_types[i].level[j]=LOG_LEVEL_UNDEFINED; if(NR_reg_initted()){ - if(snprintf(dest_prefix,sizeof(NR_registry), + if((size_t)snprintf(dest_prefix,sizeof(NR_registry), "logging.%s.facility",log_destinations[j].dest_name)>=sizeof(NR_registry)) ABORT(R_INTERNAL); if (r=NR_reg_make_registry(dest_prefix,facility_name,dest_facility_prefix)) ABORT(r); - if(snprintf(log_types[i].dest_facility_key[j],sizeof(NR_registry), + if((size_t)snprintf(log_types[i].dest_facility_key[j],sizeof(NR_registry), "%s.level",dest_facility_prefix)>=sizeof(NR_registry)) ABORT(R_INTERNAL); if(!r_log_get_reg_level(log_types[i].dest_facility_key[j],&level)){ log_types[i].level[j]=level; } /* Set a callback for the facility's level */ @@ -278,16 +278,18 @@ static void r_log_facility_change_cb(voi if(r=r_log_get_reg_level(name,&level)) ABORT(r); *lt_level=level; _status=0; abort: + (void)_status; // to avoid unused variable warning and still conform to + // pattern of using ABORT return; } /* Handle the case where a value is deleted */ static void r_log_facility_delete_cb(void *cb_arg, char action, NR_registry name) { int *lt_level=(int *)cb_arg; @@ -304,17 +306,17 @@ int r_log(int facility,int level,const c va_end(ap); return(0); } int r_dump(int facility,int level,char *name,char *data,int len) { char *hex = 0; - int unused; + size_t unused; if(!r_logging(facility,level)) return(0); hex=RMALLOC((len*2)+1); if (!hex) return(R_FAILED); @@ -560,17 +562,17 @@ static int r_log_get_destinations(int us NR_registry reg_key; int i; int value; char c; /* Get the data out of the registry */ for(i=0; i<LOG_NUM_DESTINATIONS; i++){ /* set callback for default level */ - if(snprintf(reg_key,sizeof(reg_key),"%s.%s.level",LOGGING_REG_PREFIX, + if((size_t)snprintf(reg_key,sizeof(reg_key),"%s.%s.level",LOGGING_REG_PREFIX, log_destinations[i].dest_name)>=sizeof(reg_key)) ABORT(R_INTERNAL); NR_reg_register_callback(reg_key, NR_REG_CB_ACTION_ADD|NR_REG_CB_ACTION_CHANGE|NR_REG_CB_ACTION_DELETE, r_log_default_level_change_cb,0); if(r=r_log_get_reg_level(reg_key,&value)){ @@ -578,17 +580,17 @@ static int r_log_get_destinations(int us log_destinations[i].default_level=LOG_LEVEL_UNDEFINED; else ABORT(R_INTERNAL); } else log_destinations[i].default_level=value; /* set callback for the enabled key for this logging dest */ - if(snprintf(reg_key,sizeof(reg_key),"%s.%s.enabled",LOGGING_REG_PREFIX, + if((size_t)snprintf(reg_key,sizeof(reg_key),"%s.%s.enabled",LOGGING_REG_PREFIX, log_destinations[i].dest_name)>=sizeof(reg_key)) ABORT(R_INTERNAL); NR_reg_register_callback(reg_key, NR_REG_CB_ACTION_ADD|NR_REG_CB_ACTION_CHANGE|NR_REG_CB_ACTION_DELETE, r_log_destination_change_cb,0); if(r=NR_reg_get_char(reg_key,&c)){
--- a/media/mtransport/third_party/nrappkit/src/registry/c2ru.c +++ b/media/mtransport/third_party/nrappkit/src/registry/c2ru.c @@ -216,17 +216,17 @@ abort: } int nr_c2ru_get_children(NR_registry parent, char *child, void *ptr, size_t size, int (*get)(NR_registry, void*)) { int r, _status; NR_registry registry; unsigned int count; - int i; + unsigned int i; NR_registry name; struct entry { TAILQ_ENTRY(entry) entries; } *entry; TAILQ_HEAD(, entry) *tailq = (void*)ptr; TAILQ_INIT(tailq); if ((r=nr_c2ru_make_registry(parent, child, registry))) ABORT(r);
--- a/media/mtransport/third_party/nrappkit/src/registry/registry.c +++ b/media/mtransport/third_party/nrappkit/src/registry/registry.c @@ -336,17 +336,17 @@ nr_reg_type_name(int type) return(typenames[type]); } int nr_reg_compute_type(char *typename, int *type) { int _status; - int i; + size_t i; #ifdef SANITY_CHECKS assert(!strcasecmp(typenames[NR_REG_TYPE_CHAR], "char")); assert(!strcasecmp(typenames[NR_REG_TYPE_UCHAR], "UCHAR")); assert(!strcasecmp(typenames[NR_REG_TYPE_INT2], "INT2")); assert(!strcasecmp(typenames[NR_REG_TYPE_UINT2], "UINT2")); assert(!strcasecmp(typenames[NR_REG_TYPE_INT4], "INT4")); assert(!strcasecmp(typenames[NR_REG_TYPE_UINT4], "UINT4")); @@ -556,20 +556,20 @@ NR_reg_get2_child_registry(NR_registry b } /* requires parent already in legal form */ int NR_reg_make_registry(NR_registry parent, char *child, NR_registry out) { int r, _status; - int plen; - int clen; + size_t plen; + size_t clen; char *c; - int i; + size_t i; if ((r=nr_reg_is_valid(parent))) ABORT(r); if (*child == '.') ABORT(R_BAD_ARGS); clen = strlen(child);
--- a/media/mtransport/third_party/nrappkit/src/registry/registrycb.c +++ b/media/mtransport/third_party/nrappkit/src/registry/registrycb.c @@ -96,17 +96,17 @@ nr_reg_cb_init() } return(_status); } int nr_reg_validate_action(char action) { int _status; - int i; + size_t i; for (i = 0; i < sizeof(CB_ACTIONS); ++i) { if (action == CB_ACTIONS[i]) return 0; } ABORT(R_BAD_ARGS); _status=0; @@ -392,17 +392,17 @@ nr_reg_raise_event(char *name, int actio /* PUBLIC METHODS */ int NR_reg_register_callback(NR_registry name, char action, void (*cb)(void *cb_arg, char action, NR_registry name), void *cb_arg) { int r, _status; - int i; + size_t i; for (i = 0; i < sizeof(CB_ACTIONS); ++i) { if (action & CB_ACTIONS[i]) { if ((r=nr_reg_register_callback(name, CB_ACTIONS[i], cb, cb_arg))) ABORT(r); action &= ~(CB_ACTIONS[i]); } @@ -415,17 +415,17 @@ NR_reg_register_callback(NR_registry nam abort: return(_status); } int NR_reg_unregister_callback(char *name, char action, void (*cb)(void *cb_arg, char action, NR_registry name)) { int r, _status; - int i; + size_t i; for (i = 0; i < sizeof(CB_ACTIONS); ++i) { if (action & CB_ACTIONS[i]) { if ((r=nr_reg_unregister_callback(name, CB_ACTIONS[i], cb))) ABORT(r); action &= ~(CB_ACTIONS[i]); }
--- a/media/mtransport/third_party/nrappkit/src/util/hex.c +++ b/media/mtransport/third_party/nrappkit/src/util/hex.c @@ -46,48 +46,50 @@ static char *RCSSTRING __UNUSED__ ="$Id: #include "hex.h" #include "r_log.h" static char bin2hex_map[][3] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff" }; static int hex2bin_map[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 /* '0' */, 1 /* '1' */, 2 /* '2' */, 3 /* '3' */, 4 /* '4' */, 5 /* '5' */, 6 /* '6' */, 7 /* '7' */, 8 /* '8' */, 9 /* '9' */, -1, -1, -1, -1, -1, -1, -1, 10 /* 'A' */, 11 /* 'B' */, 12 /* 'C' */, 13 /* 'D' */, 14 /* 'E' */, 15 /* 'F' */, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10 /* 'a' */, 11 /* 'b' */, 12 /* 'c' */, 13 /* 'd' */, 14 /* 'e' */, 15 /* 'f' */, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; int -nr_nbin2hex(UCHAR *bin, int binlen, char hex[], size_t size, int *len) +nr_nbin2hex(UCHAR *bin, size_t binlen, char hex[], size_t size, size_t *len) { int _status; - int i; + size_t i; + size_t hexlen; - if (size < (2*binlen)) + hexlen = 2*binlen; + if (size < hexlen) ABORT(R_BAD_ARGS); for (i = 0; i < binlen; ++i) { *hex++ = bin2hex_map[bin[i]][0]; *hex++ = bin2hex_map[bin[i]][1]; } - if (size >= (2*binlen)+1) + if (size >= hexlen+1) *hex = '\0'; - *len = (2*binlen); + *len = hexlen; _status=0; abort: return(_status); } int -nr_nhex2bin(char *hex, int hexlen, UCHAR bin[], size_t size, int *len) +nr_nhex2bin(char *hex, size_t hexlen, UCHAR bin[], size_t size, size_t *len) { int _status; - int binlen; + size_t binlen; int h1; int h2; - int i; + size_t i; if (hexlen % 2) ABORT(R_BAD_ARGS); binlen = hexlen/2; if (size < binlen) ABORT(R_BAD_ARGS);
--- a/media/mtransport/third_party/nrappkit/src/util/hex.h +++ b/media/mtransport/third_party/nrappkit/src/util/hex.h @@ -35,13 +35,13 @@ briank@network-resonance.com */ #ifndef _hex_h #define _hex_h -int nr_nbin2hex(UCHAR *bin, int binlen, char hex[], size_t size, int *len); -int nr_nhex2bin(char *hex, int hexlen, UCHAR bin[], size_t size, int *len); +int nr_nbin2hex(UCHAR *bin, size_t binlen, char hex[], size_t size, size_t *len); +int nr_nhex2bin(char *hex, size_t hexlen, UCHAR bin[], size_t size, size_t *len); #endif
--- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.c +++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_errors.c @@ -106,17 +106,17 @@ int nr_verr_exit(char *fmt,...) exit(1); } char * nr_strerror(int errnum) { static char unknown_error[256]; - int i; + size_t i; char *error = 0; for (i = 0; i < sizeof(errors)/sizeof(*errors); ++i) { if (errnum == errors[i].errnum) { error = errors[i].str; break; } }
--- a/package-lock.json +++ b/package-lock.json @@ -175,17 +175,17 @@ "chardet": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=" }, "circular-json": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==" + "integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=" }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "requires": { "restore-cursor": "2.0.0" } @@ -269,17 +269,17 @@ "pify": "2.3.0", "pinkie-promise": "2.0.1", "rimraf": "2.6.2" } }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "integrity": "sha1-XNAfwQFiG0LEzX9dGmYkNxbT850=", "requires": { "esutils": "2.0.2" } }, "dom-serializer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", @@ -859,17 +859,17 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "requires": { "pinkie": "2.0.4" } }, "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==" + "integrity": "sha1-KYuJ34uTsCIdv0Ia0rGx6iP8Z3c=" }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, "process-nextick-args": { "version": "2.0.0", @@ -926,17 +926,17 @@ "requires": { "onetime": "2.0.1", "signal-exit": "3.0.2" } }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", "requires": { "glob": "7.1.2" } }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", @@ -970,17 +970,17 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" + "integrity": "sha1-3Eu8emyp2Rbe5dQ1FvAJK1j3uKs=" }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "requires": { "shebang-regex": "1.0.0" } @@ -1071,17 +1071,17 @@ "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", "requires": { "os-tmpdir": "1.0.2" } }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", @@ -1097,17 +1097,17 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "requires": { "isexe": "2.0.0" } }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="