summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-02-19 04:15:37 +0000
committerphintuka <phintuka>2008-02-19 04:15:37 +0000
commit08200321121b7aa1ba4cd832517da23d7db12099 (patch)
treeeba309f5e3f793c5f2ad5703f0925ba21854e9d1
parent576facb2361310cbdb2cf3e15ad4e009a941774c (diff)
downloadxineliboutput-08200321121b7aa1ba4cd832517da23d7db12099.tar.gz
xineliboutput-08200321121b7aa1ba4cd832517da23d7db12099.tar.bz2
Remove static variable
-rw-r--r--tools/playlist.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/playlist.c b/tools/playlist.c
index 74bc68fd..05e80fcb 100644
--- a/tools/playlist.c
+++ b/tools/playlist.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: playlist.c,v 1.13 2008-02-19 04:11:14 phintuka Exp $
+ * $Id: playlist.c,v 1.14 2008-02-19 04:15:37 phintuka Exp $
*
*/
@@ -98,14 +98,13 @@ int cPlaylistItem::Compare(const cListObject &ListObject) const
// cID3Scanner
//
-static const char *shell_escape(const cString& src, char ch)
+static const char *shell_escape(char *buf, int buflen, const cString& src, char ch)
{
- static char buf[4096];
const char *pt = *src;
int n = 0;
if(pt) {
- while(*pt && n < (int)(sizeof(buf)-2)) {
+ while(*pt && n < buflen-2) {
if(*pt == ch || *pt == '\\' /*|| *pt == '\"' || *pt == '\''*/) {
buf[n++] = '\\';
}
@@ -141,6 +140,7 @@ class cID3Scanner : public cThread
if(xc.IsAudioFile(Item->Filename)) {
LOGDBG("Scanning metainfo for file %s", *Item->Filename);
+ char buf[4096];
cString Cmd = "";
if(!strcasecmp((Item->Filename) + strlen(Item->Filename) - 5, ".flac"))
Cmd = cString::sprintf("metaflac "
@@ -149,7 +149,7 @@ class cID3Scanner : public cThread
" --show-tag=ARTIST "
" --show-tag=TRACKNUMBER "
" \"%s\"",
- shell_escape(Item->Filename, '\"'));
+ shell_escape(buf, sizeof(buf)-1, Item->Filename, '\"'));
else
Cmd = cString::sprintf("mp3info -p \""
"ARTIST=%%a\\r\\n"
@@ -157,7 +157,7 @@ class cID3Scanner : public cThread
"TITLE=%%t\\r\\n"
"TRACKNUMBER=%%n\\r\\n\""
" \"%s\"",
- shell_escape(Item->Filename, '\"'));
+ shell_escape(buf, sizeof(buf)-1, Item->Filename, '\"'));
cPipe p;
if(p.Open(*Cmd, "r")) {