andrey Wed, 28 Apr 2010 12:29:13 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298699
Log:
const-ify fields
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
U php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
U php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2010-04-28
12:17:58 UTC (rev 298698)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2010-04-28
12:29:13 UTC (rev 298699)
@@ -63,12 +63,12 @@
typedef struct st_mysqlnd_field
{
- char *name; /* Name of column */
- char *org_name; /* Original column name, if an
alias */
- char *table; /* Table of column if column
was a field */
- char *org_table; /* Org table name, if table was
an alias */
- char *db; /* Database for table */
- char *catalog; /* Catalog for table */
+ const char *name; /* Name of column */
+ const char *org_name; /* Original column name, if an alias */
+ const char *table; /* Table of column if column
was a field */
+ const char *org_table; /* Org table name, if table was an
alias */
+ const char *db; /* Database for table */
+ const char *catalog; /* Catalog for table */
char *def; /* Default value (set
by mysql_list_fields) */
unsigned long length; /* Width of column (create length) */
unsigned long max_length; /* Max width for selected set */
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
2010-04-28 12:17:58 UTC (rev 298698)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
2010-04-28 12:29:13 UTC (rev 298699)
@@ -70,7 +70,7 @@
static const char *unknown_sqlstate= "HY000";
-char * const mysqlnd_empty_string = "";
+const char * const mysqlnd_empty_string = "";
/* Used in mysqlnd_debug.c */
const char mysqlnd_read_header_name[] = "mysqlnd_read_header";
@@ -927,13 +927,13 @@
BAIL_IF_NO_MORE_DATA;
switch ((len)) {
case 0:
- *(char **)(((char*)meta) +
rset_field_offsets[i]) = mysqlnd_empty_string;
+ *(const char **)(((char*)meta) +
rset_field_offsets[i]) = mysqlnd_empty_string;
*(unsigned int *)(((char*)meta) +
rset_field_offsets[i+1]) = 0;
break;
case MYSQLND_NULL_LENGTH:
goto faulty_or_fake;
default:
- *(char **)(((char *)meta) +
rset_field_offsets[i]) = (char *)p;
+ *(const char **)(((char *)meta) +
rset_field_offsets[i]) = (const char *)p;
*(unsigned int *)(((char*)meta) +
rset_field_offsets[i+1]) = len;
p += len;
total_len += len + 1;
@@ -989,6 +989,7 @@
(len = php_mysqlnd_net_field_length(&p)) &&
len != MYSQLND_NULL_LENGTH)
{
+ BAIL_IF_NO_MORE_DATA;
DBG_INF_FMT("Def found, length %lu, persistent=%d", len,
packet->persistent_alloc);
meta->def = mnd_pemalloc(len + 1, packet->persistent_alloc);
memcpy(meta->def, p, len);
@@ -997,8 +998,6 @@
p += len;
}
- BAIL_IF_NO_MORE_DATA;
-
DBG_INF_FMT("allocing root. persistent=%d", packet->persistent_alloc);
root_ptr = meta->root = mnd_pemalloc(total_len,
packet->persistent_alloc);
meta->root_len = total_len;
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
2010-04-28 12:17:58 UTC (rev 298698)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
2010-04-28 12:29:13 UTC (rev 298699)
@@ -254,7 +254,7 @@
unsigned long php_mysqlnd_net_field_length(zend_uchar **packet);
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t
length);
-PHPAPI extern char * const mysqlnd_empty_string;
+PHPAPI const extern char * const mysqlnd_empty_string;
void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK *
row_buffer, zval ** fields,
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-04-28 12:17:58 UTC
(rev 298698)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-04-28 12:29:13 UTC
(rev 298699)
@@ -63,12 +63,12 @@
typedef struct st_mysqlnd_field
{
- char *name; /* Name of column */
- char *org_name; /* Original column name, if an
alias */
- char *table; /* Table of column if column
was a field */
- char *org_table; /* Org table name, if table was
an alias */
- char *db; /* Database for table */
- char *catalog; /* Catalog for table */
+ const char *name; /* Name of column */
+ const char *org_name; /* Original column name, if an alias */
+ const char *table; /* Table of column if column
was a field */
+ const char *org_table; /* Org table name, if table was an
alias */
+ const char *db; /* Database for table */
+ const char *catalog; /* Catalog for table */
char *def; /* Default value (set
by mysql_list_fields) */
unsigned long length; /* Width of column (create length) */
unsigned long max_length; /* Max width for selected set */
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-28
12:17:58 UTC (rev 298698)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-28
12:29:13 UTC (rev 298699)
@@ -70,7 +70,7 @@
static const char *unknown_sqlstate= "HY000";
-char * const mysqlnd_empty_string = "";
+const char * const mysqlnd_empty_string = "";
/* Used in mysqlnd_debug.c */
const char mysqlnd_read_header_name[] = "mysqlnd_read_header";
@@ -927,13 +927,13 @@
BAIL_IF_NO_MORE_DATA;
switch ((len)) {
case 0:
- *(char **)(((char*)meta) +
rset_field_offsets[i]) = mysqlnd_empty_string;
+ *(const char **)(((char*)meta) +
rset_field_offsets[i]) = mysqlnd_empty_string;
*(unsigned int *)(((char*)meta) +
rset_field_offsets[i+1]) = 0;
break;
case MYSQLND_NULL_LENGTH:
goto faulty_or_fake;
default:
- *(char **)(((char *)meta) +
rset_field_offsets[i]) = (char *)p;
+ *(const char **)(((char *)meta) +
rset_field_offsets[i]) = (const char *)p;
*(unsigned int *)(((char*)meta) +
rset_field_offsets[i+1]) = len;
p += len;
total_len += len + 1;
@@ -989,6 +989,7 @@
(len = php_mysqlnd_net_field_length(&p)) &&
len != MYSQLND_NULL_LENGTH)
{
+ BAIL_IF_NO_MORE_DATA;
DBG_INF_FMT("Def found, length %lu, persistent=%d", len,
packet->persistent_alloc);
meta->def = mnd_pemalloc(len + 1, packet->persistent_alloc);
memcpy(meta->def, p, len);
@@ -997,8 +998,6 @@
p += len;
}
- BAIL_IF_NO_MORE_DATA;
-
DBG_INF_FMT("allocing root. persistent=%d", packet->persistent_alloc);
root_ptr = meta->root = mnd_pemalloc(total_len,
packet->persistent_alloc);
meta->root_len = total_len;
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h 2010-04-28
12:17:58 UTC (rev 298698)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h 2010-04-28
12:29:13 UTC (rev 298699)
@@ -254,7 +254,7 @@
unsigned long php_mysqlnd_net_field_length(zend_uchar **packet);
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t
length);
-PHPAPI extern char * const mysqlnd_empty_string;
+PHPAPI const extern char * const mysqlnd_empty_string;
void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK *
row_buffer, zval ** fields,
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php