From 4069dd3a905562ff8c80e20a9b98d61bc3d693d3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 24 Sep 2006 16:37:43 +0000 Subject: [PATCH] *Not all white space is treated the same here, so using isspace is not correct. In this case, use of isspace causes bugs where only the initial word of names is used, exe parameters are stripped, etc. *The exe params should be strdup'ed just like all the others. This one is my fault. SVN revision: 26108 --- .../src/lib/ecore_desktop/ecore_desktop.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_desktop/ecore_desktop.c b/legacy/ecore/src/lib/ecore_desktop/ecore_desktop.c index 634542b43e..c954a2a089 100644 --- a/legacy/ecore/src/lib/ecore_desktop/ecore_desktop.c +++ b/legacy/ecore/src/lib/ecore_desktop/ecore_desktop.c @@ -74,14 +74,15 @@ ecore_desktop_ini_get(const char *file) c = buffer; /* Strip preceeding blanks. */ - while ((*c != '\0') && (isspace(*c))) c++; + while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && (*c != '\0')) + c++; /* Skip blank lines and comments */ if ((*c == '\0') || (*c == '\n') || (*c == '#')) continue; if (*c == '[') /* New group. */ { key = c + 1; while ((*c != ']') && (*c != '\n') && (*c != '\0')) - c++; + c++; *c++ = '\0'; current = ecore_hash_new(ecore_str_hash, ecore_str_compare); if (current) @@ -100,20 +101,24 @@ ecore_desktop_ini_get(const char *file) key = c; /* Find trailing blanks or =. */ - while ((*c != '\0') && (*c != '=') && (!isspace(*c))) c++; + while ((*c != '=') && (*c != ' ') && (*c != '\t') && (*c != '\n') && (*c != '\0')) + c++; if (*c != '=') /* Find equals. */ { *c++ = '\0'; - while ((*c != '\0') && (*c != '=')) c++; + while ((*c != '=') && (*c != '\n') && (*c != '\0')) + c++; } if (*c == '=') /* Equals found. */ { *c++ = '\0'; /* Strip preceeding blanks. */ - while ((*c != '\0') && (isspace(*c))) c++; + while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && (*c != '\0')) + c++; value = c; /* Find end. */ - while ((*c != '\0') && (!isspace(*c))) c++; + while ((*c != '\n') && (*c != '\0')) + c++; *c++ = '\0'; /* FIXME: should strip space at end, then unescape value. */ tv = ecore_hash_remove(current, key); @@ -248,7 +253,8 @@ _ecore_desktop_get(const char *file, const char *lang) if (exe) { *exe = '\0'; - result->exec_params = ++exe; + exe++; + result->exec_params = strdup(exe); } exe = result->exec; }