Fix #417: Natural sort order
[geeqie.git] / src / misc.c
index 79de8b0..ca17483 100644 (file)
@@ -1,12 +1,21 @@
 /*
- * Geeqie
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
- * Authors: Vladimir Nadvornik / Laurent Monin
+ * Authors: Vladimir Nadvornik, Laurent Monin
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "main.h"
@@ -14,7 +23,7 @@
 
 gdouble get_zoom_increment(void)
 {
-       return ((options->image.zoom_increment != 0) ? (gdouble)options->image.zoom_increment / 10.0 : 1.0);
+       return ((options->image.zoom_increment != 0) ? (gdouble)options->image.zoom_increment / 100.0 : 1.0);
 }
 
 gchar *utf8_validate_or_convert(const gchar *text)
@@ -22,7 +31,7 @@ gchar *utf8_validate_or_convert(const gchar *text)
        gint len;
 
        if (!text) return NULL;
-       
+
        len = strlen(text);
        if (!g_utf8_validate(text, len, NULL))
                return g_convert(text, len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
@@ -114,83 +123,6 @@ gchar *expand_tilde(const gchar *filename)
 #endif
 }
 
-/*
-   returns text without quotes or NULL for empty or broken string
-   any text up to first '"' is skipped
-   tail is set to point at the char after the second '"'
-   or at the ending \0
-
-*/
-
-gchar *quoted_value(const gchar *text, const gchar **tail)
-{
-       const gchar *ptr;
-       gint c = 0;
-       gint l = strlen(text);
-       gchar *retval = NULL;
-
-       if (tail) *tail = text;
-
-       if (l == 0) return retval;
-
-       while (c < l && text[c] != '"') c++;
-       if (text[c] == '"')
-               {
-               gint e;
-               c++;
-               ptr = text + c;
-               e = c;
-               while (e < l)
-                       {
-                       if (text[e-1] != '\\' && text[e] == '"') break;
-                       e++;
-                       }
-               if (text[e] == '"')
-                       {
-                       if (e - c > 0)
-                               {
-                               gchar *substring = g_strndup(ptr, e - c);
-
-                               if (substring)
-                                       {
-                                       retval = g_strcompress(substring);
-                                       g_free(substring);
-                                       }
-                               }
-                       }
-               if (tail) *tail = text + e + 1;
-               }
-       else
-               /* for compatibility with older formats (<0.3.7)
-                * read a line without quotes too */
-               {
-               c = 0;
-               while (c < l && text[c] != '\n' && !g_ascii_isspace(text[c])) c++;
-               if (c != 0)
-                       {
-                       retval = g_strndup(text, c);
-                       }
-               if (tail) *tail = text + c;
-               }
-
-       return retval;
-}
-
-gchar *escquote_value(const gchar *text)
-{
-       gchar *e;
-
-       if (!text) return g_strdup("\"\"");
-
-       e = g_strescape(text, "");
-       if (e)
-               {
-               gchar *retval = g_strdup_printf("\"%s\"", e);
-               g_free(e);
-               return retval;
-               }
-       return g_strdup("\"\"");
-}
 
 /* Run a command like system() but may output debug messages. */
 int runcmd(gchar *cmd)
@@ -237,7 +169,7 @@ int runcmd(gchar *cmd)
 
                DEBUG_1("%s : %d\n", msg, retval);
        }
-       
+
        return retval;
 #endif
 }