summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesel.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-12-13 23:18:03 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-12-13 23:18:03 +0000
commit73b15ba391b3a533786e2a2f4f80274b80866822 (patch)
tree818fcfa22f617b7b5e1bdfe61980b7beb2e07f2d /gtk/gtkfilesel.c
parent8c22e8065e52a3d3d2c1157b0e5d5c827557debc (diff)
downloadgdk-pixbuf-73b15ba391b3a533786e2a2f4f80274b80866822.tar.gz
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.
Diffstat (limited to 'gtk/gtkfilesel.c')
-rw-r--r--gtk/gtkfilesel.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 2a11d0fed..061a0f476 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -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)