diff options
| author | Piotr Pawłow <pp@siedziba.pl> | 2016-09-08 23:05:41 +0200 |
|---|---|---|
| committer | Piotr Pawłow <pp@siedziba.pl> | 2016-09-08 23:05:41 +0200 |
| commit | 87380c76cb1eb3644da7291d842281caaae63f2d (patch) | |
| tree | 8957300686e074c06f6f5d142093ef0e4c40d2be /filters/php_bumpmap.c | |
| parent | 469cf3df58f7d076a62c51c1df2163d23989f924 (diff) | |
Quick and dirty PHP7 port.
Using compatibility shims and macros. Compiles both on PHP5 and 7.
Done in one afternoon without much testing, so use at your own risk!
Diffstat (limited to 'filters/php_bumpmap.c')
| -rw-r--r-- | filters/php_bumpmap.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/filters/php_bumpmap.c b/filters/php_bumpmap.c index 6910f82..24e548d 100644 --- a/filters/php_bumpmap.c +++ b/filters/php_bumpmap.c @@ -44,7 +44,9 @@ _php_bumpmap_exec(char* filter, HashTable* params,int index) int *paramtypes; char *script; Imlib_Image im=NULL; - HashPosition pos; + ulong num_index; + zend_string *str_index; + imlib_zval *data; paramnames=allpnames[index]; paramtypes=allptypes[index]; @@ -52,36 +54,28 @@ _php_bumpmap_exec(char* filter, HashTable* params,int index) script=estrdup(filter); script=_php_bumpmap_stradd(script,"("); - zend_hash_internal_pointer_reset_ex(params,&pos); - while (pos) - { - char *str_index; - ulong num_index; - int retval; - - retval=zend_hash_get_current_key_ex(params,&str_index,NULL,&num_index,0,&pos); - if (retval==HASH_KEY_IS_STRING) + ZEND_HASH_FOREACH_KEY_VAL(params, num_index, str_index, data) + { + if (str_index) { int match=0; int index=0; while (paramnames[index]) { - if (strcmp(str_index,paramnames[index])==0) + if (strcmp(STR_VAL(str_index),paramnames[index])==0) { char val[32]; - zval **data; - zend_hash_get_current_data_ex(params,(void**)&data,&pos); switch(paramtypes[index]) { case 'I': - im=(Imlib_Image)_php_imlib_get_image(data); /* Why is cast to Imlib_Image needed? */ + im=(Imlib_Image)_php_imlib_get_image(Z_RES_P(data)); /* Why is cast to Imlib_Image needed? */ script=_php_bumpmap_stradd(script,"map=[]"); break; case 'i': convert_to_long_ex(data); sprintf(val,"%d",(int)Z_LVAL_PP(data)); - script=_php_bumpmap_stradd(script,str_index); + script=_php_bumpmap_stradd(script,STR_VAL(str_index)); script=_php_bumpmap_stradd(script,"="); script=_php_bumpmap_stradd(script,val); break; @@ -97,8 +91,7 @@ _php_bumpmap_exec(char* filter, HashTable* params,int index) php_error(E_NOTICE,"Unknown argument %s ignored",str_index); } } - zend_hash_move_forward_ex(params,&pos); - } + } ZEND_HASH_FOREACH_END(); if (script[strlen(script)-1]==',') script[strlen(script)-1]='\0'; script=_php_bumpmap_stradd(script,");"); @@ -122,6 +115,9 @@ php_filter_deinit() } int +_php_bumpmap_getfilterindex(char*); + +int php_filter_exec(Imlib_Image im, char *filter, HashTable *params) { int index=_php_bumpmap_getfilterindex(filter); |
