From 876146772787599c894369801034f1fed1d16b54 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 26 Apr 2011 15:55:21 +0000 Subject: * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newline decorator according to open mode. * transcode.c (rb_econv_prepare_options): new function, to prepare econv options with newline flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/encoding.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/ruby') diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 5ccbbbdfd8..123f76aff5 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -244,6 +244,7 @@ typedef struct rb_econv_t rb_econv_t; VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts); int rb_econv_has_convpath_p(const char* from_encoding, const char* to_encoding); +int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags); int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts); rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags); @@ -314,6 +315,12 @@ void rb_econv_binmode(rb_econv_t *ec); #define ECONV_STATEFUL_DECORATOR_MASK 0x00f00000 #define ECONV_XML_ATTR_QUOTE_DECORATOR 0x00100000 +#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) +#define ECONV_DEFAULT_NEWLINE_DECORATOR ECONV_UNIVERSAL_NEWLINE_DECORATOR +#else +#define ECONV_DEFAULT_NEWLINE_DECORATOR 0 +#endif + /* end of flags for rb_econv_open */ /* flags for rb_econv_convert */ -- cgit v1.2.3