SF.net SVN: geany:[5898] trunk/src/editor.c
colombanw at users.sourceforge.net
colombanw at xxxxx
Thu Aug 25 20:12:00 UTC 2011
Revision: 5898
http://geany.svn.sourceforge.net/geany/?rev=5898&view=rev
Author: colombanw
Date: 2011-08-25 20:11:59 +0000 (Thu, 25 Aug 2011)
Log Message:
-----------
Fix checks for non-ASCII characters not to rely on signed char
Modified Paths:
--------------
trunk/src/editor.c
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2011-08-25 20:11:43 UTC (rev 5897)
+++ trunk/src/editor.c 2011-08-25 20:11:59 UTC (rev 5898)
@@ -1601,6 +1601,10 @@
}
+/* checks whether @p c is an ASCII character (e.g. < 0x80) */
+#define IS_ASCII(c) (((unsigned char)(c)) < 0x80)
+
+
/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
* NULL terminated in any case, even when the word is truncated because wordlen is too small.
* position can be -1, then the current position is used.
@@ -1632,11 +1636,11 @@
/* the checks for "c < 0" are to allow any Unicode character which should make the code
* a little bit more Unicode safe, anyway, this allows also any Unicode punctuation,
* TODO: improve this code */
- while (startword > 0 && (strchr(wc, chunk[startword - 1]) || chunk[startword - 1] < 0))
+ while (startword > 0 && (strchr(wc, chunk[startword - 1]) || ! IS_ASCII(chunk[startword - 1])))
startword--;
if (!stem)
{
- while (chunk[endword] != 0 && (strchr(wc, chunk[endword]) || chunk[endword] < 0))
+ while (chunk[endword] != 0 && (strchr(wc, chunk[endword]) || ! IS_ASCII(chunk[endword])))
endword++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list