Changeset 201

Show
Ignore:
Timestamp:
04/11/06 17:59:53 (2 years ago)
Author:
bart
Message:

A lot of fixes to silence the compile warnings generated when compiling with the default Fedora compiler options

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r199 r201  
     12006-04-11  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * A lot of fixes to silence the compile warnings generated when compiling 
     4          with the default Fedora compiler options 
     5 
    162006-04-11  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    27 
  • eaccelerator/trunk/Makefile.in

    r178 r201  
    33LTLIBRARY_SHARED_NAME = eaccelerator.la 
    44 
    5 EXTRA_CFLAGS = -O2 
     5EXTRA_CFLAGS = -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables 
    66 
    77include $(top_srcdir)/build/dynlib.mk 
  • eaccelerator/trunk/cache.c

    r191 r201  
    279279                hdr.crc32 = eaccelerator_crc32((const char *) q, q->size); 
    280280                if (write(f, &hdr, sizeof(hdr)) == sizeof(hdr)) { 
    281                     write(f, q, q->size); 
     281                    ssize_t result = 0; 
     282                    result = write(f, q, q->size); 
    282283                    EACCELERATOR_FLOCK(f, LOCK_UN); 
    283284                    close(f); 
     
    597598    unsigned int i, xlen; 
    598599    zval *list; 
    599     char *xkey
     600    char *xkey = ""
    600601    mm_user_cache_entry *p; 
    601602    time_t t = time(0); 
  • eaccelerator/trunk/content.c

    r182 r201  
    122122static int eaccelerator_is_not_modified(zval* return_value TSRMLS_DC) { 
    123123  char  etag[256]; 
    124   zval  **server_vars, **match; 
     124  union { 
     125    zval **v; 
     126    void *ptr; 
     127  } server_vars, match; 
    125128 
    126129  if (!SG(headers_sent)) { 
    127130    sprintf(etag,"ETag: eaccelerator-%u",eaccelerator_crc32(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value))); 
    128131    sapi_add_header(etag, strlen(etag), 1); 
    129     if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS && 
    130         Z_TYPE_PP(server_vars) == IS_ARRAY && 
    131         zend_hash_find(Z_ARRVAL_PP(server_vars), "HTTP_IF_NONE_MATCH", sizeof("HTTP_IF_NONE_MATCH"), (void **) &match)==SUCCESS && 
    132         Z_TYPE_PP(match) == IS_STRING) { 
    133       if (strcmp(etag+6,Z_STRVAL_PP(match)) == 0 && 
     132    if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), &server_vars.ptr) == SUCCESS && 
     133        Z_TYPE_PP(server_vars.v) == IS_ARRAY && 
     134        zend_hash_find(Z_ARRVAL_PP(server_vars.v), "HTTP_IF_NONE_MATCH", sizeof("HTTP_IF_NONE_MATCH"), &match.ptr)==SUCCESS && 
     135        Z_TYPE_PP(match.v) == IS_STRING) { 
     136      if (strcmp(etag+6,Z_STRVAL_PP(match.v)) == 0 && 
    134137          sapi_add_header("HTTP/1.0 304", sizeof("HTTP/1.0 304") - 1, 1) == SUCCESS && 
    135138          sapi_add_header("Status: 304 Not Modified", sizeof("Status: 304 Not Modified") - 1, 1) == SUCCESS) { 
     
    184187  int   ret = 0; 
    185188  zval cache_array; 
    186   zval **headers; 
    187   zval **content; 
     189  union { 
     190    zval **v; 
     191    void *ptr; 
     192  } headers, content; 
    188193  if (eaccelerator_get(key, key_len, &cache_array, eaccelerator_content_cache_place TSRMLS_CC)) { 
    189194    if (Z_TYPE(cache_array) == IS_ARRAY) { 
    190       if (zend_hash_find(Z_ARRVAL(cache_array),"content",sizeof("content"),(void**)&content) == SUCCESS && 
    191          Z_TYPE_PP(content) == IS_STRING) { 
    192         if (zend_hash_find(Z_ARRVAL(cache_array),"headers",sizeof("headers"),(void**)&headers) == SUCCESS && 
    193            Z_TYPE_PP(headers) == IS_ARRAY) { 
    194           zend_hash_apply(Z_ARRVAL_PP(headers), (apply_func_t)eaccelerator_send_header TSRMLS_CC); 
     195      if (zend_hash_find(Z_ARRVAL(cache_array),"content",sizeof("content"),&content.ptr) == SUCCESS && 
     196         Z_TYPE_PP(content.v) == IS_STRING) { 
     197        if (zend_hash_find(Z_ARRVAL(cache_array),"headers",sizeof("headers"),&headers.ptr) == SUCCESS && 
     198           Z_TYPE_PP(headers.v) == IS_ARRAY) { 
     199          zend_hash_apply(Z_ARRVAL_PP(headers.v), (apply_func_t)eaccelerator_send_header TSRMLS_CC); 
    195200        } 
    196         memcpy(return_value,*content, sizeof(zval)); 
     201        memcpy(return_value,*content.v, sizeof(zval)); 
    197202        zval_copy_ctor(return_value); 
    198203        ret = 1; 
     
    205210 
    206211static void eaccelerator_compress(char* key, int key_len, zval* return_value, time_t ttl TSRMLS_DC) { 
    207   zval  **server_vars, **encoding; 
     212  union { 
     213    zval **v; 
     214    void *ptr; 
     215  } server_vars, encoding; 
    208216 
    209217  if (EAG(compression_enabled) && 
    210218      EAG(compress_content) && 
    211219      !SG(headers_sent) && 
    212       zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS && 
    213       Z_TYPE_PP(server_vars) == IS_ARRAY && 
    214       zend_hash_find(Z_ARRVAL_PP(server_vars), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &encoding)==SUCCESS && 
    215       Z_TYPE_PP(encoding) == IS_STRING && 
     220      zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), &server_vars.ptr) == SUCCESS && 
     221      Z_TYPE_PP(server_vars.v) == IS_ARRAY && 
     222      zend_hash_find(Z_ARRVAL_PP(server_vars.v), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), &encoding.ptr)==SUCCESS && 
     223      Z_TYPE_PP(encoding.v) == IS_STRING && 
    216224      Z_TYPE_P(return_value) == IS_STRING && 
    217225      Z_STRLEN_P(return_value) >= EACCELERATOR_COMPRESS_MIN) { 
     
    235243    } 
    236244 
    237     if (strstr(Z_STRVAL_PP(encoding),"x-gzip")) { 
     245    if (strstr(Z_STRVAL_PP(encoding.v),"x-gzip")) { 
    238246      zkey_len = sizeof("gzip_") + key_len - 1; 
    239247      zkey = emalloc(zkey_len+1); 
     
    244252      params[0] = return_value; 
    245253      gzip = 1; 
    246     } else if (strstr(Z_STRVAL_PP(encoding),"gzip")) { 
     254    } else if (strstr(Z_STRVAL_PP(encoding.v),"gzip")) { 
    247255      zkey_len = sizeof("gzip_") + key_len - 1; 
    248256      zkey = emalloc(zkey_len+1); 
     
    253261      params[0] = return_value; 
    254262      gzip = 1; 
    255     } else if (strstr(Z_STRVAL_PP(encoding),"deflate")) { 
     263    } else if (strstr(Z_STRVAL_PP(encoding.v),"deflate")) { 
    256264      zkey_len = sizeof("deflate_") + key_len - 1; 
    257265      zkey = emalloc(zkey_len+1); 
     
    380388  int   key_len; 
    381389  long  ttl = 0; 
    382   zval  **server_vars, **encoding; 
     390  union { 
     391    zval **v; 
     392    void *ptr; 
     393  } server_vars, encoding; 
    383394 
    384395  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
     
    395406      EAG(compress_content) && 
    396407      !SG(headers_sent) && 
    397       zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS && 
    398       Z_TYPE_PP(server_vars) == IS_ARRAY && 
    399       zend_hash_find(Z_ARRVAL_PP(server_vars), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &encoding)==SUCCESS && 
    400       Z_TYPE_PP(encoding) == IS_STRING) { 
     408      zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), &server_vars.ptr) == SUCCESS && 
     409      Z_TYPE_PP(server_vars.v) == IS_ARRAY && 
     410      zend_hash_find(Z_ARRVAL_PP(server_vars.v), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), &encoding.ptr)==SUCCESS && 
     411      Z_TYPE_PP(encoding.v) == IS_STRING) { 
    401412    char* zkey = NULL; 
    402413    char* enc = NULL; 
    403414    int   zkey_len = 0; 
    404     if (strstr(Z_STRVAL_PP(encoding),"x-gzip")) { 
     415    if (strstr(Z_STRVAL_PP(encoding.v),"x-gzip")) { 
    405416      zkey_len = sizeof("gzip_") + key_len - 1; 
    406417      zkey = emalloc(zkey_len+1); 
     
    408419      memcpy(zkey+sizeof("gzip_")-1,key,key_len+1); 
    409420      enc = "Content-Encoding: x-gzip"; 
    410     } else if (strstr(Z_STRVAL_PP(encoding),"gzip")) { 
     421    } else if (strstr(Z_STRVAL_PP(encoding.v),"gzip")) { 
    411422      zkey_len = sizeof("gzip_") + key_len - 1; 
    412423      zkey = emalloc(zkey_len+1); 
     
    414425      memcpy(zkey+sizeof("gzip_")-1,key,key_len+1); 
    415426      enc = "Content-Encoding: gzip"; 
    416     } else if (strstr(Z_STRVAL_PP(encoding),"deflate")) { 
     427    } else if (strstr(Z_STRVAL_PP(encoding.v),"deflate")) { 
    417428      zkey_len = sizeof("deflate_") + key_len - 1; 
    418429      zkey = emalloc(zkey_len+1); 
  • eaccelerator/trunk/ea_dasm.c

    r189 r201  
    270270                    snprintf(buf, sizeof(buf), "ZEND_ISEMPTY"); 
    271271                } else { 
    272                     snprintf(buf, sizeof(buf), "")
     272                                       buf[0] = '\0'
    273273                } 
    274274#ifdef ZEND_ENGINE_2 
     
    279279                    snprintf(buf, sizeof(buf), "ZEND_ASSIGN_DIM"); 
    280280                } else { 
    281                     snprintf(buf, sizeof(buf), "")
     281                                       buf[0] = '\0'
    282282                } 
    283283#ifndef ZEND_ENGINE_2_1 
     
    288288                    snprintf(buf, sizeof(buf), "ZEND_UNSET_OBJ"); 
    289289                } else { 
    290                     snprintf(buf, sizeof(buf), "")
     290                                       buf[0] = '\0'
    291291                } 
    292292#endif 
     
    295295                snprintf(buf, sizeof(buf), "%ld", opline->extended_value); 
    296296            } else { 
    297                 snprintf(buf, sizeof(buf), "")
     297                               buf[0] = '\0'
    298298            } 
    299299            add_assoc_string(el, "extended_value", buf, 1); 
     
    315315            } else if ((op->ops & OP1_MASK) == OP1_UCLASS) { 
    316316                if (opline->op1.op_type == IS_UNUSED) { 
    317                     snprintf(buf, sizeof(buf), "")
     317                                       buf[0] = '\0'
    318318                } else { 
    319319                    snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op1.u.var)); 
     
    329329                            goto brk_failed; 
    330330                        } 
     331                                                jmp_to = &op_array->brk_cont_array[offset]; 
    331332                        offset = jmp_to->parent; 
    332333                    } while (--level > 0); 
     
    368369                    snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op1.u.var)); 
    369370                } else if (opline->op1.op_type == IS_UNUSED) { 
    370                     snprintf(buf, sizeof(buf), "")
     371                                       buf[0] = '\0'
    371372                } else { 
    372373                    snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->op1.op_type); 
     
    416417                                        snprintf(buf, sizeof(buf), "ZEND_REQUIRE_ONCE"); 
    417418                                } else { 
    418                     snprintf(buf, sizeof(buf), "")
     419                                       buf[0] = '\0'
    419420                                } 
    420421                        } else if ((op->ops & OP2_MASK) == OP2_ARG) { 
     
    426427                                        snprintf(buf, sizeof(buf), "ZEND_ISEMPTY"); 
    427428                                } else { 
    428                                         snprintf(buf, sizeof(buf), "")
     429                                        buf[0] = '\0'
    429430                                } 
    430431                        } else { 
     
    437438                                        snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
    438439                                } else if (opline->op2.op_type == IS_UNUSED) { 
    439                                         snprintf(buf, sizeof(buf), "")
     440                                        buf[0] = '\0'
    440441                                } else { 
    441442                                        snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->op2.op_type); 
     
    467468                        } 
    468469                                } else if (opline->result.op_type == IS_UNUSED) { 
    469                         snprintf(buf, sizeof(buf), "")
     470                                               buf[0] = '\0'
    470471                                } else { 
    471472                                        snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->result.op_type); 
     
    486487                                break; 
    487488                        case RES_UNUSED: 
    488                     snprintf(buf, sizeof(buf), "")
     489                                       buf[0] = '\0'
    489490                                break; 
    490491                        default: 
  • eaccelerator/trunk/ea_restore.c

    r195 r201  
    466466                                                                eaccelerator_op_array * from TSRMLS_DC) 
    467467{ 
    468         zend_function *function; 
     468    union { 
     469        zend_function *v; 
     470        void *ptr; 
     471    } function; 
    469472#ifdef ZEND_ENGINE_2 
    470473        int fname_len = 0; 
     
    530533         */ 
    531534        if (from->scope_name != NULL) { 
     535        union { 
     536            zend_class_entry *v; 
     537            void *ptr; 
     538        } scope; 
    532539                char *from_scope_lc = zend_str_tolower_dup(from->scope_name, from->scope_name_len); 
    533                 if (zend_hash_find (CG(class_table), (void *) from_scope_lc, from->scope_name_len + 1, (void **) &to->scope) != SUCCESS) { 
     540        scope.v = to->scope; 
     541                if (zend_hash_find (CG(class_table), (void *) from_scope_lc, from->scope_name_len + 1, &scope.ptr) != SUCCESS) { 
    534542                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    535543                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   can't find '%s' in class_table. use EAG(class_entry).\n", getpid(), from->scope_name)); 
     
    549557                                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    550558                                DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   checking parent '%s' have '%s'\n", getpid(), p->name, fname_lc)); 
    551                                 if (zend_hash_find(&p->function_table, fname_lc, fname_len + 1, (void **) &function) == SUCCESS) { 
     559                                if (zend_hash_find(&p->function_table, fname_lc, fname_len + 1, &function.ptr) == SUCCESS) { 
    552560                                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    553561                                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                   '%s' has '%s' of scope '%s'\n",  
    554                             getpid(), p->name, fname_lc, function->common.scope->name)); 
    555                                         to->scope = function->common.scope; 
     562                            getpid(), p->name, fname_lc, function.v->common.scope->name)); 
     563                                        to->scope = function.v->common.scope; 
    556564                                        break; 
    557565                                } 
     
    583591                to->function_name, strlen(to->function_name) + 1, 
    584592#endif 
    585                                 (void **) &function) == SUCCESS && function->type == ZEND_INTERNAL_FUNCTION) { 
     593                                &function.ptr) == SUCCESS && function.v->type == ZEND_INTERNAL_FUNCTION) { 
    586594                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    587595                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                       found in function table\n", getpid())); 
    588                         ((zend_internal_function *) (to))->handler = ((zend_internal_function *) function)->handler; 
     596                        ((zend_internal_function *) (to))->handler = ((zend_internal_function *) function.v)->handler; 
    589597                } else { 
    590598                        /* FIXME. I don't know how to fix handler. 
     
    806814{ 
    807815        zend_class_entry *old; 
    808         zend_function *f = NULL; 
    809816 
    810817        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
  • eaccelerator/trunk/ea_store.c

    r195 r201  
    8686} 
    8787 
     88 
    8889/* Calculate the size of a point to a class entry */ 
     90/* not used 
    8991static void calc_class_entry_ptr(zend_class_entry ** from TSRMLS_DC) 
    9092{ 
    9193        calc_class_entry(*from TSRMLS_CC); 
    9294} 
     95*/ 
    9396#endif 
    9497 
     
    781784        zend_class_entry *from = from_ce; 
    782785        zend_class_entry *parent = from->parent; 
    783         zend_property_info *pinfo, *cinfo = NULL; 
    784         zval **pprop = NULL; 
    785         zval **cprop = p->pData; 
     786    union { 
     787        zend_property_info *v; 
     788        void *ptr; 
     789    } pinfo, cinfo; 
     790    union { 
     791        zval **v; 
     792        void *ptr; 
     793    } pprop, cprop; 
    786794        char *mname, *cname = NULL; 
    787795 
     796    cprop.v = p->pData; 
    788797        /* Check if this is a parent class. If so, copy unconditionally */ 
    789798        if (parent) { 
     
    792801         
    793802                /* lookup the member's info in parent and child */ 
    794                 if((zend_hash_find(&parent->properties_info, mname, strlen(mname)+1, (void**)&pinfo) == SUCCESS) && 
    795                         (zend_hash_find(&from->properties_info, mname, strlen(mname)+1, (void**)&cinfo) == SUCCESS)) { 
     803                if((zend_hash_find(&parent->properties_info, mname, strlen(mname)+1, &pinfo.ptr) == SUCCESS) && 
     804                        (zend_hash_find(&from->properties_info, mname, strlen(mname)+1, &cinfo.ptr) == SUCCESS)) { 
    796805                        /* don't copy this static property if protected in parent and static public in child. 
    797806                           inheritance will handle this properly on restore */ 
    798                         if(cinfo->flags & ZEND_ACC_STATIC && (pinfo->flags & ZEND_ACC_PROTECTED && cinfo->flags & ZEND_ACC_PUBLIC)) { 
     807                        if(cinfo.v->flags & ZEND_ACC_STATIC && (pinfo.v->flags & ZEND_ACC_PROTECTED && cinfo.v->flags & ZEND_ACC_PUBLIC)) { 
    799808                                return ZEND_HASH_APPLY_REMOVE; 
    800809                        } 
    801810                        /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 
    802811#  ifdef ZEND_ENGINE_2_1 
    803                         if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, (void**)&pprop) == SUCCESS) { 
     812                        if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    804813#  else 
    805                         if(zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, (void**)&pprop) == SUCCESS) { 
     814                        if(zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    806815#  endif 
    807                                 if(*pprop == *cprop) { 
     816                                if(*pprop.v == *cprop.v) { 
    808817                                        return ZEND_HASH_APPLY_REMOVE; 
    809818                                } 
  • eaccelerator/trunk/eaccelerator.c

    r193 r201  
    350350} 
    351351 
     352/* This function isn't used. So disable it for now 
    352353static void decode_version(char *version, int v) { 
    353354  int t = (v & 0x000f00) >> 8; 
     
    364365                                     c, 
    365366                                     (v & 0x0000ff)); 
    366 
     367}  
     368*/ 
    367369 
    368370#ifdef EACCELERATOR_USE_INODE 
     
    10341036} 
    10351037 
     1038#ifndef EACCELERATOR_USE_INODE 
    10361039static char* eaccelerator_realpath(const char* name, char* realname TSRMLS_DC) { 
    10371040/* ???TODO it is possibe to cache name->realname mapping to avoid lstat() calls */ 
     
    10421045#endif 
    10431046} 
     1047#endif 
    10441048 
    10451049static int eaccelerator_stat(zend_file_handle *file_handle, 
     
    12271231  time_t compile_time; 
    12281232  int stat_result = 0; 
     1233#ifdef DEBUG 
    12291234  struct timeval tv_start; 
     1235#endif 
    12301236 
    12311237#ifdef EACCELERATOR_USE_INODE 
     
    20962102        EAG(hostname)[0] = '\000'; 
    20972103        { 
    2098                 zval  **server_vars, **hostname; 
    2099  
    2100                 if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS && 
    2101                         Z_TYPE_PP(server_vars) == IS_ARRAY && 
    2102                         zend_hash_find(Z_ARRVAL_PP(server_vars), "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &hostname)==SUCCESS && 
    2103                         Z_TYPE_PP(hostname) == IS_STRING && 
    2104                         Z_STRLEN_PP(hostname) > 0) 
     2104        union { 
     2105            zval **v; 
     2106            void *ptr; 
     2107        } server_vars; 
     2108        union { 
     2109            zval **v; 
     2110            void *ptr; 
     2111        } hostname; 
     2112 
     2113                if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), &server_vars.ptr) == SUCCESS && 
     2114                        Z_TYPE_PP(server_vars.v) == IS_ARRAY && 
     2115                        zend_hash_find(Z_ARRVAL_PP(server_vars.v), "SERVER_NAME", sizeof("SERVER_NAME"), &hostname.ptr)==SUCCESS && 
     2116                        Z_TYPE_PP(hostname.v) == IS_STRING && 
     2117                        Z_STRLEN_PP(hostname.v) > 0) 
    21052118                { 
    2106                         if (sizeof(EAG(hostname)) > Z_STRLEN_PP(hostname)) 
     2119                        if (sizeof(EAG(hostname)) > Z_STRLEN_PP(hostname.v)) 
    21072120                        { 
    2108                                 memcpy(EAG(hostname),Z_STRVAL_PP(hostname),Z_STRLEN_PP(hostname)+1); 
     2121                                memcpy(EAG(hostname),Z_STRVAL_PP(hostname.v),Z_STRLEN_PP(hostname.v)+1); 
    21092122                        } 
    21102123                        else 
    21112124                        { 
    2112                                 memcpy(EAG(hostname),Z_STRVAL_PP(hostname),sizeof(EAG(hostname))-1); 
     2125                                memcpy(EAG(hostname),Z_STRVAL_PP(hostname.v),sizeof(EAG(hostname))-1); 
    21132126                                EAG(hostname)[sizeof(EAG(hostname))-1] = '\000'; 
    21142127                        } 
  • eaccelerator/trunk/encoder.c

    r191 r201  
    250250      allow = 1; 
    251251    } else if (allow && ch == '_') { 
     252      size_t result = 0; 
    252253      label[0] = ch = fgetc(yyin); 
    253254      if (ch == EOF) {break;} 
    254255      if (ch == '_') { 
    255256        label[1] = ch = fgetc(yyin); 
    256         if (ch == EOF) {fwrite(label,1,1,yyout); break;} 
     257        if (ch == EOF) {result = fwrite(label,1,1,yyout); break;} 
    257258        if (IEQ('f')) { 
    258259          label[2] = ch = fgetc(yyin); 
    259           if (ch == EOF) {fwrite(label,2,1,yyout); break;} 
     260          if (ch == EOF) {result = fwrite(label,2,1,yyout); break;} 
    260261          if (IEQ('i')) { 
    261262            label[3] = ch = fgetc(yyin); 
    262             if (ch == EOF) {fwrite(label,3,1,yyout); break;} 
     263            if (ch == EOF) {result = fwrite(label,3,1,yyout); break;} 
    263264            if (IEQ('l')) { 
    264265              label[4] = ch = fgetc(yyin); 
    265               if (ch == EOF) {fwrite(label,4,1,yyout); break;} 
     266              if (ch == EOF) {result = fwrite(label,4,1,yyout); break;} 
    266267              if (IEQ('e')) { 
    267268                label[5] = ch = fgetc(yyin); 
    268                 if (ch == EOF) {fwrite(label,5,1,yyout); break;} 
     269                if (ch == EOF) {result = fwrite(label,5,1,yyout); break;} 
    269270                if (ch == '_') { 
    270271                  label[6] = ch = fgetc(yyin); 
    271                   if (ch == EOF) {fwrite(label,6,1,yyout); break;} 
     272                  if (ch == EOF) {result = fwrite(label,6,1,yyout); break;} 
    272273                  if (ch == '_') { 
    273274                    ch = fgetc(yyin); 
     
    278279                        (ch >= '\x7f' && ch <= '\xff') || 
    279280                        ch == '_') { 
    280                       fwrite(label,7,1,yyout); 
     281                      result = fwrite(label,7,1,yyout); 
    281282                    } else { 
    282283                      fputs("eaccelerator_loader_file()",yyout); 
    283284                    } 
    284285                  } else { 
    285                     fwrite(label,7,1,yyout); 
     286                    result = fwrite(label,7,1,yyout); 
    286287                  } 
    287288                } else { 
    288                   fwrite(label,6,1,yyout); 
     289                  result = fwrite(label,6,1,yyout); 
    289290                } 
    290291              } else { 
    291                 fwrite(label,5,1,yyout); 
     292                result = fwrite(label,5,1,yyout); 
    292293              } 
    293294            } else { 
    294               fwrite(label,4,1,yyout); 
     295              result = fwrite(label,4,1,yyout); 
    295296            } 
    296297          } else { 
    297             fwrite(label,3,1,yyout); 
     298            result = fwrite(label,3,1,yyout); 
    298299          } 
    299300        } else if (IEQ('l')) { 
    300301          label[2] = ch = fgetc(yyin); 
    301           if (ch == EOF) {fwrite(label,2,1,yyout); break;} 
     302          if (ch == EOF) {result = fwrite(label,2,1,yyout); break;} 
    302303          if (IEQ('i')) { 
    303304            label[3] = ch = fgetc(yyin); 
    304             if (ch == EOF) {fwrite(label,3,1,yyout); break;} 
     305            if (ch == EOF) {result = fwrite(label,3,1,yyout); break;} 
    305306            if (IEQ('n')) { 
    306307              label[4] = ch = fgetc(yyin); 
    307               if (ch == EOF) {fwrite(label,4,1,yyout); break;} 
     308              if (ch == EOF) {result = fwrite(label,4,1,yyout); break;} 
    308309              if (IEQ('e')) { 
    309310                label[5] = ch = fgetc(yyin); 
    310                 if (ch == EOF) {fwrite(label,5,1,yyout); break;} 
     311                if (ch == EOF) {result = fwrite(label,5,1,yyout); break;} 
    311312                if (ch == '_') { 
    312313                  label[6] = ch = fgetc(yyin); 
    313                   if (ch == EOF) {fwrite(label,6,1,yyout); break;} 
     314                  if (ch == EOF) {result = fwrite(label,6,1,yyout); break;} 
    314315                  if (ch == '_') { 
    315316                    ch = fgetc(yyin); 
     
    320321                        (ch >= '\x7f' && ch <= '\xff') || 
    321322                        ch == '_') { 
    322                       fwrite(label,7,1,yyout); 
     323                      result = fwrite(label,7,1,yyout); 
    323324                    } else { 
    324325                      fputs("eaccelerator_loader_line()",yyout); 
    325326                    } 
    326327                  } else { 
    327                     fwrite(label,7,1,yyout); 
     328                    result = fwrite(label,7,1,yyout); 
    328329                  } 
    329330                } else { 
    330                   fwrite(label,6,1,yyout); 
     331                  result = fwrite(label,6,1,yyout); 
    331332                } 
    332333              } else { 
    333                 fwrite(label,5,1,yyout); 
     334                result = fwrite(label,5,1,yyout); 
    334335              } 
    335336            } else { 
    336               fwrite(label,4,1,yyout); 
     337              result = fwrite(label,4,1,yyout); 
    337338            } 
    338339          } else { 
    339             fwrite(label,3,1,yyout); 
     340            result = fwrite(label,3,1,yyout); 
    340341          } 
    341342        } else { 
    342           fwrite(label,2,1,yyout); 
     343          result = fwrite(label,2,1,yyout); 
    343344        } 
    344345      } else { 
    345         fwrite(label,1,1,yyout); 
     346        result = fwrite(label,1,1,yyout); 
    346347      } 
    347348      allow = 0; 
     
    695696static void encode_class_entry(zend_class_entry* from); 
    696697 
     698/* not used  
    697699static void encode_class_entry_ptr(zend_class_entry** from) { 
    698700  encode_class_entry(*from); 
    699701} 
     702*/ 
    700703#endif 
    701704 
     
    719722} 
    720723 
     724/* not used  
    721725#ifdef ZEND_ENGINE_2 
    722726#define encode_zval_hash_ex(from,p) encode_hash_ex(from, p, (encode_bucket_t)encode_zval_ptr) 
     
    745749} 
    746750#endif 
     751*/ 
    747752 
    748753static void encode_op(zend_op_array* from, zend_op* opline, unsigned int ops) { 
     
    11831188                                if (prefix != NULL) 
    11841189                                { 
     1190                    size_t result = 0; 
    11851191                                        prefix->type = IS_STRING; 
    11861192                                        prefix->value.str.len = pos; 
    11871193                                        prefix->value.str.val = emalloc(pos+1); 
    11881194                                        rewind(src_fp); 
    1189                                         fread(prefix->value.str.val, pos, 1, src_fp); 
     1195                                        result = fread(prefix->value.str.val, pos, 1, src_fp); 
    11901196                                        prefix->value.str.val[prefix->value.str.len] = '\000'; 
    11911197                                } 
     
    12041210                                if (tmp_fp) 
    12051211                                { 
     1212                    size_t result = 0; 
    12061213                                        if (pre_content_len > 0) 
    12071214                                        { 
    1208                                                fwrite(pre_content, pre_content_len, 1, tmp_fp); 
     1215                        result = fwrite(pre_content, pre_content_len, 1, tmp_fp); 
    12091216                                        } 
    12101217#ifndef WITHOUT_FILE_FILTER 
     
    12201227                                        if (post_content_len > 0) 
    12211228                                        { 
    1222                                                 fwrite(post_content, post_content_len, 1, tmp_fp); 
     1229                                                result = fwrite(post_content, post_content_len, 1, tmp_fp); 
    12231230                                        } 
    12241231                                        rewind(tmp_fp); 
  • eaccelerator/trunk/loader.c

    r191 r201  
    213213} 
    214214 
     215#ifndef ZEND_ENGINE_2 
    215216static unsigned char* decode_pstr(char** p, unsigned int* l) { 
    216217  unsigned char c = decode(p, l); 
     
    230231  } 
    231232} 
     233#endif 
    232234 
    233235static double decode_double(char** p, unsigned int* l) { 
     
    251253 
    252254#define decode_zval_hash(to, p, l) decode_hash(to, sizeof(zval*), (decode_bucket_t)decode_zval_ptr, p, l TSRMLS_CC) 
    253 #define decode_zval_hash_noref(to, p, l) decode_hash(to, sizeof(zval*), (decode_bucket_t)decode_zval_ptr_noref, p, l TSRMLS_CC) 
    254255 
    255256static HashTable* decode_hash(HashTable* to, int size, decode_bucket_t decode_bucket, char**p, unsigned int* l TSRMLS_DC); 
     
    316317} 
    317318 
     319#ifndef ZEND_ENGINE_2 
     320#define decode_zval_hash_noref(to, p, l) decode_hash(to, sizeof(zval*), (decode_bucket_t)decode_zval_ptr_noref, p, l TSRMLS_CC) 
    318321static zval* decode_zval_ptr_noref(zval* to, char** p, unsigned int* l TSRMLS_DC) { 
    319322  if (to == NULL) { 
     
    325328  return to; 
    326329} 
     330#endif 
    327331 
    328332static void decode_znode(znode* to, unsigned int vars_count, char** p, unsigned int* l TSRMLS_DC) { 
     
    616620        to->fn_flags         = decode32(p, l); 
    617621        scope_name = decode_lstr((unsigned int*)&scope_name_len, p, l); 
    618         if (to->scope == NULL && scope_name != NULL) { 
    619                 if (zend_hash_find(CG(class_table), (void *)scope_name,  
    620                     scope_name_len, (void **)&to->scope) == SUCCESS) { 
    621                         to->scope = *(zend_class_entry**)to->scope; 
    622                 } else { 
    623             to->scope = NULL; 
    624         } 
    625         } 
     622    if (to->scope == NULL && scope_name != NULL) { 
     623      union { 
     624        zend_class_entry *v; 
     625        void *ptr; 
     626      } scope; 
     627      scope.v = to->scope; 
     628      if (zend_hash_find(CG(class_table), (void *)scope_name,  
     629            scope_name_len, &scope.ptr) == SUCCESS) { 
     630        to->scope = *(zend_class_entry**)to->scope; 
     631      } else { 
     632        to->scope = NULL; 
     633      } 
     634    } 
    626635#endif 
    627636  if (to->type == ZEND_INTERNAL_FUNCTION) { 
  • eaccelerator/trunk/mm.c

    r197 r201  
    158158#undef MM_SHM_CAN_ATTACH 
    159159 
     160#if defined(MM_SEM_POSIX) || defined(MM_SEM_FCNTL) || defined(MM_SEM_FLOCK) || defined(MM_SEM_WIN32) || defined(MM_SHM_MMAP_POSIX) || defined(MM_SHM_MMAP_FILE) 
    160161static int strxcat(char* dst, const char* src, int size) { 
    161162  int dst_len = strlen(dst); 
     
    170171  } 
    171172} 
     173#endif 
    172174 
    173175#if defined(MM_SEM_SPINLOCK) 
     
    192194} mm_mutex; 
    193195 
     196/* not used  
    194197static int mm_attach_lock(const char* key, mm_mutex* lock) { 
    195198  return 1; 
    196199} 
     200*/ 
    197201 
    198202static int mm_init_lock(const char* key, mm_mutex* lock) { 
  • eaccelerator/trunk/optimize.c

    r199 r201  
    15001500      (name_len == sizeof("false")-1 && strcmp(name,"false") == 0) || 
    15011501      (name_len == sizeof("true")-1 && strcmp(name,"true") == 0)) { 
    1502     zend_constant *c; 
     1502    union { 
     1503      zend_constant *v; 
     1504      void *ptr; 
     1505    } c; 
    15031506    int retval; 
    15041507    char *lookup_name = do_alloca(name_len+1); 
     
    15061509    lookup_name[name_len] = '\0'; 
    15071510 
    1508     if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { 
    1509       *result = c
     1511    if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) { 
     1512      *result = c.v
    15101513      retval=1; 
    15111514    } else { 
    15121515      zend_str_tolower(lookup_name, name_len); 
    15131516 
    1514       if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { 
    1515         if ((c->flags & CONST_CS) && (memcmp(c->name, name, name_len)!=0)) { 
     1517      if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) { 
     1518        if ((c.v->flags & CONST_CS) && (memcmp(c.v->name, name, name_len)!=0)) { 
    15161519          retval=0; 
    15171520        } else { 
    1518           *result = c
     1521          *result = c.v
    15191522          retval=1; 
    15201523        } 
     
    25442547            IS_DEFINED(op->op1)) { 
    25452548          zend_op *x = DEFINED_OP(op->op1); 
    2546           if ((x->opcode == ZEND_FETCH_W || x->opcode == ZEND_FETCH_RW) && 
    2547               x->op1.op_type == IS_CONST && 
    2548               x->op1.u.constant.type == IS_STRING) { 
     2549          if ((x->opcode == ZEND_FETCH_W || x->opcode == ZEND_FETCH_RW) &&  
     2550              x->op1.op_type == IS_CONST && x->op1.u.constant.type == IS_STRING) { 
     2551            union { 
     2552              zend_op *v; 
     2553              void *ptr; 
     2554            } op_copy; 
    25492555            char *s = emalloc(x->op1.u.constant.value.str.len+2); 
     2556            op_copy.v = op; 
    25502557            memcpy(s,x->op1.u.constant.value.str.val,x->op1.u.constant.value.str.len); 
    25512558            s[x->op1.u.constant.value.str.len] = (char)FETCH_TYPE(x); 
    25522559            s[x->op1.u.constant.value.str.len+1] = '\0'; 
    2553             zend_hash_update(&assigns, 
    2554                              s, x->op1.u.constant.value.str.len+2, 
    2555                              (void**)&op, sizeof(void*), NULL); 
     2560            zend_hash_update(&assigns, s, x->op1.u.constant.value.str.len+2, &op_copy.ptr,  
     2561                sizeof(void*), NULL); 
    25562562            efree(s); 
    25572563          } 
    25582564        } 
    2559       } else if ((op->opcode == ZEND_FETCH_R || 
    2560                   op->opcode == ZEND_FETCH_IS) && 
    2561                  !global[VAR_NUM(op->result.u.var)] && 
    2562                  op->op1.op_type == IS_CONST && 
    2563                  op->op1.u.constant.type == IS_STRING) { 
    2564         zend_op *x; 
     2565      } else if ((o