[frogr] Reducing the base string to compare when looking for tags



commit 8b81eee34e5785d891d403c910d1dee6293e9bdc
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Thu Aug 18 08:53:26 2011 +0200

    Reducing the base string to compare when looking for tags

 src/frogr-picture-loader.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/frogr-picture-loader.c b/src/frogr-picture-loader.c
index 1d0fd9a..cf6742e 100644
--- a/src/frogr-picture-loader.c
+++ b/src/frogr-picture-loader.c
@@ -512,6 +512,7 @@ remove_spaces_from_keyword (const gchar *keyword)
 static gchar *
 import_tags_from_xmp_keywords (const char *buffer, size_t len)
 {
+  gchar *comparison_substr = NULL;
   gchar *keywords_start = NULL;
   gchar *keywords_end = NULL;
   gchar *result = NULL;
@@ -521,8 +522,10 @@ import_tags_from_xmp_keywords (const char *buffer, size_t len)
      present, that is, the keywords (aka the 'tags') */
   for (i = 0; i < len && !keywords_start; i++)
     {
-      if (g_str_has_prefix (&buffer[i], "<dc:subject>"))
+      comparison_substr = g_strndup (&buffer[i], 12);
+      if (g_str_has_prefix (comparison_substr, "<dc:subject>"))
         keywords_start = g_strdup(&buffer[i+12]);
+      g_free (comparison_substr);
     }
 
   /* Find the end of the interesting XMP data, if found */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]