Skip to content

Commit

Permalink
* bignum.c, node.h, strftime.c, enc/trans/utf8_mac.trans: added expli…
Browse files Browse the repository at this point in the history
…cit casts for supplessing warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
mrkn committed Mar 25, 2010
1 parent 31bc607 commit e4d8dc5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Thu Mar 25 11:34:00 2010 Kenta Murata <[email protected]>

* bignum.c, node.h, strftime.c, enc/trans/utf8_mac.trans:
added explicit casts for supplessing warnings.

Thu Mar 25 11:34:00 2010 Kenta Murata <[email protected]>

* test/ruby/test_dir_m17n.rb: HFS+ escapes invalid byte sequences of
Expand Down
2 changes: 1 addition & 1 deletion bignum.c
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,7 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)

dd = 0;
q = yds[ny-1];
while ((q & (1UL<<(BITSPERDIG-1))) == 0) {
while ((q & (BDIGIT)(1UL<<(BITSPERDIG-1))) == 0) {
q <<= 1UL;
dd++;
}
Expand Down
2 changes: 1 addition & 1 deletion enc/trans/utf8_mac.trans
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fun_so_from_utf8_mac(void *statep,
unsigned char *o, size_t osize)
{
struct from_utf8_mac_status *sp = statep;
int n = 0;
ssize_t n = 0;

switch (l) {
case 1:
Expand Down
2 changes: 1 addition & 1 deletion node.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ typedef struct RNode {

#define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
#define nd_set_type(n,t) \
RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|(((t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))

#define NODE_LSHIFT (NODE_TYPESHIFT+7)
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
Expand Down
23 changes: 12 additions & 11 deletions strftime.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
const char *sp, *tp;
auto char tbuf[100];
long off;
int i, w;
ptrdiff_t i;
int w;
long y;
static short first = 1;
#ifdef POSIX_SEMANTICS
Expand Down Expand Up @@ -411,12 +412,12 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,

case 'd': /* day of the month, 01 - 31 */
i = range(1, vtm->mday, 31);
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'H': /* hour, 24-hour clock, 00 - 23 */
i = range(0, vtm->hour, 23);
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'I': /* hour, 12-hour clock, 01 - 12 */
Expand All @@ -425,7 +426,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
i = 12;
else if (i > 12)
i -= 12;
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'j': /* day of the year, 001 - 366 */
Expand All @@ -434,12 +435,12 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,

case 'm': /* month, 01 - 12 */
i = range(1, vtm->mon, 12);
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'M': /* minute, 00 - 59 */
i = range(0, vtm->min, 59);
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'p': /* AM or PM based on 12-hour clock */
Expand All @@ -466,7 +467,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,

case 'S': /* second, 00 - 60 */
i = range(0, vtm->sec, 60);
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'U': /* week of year, Sunday is first day of week */
Expand All @@ -475,7 +476,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,

case 'w': /* weekday, Sunday == 0, 0 - 6 */
i = range(0, vtm->wday, 6);
FMT('0', 1, "d", i);
FMT('0', 1, "d", (int)i);
continue;

case 'W': /* week of year, Monday is first day of week */
Expand All @@ -492,7 +493,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,

case 'y': /* year without a century, 00 - 99 */
i = NUM2INT(mod(vtm->year, INT2FIX(100)));
FMT('0', 2, "d", i);
FMT('0', 2, "d", (int)i);
continue;

case 'Y': /* year with century */
Expand Down Expand Up @@ -658,7 +659,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
#ifdef SUNOS_EXT
case 'k': /* hour, 24-hour clock, blank pad */
i = range(0, vtm->hour, 23);
FMT(' ', 2, "d", i);
FMT(' ', 2, "d", (int)i);
continue;

case 'l': /* hour, 12-hour clock, 1 - 12, blank pad */
Expand All @@ -667,7 +668,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
i = 12;
else if (i > 12)
i -= 12;
FMT(' ', 2, "d", i);
FMT(' ', 2, "d", (int)i);
continue;
#endif

Expand Down

0 comments on commit e4d8dc5

Please sign in to comment.