aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--src/tag/Aiff.cxx (renamed from src/tag/aiff.c)24
-rw-r--r--src/tag/Aiff.hxx (renamed from src/tag/aiff.h)7
-rw-r--r--src/tag/Riff.cxx (renamed from src/tag/riff.c)24
-rw-r--r--src/tag/Riff.hxx (renamed from src/tag/riff.h)7
-rw-r--r--src/tag/TagId3.cxx7
6 files changed, 28 insertions, 45 deletions
diff --git a/Makefile.am b/Makefile.am
index 6fcf0e88e..2596ee36e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -441,8 +441,8 @@ if HAVE_ID3TAG
libtag_a_SOURCES += \
src/tag/TagId3.cxx src/tag/TagId3.hxx \
src/tag/TagRva2.cxx src/tag/TagRva2.hxx \
- src/tag/riff.c src/tag/riff.h \
- src/tag/aiff.c src/tag/aiff.h
+ src/tag/Riff.cxx src/tag/Riff.hxx \
+ src/tag/Aiff.cxx src/tag/Aiff.hxx
endif
# decoder plugins
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;
}
}
diff --git a/src/tag/aiff.h b/src/tag/Aiff.hxx
index a0ae2d41a..9000be7f8 100644
--- a/src/tag/aiff.h
+++ b/src/tag/Aiff.hxx
@@ -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
@@ -22,10 +22,9 @@
* A parser for the AIFF file format.
*/
-#ifndef MPD_AIFF_H
-#define MPD_AIFF_H
+#ifndef MPD_AIFF_HXX
+#define MPD_AIFF_HXX
-#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
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;
}
}
diff --git a/src/tag/riff.h b/src/tag/Riff.hxx
index 7b35e092a..fbbdfaaf6 100644
--- a/src/tag/riff.h
+++ b/src/tag/Riff.hxx
@@ -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
@@ -22,10 +22,9 @@
* A parser for the RIFF file format (e.g. WAV).
*/
-#ifndef MPD_RIFF_H
-#define MPD_RIFF_H
+#ifndef MPD_RIFF_HXX
+#define MPD_RIFF_HXX
-#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx
index 0fc1b01db..2a217dc47 100644
--- a/src/tag/TagId3.cxx
+++ b/src/tag/TagId3.cxx
@@ -25,11 +25,8 @@
#include "TagBuilder.hxx"
#include "util/Error.hxx"
#include "ConfigGlobal.hxx"
-
-extern "C" {
-#include "riff.h"
-#include "aiff.h"
-}
+#include "Riff.hxx"
+#include "Aiff.hxx"
#include <glib.h>
#include <id3tag.h>