Added
Link Here
|
1 |
--- pgsql.c Wed Oct 3 19:31:58 2007 |
2 |
+++ pgsql.c Thu Dec 6 23:16:34 2007 |
3 |
@@ -63,4 +63,5 @@ |
4 |
#define PGSQL_MAX_LENGTH_OF_DOUBLE 60 |
5 |
|
6 |
+#if UINT_MAX > LONG_MAX |
7 |
#define PGSQL_RETURN_OID(oid) do { \ |
8 |
if (oid > LONG_MAX) { \ |
9 |
@@ -72,5 +73,7 @@ |
10 |
RETURN_LONG((long)oid); \ |
11 |
} while(0) |
12 |
- |
13 |
+#else |
14 |
+#define PGSQL_RETURN_OID(oid) RETURN_LONG((long)oid) |
15 |
+#endif |
16 |
|
17 |
#if HAVE_PQSETNONBLOCKING |
18 |
@@ -273,5 +276,5 @@ |
19 |
|
20 |
/* {{{ _php_pgsql_trim_message */ |
21 |
-static char * _php_pgsql_trim_message(const char *message, int *len) |
22 |
+static char * _php_pgsql_trim_message(const char *message, size_t *len) |
23 |
{ |
24 |
register int i = strlen(message)-1; |
25 |
@@ -364,5 +367,5 @@ |
26 |
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message); |
27 |
} |
28 |
- zend_hash_index_update(&PGG(notices), (int)resource_id, (void **)¬ice, sizeof(php_pgsql_notice *), NULL); |
29 |
+ zend_hash_index_update(&PGG(notices), (ulong)resource_id, (void **)¬ice, sizeof(php_pgsql_notice *), NULL); |
30 |
} |
31 |
} |
32 |
@@ -762,5 +765,6 @@ |
33 |
if (!(connect_type & PGSQL_CONNECT_FORCE_NEW) |
34 |
&& zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) &index_ptr)==SUCCESS) { |
35 |
- int type,link; |
36 |
+ int type; |
37 |
+ ulong link; |
38 |
void *ptr; |
39 |
|
40 |
@@ -768,5 +772,5 @@ |
41 |
RETURN_FALSE; |
42 |
} |
43 |
- link = (int) index_ptr->ptr; |
44 |
+ link = (uintptr_t /* ulong is as wide or wider than pointer */) index_ptr->ptr; |
45 |
ptr = zend_list_find(link,&type); /* check if the link is still there */ |
46 |
if (ptr && (type==le_link || type==le_plink)) { |
47 |
@@ -1749,4 +1753,5 @@ |
48 |
|
49 |
if (return_oid) { |
50 |
+#if UINT_MAX > LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ |
51 |
if (oid > LONG_MAX) { |
52 |
smart_str oidstr = {0}; |
53 |
@@ -1754,5 +1759,7 @@ |
54 |
smart_str_0(&oidstr); |
55 |
RETURN_STRINGL(oidstr.c, oidstr.len, 0); |
56 |
- } else { |
57 |
+ } else |
58 |
+#endif |
59 |
+ { |
60 |
RETURN_LONG((long)oid); |
61 |
} |
62 |
@@ -1855,4 +1862,5 @@ |
63 |
oid = PQftype(pgsql_result, Z_LVAL_PP(field)); |
64 |
|
65 |
+#if UINT_MAX > LONG_MAX |
66 |
if (oid > LONG_MAX) { |
67 |
smart_str s = {0}; |
68 |
@@ -1864,4 +1872,5 @@ |
69 |
} |
70 |
else |
71 |
+#endif |
72 |
{ |
73 |
Z_LVAL_P(return_value) = (long)oid; |
74 |
@@ -5742,6 +5751,6 @@ |
75 |
zval *row; |
76 |
char *field_name, *element, *data; |
77 |
- size_t num_fields, element_len, data_len; |
78 |
- int pg_numrows, pg_row; |
79 |
+ size_t num_fields, element_len; |
80 |
+ int pg_numrows, pg_row, data_len; |
81 |
uint i; |
82 |
assert(Z_TYPE_P(ret_array) == IS_ARRAY); |