1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/Win32API/Win32API.c (Win32API_initialize): use RSTRING_PTR and

RSTRING_LEN.

* ext/tk/stubs.c, ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: ditto.

* ext/win32ole/win32ole.c (ole_val2olevariantdata): ditto.

* lib/mkmf.rb (create_makefile): follow nil.to_s.

* win32/resource.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2006-08-31 11:56:42 +00:00
parent 5b5e4a6fc1
commit 6790891ef0
8 changed files with 146 additions and 135 deletions

View file

@ -50,18 +50,18 @@ Win32API_initialize(self, dllname, proc, import, export)
SafeStringValue(dllname);
SafeStringValue(proc);
hdll = LoadLibrary(RSTRING(dllname)->ptr);
hdll = LoadLibrary(RSTRING_PTR(dllname));
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING_PTR(dllname));
rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, (void*)hdll));
hproc = (HANDLE)GetProcAddress(hdll, RSTRING(proc)->ptr);
hproc = (HANDLE)GetProcAddress(hdll, RSTRING_PTR(proc));
if (!hproc) {
str = rb_str_new3(proc);
str = rb_str_cat(str, "A", 1);
hproc = (HANDLE)GetProcAddress(hdll, RSTRING(str)->ptr);
hproc = (HANDLE)GetProcAddress(hdll, RSTRING_PTR(str));
if (!hproc)
rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
RSTRING(proc)->ptr, RSTRING(str)->ptr);
RSTRING_PTR(proc), RSTRING_PTR(str));
}
rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
rb_iv_set(self, "__dllname__", dllname);
@ -75,7 +75,7 @@ Win32API_initialize(self, dllname, proc, import, export)
ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
SafeStringValue(ptr[i]);
switch (*(char *)RSTRING(ptr[i])->ptr) {
switch (*(char *)RSTRING_PTR(ptr[i])) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
break;
@ -90,8 +90,8 @@ Win32API_initialize(self, dllname, proc, import, export)
break;
default:
SafeStringValue(import);
s = RSTRING(import)->ptr;
for (i = 0, len = RSTRING(import)->len; i < len; i++) {
s = RSTRING_PTR(import);
for (i = 0, len = RSTRING_LEN(import); i < len; i++) {
switch (*s++) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
@ -117,7 +117,7 @@ Win32API_initialize(self, dllname, proc, import, export)
ex = _T_VOID;
} else {
SafeStringValue(export);
switch (*RSTRING(export)->ptr) {
switch (*RSTRING_PTR(export)) {
case 'V': case 'v':
ex = _T_VOID;
break;