summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 21:52:34 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 22:11:09 +0200
commit5362a9a94faf18975234cab5d02df5f4be225213 (patch)
treed5c9e2c5fcbf8d0fa200924ff67c3e9c83a3a082
parentd9c7482d26d17fade0dce358dd52c6891588f110 (diff)
oggedit: osx compile fixes
-rw-r--r--plugins/liboggedit/oggedit_flac.c12
-rw-r--r--plugins/liboggedit/oggedit_internal.c7
-rw-r--r--plugins/liboggedit/oggedit_opus.c7
-rw-r--r--plugins/liboggedit/oggedit_utils.c10
-rw-r--r--plugins/liboggedit/oggedit_vorbis.c10
5 files changed, 33 insertions, 13 deletions
diff --git a/plugins/liboggedit/oggedit_flac.c b/plugins/liboggedit/oggedit_flac.c
index c2dca22b..fd3a71a6 100644
--- a/plugins/liboggedit/oggedit_flac.c
+++ b/plugins/liboggedit/oggedit_flac.c
@@ -32,6 +32,9 @@
#include <unistd.h>
#include <stdbool.h>
#include <ogg/ogg.h>
+#if HAVE_SYS_SYSLIMITS_H
+#include <sys/syslimits.h>
+#endif
#include "../../deadbeef.h"
#include "oggedit_internal.h"
#include "oggedit.h"
@@ -86,7 +89,7 @@ static ogg_packet **metadata_block_packets(DB_FILE *in, ogg_sync_state *oy, cons
if (!headers)
*res = OGGEDIT_ALLOCATION_FAILURE;
- else if (!packets || headers[0]->packet[0] & 0x3F != VCTYPE)
+ else if (!packets || (headers[0]->packet[0] & 0x3F) != VCTYPE)
*res = OGGEDIT_CANNOT_PARSE_HEADERS;
else
*res = pages;
@@ -158,9 +161,12 @@ off_t oggedit_write_flac_metadata(DB_FILE *in, const char *fname, const off_t of
const off_t stream_size_k = in->vfs->getlength(in) / 1000; // use file size for now
const size_t metadata_size = 4 + vc_size(vendor, num_tags, tags);
ptrdiff_t padding = headers[0]->bytes - metadata_size;
- if (stream_size_k < 1000 || padding < 0 || headers[1] && padding > 0 || padding > stream_size_k+metadata_size)
- if (res = open_temp_file(fname, tempname, &out))
+ if (stream_size_k < 1000 || padding < 0 || (headers[1] && padding > 0) || padding > stream_size_k+metadata_size) {
+ res = open_temp_file(fname, tempname, &out);
+ if (res) {
goto cleanup;
+ }
+ }
/* Re-pad if writing the whole file */
if (*tempname) {
diff --git a/plugins/liboggedit/oggedit_internal.c b/plugins/liboggedit/oggedit_internal.c
index 29c9aa6d..f12e8d6d 100644
--- a/plugins/liboggedit/oggedit_internal.c
+++ b/plugins/liboggedit/oggedit_internal.c
@@ -36,6 +36,9 @@
#include <errno.h>
#include <sys/stat.h>
#include <ogg/ogg.h>
+#if HAVE_SYS_SYSLIMITS_H
+#include <sys/syslimits.h>
+#endif
#include "../../deadbeef.h"
#include "oggedit.h"
#include "oggedit_internal.h"
@@ -433,8 +436,10 @@ ogg_packet *fill_vc_packet(const char *magic, const size_t magic_length, const c
if (op) {
memset(op, '\0', sizeof(*op));
op->bytes = oggpack_bytes(&opb);
- if (op->packet = malloc(op->bytes))
+ op->packet = malloc(op->bytes);
+ if (op->packet) {
memcpy(op->packet, oggpack_get_buffer(&opb), op->bytes);
+ }
}
oggpack_writeclear(&opb);
diff --git a/plugins/liboggedit/oggedit_opus.c b/plugins/liboggedit/oggedit_opus.c
index fc12cf3d..5d167094 100644
--- a/plugins/liboggedit/oggedit_opus.c
+++ b/plugins/liboggedit/oggedit_opus.c
@@ -141,9 +141,12 @@ off_t oggedit_write_opus_metadata(DB_FILE *in, const char *fname, const off_t of
ptrdiff_t padding = tags_packet_size - metadata_size;
const off_t file_size_k = in->vfs->getlength(in) / 1000;
const size_t stream_size_k = stream_size ? stream_size / 1000 : file_size_k;
- if (file_size_k < 100 || padding < 0 || padding > file_size_k/10+stream_size_k+metadata_size)
- if (res = open_temp_file(fname, tempname, &out))
+ if (file_size_k < 100 || padding < 0 || padding > file_size_k/10+stream_size_k+metadata_size) {
+ res = open_temp_file(fname, tempname, &out);
+ if (res) {
goto cleanup;
+ }
+ }
/* Re-pad if writing the whole file */
if (*tempname)
diff --git a/plugins/liboggedit/oggedit_utils.c b/plugins/liboggedit/oggedit_utils.c
index 03e753a8..2d40e275 100644
--- a/plugins/liboggedit/oggedit_utils.c
+++ b/plugins/liboggedit/oggedit_utils.c
@@ -41,15 +41,15 @@ uint8_t *oggedit_vorbis_channel_map(const int channel_count)
return NULL;
switch(channel_count) {
case 3:
- return memcpy(map, &(uint8_t[]){0,2,1}, map_size);
+ return memcpy(map, &((uint8_t[]){0,2,1}), map_size);
case 5:
- return memcpy(map, &(uint8_t[]){0,2,1,3,4}, map_size);
+ return memcpy(map, &((uint8_t[]){0,2,1,3,4}), map_size);
case 6:
- return memcpy(map, &(uint8_t[]){0,2,1,4,5,3}, map_size);
+ return memcpy(map, &((uint8_t[]){0,2,1,4,5,3}), map_size);
case 7:
- return memcpy(map, &(uint8_t[]){0,2,1,4,5,6,3}, map_size);
+ return memcpy(map, &((uint8_t[]){0,2,1,4,5,6,3}), map_size);
case 8:
- return memcpy(map, &(uint8_t[]){0,2,1,6,7,4,5,3}, map_size);
+ return memcpy(map, &((uint8_t[]){0,2,1,6,7,4,5,3}), map_size);
default:
free(map);
return NULL;
diff --git a/plugins/liboggedit/oggedit_vorbis.c b/plugins/liboggedit/oggedit_vorbis.c
index ba2b4e07..499c88b0 100644
--- a/plugins/liboggedit/oggedit_vorbis.c
+++ b/plugins/liboggedit/oggedit_vorbis.c
@@ -32,6 +32,9 @@
#include <unistd.h>
#include <stdbool.h>
#include <ogg/ogg.h>
+#if HAVE_SYS_SYSLIMITS_H
+#include <sys/syslimits.h>
+#endif
#include "../../deadbeef.h"
#include "oggedit_internal.h"
#include "oggedit.h"
@@ -124,9 +127,12 @@ off_t oggedit_write_vorbis_metadata(DB_FILE *in, const char *fname, const off_t
ptrdiff_t padding = tags_packet_size - metadata_size;
const off_t file_size_k = in->vfs->getlength(in) / 1000;
const size_t stream_size_k = stream_size ? stream_size / 1000 : file_size_k;
- if (file_size_k < 100 || padding < 0 || padding > file_size_k/10+stream_size_k+metadata_size)
- if (res = open_temp_file(fname, tempname, &out))
+ if (file_size_k < 100 || padding < 0 || padding > file_size_k/10+stream_size_k+metadata_size) {
+ res = open_temp_file (fname, tempname, &out);
+ if (res) {
goto cleanup;
+ }
+ }
/* Re-pad if writing the whole file */
if (*tempname)