Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

flac: fix warning introduced in 5758a05

Change-Id: I649f7c356b8b790d6dfbd071a8e391a84d0cdcca

+19 -19
+19 -19
lib/rbcodec/metadata/flac.c
··· 33 33 bool get_flac_metadata(int fd, struct mp3entry* id3) 34 34 { 35 35 /* A simple parser to read vital metadata from a FLAC file - length, 36 - * frequency, bitrate etc. This code should either be moved to a 36 + * frequency, bitrate etc. This code should either be moved to a 37 37 * seperate file, or discarded in favour of the libFLAC code. 38 - * The FLAC stream specification can be found at 38 + * The FLAC stream specification can be found at 39 39 * http://flac.sourceforge.net/format.html#stream 40 40 */ 41 41 ··· 48 48 { 49 49 return rc; 50 50 } 51 - 52 - if (memcmp(buf, "fLaC", 4) != 0) 51 + 52 + if (memcmp(buf, "fLaC", 4) != 0) 53 53 { 54 54 return rc; 55 55 } 56 56 57 - while (!last_metadata) 57 + while (!last_metadata) 58 58 { 59 59 unsigned long i; 60 60 int type; 61 - 61 + 62 62 if (read(fd, buf, 4) != 4) 63 63 { 64 64 return rc; 65 65 } 66 - 66 + 67 67 last_metadata = buf[0] & 0x80; 68 68 type = buf[0] & 0x7f; 69 69 /* The length of the block */ ··· 72 72 if (type == 0) /* 0 is the STREAMINFO block */ 73 73 { 74 74 unsigned long totalsamples; 75 - 76 - if (i >= sizeof(id3->path) || read(fd, buf, i) != i) 75 + 76 + if (i >= sizeof(id3->path) || read(fd, buf, i) != (int)i) 77 77 { 78 78 return rc; 79 79 } 80 - 80 + 81 81 id3->vbr = true; /* All FLAC files are VBR */ 82 82 id3->filesize = filesize(fd); 83 - id3->frequency = (buf[10] << 12) | (buf[11] << 4) 83 + id3->frequency = (buf[10] << 12) | (buf[11] << 4) 84 84 | ((buf[12] & 0xf0) >> 4); 85 85 rc = true; /* Got vital metadata */ 86 86 87 87 /* totalsamples is a 36-bit field, but we assume <= 32 bits are used */ 88 88 totalsamples = get_long_be(&buf[14]); 89 - 89 + 90 90 if(totalsamples > 0) 91 91 { 92 - /* Calculate track length (in ms) and estimate the bitrate (in kbit/s) */ 92 + /* Calculate track length (in ms) and estimate the bitrate (in kbit/s) */ 93 93 id3->length = ((int64_t) totalsamples * 1000) / id3->frequency; 94 - id3->bitrate = (id3->filesize * 8) / id3->length; 95 - } 94 + id3->bitrate = (id3->filesize * 8) / id3->length; 95 + } 96 96 else if (totalsamples == 0) 97 97 { 98 98 id3->length = 0; 99 99 id3->bitrate = 0; 100 100 } 101 - else 101 + else 102 102 { 103 103 logf("flac length invalid!"); 104 104 return false; 105 105 } 106 106 107 - } 107 + } 108 108 else if (type == 4) /* 4 is the VORBIS_COMMENT block */ 109 109 { 110 110 /* The next i bytes of the file contain the VORBIS COMMENTS. */ ··· 112 112 { 113 113 return rc; 114 114 } 115 - } 115 + } 116 116 #ifdef HAVE_ALBUMART 117 117 else if (type == 6) /* 6 is the PICTURE block */ 118 118 { ··· 172 172 } 173 173 } 174 174 } 175 - 175 + 176 176 return true; 177 177 }