Commit 82a00eef authored by Hanspeter Portner's avatar Hanspeter Portner

Merge commit '49528065'

parents e44fa7b0 49528065
Pipeline #17365688 passed with stages
in 17 minutes and 27 seconds
cmake_minimum_required(VERSION 2.8)
project(osc.lv2)
include_directories(${PROJECT_SOURCE_DIR})
set(CMAKE_C_FLAGS "-std=gnu11 -Wextra -Wno-unused-parameter -ffast-math -fvisibility=hidden ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")
include(CTest)
if(${BUILD_TESTING})
add_executable(osc_test
osc_test.c)
add_test(NAME API-Test COMMAND osc_test)
endif()
......@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <string.h>
#include <stdarg.h>
#include <osc.lv2/osc.h>
#include <osc.lv2/endian.h>
......
This diff is collapsed.
......@@ -332,9 +332,11 @@ lv2_osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args
return false;
break;
case LV2_OSC_BLOB:
if(!lv2_osc_writer_add_blob(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
{
const int32_t len = va_arg(args, int32_t);
if(!lv2_osc_writer_add_blob(writer, len, va_arg(args, const uint8_t *)))
return false;
break;
} break;
case LV2_OSC_TRUE:
case LV2_OSC_FALSE:
......@@ -356,9 +358,11 @@ lv2_osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args
break;
case LV2_OSC_MIDI:
if(!lv2_osc_writer_add_midi(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
{
const int32_t len = va_arg(args, int32_t);
if(!lv2_osc_writer_add_midi(writer, len, va_arg(args, const uint8_t *)))
return false;
break;
} break;
case LV2_OSC_SYMBOL:
if(!lv2_osc_writer_add_symbol(writer, va_arg(args, const char *)))
return false;
......@@ -368,10 +372,14 @@ lv2_osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args
return false;
break;
case LV2_OSC_RGBA:
if(!lv2_osc_writer_add_rgba(writer, va_arg(args, unsigned), va_arg(args, unsigned),
va_arg(args, unsigned), va_arg(args, unsigned)))
{
const uint8_t r = va_arg(args, unsigned);
const uint8_t g = va_arg(args, unsigned);
const uint8_t b = va_arg(args, unsigned);
const uint8_t a = va_arg(args, unsigned);
if(!lv2_osc_writer_add_rgba(writer, r, g, b, a))
return false;
break;
} break;
}
}
......@@ -529,17 +537,25 @@ lv2_osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
m[0] = 0x0; // port
memcpy(&m[1], LV2_ATOM_BODY_CONST(atom), atom->size);
}
else if(atom->type == osc_urid->OSC_Char)
else if(atom->type == osc_urid->ATOM_Literal)
{
const char c = *(const char *)LV2_ATOM_BODY_CONST(atom);
if(!lv2_osc_writer_add_char(writer, c))
return false;
}
else if(atom->type == osc_urid->OSC_RGBA)
{
const uint8_t *rgba = LV2_ATOM_BODY_CONST(atom);
if(!lv2_osc_writer_add_rgba(writer, rgba[0], rgba[1], rgba[2], rgba[3]))
return false;
const LV2_Atom_Literal *lit = (LV2_Atom_Literal *)atom;
if(lit->body.datatype == osc_urid->OSC_Char)
{
const char c = *(const char *)LV2_ATOM_CONTENTS_CONST(LV2_Atom_Literal, lit);
if(!lv2_osc_writer_add_char(writer, c))
return false;
}
else if(lit->body.datatype == osc_urid->OSC_RGBA)
{
const char *rgba = LV2_ATOM_CONTENTS_CONST(LV2_Atom_Literal, atom);
uint8_t r, g, b, a;
if(sscanf(rgba, "%02"SCNx8"%02"SCNx8"%02"SCNx8"%02"SCNx8, &r, &g, &b, &a) != 4)
return false;
if(!lv2_osc_writer_add_rgba(writer, r, g, b, a))
return false;
}
}
}
}
......
CC ?= gcc
#C_FLAGS ?= -I../ -Wall -Wextra -Wpedantic $(shell pkg-config --cflags lv2) \
# -fprofile-arcs -ftest-coverage
C_FLAGS ?= -I../ $(shell pkg-config --cflags lv2) \
-fprofile-arcs -ftest-coverage
all: osc_test
osc_test: osc_test.c ../osc.lv2/*.h
$(CC) -std=gnu11 -g -o $@ $< $(C_FLAGS) -lpthread
./$@
gcov $<
clean:
rm -f osc_test *.gcov *.gc* vgcore.*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment