diff options
author | Max Kellermann <max@duempel.org> | 2013-09-28 14:14:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-28 14:14:13 +0200 |
commit | 36f712b9496a12d86d12aa32dff0d6663fc29f80 (patch) | |
tree | 940e37b32f02391af62df99adb08ee1b4ce105b9 /src/tag/riff.c | |
parent | a446775d808a8220cb2eacc797a5e4b15e3a3560 (diff) | |
download | mpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.tar.gz mpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.tar.xz mpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.zip |
tag/{riff,aiff}: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/tag/Riff.cxx (renamed from src/tag/riff.c) | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/tag/riff.c b/src/tag/Riff.cxx index 9ee916971..3d022e661 100644 --- a/src/tag/riff.c +++ b/src/tag/Riff.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ */ #include "config.h" /* must be first for large file support */ -#include "riff.h" +#include "Riff.hxx" #include <glib.h> @@ -46,16 +46,10 @@ struct riff_chunk_header { size_t riff_seek_id3(FILE *file) { - int ret; - struct stat st; - struct riff_header header; - struct riff_chunk_header chunk; - size_t size; - /* determine the file size */ - ret = fstat(fileno(file), &st); - if (ret < 0) { + struct stat st; + if (fstat(fileno(file), &st) < 0) { g_warning("Failed to stat file descriptor: %s", g_strerror(errno)); return 0; @@ -63,13 +57,13 @@ riff_seek_id3(FILE *file) /* seek to the beginning and read the RIFF header */ - ret = fseek(file, 0, SEEK_SET); - if (ret != 0) { + if (fseek(file, 0, SEEK_SET) != 0) { g_warning("Failed to seek: %s", g_strerror(errno)); return 0; } - size = fread(&header, sizeof(header), 1, file); + riff_header header; + size_t size = fread(&header, sizeof(header), 1, file); if (size != 1 || memcmp(header.id, "RIFF", 4) != 0 || GUINT32_FROM_LE(header.size) > (uint32_t)st.st_size) @@ -79,6 +73,7 @@ riff_seek_id3(FILE *file) while (true) { /* read the chunk header */ + riff_chunk_header chunk; size = fread(&chunk, sizeof(chunk), 1, file); if (size != 1) return 0; @@ -97,8 +92,7 @@ riff_seek_id3(FILE *file) /* found it! */ return size; - ret = fseek(file, size, SEEK_CUR); - if (ret != 0) + if (fseek(file, size, SEEK_CUR) != 0) return 0; } } |