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

ruby-changes:18445

From: nobu <ko1@a...>
Date: Thu, 6 Jan 2011 05:17:00 +0900 (JST)
Subject: [ruby-changes:18445] Ruby:r30468 (trunk): * enc/{emacs_mule,euc_jp}.c (code_to_mbc): suppress warnings.

nobu	2011-01-06 05:16:32 +0900 (Thu, 06 Jan 2011)

  New Revision: 30468

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

  Log:
    * enc/{emacs_mule,euc_jp}.c (code_to_mbc): suppress warnings.
    * enc/iso_8859_{1,2}.c (apply_all_case_fold): ditto.

  Modified files:
    trunk/enc/emacs_mule.c
    trunk/enc/euc_jp.c
    trunk/enc/iso_8859_1.c
    trunk/enc/iso_8859_2.c

Index: enc/euc_jp.c
===================================================================
--- enc/euc_jp.c	(revision 30467)
+++ enc/euc_jp.c	(revision 30468)
@@ -193,7 +193,7 @@
   if (enclen(enc, buf, p) != (p - buf))
     return ONIGERR_INVALID_CODE_POINT_VALUE;
 #endif  
-  return p - buf;
+  return (int)(p - buf);
 }
 
 static int
@@ -299,7 +299,7 @@
     return onigenc_minimum_property_name_to_ctype(enc, s, e);
   }
 
-  return ctype;
+  return (int)ctype;
 }
 
 static int
Index: enc/iso_8859_1.c
===================================================================
--- enc/iso_8859_1.c	(revision 30467)
+++ enc/iso_8859_1.c	(revision 30468)
@@ -29,6 +29,8 @@
 
 #include "regenc.h"
 
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
 #define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
   ((EncISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
 
@@ -107,7 +109,7 @@
 		    OnigEncoding enc ARG_UNUSED)
 {
   return onigenc_apply_all_case_fold_with_map(
-            sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+            numberof(CaseFoldMap), CaseFoldMap, 1,
             flag, f, arg);
 }
 
Index: enc/iso_8859_2.c
===================================================================
--- enc/iso_8859_2.c	(revision 30467)
+++ enc/iso_8859_2.c	(revision 30468)
@@ -29,6 +29,8 @@
 
 #include "regenc.h"
 
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
 #define ENC_ISO_8859_2_TO_LOWER_CASE(c) EncISO_8859_2_ToLowerCaseTable[c]
 #define ENC_IS_ISO_8859_2_CTYPE(code,ctype) \
   ((EncISO_8859_2_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
@@ -195,7 +197,7 @@
 		    OnigEncoding enc ARG_UNUSED)
 {
   return onigenc_apply_all_case_fold_with_map(
-            sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+            numberof(CaseFoldMap), CaseFoldMap, 1,
             flag, f, arg);
 }
 
@@ -206,7 +208,7 @@
 			   OnigEncoding enc ARG_UNUSED)
 {
   return onigenc_get_case_fold_codes_by_str_with_map(
-	     sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+	     numberof(CaseFoldMap), CaseFoldMap, 1,
 	     flag, p, end, items);
 }
 
Index: enc/emacs_mule.c
===================================================================
--- enc/emacs_mule.c	(revision 30467)
+++ enc/emacs_mule.c	(revision 30468)
@@ -264,7 +264,7 @@
 
   if (enclen(enc, buf, p) != (p - buf))
     return ONIGERR_INVALID_CODE_POINT_VALUE;
-  return p - buf;
+  return (int)(p - buf);
 }
 
 static int

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

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