Commit 73b15ba3 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

System fnmatch wasn't going to be UTF-8 clean, neither was our version.

Fri Dec 13 17:45:40 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
        System fnmatch wasn't going to be UTF-8 clean, neither
        was our version. Redo our fnmatch.c to be UTF-8, add
        test cases, fix all sorts of bugs inherited
        from the antique GNU fnmatch code. Change interface
        to get rid of fnmatch.h constants. Fixes basic
        non-workingness of filesel with non-ASCII filenames.

        * gtk/fnmatch.h: No longer needed.
parent 8c22e806
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
Fri Dec 13 17:45:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
System fnmatch wasn't going to be UTF-8 clean, neither
was our version. Redo our fnmatch.c to be UTF-8, add
test cases, fix all sorts of bugs inherited
from the antique GNU fnmatch code. Change interface
to get rid of fnmatch.h constants. Fixes basic
non-workingness of filesel with non-ASCII filenames.
* gtk/fnmatch.h: No longer needed.
Fri Dec 13 12:15:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (find_parent_dir_fullname): If
getting the parent of the directory name, make
an attempt to change back to the original directory.
Thu Dec 12 20:07:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Const
......
This diff is collapsed.
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#include <stdlib.h> /* Something to pull in features.h */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined (__GNU_LIBRARY__)
#define fnmatch _gtk_fnmatch
#endif
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#undef __P
#define __P(protos) protos
#else /* Not C++ or ANSI C. */
#undef __P
#define __P(protos) ()
/* We can get away without defining `const' here only because in this file
it is used only inside the prototype for `fnmatch', which is elided in
non-ANSI C where `const' is problematical. */
#endif /* C++ or ANSI C. */
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
#undef FNM_NOESCAPE
#undef FNM_PERIOD
/* Bits set in the FLAGS argument to `fnmatch'. */
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
#define FNM_NOMATCH 1
/* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch __P ((const char *__pattern, const char *__string,
int __flags));
#ifdef __cplusplus
}
#endif
#endif /* fnmatch.h */
......@@ -2844,10 +2844,6 @@ real_remove_row (GtkCList *clist,
clist->row_list_end = g_list_previous (list);
g_list_remove (list, clist_row);
/*if (clist->focus_row >=0 &&
(row <= clist->focus_row || clist->focus_row >= clist->rows))
clist->focus_row--;*/
if (row < ROW_FROM_YPIXEL (clist, 0))
clist->voffset += clist->row_height + CELL_SPACING;
......@@ -4346,7 +4342,9 @@ sync_selection (GtkCList *clist,
clist->focus_row += d;
if (clist->focus_row == -1 && clist->rows >= 1)
clist->focus_row = 0;
else if (clist->focus_row >= clist->rows)
else if (d < 0 && clist->focus_row >= clist->rows - 1)
clist->focus_row = clist->rows - 2;
else if (clist->focus_row >= clist->rows) /* Paranoia */
clist->focus_row = clist->rows - 1;
}
......
......@@ -55,8 +55,6 @@
#include <winsock.h> /* For gethostname */
#endif
#include "fnmatch.h"
#include "gdk/gdkkeysyms.h"
#include "gtkbutton.h"
#include "gtkcellrenderertext.h"
......@@ -67,6 +65,7 @@
#include "gtklabel.h"
#include "gtkliststore.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkstock.h"
#include "gtktreeselection.h"
......@@ -142,10 +141,6 @@ typedef struct _PossibleCompletion PossibleCompletion;
* match by first_diff_index()
*/
#define PATTERN_MATCH -1
/* The arguments used by all fnmatch() calls below
*/
#define FNMATCH_FLAGS (FNM_PATHNAME | FNM_PERIOD)
#define CMPL_ERRNO_TOO_LONG ((1<<16)-1)
#define CMPL_ERRNO_DID_NOT_CONVERT ((1<<16)-2)
......@@ -3447,9 +3442,10 @@ find_parent_dir_fullname (gchar* dirname)
if (chdir (sys_dirname) != 0 || chdir ("..") != 0)
{
cmpl_errno = errno;
chdir (sys_orig_dir);
g_free (sys_dirname);
g_free (sys_orig_dir);
cmpl_errno = errno;
return NULL;
}
g_free (sys_dirname);
......@@ -3621,8 +3617,7 @@ find_completion_dir (gchar *text_to_complete,
for (i = 0; i < dir->sent->entry_count; i += 1)
{
if (dir->sent->entries[i].is_dir &&
fnmatch (pat_buf, dir->sent->entries[i].entry_name,
FNMATCH_FLAGS)!= FNM_NOMATCH)
_gtk_fnmatch (pat_buf, dir->sent->entries[i].entry_name))
{
if (found)
{
......@@ -3649,7 +3644,7 @@ find_completion_dir (gchar *text_to_complete,
{
g_free (pat_buf);
return NULL;
}
}
next->cmpl_parent = dir;
......@@ -3772,8 +3767,7 @@ attempt_file_completion (CompletionState *cmpl_state)
{
if (dir->sent->entries[dir->cmpl_index].is_dir)
{
if (fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name,
FNMATCH_FLAGS) != FNM_NOMATCH)
if (_gtk_fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name))
{
CompletionDir* new_dir;
......@@ -3821,8 +3815,7 @@ attempt_file_completion (CompletionState *cmpl_state)
append_completion_text (dir->sent->entries[dir->cmpl_index].entry_name, cmpl_state);
cmpl_state->the_completion.is_a_completion =
fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name,
FNMATCH_FLAGS) != FNM_NOMATCH;
_gtk_fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name);
cmpl_state->the_completion.is_directory = dir->sent->entries[dir->cmpl_index].is_dir;
if (dir->sent->entries[dir->cmpl_index].is_dir)
......
......@@ -96,6 +96,9 @@ const gchar *_gtk_get_data_prefix ();
#endif /* G_OS_WIN32 */
gboolean _gtk_fnmatch (const char *pattern,
const char *string);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment