From: Patryk Kaczmarek <patryk.k@samsung.com>

Subject: [E-devel] [Patch] [Ecore] ecore_file_escape_name fix for \n
and \t

Please review and consider the attached patch for ecore_file_escape_name
function, now it correctly escapes tab and new line characters.



SVN revision: 76803
This commit is contained in:
Patryk Kaczmarek 2012-09-18 11:34:36 +00:00 committed by Carsten Haitzler
parent 001bac6058
commit 042ecacd0f
4 changed files with 37 additions and 8 deletions

View File

@ -53,3 +53,4 @@ Haifeng Deng <haifeng.deng@samsung.com>
Jérémy Zurcher <jeremy@asynk.ch>
Vikram Narayanan <vikram186@gmail.com>
Seong-ho Cho (DarkCircle) <darkcircle.0426@gmail.com>
Patryk Kaczmarek <patryk.k@samsung.com>

View File

@ -951,3 +951,8 @@
* Add string to atom_items for ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL, ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING
2012-09-18 Patryk Kaczmarek
* Fix escaping in ecore_file_escape_name() to handle tab and
newline right.

View File

@ -22,6 +22,7 @@ Fixes:
- Timeouts are handled correctly now (passing HTTP status 408 to
completion callback).
* ecore_evas rotation handling on some driver implementations
* ecore_file_escape_name() escape taba nd newline right.
Improvements:

View File

@ -1017,19 +1017,41 @@ ecore_file_escape_name(const char *filename)
{
if ((q - buf) > (PATH_MAX - 6)) return NULL;
if (
(*p == ' ') || (*p == '\t') || (*p == '\n') ||
(*p == '\\') || (*p == '\'') || (*p == '\"') ||
(*p == ';') || (*p == '!') || (*p == '#') ||
(*p == '$') || (*p == '%') || (*p == '&') ||
(*p == '*') || (*p == '(') || (*p == ')') ||
(*p == '[') || (*p == ']') || (*p == '{') ||
(*p == '}') || (*p == '|') || (*p == '<') ||
(*p == '>') || (*p == '?')
(*p == ' ') || (*p == '\\') || (*p == '\'') ||
(*p == '\"') || (*p == ';') || (*p == '!') ||
(*p == '#') || (*p == '$') || (*p == '%') ||
(*p == '&') || (*p == '*') || (*p == '(') ||
(*p == ')') || (*p == '[') || (*p == ']') ||
(*p == '{') || (*p == '}') || (*p == '|') ||
(*p == '<') || (*p == '>') || (*p == '?')
)
{
*q = '\\';
q++;
}
else if (*p == '\t')
{
*q = '\\';
q++;
*q = '\\';
q++;
*q = 't';
q++;
p++;
continue;
}
else if (*p == '\n')
{
*q = '\\';
q++;
*q = '\\';
q++;
*q = 'n';
q++;
p++;
continue;
}
*q = *p;
q++;
p++;