summaryrefslogtreecommitdiff
path: root/ext/win32ole
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-06-22 15:21:03 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-06-22 15:21:03 +0000
commit4de56c7d60bb730de7a1bc4d0b94d135505b9521 (patch)
treedb13207eea3b857d9b6f7f4625c994d25aeb32ef /ext/win32ole
parent3398183231d77043271880b408c8a7c45f49a01d (diff)
* ext/win32ole/win32ole.c (ole_hresult2msg): remove trailing
CR and LF. (doesn't depend on CR+LF) [ruby-dev:23694] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r--ext/win32ole/win32ole.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 6ca0668039..a24023f34b 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -501,9 +501,12 @@ ole_hresult2msg(hr)
NULL, hr, LOCALE_SYSTEM_DEFAULT,
(LPTSTR)&p_msg, 0, NULL);
if (dwCount > 0) {
- term = strrchr(p_msg, '\r');
- if (term) {
- *term = '\0';
+ term = p_msg + strlen(p_msg);
+ while (p_msg < term) {
+ term--;
+ if (*term == '\r' || *term == '\n')
+ *term = '\0';
+ else break;
}
if (p_msg[0] != '\0') {
rb_str_cat2(msg, p_msg);