Skip to content
Browse files

* 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
  • Loading branch information...
1 parent f83d4b1 commit 48de1e292a4f65840f01d31c5f8607f6b585057d @nurse nurse committed
Showing with 73 additions and 61 deletions.
  1. +11 −0 ChangeLog
  2. +9 −9 addr2line.c
  3. +27 −25 regcomp.c
  4. +17 −18 regexec.c
  5. +2 −2 regint.h
  6. +3 −3 regparse.c
  7. +1 −1 regparse.h
  8. +2 −2 time.c
  9. +1 −1 variable.c
View
11 ChangeLog
@@ -1,3 +1,14 @@
+Mon Jan 31 12:26:14 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * 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.
+
Mon Jan 31 04:45:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
* array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
View
18 addr2line.c
@@ -116,7 +116,7 @@ sleb128(char **p) {
}
static const char *
-get_nth_dirname(int dir, char *p)
+get_nth_dirname(unsigned long dir, char *p)
{
if (!dir--) {
return "";
@@ -125,7 +125,7 @@ get_nth_dirname(int dir, char *p)
while (*p) p++;
p++;
if (!*p) {
- fprintf(stderr, "Unexpected directory number %d in %s\n",
+ fprintf(stderr, "Unexpected directory number %lu in %s\n",
dir, binary_filename);
return "";
}
@@ -298,10 +298,10 @@ parse_debug_line_cu(int num_traces, void **traces,
break;
}
case DW_LNS_set_file:
- file = uleb128(&p);
+ file = (unsigned int)uleb128(&p);
break;
case DW_LNS_set_column:
- column = uleb128(&p);
+ column = (unsigned int)uleb128(&p);
break;
case DW_LNS_negate_stmt:
is_stmt = !is_stmt;
@@ -325,7 +325,7 @@ parse_debug_line_cu(int num_traces, void **traces,
epilogue_begin = 1;
break;
case DW_LNS_set_isa:
- isa = uleb128(&p);
+ isa = (unsigned int)uleb128(&p);
break;
case 0:
a = *(unsigned char *)p++;
@@ -360,13 +360,13 @@ parse_debug_line_cu(int num_traces, void **traces,
}
break;
default: {
- unsigned int addr_incr;
- int line_incr;
+ unsigned long addr_incr;
+ unsigned long line_incr;
a = op - opcode_base;
addr_incr = (a / line_range) * minimum_instruction_length;
line_incr = line_base + (a % line_range);
- addr += addr_incr;
- line += line_incr;
+ addr += (unsigned int)addr_incr;
+ line += (unsigned int)line_incr;
FILL_LINE();
}
}
View
52 regcomp.c
@@ -44,7 +44,6 @@ onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
return 0;
}
-
#ifndef PLATFORM_UNALIGNED_WORD_ACCESS
static unsigned char PadBuf[WORD_ALIGNMENT_SIZE];
#endif
@@ -142,7 +141,7 @@ bitset_on_num(BitSetRef bs)
#endif
extern int
-onig_bbuf_init(BBuf* buf, int size)
+onig_bbuf_init(BBuf* buf, OnigDistance size)
{
if (size <= 0) {
size = 0;
@@ -153,7 +152,7 @@ onig_bbuf_init(BBuf* buf, int size)
if (IS_NULL(buf->p)) return(ONIGERR_MEMORY);
}
- buf->alloc = size;
+ buf->alloc = (unsigned int)size;
buf->used = 0;
return 0;
}
@@ -240,7 +239,7 @@ add_abs_addr(regex_t* reg, int addr)
}
static int
-add_length(regex_t* reg, int len)
+add_length(regex_t* reg, OnigDistance len)
{
LengthType l = (LengthType )len;
@@ -285,7 +284,7 @@ add_opcode_rel_addr(regex_t* reg, int opcode, int addr)
}
static int
-add_bytes(regex_t* reg, UChar* bytes, int len)
+add_bytes(regex_t* reg, UChar* bytes, OnigDistance len)
{
BBUF_ADD(reg, bytes, len);
return 0;
@@ -318,7 +317,7 @@ static int compile_tree(Node* node, regex_t* reg);
(op) == OP_EXACTMB3N || (op) == OP_EXACTMBN || (op) == OP_EXACTN_IC)
static int
-select_str_opcode(int mb_len, int str_len, int ignore_case)
+select_str_opcode(int mb_len, OnigDistance str_len, int ignore_case)
{
int op;
@@ -439,7 +438,7 @@ add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance str_len,
}
static int
-add_compile_string(UChar* s, int mb_len, int str_len,
+add_compile_string(UChar* s, int mb_len, OnigDistance str_len,
regex_t* reg, int ignore_case)
{
int op = select_str_opcode(mb_len, str_len, ignore_case);
@@ -2311,7 +2310,7 @@ get_char_length_tree1(Node* node, regex_t* reg, int* len, int level)
do {
r = get_char_length_tree1(NCAR(node), reg, &tlen, level);
if (r == 0)
- *len = distance_add(*len, tlen);
+ *len = (int)distance_add(*len, tlen);
} while (r == 0 && IS_NOT_NULL(node = NCDR(node)));
break;
@@ -2358,7 +2357,7 @@ get_char_length_tree1(Node* node, regex_t* reg, int* len, int level)
if (qn->lower == qn->upper) {
r = get_char_length_tree1(qn->target, reg, &tlen, level);
if (r == 0)
- *len = distance_multiply(tlen, qn->lower);
+ *len = (int)distance_multiply(tlen, qn->lower);
}
else
r = GET_CHAR_LEN_VARLEN;
@@ -2431,7 +2430,8 @@ get_char_length_tree(Node* node, regex_t* reg, int* len)
static int
is_not_included(Node* x, Node* y, regex_t* reg)
{
- int i, len;
+ int i;
+ OnigDistance len;
OnigCodePoint code;
UChar *p, c;
int ytype;
@@ -2583,7 +2583,7 @@ is_not_included(Node* x, Node* y, regex_t* reg)
return 0;
}
else {
- for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) {
+ for (i = 0, p = ys->s, q = xs->s; (OnigDistance)i < len; i++, p++, q++) {
if (*p != *q) return 1;
}
}
@@ -3225,7 +3225,8 @@ update_string_node_case_fold(regex_t* reg, Node *node)
{
UChar *p, *q, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
UChar *sbuf, *ebuf, *sp;
- int r, i, len, sbuf_size;
+ int r, i, len;
+ OnigDistance sbuf_size;
StrNode* sn = NSTR(node);
end = sn->end;
@@ -3800,7 +3801,7 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
if (NTYPE(target) == NT_STR) {
if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper &&
qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) {
- int len = NSTRING_LEN(target);
+ OnigDistance len = NSTRING_LEN(target);
StrNode* sn = NSTR(target);
if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) {
@@ -3940,7 +3941,7 @@ static int
set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
UChar skip[], int** int_skip)
{
- int i, len;
+ OnigDistance i, len;
len = end - s;
if (len < ONIG_CHAR_TABLE_SIZE) {
@@ -3954,10 +3955,10 @@ set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
*int_skip = (int* )xmalloc(sizeof(int) * ONIG_CHAR_TABLE_SIZE);
if (IS_NULL(*int_skip)) return ONIGERR_MEMORY;
}
- for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = len;
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = (int)len;
for (i = 0; i < len - 1; i++)
- (*int_skip)[s[i]] = len - 1 - i;
+ (*int_skip)[s[i]] = (int)(len - 1 - i);
}
return 0;
}
@@ -4053,12 +4054,12 @@ distance_value(MinMaxLen* mm)
11, 11, 11, 11, 11, 10, 10, 10, 10, 10
};
- int d;
+ OnigDistance d;
if (mm->max == ONIG_INFINITE_DISTANCE) return 0;
d = mm->max - mm->min;
- if (d < (int )(sizeof(dist_vals)/sizeof(dist_vals[0])))
+ if (d < sizeof(dist_vals)/sizeof(dist_vals[0]))
/* return dist_vals[d] * 16 / (mm->min + 12); */
return (int )dist_vals[d];
else
@@ -4540,7 +4541,7 @@ concat_left_node_opt_info(OnigEncoding enc, NodeOptInfo* to, NodeOptInfo* add)
if (to->expr.len > 0) {
if (add->len.max > 0) {
if (to->expr.len > (int )add->len.max)
- to->expr.len = add->len.max;
+ to->expr.len = (int)add->len.max;
if (to->expr.mmd.max == 0)
select_opt_exact_info(enc, &to->exb, &to->expr);
@@ -4618,7 +4619,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
case NT_STR:
{
StrNode* sn = NSTR(node);
- int slen = sn->end - sn->s;
+ OnigDistance slen = sn->end - sn->s;
int is_raw = NSTRING_IS_RAW(node);
if (! NSTRING_IS_AMBIG(node)) {
@@ -4630,7 +4631,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
set_mml(&opt->len, slen, slen);
}
else {
- int max;
+ OnigDistance max;
if (NSTRING_IS_DONT_GET_OPT_INFO(node)) {
int n = onigenc_strlen(env->enc, sn->s, sn->end);
@@ -4653,7 +4654,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
set_mml(&opt->len, slen, max);
}
- if (opt->exb.len == slen)
+ if ((OnigDistance)opt->exb.len == slen)
opt->exb.reach_end = 1;
}
break;
@@ -4957,7 +4958,7 @@ set_optimize_exact_info(regex_t* reg, OptExactInfo* e)
reg->dmax = e->mmd.max;
if (reg->dmin != ONIG_INFINITE_DISTANCE) {
- reg->threshold_len = reg->dmin + (reg->exact_end - reg->exact);
+ reg->threshold_len = (int)(reg->dmin + (reg->exact_end - reg->exact));
}
return 0;
@@ -4976,7 +4977,7 @@ set_optimize_map_info(regex_t* reg, OptMapInfo* m)
reg->dmax = m->mmd.max;
if (reg->dmin != ONIG_INFINITE_DISTANCE) {
- reg->threshold_len = reg->dmin + 1;
+ reg->threshold_len = (int)(reg->dmin + 1);
}
}
@@ -5316,7 +5317,8 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
{
#define COMPILE_INIT_SIZE 20
- int r, init_size;
+ int r;
+ OnigDistance init_size;
Node* root;
ScanEnv scan_env = {0};
#ifdef USE_SUBEXP_CALL
View
35 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;
View
4 regint.h
@@ -403,7 +403,7 @@ typedef struct _BBuf {
} while (0)
#define BBUF_WRITE(buf,pos,bytes,n) do{\
- int used = (pos) + (n);\
+ int used = (pos) + (int)(n);\
if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
xmemcpy((buf)->p + (pos), (bytes), (n));\
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
@@ -802,7 +802,7 @@ extern void onig_print_statistics P_((FILE* f));
extern UChar* onig_error_code_to_format P_((int code));
extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
-extern int onig_bbuf_init P_((BBuf* buf, int size));
+extern int onig_bbuf_init P_((BBuf* buf, OnigDistance size));
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo, const char *sourcefile, int sourceline));
extern void onig_chain_reduce P_((regex_t* reg));
extern void onig_chain_link_add P_((regex_t* to, regex_t* add));
View
6 regparse.c
@@ -276,7 +276,7 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end)
static UChar*
strcat_capa(UChar* dest, UChar* dest_end, const UChar* src, const UChar* src_end,
- int capa)
+ size_t capa)
{
UChar* r;
@@ -293,7 +293,7 @@ strcat_capa(UChar* dest, UChar* dest_end, const UChar* src, const UChar* src_end
/* dest on static area */
static UChar*
strcat_capa_from_static(UChar* dest, UChar* dest_end,
- const UChar* src, const UChar* src_end, int capa)
+ const UChar* src, const UChar* src_end, size_t capa)
{
UChar* r;
@@ -1450,7 +1450,7 @@ onig_node_str_cat(Node* node, const UChar* s, const UChar* end)
CHECK_NULL_RETURN_MEMERR(p);
NSTR(node)->s = p;
- NSTR(node)->capa = capa;
+ NSTR(node)->capa = (int)capa;
}
}
else {
View
2 regparse.h
@@ -100,7 +100,7 @@
#define NSTR_AMBIG (1<<1)
#define NSTR_DONT_GET_OPT_INFO (1<<2)
-#define NSTRING_LEN(node) ((node)->u.str.end - (node)->u.str.s)
+#define NSTRING_LEN(node) (OnigDistance)((node)->u.str.end - (node)->u.str.s)
#define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
#define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
#define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
View
4 time.c
@@ -885,8 +885,8 @@ rb_localtime_r2(const time_t *t, struct tm *result)
result = rb_localtime_r(t, result);
#if defined(HAVE_MKTIME) && defined(LOCALTIME_OVERFLOW_PROBLEM)
if (result) {
- int gmtoff1 = 0;
- int gmtoff2 = 0;
+ long gmtoff1 = 0;
+ long gmtoff2 = 0;
struct tm tmp = *result;
time_t t2;
# if defined(HAVE_STRUCT_TM_TM_GMTOFF)
View
2 variable.c
@@ -1906,7 +1906,7 @@ rb_const_set(VALUE klass, ID id, VALUE val)
rb_vm_change_state();
ce = ALLOC(rb_const_entry_t);
- ce->flag = visibility;
+ ce->flag = (rb_const_flag_t)visibility;
ce->value = val;
st_insert(RCLASS_CONST_TBL(klass), (st_data_t)id, (st_data_t)ce);

0 comments on commit 48de1e2

Please sign in to comment.
Something went wrong with that request. Please try again.