[PHP-dev 1149] Re: 32bit CPU で 64bit整数を扱う PHP5 パッチ
Yoshihiro Kawabe
sowhat @ amnis.co.jp
2005年 6月 18日 (土) 02:37:44 JST
川辺と申します。
fseek で 64bit offsetを渡せる版のパッチです。
前のメールに書いたように、10進数で指定したり、変数で渡す分には、いいの
ですが 16進数の場合の考慮が漏れていました。
で、これは、私の環境の問題かも知れないのですが、Zend/flex.skl のflex用
スケルトンが flex の文法エラー(行番号が出ないのとディフォルトと差があ
りすぎる)で動かなかったため、flexで生成した .c の方にも修正を入れるこ
とにしています。
# flexのバージョンは、2.5.31-31 です。
そもそも、元にしたパッケージのソースでは、flex や bison を通さない様に
構築されます。
パッケージリビジョンの更新もしてません。(debian/changelogを変更してい
ない)もし、私と同じ様に Debian の環境で試そうと言う方がいたら、バージョ
ン管理は気を付けて下さい。
--
Kawabe,Yoshihiro <sowhat @ amnis.co.jp>
As the stars blink in the night sky, our married hearts are never splitted.
Even if we will unclasp each other hands, until we retain that. by H.S.
-------------- next part --------------
--- php5-5.0.3/ext/standard/formatted_print.c.ORIG 2004-11-15 22:41:41.000000000 +0900
+++ php5-5.0.3/ext/standard/formatted_print.c 2005-05-30 18:21:52.000000000 +0900
@@ -219,21 +219,21 @@
inline static void
-php_sprintf_appendint(char **buffer, int *pos, int *size, long number,
+php_sprintf_appendint(char **buffer, int *pos, int *size, long long number,
int width, char padding, int alignment,
int always_sign)
{
char numbuf[NUM_BUF_SIZE];
- register unsigned long magn, nmagn;
+ register unsigned long long magn, nmagn;
register unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
*buffer, pos, size, number, width, padding, alignment));
if (number < 0) {
neg = 1;
- magn = ((unsigned long) -(number + 1)) + 1;
+ magn = ((unsigned long long) -(number + 1)) + 1;
} else {
- magn = (unsigned long) number;
+ magn = (unsigned long long) number;
}
/* Can't right-pad 0's on integers */
@@ -262,16 +262,16 @@
inline static void
php_sprintf_appenduint(char **buffer, int *pos, int *size,
- unsigned long number,
+ unsigned long long number,
int width, char padding, int alignment)
{
char numbuf[NUM_BUF_SIZE];
- register unsigned long magn, nmagn;
+ register unsigned long long magn, nmagn;
register unsigned int i = NUM_BUF_SIZE - 1;
PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
*buffer, pos, size, number, width, padding, alignment));
- magn = (unsigned int) number;
+ magn = (unsigned long long) number;
/* Can't right-pad 0's on integers */
if (alignment == 0 && padding == '0') padding = ' ';
@@ -412,12 +412,12 @@
inline static void
-php_sprintf_append2n(char **buffer, int *pos, int *size, long number,
+php_sprintf_append2n(char **buffer, int *pos, int *size, long long number,
int width, char padding, int alignment, int n,
char *chartable, int expprec)
{
char numbuf[NUM_BUF_SIZE];
- register unsigned long num;
+ register unsigned long long num;
register unsigned int i = NUM_BUF_SIZE - 1;
register int andbits = (1 << n) - 1;
@@ -426,7 +426,7 @@
chartable));
PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
- num = (unsigned long) number;
+ num = (unsigned long long) number;
numbuf[i] = '\0';
do {
--- php5-5.0.3/Zend/zend.h.ORIG 2004-12-15 15:44:06.000000000 +0900
+++ php5-5.0.3/Zend/zend.h 2005-03-02 16:04:56.000000000 +0900
@@ -227,13 +227,15 @@
# include <limits.h>
#endif
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
+#ifdef LONG_MAX
+#undef LONG_MAX
#endif
+#define LONG_MAX 9223372036854775807LL
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
+#ifdef LONG_MIN
+#undef LONG_MIN
#endif
+#define LONG_MIN (- LONG_MAX - 1)
#undef SUCCESS
#undef FAILURE
@@ -273,7 +275,7 @@
};
typedef union _zvalue_value {
- long lval; /* long value */
+ zlong lval; /* long value */
double dval; /* double value */
struct {
char *val;
--- php5-5.0.3/Zend/zend_operators.c.ORIG 2004-11-29 18:39:57.000000000 +0900
+++ php5-5.0.3/Zend/zend_operators.c 2005-03-02 16:14:14.000000000 +0900
@@ -31,7 +31,7 @@
#include "zend_multiply.h"
#include "zend_strtod.h"
-#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
+#define LONG_SIGN_MASK (1L << (8*sizeof(zlong)-1))
ZEND_API int zend_atoi(const char *str, int str_len)
{
@@ -116,7 +116,7 @@
case IS_LONG:
break;
default:
- op->value.lval = strtol(op->value.str.val, NULL, 10);
+ op->value.lval = strtoll(op->value.str.val, NULL, 10);
op->type = IS_LONG;
break;
}
@@ -154,7 +154,7 @@
case IS_LONG: \
break; \
default: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
+ (holder).value.lval = strtoll((op)->value.str.val, NULL, 10); \
(holder).type = IS_LONG; \
break; \
} \
@@ -184,7 +184,7 @@
}
-#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)
+#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (zulong) (d) : (zlong) (d)
#define zendi_convert_to_long(op, holder, result) \
if (op==result) { \
@@ -198,7 +198,7 @@
DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \
break; \
case IS_STRING: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
+ (holder).value.lval = strtoll((op)->value.str.val, NULL, 10); \
break; \
case IS_ARRAY: \
(holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
@@ -290,7 +290,7 @@
ZEND_API void convert_to_long_base(zval *op, int base)
{
char *strval;
- long tmp;
+ zlong tmp;
switch (op->type) {
case IS_NULL:
@@ -310,7 +310,7 @@
break;
case IS_STRING:
strval = op->value.str.val;
- op->value.lval = strtol(strval, NULL, base);
+ op->value.lval = strtoll(strval, NULL, base);
STR_FREE(strval);
break;
case IS_ARRAY:
@@ -506,7 +506,7 @@
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC)
{
- long lval;
+ zlong lval;
double dval;
switch (op->type) {
@@ -526,19 +526,19 @@
}
break;
case IS_RESOURCE: {
- long tmp = op->value.lval;
+ zlong tmp = op->value.lval;
TSRMLS_FETCH();
zend_list_delete(op->value.lval);
op->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- op->value.str.len = sprintf(op->value.str.val, "Resource id #%ld", tmp);
+ op->value.str.len = sprintf(op->value.str.val, "Resource id #%lld", tmp);
break;
}
case IS_LONG:
lval = op->value.lval;
op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */
+ op->value.str.len = zend_sprintf(op->value.str.val, "%lld", lval); /* SAFE */
break;
case IS_DOUBLE: {
TSRMLS_FETCH();
@@ -747,7 +747,7 @@
if (op1->type == IS_LONG && op2->type == IS_LONG) {
- long lval = op1->value.lval + op2->value.lval;
+ zlong lval = op1->value.lval + op2->value.lval;
/* check for overflow by comparing sign bits */
if ( (op1->value.lval & LONG_SIGN_MASK) == (op2->value.lval & LONG_SIGN_MASK)
@@ -787,7 +787,7 @@
zendi_convert_scalar_to_number(op2, op2_copy, result);
if (op1->type == IS_LONG && op2->type == IS_LONG) {
- long lval = op1->value.lval - op2->value.lval;
+ zlong lval = op1->value.lval - op2->value.lval;
/* check for overflow by comparing sign bits */
if ( (op1->value.lval & LONG_SIGN_MASK) != (op2->value.lval & LONG_SIGN_MASK)
@@ -827,7 +827,7 @@
zendi_convert_scalar_to_number(op2, op2_copy, result);
if (op1->type == IS_LONG && op2->type == IS_LONG) {
- long overflow;
+ zlong overflow;
ZEND_SIGNED_MULTIPLY_LONG(op1->value.lval,op2->value.lval, result->value.lval,result->value.dval,overflow);
result->type = overflow ? IS_DOUBLE : IS_LONG;
@@ -946,7 +946,7 @@
op1 = &op1_copy;
if (op1->type == IS_DOUBLE) {
- op1->value.lval = (long) op1->value.dval;
+ op1->value.lval = (zlong) op1->value.dval;
op1->type = IS_LONG;
}
if (op1->type == IS_LONG) {
@@ -1685,7 +1685,7 @@
op1->type = IS_LONG;
break;
case IS_STRING: {
- long lval;
+ zlong lval;
double dval;
char *strval = op1->value.str.val;
@@ -1722,7 +1722,7 @@
ZEND_API int decrement_function(zval *op1)
{
- long lval;
+ zlong lval;
double dval;
switch (op1->type) {
@@ -1890,7 +1890,7 @@
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
{
int ret1, ret2;
- long lval1, lval2;
+ zlong lval1, lval2;
double dval1, dval2;
if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) &&
--- php5-5.0.3/Zend/zend_alloc.c.ORIG 2004-08-28 01:49:54.000000000 +0900
+++ php5-5.0.3/Zend/zend_alloc.c 2005-03-02 16:27:19.000000000 +0900
@@ -227,14 +227,14 @@
&& nmemb >= 0
&& size >= 0
&& offset >= 0) {
- long lval;
+ zlong lval;
double dval;
int use_dval;
ZEND_SIGNED_MULTIPLY_LONG(nmemb, size, lval, dval, use_dval);
if (!use_dval
- && lval < (long) (LONG_MAX - offset)) {
+ && lval < (zlong) (LONG_MAX - offset)) {
return emalloc_rel(lval + offset);
}
}
--- php5-5.0.3/Zend/zend_exceptions.c.ORIG 2004-12-07 16:45:46.000000000 +0900
+++ php5-5.0.3/Zend/zend_exceptions.c 2005-03-02 16:36:37.000000000 +0900
@@ -248,9 +248,9 @@
TRACE_APPEND_STR("Resource id #");
/* break; */
case IS_LONG: {
- long lval = Z_LVAL_PP(arg);
+ zlong lval = Z_LVAL_PP(arg);
char s_tmp[MAX_LENGTH_OF_LONG + 1];
- int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
+ int l_tmp = zend_sprintf(s_tmp, "%lld", lval); /* SAFE */
TRACE_APPEND_STRL(s_tmp, l_tmp);
TRACE_APPEND_STR(", ");
break;
@@ -395,11 +395,11 @@
}
if (Z_STRLEN(message) > 0) {
- len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s",
+ len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%lld\nStack trace:\n%s",
Z_OBJCE_P(getThis())->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line),
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
} else {
- len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s",
+ len = zend_spprintf(&str, 0, "exception '%s' in %s:%lld\nStack trace:\n%s",
Z_OBJCE_P(getThis())->name, Z_STRVAL(file), Z_LVAL(line),
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
}
--- php5-5.0.3/Zend/zend_execute.c.ORIG 2004-12-01 23:01:58.000000000 +0900
+++ php5-5.0.3/Zend/zend_execute.c 2005-03-02 16:35:17.000000000 +0900
@@ -841,29 +841,29 @@
}
break;
case IS_RESOURCE:
- zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", dim->value.lval, dim->value.lval);
+ zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%lld)", dim->value.lval, dim->value.lval);
/* Fall Through */
case IS_DOUBLE:
case IS_BOOL:
case IS_LONG: {
- long index;
+ zlong index;
if (dim->type == IS_DOUBLE) {
- index = (long)dim->value.dval;
+ index = (zlong)dim->value.dval;
} else {
index = dim->value.lval;
}
if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: %ld", index);
+ zend_error(E_NOTICE,"Undefined offset: %lld", index);
/* break missing intentionally */
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval_ptr);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: %ld", index);
+ zend_error(E_NOTICE,"Undefined offset: %lld", index);
/* break missing intentionally */
case BP_VAR_W: {
zval *new_zval = &EG(uninitialized_zval);
@@ -3074,7 +3074,7 @@
char *space;
char *class_name = get_active_class_name(&space TSRMLS_CC);
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC);
- zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C));
+ zend_error(E_WARNING, "Missing argument %lld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C));
if (opline->result.op_type == IS_VAR) {
PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr);
}
@@ -3635,7 +3635,7 @@
{
zval **container = get_obj_zval_ptr_ptr(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *offset = get_zval_ptr(&opline->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- long index;
+ zlong index;
if (container) {
HashTable *ht;
@@ -3672,7 +3672,7 @@
case IS_BOOL:
case IS_LONG:
if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.dval;
+ index = (zlong) offset->value.dval;
} else {
index = offset->value.lval;
}
@@ -3971,7 +3971,7 @@
zval *offset = get_zval_ptr(&opline->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
zval **value = NULL;
int result = 0;
- long index;
+ zlong index;
if (container) {
if ((*container)->type == IS_ARRAY) {
@@ -3986,7 +3986,7 @@
case IS_BOOL:
case IS_LONG:
if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.dval;
+ index = (zlong) offset->value.dval;
} else {
index = offset->value.lval;
}
--- php5-5.0.3/Zend/zend_builtin_functions.c.ORIG 2004-12-06 17:57:55.000000000 +0900
+++ php5-5.0.3/Zend/zend_builtin_functions.c 2005-03-02 16:35:58.000000000 +0900
@@ -193,7 +193,7 @@
int arg_count;
zval **z_requested_offset;
zval *arg;
- long requested_offset;
+ zlong requested_offset;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) {
RETURN_FALSE;
@@ -220,7 +220,7 @@
arg_count = (ulong) *p;
if (requested_offset>=arg_count) {
- zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset);
+ zend_error(E_WARNING, "func_get_arg(): Argument %lld not passed to function", requested_offset);
RETURN_FALSE;
}
--- php5-5.0.3/Zend/zend_multiply.h.ORIG 2004-03-18 07:23:15.000000000 +0900
+++ php5-5.0.3/Zend/zend_multiply.h 2005-03-04 21:06:05.000000000 +0900
@@ -19,29 +19,7 @@
/* $Id: php5-5.0.3-LL.patch,v 1.4 2005-06-18 02:30:22+09 sowhat Exp $ */
-#if defined(__i386__) && defined(__GNUC__)
-
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
- long __tmpvar; \
- __asm__ ("imul %3,%0\n" \
- "adc $0,%1" \
- : "=r"(__tmpvar),"=r"(usedval) \
- : "0"(a), "r"(b), "1"(0)); \
- if (usedval) (dval) = (double) (a) * (double) (b); \
- else (lval) = __tmpvar; \
+ (usedval) = 0; \
+ (lval) = (a) * (b); \
} while (0)
-
-#else
-
-#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
- long __lres = (a) * (b); \
- double __dres = (double)(a) * (double)(b); \
- double __delta = (double) __lres - __dres; \
- if ( ((usedval) = (( __dres + __delta ) != __dres))) { \
- (dval) = __dres; \
- } else { \
- (lval) = __lres; \
- } \
-} while (0)
-
-#endif
--- php5-5.0.3/Zend/zend_hash.h.ORIG 2004-01-09 02:31:47.000000000 +0900
+++ php5-5.0.3/Zend/zend_hash.h 2005-03-04 21:38:01.000000000 +0900
@@ -295,7 +295,7 @@
} \
if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \
char *end=key+length-1; \
- long idx; \
+ zlong idx; \
\
if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \
break; \
@@ -308,12 +308,12 @@
} \
if (tmp==end && *tmp=='\0') { /* a numeric index */ \
if (*key=='-') { \
- idx = strtol(key, NULL, 10); \
+ idx = strtoll(key, NULL, 10); \
if (idx!=LONG_MIN) { \
return func; \
} \
} else { \
- idx = strtol(key, NULL, 10); \
+ idx = strtoll(key, NULL, 10); \
if (idx!=LONG_MAX) { \
return func; \
} \
--- php5-5.0.3/Zend/zend_API.c.ORIG 2004-11-02 22:19:48.000000000 +0900
+++ php5-5.0.3/Zend/zend_API.c 2005-06-14 16:37:49.000000000 +0900
@@ -228,7 +228,7 @@
switch (c) {
case 'l':
{
- long *p = va_arg(*va, long *);
+ zlong *p = va_arg(*va, zlong *);
switch (Z_TYPE_PP(arg)) {
case IS_STRING:
{
@@ -741,7 +741,7 @@
}
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n)
+ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, zlong n)
{
zval *tmp;
@@ -820,7 +820,7 @@
}
-ZEND_API int add_index_long(zval *arg, uint index, long n)
+ZEND_API int add_index_long(zval *arg, uint index, zlong n)
{
zval *tmp;
@@ -902,7 +902,7 @@
}
-ZEND_API int add_next_index_long(zval *arg, long n)
+ZEND_API int add_next_index_long(zval *arg, zlong n)
{
zval *tmp;
@@ -1007,7 +1007,7 @@
}
-ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
+ZEND_API int add_get_index_long(zval *arg, uint index, zlong l, void **dest)
{
zval *tmp;
@@ -1051,7 +1051,7 @@
}
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
+ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, zlong n TSRMLS_DC)
{
zval *tmp;
zval z_key;
@@ -1095,7 +1095,7 @@
return SUCCESS;
}
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
+ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, zlong n TSRMLS_DC)
{
zval *tmp;
zval z_key;
@@ -1940,7 +1940,7 @@
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC)
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, zlong value, int access_type TSRMLS_DC)
{
zval *property;
@@ -1997,7 +1997,7 @@
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
-ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC)
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, zlong value TSRMLS_DC)
{
zval *tmp;
--- php5-5.0.3/Zend/zend_API.h.ORIG 2004-09-09 18:53:20.000000000 +0900
+++ php5-5.0.3/Zend/zend_API.h 2005-06-14 16:37:45.000000000 +0900
@@ -185,12 +185,12 @@
ZEND_API int zend_get_module_started(char *module_name);
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, zlong value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
-ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, zlong value TSRMLS_DC);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
@@ -226,7 +226,7 @@
/* no longer supported */
ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
+ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, zlong n);
ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
@@ -250,7 +250,7 @@
#define add_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
-ZEND_API int add_index_long(zval *arg, uint idx, long n);
+ZEND_API int add_index_long(zval *arg, uint idx, zlong n);
ZEND_API int add_index_null(zval *arg, uint idx);
ZEND_API int add_index_bool(zval *arg, uint idx, int b);
ZEND_API int add_index_resource(zval *arg, uint idx, int r);
@@ -259,7 +259,7 @@
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
-ZEND_API int add_next_index_long(zval *arg, long n);
+ZEND_API int add_next_index_long(zval *arg, zlong n);
ZEND_API int add_next_index_null(zval *arg);
ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, int r);
@@ -274,15 +274,15 @@
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
-ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
+ZEND_API int add_get_index_long(zval *arg, uint idx, zlong l, void **dest);
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
+ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, zlong l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC);
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC);
+ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, zlong r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
--- php5-5.0.3/Zend/zend_types.h.ORIG 2004-01-09 02:31:48.000000000 +0900
+++ php5-5.0.3/Zend/zend_types.h 2005-06-14 17:29:45.000000000 +0900
@@ -28,6 +28,9 @@
typedef unsigned long zend_ulong;
typedef unsigned short zend_ushort;
+typedef long long zlong;
+typedef unsigned long long zulong;
+
#endif /* ZEND_TYPES_H */
/*
--- php5-5.0.3/debian/rules.ORIG 2005-03-02 15:26:00.000000000 +0900
+++ php5-5.0.3/debian/rules 2005-03-11 20:03:19.000000000 +0900
@@ -32,7 +32,7 @@
COMMON_CONFIG= --enable-memory-limit \
--disable-debug \
--with-layout=GNU \
- --disable-pear \
+ --enable-pear \
--enable-calendar \
--enable-sysvsem \
--enable-sysvshm \
@@ -42,7 +42,7 @@
--enable-bcmath \
--with-bz2 \
--enable-ctype \
- --with-db2 \
+ --with-db4 \
--enable-dbx \
--with-iconv \
--enable-exif \
@@ -79,11 +79,11 @@
dh_testdir
for patch in debian/patches/*.patch; do \
echo '->'`basename $$patch`:; \
- if ! patch -p1 --ignore-whitespace --dry-run < $$patch; \
+ if ! patch -N -p1 --ignore-whitespace --dry-run < $$patch; \
then \
exit 1; \
fi; \
- patch -p1 --ignore-whitespace < $$patch; \
+ patch -N -p1 --ignore-whitespace < $$patch; \
done
perl -i -pe 's/EXTRA_VERSION=""/EXTRA_VERSION="-$(PHP5_DEBIAN_REVISION)"/' configure.in
# rm -f aclocal.m4
@@ -126,6 +126,7 @@
touch build-cli-stamp
+
configure: configure-apache-stamp configure-cgi-stamp configure-cli-stamp
configure-apache-stamp: patch-stamp
dh_testdir
@@ -135,7 +136,8 @@
CFLAGS="$(CFLAGS)" ../configure \
--disable-cli \
--disable-cgi \
- --with-apxs=/usr/bin/apxs \
+ --with-apxs2filter=/usr/bin/apxs2 \
+ --with-apxs2=/usr/bin/apxs2 \
--prefix=/usr \
--disable-debug \
--with-config-file-path=/etc/php5/apache --disable-rpath \
@@ -156,7 +158,6 @@
--with-imap-ssl \
--with-ldap=shared,/usr \
--with-mhash=shared,/usr \
- --with-mm \
--with-mysql=shared,/usr \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=shared,/usr/bin/mysql_config \
@@ -165,7 +166,6 @@
--with-tidy=shared \
--with-snmp=shared \
--enable-ucd-snmp-hack \
- --with-sybase-ct=shared,/usr \
--with-ttf=shared,/usr
cd apache-build && \
cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \
@@ -250,8 +250,9 @@
dh_installdirs
# install apache DSO module
- cp apache-build/.libs/libphp5.so debian/php5/`apxs -q LIBEXECDIR`
- cp debian/500mod_php5.info debian/php5/`apxs -q LIBEXECDIR`
+ cp apache-build/.libs/libphp5.so debian/php5/`apxs2 -q LIBEXECDIR`
+# cp debian/500mod_php5.info debian/php5/`apxs2 -q LIBEXECDIR`
+ cp debian/php5.load debian/php5/`apxs2 -q LIBEXECDIR`
# sanitize php.ini file
cat php.ini-dist | tr "\t" " " > debian/php5/usr/share/doc/php5/examples/php.ini
cat php.ini-dist | tr "\t" " " > debian/php5-cgi/usr/share/doc/php5-cgi/examples/php.ini
@@ -362,7 +363,7 @@
dh_installdeb -a
# dh_makeshlibs
# dh_perl
- LD_LIBRARY_PATH=$(CURDIR)/debian/php5/usr/lib/apache/1.3:$(LD_LIBRARY_PATH) dh_shlibdeps -a
+ LD_LIBRARY_PATH=$(CURDIR)/debian/php5/usr/lib/apache2/modules:$(LD_LIBRARY_PATH) dh_shlibdeps -a
echo "apache:Depends=apache-common (>= $(apachever))" >> debian/php5.substvars
echo "php:Provides=phpapi-$(phpapiver)" >> debian/php5.substvars
--- php5-5.0.3/debian/control.ORIG 2005-03-02 15:26:00.000000000 +0900
+++ php5-5.0.3/debian/control 2005-03-07 19:34:02.000000000 +0900
@@ -7,11 +7,11 @@
Package: php5
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${apache:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${apache2:Depends}
Conflicts: php3, libapache-mod-php4
Provides: ${php:Provides}
-Description: PHP 5 scripting language - apache 1.3 module
- This package provides the loadable module for the apache 1.3 webserver.
+Description: PHP 5 scripting language - apache 2 module
+ This package provides the loadable module for the apache 2 webserver.
Package: php5-cgi
Architecture: any
--- php5-5.0.3/debian/php5.dirs.ORIG 2005-03-02 15:26:00.000000000 +0900
+++ php5-5.0.3/debian/php5.dirs 2005-03-11 19:54:15.000000000 +0900
@@ -1,5 +1,5 @@
/etc/php5/apache
-/usr/lib/apache/1.3
+/usr/lib/apache2/modules
/usr/share/doc/php5/examples
/usr/share/doc/php5/PEAR
/usr/lib/php5/libexec
--- php5-5.0.3/debian/php5.load.ORIG 2005-03-11 20:03:56.000000000 +0900
+++ php5-5.0.3/debian/php5.load 2005-03-11 20:04:10.000000000 +0900
@@ -0,0 +1 @@
+LoadModule: php5_module /usr/lib/apache2/modules/libphp5.so
--- php5-5.0.3/debian/php5.conf.ORIG 2005-03-11 20:04:29.000000000 +0900
+++ php5-5.0.3/debian/php5.conf 2005-03-11 20:05:29.000000000 +0900
@@ -0,0 +1,4 @@
+<IfModule mod_php5.c>
+ AddType application/x-httpd-php .php .phtml .php3 .php4 .php5
+ AddType application/x-httpd-php-source .phps
+</IfModule>
--- php5-5.0.3-LL/sapi/apache2filter/config.m4.ORIG 2004-08-23 18:00:09.000000000 +0900
+++ php5-5.0.3-LL/sapi/apache2filter/config.m4 2005-06-14 19:28:47.000000000 +0900
@@ -1,130 +0,0 @@
-dnl
-dnl $Id: php5-5.0.3-LL.patch,v 1.4 2005-06-18 02:30:22+09 sowhat Exp $
-dnl
-
-AC_MSG_CHECKING(for Apache 2.0 filter-module support via DSO through APXS)
-AC_ARG_WITH(apxs2filter,
-[ --with-apxs2filter[=FILE]
- EXPERIMENTAL: Build shared Apache 2.0 module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I cannot run apxs. Possible reasons follow:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed])
- AC_MSG_RESULT([2. apxs was not found. Try to pass the path using --with-apxs2filter=/path/to/apxs])
- AC_MSG_RESULT([3. Apache was not built using --enable-so (the apxs usage page is displayed)])
- AC_MSG_RESULT()
- AC_MSG_RESULT([The output of $APXS follows:])
- $APXS -q CFLAGS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_BINDIR=`$APXS -q BINDIR`
- APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- APXS_MPM=`$APXS -q MPM_NAME`
- APU_BINDIR=`$APXS -q APU_BINDIR`
- APR_BINDIR=`$APXS -q APR_BINDIR`
-
- # Pick up ap[ru]-N-config if using httpd >=2.1
- APR_CONFIG=`$APXS -q APR_CONFIG 2>/dev/null ||
- echo $APR_BINDIR/apr-config`
- APU_CONFIG=`$APXS -q APU_CONFIG 2>/dev/null ||
- echo $APU_BINDIR/apu-config`
-
- APR_CFLAGS="`$APR_CONFIG --cppflags --includes`"
- APU_CFLAGS="`$APU_CONFIG --includes`"
-
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag";;
- esac
- done
-
- APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS"
-
- # Test that we're trying to configure with apache 2.x
- PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
- if test "$APACHE_VERSION" -le 2000000; then
- AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
- elif test "$APACHE_VERSION" -lt 2000040; then
- AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required.])
- fi
-
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
- if test -z `$APXS -q SYSCONFDIR`; then
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5"
- else
- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5"
- fi
-
- case $host_alias in
- *aix*)
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *darwin*)
- dnl When using bundles on Darwin, we must resolve all symbols. However,
- dnl the linker does not recursively look at the bundle loader and
- dnl pull in its dependencies. Therefore, we must pull in the APR
- dnl and APR-util libraries.
- if test -x "$APR_BINDIR/apr-config"; then
- MH_BUNDLE_FLAGS="`$APR_BINDIR/apr-config --ldflags --link-ld --libs`"
- fi
- if test -x "$APU_BINDIR/apu-config"; then
- MH_BUNDLE_FLAGS="`$APU_BINDIR/apu-config --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS"
- fi
- MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
- PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp5.so
- INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
- ;;
- *beos*)
- if test -f _APP_; then `rm _APP_`; fi
- `ln -s $APXS_BINDIR/httpd _APP_`
- EXTRA_LIBS="$EXTRA_LIBS _APP_"
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *)
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- esac
-
- if test "$APXS_MPM" != "prefork"; then
- PHP_BUILD_THREAD_SAFE
- fi
- AC_MSG_RESULT(yes)
-
- PHP_SUBST(APXS)
-],[
- AC_MSG_RESULT(no)
-])
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
--- php5-5.0.3/debian/changelog.ORIG 2005-06-14 17:40:59.000000000 +0900
+++ php5-5.0.3/debian/changelog 2005-03-02 16:39:56.000000000 +0900
@@ -1,3 +1,9 @@
+php5 (5.0.3-1.llext.1) unstable; urgency=low
+
+ * Change lval to long long.
+
+ -- Yoshihiro Kawabe <sowhat @ alfecca> Wed, 2 Mar 2005 16:41:18 +0900
+
php5 (5.0.3-1.dotdeb.0) unstable; urgency=low
* New release
--- php5-5.0.3-LL/Zend/zend_language_scanner.l.ORIG 2004-11-04 08:14:31.000000000 +0900
+++ php5-5.0.3-LL/Zend/zend_language_scanner.l 2005-06-17 00:56:40.000000000 +0900
@@ -1187,7 +1187,7 @@
<ST_IN_SCRIPTING>{LNUM} {
errno = 0;
- zendlval->value.lval = strtol(yytext, NULL, 0);
+ zendlval->value.lval = strtoll(yytext, NULL, 0);
if (errno == ERANGE) { /* overflow */
zendlval->value.dval = zend_strtod(yytext, NULL);
zendlval->type = IS_DOUBLE;
@@ -1200,7 +1200,7 @@
<ST_IN_SCRIPTING>{HNUM} {
errno = 0;
- zendlval->value.lval = strtoul(yytext, NULL, 16);
+ zendlval->value.lval = strtoull(yytext, NULL, 16);
if (errno == ERANGE) { /* overflow */
/* not trying strtod - it returns trash on 0x-es */
zendlval->value.lval = LONG_MAX; /* maximal long */
@@ -1785,12 +1785,12 @@
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.lval = strtol(yytext+1, NULL, 8);
+ zendlval->value.lval = strtoll(yytext+1, NULL, 8);
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
- zendlval->value.lval = strtol (yytext+2, NULL, 16);
+ zendlval->value.lval = strtoll (yytext+2, NULL, 16);
return T_CHARACTER;
}
--- php5-5.0.3-LL/Zend/zend_language_scanner.c.ORIG 2004-12-15 15:58:52.000000000 +0900
+++ php5-5.0.3-LL/Zend/zend_language_scanner.c 2005-06-17 20:48:38.000000000 +0900
@@ -4411,7 +4411,7 @@
YY_RULE_SETUP
{
errno = 0;
- zendlval->value.lval = strtol(yytext, NULL, 0);
+ zendlval->value.lval = strtoll(yytext, NULL, 0);
if (errno == ERANGE) { /* overflow */
zendlval->value.dval = zend_strtod(yytext, NULL);
zendlval->type = IS_DOUBLE;
@@ -4426,7 +4426,7 @@
YY_RULE_SETUP
{
errno = 0;
- zendlval->value.lval = strtoul(yytext, NULL, 16);
+ zendlval->value.lval = strtoull(yytext, NULL, 16);
if (errno == ERANGE) { /* overflow */
/* not trying strtod - it returns trash on 0x-es */
zendlval->value.lval = LONG_MAX; /* maximal long */
@@ -5087,14 +5087,14 @@
case 150:
YY_RULE_SETUP
{
- zendlval->value.lval = strtol(yytext+1, NULL, 8);
+ zendlval->value.lval = strtoll(yytext+1, NULL, 8);
return T_CHARACTER;
}
YY_BREAK
case 151:
YY_RULE_SETUP
{
- zendlval->value.lval = strtol (yytext+2, NULL, 16);
+ zendlval->value.lval = strtoll (yytext+2, NULL, 16);
return T_CHARACTER;
}
YY_BREAK
--- php5-5.0.3-LL/Zend/zend_operators.h.ORIG 2004-11-04 08:14:32.000000000 +0900
+++ php5-5.0.3-LL/Zend/zend_operators.h 2005-06-16 20:09:06.000000000 +0900
@@ -67,7 +67,7 @@
static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, zend_bool allow_errors)
{
- long local_lval;
+ zlong local_lval;
double local_dval;
char *end_ptr_long, *end_ptr_double;
int conv_base=10;
@@ -81,7 +81,7 @@
conv_base=16;
}
errno=0;
- local_lval = strtol(str, &end_ptr_long, conv_base);
+ local_lval = strtoll(str, &end_ptr_long, conv_base);
if (errno!=ERANGE) {
if (end_ptr_long == str+length) { /* integer string */
if (lval) {
--- php5-5.0.3-LL/ext/soap/php_encoding.c.ORIG 2004-12-08 02:29:24.000000000 +0900
+++ php5-5.0.3-LL/ext/soap/php_encoding.c 2005-06-17 05:00:39.000000000 +0900
@@ -715,7 +715,7 @@
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
whiteSpace_collapse(data->children->content);
errno = 0;
- ret->value.lval = strtol(data->children->content, NULL, 0);
+ ret->value.lval = strtoll(data->children->content, NULL, 0);
if (errno == ERANGE) { /* overflow */
ret->value.dval = zend_strtod(data->children->content, NULL);
ret->type = IS_DOUBLE;
PHP-dev メーリングリストの案内