Browse Source

Fix compilation under MSVC.

git-svn-id: http://svn.drobilla.net/lad/trunk/sratom@4147 a436a847-0d15-0410-975c-d299462d15a1
zrythm_meson
David Robillard 11 years ago
parent
commit
d69e1fb5c8
  1. 9
      src/sratom.c
  2. 6
      wscript

9
src/sratom.c

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -281,7 +282,7 @@ sratom_write(Sratom* sratom, @@ -281,7 +282,7 @@ sratom_write(Sratom* sratom,
} else if (type_urid == sratom->midi_MidiEvent) {
new_node = true;
datatype = serd_node_from_string(SERD_URI, NS_MIDI "MidiEvent");
uint8_t* str = calloc(size * 2 + 1, 1);
uint8_t* str = (uint8_t*)calloc(size * 2 + 1, 1);
for (uint32_t i = 0; i < size; ++i) {
snprintf((char*)str + (2 * i), size * 2 + 1, "%02X",
(unsigned)(uint8_t)*((uint8_t*)body + i));
@ -424,7 +425,9 @@ sratom_to_turtle(Sratom* sratom, @@ -424,7 +425,9 @@ sratom_to_turtle(Sratom* sratom,
SerdWriter* writer = serd_writer_new(
SERD_TURTLE,
SERD_STYLE_ABBREVIATED|SERD_STYLE_RESOLVED|SERD_STYLE_CURIED,
(SerdStyle)(SERD_STYLE_ABBREVIATED |
SERD_STYLE_RESOLVED |
SERD_STYLE_CURIED),
env, &buri, serd_chunk_sink, &str);
// Write @prefix directives
@ -549,7 +552,7 @@ read_node(Sratom* sratom, @@ -549,7 +552,7 @@ read_node(Sratom* sratom,
} else if (language) {
const char* prefix = "http://lexvo.org/id/iso639-3/";
const size_t lang_len = strlen(prefix) + strlen(language);
char* lang_uri = calloc(lang_len + 1, 1);
char* lang_uri = (char*)calloc(lang_len + 1, 1);
snprintf(lang_uri, lang_len + 1, "%s%s", prefix, language);
lv2_atom_forge_literal(
forge, str, len, 0,

6
wscript

@ -81,9 +81,11 @@ def build(bld): @@ -81,9 +81,11 @@ def build(bld):
libflags = [ '-fvisibility=hidden' ]
libs = [ 'm' ]
defines = []
if bld.env['MSVC_COMPILER']:
libflags = []
libs = []
defines = ['snprintf=_snprintf']
# Shared Library
obj = bld(features = 'c cshlib',
@ -95,6 +97,7 @@ def build(bld): @@ -95,6 +97,7 @@ def build(bld):
target = 'sratom-%s' % SRATOM_MAJOR_VERSION,
vnum = SRATOM_LIB_VERSION,
install_path = '${LIBDIR}',
defines = defines,
cflags = libflags + [ '-DSRATOM_SHARED',
'-DSRATOM_INTERNAL' ])
autowaf.use_lib(bld, obj, 'SERD SORD LV2')
@ -110,6 +113,7 @@ def build(bld): @@ -110,6 +113,7 @@ def build(bld):
target = 'sratom-%s' % SRATOM_MAJOR_VERSION,
vnum = SRATOM_LIB_VERSION,
install_path = '${LIBDIR}',
defines = defines,
cflags = ['-DSRATOM_INTERNAL'])
autowaf.use_lib(bld, obj, 'SERD SORD LV2')
@ -128,6 +132,7 @@ def build(bld): @@ -128,6 +132,7 @@ def build(bld):
name = 'libsratom_profiled',
target = 'sratom_profiled',
install_path = '',
defines = defines,
cflags = test_cflags + ['-DSRATOM_INTERNAL'])
autowaf.use_lib(bld, obj, 'SERD SORD LV2')
@ -139,6 +144,7 @@ def build(bld): @@ -139,6 +144,7 @@ def build(bld):
lib = test_libs,
target = 'sratom_test',
install_path = '',
defines = defines,
cflags = test_cflags)
# Documentation

Loading…
Cancel
Save