Develop and Download Open Source Software

Browse CVS Repository

Diff of /xoonips/AL/xnpal.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.32 by aga, Wed Feb 9 07:23:50 2005 UTC revision 1.33 by youi, Wed Feb 9 11:12:39 2005 UTC
# Line 123  ZEND_FUNCTION(xnp_get_item_types Line 123  ZEND_FUNCTION(xnp_get_item_types
123  ZEND_FUNCTION(xnp_get_index_id_by_item_id  );  ZEND_FUNCTION(xnp_get_index_id_by_item_id  );
124  ZEND_FUNCTION(xnp_get_own_public_item_id   );  ZEND_FUNCTION(xnp_get_own_public_item_id   );
125    
126    ZEND_FUNCTION(xnp_zip_create               );
127    
128  };  };
129  /* compiled function list so Zend knows what's in this module */  /* compiled function list so Zend knows what's in this module */
130  zend_function_entry xnpalmod_functions[] =  zend_function_entry xnpalmod_functions[] =
# Line 216  zend_function_entry xnpalmod_functions[] Line 218  zend_function_entry xnpalmod_functions[]
218      ZEND_FE(xnp_get_index_id_by_item_id  ,NULL)      ZEND_FE(xnp_get_index_id_by_item_id  ,NULL)
219      ZEND_FE(xnp_get_own_public_item_id   ,NULL)      ZEND_FE(xnp_get_own_public_item_id   ,NULL)
220    
221        ZEND_FE(xnp_zip_create               ,NULL)
222    
223          {NULL, NULL, NULL}          {NULL, NULL, NULL}
224  };  };
225    
# Line 3343  ZEND_FUNCTION(xnp_get_own_public_item_id Line 3347  ZEND_FUNCTION(xnp_get_own_public_item_id
3347                    
3348          RETURN_LONG( result );          RETURN_LONG( result );
3349  }  }
3350    
3351    ZEND_FUNCTION(xnp_zip_create)
3352    {
3353            zval* zzipfile;
3354            zval* zfiles;
3355            result_t result = RES_ERROR;
3356            
3357            if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za",
3358                                                              &zzipfile, &zfiles) == FAILURE) {
3359                    return;
3360            }
3361            char* zipfile = getZvalString( &zzipfile );
3362            char** files = 0;
3363            int len;
3364    
3365            if ( Z_TYPE_P(zfiles) != IS_ARRAY ){
3366                    result = RES_ERROR;
3367            }
3368            else {
3369                    len = zend_hash_num_elements(Z_ARRVAL_P(zfiles));
3370                    if(len > 0) {
3371                            zval             **tmp;
3372                            HashPosition   pos;
3373                            int i = 0;
3374                            files = new char*[ len ];
3375    
3376                            zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(zfiles), &pos);
3377                            while (zend_hash_get_current_data_ex(Z_ARRVAL_P(zfiles), (void **) &tmp, &pos) == SUCCESS ) {
3378                                    SEPARATE_ZVAL(tmp); // zend.arguments.write-safety.html 参照
3379                                    convert_to_string_ex(tmp);
3380                                    
3381                                    if ( i < len )
3382                                            files[i++] = Z_STRVAL_PP(tmp);
3383                                    zend_hash_move_forward_ex(Z_ARRVAL_P(zfiles), &pos);
3384                            }
3385                            //len = i;
3386                    }
3387            }
3388            if( files != 0 ){
3389                    result = zipCreate( zipfile, files, len );
3390        }else{
3391                    result = RES_ERROR;
3392            }
3393            
3394            RETURN_LONG( result );
3395    }
3396    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26