summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8dc7f96)
raw | patch | inline | side by side (parent: 8dc7f96)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Tue, 12 Jun 2012 21:15:44 +0000 (23:15 +0200) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Tue, 12 Jun 2012 21:15:44 +0000 (23:15 +0200) |
src/strfsong.c | patch | blob | history |
diff --git a/src/strfsong.c b/src/strfsong.c
index e3d4eb98cda560fd56d291bee98ff18207f56499..4e9b8d6bbc04f1e5f100dcb0968e957b4b254675 100644 (file)
--- a/src/strfsong.c
+++ b/src/strfsong.c
gsize n, length = 0;
gboolean found = FALSE;
- memset(s, 0, max);
+ s[0] = '\0';
+
if (song == NULL)
return 0;
if (p[0] == '|') {
++p;
if(!found) {
- memset(s, 0, max);
+ s[0] = '\0';
length = 0;
} else {
p = skip(p);
if (p[0] == ']') {
if(last) *last = p+1;
if(!found && length) {
- memset(s, 0, max);
+ s[0] = '\0';
length = 0;
}
return length;
/* pass-through non-escaped portions of the format string */
if (p[0] != '#' && p[0] != '%' && length<max) {
s[length++] = *p;
+ s[length] = '\0';
p++;
continue;
}
/* let the escape character escape itself */
if (p[0] == '#' && p[1] != '\0' && length<max) {
s[length++] = *(p+1);
+ s[length] = '\0';
p+=2;
continue;
}