Changeset 1201


Ignore:
Timestamp:
2012-12-17T14:22:49+01:00 (19 months ago)
Author:
moo
Message:

fix some 64bit warnings

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/devel/run

    r1193 r1201  
    171171    phpize --clean \ 
    172172    && phpize \ 
    173     && CFLAGS="-g -O0 $pedanti -Wno-variadic-macros -Wno-long-long -Wall -Wno-unused-parameter -Wno-unused-function -W -Wshadow -Werror=implicit-function-declaration -std=c89 -D_GNU_SOURCE -D_POSIX_SOURCE -Dinline=" ./configure \ 
     173    && CFLAGS="-g -O0 $pedantic -Wno-variadic-macros -Wno-long-long -Wall -Wno-unused-parameter -Wno-unused-function -W -Wshadow -Werror=implicit-function-declaration -Wconversion -std=c89 -D_GNU_SOURCE -D_POSIX_SOURCE -Dinline=" ./configure \ 
    174174        --enable-xcache-cacher \ 
    175175        --enable-xcache-optimizer \ 
  • trunk/mod_cacher/xc_cache.h

    r1188 r1201  
    155155    time_t file_mtime; 
    156156    size_t file_size; 
    157     int file_device; 
    158     int file_inode; 
    159  
    160     int    filepath_len; 
     157    size_t file_device; 
     158    size_t file_inode; 
     159 
     160    size_t filepath_len; 
    161161    ZEND_24(NOTHING, const) char *filepath; 
    162     int    dirpath_len; 
     162    size_t dirpath_len; 
    163163    char  *dirpath; 
    164164#ifdef IS_UNICODE 
  • trunk/mod_cacher/xc_cacher.c

    r1199 r1201  
    411411    time_t n = XG(request_time) / interval; 
    412412    if (*curtime != n) { 
    413         zend_uint target_slot = n % count; 
     413        zend_uint target_slot = ((zend_uint) n) % count; 
    414414        zend_uint slot; 
    415415        for (slot = advance_wrapped(*curslot, count); 
     
    449449{ 
    450450    xc_entry_t *p, **pp; 
    451     int i, c; 
     451    size_t i, c; 
    452452 
    453453    for (i = 0, c = cache->hentry->size; i < c; i ++) { 
     
    517517static void xc_gc_expires_var(TSRMLS_D) /* {{{ */ 
    518518{ 
    519     int i, c; 
     519    size_t i, c; 
    520520 
    521521    if (!xc_var_gc_interval || !xc_var_caches) { 
     
    736736{ 
    737737    zval* list; 
    738     int i, c; 
     738    size_t i, c; 
    739739    xc_entry_t *e; 
    740740 
     
    934934    char *tokbuf; 
    935935    size_t path_buffer_len; 
    936     int size; 
     936    size_t size; 
    937937    char tokens[] = { DEFAULT_DIR_SEPARATOR, '\0' }; 
    938938    int ret; 
     
    969969    if (zend_is_executing(TSRMLS_C)) { 
    970970        const char *executing_filename = zend_get_executed_filename(TSRMLS_C); 
    971         int dirname_len = strlen(executing_filename); 
     971        int dirname_len = (int) strlen(executing_filename); 
    972972        size_t filename_len = strlen(filepath); 
    973973 
     
    10661066 
    10671067    compiler->new_entry.entry.name.str.val = xc_expand_url(filepath, compiler->opened_path_buffer TSRMLS_CC); 
    1068     compiler->new_entry.entry.name.str.len = strlen(compiler->new_entry.entry.name.str.val); 
     1068    compiler->new_entry.entry.name.str.len = (int) strlen(compiler->new_entry.entry.name.str.val); 
    10691069 
    10701070    *entry_checker_data->stored_entry = (xc_entry_php_t *) xc_entry_find_unlocked( 
     
    11441144    else { 
    11451145#ifdef ZEND_ENGINE_2_3 
    1146         char *opened_path = php_resolve_path(compiler->filename, compiler->filename_len, PG(include_path) TSRMLS_CC); 
     1146        char *opened_path = php_resolve_path(compiler->filename, (int) compiler->filename_len, PG(include_path) TSRMLS_CC); 
    11471147        if (opened_path) { 
    11481148            strcpy(compiler->opened_path_buffer, opened_path); 
     
    11821182 
    11831183        delta = XG(request_time) - buf.st_mtime; 
    1184         if (abs(delta) < 2 && !xc_test) { 
     1184        if (abs((int) delta) < 2 && !xc_test) { 
    11851185            return FAILURE; 
    11861186        } 
     
    12141214            ++basename_begin; 
    12151215 
    1216             basename_hash_value = HASH_STR_L(basename_begin, filename_end - basename_begin); 
     1216            basename_hash_value = HASH_STR_L(basename_begin, (uint) (filename_end - basename_begin)); 
    12171217        } 
    12181218 
     
    12541254 
    12551255    PHP_MD5Init(&context); 
    1256     while ((n = php_stream_read(stream, (char *) buf, sizeof(buf))) > 0) { 
     1256    while ((n = php_stream_read(stream, (char *) buf, (int) sizeof(buf))) > 0) { 
    12571257        PHP_MD5Update(&context, buf, n); 
    12581258    } 
  • trunk/mod_coverager/xc_coverager.c

    r1151 r1201  
    4040} 
    4141/* }}} */ 
    42 static void xcache_mkdirs_ex(char *root, int rootlen, char *path, int pathlen TSRMLS_DC) /* {{{ */ 
     42static void xcache_mkdirs_ex(char *root, long rootlen, char *path, long pathlen TSRMLS_DC) /* {{{ */ 
    4343{ 
    4444    char *fullpath; 
     
    7676    long covlines, *phits; 
    7777    int fd = -1; 
    78     int size; 
     78    size_t size; 
    7979    int newfile; 
    8080    struct stat srcstat, outstat; 
     
    277277    zstr s; 
    278278    char *outfilename; 
    279     int dumpdir_len, outfilelen, alloc_len = 0; 
     279    size_t dumpdir_len, outfilelen, alloc_len = 0; 
    280280    uint size; 
    281281    HashPosition pos; 
     
    334334                zend_hash_move_forward_ex(cov, &pos2); 
    335335            } 
    336             add_assoc_zval_ex(return_value, ZSTR_S(filename), strlen(ZSTR_S(filename)) + 1, lines); 
     336            add_assoc_zval_ex(return_value, ZSTR_S(filename), (uint) strlen(ZSTR_S(filename)) + 1, lines); 
    337337 
    338338            zend_hash_move_forward_ex(XG(coverages), &pos); 
     
    357357static coverager_t xc_coverager_get(const char *filename TSRMLS_DC) /* {{{ */ 
    358358{ 
    359     int len = strlen(filename) + 1; 
     359    uint len = (uint) strlen(filename) + 1; 
    360360    coverager_t cov, *pcov; 
    361361 
     
    473473    if (XG(coverages) && XG(coverager_started)) { 
    474474        int size = xc_coverager_get_op_array_size_no_tail(op_array); 
    475         int oplineno = (*EG(opline_ptr)) - op_array->opcodes; 
     475        int oplineno = (int) ((*EG(opline_ptr)) - op_array->opcodes); 
    476476        if (oplineno < size) { 
    477477            xc_coverager_add_hits(xc_coverager_get(op_array->filename TSRMLS_CC), (*EG(opline_ptr))->lineno, 1 TSRMLS_CC); 
     
    498498 
    499499    p = (long*) str; 
    500     len -= sizeof(long); 
     500    len -= (int) sizeof(long); 
    501501    if (len < 0) { 
    502502        return; 
     
    507507    } 
    508508 
    509     for (; len >= (int) sizeof(long) * 2; len -= sizeof(long) * 2, p += 2) { 
     509    for (; len >= (int) sizeof(long) * 2; len -= (int) sizeof(long) * 2, p += 2) { 
    510510        add_index_long(return_value, p[0], p[1] < 0 ? 0 : p[1]); 
    511511    } 
     
    658658 
    659659    if (cfg_get_string("xcache.coveragedump_directory", &xc_coveragedump_dir) == SUCCESS && xc_coveragedump_dir) { 
    660         int len; 
     660        size_t len; 
    661661        xc_coveragedump_dir = pestrdup(xc_coveragedump_dir, 1); 
    662662        len = strlen(xc_coveragedump_dir); 
  • trunk/processor/hashtable.m4

    r932 r1201  
    7272        dnl only used for copy 
    7373        IFCOPY(`uint n;') 
    74         IFCALCCOPY(`int bucketsize;') 
     74        IFCALCCOPY(`size_t bucketsize;') 
    7575 
    7676#if defined(HARDENING_PATCH_HASH_PROTECT) && HARDENING_PATCH_HASH_PROTECT 
  • trunk/processor/head.m4

    r1135 r1201  
    8989struct _xc_processor_t { 
    9090    char *p; 
    91     zend_uint size; 
     91    size_t size; 
    9292    HashTable strings; 
    9393    HashTable zvalptrs; 
     
    159159#endif 
    160160/* {{{ xc_zstrlen_char */ 
    161 static inline int xc_zstrlen_char(const_zstr s) 
     161static inline size_t xc_zstrlen_char(const_zstr s) 
    162162{ 
    163163    return strlen(ZSTR_S(s)); 
     
    166166#ifdef IS_UNICODE 
    167167/* {{{ xc_zstrlen_uchar */ 
    168 static inline int xc_zstrlen_uchar(zstr s) 
     168static inline size_t xc_zstrlen_uchar(zstr s) 
    169169{ 
    170170    return u_strlen(ZSTR_U(s)); 
     
    172172/* }}} */ 
    173173/* {{{ xc_zstrlen */ 
    174 static inline int xc_zstrlen(int type, const_zstr s) 
     174static inline size_t xc_zstrlen(int type, const_zstr s) 
    175175{ 
    176176    return type == IS_UNICODE ? xc_zstrlen_uchar(s) : xc_zstrlen_char(s); 
     
    192192static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) { 
    193193    pushdef(`__LINE__', `relayline') 
    194     int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
     194    size_t realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
    195195    long dummy = 1; 
    196196 
     
    198198        ALLOC(, char, realsize) 
    199199    } 
    200     else if (zend_u_hash_add(&processor->strings, type, str, size, (void *) &dummy, sizeof(dummy), NULL) == SUCCESS) { 
     200    else if (zend_u_hash_add(&processor->strings, type, str, (uint) size, (void *) &dummy, sizeof(dummy), NULL) == SUCCESS) { 
    201201        /* new string */ 
    202202        ALLOC(, char, realsize) 
     
    214214static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) { 
    215215    pushdef(`__LINE__', `relayline') 
    216     int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
     216    size_t realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
    217217    zstr ret, *pret; 
    218218 
     
    223223    } 
    224224 
    225     if (zend_u_hash_find(&processor->strings, type, str, size, (void **) &pret) == SUCCESS) { 
     225    if (zend_u_hash_find(&processor->strings, type, str, (uint) size, (void **) &pret) == SUCCESS) { 
    226226        return *pret; 
    227227    } 
     
    230230    ALLOC(ZSTR_V(ret), char, realsize) 
    231231    memcpy(ZSTR_V(ret), ZSTR_V(str), realsize); 
    232     zend_u_hash_add(&processor->strings, type, str, size, (void *) &ret, sizeof(zstr), NULL); 
     232    zend_u_hash_add(&processor->strings, type, str, (uint) size, (void *) &ret, sizeof(zstr), NULL); 
    233233    return ret; 
    234234 
     
    239239 * return class_index + 1 
    240240 */ 
    241 static zend_ulong xc_get_class_num(xc_processor_t *processor, zend_class_entry *ce) { 
    242     zend_ulong i; 
     241static zend_uint xc_get_class_num(xc_processor_t *processor, zend_class_entry *ce) { 
     242    zend_uint i; 
    243243    const xc_entry_data_php_t *php = processor->php_src; 
    244244    zend_class_entry *ceptr; 
     
    357357/* {{{ field name checker */ 
    358358IFAUTOCHECK(`dnl 
    359 static int xc_check_names(const char *file, int line, const char *functionName, const char **assert_names, int assert_names_count, HashTable *done_names) 
     359static int xc_check_names(const char *file, int line, const char *functionName, const char **assert_names, size_t assert_names_count, HashTable *done_names) 
    360360{ 
    361361    int errors = 0; 
    362362    if (assert_names_count) { 
    363         int i; 
     363        size_t i; 
    364364        Bucket *b; 
    365365 
    366366        for (i = 0; i < assert_names_count; ++i) { 
    367             if (!zend_u_hash_exists(done_names, IS_STRING, assert_names[i], strlen(assert_names[i]) + 1)) { 
     367            if (!zend_u_hash_exists(done_names, IS_STRING, assert_names[i], (uint) strlen(assert_names[i]) + 1)) { 
    368368                fprintf(stderr 
    369369                    , "Error: missing field at %s `#'%d %s`' : %s\n" 
  • trunk/processor/main.m4

    r1132 r1201  
    207207dnl {{{ DONE_* 
    208208define(`DONE_SIZE', `IFAUTOCHECK(`dnl 
    209     xc_autocheck_done_size += $1`'; 
     209    xc_autocheck_done_size += (int) $1`'; 
    210210    xc_autocheck_done_count ++; 
    211211')') 
  • trunk/processor/processor.m4

    r1196 r1201  
    11781178    PROCESS(time_t, file_mtime) 
    11791179    PROCESS(size_t, file_size) 
    1180     PROCESS(int, file_device) 
    1181     PROCESS(int, file_inode) 
    1182  
    1183     PROCESS(int, filepath_len) 
     1180    PROCESS(size_t, file_device) 
     1181    PROCESS(size_t, file_inode) 
     1182 
     1183    PROCESS(size_t, filepath_len) 
    11841184    IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)') 
    1185     PROCESS(int, dirpath_len) 
     1185    PROCESS(size_t, dirpath_len) 
    11861186    IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)') 
    11871187#ifdef IS_UNICODE 
  • trunk/xcache.c

    r1182 r1201  
    248248        if (name) { 
    249249            /* RETURN_STRING */ 
    250             int len = strlen(name); 
     250            int len = (int) strlen(name); 
    251251            return_value->value.str.len = len; 
    252252            return_value->value.str.val = estrndup(name, len); 
     
    754754        char *env; 
    755755        if ((env = getenv("XCACHE_TEST")) != NULL) { 
    756             xc_test = atoi(env); 
     756            xc_test = (zend_bool) atoi(env); 
    757757        } 
    758758    } 
Note: See TracChangeset for help on using the changeset viewer.