[2/2] comctl32: replace nonprintable characters with spaces on SB_SETTEXT
Nikolay Sivov
bunglehead at gmail.com
Mon Mar 2 15:23:49 CST 2009
Changelog:
- replace nonprintable characters with spaces on SB_SETTEXT
>From 5dfa313b255a00ee9a108940702d2a4eb651d6b7 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 2 Mar 2009 16:18:22 -0500
Subject: Replace nonprintable characters with spaces on SB_SETTEXT
---
dlls/comctl32/status.c | 12 ++++++++++++
dlls/comctl32/tests/status.c | 12 ++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index a56c2a0..388e774 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -762,6 +762,8 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
part->text = (LPWSTR)text;
} else {
LPWSTR ntext;
+ WCHAR *idx;
+ const WCHAR space = {' '};
if (text && !isW) {
LPCSTR atxt = (LPCSTR)text;
@@ -775,6 +777,16 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
strcpyW (ntext, text);
} else ntext = 0;
+ /* replace nonprintable characters with spaces */
+ if (ntext) {
+ idx = ntext;
+ while (*idx) {
+ if(!isprintW(*idx))
+ *idx = space;
+ idx++;
+ }
+ }
+
/* check if text is unchanged -> no need to redraw */
if (text) {
if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index 4ae663f..e82a391 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -318,17 +318,13 @@ static void test_status_control(void)
expect(11,LOWORD(r));
expect(0,HIWORD(r));
r = SendMessage(hWndStatus, SB_GETTEXT, 1, (LPARAM) charArray);
- todo_wine
- {
- ok(strcmp(charArray,"InvalidChars\\7 ") == 0, "Expected InvalidChars\\7 , got %s\n", charArray);
- }
+ ok(strcmp(charArray,"InvalidChars\\7 ") == 0, "Expected InvalidChars\\7 , got %s\n", charArray);
+
expect(15,LOWORD(r));
expect(0,HIWORD(r));
r = SendMessage(hWndStatus, SB_GETTEXT, 2, (LPARAM) charArray);
- todo_wine
- {
- ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
- }
+ ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
+
expect(15,LOWORD(r));
expect(0,HIWORD(r));
--
1.5.6.5
More information about the wine-patches
mailing list