From: Moriyoshi Koizumi Date: Thu, 4 Mar 2004 21:50:21 +0000 (+0000) Subject: - Fix compiler warnings. (Patch by K.Kosako ) X-Git-Tag: RELEASE_0_2_0~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab204a36e0b0d877b1e7d821d50386a1bfab90d4;p=php - Fix compiler warnings. (Patch by K.Kosako ) --- diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY index 0373fc894f..a7a817dd2d 100644 --- a/ext/mbstring/oniguruma/HISTORY +++ b/ext/mbstring/oniguruma/HISTORY @@ -1,5 +1,20 @@ History +2004/03/04: Version 2.2.4 + +2004/03/04: [impl] (thanks Moriyoshi Koizumi) + fix many warning in Win32 VC++ with /W3 option. + +2004/03/02: Version 2.2.3 + +2004/03/02: [bug] (thanks Isao Sonobe) + return invalid capture region value if capture history + is used. (OP_MEMORY_END_PUSH_REC bug) + ex. /\\g

(?@

\\(\\g\\)){0}(?(?:\\g

)*|){0}/ + .match("((())())") +2004/03/02: [impl] add :nodoc: to onig_stat_print() for RDoc. +2004/03/02: [impl] don't use ONIG_SOURCE_IS_WRAPPED. + 2004/02/27: Version 2.2.2 2004/02/27: [impl] fix the position of onig_stat_print(). @@ -8,7 +23,8 @@ History 2004/02/26: Version 2.2.1 -2004/02/26: [bug] invalid definition at onig_error_code_to_str() +2004/02/26: [bug] [bugs.php.net:#26677] (thanks behrens) + invalid definition at onig_error_code_to_str() in the case of NOT HAVE_STDARG_PROTOTYPES. 2004/02/25: Version 2.2.0 diff --git a/ext/mbstring/oniguruma/enc/euc_jp.c b/ext/mbstring/oniguruma/enc/euc_jp.c index b0526dfe20..848016ba5a 100644 --- a/ext/mbstring/oniguruma/enc/euc_jp.c +++ b/ext/mbstring/oniguruma/enc/euc_jp.c @@ -70,9 +70,9 @@ eucjp_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar *p = buf; - if ((code & 0xff0000) != 0) *p++ = ((code >> 16) & 0xff); - if ((code & 0xff00) != 0) *p++ = ((code >> 8) & 0xff); - *p++ = (code & 0xff); + if ((code & 0xff0000) != 0) *p++ = (UChar )(((code >> 16) & 0xff)); + if ((code & 0xff00) != 0) *p++ = (UChar )(((code >> 8) & 0xff)); + *p++ = (UChar )(code & 0xff); #if 1 if (enc_len(ONIG_ENCODING_EUC_JP, buf[0]) != (p - buf)) diff --git a/ext/mbstring/oniguruma/enc/sjis.c b/ext/mbstring/oniguruma/enc/sjis.c index 2d54faaf73..8485910e69 100644 --- a/ext/mbstring/oniguruma/enc/sjis.c +++ b/ext/mbstring/oniguruma/enc/sjis.c @@ -53,8 +53,8 @@ sjis_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar *p = buf; - if ((code & 0xff00) != 0) *p++ = ((code >> 8) & 0xff); - *p++ = (code & 0xff); + if ((code & 0xff00) != 0) *p++ = (UChar )(((code >> 8) & 0xff)); + *p++ = (UChar )(code & 0xff); #if 0 if (enc_len(ONIG_ENCODING_SJIS, buf[0]) != (p - buf)) diff --git a/ext/mbstring/oniguruma/enc/utf8.c b/ext/mbstring/oniguruma/enc/utf8.c index 6f7ef0f3f6..604cfac2ef 100644 --- a/ext/mbstring/oniguruma/enc/utf8.c +++ b/ext/mbstring/oniguruma/enc/utf8.c @@ -112,36 +112,36 @@ utf8_code_to_mbc_first(OnigCodePoint code) static int utf8_code_to_mbc(OnigCodePoint code, UChar *buf) { -#define UTF8_TRAILS(code, shift) ((((code) >> (shift)) & 0x3f) | 0x80) -#define UTF8_TRAIL0(code) (((code) & 0x3f) | 0x80) +#define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80) +#define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80) if ((code & 0xffffff80) == 0) { - *buf = code; + *buf = (UChar )code; return 1; } else { UChar *p = buf; if ((code & 0xfffff800) == 0) { - *p++ = ((code>>6)& 0x1f) | 0xc0; + *p++ = (UChar )(((code>>6)& 0x1f) | 0xc0); } else if ((code & 0xffff0000) == 0) { - *p++ = ((code>>12) & 0x0f) | 0xe0; + *p++ = (UChar )(((code>>12) & 0x0f) | 0xe0); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0xffe00000) == 0) { - *p++ = ((code>>18) & 0x07) | 0xf0; + *p++ = (UChar )(((code>>18) & 0x07) | 0xf0); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0xfc000000) == 0) { - *p++ = ((code>>24) & 0x03) | 0xf8; + *p++ = (UChar )(((code>>24) & 0x03) | 0xf8); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0x80000000) == 0) { - *p++ = ((code>>30) & 0x01) | 0xfc; + *p++ = (UChar )(((code>>30) & 0x01) | 0xfc); *p++ = UTF8_TRAILS(code, 24); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); diff --git a/ext/mbstring/oniguruma/oniguruma.h b/ext/mbstring/oniguruma/oniguruma.h index fd9e8f1700..b4f5a84e6f 100644 --- a/ext/mbstring/oniguruma/oniguruma.h +++ b/ext/mbstring/oniguruma/oniguruma.h @@ -13,7 +13,7 @@ #define ONIGURUMA #define ONIGURUMA_VERSION_MAJOR 2 #define ONIGURUMA_VERSION_MINOR 2 -#define ONIGURUMA_VERSION_TEENY 2 +#define ONIGURUMA_VERSION_TEENY 4 #ifndef P_ #if defined(__STDC__) || defined(_WIN32) diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c index 9a89b92ecb..24d44dd1b8 100644 --- a/ext/mbstring/oniguruma/regcomp.c +++ b/ext/mbstring/oniguruma/regcomp.c @@ -830,7 +830,7 @@ compile_qualifier_node(QualifierNode* qn, regex_t* reg) r = compile_tree_empty_check(qn->target, reg, empty_info); if (r) return r; r = add_opcode_rel_addr(reg, OP_JUMP, - -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH_OR_JUMP_EXACT1)); + -(mod_tlen + (int )SIZE_OP_JUMP + (int )SIZE_OP_PUSH_OR_JUMP_EXACT1)); } else if (IS_NOT_NULL(qn->next_head_exact)) { r = add_opcode_rel_addr(reg, OP_PUSH_IF_PEEK_NEXT, @@ -840,7 +840,7 @@ compile_qualifier_node(QualifierNode* qn, regex_t* reg) r = compile_tree_empty_check(qn->target, reg, empty_info); if (r) return r; r = add_opcode_rel_addr(reg, OP_JUMP, - -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH_IF_PEEK_NEXT)); + -(mod_tlen + (int )SIZE_OP_JUMP + (int )SIZE_OP_PUSH_IF_PEEK_NEXT)); } else { r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); @@ -848,7 +848,7 @@ compile_qualifier_node(QualifierNode* qn, regex_t* reg) r = compile_tree_empty_check(qn->target, reg, empty_info); if (r) return r; r = add_opcode_rel_addr(reg, OP_JUMP, - -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH)); + -(mod_tlen + (int )SIZE_OP_JUMP + (int )SIZE_OP_PUSH)); } } else { @@ -856,7 +856,7 @@ compile_qualifier_node(QualifierNode* qn, regex_t* reg) if (r) return r; r = compile_tree_empty_check(qn->target, reg, empty_info); if (r) return r; - r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + SIZE_OP_PUSH)); + r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + (int )SIZE_OP_PUSH)); } } else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?..){0}/ */ @@ -1088,7 +1088,7 @@ compile_effect_node(EffectNode* node, regex_t* reg) r = add_opcode(reg, OP_POP); if (r) return r; r = add_opcode_rel_addr(reg, OP_JUMP, - -(SIZE_OP_PUSH + len + SIZE_OP_POP + SIZE_OP_JUMP)); + -((int )SIZE_OP_PUSH + len + (int )SIZE_OP_POP + (int )SIZE_OP_JUMP)); } else { r = add_opcode(reg, OP_PUSH_STOP_BT); @@ -3803,7 +3803,7 @@ concat_left_node_opt_info(NodeOptInfo* to, NodeOptInfo* add) if (to->expr.len > 0) { if (add->len.max > 0) { - if (to->expr.len > add->len.max) + if (to->expr.len > (int )add->len.max) to->expr.len = add->len.max; if (to->expr.mmd.max == 0) diff --git a/ext/mbstring/oniguruma/regenc.c b/ext/mbstring/oniguruma/regenc.c index 7e9c640bb6..21598ca7c7 100644 --- a/ext/mbstring/oniguruma/regenc.c +++ b/ext/mbstring/oniguruma/regenc.c @@ -233,7 +233,7 @@ onigenc_single_byte_code_to_mbc_first(OnigCodePoint code) extern int onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf) { - *buf = (code & 0xff); + *buf = (UChar )(code & 0xff); return 1; } @@ -355,9 +355,9 @@ onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) UChar *p = buf; if ((code & 0xff00) != 0) { - *p++ = ((code >> 8) & 0xff); + *p++ = (UChar )((code >> 8) & 0xff); } - *p++ = (code & 0xff); + *p++ = (UChar )(code & 0xff); #if 1 if (enc_len(enc, buf[0]) != (p - buf)) @@ -372,15 +372,15 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) UChar *p = buf; if ((code & 0xff000000) != 0) { - *p++ = ((code >> 24) & 0xff); + *p++ = (UChar )((code >> 24) & 0xff); } if ((code & 0xff0000) != 0) { - *p++ = ((code >> 16) & 0xff); + *p++ = (UChar )((code >> 16) & 0xff); } if ((code & 0xff00) != 0) { - *p++ = ((code >> 8) & 0xff); + *p++ = (UChar )((code >> 8) & 0xff); } - *p++ = (code & 0xff); + *p++ = (UChar )(code & 0xff); #if 1 if (enc_len(enc, buf[0]) != (p - buf)) diff --git a/ext/mbstring/oniguruma/regenc.h b/ext/mbstring/oniguruma/regenc.h index 935080a950..e0c6211d32 100644 --- a/ext/mbstring/oniguruma/regenc.h +++ b/ext/mbstring/oniguruma/regenc.h @@ -8,10 +8,9 @@ #ifndef REGENC_H #define REGENC_H -#ifndef ONIG_SOURCE_IS_WRAPPED +#ifndef RUBY_PLATFORM #include "config.h" #endif - #include "oniguruma.h" #ifndef NULL diff --git a/ext/mbstring/oniguruma/regex.c b/ext/mbstring/oniguruma/regex.c index 764b3963d9..2d79d000a8 100644 --- a/ext/mbstring/oniguruma/regex.c +++ b/ext/mbstring/oniguruma/regex.c @@ -8,8 +8,6 @@ /* * Source wrapper for Ruby. */ -#define ONIG_SOURCE_IS_WRAPPED - #include "regint.h" #include "regex.h" diff --git a/ext/mbstring/oniguruma/regexec.c b/ext/mbstring/oniguruma/regexec.c index c8772ba1f6..2ded602e15 100644 --- a/ext/mbstring/oniguruma/regexec.c +++ b/ext/mbstring/oniguruma/regexec.c @@ -935,6 +935,9 @@ static int MaxStackDepth = 0; } while (0) #ifdef RUBY_PLATFORM +/* + * :nodoc: + */ static VALUE onig_stat_print() { onig_print_statistics(stderr); @@ -951,7 +954,7 @@ extern void onig_statistics_init() MaxStackDepth = 0; #ifdef RUBY_PLATFORM - ONIG_RUBY_DEFINE_GLOBAL_FUNCTION("onig_stat_print", onig_stat_print, 0); + rb_define_global_function("onig_stat_print", onig_stat_print, 0); #endif } @@ -984,7 +987,7 @@ extern int onig_is_in_code_range(UChar* p, OnigCodePoint code) { OnigCodePoint n, *data; - int low, high, x; + OnigCodePoint low, high, x; GET_CODE_POINT(n, p); data = (OnigCodePoint* )p; @@ -1779,8 +1782,8 @@ match_at(regex_t* reg, UChar* str, UChar* end, UChar* sstart, #ifdef USE_SUBEXP_CALL case OP_MEMORY_END_PUSH_REC: STAT_OP_IN(OP_MEMORY_END_PUSH_REC); GET_MEMNUM_INC(mem, p); + STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */ STACK_PUSH_MEM_END(mem, s); - STACK_GET_MEM_START(mem, stkp); mem_start_stk[mem] = GET_STACK_INDEX(stkp); STAT_OP_OUT; continue; @@ -1790,7 +1793,12 @@ match_at(regex_t* reg, UChar* str, UChar* end, UChar* sstart, GET_MEMNUM_INC(mem, p); mem_end_stk[mem] = (StackIndex )((void* )s); STACK_GET_MEM_START(mem, stkp); - mem_start_stk[mem] = GET_STACK_INDEX(stkp); + + if (BIT_STATUS_AT(reg->bt_mem_start, mem)) + mem_start_stk[mem] = GET_STACK_INDEX(stkp); + else + mem_start_stk[mem] = (StackIndex )((void* )stkp->u.mem.pstr); + STACK_PUSH_MEM_END_MARK(mem); STAT_OP_OUT; continue; @@ -3044,11 +3052,11 @@ onig_search(regex_t* reg, UChar* str, UChar* end, semi_end = end; end_buf: - if (semi_end - str < reg->anchor_dmin) + if ((OnigDistance )(semi_end - str) < reg->anchor_dmin) goto mismatch_no_msa; if (range > start) { - if (semi_end - start > reg->anchor_dmax) { + if ((OnigDistance )(semi_end - start) > reg->anchor_dmax) { start = semi_end - reg->anchor_dmax; if (start < end) start = onigenc_get_right_adjust_char_head(reg->enc, str, start); @@ -3056,17 +3064,17 @@ onig_search(regex_t* reg, UChar* str, UChar* end, start = onigenc_get_prev_char_head(reg->enc, str, end); } } - if (semi_end - (range - 1) < reg->anchor_dmin) { + if ((OnigDistance )(semi_end - (range - 1)) < reg->anchor_dmin) { range = semi_end - reg->anchor_dmin + 1; } if (start >= range) goto mismatch_no_msa; } else { - if (semi_end - range > reg->anchor_dmax) { + if ((OnigDistance )(semi_end - range) > reg->anchor_dmax) { range = semi_end - reg->anchor_dmax; } - if (semi_end - start < reg->anchor_dmin) { + if ((OnigDistance )(semi_end - start) < reg->anchor_dmin) { start = semi_end - reg->anchor_dmin; start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, start); if (range > start) goto mismatch_no_msa; diff --git a/ext/mbstring/oniguruma/regint.h b/ext/mbstring/oniguruma/regint.h index c01a73c546..35736b6dcb 100644 --- a/ext/mbstring/oniguruma/regint.h +++ b/ext/mbstring/oniguruma/regint.h @@ -79,8 +79,6 @@ #endif #endif -#define ONIG_RUBY_DEFINE_GLOBAL_FUNCTION(s,f,n) \ - rb_define_global_function(s, f, n) #endif /* else NOT_RUBY */ #define THREAD_PASS_LIMIT_COUNT 10 @@ -340,14 +338,14 @@ typedef struct _BBuf { } while (0) #define BBUF_EXPAND(buf,low) do{\ - do { (buf)->alloc *= 2; } while ((buf)->alloc < low);\ + do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ } while (0) #define BBUF_ENSURE_SIZE(buf,size) do{\ - int new_alloc = (buf)->alloc;\ - while (new_alloc < (size)) { new_alloc *= 2; }\ + unsigned int new_alloc = (buf)->alloc;\ + while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\ if ((buf)->alloc != new_alloc) {\ (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ @@ -357,16 +355,16 @@ typedef struct _BBuf { #define BBUF_WRITE(buf,pos,bytes,n) do{\ int used = (pos) + (n);\ - if ((buf)->alloc < used) BBUF_EXPAND((buf),used);\ + if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\ xmemcpy((buf)->p + (pos), (bytes), (n));\ - if ((buf)->used < used) (buf)->used = used;\ + if ((buf)->used < (unsigned int )used) (buf)->used = used;\ } while (0) #define BBUF_WRITE1(buf,pos,byte) do{\ int used = (pos) + 1;\ - if ((buf)->alloc < used) BBUF_EXPAND((buf),used);\ + if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\ (buf)->p[(pos)] = (byte);\ - if ((buf)->used < used) (buf)->used = used;\ + if ((buf)->used < (unsigned int )used) (buf)->used = used;\ } while (0) #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n)) @@ -376,9 +374,9 @@ typedef struct _BBuf { /* from < to */ #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\ - if ((to) + (n) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\ + if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\ xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ - if ((to) + (n) > (buf)->used) (buf)->used = (to) + (n);\ + if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\ } while (0) /* from > to */ @@ -639,12 +637,12 @@ typedef int RepeatNumType; typedef struct { - OnigCodePoint esc; - OnigCodePoint anychar; - OnigCodePoint anytime; - OnigCodePoint zero_or_one_time; - OnigCodePoint one_or_more_time; - OnigCodePoint anychar_anytime; + UChar esc; + UChar anychar; + UChar anytime; + UChar zero_or_one_time; + UChar one_or_more_time; + UChar anychar_anytime; } OnigMetaCharTableType; extern OnigMetaCharTableType OnigMetaCharTable; diff --git a/ext/mbstring/oniguruma/regparse.c b/ext/mbstring/oniguruma/regparse.c index 673432c00e..2260df4155 100644 --- a/ext/mbstring/oniguruma/regparse.c +++ b/ext/mbstring/oniguruma/regparse.c @@ -1585,7 +1585,7 @@ add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to) to = data[(high - 1)*2 + 1]; } - if (inc_n != 0 && high < n) { + if (inc_n != 0 && (OnigCodePoint )high < n) { int from_pos = SIZE_CODE_POINT * (1 + high * 2); int to_pos = SIZE_CODE_POINT * (1 + (low + 1) * 2); int size = (n - high) * 2 * SIZE_CODE_POINT; @@ -1666,8 +1666,8 @@ not_code_range_buf(BBuf* bbuf, BBuf** pbuf) static int or_code_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) { - int i, r; - OnigCodePoint n1, *data1; + int r; + OnigCodePoint i, n1, *data1; OnigCodePoint from, to; *pbuf = (BBuf* )NULL; @@ -1762,8 +1762,8 @@ and_code_range1(BBuf** pbuf, OnigCodePoint from1, OnigCodePoint to1, static int and_code_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) { - int i, j, r; - OnigCodePoint n1, n2, *data1, *data2; + int r; + OnigCodePoint i, j, n1, n2, *data1, *data2; OnigCodePoint from, to, from1, to1, from2, to2; *pbuf = (BBuf* )NULL; @@ -3212,8 +3212,9 @@ static int add_ctype_to_cc_by_list(CClassNode* cc, int ctype, int not, OnigEncoding enc) { - int i, j, r, nsb, nmb; + int i, r, nsb, nmb; OnigCodePointRange *sbr, *mbr; + OnigCodePoint j; r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &nsb, &nmb, &sbr, &mbr); if (r != 0) return r; diff --git a/ext/mbstring/oniguruma/regposix.c b/ext/mbstring/oniguruma/regposix.c index 3604ccfdbf..4cb30cc565 100644 --- a/ext/mbstring/oniguruma/regposix.c +++ b/ext/mbstring/oniguruma/regposix.c @@ -166,7 +166,7 @@ regexec(regex_t* reg, const char* str, size_t nmatch, } else if (r == ONIG_MISMATCH) { r = REG_NOMATCH; - for (i = 0; i < nmatch; i++) + for (i = 0; i < (int )nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = ONIG_REGION_NOTPOS; } else {