mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/Win32API/Win32API.c (Win32API_Call): RSTRING()->ptr may be
NULL. * ext/nkf/nkf.c (rb_nkf_guess): ditto. * ext/readline/readline.c (readline_s_set_completion_append_character): ditto. * ext/socket/socket.c (sock_s_getaddrinfo, sock_s_getnameinfo): ditto. * ext/tcltklib/tcltklib.c (ip_toUTF8, ip_fromUTF8): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f5f30e580f
commit
e855026500
6 changed files with 22 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Aug 30 19:35:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* ext/Win32API/Win32API.c (Win32API_Call): use StringValuePtr() to
|
||||
confirm ptr is not NULL.
|
||||
|
||||
* ext/socket/socket.c (sock_s_getaddrinfo): ditto.
|
||||
|
||||
* ext/socket/socket.c (sock_s_getnameinfo): ditto.
|
||||
|
||||
Thu Aug 29 23:34:42 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
|
||||
|
||||
* bcc32/MakeFile.sub (sitearch): add.
|
||||
|
|
|
@ -249,7 +249,7 @@ Win32API_Call(argc, argv, obj)
|
|||
} else {
|
||||
StringValue(str);
|
||||
rb_str_modify(str);
|
||||
pParam = RSTRING(str)->ptr;
|
||||
pParam = StringValuePtr(str)
|
||||
}
|
||||
#if defined(_MSC_VER) || defined(__LCC__)
|
||||
#if defined(_M_IX86)
|
||||
|
|
|
@ -104,6 +104,7 @@ rb_nkf_guess(obj, src)
|
|||
StringValue(src);
|
||||
p = RSTRING(src)->ptr;
|
||||
pend = p + RSTRING(src)->len;
|
||||
if (p == pend) return INT2FIX(_UNKNOWN);
|
||||
|
||||
#define INCR do {\
|
||||
p++;\
|
||||
|
|
|
@ -191,11 +191,9 @@ readline_s_set_completion_append_character(self, str)
|
|||
VALUE self, str;
|
||||
{
|
||||
#ifdef READLINE_21_OR_LATER
|
||||
if (NIL_P(str)) {
|
||||
if (NIL_P(str) || !StringValuePtr(str) || !RSTRING(str)->len) {
|
||||
rl_completion_append_character = '\0';
|
||||
} else {
|
||||
StringValue(str);
|
||||
|
||||
rl_completion_append_character = RSTRING(str)->ptr[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -2133,7 +2133,7 @@ sock_s_getaddrinfo(argc, argv)
|
|||
{
|
||||
VALUE host, port, family, socktype, protocol, flags, ret;
|
||||
char hbuf[1024], pbuf[1024];
|
||||
char *hptr, *pptr;
|
||||
char *hptr, *pptr, *ap;
|
||||
struct addrinfo hints, *res;
|
||||
int error;
|
||||
|
||||
|
@ -2167,13 +2167,12 @@ sock_s_getaddrinfo(argc, argv)
|
|||
else if (FIXNUM_P(family)) {
|
||||
hints.ai_family = FIX2INT(family);
|
||||
}
|
||||
else {
|
||||
StringValue(family);
|
||||
if (strcmp(RSTRING(family)->ptr, "AF_INET") == 0) {
|
||||
else if ((ap = StringValuePtr(family)) != 0) {
|
||||
if (strcmp(ap, "AF_INET") == 0) {
|
||||
hints.ai_family = PF_INET;
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (strcmp(RSTRING(family)->ptr, "AF_INET6") == 0) {
|
||||
else if (strcmp(ap, "AF_INET6") == 0) {
|
||||
hints.ai_family = PF_INET6;
|
||||
}
|
||||
#endif
|
||||
|
@ -2211,7 +2210,7 @@ sock_s_getnameinfo(argc, argv)
|
|||
int error;
|
||||
struct sockaddr_storage ss;
|
||||
struct sockaddr *sap;
|
||||
char *ep;
|
||||
char *ep, *ap;
|
||||
|
||||
sa = flags = Qnil;
|
||||
rb_scan_args(argc, argv, "11", &sa, &flags);
|
||||
|
@ -2287,13 +2286,12 @@ sock_s_getnameinfo(argc, argv)
|
|||
else if (FIXNUM_P(af)) {
|
||||
hints.ai_family = FIX2INT(af);
|
||||
}
|
||||
else {
|
||||
StringValue(af);
|
||||
if (strcmp(RSTRING(af)->ptr, "AF_INET") == 0) {
|
||||
else if ((ap = StringValuePtr(af)) != 0) {
|
||||
if (strcmp(ap, "AF_INET") == 0) {
|
||||
hints.ai_family = PF_INET;
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (strcmp(RSTRING(af)->ptr, "AF_INET6") == 0) {
|
||||
else if (ap, "AF_INET6") == 0) {
|
||||
hints.ai_family = PF_INET6;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -565,6 +565,7 @@ ip_toUTF8(self, str, encodename)
|
|||
StringValue(encodename);
|
||||
StringValue(str);
|
||||
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
|
||||
if (!RSTRING(str)->len) return str;
|
||||
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
||||
strcpy(buf, RSTRING(str)->ptr);
|
||||
|
||||
|
@ -598,6 +599,7 @@ ip_fromUTF8(self, str, encodename)
|
|||
StringValue(encodename);
|
||||
StringValue(str);
|
||||
encoding = Tcl_GetEncoding(interp,RSTRING(encodename)->ptr);
|
||||
if (!RSTRING(str)->len) return str;
|
||||
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
||||
strcpy(buf,RSTRING(str)->ptr);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue