bugvile, a vi-compatible text editor - Bugs: bug #38342, istype return wrong result for a...

 
 

bug #38342: istype return wrong result for a unicode character

Submitter:  KOMEDA Shinji <komeda>
Submitted:  Sat 16 Feb 2013 06:40:33 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 15 Apr 2013 10:55:13 AM UTC, comment #2: 

fixed in 9.8j

Thomas Dickey <dickey>
Group administrator
Sat 16 Feb 2013 06:51:28 PM UTC, comment #1: 

thanks - I think it is possible to devise a check for side-effects
by temporarily defining it to call a function with the two values.
Compilers warn about that.

Thomas Dickey <dickey>
Group administrator
Sat 16 Feb 2013 06:40:33 PM UTC, original submission:  

For example, if c is U+4E08, isbackspace(c) should return 0, but it returns 1.

CharOf(c) discards higher bits, then vlCTYPE looks only most lower 8-bits.
istype(m,c) works if c is a ascii charcter.

This patch might have side effects, cause c is evaluated twice.

<pre>
--- vl_ctype.h 2012-03-09 20:39:24.000000000 +0900
+++ vl_ctype.h 2013-02-17 03:02:01.000000000 +0900
@@ -157,7 +157,11 @@
 /* these parallel the ctypes.h definitions, except that
  they force the char to valid range first */
 #define vlCTYPE(c) vl_chartypes_[CharOf(c)]
+#ifdef OPT_MULTIBYTE
+#define istype(m,c) (isascii(c) && ((vlCTYPE(c) & (m)) != 0))
+#else
 #define istype(m,c) ((vlCTYPE(c) & (m)) != 0)
+#endif
 
 #define isAlnum(c) istype(vl_lower | vl_upper | vl_digit, c)
 #define isAlpha(c) istype(vl_lower | vl_upper, c)
</pre>


KOMEDA Shinji <komeda>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dickey (Posted a comment)
  • -email is unavailable- added by komeda (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-04-15 dickey StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code