Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
36f712b9
Commit
36f712b9
authored
Sep 28, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/{riff,aiff}: convert to C++
parent
a446775d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
45 deletions
+28
-45
Makefile.am
Makefile.am
+2
-2
Aiff.cxx
src/tag/Aiff.cxx
+9
-15
Aiff.hxx
src/tag/Aiff.hxx
+3
-4
Riff.cxx
src/tag/Riff.cxx
+9
-15
Riff.hxx
src/tag/Riff.hxx
+3
-4
TagId3.cxx
src/tag/TagId3.cxx
+2
-5
No files found.
Makefile.am
View file @
36f712b9
...
...
@@ -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
...
...
src/tag/
aiff.c
→
src/tag/
Aiff.cxx
View file @
36f712b9
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
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
;
}
}
src/tag/
aiff.h
→
src/tag/
Aiff.hxx
View file @
36f712b9
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
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_H
XX
#define MPD_AIFF_H
XX
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
...
...
src/tag/
riff.c
→
src/tag/
Riff.cxx
View file @
36f712b9
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
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
;
}
}
src/tag/
riff.h
→
src/tag/
Riff.hxx
View file @
36f712b9
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
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_H
XX
#define MPD_RIFF_H
XX
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
...
...
src/tag/TagId3.cxx
View file @
36f712b9
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment