[前][次][番号順一覧][スレッド一覧]

ruby-changes:18744

From: naruse <ko1@a...>
Date: Thu, 3 Feb 2011 16:37:40 +0900 (JST)
Subject: [ruby-changes:18744] Ruby:r30771 (trunk): * enc/shift_jis.c (code_to_mbc): cast as int from the subtraction of pointers.

naruse	2011-02-03 16:37:25 +0900 (Thu, 03 Feb 2011)

  New Revision: 30771

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30771

  Log:
    * enc/shift_jis.c (code_to_mbc): cast as int from the subtraction of pointers.
    
    * enc/utf_16le.c (utf16le_mbc_enc_len): use ptrdiff_t.
    
    * enc/utf_32be.c (utf32be_left_adjust_char_head): ditto.
    
    * enc/utf_32le.c (utf32le_left_adjust_char_head): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/enc/shift_jis.c
    trunk/enc/utf_16le.c
    trunk/enc/utf_32be.c
    trunk/enc/utf_32le.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30770)
+++ ChangeLog	(revision 30771)
@@ -1,3 +1,13 @@
+Thu Feb  3 16:34:10 2011  NARUSE, Yui  <naruse@r...>
+
+	* enc/shift_jis.c (code_to_mbc): cast as int from the subtraction of pointers.
+
+	* enc/utf_16le.c (utf16le_mbc_enc_len): use ptrdiff_t.
+
+	* enc/utf_32be.c (utf32be_left_adjust_char_head): ditto.
+
+	* enc/utf_32le.c (utf32le_left_adjust_char_head): ditto.
+
 Thu Feb  3 16:31:43 2011  NARUSE, Yui  <naruse@r...>
 
 	* include/ruby/missing.h: don't use HAVE_STDDEF_H because it never
Index: enc/shift_jis.c
===================================================================
--- enc/shift_jis.c	(revision 30770)
+++ enc/shift_jis.c	(revision 30771)
@@ -175,7 +175,7 @@
   if (enclen(enc, buf) != (p - buf))
     return REGERR_INVALID_CODE_POINT_VALUE;
 #endif
-  return p - buf;
+  return (int)(p - buf);
 }
 
 static int
Index: enc/utf_32be.c
===================================================================
--- enc/utf_32be.c	(revision 30770)
+++ enc/utf_32be.c	(revision 30771)
@@ -155,7 +155,7 @@
 utf32be_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end,
 			      OnigEncoding enc ARG_UNUSED)
 {
-  int rem;
+  ptrdiff_t rem;
 
   if (s <= start) return (UChar* )s;
 
Index: enc/utf_32le.c
===================================================================
--- enc/utf_32le.c	(revision 30770)
+++ enc/utf_32le.c	(revision 30771)
@@ -155,7 +155,7 @@
 utf32le_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end,
 			      OnigEncoding enc ARG_UNUSED)
 {
-  int rem;
+  ptrdiff_t rem;
 
   if (s <= start) return (UChar* )s;
 
Index: enc/utf_16le.c
===================================================================
--- enc/utf_16le.c	(revision 30770)
+++ enc/utf_16le.c	(revision 30771)
@@ -56,7 +56,8 @@
 utf16le_mbc_enc_len(const UChar* p, const OnigUChar* e,
 		    OnigEncoding enc ARG_UNUSED)
 {
-  int len = e-p, byte;
+  ptrdiff_t len = e - p;
+  UChar byte;
   if (len < 2)
     return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(1);
   byte = p[1];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]