pajoye                                   Thu, 18 Aug 2011 09:16:04 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=315128

Log:
- do not use 64bit integer instead of size_t (can't be alloc'ed), or when the 
actual possible values are 32bit or lower only

Changed paths:
    U   php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.c
    U   php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.h
    U   php/php-src/trunk/sapi/cli/php_http_parser.c
    U   php/php-src/trunk/sapi/cli/php_http_parser.h

Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.c     2011-08-18 
09:08:00 UTC (rev 315127)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.c     2011-08-18 
09:16:04 UTC (rev 315128)
@@ -323,12 +323,12 @@
 {
   char c, ch;
   const char *p = data, *pe;
-  int64_t to_read;
+  size_t to_read;

   enum state state = (enum state) parser->state;
   enum header_states header_state = (enum header_states) parser->header_state;
-  uint64_t index = parser->index;
-  uint64_t nread = parser->nread;
+  uint32_t index = parser->index;
+  uint32_t nread = parser->nread;

   /* technically we could combine all of these (except for url_mark) into one
      variable, saving stack space, but it seems more clear to have them
@@ -1425,7 +1425,7 @@
       }

       case s_body_identity:
-        to_read = MIN(pe - p, (int64_t)parser->content_length);
+        to_read = MIN(pe - p, (size_t)parser->content_length);
         if (to_read > 0) {
           if (settings->on_body) settings->on_body(parser, p, to_read);
           p += to_read - 1;
@@ -1510,7 +1510,7 @@
       {
         assert(parser->flags & F_CHUNKED);

-        to_read = MIN(pe - p, (int64_t)(parser->content_length));
+        to_read = MIN(pe - p, (size_t)(parser->content_length));

         if (to_read > 0) {
           if (settings->on_body) settings->on_body(parser, p, to_read);

Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.h
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.h     2011-08-18 
09:08:00 UTC (rev 315127)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_http_parser.h     2011-08-18 
09:16:04 UTC (rev 315128)
@@ -112,7 +112,7 @@
   unsigned char index;

   uint32_t nread;
-  int64_t content_length;
+  size_t content_length;

   /** READ-ONLY **/
   unsigned short http_major;

Modified: php/php-src/trunk/sapi/cli/php_http_parser.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_http_parser.c        2011-08-18 09:08:00 UTC 
(rev 315127)
+++ php/php-src/trunk/sapi/cli/php_http_parser.c        2011-08-18 09:16:04 UTC 
(rev 315128)
@@ -323,12 +323,12 @@
 {
   char c, ch;
   const char *p = data, *pe;
-  int64_t to_read;
+  size_t to_read;

   enum state state = (enum state) parser->state;
   enum header_states header_state = (enum header_states) parser->header_state;
-  uint64_t index = parser->index;
-  uint64_t nread = parser->nread;
+  uint32_t index = parser->index;
+  uint32_t nread = parser->nread;

   /* technically we could combine all of these (except for url_mark) into one
      variable, saving stack space, but it seems more clear to have them
@@ -1425,7 +1425,7 @@
       }

       case s_body_identity:
-        to_read = MIN(pe - p, (int64_t)parser->content_length);
+        to_read = MIN(pe - p, (size_t)parser->content_length);
         if (to_read > 0) {
           if (settings->on_body) settings->on_body(parser, p, to_read);
           p += to_read - 1;
@@ -1510,7 +1510,7 @@
       {
         assert(parser->flags & F_CHUNKED);

-        to_read = MIN(pe - p, (int64_t)(parser->content_length));
+        to_read = MIN(pe - p, (size_t)(parser->content_length));

         if (to_read > 0) {
           if (settings->on_body) settings->on_body(parser, p, to_read);

Modified: php/php-src/trunk/sapi/cli/php_http_parser.h
===================================================================
--- php/php-src/trunk/sapi/cli/php_http_parser.h        2011-08-18 09:08:00 UTC 
(rev 315127)
+++ php/php-src/trunk/sapi/cli/php_http_parser.h        2011-08-18 09:16:04 UTC 
(rev 315128)
@@ -112,7 +112,7 @@
   unsigned char index;

   uint32_t nread;
-  int64_t content_length;
+  size_t content_length;

   /** READ-ONLY **/
   unsigned short http_major;

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

Reply via email to