aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag/Aiff.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-09-28 14:14:13 +0200
committerMax Kellermann <max@duempel.org>2013-09-28 14:14:13 +0200
commit36f712b9496a12d86d12aa32dff0d6663fc29f80 (patch)
tree940e37b32f02391af62df99adb08ee1b4ce105b9 /src/tag/Aiff.cxx
parenta446775d808a8220cb2eacc797a5e4b15e3a3560 (diff)
downloadmpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.tar.gz
mpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.tar.xz
mpd-36f712b9496a12d86d12aa32dff0d6663fc29f80.zip
tag/{riff,aiff}: convert to C++
Diffstat (limited to '')
-rw-r--r--src/tag/Aiff.cxx (renamed from src/tag/aiff.c)24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/tag/aiff.c b/src/tag/Aiff.cxx
index f66f29e2d..09d107d5b 100644
--- a/src/tag/aiff.c
+++ b/src/tag/Aiff.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 "aiff.h"
+#include "Aiff.hxx"
#include <glib.h>
@@ -46,16 +46,10 @@ struct aiff_chunk_header {
size_t
aiff_seek_id3(FILE *file)
{
- int ret;
- struct stat st;
- struct aiff_header header;
- struct aiff_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 @@ aiff_seek_id3(FILE *file)
/* seek to the beginning and read the AIFF 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);
+ aiff_header header;
+ size_t size = fread(&header, sizeof(header), 1, file);
if (size != 1 ||
memcmp(header.id, "FORM", 4) != 0 ||
GUINT32_FROM_BE(header.size) > (uint32_t)st.st_size ||
@@ -81,6 +75,7 @@ aiff_seek_id3(FILE *file)
while (true) {
/* read the chunk header */
+ aiff_chunk_header chunk;
size = fread(&chunk, sizeof(chunk), 1, file);
if (size != 1)
return 0;
@@ -99,8 +94,7 @@ aiff_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;
}
}