Skip to content

Commit

Permalink
19991018
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Oct 18, 1999
1 parent 40a3f60 commit 125ca1a
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 31 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Mon Oct 18 16:15:52 1999 Yukihiro Matsumoto <matz@netlab.co.jp>

* ext/nkf/nkf.c (rb_nkf_kconv): output should be NUL terminated.

Sun Oct 17 03:35:33 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>

* array.c (rb_ary_pop): forgot some freeze checks.

Fri Oct 15 22:50:41 1999 WATANABE Hirofumi <eban@os.rim.or.jp>

* error.c (sys_nerr): on CYGWIN, it is _sys_nerr.

Fri Oct 15 01:32:31 1999 WATANABE Hirofumi <eban@os.rim.or.jp>

* io.c (rb_io_ctl) :need to use NUM2ULONG, not NUM2INT.
Expand Down
4 changes: 4 additions & 0 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ VALUE
rb_ary_pop(ary)
VALUE ary;
{
rb_ary_modify(ary);
if (RARRAY(ary)->len == 0) return Qnil;
if (RARRAY(ary)->len * 10 < RARRAY(ary)->capa && RARRAY(ary)->capa > ARY_DEFAULT_SIZE) {
RARRAY(ary)->capa = RARRAY(ary)->len * 2;
Expand All @@ -294,6 +295,7 @@ rb_ary_shift(ary)
{
VALUE top;

rb_ary_modify(ary);
if (RARRAY(ary)->len == 0) return Qnil;

top = RARRAY(ary)->ptr[0];
Expand Down Expand Up @@ -844,6 +846,7 @@ rb_ary_reverse(ary)
VALUE *p1, *p2;
VALUE tmp;

rb_ary_modify(ary);
if (RARRAY(ary)->len == 0) return ary;

p1 = RARRAY(ary)->ptr;
Expand Down Expand Up @@ -1026,6 +1029,7 @@ static VALUE
rb_ary_clear(ary)
VALUE ary;
{
rb_ary_modify(ary);
RARRAY(ary)->len = 0;
if (ARY_DEFAULT_SIZE*3 < RARRAY(ary)->capa) {
RARRAY(ary)->capa = ARY_DEFAULT_SIZE * 2;
Expand Down
4 changes: 4 additions & 0 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
int sys_nerr = 256;
#endif

#if defined __CYGWIN__ && defined _sys_nerr
#define sys_nerr _sys_nerr
#endif

int ruby_nerrs;

static void
Expand Down
2 changes: 1 addition & 1 deletion ext/nkf/depend
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h nkf1.7/nkf.c
nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(srcdir)/nkf1.7/nkf.c
22 changes: 5 additions & 17 deletions ext/nkf/nkf.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ rb_nkf_putchar(c)
{
if (output_ctr >= o_len) {
o_len += incsize;
rb_str_cat(dst, "", incsize);
rb_str_cat(dst, 0, incsize);
output = RSTRING(dst)->ptr;
incsize *= 2;
}

output[output_ctr++] = c;
/*
printf("[[%c][%c][%d]]\n", c, output[output_ctr - 1], output_ctr);
*/

return c;
}

Expand Down Expand Up @@ -78,18 +76,8 @@ rb_nkf_kconv(obj, opt, src)
}

kanji_convert(NULL);
if (output_ctr > 0) output_ctr--;
if (output[output_ctr] == '\0') {
/*
printf("([%c][%d])\n", output[output_ctr], output_ctr);
*/
RSTRING(dst)->len = output_ctr;
} else {
/*
printf("<[%c][%d]>\n", output[output_ctr], output_ctr);
*/
RSTRING(dst)->len = output_ctr + 1;
}
RSTRING(dst)->ptr[output_ctr] = '\0';
RSTRING(dst)->len = output_ctr;

return dst;
}
Expand Down
5 changes: 5 additions & 0 deletions ext/socket/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
#endif
main()
{
int passive, gaierr, inet4 = 0, inet6 = 0;
Expand All @@ -176,6 +180,7 @@
goto bad;
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_LOCAL) continue;
if (ai->ai_addr == NULL ||
ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
Expand Down
2 changes: 2 additions & 0 deletions ext/socket/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,9 @@ tcp_s_gethostbyname(obj, host)
struct sockaddr_in6 sin6;
MEMZERO(&sin6, struct sockaddr_in6, 1);
sin6.sin6_family = AF_INET;
#ifdef SIN6_LEN
sin6.sin6_len = sizeof(sin6);
#endif
memcpy((char *) &sin6.sin6_addr, *pch, h->h_length);
h = gethostbyaddr((char *)&sin6.sin6_addr,
sizeof(sin6.sin6_addr),
Expand Down
23 changes: 20 additions & 3 deletions lib/net/pop.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=begin
= Net module version 1.0.2 reference manual
= Net module version 1.0.3 reference manual
pop.rb written by Minero Aoki <aamine@dp.u-netsurf.ne.jp>
Expand Down Expand Up @@ -167,6 +167,10 @@ def deleted?
@deleted
end

def uidl
@proto.uidl @num
end

end

end # POP3Session
Expand Down Expand Up @@ -219,6 +223,11 @@ def proto_initialize

class POP3Command < Command

def initialize( sock )
@uidl = nil
super
end


=begin
Expand Down Expand Up @@ -323,11 +332,19 @@ def retr( num, dest = '', &block )


def dele( num )
@socket.writeline( sprintf( 'DELE %s', num ) )
@socket.writeline( 'DELE ' + num.to_s )
check_reply( SuccessCode )
end


def uidl( num )
@socket.writeline( 'UIDL ' + num.to_s )
rep = check_reply( SuccessCode )
uid = rep.msg.split(' ')[1]

uid
end


private

Expand Down Expand Up @@ -412,7 +429,7 @@ def digest( str )
end


unless Session::Version == '1.0.2' then
unless Session::Version == '1.0.3' then
$stderr.puts "WARNING: wrong version of session.rb & pop.rb"
end

Expand Down
16 changes: 9 additions & 7 deletions lib/net/session.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=begin
= Net module version 1.0.2 reference manual
= Net module version 1.0.3 reference manual
session.rb written by Minero Aoki <aamine@dp.u-netsurf.ne.jp>
Expand Down Expand Up @@ -39,7 +39,7 @@ def doquote
: Version
The version of Session class. It is a string like "1.0.2".
The version of Session class. It is a string like "1.0.3".
=end

Expand All @@ -48,7 +48,7 @@ module Net

class Session

Version = '1.0.2'
Version = '1.0.3'

=begin
Expand All @@ -71,7 +71,9 @@ def initialize( addr = 'localhost', port = nil )
proto_initialize
@address = addr
@port = port if port

@active = false
@pipe = nil
end

class << self
Expand Down Expand Up @@ -133,12 +135,12 @@ def start( *args )
return false if active?
@active = true

if ProtocolSocket === args[0] then
@socket = args.shift
@socket.pipe = @pipe
if Class === args[0] then
c = args.shift
else
@socket = ProtocolSocket.open( @address, @port, @pipe )
c = ProtocolSocket
end
@socket = c.open( @address, @port, @pipe )
@pipe = nil

@proto = @proto_type.new( @socket )
Expand Down
4 changes: 2 additions & 2 deletions lib/net/smtp.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=begin
= Net module version 1.0.2 reference manual
= Net module version 1.0.3 reference manual
smtp.rb written by Minero Aoki <aamine@dp.u-netsurf.ne.jp>
Expand Down Expand Up @@ -212,7 +212,7 @@ def read_reply
end


unless Session::Version == '1.0.2' then
unless Session::Version == '1.0.3' then
$stderr.puts "WARNING: wrong version of session.rb & smtp.rb"
end

Expand Down
2 changes: 1 addition & 1 deletion ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ load_file(fname, script)
while (p < pend && ISSPACE(*p))
p++;
path = p; /* interpreter path */
#ifndef USE_CWGUSI
while (p < pend && !ISSPACE(*p))
p++;
*p++ = '\0';
Expand All @@ -667,7 +668,6 @@ load_file(fname, script)
argv = origargv;
}
argv[0] = path;
#ifndef USE_CWGUSI
execv(path, argv);
#endif
ruby_sourcefile = fname;
Expand Down

0 comments on commit 125ca1a

Please sign in to comment.