ruby-changes:1806
From: ko1@a...
Date: 28 Aug 2007 23:16:39 +0900
Subject: [ruby-changes:1806] suke - Ruby:r13297 (ruby_1_8): * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
suke 2007-08-28 23:16:24 +0900 (Tue, 28 Aug 2007) New Revision: 13297 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/win32ole/win32ole.c branches/ruby_1_8/version.h Log: * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key, reg_get_val, ole_wc2mb): fix the bug. Thanks, arton. [ruby-dev:31576] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=13297&r2=13296 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/win32ole/win32ole.c?r1=13297&r2=13296 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=13297&r2=13296 Index: ruby_1_8/ext/win32ole/win32ole.c =================================================================== --- ruby_1_8/ext/win32ole/win32ole.c (revision 13296) +++ ruby_1_8/ext/win32ole/win32ole.c (revision 13297) @@ -79,7 +79,7 @@ #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "0.7.1" +#define WIN32OLE_VERSION "0.7.2" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -477,8 +477,9 @@ LPSTR pm; size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL); if (size) { - pm = ALLOC_N(char, size); + pm = ALLOC_N(char, size + 1); WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL); + pm[size] = '\0'; } else { pm = ALLOC_N(char, 1); @@ -1138,12 +1139,13 @@ HKEY hkey; DWORD i; { - char buf[BUFSIZ]; - DWORD size_buf = sizeof(buf); + char buf[BUFSIZ + 1]; + DWORD size_buf = sizeof(buf) - 1; FILETIME ft; LONG err = RegEnumKeyEx(hkey, i, buf, &size_buf, NULL, NULL, NULL, &ft); if(err == ERROR_SUCCESS) { + buf[BUFSIZ] = '\0'; return rb_str_new2(buf); } return Qnil; @@ -1154,10 +1156,11 @@ HKEY hkey; const char *subkey; { - char buf[BUFSIZ]; - LONG size_buf = sizeof(buf); + char buf[BUFSIZ + 1]; + LONG size_buf = sizeof(buf) - 1; LONG err = RegQueryValue(hkey, subkey, buf, &size_buf); if (err == ERROR_SUCCESS) { + buf[BUFSIZ] = '\0'; return rb_str_new2(buf); } return Qnil; @@ -3618,8 +3621,10 @@ if (FAILED(hr)) return progid; hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf); - if (SUCCEEDED(hr)) - progid = WC2VSTR(pbuf); + if (SUCCEEDED(hr)) { + progid = ole_wc2vstr(pbuf, FALSE); + CoTaskMemFree(pbuf); + } OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); return progid; } Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 13296) +++ ruby_1_8/ChangeLog (revision 13297) @@ -1,3 +1,9 @@ +Tue Aug 28 23:26:12 2007 Masaki Suketa <masaki.suketa@n...> + + * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key, + reg_get_val, ole_wc2mb): fix the bug. Thanks, arton. + [ruby-dev:31576] + Mon Aug 27 19:10:50 2007 Yukihiro Matsumoto <matz@r...> * ext/etc/etc.c (etc_getlogin): update documentation to note Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 13296) +++ ruby_1_8/version.h (revision 13297) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2007-08-27" +#define RUBY_RELEASE_DATE "2007-08-28" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20070827 +#define RUBY_RELEASE_CODE 20070828 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 27 +#define RUBY_RELEASE_DAY 28 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml