diff --git a/ChangeLog b/ChangeLog index 56f7c90ba4..5eaffbbbeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jul 24 13:32:56 2003 Yukihiro Matsumoto + + * eval.c (thgroup_add): no warning for terminated threads. + Thu Jul 24 13:09:26 2003 Tanaka Akira * lib/pathname.rb: added. @@ -39,6 +43,14 @@ Thu Jul 24 03:41:30 2003 NAKAMURA Usaku * ext/tcltklib/tcltklib.c (ip_init): need at least one statement after label. +Thu Jul 24 01:48:03 2003 Yukihiro Matsumoto + + * lib/cgi.rb (CGI::QueryExtension::[]): should return StringIO (or + Tempfile) for multipart/form. + + * variable.c (rb_define_const): give warning for non constant + name. [ruby-core:01287] + Thu Jul 24 01:51:08 2003 GOTOU Yuuzou * lib/webrick: imported. @@ -58,6 +70,10 @@ Wed Jul 23 23:06:59 2003 WATANABE Hirofumi * file.c (DOSISH): better Cygwin support. +Wed Jul 23 19:13:21 2003 Yukihiro Matsumoto + + * string.c (rb_str_split_m): the receiver may be empty string. + Wed Jul 23 18:43:00 2003 Masatoshi SEKI * lib/erb.rb: import erb-2.0.4b1. @@ -23203,5 +23219,10 @@ Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto * version 1.1 alpha0 released. Local variables: -add-log-time-format: current-time-string +add-log-time-format: (lambda () + (let* ((time (current-time)) + (diff (+ (cadr time) 32400)) + (lo (% diff 65536)) + (hi (+ (car time) (/ diff 65536)))) + (format-time-string "%c" (list hi lo) t))) end: diff --git a/eval.c b/eval.c index f84e5f0630..13f9bec54a 100644 --- a/eval.c +++ b/eval.c @@ -9024,7 +9024,6 @@ rb_thread_kill(thread) if (th == th->next || th == main_thread) rb_exit(0); rb_thread_ready(th); - th->thgroup = 0; th->status = THREAD_TO_KILL; if (!rb_thread_critical) rb_thread_schedule(); return thread; @@ -9965,8 +9964,7 @@ thgroup_add(group, thread) } if (!th->thgroup) { - rb_warn("terminated thread"); - return group; + return Qnil; } if (OBJ_FROZEN(th->thgroup)) { rb_raise(rb_eThreadError, "can't move from the frozen thread group"); diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index b9e66f676e..c5489a9535 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -1,7 +1,5 @@ require 'mkmf' -$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" - case RUBY_PLATFORM when /bccwin32/ test_func = "WSACleanup" @@ -150,6 +148,29 @@ main() } EOF $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS +else # doug's fix, NOW add -Dss_family... only if required! +$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" + if try_link(< +# include +#else +# include +# include +# include +# include +#endif +int +main() +{ + struct sockaddr_storage ss; + + ss.ss_family; + return 0; +} +EOF + $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS +end end if try_link(<len; i++) { args[0] = RARRAY(finalizers)->ptr[i]; + critical_save = rb_thread_critical; + rb_thread_critical = Qtrue; rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status); + rb_thread_critical = critical_save; + CHECK_INTS; } + CHECK_INTS; if (finalizer_table && st_delete(finalizer_table, &obj, &table)) { for (i=0; ilen; i++) { args[0] = RARRAY(table)->ptr[i]; + critical_save = rb_thread_critical; + rb_thread_critical = Qtrue; rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status); + rb_thread_critical = critical_save; + CHECK_INTS; } } - rb_thread_critical = critical_save; } void diff --git a/lib/cgi.rb b/lib/cgi.rb index 8f522ab7c1..1327b64d34 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -800,7 +800,7 @@ convert string charset, and set language to "ja". body = Tempfile.new("CGI") else begin - require "stringio" if not defined? StringIO + require "stringio" body = StringIO.new rescue LoadError require "tempfile" @@ -917,6 +917,7 @@ convert string charset, and set language to "ja". if ("POST" == env_table['REQUEST_METHOD']) and %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(env_table['CONTENT_TYPE']) boundary = $1.dup + @multipart = true @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH'])) else @params = CGI::parse( @@ -947,7 +948,6 @@ convert string charset, and set language to "ja". super(str) end def [](idx) - p caller(1) warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']" self end @@ -964,8 +964,17 @@ convert string charset, and set language to "ja". def [](key) params = @params[key] value = params[0] - value ||= "" - Value.new(value,params) + if @multipart + if value + return value + elsif defined? StringIO + StringIO.new("") + else + Tempfile.new("CGI") + end + else + Value.new(value || "", params) + end end def keys(*args) @@ -1931,6 +1940,7 @@ The hash keys are case sensitive. Ask the samples. end extend QueryExtension + @multipart = false if "POST" != env_table['REQUEST_METHOD'] initialize_query() # set @params, @cookies else diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb index dad6b2f075..b2c90e38e2 100644 --- a/lib/irb/locale.rb +++ b/lib/irb/locale.rb @@ -21,27 +21,26 @@ module IRB LOCALE_DIR = "/lc/" def initialize(locale = nil) - @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] - @lang = "C" unless @lang + @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C" end attr_reader :lang - @@LC2KCONV = { - # "ja" => Kconv::JIS, - # "ja_JP" => Kconv::JIS, - "ja_JP.ujis" => Kconv::EUC, - "ja_JP.euc" => Kconv::EUC, - "ja_JP.eucJP" => Kconv::EUC, - "ja_JP.sjis" => Kconv::SJIS, - "ja_JP.SJIS" => Kconv::SJIS, - } + def lc2kconv(lang) + case lang + when "ja_JP.ujis", "ja_JP.euc", "ja_JP.eucJP" + Kconv::EUC + when "ja_JP.sjis", "ja_JP.SJIS" + Kconv::SJIS + end + end + private :lc2kconv def String(mes) mes = super(mes) case @lang when /^ja/ - mes = Kconv::kconv(mes, @@LC2KCONV[@lang]) + mes = Kconv::kconv(mes, lc2kconv(@lang)) else mes end diff --git a/string.c b/string.c index eb7b347447..08aa302aaf 100644 --- a/string.c +++ b/string.c @@ -2557,7 +2557,11 @@ rb_str_split_m(argc, argv, str) if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) { lim = NUM2INT(limit); if (lim <= 0) limit = Qnil; - else if (lim == 1) return rb_ary_new3(1, str); + else if (lim == 1) { + if (RSTRING(str)->len == 0) + return rb_ary_new2(0); + return rb_ary_new3(1, str); + } i = 1; } diff --git a/variable.c b/variable.c index 77c1c37240..76c0939c46 100644 --- a/variable.c +++ b/variable.c @@ -1548,6 +1548,9 @@ rb_define_const(klass, name, val) { ID id = rb_intern(name); + if (!rb_is_const_id(id)) { + rb_warn("rb_define_const: invalide name `%s' for constant", name); + } if (klass == rb_cObject) { rb_secure(4); }