sterling                Sat Jan 20 15:42:03 2001 EDT

  Modified files:              
    /php4/ext/sablot    sablot.c 
  Log:
  Fix the scheme handler support and make it compile on win32 systems.
  
  
  
Index: php4/ext/sablot/sablot.c
diff -u php4/ext/sablot/sablot.c:1.32 php4/ext/sablot/sablot.c:1.33
--- php4/ext/sablot/sablot.c:1.32       Fri Jan 19 03:44:12 2001
+++ php4/ext/sablot/sablot.c    Sat Jan 20 15:42:03 2001
@@ -1506,76 +1506,81 @@
 
 /* {{{ Sablotron Scheme Handler functions */
 
-static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *scheme, 
const char *rest, char **buffer, int *byteCount) {
-       php_sablot *handle = (php_sablot *)userData;
+static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *scheme, 
+const char *rest, char **buffer, int *byteCount) 
+{
+       php_sablot *handle = (php_sablot *) userData;
+       ELS_FETCH();
 
        if (handle->getAllHandler) {
-       zval *retval;
-               zval *args[4];
-               char *mybuff;
-           int i;
-        int argc;
-
-        argc=4;
-               args[0] = _php_sablot_resource_zval(handle->index);
-               args[1] = _php_sablot_string_zval(scheme);
-               args[2] = _php_sablot_string_zval(rest);
-               args[3] = _php_sablot_string_zval("");
+               zval *retval,
+                    *argv[4];
+               int   idx,
+                     argc = 4;
 
                MAKE_STD_ZVAL(retval);
 
-       if (call_user_function(EG(function_table), NULL, handle->getAllHandler, 
retval, argc, args) == FAILURE) {
-               php_error(E_WARNING, "Sorry, couldn't call %s handler", "scheme 
getAll");
-       }
-
-       zval_dtor(retval);
-       efree(retval);
-
-        /**
-         * do not destroy xml data.
-         */
-               *buffer=Z_STRVAL_P(args[3]);
-               *byteCount=Z_STRLEN_P(args[3]);
-        /**
-         * destroy zvals
-         */
-           for (i=0; i<3; i++) {
-                   zval_del_ref(&(args[i]));
-           }
+               argv[0] = _php_sablot_resource_zval(handle->index);
+               argv[1] = _php_sablot_string_zval(scheme);
+               argv[2] = _php_sablot_string_zval(rest);
+               argv[3] = _php_sablot_string_zval("");
+
+               if (call_user_function(EG(function_table),
+                                      NULL,
+                                      handle->getAllHandler,
+                                      retval,
+                                      argc,
+                                      argv) == FAILURE) {
+                       php_error(E_WARNING, "Sorry couldn't call function, %s, with 
+handler of type %s",
+                                 handle->getAllHandler->value.str.val, "Scheme 
+GetALL");
+               }
+
+               zval_dtor(retval);
+               efree(retval);
+
+               *buffer    = Z_STRVAL_P(argv[3]);
+               *byteCount = Z_STRLEN_P(argv[3]);
+
+               for (idx = 1; idx < 3; idx++) {
+                       zval_del_ref(&(argv[idx]));
+               }
        }
-};
 
-static int _php_sablot_sh_freeMemory(void *userData, SablotHandle p, char *buffer) {
-    /**
-     * here we should destroy the buffer containing the xml data
-     * buffer to zval and zval-del_ref
-     * we should destroy the zval not the pointer.
-     */
-};
+
+       return(0);
+}
+
+static int _php_sablot_sh_freeMemory(void *userData, SablotHandle p, char *buffer) 
+{
+       /** Not implemented **/
+}
 
-static int _php_sablot_sh_open(void *userData, SablotHandle p, const char *scheme, 
const char *rest, int *handle) {
+static int _php_sablot_sh_open(void *userData, SablotHandle p, const char *scheme, 
+const char *rest, int *handle) 
+{
     /**
      * Not implemented
      */
-};
+}
 
-static int _php_sablot_sh_get(void *userData, SablotHandle p, int handle, char 
*buffer, int *byteCount) {
+static int _php_sablot_sh_get(void *userData, SablotHandle p, int handle, char 
+*buffer, int *byteCount)
+{
     /**
      * Not implemented
      */
-};
+}
 
-static int _php_sablot_sh_put(void *userData, SablotHandle p, int handle, const char 
*buffer, int *byteCount) {
+static int _php_sablot_sh_put(void *userData, SablotHandle p, int handle, const char 
+*buffer, int *byteCount)
+{
     /**
      * Not implemented
      */
-};
+}
 
-static int _php_sablot_sh_close(void *userData, SablotHandle p, int handle) {
+static int _php_sablot_sh_close(void *userData, SablotHandle p, int handle) 
+{
     /**
      * Not implemented
      */
-};
+}
 
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to