#include <ruby.h>
#include <zlib.h>
#include <time.h>
#include <ruby/encoding.h>
Go to the source code of this file.
#define ARG_FLUSH | ( | val | ) | FIXNUMARG((val), Z_NO_FLUSH) |
Definition at line 1157 of file zlib.c.
Referenced by rb_deflate_deflate().
#define ARG_LEVEL | ( | val | ) | FIXNUMARG((val), Z_DEFAULT_COMPRESSION) |
Definition at line 1153 of file zlib.c.
Referenced by rb_deflate_initialize(), rb_deflate_params(), and rb_deflate_s_deflate().
#define ARG_MEMLEVEL | ( | val | ) | FIXNUMARG((val), DEF_MEM_LEVEL) |
Definition at line 1155 of file zlib.c.
Referenced by rb_deflate_initialize().
#define ARG_STRATEGY | ( | val | ) | FIXNUMARG((val), Z_DEFAULT_STRATEGY) |
Definition at line 1156 of file zlib.c.
Referenced by rb_deflate_initialize(), and rb_deflate_params().
#define ARG_WBITS | ( | val | ) | FIXNUMARG((val), MAX_WBITS) |
Definition at line 1154 of file zlib.c.
Referenced by rb_deflate_initialize(), and rb_inflate_initialize().
#define DEF_MEM_LEVEL MAX_MEM_LEVEL |
Definition at line 41 of file zlib.c.
Referenced by Init_zlib().
#define FIXNUMARG | ( | val, | ||
ifnil | ||||
) |
(NIL_P((val)) ? (ifnil) \ : ((void)Check_Type((val), T_FIXNUM), FIX2INT((val))))
Definition at line 1149 of file zlib.c.
Referenced by rb_deflate_flush().
#define rb_zlib_adler32_combine rb_f_notimplement |
Definition at line 350 of file zlib.c.
Referenced by Init_zlib().
#define rb_zlib_crc32_combine rb_f_notimplement |
Definition at line 384 of file zlib.c.
Referenced by Init_zlib().
#define RUBY_ZLIB_VERSION "0.6.0" |
Definition at line 27 of file zlib.c.
Referenced by Init_zlib().
#define VALGRIND_MAKE_MEM_DEFINED | ( | p, | ||
n | ||||
) |
Definition at line 23 of file zlib.c.
Referenced by zlib_mem_alloc().
#define zstream_append_buffer2 | ( | z, | ||
v | ||||
) | zstream_append_buffer((z),(Bytef*)RSTRING_PTR(v),RSTRING_LEN(v)) |
Definition at line 569 of file zlib.c.
Referenced by rb_inflate_addstr(), rb_inflate_inflate(), and zstream_passthrough_input().
#define zstream_append_input2 | ( | z, | ||
v | ||||
) |
RB_GC_GUARD(v),\ zstream_append_input((z), (Bytef*)RSTRING_PTR(v), RSTRING_LEN(v))
#define ZSTREAM_AVAIL_OUT_STEP_MAX 16384 |
Definition at line 437 of file zlib.c.
Referenced by zstream_expand_buffer(), and zstream_shift_buffer().
#define ZSTREAM_AVAIL_OUT_STEP_MIN 2048 |
Definition at line 438 of file zlib.c.
Referenced by zstream_expand_buffer().
#define zstream_deflate_new | ( | klass | ) | zstream_new((klass), &deflate_funcs) |
Definition at line 894 of file zlib.c.
Referenced by rb_deflate_s_allocate().
#define ZSTREAM_FLAG_IN_STREAM 0x2 |
Definition at line 424 of file zlib.c.
Referenced by zstream_end().
#define zstream_inflate_new | ( | klass | ) | zstream_new((klass), &inflate_funcs) |
Definition at line 895 of file zlib.c.
Referenced by rb_inflate_s_allocate().
#define zstream_init_deflate | ( | z | ) | zstream_init((z), &deflate_funcs) |
Definition at line 485 of file zlib.c.
Referenced by rb_deflate_s_deflate().
#define zstream_init_inflate | ( | z | ) | zstream_init((z), &inflate_funcs) |
Definition at line 486 of file zlib.c.
Referenced by rb_inflate_s_inflate().
#define ZSTREAM_INITIAL_BUFSIZE 1024 |
Definition at line 436 of file zlib.c.
Referenced by zstream_expand_buffer().
#define ZSTREAM_IS_CLOSING | ( | z | ) | ((z)->flags & ZSTREAM_FLAG_CLOSING) |
#define ZSTREAM_IS_FINISHED | ( | z | ) | ((z)->flags & ZSTREAM_FLAG_FINISHED) |
Definition at line 431 of file zlib.c.
Referenced by rb_inflate_addstr(), rb_inflate_inflate(), and rb_zstream_finished_p().
#define ZSTREAM_IS_READY | ( | z | ) | ((z)->flags & ZSTREAM_FLAG_READY) |
Definition at line 430 of file zlib.c.
Referenced by get_zstream(), rb_zstream_closed_p(), zstream_end(), and zstream_free().
#define ZSTREAM_READY | ( | z | ) | ((z)->flags |= ZSTREAM_FLAG_READY) |
Definition at line 429 of file zlib.c.
Referenced by rb_deflate_initialize(), rb_deflate_s_deflate(), rb_inflate_initialize(), and rb_inflate_s_inflate().
Definition at line 1221 of file zlib.c.
References RSTRING_LEN, RSTRING_PTR, zstream_detach_buffer(), and zstream_run().
Referenced by rb_deflate_s_deflate().
Definition at line 289 of file zlib.c.
References func, NIL_P, NUM2ULONG, rb_scan_args(), rb_uint2inum(), RSTRING_LEN, RSTRING_PTR, and StringValue.
Referenced by rb_zlib_adler32(), and rb_zlib_crc32().
Definition at line 1277 of file zlib.c.
References NIL_P, RSTRING_LEN, RSTRING_PTR, StringValue, and zstream_run().
Referenced by rb_deflate_addstr(), and rb_deflate_deflate().
Definition at line 1522 of file zlib.c.
References NIL_P, RSTRING_LEN, RSTRING_PTR, StringValue, and zstream_run().
Referenced by rb_inflate_addstr(), and rb_inflate_inflate().
static void finalizer_warn | ( | const char * | msg | ) | [static] |
Definition at line 267 of file zlib.c.
Referenced by zstream_finalize().
Definition at line 898 of file zlib.c.
References Data_Get_Struct, rb_raise(), and ZSTREAM_IS_READY.
Referenced by rb_deflate_addstr(), rb_deflate_deflate(), rb_deflate_flush(), rb_deflate_init_copy(), rb_deflate_params(), rb_deflate_set_dictionary(), rb_inflate_addstr(), rb_inflate_inflate(), rb_inflate_set_dictionary(), rb_inflate_sync(), rb_inflate_sync_point_p(), rb_zstream_adler(), rb_zstream_data_type(), rb_zstream_end(), rb_zstream_finish(), rb_zstream_finished_p(), rb_zstream_reset(), rb_zstream_set_avail_out(), rb_zstream_total_in(), and rb_zstream_total_out().
Definition at line 1471 of file zlib.c.
References RSTRING_LEN, RSTRING_PTR, zstream_detach_buffer(), and zstream_run().
Referenced by rb_inflate_s_inflate().
void Init_zlib | ( | void | ) |
Definition at line 3522 of file zlib.c.
References DEF_MEM_LEVEL, INT2FIX, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_const(), rb_define_method(), rb_define_module(), rb_define_module_function(), rb_define_singleton_method(), rb_deflate_addstr(), rb_deflate_deflate(), rb_deflate_flush(), rb_deflate_init_copy(), rb_deflate_initialize(), rb_deflate_params(), rb_deflate_s_allocate(), rb_deflate_s_deflate(), rb_deflate_set_dictionary(), rb_eStandardError, rb_include_module(), rb_inflate_addstr(), rb_inflate_inflate(), rb_inflate_initialize(), rb_inflate_s_allocate(), rb_inflate_s_inflate(), rb_inflate_set_dictionary(), rb_inflate_sync(), rb_inflate_sync_point_p(), rb_intern, rb_mEnumerable, rb_str_new2(), rb_undef_alloc_func(), rb_zlib_adler32(), rb_zlib_adler32_combine, rb_zlib_crc32(), rb_zlib_crc32_combine, rb_zlib_crc_table(), rb_zlib_version(), rb_zstream_adler(), rb_zstream_avail_in(), rb_zstream_avail_out(), rb_zstream_closed_p(), rb_zstream_data_type(), rb_zstream_end(), rb_zstream_finish(), rb_zstream_finished_p(), rb_zstream_flush_next_in(), rb_zstream_flush_next_out(), rb_zstream_reset(), rb_zstream_set_avail_out(), rb_zstream_total_in(), rb_zstream_total_out(), and RUBY_ZLIB_VERSION.
static NORETURN | ( | void | raise_zlib_errorint, const char * | ) | [static] |
static void raise_zlib_error | ( | int | err, | |
const char * | msg | |||
) | [static] |
Definition at line 219 of file zlib.c.
References buf, rb_exc_new2(), rb_exc_raise(), rb_sys_fail(), and snprintf.
Referenced by rb_deflate_init_copy(), rb_deflate_initialize(), rb_deflate_params(), rb_deflate_s_deflate(), rb_deflate_set_dictionary(), rb_inflate_initialize(), rb_inflate_s_inflate(), rb_inflate_set_dictionary(), rb_inflate_sync_point_p(), zstream_end(), zstream_reset(), zstream_run(), and zstream_sync().
Definition at line 1326 of file zlib.c.
References do_deflate(), get_zstream(), and OBJ_INFECT.
Referenced by Init_zlib().
Definition at line 1304 of file zlib.c.
References ARG_FLUSH, do_deflate(), get_zstream(), OBJ_INFECT, rb_scan_args(), and zstream_detach_buffer().
Referenced by Init_zlib().
Definition at line 1343 of file zlib.c.
References FIXNUMARG, get_zstream(), OBJ_INFECT, rb_scan_args(), zstream_detach_buffer(), and zstream_run().
Referenced by Init_zlib().
Definition at line 1200 of file zlib.c.
References zstream::buf, zstream::buf_filled, Data_Get_Struct, err, zstream::flags, get_zstream(), zstream::input, NIL_P, Qnil, raise_zlib_error(), rb_str_dup(), and zstream::stream.
Referenced by Init_zlib().
Definition at line 1176 of file zlib.c.
References ARG_LEVEL, ARG_MEMLEVEL, ARG_STRATEGY, ARG_WBITS, Data_Get_Struct, err, raise_zlib_error(), rb_scan_args(), zstream::stream, and ZSTREAM_READY.
Referenced by Init_zlib().
Definition at line 1370 of file zlib.c.
References ARG_LEVEL, ARG_STRATEGY, zstream::buf_filled, err, get_zstream(), raise_zlib_error(), rb_warning(), zstream::stream, and zstream_expand_buffer().
Referenced by Init_zlib().
Definition at line 1251 of file zlib.c.
References ARG_LEVEL, deflate_run(), err, OBJ_INFECT, raise_zlib_error(), rb_ensure(), rb_scan_args(), zstream::stream, StringValue, zstream_end(), zstream_init_deflate, and ZSTREAM_READY.
Referenced by Init_zlib().
Definition at line 1407 of file zlib.c.
References err, get_zstream(), OBJ_INFECT, raise_zlib_error(), RSTRING_LEN, RSTRING_PTR, zstream::stream, and StringValue.
Referenced by Init_zlib().
Definition at line 1586 of file zlib.c.
References do_inflate(), get_zstream(), NIL_P, OBJ_INFECT, StringValue, zstream_append_buffer2, ZSTREAM_IS_FINISHED, and zstream_passthrough_input().
Referenced by Init_zlib().
Definition at line 1549 of file zlib.c.
References do_inflate(), get_zstream(), NIL_P, OBJ_INFECT, rb_str_new(), StringValue, zstream_append_buffer2, zstream_detach_buffer(), ZSTREAM_IS_FINISHED, and zstream_passthrough_input().
Referenced by Init_zlib().
Definition at line 1452 of file zlib.c.
References ARG_WBITS, Data_Get_Struct, err, raise_zlib_error(), rb_scan_args(), zstream::stream, and ZSTREAM_READY.
Referenced by Init_zlib().
Definition at line 1499 of file zlib.c.
References err, inflate_run(), OBJ_INFECT, raise_zlib_error(), rb_ensure(), zstream::stream, StringValue, zstream_end(), zstream_init_inflate, and ZSTREAM_READY.
Referenced by Init_zlib().
Definition at line 1656 of file zlib.c.
References err, get_zstream(), OBJ_INFECT, raise_zlib_error(), RSTRING_LEN, RSTRING_PTR, zstream::stream, and StringValue.
Referenced by Init_zlib().
Definition at line 1617 of file zlib.c.
References get_zstream(), OBJ_INFECT, RSTRING_LEN, RSTRING_PTR, StringValue, and zstream_sync().
Referenced by Init_zlib().
Definition at line 1634 of file zlib.c.
References err, get_zstream(), raise_zlib_error(), and zstream::stream.
Referenced by Init_zlib().
int rb_io_extract_encoding_option | ( | VALUE | opt, | |
rb_encoding ** | enc_p, | |||
rb_encoding ** | enc2_p | |||
) |
Referenced by rb_io_extract_modeenc().
VALUE rb_str_conv_enc_opts | ( | VALUE | , | |
rb_encoding * | , | |||
rb_encoding * | , | |||
int | , | |||
VALUE | ||||
) |
Referenced by rb_str_conv_enc().
Definition at line 391 of file zlib.c.
References rb_ary_new2(), rb_ary_push(), and rb_uint2inum().
Referenced by Init_zlib().
Definition at line 279 of file zlib.c.
References OBJ_TAINT, and rb_str_new2().
Referenced by Init_zlib().
Definition at line 1114 of file zlib.c.
References get_zstream(), rb_uint2inum(), and zstream::stream.
Referenced by Init_zlib().
Definition at line 1074 of file zlib.c.
References Data_Get_Struct, zstream::input, INT2FIX, NIL_P, and RSTRING_LEN.
Referenced by Init_zlib().
Definition at line 1047 of file zlib.c.
References Data_Get_Struct, rb_uint2inum(), and zstream::stream.
Referenced by Init_zlib().
Definition at line 1132 of file zlib.c.
References Data_Get_Struct, Qfalse, and ZSTREAM_IS_READY.
Referenced by Init_zlib().
Definition at line 1105 of file zlib.c.
References get_zstream(), INT2FIX, and zstream::stream.
Referenced by Init_zlib().
Definition at line 978 of file zlib.c.
References get_zstream(), and zstream_end().
Referenced by Init_zlib().
Definition at line 1000 of file zlib.c.
References get_zstream(), OBJ_INFECT, zstream_detach_buffer(), and zstream_run().
Referenced by Init_zlib().
Definition at line 1123 of file zlib.c.
References get_zstream(), Qtrue, and ZSTREAM_IS_FINISHED.
Referenced by Init_zlib().
Definition at line 1016 of file zlib.c.
References Data_Get_Struct, OBJ_INFECT, and zstream_detach_input().
Referenced by Init_zlib().
Definition at line 1031 of file zlib.c.
References Data_Get_Struct, OBJ_INFECT, and zstream_detach_buffer().
Referenced by Init_zlib().
Definition at line 989 of file zlib.c.
References get_zstream(), and zstream_reset().
Referenced by Init_zlib().
Definition at line 1061 of file zlib.c.
References Check_Type, FIX2INT, get_zstream(), T_FIXNUM, and zstream_expand_buffer_into().
Referenced by Init_zlib().
Definition at line 1085 of file zlib.c.
References get_zstream(), rb_uint2inum(), and zstream::stream.
Referenced by Init_zlib().
Definition at line 1094 of file zlib.c.
References get_zstream(), rb_uint2inum(), and zstream::stream.
Referenced by Init_zlib().
static voidpf zlib_mem_alloc | ( | voidpf | opaque, | |
uInt | items, | |||
uInt | size | |||
) | [static] |
Definition at line 450 of file zlib.c.
References VALGRIND_MAKE_MEM_DEFINED, and xmalloc.
static void zlib_mem_free | ( | voidpf | opaque, | |
voidpf | address | |||
) | [static] |
static void zstream_append_buffer | ( | struct zstream * | z, | |
const Bytef * | src, | |||
int | len | |||
) | [static] |
Definition at line 540 of file zlib.c.
References zstream::buf, zstream::buf_filled, NIL_P, rb_str_buf_cat(), rb_str_buf_new(), rb_str_resize(), RBASIC, RSTRING_LEN, RSTRING_PTR, and zstream::stream.
static void zstream_append_input | ( | struct zstream * | z, | |
const Bytef * | src, | |||
unsigned int | len | |||
) | [static] |
Definition at line 649 of file zlib.c.
References zstream::input, NIL_P, rb_str_buf_cat(), rb_str_buf_new(), and RBASIC.
Referenced by zstream_run(), and zstream_sync().
static void zstream_buffer_ungetbyte | ( | struct zstream * | z, | |
int | c | |||
) | [static] |
Definition at line 633 of file zlib.c.
References zstream::buf, zstream::buf_filled, memmove(), NIL_P, RSTRING_LEN, RSTRING_PTR, zstream::stream, and zstream_expand_buffer().
static void zstream_buffer_ungets | ( | struct zstream * | z, | |
const Bytef * | b, | |||
int | len | |||
) | [static] |
Definition at line 617 of file zlib.c.
References zstream::buf, zstream::buf_filled, memmove(), NIL_P, RSTRING_LEN, RSTRING_PTR, zstream::stream, and zstream_expand_buffer_into().
Definition at line 573 of file zlib.c.
References zstream::buf, zstream::buf_filled, NIL_P, rb_cString, rb_str_new(), rb_str_resize(), RBASIC, and zstream::stream.
Referenced by deflate_run(), inflate_run(), rb_deflate_deflate(), rb_deflate_flush(), rb_inflate_inflate(), rb_zstream_finish(), rb_zstream_flush_next_out(), and zstream_shift_buffer().
Definition at line 696 of file zlib.c.
References zstream::input, NIL_P, rb_cString, rb_str_new(), and RBASIC.
Referenced by rb_zstream_flush_next_in().
static void zstream_discard_input | ( | struct zstream * | z, | |
unsigned int | len | |||
) | [static] |
Definition at line 668 of file zlib.c.
References zstream::input, memmove(), NIL_P, rb_str_resize(), RSTRING_LEN, and RSTRING_PTR.
Referenced by zstream_sync().
Definition at line 730 of file zlib.c.
References zstream::zstream_funcs::end, err, zstream::flags, zstream::func, raise_zlib_error(), rb_warning(), zstream::stream, ZSTREAM_FLAG_IN_STREAM, ZSTREAM_IS_READY, zstream_reset(), and zstream_reset_input().
Referenced by rb_deflate_s_deflate(), rb_inflate_s_inflate(), and rb_zstream_end().
static void zstream_expand_buffer | ( | struct zstream * | z | ) | [static] |
Definition at line 489 of file zlib.c.
References zstream::buf, zstream::buf_filled, NIL_P, rb_str_new(), rb_str_resize(), RBASIC, RSTRING_LEN, RSTRING_PTR, zstream::stream, ZSTREAM_AVAIL_OUT_STEP_MAX, ZSTREAM_AVAIL_OUT_STEP_MIN, and ZSTREAM_INITIAL_BUFSIZE.
Referenced by rb_deflate_params(), zstream_buffer_ungetbyte(), and zstream_run().
static void zstream_expand_buffer_into | ( | struct zstream * | z, | |
unsigned int | size | |||
) | [static] |
Definition at line 521 of file zlib.c.
References zstream::buf, zstream::buf_filled, NIL_P, rb_str_new(), rb_str_resize(), RBASIC, RSTRING_PTR, and zstream::stream.
Referenced by rb_zstream_set_avail_out(), and zstream_buffer_ungets().
static void zstream_finalize | ( | struct zstream * | z | ) | [static] |
Definition at line 864 of file zlib.c.
References zstream::zstream_funcs::end, err, finalizer_warn(), zstream::func, and zstream::stream.
Referenced by zstream_free().
static void zstream_free | ( | struct zstream * | z | ) | [static] |
Definition at line 874 of file zlib.c.
References xfree(), zstream_finalize(), and ZSTREAM_IS_READY.
Referenced by zstream_new().
static void zstream_init | ( | struct zstream * | z, | |
const struct zstream_funcs * | func | |||
) | [static] |
Definition at line 468 of file zlib.c.
References zstream::buf, zstream::buf_filled, zstream::flags, zstream::func, zstream::input, and zstream::stream.
Referenced by zstream_new().
static void zstream_mark | ( | struct zstream * | z | ) | [static] |
Definition at line 857 of file zlib.c.
References zstream::buf, zstream::input, and rb_gc_mark().
Referenced by zstream_new().
Definition at line 883 of file zlib.c.
References Data_Make_Struct, zstream_free(), zstream_init(), and zstream_mark().
static void zstream_passthrough_input | ( | struct zstream * | z | ) | [static] |
Definition at line 687 of file zlib.c.
References zstream::input, NIL_P, and zstream_append_buffer2.
Referenced by rb_inflate_addstr(), and rb_inflate_inflate().
static void zstream_reset | ( | struct zstream * | z | ) | [static] |
Definition at line 713 of file zlib.c.
References zstream::buf, zstream::buf_filled, err, zstream::flags, zstream::func, raise_zlib_error(), zstream::zstream_funcs::reset, zstream::stream, and zstream_reset_input().
Referenced by rb_zstream_reset(), and zstream_end().
static void zstream_reset_input | ( | struct zstream * | z | ) | [static] |
Definition at line 681 of file zlib.c.
References zstream::input.
Referenced by zstream_end(), zstream_reset(), zstream_run(), and zstream_sync().
static void zstream_run | ( | struct zstream * | z, | |
Bytef * | src, | |||
uInt | len, | |||
int | flush | |||
) | [static] |
Definition at line 753 of file zlib.c.
References zstream::buf_filled, err, zstream::flags, zstream::func, zstream::input, NIL_P, raise_zlib_error(), RB_GC_GUARD, rb_thread_schedule(), RSTRING_LEN, RSTRING_PTR, zstream::zstream_funcs::run, zstream::stream, zstream_append_input(), zstream_expand_buffer(), and zstream_reset_input().
Referenced by deflate_run(), do_deflate(), do_inflate(), inflate_run(), rb_deflate_flush(), and rb_zstream_finish().
Definition at line 594 of file zlib.c.
References zstream::buf, zstream::buf_filled, memmove(), rb_cString, rb_str_subseq(), RBASIC, RSTRING_LEN, RSTRING_PTR, zstream::stream, ZSTREAM_AVAIL_OUT_STEP_MAX, and zstream_detach_buffer().
Definition at line 818 of file zlib.c.
References err, zstream::input, NIL_P, raise_zlib_error(), rb_str_new(), RSTRING_LEN, RSTRING_PTR, zstream::stream, zstream_append_input(), zstream_discard_input(), and zstream_reset_input().
Referenced by rb_inflate_sync().
VALUE cDataError [static] |
VALUE cStreamEnd [static] |
VALUE cStreamError [static] |
VALUE cVersionError [static] |
struct zstream_funcs deflate_funcs [static] |
struct zstream_funcs inflate_funcs [static] |