summaryrefslogtreecommitdiff
blob: c92609fd1f1f7c126d6decb6041a0fd90d6b90fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- openMotif-2.2.3/lib/Xm/TextF.c.char_not_supported
+++ openMotif-2.2.3/lib/Xm/TextF.c
@@ -3723,20 +3723,17 @@
       cache_ptr = tmp = XmStackAlloc(buf_size, cache);
    
       tmp_str = (wchar_t *)str;
-      ret_val = wctomb(tmp, *tmp_str);
+      // Fixed MZ BZ#1257: by Brad Despres <brad@sd.aonix.com>
       count = 0;
-      while ( (ret_val > 0)&& (buf_size >= MB_CUR_MAX) && (count < n) )
-	{
-	  count += 1;
-	  tmp += ret_val;
-	  buf_size -= ret_val;
-	  tmp_str++;
-	  ret_val = wctomb(tmp, *tmp_str);
-	}
-         
+      do {
+	ret_val = wctomb(tmp, *tmp_str);
+	count += 1;
+	tmp += ret_val;
+	buf_size -= ret_val;
+	tmp_str++;
+      } while ( (ret_val > 0)&& (buf_size >= MB_CUR_MAX) && (count < n) ) ;
       if (ret_val == -1)    /* bad character */
 	return (False);
- 
       is_printable = XTextWidth(TextF_Font(tf), cache_ptr, tmp - cache_ptr);
       XmStackFree(cache_ptr, cache);
       return (is_printable);