1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* regex.c (calculate_must_string, slow_search, re_search): Silence

warnings regarding char * vs. unsigned char * mismatch;
  submitted by Lyle Johnson <lyle.johnson@gmail.com>
  in [ruby-core:10416].

* ext/bigdecimal/bigdecimal.c (BigDecimal_load): Ditto.

* ext/digest/sha1/sha1ossl.c (SHA1_Finish): Ditto.

* ext/digest/rmd160/rmd160ossl.c (RMD160_Finish): Ditto.

* ext/digest/digest.c (rb_digest_base_finish,
  rb_digest_base_update): Ditto.

* ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
  rb_nkf_guess2): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2007-02-27 10:38:32 +00:00
parent 8e062b44bd
commit 5a9a84efe7
7 changed files with 39 additions and 20 deletions

View file

@ -1,3 +1,22 @@
Tue Feb 27 19:36:57 2007 Akinori MUSHA <knu@iDaemons.org>
* regex.c (calculate_must_string, slow_search, re_search): Silence
warnings regarding char * vs. unsigned char * mismatch;
submitted by Lyle Johnson <lyle.johnson@gmail.com>
in [ruby-core:10416].
* ext/bigdecimal/bigdecimal.c (BigDecimal_load): Ditto.
* ext/digest/sha1/sha1ossl.c (SHA1_Finish): Ditto.
* ext/digest/rmd160/rmd160ossl.c (RMD160_Finish): Ditto.
* ext/digest/digest.c (rb_digest_base_finish,
rb_digest_base_update): Ditto.
* ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
rb_nkf_guess2): Ditto.
Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org> Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock): * ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):

View file

@ -332,7 +332,7 @@ BigDecimal_load(VALUE self, VALUE str)
unsigned long m=0; unsigned long m=0;
SafeStringValue(str); SafeStringValue(str);
pch = RSTRING_PTR(str); pch = (unsigned char *)RSTRING_PTR(str);
/* First get max prec */ /* First get max prec */
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') { while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
if(!ISDIGIT(ch)) { if(!ISDIGIT(ch)) {
@ -341,7 +341,7 @@ BigDecimal_load(VALUE self, VALUE str)
m = m*10 + (unsigned long)(ch-'0'); m = m*10 + (unsigned long)(ch-'0');
} }
if(m>VpBaseFig()) m -= VpBaseFig(); if(m>VpBaseFig()) m -= VpBaseFig();
GUARD_OBJ(pv,VpNewRbClass(m,pch,self)); GUARD_OBJ(pv,VpNewRbClass(m,(char *)pch,self));
m /= VpBaseFig(); m /= VpBaseFig();
if(m && pv->MaxPrec>m) pv->MaxPrec = m+1; if(m && pv->MaxPrec>m) pv->MaxPrec = m+1;
return ToValue(pv); return ToValue(pv);

View file

@ -519,7 +519,7 @@ rb_digest_base_update(VALUE self, VALUE str)
Data_Get_Struct(self, void, pctx); Data_Get_Struct(self, void, pctx);
StringValue(str); StringValue(str);
algo->update_func(pctx, RSTRING_PTR(str), RSTRING_LEN(str)); algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
return self; return self;
} }
@ -537,7 +537,7 @@ rb_digest_base_finish(VALUE self)
Data_Get_Struct(self, void, pctx); Data_Get_Struct(self, void, pctx);
str = rb_str_new(0, algo->digest_len); str = rb_str_new(0, algo->digest_len);
algo->finish_func(pctx, RSTRING_PTR(str)); algo->finish_func(pctx, (unsigned char *)RSTRING_PTR(str));
/* avoid potential coredump caused by use of a finished context */ /* avoid potential coredump caused by use of a finished context */
algo->init_func(pctx); algo->init_func(pctx);

View file

@ -4,5 +4,5 @@
#include "rmd160ossl.h" #include "rmd160ossl.h"
void RMD160_Finish(RMD160_CTX *ctx, char *buf) { void RMD160_Finish(RMD160_CTX *ctx, char *buf) {
RIPEMD160_Final(buf, ctx); RIPEMD160_Final((unsigned char *)buf, ctx);
} }

View file

@ -6,5 +6,5 @@
void void
SHA1_Finish(SHA1_CTX *ctx, char *buf) SHA1_Finish(SHA1_CTX *ctx, char *buf)
{ {
SHA1_Final(buf, ctx); SHA1_Final((unsigned char *)buf, ctx);
} }

View file

@ -63,7 +63,7 @@ rb_nkf_putchar(c)
o_len += incsize; o_len += incsize;
rb_str_resize(result, o_len); rb_str_resize(result, o_len);
incsize *= 2; incsize *= 2;
output = RSTRING(result)->ptr; output = (unsigned char *)RSTRING(result)->ptr;
} }
output[output_ctr++] = c; output[output_ctr++] = c;
@ -158,13 +158,13 @@ rb_nkf_kconv(obj, opt, src)
input_ctr = 0; input_ctr = 0;
StringValue(src); StringValue(src);
input = RSTRING(src)->ptr; input = (unsigned char *)RSTRING(src)->ptr;
i_len = RSTRING(src)->len; i_len = RSTRING(src)->len;
result = rb_str_new(0, i_len*3 + 10); result = rb_str_new(0, i_len*3 + 10);
v = result; v = result;
output_ctr = 0; output_ctr = 0;
output = RSTRING(result)->ptr; output = (unsigned char *)RSTRING(result)->ptr;
o_len = RSTRING(result)->len; o_len = RSTRING(result)->len;
*output = '\0'; *output = '\0';
@ -213,7 +213,7 @@ rb_nkf_guess1(obj, src)
int sequence_counter = 0; int sequence_counter = 0;
StringValue(src); StringValue(src);
p = RSTRING(src)->ptr; p = (unsigned char *)RSTRING(src)->ptr;
pend = p + RSTRING(src)->len; pend = p + RSTRING(src)->len;
if (p == pend) return INT2FIX(_UNKNOWN); if (p == pend) return INT2FIX(_UNKNOWN);
@ -328,7 +328,7 @@ rb_nkf_guess2(obj, src)
input_ctr = 0; input_ctr = 0;
StringValue(src); StringValue(src);
input = RSTRING(src)->ptr; input = (unsigned char *)RSTRING(src)->ptr;
i_len = RSTRING(src)->len; i_len = RSTRING(src)->len;
if(x0201_f == WISH_TRUE) if(x0201_f == WISH_TRUE)

18
regex.c
View file

@ -1014,8 +1014,8 @@ calculate_must_string(start, end)
{ {
int mcnt; int mcnt;
int max = 0; int max = 0;
unsigned char *p = start; unsigned char *p = (unsigned char *)start;
unsigned char *pend = end; unsigned char *pend = (unsigned char *)end;
char *must = 0; char *must = 0;
if (start == NULL) return 0; if (start == NULL) return 0;
@ -1029,7 +1029,7 @@ calculate_must_string(start, end)
case exactn: case exactn:
mcnt = *p; mcnt = *p;
if (mcnt > max) { if (mcnt > max) {
must = p; must = (char *)p;
max = mcnt; max = mcnt;
} }
p += mcnt+1; p += mcnt+1;
@ -2689,7 +2689,7 @@ slow_search(little, llen, big, blen, translate)
} }
} }
if (slow_match(little, little+llen, big, bend, translate)) if (slow_match(little, little+llen, big, bend, (unsigned char *)translate))
return big - bsave; return big - bsave;
big+=mbclen(*big); big+=mbclen(*big);
@ -3222,13 +3222,13 @@ re_search(bufp, string, size, startpos, range, regs)
} }
pend = size; pend = size;
if (bufp->options & RE_OPTIMIZE_NO_BM) { if (bufp->options & RE_OPTIMIZE_NO_BM) {
pos = slow_search(bufp->must+1, len, pos = slow_search((unsigned char *)(bufp->must+1), len,
string+pbeg, pend-pbeg, (unsigned char*)(string+pbeg), pend-pbeg,
MAY_TRANSLATE()?translate:0); (char *)(MAY_TRANSLATE()?translate:0));
} }
else { else {
pos = bm_search(bufp->must+1, len, pos = bm_search((unsigned char *)(bufp->must+1), len,
string+pbeg, pend-pbeg, (unsigned char *)(string+pbeg), pend-pbeg,
bufp->must_skip, bufp->must_skip,
MAY_TRANSLATE()?translate:0); MAY_TRANSLATE()?translate:0);
} }