helly           Sat Oct 29 11:09:12 2005 EDT

  Modified files:              
    /php-src/ext/standard       php_fopen_wrapper.c 
  Log:
  - Allow to specify ma memory usage for temp stream
  
http://cvs.php.net/diff.php/php-src/ext/standard/php_fopen_wrapper.c?r1=1.47&r2=1.48&ty=u
Index: php-src/ext/standard/php_fopen_wrapper.c
diff -u php-src/ext/standard/php_fopen_wrapper.c:1.47 
php-src/ext/standard/php_fopen_wrapper.c:1.48
--- php-src/ext/standard/php_fopen_wrapper.c:1.47       Sat Oct 29 10:29:59 2005
+++ php-src/ext/standard/php_fopen_wrapper.c    Sat Oct 29 11:09:12 2005
@@ -17,7 +17,7 @@
    |          Hartmut Holzgraefe <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_fopen_wrapper.c,v 1.47 2005/10/29 14:29:59 helly Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.48 2005/10/29 15:09:12 helly Exp $ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -153,12 +153,23 @@
        int mode_rw = 0;
        php_stream * stream = NULL;
        char *p, *token, *pathdup;
+       long max_memory;
 
        if (!strncasecmp(path, "php://", 6))
                path += 6;
        
-       if (!strcasecmp(path, "temp")) {
-               return php_stream_temp_create(0, PHP_STREAM_MAX_MEM);
+       if (!strncasecmp(path, "temp", 4)) {
+               path += 4;
+               max_memory = PHP_STREAM_MAX_MEM;
+               if (!strncasecmp(path, "/maxmemory:", 11)) {
+                       path += 11;
+                       sscanf(path, "%ld", &max_memory);
+                       if (max_memory < 0) {
+                               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Max 
memory must be >= 0");
+                               return NULL;
+                       }
+               }
+               return php_stream_temp_create(0, max_memory);           
        }
        
        if (!strcasecmp(path, "memory")) {
@@ -190,7 +201,7 @@
                pathdup = estrndup(path + 6, strlen(path + 6));
                p = strstr(pathdup, "/resource=");
                if (!p) {
-                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "No URL 
resource specified.");
+                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "No URL 
resource specified");
                        efree(pathdup);
                        return NULL;
                }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to