aboutsummaryrefslogtreecommitdiffstats
path: root/src/serd_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-16 18:21:53 +0000
committerDavid Robillard <d@drobilla.net>2012-01-16 18:21:53 +0000
commit2d724f0e199f74201307cc161031afbd8dba4eb5 (patch)
treeb6db75dbfa6e3d29823d64b9207232e61cfcc070 /src/serd_internal.h
parent80a8bad6790dd510577d0922287b8a3f60d89252 (diff)
downloadserd-2d724f0e199f74201307cc161031afbd8dba4eb5.tar.gz
serd-2d724f0e199f74201307cc161031afbd8dba4eb5.tar.bz2
serd-2d724f0e199f74201307cc161031afbd8dba4eb5.zip
Support compilation as C++ under MSVC++
git-svn-id: http://svn.drobilla.net/serd/trunk@291 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r--src/serd_internal.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h
index ae5669a9..ba6b5d98 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -38,6 +38,14 @@
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
+#ifndef fmax
+static inline float
+fmax(float a, float b)
+{
+ return (a < b) ? b : a;
+}
+#endif
+
/* File and Buffer Utilities */
static inline FILE*
@@ -82,7 +90,7 @@ static inline SerdStack
serd_stack_new(size_t size)
{
SerdStack stack;
- stack.buf = malloc(size);
+ stack.buf = (uint8_t*)malloc(size);
stack.buf_size = size;
stack.size = SERD_STACK_BOTTOM;
return stack;
@@ -109,7 +117,7 @@ serd_stack_push(SerdStack* stack, size_t n_bytes)
const size_t new_size = stack->size + n_bytes;
if (stack->buf_size < new_size) {
stack->buf_size *= 2;
- stack->buf = realloc(stack->buf, stack->buf_size);
+ stack->buf = (uint8_t*)realloc(stack->buf, stack->buf_size);
}
uint8_t* const ret = (stack->buf + stack->size);
stack->size = new_size;
@@ -141,7 +149,7 @@ serd_bulk_sink_new(SerdSink sink, void* stream, size_t block_size)
bsink.stream = stream;
bsink.size = 0;
bsink.block_size = block_size;
- bsink.buf = serd_bufalloc(block_size);
+ bsink.buf = (uint8_t*)serd_bufalloc(block_size);
return bsink;
}