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

ruby-changes:7830

From: akr <ko1@a...>
Date: Mon, 15 Sep 2008 03:35:32 +0900 (JST)
Subject: [ruby-changes:7830] Ruby:r19351 (trunk): * transcode_data.h: return output functions ssize_t.

akr	2008-09-15 03:35:17 +0900 (Mon, 15 Sep 2008)

  New Revision: 19351

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

  Log:
    * transcode_data.h: return output functions ssize_t.
    
    * transcode.c (transcode_restartable0): don't need to cast the result
      of output functions.
    
    * enc/trans/newline.trans: follow the type change.
    
    * enc/trans/escape.trans: ditto.
    
    * enc/trans/utf_16_32.trans: ditto.
    
    * enc/trans/iso2022.trans: ditto.
    
    * enc/trans/japanese.trans: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/enc/trans/escape.trans
    trunk/enc/trans/iso2022.trans
    trunk/enc/trans/japanese.trans
    trunk/enc/trans/newline.trans
    trunk/enc/trans/utf_16_32.trans
    trunk/transcode.c
    trunk/transcode_data.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19350)
+++ ChangeLog	(revision 19351)
@@ -1,3 +1,20 @@
+Mon Sep 15 03:33:10 2008  Tanaka Akira  <akr@f...>
+
+	* transcode_data.h: return output functions ssize_t.
+
+	* transcode.c (transcode_restartable0): don't need to cast the result
+	  of output functions.
+
+	* enc/trans/newline.trans: follow the type change.
+
+	* enc/trans/escape.trans: ditto.
+
+	* enc/trans/utf_16_32.trans: ditto.
+
+	* enc/trans/iso2022.trans: ditto.
+
+	* enc/trans/japanese.trans: ditto.
+
 Mon Sep 15 03:04:29 2008  Tanaka Akira  <akr@f...>
 
 	* transcode_data.h: output function takes output buffer size.
Index: enc/trans/escape.trans
===================================================================
--- enc/trans/escape.trans	(revision 19350)
+++ enc/trans/escape.trans	(revision 19351)
@@ -43,7 +43,7 @@
     return 0;
 }
 
-static int
+static ssize_t
 fun_so_escape_xml_attr_quote(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
@@ -56,7 +56,7 @@
     return n;
 }
 
-static int
+static ssize_t
 escape_xml_attr_quote_finish(void *statep, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
Index: enc/trans/iso2022.trans
===================================================================
--- enc/trans/iso2022.trans	(revision 19350)
+++ enc/trans/iso2022.trans	(revision 19351)
@@ -70,7 +70,7 @@
         return (VALUE)INVALID;
 }
 
-static int
+static ssize_t
 fun_so_iso2022jp_decoder(void *statep, const unsigned char *s, size_t l, unsigned char* o, size_t osize)
 {
     unsigned char *sp = statep;
@@ -119,7 +119,7 @@
     NULL, fun_si_iso2022jp_decoder, NULL, fun_so_iso2022jp_decoder
 };
 
-static int
+static ssize_t
 fun_so_iso2022jp_encoder(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
@@ -172,7 +172,7 @@
     return 0;
 }
 
-static int
+static ssize_t
 finish_iso2022jp_encoder(void *statep, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
@@ -203,7 +203,7 @@
     iso2022jp_encoder_reset_sequence_size, finish_iso2022jp_encoder
 };
 
-static int
+static ssize_t
 fun_so_stateless_iso2022jp_to_eucjp(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     o[0] = s[1];
@@ -223,7 +223,7 @@
     NULL, NULL, NULL, fun_so_stateless_iso2022jp_to_eucjp,
 };
 
-static int
+static ssize_t
 fun_so_eucjp_to_stateless_iso2022jp(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     o[0] = EMACS_MULE_LEADING_CODE_JISX0208_1983;
Index: enc/trans/newline.trans
===================================================================
--- enc/trans/newline.trans	(revision 19350)
+++ enc/trans/newline.trans	(revision 19351)
@@ -40,7 +40,7 @@
     return 0;
 }
 
-static int
+static ssize_t
 fun_so_universal_newline(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
@@ -75,7 +75,7 @@
     return len;
 }
 
-static int
+static ssize_t
 universal_newline_finish(void *statep, unsigned char *o, size_t osize)
 {
     unsigned char *sp = statep;
Index: enc/trans/utf_16_32.trans
===================================================================
--- enc/trans/utf_16_32.trans	(revision 19350)
+++ enc/trans/utf_16_32.trans	(revision 19351)
@@ -37,7 +37,7 @@
 
 <%= transcode_generated_code %>
 
-static int
+static ssize_t
 fun_so_from_utf_16be(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!s[0] && s[1]<0x80) {
@@ -65,7 +65,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_to_utf_16be(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!(s[0]&0x80)) {
@@ -93,7 +93,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_from_utf_16le(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!s[1] && s[0]<0x80) {
@@ -121,7 +121,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_to_utf_16le(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!(s[0]&0x80)) {
@@ -149,7 +149,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_from_utf_32be(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!s[1]) {
@@ -178,7 +178,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_to_utf_32be(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     o[0] = 0;
@@ -204,7 +204,7 @@
     return 4;
 }
 
-static int
+static ssize_t
 fun_so_from_utf_32le(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (!s[2]) {
@@ -233,7 +233,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_to_utf_32le(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     o[3] = 0;
Index: enc/trans/japanese.trans
===================================================================
--- enc/trans/japanese.trans	(revision 19350)
+++ enc/trans/japanese.trans	(revision 19351)
@@ -19,7 +19,7 @@
 
 <%= transcode_generated_code %>
 
-static int
+static ssize_t
 fun_so_eucjp2sjis(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (s[0] == 0x8e) {
@@ -40,7 +40,7 @@
     }
 }
 
-static int
+static ssize_t
 fun_so_sjis2eucjp(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
 {
     if (l == 1) {
Index: transcode_data.h
===================================================================
--- transcode_data.h	(revision 19350)
+++ transcode_data.h	(revision 19351)
@@ -84,9 +84,9 @@
     int (*state_fini_func)(void*); /* ret==0:success ret!=0:failure(errno) */
     VALUE (*func_ii)(void*, VALUE); /* info  -> info   */
     VALUE (*func_si)(void*, const unsigned char*, size_t); /* start -> info   */
-    int (*func_io)(void*, VALUE, const unsigned char*, size_t); /* info  -> output */
-    int (*func_so)(void*, const unsigned char*, size_t, unsigned char*, size_t); /* start -> output */
-    int (*finish_func)(void*, unsigned char*, size_t); /* -> output */
+    ssize_t (*func_io)(void*, VALUE, const unsigned char*, size_t); /* info  -> output */
+    ssize_t (*func_so)(void*, const unsigned char*, size_t, unsigned char*, size_t); /* start -> output */
+    ssize_t (*finish_func)(void*, unsigned char*, size_t); /* -> output */
     int (*resetsize_func)(void*); /* -> len */
     int (*resetstate_func)(void*, unsigned char*, size_t); /* -> output */
 };
Index: transcode.c
===================================================================
--- transcode.c	(revision 19350)
+++ transcode.c	(revision 19351)
@@ -604,11 +604,10 @@
 	  case FUNio:
             SUSPEND_OBUF(13);
             if (tr->max_output <= out_stop - out_p)
-                out_p += (VALUE)(*tr->func_io)(TRANSCODING_STATE(tc),
-                    next_info,
-                    out_p, out_stop - out_p);
+                out_p += tr->func_io(TRANSCODING_STATE(tc),
+                    next_info, out_p, out_stop - out_p);
             else {
-                writebuf_len = (VALUE)(*tr->func_io)(TRANSCODING_STATE(tc),
+                writebuf_len = tr->func_io(TRANSCODING_STATE(tc),
                     next_info,
                     TRANSCODING_WRITEBUF(tc), TRANSCODING_WRITEBUF_SIZE(tc));
                 writebuf_off = 0;
@@ -625,13 +624,13 @@
                 SUSPEND_OBUF(14);
                 if (tr->max_output <= out_stop - out_p) {
                     char_start = transcode_char_start(tc, *in_pos, inchar_start, in_p, &char_len);
-                    out_p += (VALUE)(*tr->func_so)(TRANSCODING_STATE(tc),
+                    out_p += tr->func_so(TRANSCODING_STATE(tc),
                         char_start, (size_t)char_len,
                         out_p, out_stop - out_p);
                 }
                 else {
                     char_start = transcode_char_start(tc, *in_pos, inchar_start, in_p, &char_len);
-                    writebuf_len = (VALUE)(*tr->func_so)(TRANSCODING_STATE(tc),
+                    writebuf_len = tr->func_so(TRANSCODING_STATE(tc),
                         char_start, (size_t)char_len,
                         TRANSCODING_WRITEBUF(tc), TRANSCODING_WRITEBUF_SIZE(tc));
                     writebuf_off = 0;

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

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