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
35710a81
Commit
35710a81
authored
Nov 01, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: use GUINT32_FROM_LE() instead of readLEuint32()
Eliminate code already provided by GLib.
parent
b9961086
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
17 deletions
+8
-17
tag.c
src/tag.c
+8
-8
utils.c
src/utils.c
+0
-7
utils.h
src/utils.h
+0
-2
No files found.
src/tag.c
View file @
35710a81
...
...
@@ -125,9 +125,9 @@ struct tag *tag_ape_load(const char *file)
struct
{
unsigned
char
id
[
8
];
u
nsigned
char
version
[
4
]
;
u
nsigned
char
length
[
4
]
;
u
nsigned
char
tagCount
[
4
]
;
u
int32_t
version
;
u
int32_t
length
;
u
int32_t
tagCount
;
unsigned
char
flags
[
4
];
unsigned
char
reserved
[
8
];
}
footer
;
...
...
@@ -166,11 +166,11 @@ struct tag *tag_ape_load(const char *file)
goto
fail
;
if
(
memcmp
(
footer
.
id
,
"APETAGEX"
,
sizeof
(
footer
.
id
))
!=
0
)
goto
fail
;
if
(
readLEuint32
(
footer
.
version
)
!=
2000
)
if
(
GUINT32_FROM_LE
(
footer
.
version
)
!=
2000
)
goto
fail
;
/* find beginning of ape tag */
tagLen
=
readLEuint32
(
footer
.
length
);
tagLen
=
GUINT32_FROM_LE
(
footer
.
length
);
if
(
tagLen
<
sizeof
(
footer
))
goto
fail
;
if
(
fseek
(
fp
,
size
-
tagLen
,
SEEK_SET
))
...
...
@@ -185,13 +185,13 @@ struct tag *tag_ape_load(const char *file)
goto
fail
;
/* read tags */
tagCount
=
readLEuint32
(
footer
.
tagCount
);
tagCount
=
GUINT32_FROM_LE
(
footer
.
tagCount
);
p
=
buffer
;
while
(
tagCount
--
&&
tagLen
>
10
)
{
size
=
readLEuint32
((
unsigned
char
*
)
p
);
size
=
GUINT32_FROM_LE
(
*
(
const
uint32_t
*
)
p
);
p
+=
4
;
tagLen
-=
4
;
flags
=
readLEuint32
((
unsigned
char
*
)
p
);
flags
=
GUINT32_FROM_LE
(
*
(
const
uint32_t
*
)
p
);
p
+=
4
;
tagLen
-=
4
;
...
...
src/utils.c
View file @
35710a81
...
...
@@ -75,13 +75,6 @@ int ipv6Supported(void)
#endif
}
unsigned
long
readLEuint32
(
const
unsigned
char
*
p
)
{
return
((
unsigned
long
)
p
[
0
]
<<
0
)
|
((
unsigned
long
)
p
[
1
]
<<
8
)
|
((
unsigned
long
)
p
[
2
]
<<
16
)
|
((
unsigned
long
)
p
[
3
]
<<
24
);
}
mpd_malloc
char
*
xstrdup
(
const
char
*
s
)
{
char
*
ret
=
strdup
(
s
);
...
...
src/utils.h
View file @
35710a81
...
...
@@ -37,8 +37,6 @@ void my_usleep(long usec);
int
ipv6Supported
(
void
);
unsigned
long
readLEuint32
(
const
unsigned
char
*
p
);
/* trivial functions, keep them inlined */
static
inline
void
xclose
(
int
fd
)
{
...
...
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