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
d54df97b
Commit
d54df97b
authored
Aug 07, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite getId3Tag so we can get rid of this silly ID3_TAG_BUFLEN crap
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4594
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
5f1e53e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
tag.c
src/tag.c
+21
-28
No files found.
src/tag.c
View file @
d54df97b
...
@@ -44,9 +44,6 @@
...
@@ -44,9 +44,6 @@
#ifdef HAVE_ID3TAG
#ifdef HAVE_ID3TAG
# define isId3v1(tag) (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1)
# define isId3v1(tag) (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1)
/* Size of the buffer to use for peeking at tag headers. We reuse this buffer
if the whole tag fits in it, so make it big to avoid a malloc(). */
# define ID3_TAG_BUFLEN 1024
# ifndef ID3_FRAME_COMPOSER
# ifndef ID3_FRAME_COMPOSER
# define ID3_FRAME_COMPOSER "TCOM"
# define ID3_FRAME_COMPOSER "TCOM"
# endif
# endif
...
@@ -232,39 +229,35 @@ static int getId3v2FooterSize(FILE * stream, long offset, int whence)
...
@@ -232,39 +229,35 @@ static int getId3v2FooterSize(FILE * stream, long offset, int whence)
static
struct
id3_tag
*
getId3Tag
(
FILE
*
stream
,
long
offset
,
int
whence
)
static
struct
id3_tag
*
getId3Tag
(
FILE
*
stream
,
long
offset
,
int
whence
)
{
{
struct
id3_tag
*
tag
;
struct
id3_tag
*
tag
;
id3_byte_t
buf
[
ID3_TAG_BUFLEN
];
id3_byte_t
queryBuf
[
ID3_TAG_QUERYSIZE
];
id3_byte_t
*
mb
uf
;
id3_byte_t
*
tagB
uf
;
int
tag
s
ize
;
int
tag
S
ize
;
int
bufs
ize
;
int
queryBufS
ize
;
int
mbufs
ize
;
int
tagBufS
ize
;
/* It's ok if we get less than we asked for */
/* It's ok if we get less than we asked for */
bufsize
=
fillBuffer
(
buf
,
ID3_TAG_BUFLEN
,
stream
,
offset
,
whence
);
queryBufSize
=
fillBuffer
(
queryBuf
,
ID3_TAG_QUERYSIZE
,
if
(
bufsize
<=
0
)
return
NULL
;
stream
,
offset
,
whence
);
if
(
queryBufSize
<=
0
)
return
NULL
;
/* Look for a tag header */
/* Look for a tag header */
tagsize
=
id3_tag_query
(
buf
,
bufsize
);
tagSize
=
id3_tag_query
(
queryBuf
,
queryBufSize
);
if
(
tagsize
<=
0
)
return
NULL
;
if
(
tagSize
<=
0
)
return
NULL
;
if
(
tagsize
<=
bufsize
)
{
/* Got an id3 tag, and it fits in buf */
tag
=
id3_tag_parse
(
buf
,
tagsize
);
}
else
{
/* Got an id3tag that overflows buf, so get a new one */
mbuf
=
malloc
(
tagsize
);
if
(
!
mbuf
)
return
NULL
;
mbufsize
=
fillBuffer
(
mbuf
,
tagsize
,
stream
,
offset
,
whence
);
if
(
mbufsize
<
tagsize
)
{
free
(
mbuf
);
return
NULL
;
}
tag
=
id3_tag_parse
(
mbuf
,
tagsize
);
/* Found a tag. Allocate a buffer and read it in. */
tagBuf
=
malloc
(
tagSize
);
if
(
!
tagBuf
)
return
NULL
;
free
(
mbuf
);
tagBufSize
=
fillBuffer
(
tagBuf
,
tagSize
,
stream
,
offset
,
whence
);
if
(
tagBufSize
<
tagSize
)
{
free
(
tagBuf
);
return
NULL
;
}
}
tag
=
id3_tag_parse
(
tagBuf
,
tagBufSize
);
free
(
tagBuf
);
return
tag
;
return
tag
;
}
}
#endif
#endif
...
...
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