From 8033f75a05ad8f5e2719e23285bcf9f5a9f5d12a Mon Sep 17 00:00:00 2001 From: thor Date: Sun, 2 Dec 2007 00:02:35 +0000 Subject: [PATCH] Do not leave the data fields modified after print_lines - that screwed raw tag display. git-svn-id: svn://scm.orgis.org/mpg123/trunk@1211 35dc7657-300d-0410-a2e5-dc2837fedb53 --- doc/examples/id3dump.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/examples/id3dump.c b/doc/examples/id3dump.c index 3aeb8a00..29534916 100644 --- a/doc/examples/id3dump.c +++ b/doc/examples/id3dump.c @@ -55,13 +55,18 @@ void print_lines(const char* prefix, mpg123_string *inlines) { if(lines[i] == '\n' || lines[i] == '\r' || lines[i] == 0) { - if(lines[i] == '\n') ++hadlf; - if(lines[i] == '\r') ++hadcr; - + char save = lines[i]; /* saving, changing, restoring a byte in the data */ + if(save == '\n') ++hadlf; + if(save == '\r') ++hadcr; if((hadcr || hadlf) && hadlf % 2 == 0 && hadcr % 2 == 0) line = ""; - lines[i] = 0; - if(line){ printf("%s%s\n", prefix, line); line = NULL; } + if(line) + { + lines[i] = 0; + printf("%s%s\n", prefix, line); + line = NULL; + lines[i] = save; + } } else {