summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-31 03:44:57 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-31 03:44:57 (GMT)
commit48de1e292a4f65840f01d31c5f8607f6b585057d (patch)
tree29af77d2e1dd1c8e44e522ac84847ab4de84afa1 /regexec.c
parentf83d4b17804f11a78a8c6f877543a7c55b734dd2 (diff)
* addr2line.c: suppressed shorten-64-to-32 warnings.
* regcomp.c: ditto. * regexec.c: ditto. * regint.h: ditto. * regparse.c: ditto. * regparse.h: ditto. * time.c: ditto. * variable.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/regexec.c b/regexec.c
index 0c2f574..4c0ba17 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1254,7 +1254,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
{
static const UChar FinishCode[] = { OP_FINISH };
- int i, n, num_mem, best_len, pop_level;
+ int i, num_mem, best_len, pop_level;
+ ptrdiff_t n;
LengthType tlen, tlen2;
MemNumType mem;
RelAddrType addr;
@@ -1331,14 +1332,14 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
if (IS_FIND_LONGEST(option)) {
if (n > msa->best_len) {
- msa->best_len = n;
+ msa->best_len = (int)n;
msa->best_s = (UChar* )sstart;
}
else
goto end_best_len;
}
#endif
- best_len = n;
+ best_len = (int)n;
region = msa->region;
if (region) {
#ifdef USE_POSIX_API_REGION_OPTION
@@ -1365,18 +1366,16 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
else {
#endif /* USE_POSIX_API_REGION_OPTION */
- region->beg[0] = sstart - str;
- region->end[0] = s - str;
+ region->beg[0] = (int)(sstart - str);
+ region->end[0] = (int)(s - str);
for (i = 1; i <= num_mem; i++) {
if (mem_end_stk[i] != INVALID_STACK_INDEX) {
- if (BIT_STATUS_AT(reg->bt_mem_start, i))
- region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;
- else
- region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;
-
- region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)
- ? STACK_AT(mem_end_stk[i])->u.mem.pstr
- : (UChar* )((void* )mem_end_stk[i])) - str;
+ region->beg[i] = (int)((BIT_STATUS_AT(reg->bt_mem_start, i))
+ ? STACK_AT(mem_start_stk[i])->u.mem.pstr - str
+ : (UChar* )((void* )mem_start_stk[i]) - str);
+ region->end[i] = (int)(BIT_STATUS_AT(reg->bt_mem_end, i)
+ ? STACK_AT(mem_end_stk[i])->u.mem.pstr - str
+ : (UChar* )((void* )mem_end_stk[i]) - str);
}
else {
region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;
@@ -2201,7 +2200,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
n = pend - pstart;
DATA_ENSURE(n);
sprev = s;
- STRING_CMP_IC(case_fold_flag, pstart, &s, n, end);
+ STRING_CMP_IC(case_fold_flag, pstart, &s, (int)n, end);
while (sprev + (len = enclen(encode, sprev, end)) < s)
sprev += len;
@@ -2273,7 +2272,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(n);
sprev = s;
swork = s;
- STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, end, is_fail);
+ STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, (int)n, end, is_fail);
if (is_fail) continue;
s = swork;
while (sprev + (len = enclen(encode, sprev, end)) < s)
@@ -2898,7 +2897,7 @@ bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
{
const UChar *s, *se, *t, *p, *end;
const UChar *tail;
- int skip, tlen1;
+ ptrdiff_t skip, tlen1;
#ifdef ONIG_DEBUG_SEARCH
fprintf(stderr, "bm_search_notrev: text: %d, text_end: %d, text_range: %d\n",
@@ -2997,7 +2996,7 @@ set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
if (IS_NULL(*skip)) return ONIGERR_MEMORY;
}
- len = end - s;
+ len = (int)(end - s);
for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++)
(*skip)[i] = len;
@@ -3370,7 +3369,7 @@ extern long
onig_search(regex_t* reg, const UChar* str, const UChar* end,
const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option)
{
- int r;
+ long r;
UChar *s, *prev;
OnigMatchArg msa;
const UChar *orig_start = start;