use G_DIR_SEPARATOR instead of '/'.

2005-05-06  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/compressor.c: use G_DIR_SEPARATOR instead of '/'.

	* plug-ins/common/mail.c: ditto. Fixed some coding style issues.
	Special case .bz2 files just as .gz ones.
This commit is contained in:
Michael Natterer 2005-05-06 19:36:12 +00:00 committed by Michael Natterer
parent 7be65c2d60
commit 65098dda2b
3 changed files with 20 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2005-05-06 Michael Natterer <mitch@gimp.org>
* plug-ins/common/compressor.c: use G_DIR_SEPARATOR instead of '/'.
* plug-ins/common/mail.c: ditto. Fixed some coding style issues.
Special case .bz2 files just as .gz ones.
2005-05-06 Sven Neumann <sven@gimp.org> 2005-05-06 Sven Neumann <sven@gimp.org>
* app/core/gimpimage-merge.c: removed redundant casts. * app/core/gimpimage-merge.c: removed redundant casts.

View File

@ -670,10 +670,11 @@ find_extension (const Compressor *compressor,
while (TRUE) while (TRUE)
{ {
if (!ext || ext[1] == '\0' || strchr (ext, '/')) if (!ext || ext[1] == '\0' || strchr (ext, G_DIR_SEPARATOR))
{ {
return NULL; return NULL;
} }
if (0 == g_ascii_strcasecmp (ext, compressor->xcf_extension)) if (0 == g_ascii_strcasecmp (ext, compressor->xcf_extension))
{ {
return ".xcf"; /* we've found it */ return ".xcf"; /* we've found it */

View File

@ -654,15 +654,9 @@ save_dialog (void)
static gboolean static gboolean
valid_file (const gchar *filename) valid_file (const gchar *filename)
{ {
int stat_res;
struct stat buf; struct stat buf;
stat_res = g_stat (filename, &buf); return g_stat (filename, &buf) == 0 && buf.st_size > 0;
if ((0 == stat_res) && (buf.st_size > 0))
return TRUE;
else
return FALSE;
} }
static gchar * static gchar *
@ -699,7 +693,7 @@ find_content_type (const gchar *filename)
while (type_mappings[i]) while (type_mappings[i])
{ {
if (strcmp (ext, type_mappings[i]) == 0) if (g_ascii_strcasecmp (ext, type_mappings[i]) == 0)
{ {
return g_strdup (type_mappings[i + 1]); return g_strdup (type_mappings[i + 1]);
} }
@ -724,7 +718,7 @@ find_extension (const gchar *filename)
while (TRUE) while (TRUE)
{ {
if (!ext || ext[1] == 0 || strchr (ext, '/')) if (!ext || ext[1] == '\0' || strchr (ext, G_DIR_SEPARATOR))
{ {
g_message (_("some sort of error with the file extension " g_message (_("some sort of error with the file extension "
"or lack thereof")); "or lack thereof"));
@ -732,7 +726,8 @@ find_extension (const gchar *filename)
return NULL; return NULL;
} }
if (0 != strcmp(ext,".gz")) if (0 != g_ascii_strcasecmp (ext, ".gz") &&
0 != g_ascii_strcasecmp (ext, ".bz2"))
{ {
return ext; return ext;
} }