projects
/
lms
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fb1a259
)
Minor warning cleanups
author
barbieri
<barbieri@gmail.com>
Fri, 1 Feb 2008 14:29:44 +0000
(14:29 +0000)
committer
barbieri
<barbieri@gmail.com>
Fri, 1 Feb 2008 14:29:44 +0000
(14:29 +0000)
lightmediascanner/src/plugins/rm/rm.c
patch
|
blob
|
history
diff --git
a/lightmediascanner/src/plugins/rm/rm.c
b/lightmediascanner/src/plugins/rm/rm.c
index
a39de4c
..
6de6d81
100644
(file)
--- a/
lightmediascanner/src/plugins/rm/rm.c
+++ b/
lightmediascanner/src/plugins/rm/rm.c
@@
-39,6
+39,12
@@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
+#define BE_4BYTE(a) ((((unsigned char*)a)[0] << 24) | \
+ (((unsigned char*)a)[1] << 16) | \
+ (((unsigned char*)a)[2] << 8) | \
+ ((unsigned char*)a)[3])
+#define BE_2BYTE(a) ((((unsigned char*)a)[0] << 8) | ((unsigned char*)a)[1])
+
enum StreamTypes {
STREAM_TYPE_UNKNOWN = 0,
STREAM_TYPE_AUDIO,
enum StreamTypes {
STREAM_TYPE_UNKNOWN = 0,
STREAM_TYPE_AUDIO,
@@
-93,7
+99,7
@@
_parse_file_header(int fd, struct rm_file_header *file_header)
}
/* convert to host byte order */
}
/* convert to host byte order */
- file_header->size = ntohl(file_header->size);
+ file_header->size = BE_4BYTE(&file_header->size);
#if 0
fprintf(stderr, "file_header type=%.*s\n", 4, file_header->type);
#if 0
fprintf(stderr, "file_header type=%.*s\n", 4, file_header->type);
@@
-120,7
+126,7
@@
_read_header_type_and_size(int fd, char *type, uint32_t *size)
if (read(fd, size, 4) != 4)
return -1;
if (read(fd, size, 4) != 4)
return -1;
- *size = ntohl(*size);
+ *size = BE_4BYTE(size);
#if 0
fprintf(stderr, "header type=%.*s\n", 4, type);
#if 0
fprintf(stderr, "header type=%.*s\n", 4, type);
@@
-131,7
+137,7
@@
_read_header_type_and_size(int fd, char *type, uint32_t *size)
}
static int
}
static int
-_read_string(int fd, char **out, int *out_len)
+_read_string(int fd, char **out, unsigned int *out_len)
{
char *s;
uint16_t len;
{
char *s;
uint16_t len;
@@
-139,27
+145,25
@@
_read_string(int fd, char **out, int *out_len)
if (read(fd, &len, 2) == -1)
return -1;
if (read(fd, &len, 2) == -1)
return -1;
- len = ntohs(len);
+ len = BE_2BYTE(&len);
if (out) {
if (len > 0) {
if (out) {
if (len > 0) {
- s = malloc(sizeof(char) * len + 1);
+ s = malloc(sizeof(char) * (len + 1));
if (read(fd, s, len) == -1) {
free(s);
return -1;
}
s[len] = '\0';
*out = s;
if (read(fd, s, len) == -1) {
free(s);
return -1;
}
s[len] = '\0';
*out = s;
- }
- else {
+ } else
*out = NULL;
*out = NULL;
- }
*out_len = len;
*out_len = len;
- }
- else {
+ } else
lseek(fd, len, SEEK_CUR);
lseek(fd, len, SEEK_CUR);
- }
+
+ return 0;
}
/*
}
/*
@@
-176,13
+180,9
@@
_read_string(int fd, char **out, int *out_len)
* word Comment string length
* byte[] Comment string
*/
* word Comment string length
* byte[] Comment string
*/
-static int
+static void
_parse_cont_header(int fd, struct rm_info *info)
{
_parse_cont_header(int fd, struct rm_info *info)
{
- uint16_t version;
- uint16_t title_len;
- char *title;
-
/* Ps.: type and size were already read */
/* ignore version */
/* Ps.: type and size were already read */
/* ignore version */