Navigation


Changeset 1027:0117a7746b21 in freeDiameter for libfdproto


Ignore:
Timestamp:
Apr 15, 2013, 4:17:07 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Fix a number of errors and warnings introduced/highlighted by recent commits

Location:
libfdproto
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/dictionary.c

    r979 r1027  
    3535
    3636#include "fdproto-internal.h"
     37#include <inttypes.h>
    3738
    3839/* Names of the base types */
     
    11791180                                        n = enumval->enum_value.os.len;
    11801181                                for (i=0; i < n; i++)
    1181                                         fd_log_debug("0x%02.2X/'%c' ", enumval->enum_value.os.data[i], ASCII(enumval->enum_value.os.data[i]));
     1182                                        fd_log_debug("0x%02hhX/'%c' ", enumval->enum_value.os.data[i], ASCII(enumval->enum_value.os.data[i]));
    11821183                                if (n == LEN_MAX)
    11831184                                        fd_log_debug("...");
     
    11901191
    11911192                case AVP_TYPE_INTEGER64:
    1192                         fd_log_debug("%lli", enumval->enum_value.i64);
     1193                        fd_log_debug(PRId64, enumval->enum_value.i64);
    11931194                        break;
    11941195
     
    11981199
    11991200                case AVP_TYPE_UNSIGNED64:
    1200                         fd_log_debug("%llu", enumval->enum_value.u64);
     1201                        fd_log_debug(PRIu64, enumval->enum_value.u64);
    12011202                        break;
    12021203
  • libfdproto/log.c

    r990 r1027  
    166166                        fd_log_debug("(Thread '%s' renamed to '%s')", (char *)val, name?:"(nil)");
    167167                } else {
    168                         fd_log_debug("(Thread %p named '%s')", pthread_self(), name?:"(nil)");
     168                        fd_log_debug("(Thread %p named '%s')", (void *)pthread_self(), name?:"(nil)");
    169169                }
    170170        }
  • libfdproto/messages.c

    r1014 r1027  
    15171517static int bufferize_msg(unsigned char * buffer, size_t buflen, size_t * offset, struct msg * msg)
    15181518{
    1519         TRACE_ENTRY("%p %d %p %p", buffer, buflen, offset, msg);
     1519        TRACE_ENTRY("%p %zd %p %p", buffer, buflen, offset, msg);
    15201520       
    15211521        if ((buflen - *offset) < GETMSGHDRSZ())
     
    15521552        struct dict_avp_data dictdata;
    15531553       
    1554         TRACE_ENTRY("%p %d %p %p", buffer, buflen, offset, avp);
     1554        TRACE_ENTRY("%p %zd %p %p", buffer, buflen, offset, avp);
    15551555       
    15561556        if ((buflen - *offset) < avp->avp_public.avp_len)
     
    16491649        struct fd_list * avpch;
    16501650       
    1651         TRACE_ENTRY("%p %d %p %p", buffer, buflen, offset, list);
     1651        TRACE_ENTRY("%p %zd %p %p", buffer, buflen, offset, list);
    16521652       
    16531653        for (avpch = list->next; avpch != list; avpch = avpch->next) {
     
    17121712        size_t offset = 0;
    17131713       
    1714         TRACE_ENTRY("%p %d %p", buf, buflen, head);
     1714        TRACE_ENTRY("%p %zd %p", buf, buflen, head);
    17151715       
    17161716        while (offset < buflen) {
     
    17181718               
    17191719                if (buflen - offset < AVPHDRSZ_NOVEND) {
    1720                         TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes", buflen - offset);
     1720                        TRACE_DEBUG(INFO, "truncated buffer: remaining only %zd bytes", buflen - offset);
    17211721                        return EBADMSG;
    17221722                }
     
    17361736                if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) {
    17371737                        if (buflen - offset < 4) {
    1738                                 TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for vendor and data", buflen - offset);
     1738                                TRACE_DEBUG(INFO, "truncated buffer: remaining only %zd bytes for vendor and data", buflen - offset);
    17391739                                free(avp);
    17401740                                return EBADMSG;
     
    17471747                if ( (avp->avp_public.avp_len > GETAVPHDRSZ(avp->avp_public.avp_flags))
    17481748                && (buflen - offset < avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags))) {
    1749                         TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for data, and avp data size is %d",
     1749                        TRACE_DEBUG(INFO, "truncated buffer: remaining only %zd bytes for data, and avp data size is %d",
    17501750                                        buflen - offset,
    17511751                                        avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags));
     
    17751775        unsigned char * buf;
    17761776       
    1777         TRACE_ENTRY("%p %d %p", buffer, buflen, msg);
     1777        TRACE_ENTRY("%p %zd %p", buffer, buflen, msg);
    17781778       
    17791779        CHECK_PARAMS(  buffer &&  *buffer  &&  msg  &&  (buflen >= GETMSGHDRSZ())  );
     
    17891789        msglen = ntohl(*(uint32_t *)buf) & 0x00ffffff;
    17901790        if ( buflen < msglen ) { 
    1791                 TRACE_DEBUG(INFO, "Truncated message (%d / %d)", buflen, msglen );
     1791                TRACE_DEBUG(INFO, "Truncated message (%zd / %d)", buflen, msglen );
    17921792                free(buf);
    17931793                return EBADMSG;
  • libfdproto/ostr.c

    r1022 r1027  
    170170                }
    171171                /* otherwise, we just display the hex code */
    172                 TRACE_DEBUG(INFO, "Invalid character (0x%hhX) at offset %d in DiameterIdentity '%.*s'", os[i], i+1, ossz, os);
     172                TRACE_DEBUG(INFO, "Invalid character (0x%hhX) at offset %d in DiameterIdentity '%.*s'", os[i], i+1, (int)ossz, os);
    173173                return 0;
    174174disp:
    175                 TRACE_DEBUG(INFO, "Invalid character '%.*s' at offset %d in DiameterIdentity '%.*s'", nb, os + i, i+1, ossz, os);
     175                TRACE_DEBUG(INFO, "Invalid character '%.*s' at offset %d in DiameterIdentity '%.*s'", nb, os + i, i+1, (int)ossz, os);
    176176                return 0;
    177177        }
     
    291291        /* Remaining of URI marker */
    292292        if (memcmp( uri + offset, "://", 3)) {
    293                 TRACE_DEBUG(INFO, "Invalid DiameterURI prefix: got '%.*s', expected 'aaa://' or 'aaas://'", offset + 3, uri);
     293                TRACE_DEBUG(INFO, "Invalid DiameterURI prefix: got '%.*s', expected 'aaa://' or 'aaas://'", (int)offset + 3, uri);
    294294                return EINVAL;
    295295        }
     
    380380                }
    381381               
    382                 TRACE_DEBUG(INFO, "Invalid DiameterURI: transport string is not recognized ('%.*s').", urisz - offset, uri + offset);
     382                TRACE_DEBUG(INFO, "Invalid DiameterURI: transport string is not recognized ('%.*s').", (int)(urisz - offset), uri + offset);
    383383                return EINVAL;
    384384        }
     
    417417                }
    418418               
    419                 TRACE_DEBUG(INFO, "Invalid DiameterURI: protocol string is not recognized ('%.*s').", urisz - offset, uri + offset);
     419                TRACE_DEBUG(INFO, "Invalid DiameterURI: protocol string is not recognized ('%.*s').", (int)(urisz - offset), uri + offset);
    420420                return EINVAL;
    421421               
     
    425425                return 0; /* Finished */
    426426       
    427         TRACE_DEBUG(INFO, "Invalid DiameterURI: final part of string is not recognized ('%.*s').", urisz - offset, uri + offset);
     427        TRACE_DEBUG(INFO, "Invalid DiameterURI: final part of string is not recognized ('%.*s').", (int)(urisz - offset), uri + offset);
    428428        return EINVAL;
    429429}
  • libfdproto/sessions.c

    r979 r1027  
    523523        int ret;
    524524       
    525         TRACE_ENTRY("%p %d %p %p", sid, len, session, new);
     525        TRACE_ENTRY("%p %zd %p %p", sid, len, session, new);
    526526        CHECK_PARAMS( sid && session );
    527527       
    528528        if (!fd_os_is_valid_os0(sid,len)) {
    529                 TRACE_DEBUG(INFO, "Warning: a Session-Id value contains \\0 chars... (len:%zd, begin:'%.*s') => Debug messages may be truncated.", len, len, sid);
     529                TRACE_DEBUG(INFO, "Warning: a Session-Id value contains \\0 chars... (len:%zd, begin:'%.*s') => Debug messages may be truncated.", len, (int)len, sid);
    530530        }
    531531       
Note: See TracChangeset for help on using the changeset viewer.