Changeset 840 in svn


Ignore:
Timestamp:
2012-03-25T04:51:51+02:00 (3 years ago)
Author:
Xuefer
Message:

copy md5 digest correctly in notmemcpy mode

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/dispatch.m4

    r662 r840  
    2424    , `$1', `xc_entry_type_t',  `PROC_INT(`$2', `d',  `$1')'
    2525    , `$1', `xc_hash_value_t',  `PROC_INT(`$2', `lu', `$1')'
    26     , `$1', `xc_md5sum_t',      `/* is copying enough? */COPY(`$2')'
     26    , `$1', `xc_md5sum_t',      `COPY(`$2')'
    2727    , `', `', `m4_errprint(`Unknown type "$1"')'
    2828    )
     
    3939                ifelse(
    4040                    `$2', `zend_bool', `add_assoc_bool_ex(arr, ZEND_STRS("$3"), src->$3[i] ? 1 : 0);'
    41                 , `', `', `add_assoc_long_ex(arr, ZEND_STRS("$3"), src->$3[i]);')
     41                , `', `', `add_next_index_long(arr, src->$3[i]);')
    4242            }
    4343            add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr);
  • trunk/xcache.c

    r832 r840  
    146146    xc_entry_data_php_t *p;
    147147    for (p = php->cache->phps[php->hvalue]; p; p = p->next) {
    148         if (memcmp(php->md5, p->md5, sizeof(php->md5)) == 0) {
     148        if (memcmp(&php->md5, &p->md5, sizeof(php->md5)) == 0) {
    149149            p->hits ++;
    150150            return p;
     
    170170        xc_entry_data_php_t *p;
    171171        for (p = *pp; p; pp = &(p->next), p = p->next) {
    172             if (memcmp(php->md5, p->md5, sizeof(php->md5)) == 0) {
     172            if (memcmp(&php->md5, &p->md5, sizeof(php->md5)) == 0) {
    173173                /* unlink */
    174174                *pp = p->next;
     
    10881088static inline xc_hash_value_t xc_php_hash_md5(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
    10891089{
    1090     return HASH_STR_S(php->md5, sizeof(php->md5));
     1090    return HASH_STR_S(&php->md5, sizeof(php->md5));
    10911091}
    10921092/* }}} */
     
    11091109        PHP_MD5Update(&context, buf, n);
    11101110    }
    1111     PHP_MD5Final((unsigned char *) php->md5, &context);
     1111    PHP_MD5Final((unsigned char *) php->md5.digest, &context);
    11121112
    11131113    php_stream_close(stream);
  • trunk/xcache.h

    r832 r840  
    343343#endif
    344344typedef enum { XC_TYPE_PHP, XC_TYPE_VAR } xc_entry_type_t;
    345 typedef char xc_md5sum_t[16];
     345typedef struct {
     346    char digest[16];
     347} xc_md5sum_t;
    346348/* {{{ xc_compilererror_t */
    347349typedef struct {
Note: See TracChangeset for help on using the changeset viewer.