pajoye          Thu Jun 11 17:14:34 2009 UTC

  Modified files:              
    /php-src/ext/mysqlnd        mysqlnd_wireprotocol.c 
  Log:
  - MF53: silent warning and make it less ambiguous
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_wireprotocol.c?r1=1.28&r2=1.29&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_wireprotocol.c
diff -u php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.28 
php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.29
--- php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.28     Thu Jun 11 08:32:34 2009
+++ php-src/ext/mysqlnd/mysqlnd_wireprotocol.c  Thu Jun 11 17:14:34 2009
@@ -612,7 +612,7 @@
        /* pad2 */
        p+= 13;
 
-       if (p - buf < packet->header.size) {
+       if ((size_t)(p - buf) < packet->header.size) {
                /* scramble_buf is split into two parts */
                memcpy(packet->scramble_buf + SCRAMBLE_LENGTH_323,
                                p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323);
@@ -626,7 +626,7 @@
        DBG_INF_FMT("server_capabilities=%d charset_no=%d server_status=%d",
                                packet->server_capabilities, 
packet->charset_no, packet->server_status);
 
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - 
begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "GREET packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);
@@ -811,7 +811,7 @@
        p+= 2;
 
        /* There is a message */
-       if (packet->header.size > p - buf && (i = 
php_mysqlnd_net_field_length(&p))) {
+       if (packet->header.size > (size_t)(p - buf) && (i = 
php_mysqlnd_net_field_length(&p))) {
                packet->message = pestrndup((char *)p, MIN(i, sizeof(buf) - (p 
- buf)), conn->persistent);
                packet->message_len = i;
        } else {
@@ -822,7 +822,7 @@
                                packet->affected_rows, packet->last_insert_id, 
packet->server_status,
                                packet->warning_count);
 
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - 
begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "OK packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);
@@ -895,7 +895,7 @@
                packet->server_status = 0;
        }
 
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("EOF packet %d bytes shorter than expected", p - 
begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "EOF packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);
@@ -1045,7 +1045,7 @@
                        packet->warning_count = uint2korr(p);
                        p+=2;
                        /* Check for additional textual data */
-                       if (packet->header.size  > (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
+                       if (packet->header.size  > (size_t)(p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
                                packet->info_or_local_file = mnd_pemalloc(len + 
1, conn->persistent);
                                memcpy(packet->info_or_local_file, p, len);
                                packet->info_or_local_file[len] = '\0';
@@ -1060,7 +1060,7 @@
                        /* Result set */
                        break;
        }
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("RSET_HEADER packet %d bytes shorter than 
expected", p - begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "GREET packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);
@@ -1188,7 +1188,7 @@
          NULL_LENGTH (0xFB) comes from COM_FIELD_LIST when the default value 
is NULL.
          Otherwise the string is length encoded.
        */
-       if (packet->header.size > (p - buf) &&
+       if (packet->header.size > (size_t)(p - buf) &&
                (len = php_mysqlnd_net_field_length(&p)) &&
                len != MYSQLND_NULL_LENGTH)
        {
@@ -1200,7 +1200,7 @@
                p += len;
        }
 
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("RSET field packet %d bytes shorter than expected", 
p - begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result set field 
packet "MYSQLND_SZ_T_SPEC" bytes "
                                                "shorter than expected", p - 
begin - packet->header.size);
@@ -1944,7 +1944,7 @@
        DBG_INF_FMT("Prepare packet read: stmt_id=%d fields=%d params=%d",
                                packet->stmt_id, packet->field_count, 
packet->param_count);
 
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("PREPARE packet %d bytes shorter than expected", p 
- begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "PREPARE packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);
@@ -2004,7 +2004,7 @@
                                                                                
 packet->error_info.sqlstate
                                                                                
 TSRMLS_CC);
        }
-       if (p - begin > packet->header.size) {
+       if ((size_t)(p - begin) > packet->header.size) {
                DBG_ERR_FMT("CHANGE_USER packet %d bytes shorter than 
expected", p - begin - packet->header.size);
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "CHANGE_USER packet 
"MYSQLND_SZ_T_SPEC" bytes shorter than expected",
                                                 p - begin - 
packet->header.size);



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

Reply via email to