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>
|
Thu Aug 29 23:34:42 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
|
||||||
|
|
||||||
* bcc32/MakeFile.sub (sitearch): add.
|
* bcc32/MakeFile.sub (sitearch): add.
|
||||||
|
|
|
@ -249,7 +249,7 @@ Win32API_Call(argc, argv, obj)
|
||||||
} else {
|
} else {
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
pParam = RSTRING(str)->ptr;
|
pParam = StringValuePtr(str)
|
||||||
}
|
}
|
||||||
#if defined(_MSC_VER) || defined(__LCC__)
|
#if defined(_MSC_VER) || defined(__LCC__)
|
||||||
#if defined(_M_IX86)
|
#if defined(_M_IX86)
|
||||||
|
|
|
@ -104,6 +104,7 @@ rb_nkf_guess(obj, src)
|
||||||
StringValue(src);
|
StringValue(src);
|
||||||
p = RSTRING(src)->ptr;
|
p = RSTRING(src)->ptr;
|
||||||
pend = p + RSTRING(src)->len;
|
pend = p + RSTRING(src)->len;
|
||||||
|
if (p == pend) return INT2FIX(_UNKNOWN);
|
||||||
|
|
||||||
#define INCR do {\
|
#define INCR do {\
|
||||||
p++;\
|
p++;\
|
||||||
|
|
|
@ -191,11 +191,9 @@ readline_s_set_completion_append_character(self, str)
|
||||||
VALUE self, str;
|
VALUE self, str;
|
||||||
{
|
{
|
||||||
#ifdef READLINE_21_OR_LATER
|
#ifdef READLINE_21_OR_LATER
|
||||||
if (NIL_P(str)) {
|
if (NIL_P(str) || !StringValuePtr(str) || !RSTRING(str)->len) {
|
||||||
rl_completion_append_character = '\0';
|
rl_completion_append_character = '\0';
|
||||||
} else {
|
} else {
|
||||||
StringValue(str);
|
|
||||||
|
|
||||||
rl_completion_append_character = RSTRING(str)->ptr[0];
|
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;
|
VALUE host, port, family, socktype, protocol, flags, ret;
|
||||||
char hbuf[1024], pbuf[1024];
|
char hbuf[1024], pbuf[1024];
|
||||||
char *hptr, *pptr;
|
char *hptr, *pptr, *ap;
|
||||||
struct addrinfo hints, *res;
|
struct addrinfo hints, *res;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -2167,13 +2167,12 @@ sock_s_getaddrinfo(argc, argv)
|
||||||
else if (FIXNUM_P(family)) {
|
else if (FIXNUM_P(family)) {
|
||||||
hints.ai_family = FIX2INT(family);
|
hints.ai_family = FIX2INT(family);
|
||||||
}
|
}
|
||||||
else {
|
else if ((ap = StringValuePtr(family)) != 0) {
|
||||||
StringValue(family);
|
if (strcmp(ap, "AF_INET") == 0) {
|
||||||
if (strcmp(RSTRING(family)->ptr, "AF_INET") == 0) {
|
|
||||||
hints.ai_family = PF_INET;
|
hints.ai_family = PF_INET;
|
||||||
}
|
}
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
else if (strcmp(RSTRING(family)->ptr, "AF_INET6") == 0) {
|
else if (strcmp(ap, "AF_INET6") == 0) {
|
||||||
hints.ai_family = PF_INET6;
|
hints.ai_family = PF_INET6;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2211,7 +2210,7 @@ sock_s_getnameinfo(argc, argv)
|
||||||
int error;
|
int error;
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct sockaddr *sap;
|
struct sockaddr *sap;
|
||||||
char *ep;
|
char *ep, *ap;
|
||||||
|
|
||||||
sa = flags = Qnil;
|
sa = flags = Qnil;
|
||||||
rb_scan_args(argc, argv, "11", &sa, &flags);
|
rb_scan_args(argc, argv, "11", &sa, &flags);
|
||||||
|
@ -2287,13 +2286,12 @@ sock_s_getnameinfo(argc, argv)
|
||||||
else if (FIXNUM_P(af)) {
|
else if (FIXNUM_P(af)) {
|
||||||
hints.ai_family = FIX2INT(af);
|
hints.ai_family = FIX2INT(af);
|
||||||
}
|
}
|
||||||
else {
|
else if ((ap = StringValuePtr(af)) != 0) {
|
||||||
StringValue(af);
|
if (strcmp(ap, "AF_INET") == 0) {
|
||||||
if (strcmp(RSTRING(af)->ptr, "AF_INET") == 0) {
|
|
||||||
hints.ai_family = PF_INET;
|
hints.ai_family = PF_INET;
|
||||||
}
|
}
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
else if (strcmp(RSTRING(af)->ptr, "AF_INET6") == 0) {
|
else if (ap, "AF_INET6") == 0) {
|
||||||
hints.ai_family = PF_INET6;
|
hints.ai_family = PF_INET6;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -565,6 +565,7 @@ ip_toUTF8(self, str, encodename)
|
||||||
StringValue(encodename);
|
StringValue(encodename);
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
|
||||||
|
if (!RSTRING(str)->len) return str;
|
||||||
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
||||||
strcpy(buf, RSTRING(str)->ptr);
|
strcpy(buf, RSTRING(str)->ptr);
|
||||||
|
|
||||||
|
@ -598,6 +599,7 @@ ip_fromUTF8(self, str, encodename)
|
||||||
StringValue(encodename);
|
StringValue(encodename);
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
encoding = Tcl_GetEncoding(interp,RSTRING(encodename)->ptr);
|
encoding = Tcl_GetEncoding(interp,RSTRING(encodename)->ptr);
|
||||||
|
if (!RSTRING(str)->len) return str;
|
||||||
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
|
||||||
strcpy(buf,RSTRING(str)->ptr);
|
strcpy(buf,RSTRING(str)->ptr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue