diff options
author | luislavena <luislavena@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-04 01:10:06 +0000 |
---|---|---|
committer | luislavena <luislavena@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-04 01:10:06 +0000 |
commit | f9a6a1dd0c687dfc6e63e5d20bc3812416def301 (patch) | |
tree | 2f77668d636ebbc6fd4deeb05dae91d97f71b38c /ext/zlib | |
parent | 4a1cfe70dc31f9be8a12908d85b51297d61b8eae (diff) | |
download | ruby-f9a6a1dd0c687dfc6e63e5d20bc3812416def301.tar.gz |
Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline decorator
Use CRLF only when required to improve file reading and writing under Windows.
Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/zlib.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index a235cbb621..073883bc05 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -10,6 +10,7 @@ #include <zlib.h> #include <time.h> #include <ruby/io.h> +#include <fcntl.h> #ifdef HAVE_VALGRIND_MEMCHECK_H # include <valgrind/memcheck.h> @@ -3425,6 +3426,13 @@ rb_gzreader_initialize(int argc, VALUE *argv, VALUE obj) Data_Get_Struct(obj, struct gzfile, gz); rb_scan_args(argc, argv, "1:", &io, &opt); +#ifdef O_BINARY + if (BUILTIN_TYPE(io) == T_FILE) { + rb_io_t *fptr; + GetOpenFile(io, fptr); + setmode(fptr->fd, O_BINARY); + } +#endif /* this is undocumented feature of zlib */ err = inflateInit2(&gz->z.stream, -MAX_WBITS); |