[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: GdkGraphics fix
From: |
Tom Tromey |
Subject: |
Re: [cp-patches] FYI: GdkGraphics fix |
Date: |
Fri, 25 Nov 2005 12:28:05 -0700 |
>>>>> "Lillian" == Lillian Angel <address@hidden> writes:
Lillian> PR 24937
Lillian> * gnu/java/awt/peer/gtk/GdkGraphics.java
Lillian> (drawString): Removed pattern matching code. This is now
Lillian> done in native.
Lillian> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
Lillian> (Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString): Added
Lillian> a loop to filter out all non-printing characters.
Lillian> cstr = (*env)->GetStringUTFChars (env, str, NULL);
Lillian> + sTmp = cstr;
Lillian> + for (; *sTmp != '\0'; sTmp++)
Lillian> + if (isprint(*sTmp))
I don't think this does what you intend it to do.
isprint() takes a C 'char' and tells you whether it is printable.
But, this string doesn't contain plain old chars -- a given char might
be the start of a multi-byte UTF-8 representation of some Unicode
character. isprint() won't know about this, and might well return
false for something which is perfectly displayable... I suggest
testing with some characters outside of the ordinary Latin 1 range.
If you are only trying to delete newlines, I suggest just checking for
those directly. Or, if you want to handle all control characters I
think you could just do something like: if ((unsigned char) *sTmp < ' ')...
Tom
- [cp-patches] RFC: GdkGraphics fix, Lillian Angel, 2005/11/21
- Re: [cp-patches] RFC: GdkGraphics fix, Thomas Fitzsimmons, 2005/11/21
- Re: [cp-patches] RFC: GdkGraphics fix, Lillian Angel, 2005/11/21
- Re: [cp-patches] FYI: GdkGraphics fix, Lillian Angel, 2005/11/21
- Re: [cp-patches] FYI: GdkGraphics fix, Mark Wielaard, 2005/11/21
- Message not available
- Re: [cp-patches] FYI: GdkGraphics fix, Lillian Angel, 2005/11/22
- Re: [cp-patches] FYI: GdkGraphics fix, Lillian Angel, 2005/11/22
- Re: [cp-patches] FYI: GdkGraphics fix, Christian Thalinger, 2005/11/25
- Re: [cp-patches] FYI: GdkGraphics fix, Mark Wielaard, 2005/11/25
- Re: [cp-patches] FYI: GdkGraphics fix,
Tom Tromey <=
- Re: [cp-patches] FYI: GdkGraphics fix, Lillian Angel, 2005/11/25
Re: [cp-patches] RFC: GdkGraphics fix, Tom Tromey, 2005/11/25