Changeset 3510

Show
Ignore:
Timestamp:
05/05/08 15:00:01 (7 months ago)
Author:
ludovic.rousseau
Message:

Use size_t instead of int when needed, plus some other minor changes

Patch bug.1 included in Ticket #176

Location:
trunk/src
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/libopensc/muscle-filesystem.h

    r3080 r3510  
    5252} mscfs_t; 
    5353 
    54 mscfs_t *mscfs_new(); 
     54mscfs_t *mscfs_new(void); 
    5555void mscfs_free(mscfs_t *fs); 
    5656void mscfs_clear_cache(mscfs_t* fs); 
  • trunk/src/libopensc/muscle.c

    r3148 r3510  
    317317{ 
    318318        assert(buffer); 
    319         assert(bufferLength >= pinLength); 
     319        assert(bufferLength >= (size_t)pinLength); 
    320320        assert(pinLength <= MSC_MAX_PIN_LENGTH); 
    321321 
     
    361361{ 
    362362        assert(buffer); 
    363         assert(bufferLength >= pukLength); 
     363        assert(bufferLength >= (size_t)pukLength); 
    364364        assert(pukLength <= MSC_MAX_PIN_LENGTH); 
    365365 
     
    407407        assert(newPinLength <= MSC_MAX_PIN_LENGTH); 
    408408        assert(buffer); 
    409         assert(bufferLength >= pinLength + newPinLength + 2); 
     409        assert(bufferLength >= pinLength + newPinLength + 2UL); 
    410410 
    411411        truncatePinNulls(pinValue, &pinLength); 
     
    807807                        size_t outputDataLength) 
    808808{ 
    809         int left = dataLength; 
     809        size_t left = dataLength; 
    810810        const u8* inPtr = data; 
    811811        u8* outPtr = outputData; 
  • trunk/src/pkcs11/framework-pkcs15.c

    r3439 r3510  
    264264{ 
    265265        int found = 0; 
    266         int ii=0; 
     266        unsigned int ii=0; 
    267267 
    268268        while(ii<num_objects && !found) { 
  • trunk/src/pkcs11/openssl.c

    r3405 r3510  
    137137{ 
    138138        EVP_MD_CTX      *md_ctx = DIGEST_CTX(op); 
    139         unsigned int    len = *pulDigestLen; 
    140  
    141         if (len < EVP_MD_CTX_size(md_ctx)) { 
     139        CK_ULONG        len = *pulDigestLen; 
     140 
     141        if (len < (CK_ULONG)EVP_MD_CTX_size(md_ctx)) { 
    142142                *pulDigestLen = EVP_MD_CTX_size(md_ctx); 
    143143                return CKR_BUFFER_TOO_SMALL; 
  • trunk/src/pkcs11/pkcs11-display.c

    r3405 r3510  
    714714void print_slot_info(FILE *f, CK_SLOT_INFO *info) 
    715715{ 
    716   int            i; 
     716  size_t i; 
    717717  enum_specs ck_flags[] = { 
    718718    { CKF_TOKEN_PRESENT    , "CKF_TOKEN_PRESENT                " }, 
     
    900900void print_session_info(FILE *f, CK_SESSION_INFO *info) 
    901901{ 
    902   int            i; 
     902  size_t i; 
    903903  enum_specs ck_flags[] = { 
    904904    { CKF_RW_SESSION     , "CKF_RW_SESSION                   " }, 
  • trunk/src/scconf/parse.c

    r3405 r3510  
    151151        switch (parser.current_item->type) { 
    152152        case SCCONF_ITEM_TYPE_COMMENT: 
    153                 parser.current_item->value.comment = strdup((char *) data); 
     153                parser.current_item->value.comment = strdup((const char *) data); 
    154154                break; 
    155155        case SCCONF_ITEM_TYPE_BLOCK: 
  • trunk/src/scconf/sclex.c

    r1686 r3510  
    9393} 
    9494 
    95 static void buf_eat_till(BUFHAN * bp, char start, char *end) 
     95static void buf_eat_till(BUFHAN * bp, char start, const char *end) 
    9696{ 
    9797        int i; 
  • trunk/src/signer/dialog.c

    r3183 r3510  
    3737{ 
    3838        int r; 
     39        size_t len; 
    3940        const char *argv[3]; 
    4041        const char *pgmname = PIN_ENTRY; 
     
    7980                        goto err; 
    8081                } 
    81                 r = strlen(buf); 
    82                 if (r < pinfo->min_length) { 
     82                len = strlen(buf); 
     83                if (len < pinfo->min_length) { 
    8384                        sprintf(errtext, "PIN code too short, min. %lu digits", (unsigned long) pinfo->min_length); 
    8485                        continue; 
    8586                } 
    86                 if (r > pinfo->max_length) { 
     87                if (len > pinfo->max_length) { 
    8788                        sprintf(errtext, "PIN code too long, max. %lu digits", (unsigned long) pinfo->max_length); 
    8889                        continue; 
  • trunk/src/signer/opensc-crypto.h

    r459 r3510  
    1414}; 
    1515 
    16 extern RSA_METHOD * sc_get_method(); 
     16extern RSA_METHOD * sc_get_method(void); 
    1717 
    1818#endif 
  • trunk/src/tests/print.c

    r3183 r3510  
    9696{ 
    9797        int i; 
     98        size_t j; 
    9899        const char *usages[] = 
    99100        { 
     
    132133        if (prkey->path.len) { 
    133134                printf("\tPath        : "); 
    134                 for (i = 0; i < prkey->path.len; i++) 
    135                         printf("%02X", prkey->path.value[i]); 
     135                for (j = 0; j < prkey->path.len; j++) 
     136                        printf("%02X", prkey->path.value[j]); 
    136137                if (prkey->path.type == SC_PATH_TYPE_PATH_PROT) 
    137138                        printf(" (protected)"); 
     
    144145{ 
    145146        int i; 
     147        size_t j; 
    146148        const char *usages[] = 
    147149        { 
     
    179181        printf("\tNative      : %s\n", pubkey->native ? "yes" : "no"); 
    180182        printf("\tPath        : "); 
    181         for (i = 0; i < pubkey->path.len; i++) 
    182                 printf("%02X", pubkey->path.value[i]); 
     183        for (j = 0; j < pubkey->path.len; j++) 
     184                printf("%02X", pubkey->path.value[j]); 
    183185        printf("\n"); 
    184186        printf("\tID          : %s\n", sc_pkcs15_print_id(&pubkey->id)); 
  • trunk/src/tests/sc-test.h

    r3182 r3510  
    1414 
    1515int sc_test_init(int *argc, char *argv[]); 
    16 void sc_test_cleanup(); 
     16void sc_test_cleanup(void); 
    1717void sc_test_print_card(const sc_pkcs15_card_t *); 
    1818void sc_test_print_object(const struct sc_pkcs15_object *); 
  • trunk/src/tools/opensc-explorer.c

    r3405 r3510  
    130130        } else { 
    131131                /* file id */ 
    132                 int buf[2]; 
     132                unsigned int buf[2]; 
    133133                u8 cbuf[2]; 
    134134         
     
    535535                goto usage; 
    536536        /* %z isn't supported everywhere */ 
    537         if (sscanf(argv[1], "%d", &size) != 1) 
     537        if (sscanf(argv[1], "%u", &size) != 1) 
    538538                goto usage; 
    539539        file = sc_file_new(); 
     
    565565        if (arg_to_path(argv[0], &path, 1) != 0) 
    566566                goto usage; 
    567         if (sscanf(argv[1], "%d", &size) != 1) 
     567        if (sscanf(argv[1], "%u", &size) != 1) 
    568568                goto usage; 
    569569        file = sc_file_new(); 
  • trunk/src/tools/piv-tool.c

    r3405 r3510  
    122122                der = malloc(derlen); 
    123123                if (der == NULL) { 
    124                         printf("file %s is too big, %d\n", cert_file, derlen); 
     124                        printf("file %s is too big, %lu\n", 
     125                                cert_file, (unsigned long)derlen); 
    125126                        return-1 ; 
    126127                } 
  • trunk/src/tools/pkcs15-init.c

    r3405 r3510  
    108108static void     read_options_file(const char *); 
    109109static void     ossl_print_errors(void); 
    110 static void set_userpin_ref(); 
     110static void set_userpin_ref(void); 
    111111 
    112112