Skip to content

Commit

Permalink
Search for LYRICSBEGIN in Lyrics3v1
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajen committed Jul 22, 2018
1 parent 3374674 commit d4c845f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/reader/tag/lyrics3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ const int kTagMaxSizeV1 = 5111; // 5100 + 11(length of LYRICSBEGIN)
// Returns -1 if no header is found for the Lyrics3v1 tag.
// Otherwise returns the size of the Lyrics3v1 tag including LYRICSBEGIN
// (but not including LYRICSEND).
int getLyrics3v1Size(const Bytes& footer) {
// TODO look for LYRICSBEGIN
int getLyrics3v1Size(const Bytes& lyrics) {
const char* lyrics_ptr = (const char*)lyrics.data();
for (int i = 0, n = lyrics.size() - 11 + 1; i < n; i++) {
if (strncmp(lyrics_ptr + i, "LYRICSBEGIN", 11) == 0) {
return lyrics.size() - i;
}
}
return -1;
}

Expand Down

0 comments on commit d4c845f

Please sign in to comment.