Bug 825927 Patch 1: Fix log message formats r=ekr
authorAdam Roach [:abr] <adam@nostrum.com>
Wed, 23 Jan 2013 16:33:20 -0600
changeset 120372 e228c4f5d681f59124226f071aa0fcf6ae86a5cf
parent 120371 01b9474f522ce2b381be96544e94efbaa872d8fa
child 120373 c4887bfe1e9a0c7221ac9156ae23a65f90e7c62e
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr
bugs825927
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 825927 Patch 1: Fix log message formats r=ekr
media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
media/mtransport/third_party/nICEr/src/ice/ice_component.c
media/mtransport/third_party/nICEr/src/stun/addrs.c
media/mtransport/third_party/nICEr/src/stun/stun_codec.c
media/mtransport/third_party/nrappkit/src/registry/registrycb.c
media/mtransport/third_party/nrappkit/src/util/p_buf.c
media/mtransport/third_party/nrappkit/src/util/util.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
@@ -396,17 +396,17 @@ int nr_ice_candidate_pair_start(nr_ice_p
     return(_status);
   }
 
 
 int nr_ice_candidate_pair_do_triggered_check(nr_ice_peer_ctx *pctx, nr_ice_cand_pair *pair)
   {
     int r,_status;
 
-    r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): triggered check on %s",pctx,pair->as_string);
+    r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): triggered check on %s",pctx->label,pair->as_string);
 
     switch(pair->state){
       case NR_ICE_PAIR_STATE_FROZEN:
         nr_ice_candidate_pair_set_state(pctx,pair,NR_ICE_PAIR_STATE_WAITING);
         /* Fall through */
       case NR_ICE_PAIR_STATE_WAITING:
         /* Start the checks */
         if(r=nr_ice_candidate_pair_start(pctx,pair))
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -228,17 +228,17 @@ int nr_ice_component_initialize(struct n
       STAILQ_INSERT_TAIL(&component->sockets,isock,entry);
     }
     isock=0;
 
 
     /* count the candidates that will be initialized */
     cand=TAILQ_FIRST(&component->candidates);
     if(!cand){
-      r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): couldn't create any valid candidates");
+      r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): couldn't create any valid candidates",ctx->label);
       ABORT(R_NOT_FOUND);
     }
 
     while(cand){
       ctx->uninitialized_candidates++;
       cand=TAILQ_NEXT(cand,entry_comp);
     }
 
@@ -392,17 +392,17 @@ static int nr_ice_component_stun_server_
     }
 
     /* Find the candidate pair that this maps to */
     if(r=nr_socket_getaddr(sock,&local_addr)) {
       *error=500;
       ABORT(r);
     }
 
-    r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): This STUN request appears to map to local addr",comp->stream->pctx->label,local_addr.as_string);
+    r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): This STUN request appears to map to local addr %s",comp->stream->pctx->label,local_addr.as_string);
 
     pair=TAILQ_FIRST(&comp->stream->check_list);
     while(pair){
       component_id_matched = 0;
       local_addr_matched = 0;
       remote_addr_matched = 0;
 
       if(pair->remote->component->component_id!=comp->component_id)
--- a/media/mtransport/third_party/nICEr/src/stun/addrs.c
+++ b/media/mtransport/third_party/nICEr/src/stun/addrs.c
@@ -185,17 +185,17 @@ stun_grab_addrs(char *name, int addrcoun
         case AF_INET6:
             UNIMPLEMENTED;
             break;
         }
 
         addrcount--;
 
         if (*count >= maxaddrs) {
-            r_log(NR_LOG_STUN, LOG_WARNING, "Address list truncated at %d out of entries", maxaddrs, maxaddrs+addrcount);
+            r_log(NR_LOG_STUN, LOG_WARNING, "Address list truncated at %d out of %d entries", maxaddrs, maxaddrs+addrcount);
             break;
         }
 
         ifam = (struct ifa_msghdr *)((char *)ifam + ifam->ifam_msglen);
     }
 
     _status = 0;
   abort:
--- a/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
+++ b/media/mtransport/third_party/nICEr/src/stun/stun_codec.c
@@ -85,49 +85,49 @@ nr_stun_attr_codec_fingerprint_decode(nr
 
 
 int
 nr_stun_encode_htons(UINT2 data, int buflen, UCHAR *buf, int *offset)
 {
    UINT2 d = htons(data);
 
    if (*offset + sizeof(d) >= buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d >= %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd >= %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&buf[*offset], &d, sizeof(d));
    *offset += sizeof(d);
 
    return 0;
 }
 
 int
 nr_stun_encode_htonl(UINT4 data, int buflen, UCHAR *buf, int *offset)
 {
    UINT4 d = htonl(data);
 
    if (*offset + sizeof(d) > buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d > %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd > %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&buf[*offset], &d, sizeof(d));
    *offset += sizeof(d);
 
    return 0;
 }
 
 int
 nr_stun_encode_htonll(UINT8 data, int buflen, UCHAR *buf, int *offset)
 {
    UINT8 d = htonll(data);
 
    if (*offset + sizeof(d) > buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d > %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd > %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&buf[*offset], &d, sizeof(d));
    *offset += sizeof(d);
 
    return 0;
 }
@@ -148,51 +148,51 @@ nr_stun_encode(UCHAR *data, int length, 
 
 
 int
 nr_stun_decode_htons(UCHAR *buf, int buflen, int *offset, UINT2 *data)
 {
    UINT2 d;
 
    if (*offset + sizeof(d) > buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d > %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd > %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&d, &buf[*offset], sizeof(d));
    *offset += sizeof(d);
    *data = htons(d);
 
    return 0;
 }
 
 int
 nr_stun_decode_htonl(UCHAR *buf, int buflen, int *offset, UINT4 *data)
 {
    UINT4 d;
 
    if (*offset + sizeof(d) > buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d > %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd > %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&d, &buf[*offset], sizeof(d));
    *offset += sizeof(d);
    *data = htonl(d);
 
    return 0;
 }
 
 int
 nr_stun_decode_htonll(UCHAR *buf, int buflen, int *offset, UINT8 *data)
 {
    UINT8 d;
 
    if (*offset + sizeof(d) > buflen) {
-      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %d > %d", *offset, sizeof(d), buflen);
+      r_log(NR_LOG_STUN, LOG_WARNING, "Attempted buffer overrun: %d + %zd > %d", *offset, sizeof(d), buflen);
       return R_BAD_DATA;
    }
 
    memcpy(&d, &buf[*offset], sizeof(d));
    *offset += sizeof(d);
    *data = htonll(d);
 
    return 0;
@@ -224,17 +224,17 @@ nr_stun_attr_string_illegal(nr_stun_attr
         ABORT(R_FAILED);
     }
 
     if (max_chars >= 0) {
         if (mbslen(s, &nchars)) {
             /* who knows what to do, just assume everything is working ok */
         }
         else if (nchars > max_chars) {
-            r_log(NR_LOG_STUN, LOG_WARNING, "%s is too large: %d characters", attr_info->name, nchars);
+            r_log(NR_LOG_STUN, LOG_WARNING, "%s is too large: %zd characters", attr_info->name, nchars);
             ABORT(R_FAILED);
         }
     }
 
     _status = 0;
   abort:
     return _status;
 }
@@ -916,17 +916,17 @@ nr_stun_attr_codec_string_decode(nr_stun
     if (nr_stun_decode(attrlen, buf, buflen, &offset, (UCHAR*)result))
         ABORT(R_FAILED);
     result[attrlen] = '\0'; /* just to be nice */
 
     if (strlen(result) != 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) {
-            r_log(NR_LOG_STUN, LOG_WARNING, "Error in string: %d/%d", strlen(result), attrlen);
+            r_log(NR_LOG_STUN, LOG_WARNING, "Error in string: %zd/%d", strlen(result), attrlen);
             ABORT(R_FAILED);
         }
     }
 
     _status = 0;
   abort:
     return _status;
 }
@@ -1047,17 +1047,17 @@ nr_stun_attr_codec_xor_mapped_address_en
     /* this needs to be the magic cookie in the header and not
      * the MAGIC_COOKIE constant because if we're talking to
      * older servers (that don't have a magic cookie) they use
      * message ID for this */
     magic_cookie = ntohl(header->magic_cookie);
 
     nr_stun_xor_mapped_address(magic_cookie, &xor_mapped_address->unmasked, &xor_mapped_address->masked);
 
-    r_log(NR_LOG_STUN, LOG_DEBUG, "Masked XOR-MAPPED-ADDRESS = %s", &xor_mapped_address->masked.as_string);
+    r_log(NR_LOG_STUN, LOG_DEBUG, "Masked XOR-MAPPED-ADDRESS = %s", xor_mapped_address->masked.as_string);
 
     if (nr_stun_attr_codec_addr.encode(attr_info, &xor_mapped_address->masked, offset, buflen, buf, attrlen))
         return R_FAILED;
 
     return 0;
 }
 
 static int
--- a/media/mtransport/third_party/nrappkit/src/registry/registrycb.c
+++ b/media/mtransport/third_party/nrappkit/src/registry/registrycb.c
@@ -173,17 +173,17 @@ nr_reg_register_callback(NR_registry nam
 
     if (create_info) {
       if ((r=r_assoc_insert(assoc, (char*)cb_id, SIZEOF_CB_ID, info, 0, nr_reg_info_free, R_ASSOC_NEW)))
         ABORT(r);
     }
 
     _status=0;
   abort:
-    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "register callback %X on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
+    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "register callback %p on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
 
     if (_status) {
       if (create_info && info) RFREE(info);
       if (create_assoc && assoc) nr_reg_assoc_destroy(&assoc);
     }
     return(_status);
 }
 
@@ -226,17 +226,17 @@ nr_reg_unregister_callback(char *name, c
       if (size == 0) {
         if ((r=r_assoc_delete(nr_registry_callbacks, name, strlen(name)+1)))
           ABORT(r);
       }
     }
 
     _status=0;
   abort:
-    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "unregister callback %X on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
+    r_log(NR_LOG_REGISTRY, LOG_DEBUG, "unregister callback %p on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded"));
 
     return(_status);
 }
 
 int
 compute_cb_id(void *cb, char action, unsigned char cb_id[SIZEOF_CB_ID])
 {
    /* callbacks are identified by the pointer to the cb function plus
@@ -318,25 +318,25 @@ nr_reg_raise_event_recurse(char *name, c
           if (r == R_EOD)
             break;
           else
             ABORT(r);
         }
 
         if (info->action == action) {
           r_log(NR_LOG_REGISTRY, LOG_DEBUG,
-                "Invoking callback %X for '%s'",
+                "Invoking callback %p for '%s'",
                 info->cb,
                 nr_reg_action_name(info->action));
 
           (void)info->cb(info->cb_arg, action, name);
         }
         else {
           r_log(NR_LOG_REGISTRY, LOG_DEBUG,
-                "Skipping callback %X for '%s'",
+                "Skipping callback %p for '%s'",
                 info->cb,
                 nr_reg_action_name(info->action));
         }
       }
     }
 
     if (strlen(tmp) > 0) {
         c = strrchr(tmp, '.');
--- a/media/mtransport/third_party/nrappkit/src/util/p_buf.c
+++ b/media/mtransport/third_party/nrappkit/src/util/p_buf.c
@@ -171,17 +171,17 @@ int nr_p_buf_write_to_chain(ctx,chain,da
 
       towrite=MIN(len,(buf->size-(buf->length+buf->r_offset)));
 
       memcpy(buf->data+buf->length+buf->r_offset,data,towrite);
       len-=towrite;
       data+=towrite;
       buf->length+=towrite;
 
-      r_log(LOG_COMMON,LOG_DEBUG,"Wrote %d bytes to buffer %d",towrite,buf);
+      r_log(LOG_COMMON,LOG_DEBUG,"Wrote %d bytes to buffer %p",towrite,buf);
       buf=0;
     }
 
     _status=0;
   abort:
     return(_status);
   }
 
--- a/media/mtransport/third_party/nrappkit/src/util/util.c
+++ b/media/mtransport/third_party/nrappkit/src/util/util.c
@@ -380,22 +380,22 @@ int nr_reg_uint4_fetch_and_check(NR_regi
     UINT4 my_val;
 
     if(r=NR_reg_get_uint4(key,&my_val)){
       r_log(log_fac,LOG_ERR,"Couldn't get key '%s', error %d",key,r);
       ABORT(r);
     }
 
     if((min>0) && (my_val<min)){
-      r_log(log_fac,LOG_ERR,"Invalid value for key '%s'=%lu, (min = %lu)",key,my_val,min);
+      r_log(log_fac,LOG_ERR,"Invalid value for key '%s'=%lu, (min = %lu)",key,(unsigned long)my_val,(unsigned long)min);
       ABORT(R_BAD_DATA);
     }
 
     if(my_val>max){
-      r_log(log_fac,LOG_ERR,"Invalid value for key '%s'=%lu, (max = %lu)",key,my_val,max);
+      r_log(log_fac,LOG_ERR,"Invalid value for key '%s'=%lu, (max = %lu)",key,(unsigned long)my_val,(unsigned long)max);
       ABORT(R_BAD_DATA);
     }
 
     *val=my_val;
     _status=0;
 
   abort:
     if(die && _status){