[patch] [gui] warning patrol in gtk-peer
Thomas Fitzsimmons
fitzsim@redhat.com
Thu Oct 21 20:59:00 GMT 2004
On Thu, 2004-10-21 at 15:58, Mark Wielaard wrote:
> Hi,
>
> On Thu, 2004-10-21 at 18:00, Andreas Tobler wrote:
> > Hello all,
> >
> > the following patch cleans up a few warnings from unused variables.
> >
> > ok for gui?
>
> I cannot approve it. But in general anything goes for the gui branch,
> And I think this is actually obvious.
>
> I would do one little thing different though.
>
> > * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
> > (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter):
> > Likewise.
> > (filenameFilterCallback): Remove unused var.
> > (handle_response): Initialize str_filename.
>
> You initialize str_filename in the definition. But we can also make sure
> that it is always defined in the function body. The code first checks
> for responseId == GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL or
> GTK_RESPONSE_DELETE_EVENT. Then it handles GTK_RESPONSE_DELETE_EVENT and
> returns. So the following if-then-else block could also be written as:
>
> @@ -252,7 +251,7 @@
> if (responseId == GTK_RESPONSE_OK) {
> fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
> str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
> - } else if (responseId == GTK_RESPONSE_CANCEL) {
> + } else /* responseId == GTK_RESPONSE_CANCEL */ {
> str_fileName = NULL;
> }
>
I think str_fileName should be initialized to NULL when it is declared
and the else clause should be removed.
With that change, this patch can go in.
Tom
More information about the Java-patches
mailing list