[Swfdec] libswfdec/swfdec_loader.c
Benjamin Otte
company at kemper.freedesktop.org
Fri Mar 16 14:23:22 PDT 2007
libswfdec/swfdec_loader.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
New commits:
diff-tree 154596318676ff838f8acc47d3bc62bf3967868b (from 852a195c76af81618bc0b4ebf3bc820ac03bbb95)
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Mar 16 22:22:58 2007 +0100
fix filename computation
diff --git a/libswfdec/swfdec_loader.c b/libswfdec/swfdec_loader.c
index 8cd432c..29abd3f 100644
--- a/libswfdec/swfdec_loader.c
+++ b/libswfdec/swfdec_loader.c
@@ -448,18 +448,17 @@ swfdec_loader_get_filename (SwfdecLoader
}
ret = g_filename_from_utf8 (start, end ? end - start : -1, NULL, NULL, NULL);
if (ret) {
- char *dot;
const char *ext;
ext = swfdec_loader_data_type_get_extension (loader->data_type);
- if (*ext && (dot = strrchr (ret, '.'))) {
+ if (*ext) {
+ char *dot = strrchr (ret, '.');
char *real;
- guint len = strlen (dot);
- if (len <= 5) {
- real = g_strdup_printf ("%*s.%s", dot - ret, ret, ext);
- } else {
- real = g_strdup_printf ("%s.%s", ret, ext);
- }
+ guint len = dot ? strlen (dot) : G_MAXUINT;
+ g_print ("ret: %s, dot: %s, ext: %s\n", ret, dot, ext);
+ if (len <= 5)
+ *dot = '\0';
+ real = g_strdup_printf ("%s.%s", ret, ext);
g_free (ret);
ret = real;
}
More information about the Swfdec
mailing list