classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: GdkGraphics fix


From: Lillian Angel
Subject: Re: [cp-patches] FYI: GdkGraphics fix
Date: Fri, 25 Nov 2005 16:01:43 -0500

Thanks, I fixed this.
Committed.

2005-11-25  Lillian Angel  <address@hidden>

        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
        (drawString): Changed pointer to be const, and fixed check to
        draw characters only if they are >= ' '. Handles all control
        characters.


On Fri, 2005-11-25 at 12:28 -0700, Tom Tromey wrote:
> >>>>> "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
> 

Attachment: patch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]