Bug 1307958 - -Werror=sign-compare in ./media subdirectory draft
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Sat, 09 Nov 2019 10:59:54 +0900
changeset 81064 c9f0a1c73aa991348c0cc39dd66386f2e854c3db
parent 81063 7a6ed8d4c68b2ca7f30bdb4f4452d126fec9568c
child 81065 9547b7a1d2bb1ec854775bb969e643f7099e8e9f
push id9744
push userishikawa@yk.rim.or.jp
push dateSat, 09 Nov 2019 02:01:06 +0000
treeherdertry-comm-central@56c83244ac0e [default view] [failures only]
bugs1307958
Bug 1307958 - -Werror=sign-compare in ./media subdirectory
mozilla-M-C-002-media-sign-compare.patch
new file mode 100644
--- /dev/null
+++ b/mozilla-M-C-002-media-sign-compare.patch
@@ -0,0 +1,588 @@
+# HG changeset patch
+# User ISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
+# Parent  3f8d20e797dd1f618651ef3b2b6306aecb0b9d21
+Bug 1307958 - -Werror=sign-compare in ./media subdirectory
+* * *
+gcc signed vs unsiged warning
+* * *
+sign vs unsigned compare fix. Some warnings are treated as errors by gcc and its options.
+
+diff --git a/media/libjpeg/jdphuff.c b/media/libjpeg/jdphuff.c
+--- a/media/libjpeg/jdphuff.c
++++ b/media/libjpeg/jdphuff.c
+@@ -206,22 +206,22 @@ start_pass_phuff_decoder(j_decompress_pt
+  * On some machines, a shift and add will be faster than a table lookup.
+  */
+ 
+ #define AVOID_TABLES
+ #ifdef AVOID_TABLES
+ 
+ #define NEG_1  ((unsigned)-1)
+ #define HUFF_EXTEND(x, s) \
+-  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
++        ((x) < (unsigned) (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
+ 
+ #else
+ 
+ #define HUFF_EXTEND(x, s) \
+-  ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
++        ((x) < (unsigned) extend_test[s] ? (x) + extend_offset[s] : (x))
+ 
+ static const int extend_test[16] = {   /* entry n is 2**(n-1) */
+   0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+   0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
+ };
+ 
+ static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
+   0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
+@@ -335,17 +335,17 @@ decode_mcu_DC_first(j_decompress_ptr cin
+ 
+       /* Decode a single block's worth of coefficients */
+ 
+       /* Section F.2.2.1: decode the DC coefficient difference */
+       HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
+       if (s) {
+         CHECK_BIT_BUFFER(br_state, s, return FALSE);
+         r = GET_BITS(s);
+-        s = HUFF_EXTEND(r, s);
++        s = HUFF_EXTEND((unsigned) r, s);
+       }
+ 
+       /* Convert DC difference to actual value, update last_dc_val */
+       if ((state.last_dc_val[ci] >= 0 &&
+            s > INT_MAX - state.last_dc_val[ci]) ||
+           (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
+         ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+       s += state.last_dc_val[ci];
+@@ -412,17 +412,17 @@ decode_mcu_AC_first(j_decompress_ptr cin
+       for (k = cinfo->Ss; k <= Se; k++) {
+         HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
+         r = s >> 4;
+         s &= 15;
+         if (s) {
+           k += r;
+           CHECK_BIT_BUFFER(br_state, s, return FALSE);
+           r = GET_BITS(s);
+-          s = HUFF_EXTEND(r, s);
++          s = HUFF_EXTEND((unsigned) r, s);
+           /* Scale and output coefficient in natural (dezigzagged) order */
+           (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
+         } else {
+           if (r == 15) {        /* ZRL */
+             k += 15;            /* skip 15 zeroes in band */
+           } else {              /* EOBr, run length is 2^r + appended bits */
+             EOBRUN = 1 << r;
+             if (r) {            /* EOBr, r > 0 */
+diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_build.c b/media/mtransport/third_party/nICEr/src/stun/stun_build.c
+--- a/media/mtransport/third_party/nICEr/src/stun/stun_build.c
++++ b/media/mtransport/third_party/nICEr/src/stun/stun_build.c
+@@ -317,17 +317,17 @@ nr_stun_compute_lt_message_integrity_pas
+     if (!__isascii(password->data[i]))
+       ABORT(R_BAD_DATA);
+   }
+ 
+   if (hmac_key->len < 16)
+     ABORT(R_BAD_ARGS);
+ 
+   snprintf(digest_input, sizeof(digest_input), "%s:%s:", username, realm);
+-  if ((sizeof(digest_input) - strlen(digest_input)) < password->len)
++  if ((sizeof(digest_input) - strlen(digest_input)) < (size_t) password->len)
+     ABORT(R_BAD_DATA);
+ 
+   len = strlen(digest_input);
+   memcpy(digest_input + len, password->data, password->len);
+ 
+ 
+   if (r=nr_crypto_md5((UCHAR *)digest_input, len + password->len, hmac_key->data))
+     ABORT(r);
+diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.c b/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.c
+--- a/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.c
++++ b/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.c
+@@ -232,20 +232,21 @@ static void nr_stun_client_timer_expired
+     if(ctx->state==NR_STUN_CLIENT_STATE_CANCELLED)
+       ABORT(R_REJECTED);
+ 
+     gettimeofday(&now, 0);
+     if (r_timeval_diff_ms(&now, &ctx->timer_set, &ms_waited)) {
+         r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Timer expired",ctx->label);
+     }
+     else {
+-        r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Timer expired (after %llu ms)",ctx->label, ms_waited);
++        r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Timer expired (after %llu ms)",ctx->label,
++              (long long unsigned) ms_waited);
+     }
+ 
+-    if (ctx->request_ct >= ctx->maximum_transmits) {
++    if ((int) ctx->request_ct >= (int) ctx->maximum_transmits) {
+         r_log(NR_LOG_STUN,LOG_INFO,"STUN-CLIENT(%s): Timed out",ctx->label);
+         ctx->state=NR_STUN_CLIENT_STATE_TIMED_OUT;
+         ABORT(R_FAILED);
+     }
+ 
+     if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING)
+         ABORT(R_NOT_PERMITTED);
+ 
+@@ -277,17 +278,17 @@ static void nr_stun_client_timer_expired
+ 
+ int nr_stun_client_force_retransmit(nr_stun_client_ctx *ctx)
+   {
+     int r,_status;
+ 
+     if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING)
+         ABORT(R_NOT_PERMITTED);
+ 
+-    if (ctx->request_ct > ctx->maximum_transmits) {
++    if ((int) ctx->request_ct > (int) ctx->maximum_transmits) {
+         r_log(NR_LOG_STUN,LOG_INFO,"STUN-CLIENT(%s): Too many retransmit attempts",ctx->label);
+         ABORT(R_FAILED);
+     }
+ 
+     /* if there is a scheduled retransimt, get rid of the scheduled retransmit
+      * and retransmit immediately */
+     if (ctx->timer_handle) {
+         NR_async_timer_cancel(ctx->timer_handle);
+@@ -400,17 +401,17 @@ static int nr_stun_client_send_request(n
+ 
+     ctx->request_ct++;
+ 
+     if (NR_STUN_GET_TYPE_CLASS(ctx->request->header.type) == NR_CLASS_INDICATION) {
+         /* no need to set the timer because indications don't receive a
+          * response */
+     }
+     else {
+-        if (ctx->request_ct >= ctx->maximum_transmits) {
++            if ((int) ctx->request_ct >= (int) ctx->maximum_transmits) {
+           /* Reliable transport only get here once. Unreliable get here for
+            * their final timeout. */
+           ctx->timeout_ms += ctx->maximum_transmits_timeout_ms;
+         }
+         else if (ctx->timeout_ms) {
+           /* exponential backoff */
+           ctx->timeout_ms *= ctx->retransmission_backoff_factor;
+         }
+diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_codec.c b/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
+--- a/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
++++ b/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
+@@ -649,17 +649,17 @@ nr_stun_attr_codec_error_code_decode(nr_
+      || nr_stun_decode(1, buf, buflen, &offset, &number))
+         ABORT(R_FAILED);
+ 
+     result->number = (class * 100) + number;
+ 
+     size_reason = attrlen - 4;
+ 
+     /* -1 because the string will be null terminated */
+-    if (size_reason > (sizeof(result->reason) - 1)) {
++    if (size_reason > (signed) (sizeof(result->reason) - 1)) {
+         r_log(NR_LOG_STUN, LOG_WARNING, "Reason is too large, truncating");
+         /* don't fail, but instead truncate the reason */
+         size_reason = sizeof(result->reason) - 1;
+     }
+ 
+     if (nr_stun_decode(size_reason, buf, buflen, &offset, (UCHAR*)result->reason))
+         ABORT(R_FAILED);
+     result->reason[size_reason] = '\0';
+@@ -727,17 +727,17 @@ nr_stun_attr_codec_fingerprint_decode(nr
+     /* the length must include the FINGERPRINT attribute when computing
+      * the fingerprint */
+     length = offset;  /* right before FINGERPRINT */
+     length -= sizeof(*header); /* remove header length */
+     length += 8;  /* add length of Fingerprint */
+     header->length = htons(length);
+ 
+     /* make sure FINGERPRINT is final attribute in message */
+-    if (length + sizeof(*header) != buflen) {
++    if (length + sizeof(*header) != (unsigned) buflen) {
+         r_log(NR_LOG_STUN, LOG_WARNING, "Fingerprint is not final attribute in message");
+         ABORT(R_FAILED);
+     }
+ 
+     if (r_crc32((char*)buf, offset, &checksum)) {
+         r_log(NR_LOG_STUN, LOG_WARNING, "Unable to compute fingerprint");
+         ABORT(R_FAILED);
+     }
+@@ -983,20 +983,20 @@ nr_stun_attr_codec_string_decode(nr_stun
+         r_log(NR_LOG_STUN, LOG_WARNING, "String is too large: %d bytes", attrlen);
+         ABORT(R_FAILED);
+     }
+ 
+     if (nr_stun_decode(attrlen, buf, buflen, &offset, (UCHAR*)result))
+         ABORT(R_FAILED);
+     result[attrlen] = '\0'; /* just to be nice */
+ 
+-    if (strlen(result) != attrlen) {
++    if (strlen(result) != (unsigned) attrlen) {
+         /* stund 0.96 sends a final null in the Server attribute, so
+          * only error if the null appears anywhere else in a string */
+-        if (strlen(result) != attrlen-1) {
++        if (strlen(result) != (unsigned) attrlen-1) {
+             r_log(NR_LOG_STUN, LOG_WARNING, "Error in string: %zd/%d", strlen(result), attrlen);
+             ABORT(R_FAILED);
+         }
+     }
+ 
+     _status = 0;
+   abort:
+     return _status;
+@@ -1412,17 +1412,17 @@ nr_stun_decode_message(nr_stun_message *
+     nr_stun_attr_info *attr_info;
+     Data *password;
+ 
+     r_log(NR_LOG_STUN, LOG_DEBUG, "Parsing STUN message of %d bytes", msg->length);
+ 
+     if (!TAILQ_EMPTY(&msg->attributes))
+         ABORT(R_BAD_ARGS);
+ 
+-    if (sizeof(nr_stun_message_header) > msg->length) {
++    if ((int) sizeof(nr_stun_message_header) > msg->length) {
+        r_log(NR_LOG_STUN, LOG_WARNING, "Message too small");
+        ABORT(R_FAILED);
+     }
+ 
+     memcpy(&msg->header, msg->buffer, sizeof(msg->header));
+     msg->header.type = ntohs(msg->header.type);
+     msg->header.length = ntohs(msg->header.length);
+     msg->header.magic_cookie = ntohl(msg->header.magic_cookie);
+@@ -1432,17 +1432,17 @@ nr_stun_decode_message(nr_stun_message *
+     if (msg->name)
+         r_log(NR_LOG_STUN, LOG_DEBUG, "Parsed MsgType: %s", msg->name);
+     else
+         r_log(NR_LOG_STUN, LOG_DEBUG, "Parsed MsgType: 0x%03x", msg->header.type);
+     r_log(NR_LOG_STUN, LOG_DEBUG, "Parsed Length: %d", msg->header.length);
+     r_log(NR_LOG_STUN, LOG_DEBUG, "Parsed Cookie: %08x", msg->header.magic_cookie);
+     r_dump(NR_LOG_STUN, LOG_DEBUG, "Parsed ID", (void*)&msg->header.id, sizeof(msg->header.id));
+ 
+-    if (msg->header.length + sizeof(msg->header) != msg->length) {
++    if ((msg->header.length + sizeof(msg->header)) != msg->length) {
+        r_log(NR_LOG_STUN, LOG_WARNING, "Inconsistent message header length: %d/%d",
+                                         msg->header.length, msg->length);
+        ABORT(R_FAILED);
+     }
+ 
+     size = msg->header.length;
+ 
+     if ((size % 4) != 0) {
+@@ -1486,17 +1486,17 @@ nr_stun_decode_message(nr_stun_message *
+             r_log(NR_LOG_STUN, LOG_INFO, "Unrecognized attribute: 0x%04x", attr->type);
+         }
+         else {
+             attr_info->name = attr_info->name;
+             attr->type_name = attr_info->codec->name;
+ 
+             if (attr->type == NR_STUN_ATTR_MESSAGE_INTEGRITY) {
+                 if (get_password && get_password(arg, msg, &password) == 0) {
+-                    if (password->len > sizeof(attr->u.message_integrity.password)) {
++                        if (password->len > (int) sizeof(attr->u.message_integrity.password)) {
+                         r_log(NR_LOG_STUN, LOG_WARNING, "Password too long: %d bytes", password->len);
+                         ABORT(R_FAILED);
+                     }
+ 
+                     memcpy(attr->u.message_integrity.password, password->data, password->len);
+                     attr->u.message_integrity.passwordlen = password->len;
+                 }
+                 else {
+diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_hint.c b/media/mtransport/third_party/nICEr/src/stun/stun_hint.c
+--- a/media/mtransport/third_party/nICEr/src/stun/stun_hint.c
++++ b/media/mtransport/third_party/nICEr/src/stun/stun_hint.c
+@@ -58,17 +58,17 @@ nr_is_stun_message(UCHAR *buf, size_t le
+ #if 0
+    nr_stun_message msg;
+ #endif
+    UINT2 type;
+    nr_stun_encoded_attribute* attr;
+    unsigned int attrLen;
+    int atrType;
+ 
+-   if (sizeof(nr_stun_message_header) > len)
++   if ((int) sizeof(nr_stun_message_header) > len)
+        return 0;
+ 
+    if ((buf[0] & (0x80|0x40)) != 0)
+        return 0;
+ 
+    memcpy(&type, buf, 2);
+    type = ntohs(type);
+ 
+diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_msg.c b/media/mtransport/third_party/nICEr/src/stun/stun_msg.c
+--- a/media/mtransport/third_party/nICEr/src/stun/stun_msg.c
++++ b/media/mtransport/third_party/nICEr/src/stun/stun_msg.c
+@@ -217,17 +217,17 @@ NR_STUN_MESSAGE_ADD_ATTRIBUTE(
+     {}
+ )
+ 
+ int
+ nr_stun_message_add_message_integrity_attribute(nr_stun_message *msg, Data *password)
+ NR_STUN_MESSAGE_ADD_ATTRIBUTE(
+     NR_STUN_ATTR_MESSAGE_INTEGRITY,
+     {
+-        if (sizeof(attr->u.message_integrity.password) < password->len)
++       if ( (int) sizeof(attr->u.message_integrity.password) < password->len)
+             ABORT(R_BAD_DATA);
+ 
+         memcpy(attr->u.message_integrity.password, password->data, password->len);
+         attr->u.message_integrity.passwordlen = password->len;
+     }
+ )
+ 
+ int
+diff --git a/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c b/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
+--- a/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
++++ b/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
+@@ -892,18 +892,18 @@ int nr_turn_client_parse_data_indication
+     ABORT(r);
+   }
+ #endif
+ 
+   if (!nr_stun_message_has_attribute(ind, NR_STUN_ATTR_DATA, &attr)) {
+     ABORT(R_BAD_DATA);
+   }
+ 
+-  assert(newsize >= attr->u.data.length);
+-  if (newsize < attr->u.data.length)
++  assert((int) newsize >= (int) attr->u.data.length);
++  if ((int) newsize < (int) attr->u.data.length)
+     ABORT(R_BAD_ARGS);
+ 
+   memcpy(newmsg, attr->u.data.data, attr->u.data.length);
+   *newlen = attr->u.data.length;
+ 
+   _status=0;
+ abort:
+   nr_stun_message_destroy(&ind);
+diff --git a/media/mtransport/third_party/nrappkit/src/registry/c2ru.c b/media/mtransport/third_party/nrappkit/src/registry/c2ru.c
+--- a/media/mtransport/third_party/nrappkit/src/registry/c2ru.c
++++ b/media/mtransport/third_party/nrappkit/src/registry/c2ru.c
+@@ -231,17 +231,17 @@ nr_c2ru_get_children(NR_registry parent,
+   if ((r=nr_c2ru_make_registry(parent, child, registry)))
+     ABORT(r);
+ 
+   if ((r=NR_reg_get_child_count(registry, &count))) {
+     if (r != R_NOT_FOUND)
+       ABORT(r);
+   }
+   else {
+-    for (i = 0; i < count; ++i) {
++          for (i = 0; (unsigned) i < count; ++i) {
+       if ((r=NR_reg_get_child_registry(registry, i, name))) {
+         /* ignore R_NOT_FOUND errors */
+         if (r == R_NOT_FOUND)
+           continue;
+         else
+           ABORT(r);
+       }
+ 
+diff --git a/media/mtransport/third_party/nrappkit/src/registry/registry.c b/media/mtransport/third_party/nrappkit/src/registry/registry.c
+--- a/media/mtransport/third_party/nrappkit/src/registry/registry.c
++++ b/media/mtransport/third_party/nrappkit/src/registry/registry.c
+@@ -354,17 +354,17 @@ nr_reg_compute_type(char *typename, int 
+     assert(!strcasecmp(typenames[NR_REG_TYPE_UINT8],    "UINT8"));
+     assert(!strcasecmp(typenames[NR_REG_TYPE_DOUBLE],   "double"));
+     assert(!strcasecmp(typenames[NR_REG_TYPE_BYTES],    "Data"));
+     assert(!strcasecmp(typenames[NR_REG_TYPE_STRING],   "string"));
+     assert(!strcasecmp(typenames[NR_REG_TYPE_REGISTRY], "registry"));
+     assert(sizeof(typenames)/sizeof(*typenames) == (NR_REG_TYPE_REGISTRY+1));
+ #endif
+ 
+-    for (i = 0; i < sizeof(typenames)/sizeof(*typenames); ++i) {
++    for (i = 0; (unsigned) i < sizeof(typenames)/sizeof(*typenames); ++i) {
+       if (!strcasecmp(typenames[i], typename)) {
+         *type = i;
+         return 0;
+       }
+     }
+     ABORT(R_BAD_ARGS);
+ 
+     _status=0;
+@@ -571,17 +571,17 @@ NR_reg_make_registry(NR_registry parent,
+ 
+     if (*child == '.')
+         ABORT(R_BAD_ARGS);
+ 
+     clen = strlen(child);
+     if (!clen)
+         ABORT(R_BAD_ARGS);
+     plen = strlen(parent);
+-    if ((plen + clen + 2) > sizeof(NR_registry))
++    if ((plen + clen + 2) > (int) sizeof(NR_registry))
+         ABORT(R_BAD_ARGS);
+ 
+     if (out != parent)
+         strcpy(out, parent);
+ 
+     c = &(out[plen]);
+ 
+     if (parent[0] != '\0') {
+diff --git a/media/mtransport/third_party/nrappkit/src/registry/registry_local.c b/media/mtransport/third_party/nrappkit/src/registry/registry_local.c
+--- a/media/mtransport/third_party/nrappkit/src/registry/registry_local.c
++++ b/media/mtransport/third_party/nrappkit/src/registry/registry_local.c
+@@ -485,20 +485,20 @@ nr_reg_alloc_node_data(char *name, nr_re
+       break;
+     case NR_REG_TYPE_INT4:
+       snprintf(s, len, "%d", ((nr_scalar_registry_node*)node)->scalar._nr_int4);
+       break;
+     case NR_REG_TYPE_UINT4:
+       snprintf(s, len, "%u", ((nr_scalar_registry_node*)node)->scalar._nr_uint4);
+       break;
+     case NR_REG_TYPE_INT8:
+-      snprintf(s, len, "%lld", ((nr_scalar_registry_node*)node)->scalar._nr_int8);
++            snprintf(s, len, "%lld", (long long int) ((nr_scalar_registry_node*)node)->scalar._nr_int8);
+       break;
+     case NR_REG_TYPE_UINT8:
+-      snprintf(s, len, "%llu", ((nr_scalar_registry_node*)node)->scalar._nr_uint8);
++            snprintf(s, len, "%llu", (long long unsigned int) ((nr_scalar_registry_node*)node)->scalar._nr_uint8);
+       break;
+     case NR_REG_TYPE_DOUBLE:
+       snprintf(s, len, "%#f", ((nr_scalar_registry_node*)node)->scalar._double);
+       break;
+     case NR_REG_TYPE_REGISTRY:
+       snprintf(s, len, "%s", name);
+       break;
+     case NR_REG_TYPE_BYTES:
+diff --git a/media/mtransport/third_party/nrappkit/src/util/hex.c b/media/mtransport/third_party/nrappkit/src/util/hex.c
+--- a/media/mtransport/third_party/nrappkit/src/util/hex.c
++++ b/media/mtransport/third_party/nrappkit/src/util/hex.c
+@@ -83,17 +83,17 @@ nr_nhex2bin(char *hex, size_t hexlen, UC
+     int h2;
+     size_t i;
+ 
+     if (hexlen % 2)
+         ABORT(R_BAD_ARGS);
+ 
+     binlen = hexlen/2;
+ 
+-    if (size < binlen)
++    if (size < (size_t) binlen)
+         ABORT(R_BAD_ARGS);
+ 
+     for (i = 0; i < binlen; ++i) {
+         h1 = hex2bin_map[(int)*hex++];
+         h2 = hex2bin_map[(int)*hex++];
+ 
+         if (h1 == -1 || h2 == -1)
+             ABORT(R_BAD_ARGS);
+diff --git a/media/webrtc/trunk/third_party/gflags/src/gflags_reporting.cc b/media/webrtc/trunk/third_party/gflags/src/gflags_reporting.cc
+--- a/media/webrtc/trunk/third_party/gflags/src/gflags_reporting.cc
++++ b/media/webrtc/trunk/third_party/gflags/src/gflags_reporting.cc
+@@ -129,17 +129,17 @@ string DescribeOneFlag(const CommandLine
+   SStringPrintf(&main_part, "    -%s (%s)",
+                 flag.name.c_str(),
+                 flag.description.c_str());
+   const char* c_string = main_part.c_str();
+   int chars_left = static_cast<int>(main_part.length());
+   string final_string = "";
+   int chars_in_line = 0;  // how many chars in current line so far?
+   while (1) {
+-    assert(chars_left == strlen(c_string));  // Unless there's a \0 in there?
++    assert(chars_left == (int) strlen(c_string));  // Unless there's a \0 in there?
+     const char* newline = strchr(c_string, '\n');
+     if (newline == NULL && chars_in_line+chars_left < kLineLength) {
+       // The whole remainder of the string fits on this line
+       final_string += c_string;
+       chars_in_line += chars_left;
+       break;
+     }
+     if (newline != NULL && newline - c_string < kLineLength - chars_in_line) {
+diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/logging/apm_data_dumper.h b/media/webrtc/trunk/webrtc/modules/audio_processing/logging/apm_data_dumper.h
+--- a/media/webrtc/trunk/webrtc/modules/audio_processing/logging/apm_data_dumper.h
++++ b/media/webrtc/trunk/webrtc/modules/audio_processing/logging/apm_data_dumper.h
+@@ -121,17 +121,17 @@ class ApmDataDumper {
+ #endif
+   }
+ 
+   void DumpRaw(const char* name, size_t v_length, const bool* v) {
+ #if WEBRTC_APM_DEBUG_DUMP == 1
+     if (rtc::LogMessage::aec_debug()) {
+       FILE* file = GetRawFile(name);
+       if (file) {
+-        for (int k = 0; k < v_length; ++k) {
++        for (size_t k = 0; k < v_length; ++k) {
+           int16_t value = static_cast<int16_t>(v[k]);
+           fwrite(&value, sizeof(value), 1, file);
+         }
+       }
+     }
+ #endif
+   }
+ 
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc
+@@ -178,17 +178,17 @@ DesktopDeviceInfoImpl::~DesktopDeviceInf
+ }
+ 
+ int32_t DesktopDeviceInfoImpl::getDisplayDeviceCount() {
+   return desktop_display_list_.size();
+ }
+ 
+ int32_t DesktopDeviceInfoImpl::getDesktopDisplayDeviceInfo(int32_t nIndex,
+                                                            DesktopDisplayDevice & desktopDisplayDevice) {
+-  if(nIndex < 0 || nIndex >= desktop_display_list_.size()) {
++  if(nIndex < 0 || (unsigned) nIndex >= desktop_display_list_.size()) {
+     return -1;
+   }
+ 
+   std::map<intptr_t,DesktopDisplayDevice*>::iterator iter = desktop_display_list_.begin();
+   std::advance (iter, nIndex);
+   DesktopDisplayDevice * pDesktopDisplayDevice = iter->second;
+   if(pDesktopDisplayDevice) {
+     desktopDisplayDevice = (*pDesktopDisplayDevice);
+@@ -197,17 +197,17 @@ int32_t DesktopDeviceInfoImpl::getDeskto
+   return 0;
+ }
+ 
+ int32_t DesktopDeviceInfoImpl::getWindowCount() {
+   return desktop_window_list_.size();
+ }
+ int32_t DesktopDeviceInfoImpl::getWindowInfo(int32_t nIndex,
+                                              DesktopDisplayDevice &windowDevice) {
+-  if (nIndex < 0 || nIndex >= desktop_window_list_.size()) {
++  if (nIndex < 0 || (unsigned) nIndex >= desktop_window_list_.size()) {
+     return -1;
+   }
+ 
+   std::map<intptr_t, DesktopDisplayDevice *>::iterator itr = desktop_window_list_.begin();
+   std::advance(itr, nIndex);
+   DesktopDisplayDevice * pWindow = itr->second;
+   if (!pWindow) {
+     return -1;
+@@ -218,17 +218,17 @@ int32_t DesktopDeviceInfoImpl::getWindow
+ }
+ 
+ int32_t DesktopDeviceInfoImpl::getApplicationCount() {
+   return desktop_application_list_.size();
+ }
+ 
+ int32_t DesktopDeviceInfoImpl::getApplicationInfo(int32_t nIndex,
+                                                   DesktopApplication & desktopApplication) {
+-  if(nIndex < 0 || nIndex >= desktop_application_list_.size()) {
++  if(nIndex < 0 || (unsigned) nIndex >= desktop_application_list_.size()) {
+     return -1;
+   }
+ 
+   std::map<intptr_t,DesktopApplication*>::iterator iter = desktop_application_list_.begin();
+   std::advance (iter, nIndex);
+   DesktopApplication * pDesktopApplication = iter->second;
+   if (pDesktopApplication) {
+     desktopApplication = (*pDesktopApplication);
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.cc
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.cc
+@@ -75,17 +75,17 @@ void DesktopDeviceInfoX11::InitializeApp
+       }
+ 
+       unsigned int processId = window_util_x11.GetWindowProcessID(app_window);
+       // filter out non-process
+       if (processId == 0) {
+         continue;
+       }
+       // filter out current process
+-      if (processId == getpid()) {
++      if ((pid_t) processId == getpid()) {
+         continue;
+       }
+ 
+       // filter out existing applications, after incrementing its window count
+       DesktopApplicationList::iterator itr = desktop_application_list_.find(processId);
+       if (itr != desktop_application_list_.end()) {
+         itr->second->setWindowCount(itr->second->getWindowCount() + 1);
+         continue;