diff -Nru liblo-0.29/AUTHORS liblo-0.30/AUTHORS --- liblo-0.29/AUTHORS 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/AUTHORS 2019-03-03 20:47:29.000000000 +0000 @@ -8,7 +8,6 @@ Chris Hixon Kentaro Fukuchi Dave Robillard -Nicolas Humfrey Stephen Sinclair Dominic Sacré Alex McLean @@ -19,6 +18,10 @@ Patric Schmitz Felix Homann Stephen Kyne +Shawn Hovoer +Yann E. Morin +Fabrice Fontaine +Ingo Koinzer Guidelines for authors: diff -Nru liblo-0.29/build/config-msvc.h liblo-0.30/build/config-msvc.h --- liblo-0.29/build/config-msvc.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/build/config-msvc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define this to enable ipv6. */ -/* #undef ENABLE_IPV6 */ - -/* Define this to enable network tests. */ -#define ENABLE_NETWORK_TESTS 1 - -/* Define this to enable threads. */ -@DEFTHREADS@#define ENABLE_THREADS 1 - -/* Define this to use pthreads for threading. */ -@DEFTHREADS@#define HAVE_LIBPTHREADS 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if inet_aton() is available. */ -/* #undef HAVE_INET_ATON */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -@DEFTHREADS@#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_IN_H */ - -/* Define to 1 if poll() is available. */ -/* #undef HAVE_POLL */ - -/* Define to 1 if select() is available. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #define HAVE_UNISTD_H 1 */ - -/* If machine is bigendian */ -#define LO_BIGENDIAN "0" - -/* Libtool compatibility version */ -#define LO_SO_VERSION @LO_SO_VERSION@ - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "liblo" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "liblo-devel@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "liblo" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "liblo " /*VERSION*/ - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "liblo" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION /*VERSION*/ - -/* printf code for type long long int */ -#define PRINTF_LL "ll" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION /*VERSION*/ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff -Nru liblo-0.29/build/lo_endian-msvc.h liblo-0.30/build/lo_endian-msvc.h --- liblo-0.29/build/lo_endian-msvc.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/build/lo_endian-msvc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2014 Steve Harris et al. (see AUTHORS) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * $Id$ - */ - -#ifndef LO_ENDIAN_H -#define LO_ENDIAN_H - -#include - -#ifdef _MSC_VER -#define inline __inline -#define uint64_t unsigned __int64 -#define uint32_t unsigned __int32 -#else -#include -#endif - -#ifdef WIN32 -#include -#include -#else -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define lo_swap16(x) htons(x) - -#define lo_swap32(x) htonl(x) - -/* These macros come from the Linux kernel */ - -#ifndef lo_swap16 -#define lo_swap16(x) \ -({ \ - uint16_t __x = (x); \ - ((uint16_t)( \ - (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ - (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ -}) -#warning USING UNOPTIMISED ENDIAN STUFF -#endif - -#ifndef lo_swap32 -#define lo_swap32(x) \ -({ \ - uint32_t __x = (x); \ - ((uint32_t)( \ - (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ - (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ - (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ - (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ -}) -#endif - -#if 0 -#ifndef lo_swap64 -#define lo_swap64(x) \ -({ \ - uint64_t __x = (x); \ - ((uint64_t)( \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ -}) -#endif -#else - -typedef union { - uint64_t all; - struct { - uint32_t a; - uint32_t b; - } part; -} lo_split64; - -static inline uint64_t lo_swap64(uint64_t x) -{ - lo_split64 in, out; - - in.all = x; - out.part.a = lo_swap32(in.part.b); - out.part.b = lo_swap32(in.part.a); - - return out.all; -} -#endif - -/* Host to OSC and OSC to Host conversion macros */ - -#if 0 -#define lo_htoo16(x) (x) -#define lo_htoo32(x) (x) -#define lo_htoo64(x) (x) -#define lo_otoh16(x) (x) -#define lo_otoh32(x) (x) -#define lo_otoh64(x) (x) -#else -#define lo_htoo16 lo_swap16 -#define lo_htoo32 lo_swap32 -#define lo_htoo64 lo_swap64 -#define lo_otoh16 lo_swap16 -#define lo_otoh32 lo_swap32 -#define lo_otoh64 lo_swap64 -#endif - -#ifdef __cplusplus -} -#endif - -#ifdef _MSC_VER -#undef inline -#undef uint64_t -#undef uint32_t -#endif - -#endif - -/* vi:set ts=8 sts=4 sw=4: */ diff -Nru liblo-0.29/build/Makefile.am liblo-0.30/build/Makefile.am --- liblo-0.29/build/Makefile.am 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/build/Makefile.am 2019-03-03 20:47:29.000000000 +0000 @@ -1,5 +1,4 @@ MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = config-msvc.h lo_endian-msvc.h premake4.lua \ - android_build.sh README.md +EXTRA_DIST = android_build.sh README.md diff -Nru liblo-0.29/build/premake4.lua liblo-0.30/build/premake4.lua --- liblo-0.29/build/premake4.lua 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/build/premake4.lua 1970-01-01 00:00:00.000000000 +0000 @@ -1,290 +0,0 @@ ----------------------------------------------------------------------- --- Premake4 configuration script for LibLo --- Adapted from ODE's build script by Jason Perkins. --- For more information on Premake: http://industriousone.com/premake ----------------------------------------------------------------------- - ----------------------------------------------------------------------- --- Configuration options ----------------------------------------------------------------------- - - -- always clean all of the optional components and toolsets - if _ACTION == "clean" then - for action in pairs(premake.actions) do - os.rmdir(action) - end - end - - - ----------------------------------------------------------------------- --- The solution, and solution-wide settings ----------------------------------------------------------------------- - - solution "liblo" - - language "C" - location ( _OPTIONS["to"] or _ACTION ) - - newoption { - trigger = "without-threads", - description = "Disable lo_server_thread functions, no need for pthread." -} - - newoption { - trigger = "pthreads", - description = "Specify the location of the pthreads-w32 library." - } - - includedirs { - "../lo", - "../src" - } - - -- define all the possible build configurations - configurations { - "DebugDLL", "ReleaseDLL", - "DebugLib", "ReleaseLib", - } - - configuration { "Debug*" } - defines { "_DEBUG" } - flags { "Symbols" } - - configuration { "Release*" } - flags { "OptimizeSpeed", "NoFramePointer" } - - configuration { "Windows" } - defines { "WIN32" } - - -- give each configuration a unique output directory - for _, name in ipairs(configurations()) do - configuration { name } - targetdir ( "../lib/" .. name ) - end - - -- disable Visual Studio security warnings - configuration { "vs*" } - defines { "_CRT_SECURE_NO_DEPRECATE" } - - -- tell source to use config.h - configuration { "vs*" } - defines { "HAVE_CONFIG_H" } - - -- don't remember why we had to do this (from ODE) - configuration { "vs2002 or vs2003", "*Lib" } - flags { "StaticRuntime" } - ----------------------------------------------------------------------- --- Write a custom to .., based on the supplied flags ----------------------------------------------------------------------- - --- First get the version number from "configure.ac" -- - - io.input("../configure.ac") - text = io.read("*all") - io.close() - - version = string.match(text, "AC_INIT%(%[liblo%],%[(%d+%.%d+%w+)%]") - - ltcurrent = string.match(text, "m4_define%(%[lt_current%], (%d+)") - ltrev = string.match(text, "m4_define%(%[lt_revision%], (%d+)") - ltage = string.match(text, "m4_define%(%[lt_age%], (%d+)") - - ltversion = '{' .. ltcurrent .. ', ' .. ltrev .. ', ' .. ltage .. '}' - --- Replace it in "config.h" -- - - io.input("config-msvc.h") - local text = io.read("*all") - - text = string.gsub(text, '/%*VERSION%*/', '"'..version..'"') - - if _OPTIONS["without-threads"] then - text = string.gsub(text, '@DEFTHREADS@', '// ') - else - text = string.gsub(text, '@DEFTHREADS@', '') - end - - text = string.gsub(text, '@LO_SO_VERSION@', ltversion) - - io.output("../config.h") - io.write(text) - io.close() - ----------------------------------------------------------------------- --- Write a custom to ../src/ ----------------------------------------------------------------------- - - io.input("../src/liblo.def.in") - local text = io.read("*all") - - if _OPTIONS["without-threads"] then - text = string.gsub(text, '@DEFTHREADS@', ';;') - else - text = string.gsub(text, '@DEFTHREADS@', '') - end - - text = string.gsub(text, ' @DLL_NAME@', '') - - io.output("../src/liblo.def") - io.write(text) - io.close() - ----------------------------------------------------------------------- --- Write a custom to ../lo/ ----------------------------------------------------------------------- - - io.input("../lo/lo.h.in") - local text = io.read("*all") - - threads_enabler='#include "lo/lo_serverthread.h"' - threads_disabler='/* lo/lo_serverthread.h unavailable (--without-threads) */' - if _OPTIONS["without-threads"] then - text = string.gsub(text, '@THREADS_INCLUDE@', threads_disabler) - else - text = string.gsub(text, '@THREADS_INCLUDE@', threads_enabler) - end - - io.output("../lo/lo.h") - io.write(text) - io.close() - ----------------------------------------------------------------------- --- Copy to ../lo ----------------------------------------------------------------------- - - io.input("lo_endian-msvc.h") - io.output("../lo/lo_endian.h") - local text = io.read("*all") - io.write(text) - io.close() - ----------------------------------------------------------------------- --- The LibLo library project ----------------------------------------------------------------------- - - project "liblo" - - kind "StaticLib" - location ( _OPTIONS["to"] or _ACTION ) - - includedirs { - "..", - } - - files { - "../src/*.c", - "../src/*.h", - "../lo/*.h", - "../src/liblo.def", - } - - excludes { - "../src/testlo.c", - "../src/subtest.c", - "../src/test_bidirectional_tcp.c", - "../src/tools", - } - - configuration { "windows" } - links { "user32", - "wsock32", - "ws2_32", - "iphlpapi", - } - - configuration { "without-threads" } - excludes { "../src/server_thread.c" } - - configuration { "not without-threads" } - links { "pthreadVC2" } - if (_OPTIONS["pthreads"]) then - includedirs { _OPTIONS["pthreads"] } - end - - configuration { "*Lib" } - kind "StaticLib" - defines "LIBLO_LIB" - - configuration { "*DLL" } - kind "SharedLib" - defines "LIBLO_DLL" - - configuration { "Debug*" } - targetname "liblo_d" - - configuration { "Release*" } - targetname "liblo" - - ----------------------------------------------------------------------- --- The automated test application ----------------------------------------------------------------------- - - - project "testlo" - - kind "ConsoleApp" - location ( _OPTIONS["to"] or _ACTION ) - links { "user32", - "wsock32", - "ws2_32", - "iphlpapi", - "pthreadVC2", - } - - includedirs { - "..", - } - - files { - "../src/testlo.c", - } - - configuration { "DebugDLL" } - links { "liblo_d" } - libdirs { "../lib/debugdll" } - - configuration { "DebugLib" } - links { "liblo_d" } - libdirs { "../lib/debuglib" } - - configuration { "Release*" } - links { "liblo" } - - configuration { "not without-threads" } - links { "pthreadVC2" } - if (_OPTIONS["pthreads"]) then - includedirs { _OPTIONS["pthreads"] } - end - - project "subtest" - - kind "ConsoleApp" - location ( _OPTIONS["to"] or _ACTION ) - links { "user32", - "wsock32", - "ws2_32", - "iphlpapi", - "pthreadVC2", - } - - includedirs { - "..", - } - - files { - "../src/subtest.c", - } - - configuration { "DebugDLL" } - links { "liblo_d" } - libdirs { "../lib/debugdll" } - - configuration { "DebugLib" } - links { "liblo_d" } - libdirs { "../lib/debuglib" } - - configuration { "Release*" } - links { "liblo" } diff -Nru liblo-0.29/build/README.md liblo-0.30/build/README.md --- liblo-0.29/build/README.md 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/build/README.md 2019-03-03 20:47:29.000000000 +0000 @@ -10,40 +10,32 @@ ------------------------------------------ Some Windows users prefer to use Microsoft Visual Studio to the -well-supported MSYS/MingW or Cygwin environments. +well-supported MSYS2 environment. For them, an alternative configuration system is supported by liblo -using the excellent `premake4` utility. -The `build` folder contains a file called `premake4.lua`. -It must be accompanied by `premake4.exe`, which can be downloaded -from: - - http://industriousone.com/premake/download - -Once `premake4.exe` is copied to the `build` directory, open a -`cmd.exe` prompt and `cd` to the `build` directory. -Then, run `premake4` with arguments specifying the version of -Microsoft Visual Studio you wish to use. -For example, for MSVS 2010: - - > premake4 vs2010 - -You may provide the `--without-threads` option if you wish to exclude -support for liblo's `lo_server_thread` API, which can be helpful if you -have not downloaded the Win32 port of `pthread`. -This can be found at, - - http://sourceware.org/pthreads-win32/ - -You should specify the location of this library using the `--pthreads` -option to premake4, e.g.: - - > premake4 --pthreads=C:/Libraries/pthreads-w32-2-9-1-release vs2010 - -Unfortunately liblo does not yet support the Win32 thread API, so -pthreads-w32 is required for lo_server_thread functionality. Note that -test programs (`subtest.exe`, `testlo.exe`) will not be built without -threading enabled. +using the excellent `CMake` utility. +The `cmake` folder contains a file called `CMakeLists.txt`. +To use it, you must first install CMake either through your favorite +package manager (such as MSYS2's pacman, or Chocolatey, NuGet, etc), +or by going to, + + http://cmake.org + +Once CMake has been installed, you can run it as a GUI program, or run +it from the command-line specifying the "generator" as your version of +Visual Studio, and adding `Win64` if you want a 64-bit build. Note +that you must run it from the `cmake` folder, NOT the project's main +directory: + + > cd liblo\cmake + > C:\\cmake.exe -G "Visual Studio 15 2017 Win64" + +You can specify some options such as enable/disalbing the C++ tests, +examples, tests, static library build, and command-line tools. You +can also choose to enable or disable the `lo_server_thread` interface +via the `THREADING` option. On Windows, the Win32 threading API is +used, therefore there is no longer a need to install the `pthreads` +library on Windows. Building liblo for Android -------------------------- diff -Nru liblo-0.29/cmake/CMakeLists.txt liblo-0.30/cmake/CMakeLists.txt --- liblo-0.29/cmake/CMakeLists.txt 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/cmake/CMakeLists.txt 2019-03-03 20:47:29.000000000 +0000 @@ -1,5 +1,16 @@ cmake_minimum_required(VERSION 3.0) +option(WITH_TOOLS "Enable building tools." ON) +option(WITH_TESTS "Enable building tests." ON) +option(WITH_EXAMPLES "Enable building examples." ON) +option(WITH_CPP_TESTS "Enable building C++ wrapper tests." ON) +option(WITH_STATIC "Enable building static library." OFF) +option(THREADING "Build with threading support." ON) + +if (WITH_STATIC) + message(STATUS "If you are using the static library build, please keep in mind (and inform yourself of the implications) that liblo is licensed with LGPL v2.1+.") +endif() + include(CheckIncludeFiles) include(CheckSymbolExists) include(CheckLibraryExists) @@ -8,29 +19,74 @@ set(PROJECT liblo) set(PACKAGE_NAME "${PROJECT}") -project(${PROJECT} LANGUAGES C CXX) +if (WITH_CPP_TESTS) + project(${PROJECT} LANGUAGES C CXX) +else() + project(${PROJECT} LANGUAGES C) +endif() if(NOT CMAKE_VERSION VERSION_LESS 3.1.0) set_property(TARGET ${LIBRARY} PROPERTY C_STANDARD 11) - set_property(TARGET ${LIBRARY} PROPERTY CXX_STANDARD 11) + if (WITH_CPP_TESTS) + set_property(TARGET ${LIBRARY} PROPERTY CXX_STANDARD 11) + endif() endif() set(CMAKE_VERBOSE_MAKEFILE OFF) +if (MSVC) + add_definitions( + /D_CRT_SECURE_NO_WARNINGS + /D_CRT_SECURE_NO_DEPRECATE + /D_CRT_NONSTDC_NO_DEPRECATE + /D_WINSOCK_DEPRECATED_NO_WARNINGS) + + # On Windows we do not wish the default behaviour of removing "lib" + # from "liblo.dll". + if ("${CMAKE_SHARED_LIBRARY_PREFIX}" STREQUAL "") + set(CMAKE_SHARED_LIBRARY_PREFIX "lib") + endif() + if ("${CMAKE_STATIC_LIBRARY_PREFIX}" STREQUAL "") + set(CMAKE_STATIC_LIBRARY_PREFIX "lib") + endif() + + # For Visual Studio, ensure import lib can be distinguished from + # static lib + if ("${CMAKE_IMPORT_LIBRARY_PREFIX}" STREQUAL "") + set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") + endif() + if ("${CMAKE_IMPORT_LIBRARY_SUFFIX}" STREQUAL ".lib") + set(CMAKE_STATIC_LIBRARY_SUFFIX "_static.lib") + endif() +endif() + set(LIBRARY_SHARED lo_shared) -set(LIBRARY_STATIC lo_static) -set(OSCDUMP oscdump) -set(OSCSEND oscsend) -set(TESTLO testlo) -set(SUBTEST subtest) -set(CPPTEST cpp_test) -set(EXAMPLE_CLIENT example_client) -set(EXAMPLE_SERVER example_server) -set(EXAMPLE_TCP_ECHO_SERVER example_tcp_echo_server) -set(NONBLOCKING_SERVER_EXAMPLE nonblocking_server_example) +if (WITH_STATIC) + set(LIBRARY_STATIC lo_static) +endif() +if (WITH_TOOLS) + set(OSCDUMP oscdump) + set(OSCSEND oscsend) +endif() +if (WITH_TESTS) + set(TESTLO testlo) + set(SUBTEST subtest) + if (WITH_CPP_TESTS) + set(CPPTEST cpp_test) + endif() +else() + set(WITH_CPP_TESTS OFF) +endif() +if (WITH_EXAMPLES) + set(EXAMPLE_CLIENT example_client) + set(EXAMPLE_SERVER example_server) + set(EXAMPLE_TCP_ECHO_SERVER example_tcp_echo_server) + set(NONBLOCKING_SERVER_EXAMPLE nonblocking_server_example) +endif() set(TOOLS ${OSCDUMP} ${OSCSEND}) -set(TESTS ${TESTLO} ${SUBTEST} ${CPPTEST}) +set(TESTS ${TESTLO} ${SUBTEST}) +list(APPEND TESTS ${CPPTEST}) set(EXAMPLES ${EXAMPLE_CLIENT} ${EXAMPLE_SERVER} ${EXAMPLE_TCP_ECHO_SERVER} ${NONBLOCKING_SERVER_EXAMPLE}) set(PROGRAMS ${TOOLS} ${TESTS} ${EXAMPLES}) @@ -65,7 +121,9 @@ set(OSCSEND_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../src/tools/oscsend.c) set(TESTLO_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../src/testlo.c) set(SUBTEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../src/subtest.c) -set(CPPTEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../src/cpp_test.cpp) +if (WITH_CPP_TESTS) + set(CPPTEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../src/cpp_test.cpp) +endif() set(EXAMPLE_CLIENT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../examples/example_client.c) set(EXAMPLE_SERVER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../examples/example_server.c) set(EXAMPLE_TCP_ECHO_SERVER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../examples/example_tcp_echo_server.c) @@ -84,12 +142,11 @@ check_symbol_exists(getifaddrs "sys/types.h;ifaddrs.h" HAVE_GETIFADDRS) check_symbol_exists(inet_pton "arpa/inet.h" HAVE_INET_PTON) -set(THREADING ON CACHE BOOL "Build with threading support.") if(THREADING) if (CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_THREAD_PREFER_PTHREAD OFF CACHE BOOL "Prefer pthread to other thread libraries.") + option(CMAKE_THREAD_PREFER_PTHREAD "Prefer pthread to other thread libraries." OFF) else() - set(CMAKE_THREAD_PREFER_PTHREAD ON CACHE BOOL "Prefer pthread to other thread libraries.") + option(CMAKE_THREAD_PREFER_PTHREAD "Prefer pthread to other thread libraries." ON) endif() include(FindThreads) if (NOT Threads_FOUND) @@ -112,32 +169,47 @@ ${NONBLOCKING_SERVER_EXAMPLE_SOURCES} PROPERTIES LANGUAGE ${BUILD_LANGUAGE}) -set_source_files_properties(${CPPTEST_SOURCES} - PROPERTIES LANGUAGE CXX) +if (WITH_CPP_TESTS) + set_source_files_properties(${CPPTEST_SOURCES} + PROPERTIES LANGUAGE CXX) +endif() # Library -add_library(${LIBRARY_STATIC} STATIC ${LIBRARY_SOURCES}) add_library(${LIBRARY_SHARED} SHARED ${LIBRARY_SOURCES}) +if (WITH_STATIC) + add_library(${LIBRARY_STATIC} STATIC ${LIBRARY_SOURCES}) +endif() # Tools -add_executable(${OSCDUMP} ${OSCDUMP_SOURCES}) -add_executable(${OSCSEND} ${OSCSEND_SOURCES}) +if (WITH_TOOLS) + add_executable(${OSCDUMP} ${OSCDUMP_SOURCES}) + add_executable(${OSCSEND} ${OSCSEND_SOURCES}) +endif() # Tests -add_executable(${TESTLO} ${TESTLO_SOURCES}) -add_executable(${SUBTEST} ${SUBTEST_SOURCES}) -add_executable(${CPPTEST} ${CPPTEST_SOURCES}) +if (WITH_TESTS) + add_executable(${TESTLO} ${TESTLO_SOURCES}) + add_executable(${SUBTEST} ${SUBTEST_SOURCES}) +endif() +if (WITH_CPP_TESTS) + add_executable(${CPPTEST} ${CPPTEST_SOURCES}) +endif() # Examples -add_executable(${EXAMPLE_CLIENT} ${EXAMPLE_CLIENT_SOURCES}) -add_executable(${EXAMPLE_SERVER} ${EXAMPLE_SERVER_SOURCES}) -add_executable(${EXAMPLE_TCP_ECHO_SERVER} ${EXAMPLE_TCP_ECHO_SERVER_SOURCES}) -add_executable(${NONBLOCKING_SERVER_EXAMPLE} ${NONBLOCKING_SERVER_EXAMPLE_SOURCES}) +if (WITH_EXAMPLES) + add_executable(${EXAMPLE_CLIENT} ${EXAMPLE_CLIENT_SOURCES}) + add_executable(${EXAMPLE_SERVER} ${EXAMPLE_SERVER_SOURCES}) + add_executable(${EXAMPLE_TCP_ECHO_SERVER} ${EXAMPLE_TCP_ECHO_SERVER_SOURCES}) + add_executable(${NONBLOCKING_SERVER_EXAMPLE} ${NONBLOCKING_SERVER_EXAMPLE_SOURCES}) +endif() if(THREADING) set(ENABLE_THREADS 1) target_link_libraries(${LIBRARY_SHARED} Threads::Threads) + if (WITH_STATIC) + target_link_libraries(${LIBRARY_STATIC} Threads::Threads) + endif() set(THREADS_INCLUDE "#include \"lo/lo_serverthread.h\"") @@ -149,13 +221,18 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(${LIBRARY_SHARED} "user32" "wsock32" "ws2_32" "iphlpapi") if(THREADING AND Threads_FOUND) - target_link_libraries(${LIBRARY_SHARED} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${LIBRARY_SHARED} ${CMAKE_THREAD_LIBS_INIT}) + if (WITH_STATIC) + target_link_libraries(${LIBRARY_STATIC} ${CMAKE_THREAD_LIBS_INIT}) + endif() endif() set_target_properties(${LIBRARY_SHARED} PROPERTIES COMPILE_DEFINITIONS "LIBLO_DLL") - set_target_properties(${LIBRARY_STATIC} PROPERTIES - COMPILE_DEFINITIONS "LIBLO_LIB") + if (WITH_STATIC) + set_target_properties(${LIBRARY_STATIC} PROPERTIES + COMPILE_DEFINITIONS "LIBLO_LIB") + endif() set(DLLNAME "") if(THREADING) @@ -164,14 +241,19 @@ set(DEFTHREADS ";;") endif() else() - target_link_libraries(${LIBRARY_SHARED} "m") + target_link_libraries(${LIBRARY_SHARED} "m") + if (WITH_STATIC) + target_link_libraries(${LIBRARY_STATIC} "m") + endif() endif() set(LO_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) target_include_directories(${LIBRARY_SHARED} PUBLIC ${LO_INCLUDE_DIRS}) -target_include_directories(${LIBRARY_STATIC} PUBLIC ${LO_INCLUDE_DIRS}) +if (WITH_STATIC) + target_include_directories(${LIBRARY_STATIC} PUBLIC ${LO_INCLUDE_DIRS}) +endif() foreach(PROG ${PROGRAMS}) target_include_directories(${PROG} PUBLIC ${LO_INCLUDE_DIRS}) @@ -181,14 +263,18 @@ foreach(PROG ${TOOLS}) set_property(TARGET ${PROG} PROPERTY RUNTIME_OUTPUT_DIRECTORY "tools") endforeach(PROG) + foreach(PROG ${TESTS}) set_property(TARGET ${PROG} PROPERTY RUNTIME_OUTPUT_DIRECTORY "tests") endforeach(PROG) + foreach(PROG ${EXAMPLES}) set_property(TARGET ${PROG} PROPERTY RUNTIME_OUTPUT_DIRECTORY "examples") endforeach(PROG) -set_property(TARGET ${CPPTEST} PROPERTY CXX_STANDARD 11) +if (WITH_CPP_TESTS) + set_property(TARGET ${CPPTEST} PROPERTY CXX_STANDARD 11) +endif() # parse version info from configure.ac file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/../configure.ac" @@ -219,9 +305,11 @@ SOVERSION "${CURRENT_MINUS_AGE}" OUTPUT_NAME "lo" ) -set_target_properties(${LIBRARY_STATIC} PROPERTIES - OUTPUT_NAME "lo" - ) +if (WITH_STATIC) + set_target_properties(${LIBRARY_STATIC} PROPERTIES + OUTPUT_NAME "lo" + ) +endif() if(NOT DEFINED PRINTF_LL) message(STATUS "Check how to print long long int") @@ -248,8 +336,10 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../src/liblo.def.in ${CMAKE_CURRENT_BINARY_DIR}/src/liblo.def) - set_target_properties(${LIBRARY_STATIC} PROPERTIES - LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/src/liblo.def\"") + if (WITH_STATIC) + set_target_properties(${LIBRARY_STATIC} PROPERTIES + LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/src/liblo.def\"") + endif() set_target_properties(${LIBRARY_SHARED} PROPERTIES LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/src/liblo.def\"") else() diff -Nru liblo-0.29/configure.ac liblo-0.30/configure.ac --- liblo-0.29/configure.ac 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/configure.ac 2019-03-03 20:47:29.000000000 +0000 @@ -1,6 +1,6 @@ AC_PREREQ([2.69]) -AC_INIT([liblo],[0.29],[liblo-devel@lists.sourceforge.net]) +AC_INIT([liblo],[0.30],[liblo-devel@lists.sourceforge.net]) # libtool version: current:revision:age # @@ -15,9 +15,9 @@ # # If any interfaces have been removed since the last public release, then set # age to 0. -m4_define([lt_current], 10) +m4_define([lt_current], 11) m4_define([lt_revision], 0) -m4_define([lt_age], 3) +m4_define([lt_age], 4) m4_define([lt_version_info], [lt_current:lt_revision:lt_age]) m4_define([lt_current_minus_age], [m4_eval(lt_current - lt_age)]) diff -Nru liblo-0.29/debian/changelog liblo-0.30/debian/changelog --- liblo-0.29/debian/changelog 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/changelog 2019-07-26 01:01:22.000000000 +0000 @@ -1,3 +1,56 @@ +liblo (0.30-3) unstable; urgency=medium + + [ Ondřej Nový ] + * Bump Standards-Version to 4.4.0 + + [ Felipe Sateler ] + * Add glob to mark liblo.la as not installed in all architectures + * Remove debian/source/local-options for compatibility with dgit. + It is also unnecessary since git-buildpackge does the right thing anyway + * Set upstream page to github. + Also add upstream metadata file + Fixes lintian: upstream-metadata-file-is-missing + See https://lintian.debian.org/tags/upstream-metadata-file-is-missing.html for more details. + + -- Felipe Sateler Thu, 25 Jul 2019 21:01:22 -0400 + +liblo (0.30-2) unstable; urgency=medium + + * Upload to unstable + + -- Felipe Sateler Sun, 07 Jul 2019 22:35:27 -0400 + +liblo (0.30-1) experimental; urgency=medium + + [ Stephen Sinclair ] + * New upstream version 0.30. + * debian/rules: + - set hardening options for binaries + (thanks lintian hardening-no-bindnow) + - remove --parallel, obsolete on current debhelper + * debian/copyright: + - remove copyright for install-sh and compile (not present) + - add copyright for src/tools/oscsendfile.c + - remove unused expat license. + * debian/control: + - update standards to 4.3.0 + - fix duplicate-short-description for liblo7-tools + - fix binary-control-field-duplicates-source, remove section for liblo7 + * debian/liblo7.symbols: + - add new symbols from this release + + lo_server_thread_new_multicast_iface + + lo_servers_recv_noblock + + lo_servers_wait + + [ Felipe Sateler ] + * Mark Rules-Requires-Root: no as we don't need root for building + * Bump debhelper compat level to 12 + * Fail build if there are files missing to install. + Instead of building faulty binaries + * Upload to experimental due to freeze + + -- Felipe Sateler Sat, 01 Jun 2019 09:36:32 -0400 + liblo (0.29-1) unstable; urgency=medium * New upstream version 0.29 diff -Nru liblo-0.29/debian/compat liblo-0.30/debian/compat --- liblo-0.29/debian/compat 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -10 diff -Nru liblo-0.29/debian/control liblo-0.30/debian/control --- liblo-0.29/debian/control 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/control 2019-07-26 01:01:22.000000000 +0000 @@ -1,15 +1,16 @@ Source: liblo -Maintainer: Debian Multimedia Maintainers +Maintainer: Debian Multimedia Maintainers Uploaders: Felipe Sateler Section: libs Priority: optional -Build-Depends: debhelper (>= 10), +Build-Depends: debhelper-compat (= 12), dh-buildinfo, doxygen -Standards-Version: 4.0.1 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-multimedia/liblo.git -Vcs-Git: https://anonscm.debian.org/git/pkg-multimedia/liblo.git -Homepage: http://liblo.sourceforge.net/ +Standards-Version: 4.4.0 +Vcs-Browser: https://salsa.debian.org/multimedia-team/liblo +Vcs-Git: https://salsa.debian.org/multimedia-team/liblo.git +Homepage: https://github.com/radarsat1/liblo +Rules-Requires-Root: no Package: liblo-dev Architecture: any @@ -21,7 +22,7 @@ Replaces: liblo0-dev Description: Lightweight OSC library -- development files LibLO is a lightweight, easy to use implementation of the OSC (Open - Sound Control) protocol (see + Sound Control) protocol (see for details). . Open Sound Control (OSC) is a protocol for communication among @@ -42,14 +43,13 @@ Package: liblo7 Architecture: any Multi-Arch: same -Section: libs Depends: ${misc:Depends}, ${shlibs:Depends} Suggests: liblo-dev Pre-Depends: ${misc:Pre-Depends} Description: Lightweight OSC library LibLO is a lightweight, easy to use implementation of the OSC (Open - Sound Control) protocol (see + Sound Control) protocol (see for details). . Open Sound Control (OSC) is a protocol for communication among @@ -70,7 +70,7 @@ Section: utils Depends: ${misc:Depends}, ${shlibs:Depends} -Description: Lightweight OSC library +Description: Lightweight OSC library (command-line tools) LibLO is a lightweight, easy to use implementation of the OSC (Open Sound Control) protocol (see for details). diff -Nru liblo-0.29/debian/copyright liblo-0.30/debian/copyright --- liblo-0.29/debian/copyright 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/copyright 2019-07-26 01:01:22.000000000 +0000 @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: LibLO Upstream-Contact: Stephen Sinclair -Source: http://liblo.sourceforge.net/ +Source: https://github.com/radarsat1/liblo Files: * Copyright: 2004-2013 @@ -23,60 +23,26 @@ ventosus License: LGPL-2.1+ -Files: compile - config.guess - config.sub - depcomp -Copyright: 1992-2013, Free Software Foundation, Inc. -License: GPL-2+-autoconf - As a special exception to the GNU General Public License, if you - distribute this file as part of a program that contains a configuration - script generated by Autoconf, you may include it under the same - distribution terms that you use for the rest of that program. - Files: src/tools/oscdump.c src/tools/oscsend.c Copyright: 2008, Kentaro Fukuchi License: LGPL-2.1+ +Files: src/tools/oscsendfile.c +Copyright: 2016, Joseph Malloch + 2008, Kentaro Fukuchi +License: LGPL-2.1+ + Files: src/pattern_match.c Copyright: 2002-2004, libOSC++ contributors License: LGPL-2.1+ -Files: install-sh -Copyright: 1994, X Consortium -License: Expat~X with X exception - Except as contained in this notice, the name of the X Consortium shall - not be used in advertising or otherwise to promote the sale, use or - other dealings in this Software without prior written authorization - from the X Consortium. - Files: debian/* Copyright: 2004-2006, Robert Jordens 2008-2013, Felipe Sateler 2010-2011, Jonas Smedegaard License: GPL-2+ -License: Expat~X - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - . - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - License: GPL-2+ This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff -Nru liblo-0.29/debian/liblo7.symbols liblo-0.30/debian/liblo7.symbols --- liblo-0.29/debian/liblo7.symbols 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/liblo7.symbols 2019-07-26 01:01:22.000000000 +0000 @@ -133,6 +133,7 @@ lo_server_thread_new@Base 0.26~repack lo_server_thread_new_from_url@Base 0.27 lo_server_thread_new_multicast@Base 0.26~repack + lo_server_thread_new_multicast_iface@Base 0.30 lo_server_thread_new_with_proto@Base 0.26~repack lo_server_thread_pp@Base 0.26~repack lo_server_thread_set_callbacks@Base 0.29 @@ -140,6 +141,8 @@ lo_server_thread_start@Base 0.26~repack lo_server_thread_stop@Base 0.26~repack lo_server_wait@Base 0.26~repack + lo_servers_recv_noblock@Base 0.30 + lo_servers_wait@Base 0.30 lo_strsize@Base 0.26~repack lo_throw@Base 0.26~repack lo_timetag_diff@Base 0.26~repack diff -Nru liblo-0.29/debian/not-installed liblo-0.30/debian/not-installed --- liblo-0.29/debian/not-installed 1970-01-01 00:00:00.000000000 +0000 +++ liblo-0.30/debian/not-installed 2019-07-26 01:01:22.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/liblo.la diff -Nru liblo-0.29/debian/rules liblo-0.30/debian/rules --- liblo-0.29/debian/rules 2017-08-18 14:12:05.000000000 +0000 +++ liblo-0.30/debian/rules 2019-07-26 01:01:22.000000000 +0000 @@ -1,11 +1,13 @@ #!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk .PHONY: build %: - dh $@ --with buildinfo --parallel + dh $@ --with buildinfo build: build-arch @@ -27,3 +29,5 @@ --enable-examples +override_dh_missing: + dh_missing --fail-missing diff -Nru liblo-0.29/debian/upstream/metadata liblo-0.30/debian/upstream/metadata --- liblo-0.29/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ liblo-0.30/debian/upstream/metadata 2019-07-26 01:01:22.000000000 +0000 @@ -0,0 +1,6 @@ +Archive: GitHub +Bug-Database: https://github.com/radarsat1/liblo/issues +Contact: https://github.com/radarsat1/liblo/issues +Name: liblo +Repository: https://github.com/radarsat1/liblo.git +Repository-Browse: https://github.com/radarsat1/liblo diff -Nru liblo-0.29/lo/lo_cpp.h liblo-0.30/lo/lo_cpp.h --- liblo-0.29/lo/lo_cpp.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_cpp.h 2019-03-03 20:47:29.000000000 +0000 @@ -225,7 +225,12 @@ { return lo_address_get_protocol(address); } std::string url() const - { auto s(lo_address_get_url(address)); return std::string(s?s:""); } + { + char* s(lo_address_get_url(address)); + std::string result(s?s:""); + free(s); + return result; + } std::string iface() const { auto s(lo_address_get_iface(address)); return std::string(s?s:""); } @@ -603,7 +608,12 @@ { return lo_server_get_protocol(server); } std::string url() const - { auto s(lo_server_get_url(server)); return std::string(s?s:""); } + { + char* s(lo_server_get_url(server)); + std::string result(s?s:""); + free(s); + return result; + } int enable_queue(int queue_enabled, int dispatch_remaining=1) @@ -708,6 +718,17 @@ } } + ServerThread(const string_type &group, const num_string_type &port, + const string_type &iface, const string_type &ip, + lo_err_handler err_h=0) : Server(0) + { if (iface._s || ip._s) + server_thread = lo_server_thread_new_multicast_iface(group, port, + iface, ip, err_h); + else + server_thread = lo_server_thread_new_multicast(group, port, err_h); + if (server_thread) + server = lo_server_thread_get_server(server_thread); } + virtual ~ServerThread() { server = 0; if (server_thread) lo_server_thread_free(server_thread); } diff -Nru liblo-0.29/lo/lo_endian.h.in liblo-0.30/lo/lo_endian.h.in --- liblo-0.29/lo/lo_endian.h.in 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_endian.h.in 2019-03-03 20:47:29.000000000 +0000 @@ -18,19 +18,7 @@ #define LO_ENDIAN_H #include - -#ifdef _MSC_VER -#ifndef UINTSDEFINED -#define UINTSDEFINED -#define int32_t __int32 -#define int64_t __int64 -#define uint32_t unsigned __int32 -#define uint64_t unsigned __int64 -#define uint8_t unsigned __int8 -#endif -#else #include -#endif #if defined(WIN32) || defined(_MSC_VER) #include diff -Nru liblo-0.29/lo/lo_lowlevel.h liblo-0.30/lo/lo_lowlevel.h --- liblo-0.29/lo/lo_lowlevel.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_lowlevel.h 2019-03-03 20:47:29.000000000 +0000 @@ -31,11 +31,10 @@ #include #include #ifdef _MSC_VER -#define ssize_t SSIZE_T -#define uint32_t unsigned __int32 -#else -#include +typedef SSIZE_T ssize_t; #endif +#include + #include "lo/lo_types.h" #include "lo/lo_errors.h" @@ -107,7 +106,7 @@ /** * \brief Create a new lo_message object */ -lo_message lo_message_new(); +lo_message lo_message_new(void); /** * \brief Add one to a message's reference count. @@ -765,6 +764,21 @@ int lo_server_wait(lo_server s, int timeout); /** + * \brief Wait on multiple servers for an OSC message to be received + * + * \param s An array of servers to wait for connections on. + * \param status An array to receive the status of each server. + * \param num_servers The number of servers in the array s. + * \param timeout A timeout in milliseconds to wait for the incoming packet. + * a value of 0 will return immediately. + * + * The return value is the number of servers with a message waiting or + * 0 if there is no message. If there is a message waiting you can now + * call lo_server_recv() to receive that message. + */ +int lo_servers_wait(lo_server *s, int *status, int num_servers, int timeout); + +/** * \brief Look for an OSC message waiting to be received * * \param s The server to wait for connections on. @@ -778,6 +792,22 @@ int lo_server_recv_noblock(lo_server s, int timeout); /** + * \brief Look for an OSC message waiting to be received on multiple servers + * + * \param s As array of servers to wait for connections on. + * \param recvd An array to store the number of bytes received by each server + * in array s. + * \param num_servers The number of servers in the array s. + * \param timeout A timeout in milliseconds to wait for the incoming packet. + * a value of 0 will return immediately. + * + * The return value is the total number of bytes received by all servers. + * The messages will be dispatched to a matching method if one is found. + */ +int lo_servers_recv_noblock(lo_server *s, int *recvd, int num_servers, + int timeout); + +/** * \brief Block, waiting for an OSC message to be received * * The return value is the number of bytes in the received message. The message diff -Nru liblo-0.29/lo/lo_osc_types.h liblo-0.30/lo/lo_osc_types.h --- liblo-0.29/lo/lo_osc_types.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_osc_types.h 2019-03-03 20:47:29.000000000 +0000 @@ -22,18 +22,7 @@ * constants. */ -#ifdef _MSC_VER -#ifndef UINTSDEFINED -#define UINTSDEFINED -#define int32_t __int32 -#define int64_t __int64 -#define uint32_t unsigned __int32 -#define uint64_t unsigned __int64 -#define uint8_t unsigned __int8 -#endif -#else #include -#endif /** * \addtogroup liblo diff -Nru liblo-0.29/lo/lo_serverthread.h liblo-0.30/lo/lo_serverthread.h --- liblo-0.29/lo/lo_serverthread.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_serverthread.h 2019-03-03 20:47:29.000000000 +0000 @@ -64,6 +64,28 @@ lo_err_handler err_h); /** + * \brief Create a new server thread instance, and join a UDP + * multicast group, optionally specifying which network interface to + * use. Note that usually only one of iface or ip are specified. + * + * \param group The multicast group to join. See documentation on IP + * multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html + * \param port If using UDP then NULL may be passed to find an unused port. + * Otherwise a decimal port number or service name or may be passed. + * If using UNIX domain sockets then a socket path should be passed here. + * \param iface A string specifying the name of a network interface to + * use, or zero if not specified. + * \param ip A string specifying the IP address of a network interface + * to use, or zero if not specified. + * \param err_h An error callback function that will be called if there is an + * error in messge reception or server creation. Pass NULL if you do not want + * error handling. + */ +lo_server_thread lo_server_thread_new_multicast_iface(const char *group, const char *port, + const char *iface, const char *ip, + lo_err_handler err_h); + +/** * \brief Create a new server thread to handle incoming OSC * messages, specifying protocol. * diff -Nru liblo-0.29/lo/lo_throw.h liblo-0.30/lo/lo_throw.h --- liblo-0.29/lo/lo_throw.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/lo/lo_throw.h 2019-03-03 20:47:29.000000000 +0000 @@ -27,7 +27,7 @@ * it can be provided by associating it with a particular server * through this thread-safe API. */ -void *lo_error_get_context(); +void *lo_error_get_context(void); void lo_server_set_error_context(lo_server s, void *user_data); diff -Nru liblo-0.29/NEWS liblo-0.30/NEWS --- liblo-0.29/NEWS 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/NEWS 2019-03-03 20:47:29.000000000 +0000 @@ -1,5 +1,27 @@ -------------------------------------------- +2019-03-03: Release 0.30 +-------------------------------------------- + +We are pleased to present stable release 0.30 of LibLo, the +lightweight, easy to use implementation of the Open Sound Control +protocol. + +Open Sound Control (OSC) is a protocol for communication among +computers, sound synthesizers, and other multimedia devices that is +designed for use over modern network transports. + +Changes of note since the 0.29 release include: + +- Functions to wait and receive on multiple servers (lo_servers_wait + and lo_servers_recv_noblock) +- Improvements to the CMake build system. +- Remove premake4 files and rely on CMake for building on Windows. +- Fix memory leak in lo_server_recv_raw_stream. +- C++ wrapper: Fix memory leak on string allocation. +- oscdump: Disable line buffering in Windows to support MSYS2 output. + +-------------------------------------------- 2017-08-11: Release 0.29 -------------------------------------------- diff -Nru liblo-0.29/README.md liblo-0.30/README.md --- liblo-0.29/README.md 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/README.md 2019-03-03 20:47:29.000000000 +0000 @@ -32,10 +32,8 @@ so that the liblo library can be located by your application. -To build with MS Visual Studio on Windows, first download and run the -`premake4.exe` application in the build directory with an argument -describing which IDE you are using. This will generate project and -solution files. See `build/README.md` for more details. +To build with MS Visual Studio on Windows, please use CMake as +described next. See `build/README.md` for more details. Building with CMake ------------------- diff -Nru liblo-0.29/src/bundle.c liblo-0.30/src/bundle.c --- liblo-0.29/src/bundle.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/bundle.c 2019-03-03 20:47:29.000000000 +0000 @@ -14,6 +14,10 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff -Nru liblo-0.29/src/liblo.def.in liblo-0.30/src/liblo.def.in --- liblo-0.29/src/liblo.def.in 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/liblo.def.in 2019-03-03 20:47:29.000000000 +0000 @@ -143,3 +143,6 @@ @DEFTHREADS@ lo_server_thread_set_callbacks @140 lo_server_del_lo_method @141 @DEFTHREADS@ lo_server_thread_del_lo_method @142 +@DEFTHREADS@ lo_server_thread_new_multicast_iface @143 + lo_servers_wait @144 + lo_servers_recv_noblock @145 diff -Nru liblo-0.29/src/lo_types_internal.h liblo-0.30/src/lo_types_internal.h --- liblo-0.29/src/lo_types_internal.h 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/lo_types_internal.h 2019-03-03 20:47:29.000000000 +0000 @@ -26,10 +26,6 @@ #ifdef _MSC_VER typedef SSIZE_T ssize_t; -typedef unsigned __int64 uint64_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef __int32 int32_t; #endif #ifndef UINT_PTR diff -Nru liblo-0.29/src/message.c liblo-0.30/src/message.c --- liblo-0.29/src/message.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/message.c 2019-03-03 20:47:29.000000000 +0000 @@ -14,6 +14,10 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff -Nru liblo-0.29/src/send.c liblo-0.30/src/send.c --- liblo-0.29/src/send.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/send.c 2019-03-03 20:47:29.000000000 +0000 @@ -532,9 +532,9 @@ if (ret == -1) { if (a->protocol == LO_TCP) { + closesocket(a->socket); if (from) lo_server_del_socket(from, -1, a->socket); - closesocket(a->socket); a->socket = -1; } diff -Nru liblo-0.29/src/server.c liblo-0.30/src/server.c --- liblo-0.29/src/server.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/server.c 2019-03-03 20:47:29.000000000 +0000 @@ -51,10 +51,14 @@ #include #include #ifdef HAVE_POLL -#include +#include #endif #include #include +#include +#ifdef HAVE_GETIFADDRS +#include +#endif #endif #if defined(WIN32) || defined(_MSC_VER) @@ -298,20 +302,72 @@ /* Set hostname to empty string */ hostname[0] = '\0'; -#ifdef ENABLE_IPV6 +#if defined(ENABLE_IPV6) && defined(HAVE_GETIFADDRS) /* Try it the IPV6 friendly way first */ - for (it = ai; it; it = it->ai_next) { - if (getnameinfo(it->ai_addr, it->ai_addrlen, hostname, - sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0) { + do { + struct ifaddrs *ifa, *ifa_list; + if (getifaddrs(&ifa_list)) break; + ifa = ifa_list; + + while (ifa) { + if (!ifa->ifa_addr) { + ifa = ifa->ifa_next; + continue; + } + + if (s->addr_if.iface) { + if (s->addr_if.size == sizeof(struct in_addr) + && (ifa->ifa_addr->sa_family == AF_INET)) + { + struct sockaddr_in *sin = (struct sockaddr_in*)ifa->ifa_addr; + if (memcmp(&sin->sin_addr, &s->addr_if.a.addr, sizeof(struct in_addr))!=0 + || (s->addr_if.iface && ifa->ifa_name + && strcmp(s->addr_if.iface, ifa->ifa_name)!=0)) + { + ifa = ifa->ifa_next; + continue; + } + } + else if (s->addr_if.size == sizeof(struct in6_addr) + && (ifa->ifa_addr->sa_family == AF_INET6)) + { + struct sockaddr_in6 *sin = (struct sockaddr_in6*)ifa->ifa_addr; + if (memcmp(&sin->sin6_addr, &s->addr_if.a.addr6, + sizeof(struct in6_addr))!=0 + || (s->addr_if.iface && ifa->ifa_name + && strcmp(s->addr_if.iface, ifa->ifa_name)!=0)) + { + ifa = ifa->ifa_next; + continue; + } + } + } + + if ((ifa->ifa_addr->sa_family == AF_INET + && (!s->addr_if.iface || s->addr_if.size == sizeof(struct in_addr)) + && (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), hostname, + sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0)) + || (ifa->ifa_addr->sa_family == AF_INET6 + && (!s->addr_if.iface || s->addr_if.size == sizeof(struct in6_addr)) + && (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), hostname, + sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0))) + { + /* check to make sure getnameinfo() didn't just set the hostname to "::". + Needed on Darwin. */ + if (hostname[0] == ':') + hostname[0] = '\0'; + else if (strcmp(hostname, "localhost")==0) + hostname[0] = '\0'; + else + break; + } + ifa = ifa->ifa_next; } - } - /* check to make sure getnameinfo() didn't just set the hostname to "::". - Needed on Darwin. */ - if (hostname[0] == ':') { - hostname[0] = '\0'; + freeifaddrs(ifa_list); } + while (0); #endif /* Fallback to the oldschool (i.e. more reliable) way */ @@ -321,7 +377,7 @@ gethostname(hostname, sizeof(hostname)); he = gethostbyname(hostname); if (he) { - strncpy(hostname, he->h_name, sizeof(hostname)); + strncpy(hostname, he->h_name, sizeof(hostname) - 1); } } @@ -333,6 +389,38 @@ s->hostname = strdup(hostname); } +#if defined(WIN32) || defined(_MSC_VER) || defined(HAVE_GETIFADDRS) + +static int lo_server_set_iface(lo_server s, int fam, const char *iface, const char *ip) +{ + int err = lo_inaddr_find_iface(&s->addr_if, fam, iface, ip); + if (err) + return err; + + if (s->addr_if.size == sizeof(struct in_addr)) { + if (setsockopt(s->sockets[0].fd, IPPROTO_IP, IP_MULTICAST_IF, + (const char*)&s->addr_if.a.addr, s->addr_if.size) < 0) + { + err = geterror(); + lo_throw(s, err, strerror(err), "setsockopt(IP_MULTICAST_IF)"); + return err; + } + } +#ifdef ENABLE_IPV6 // TODO: this setsockopt fails on linux + else if (s->addr_if.size == sizeof(struct in6_addr)) { + if (setsockopt(s->sockets[0].fd, IPPROTO_IP, IPV6_MULTICAST_IF, + &s->addr_if.a.addr6, s->addr_if.size) < 0) { + err = geterror(); + lo_throw(s, err, strerror(err), "setsockopt(IPV6_MULTICAST_IF)"); + return err; + } + } +#endif + return 0; +} + +#endif // HAVE_GETIFADDRS + lo_server lo_server_new_with_proto_internal(const char *group, const char *port, const char *iface, @@ -551,11 +639,22 @@ #if defined(WIN32) || defined(_MSC_VER) if (wins2003_or_later) #endif + { /* Join multicast group if specified. */ - if (group != NULL) + if (group != NULL) { if (lo_server_join_multicast_group(s, group, used->ai_family, iface, ip)) return NULL; + } else { +#if defined(WIN32) || defined(_MSC_VER) || defined(HAVE_GETIFADDRS) + if ((iface || ip) + && lo_inaddr_find_iface(&s->addr_if, used->ai_family, iface, ip)) + { + used = NULL; + continue; + } +#endif + }} if ((used != NULL) && (bind(s->sockets[0].fd, used->ai_addr, used->ai_addrlen) < @@ -605,12 +704,10 @@ if (used->ai_family == PF_INET6) { struct sockaddr_in6 *addr = (struct sockaddr_in6 *) used->ai_addr; - - s->port = htons(addr->sin6_port); + s->port = ntohs(addr->sin6_port); } else if (used->ai_family == PF_INET) { struct sockaddr_in *addr = (struct sockaddr_in *) used->ai_addr; - - s->port = htons(addr->sin_port); + s->port = ntohs(addr->sin_port); } else { lo_throw(s, LO_UNKNOWNPROTO, "unknown protocol family", NULL); s->port = atoi(port); @@ -619,40 +716,6 @@ return s; } -#if defined(WIN32) || defined(_MSC_VER) || defined(HAVE_GETIFADDRS) - -static int lo_server_set_iface(lo_server s, int fam, const char *iface, const char *ip) -{ - int err = lo_inaddr_find_iface(&s->addr_if, fam, iface, ip); - if (err) - return err; - - if (s->addr_if.size == sizeof(struct in_addr)) { - if (setsockopt(s->sockets[0].fd, IPPROTO_IP, IP_MULTICAST_IF, - (const char*)&s->addr_if.a.addr, s->addr_if.size) < 0) - { - err = geterror(); - lo_throw(s, err, strerror(err), "setsockopt(IP_MULTICAST_IF)"); - lo_server_free(s); - return err; - } - } -#ifdef ENABLE_IPV6 - else if (s->addr_if.size == sizeof(struct in6_addr)) { - if (setsockopt(s->sockets[0].fd, IPPROTO_IP, IPV6_MULTICAST_IF, - &s->addr_if.a.addr6, s->addr_if.size) < 0) { - err = geterror(); - lo_throw(s, err, strerror(err), "setsockopt(IPV6_MULTICAST_IF)"); - lo_server_free(s); - return err; - } - } -#endif - return 0; -} - -#endif // HAVE_GETIFADDRS - int lo_server_join_multicast_group(lo_server s, const char *group, int fam, const char *iface, const char *ip) { @@ -683,7 +746,10 @@ #if defined(WIN32) || defined(_MSC_VER) || defined(HAVE_GETIFADDRS) if (iface || ip) { int err = lo_server_set_iface(s, fam, iface, ip); - if (err) return err; + if (err) { + lo_server_free(s); + return err; + } mreq.imr_interface = s->addr_if.a.addr; // TODO: the above assignment is for an in_addr, which assumes IPv4 @@ -816,7 +882,7 @@ buffer = (char*) malloc(s->max_msg_size); heap_buffer = 1; } - else if (buffer > 0) { + else { buffer = (char*) alloca(s->max_msg_size); } @@ -1200,7 +1266,7 @@ poll(s->sockets, s->sockets_len, -1); - for (i = data ? 0 : (s->sockets_len - 1); i >= 0; --i) { + for (i = s->sockets_len - 1; i >= 0 && !data; --i) { if (s->sockets[i].revents == POLLERR || s->sockets[i].revents == POLLHUP) { if (i > 0) { @@ -1282,77 +1348,108 @@ int lo_server_wait(lo_server s, int timeout) { - int sched_timeout = lo_server_next_event_delay(s) * 1000; - int i; - struct sockaddr_storage addr; - socklen_t addr_len = sizeof(addr); + return lo_servers_wait(&s, 0, 1, timeout); +} + +int lo_servers_wait(lo_server *s, int *status, int num_servers, int timeout) +{ + int i, j, sched_timeout; + + if (!status) + status = alloca(sizeof(int) * num_servers); + for (i = 0; i < num_servers; i++) + status[i] = 0; + lo_timetag now, then; #ifdef HAVE_SELECT #ifndef HAVE_POLL fd_set ps; struct timeval stimeout; + struct sockaddr_storage addr; + socklen_t addr_len = sizeof(addr); #endif #endif #ifdef HAVE_POLL + socklen_t addr_len = sizeof(struct sockaddr_storage); + struct sockaddr_storage *addr = alloca (addr_len * num_servers); + int num_sockets; + again: - for (i = 0; i < s->sockets_len; i++) { - s->sockets[i].events = POLLIN | POLLPRI | POLLERR | POLLHUP; - s->sockets[i].revents = 0; + num_sockets = 0; + for (j = 0; j < num_servers; j++) { + for (i = 0; i < s[j]->sockets_len; i++) { + if (lo_server_buffer_contains_msg(s[j], i)) { + status[j] = 1; + } + ++num_sockets; + } + } + + struct pollfd *sockets = alloca(sizeof(struct pollfd) * num_sockets); - if (lo_server_buffer_contains_msg(s, i)) - return 1; + sched_timeout = timeout; + int k; + for (j = 0, k = 0; j < num_servers; j++) { + for (i = 0; i < s[j]->sockets_len; i++) { + sockets[k].fd = s[j]->sockets[i].fd; + sockets[k].events = POLLIN | POLLPRI | POLLERR | POLLHUP; + sockets[k].revents = 0; + ++k; + } + int server_timeout = lo_server_next_event_delay(s[j]) * 1000; + if (server_timeout < sched_timeout) + sched_timeout = server_timeout; } lo_timetag_now(&then); - poll(s->sockets, s->sockets_len, - timeout > sched_timeout ? sched_timeout : timeout); - - if (s->sockets[0].revents == POLLERR - || s->sockets[0].revents == POLLHUP) - return 0; + poll(sockets, num_sockets, timeout > sched_timeout ? sched_timeout : timeout); - // If select() was reporting a new connection on the listening + // If poll() was reporting a new connection on the listening // socket rather than a ready message, accept it and check again. - if (s->sockets[0].revents) - { - if (s->protocol == LO_TCP) - { - int sock = accept(s->sockets[0].fd, - (struct sockaddr *) &addr, &addr_len); + for (j = 0, k = 0; j < num_servers; j++) { + if (sockets[k].revents && sockets[k].revents != POLLERR + && sockets[k].revents != POLLHUP) { + if (s[j]->protocol == LO_TCP) { + int sock = accept(sockets[k].fd, (struct sockaddr *) &addr[j], + &addr_len); + + i = lo_server_add_socket(s[j], sock, 0, &addr[j], addr_len); + if (i < 0) + closesocket(sock); + + init_context(&s[j]->contexts[i]); + + lo_timetag_now(&now); + + double diff = lo_timetag_diff(now, then); + + timeout -= (int)(diff*1000); + if (timeout < 0) + timeout = 0; - i = lo_server_add_socket(s, sock, 0, &addr, addr_len); - if (i < 0) - closesocket(sock); - - init_context(&s->contexts[i]); - - lo_timetag_now(&now); - - double diff = lo_timetag_diff(now, then); - - sched_timeout = lo_server_next_event_delay(s) * 1000; - timeout -= (int)(diff*1000); - if (timeout < 0) timeout = 0; - - goto again; - } - else { - return 1; + goto again; + } + else { + status[j] = 1; + } } + k += s[j]->sockets_len; } - for (i = 1; i < s->sockets_len; i++) { - if (s->sockets[i].revents == POLLERR - || s->sockets[i].revents == POLLHUP) - return 0; - if (s->sockets[i].revents) - return 1; + for (j = 0, k = 1; j < num_servers; j++, k++) { + for (i = 1; i < s[j]->sockets_len; i++, k++) { + if (sockets[k].revents && sockets[k].revents != POLLERR + && sockets[k].revents != POLLHUP) + status[j] = 1; + } } - if (lo_server_next_event_delay(s) < 0.01) - return 1; + for (j = 0; j < num_servers; j++) { + if (lo_server_next_event_delay(s[j]) < 0.01) + status[j] = 1; + } #else #ifdef HAVE_SELECT int res, to, nfds = 0; @@ -1362,19 +1459,30 @@ return 0; #endif + again: + + sched_timeout = timeout; + for (j = 0; j < num_servers; j++) { + int server_timeout = lo_server_next_event_delay(s[j]) * 1000; + if (server_timeout < sched_timeout) + sched_timeout = server_timeout; + } + to = timeout > sched_timeout ? sched_timeout : timeout; stimeout.tv_sec = to / 1000; stimeout.tv_usec = (to % 1000) * 1000; - again: FD_ZERO(&ps); - for (i = 0; i < s->sockets_len; i++) { - FD_SET(s->sockets[i].fd, &ps); - if (s->sockets[i].fd > nfds) - nfds = s->sockets[i].fd; + for (j = 0; j < num_servers; j++) { + for (i = 0; i < s[j]->sockets_len; i++) { + FD_SET(s[j]->sockets[i].fd, &ps); + if (s[j]->sockets[i].fd > nfds) + nfds = s[j]->sockets[i].fd; - if (lo_server_buffer_contains_msg(s, i)) - return 1; + if (lo_server_buffer_contains_msg(s[j], i)) { + status[j] = 1; + } + } } lo_timetag_now(&then); @@ -1382,62 +1490,94 @@ if (res == SOCKET_ERROR) return 0; + else if (res) { + for (j = 0; j < num_servers; j++) { + if (FD_ISSET(s[j]->sockets[0].fd, &ps)) { + // If select() was reporting a new connection on the listening + // socket rather than a ready message, accept it and check again. + if (s[j]->protocol == LO_TCP) { + int sock = accept(s[j]->sockets[0].fd, + (struct sockaddr *) &addr, &addr_len); + double diff; + struct timeval tvdiff; + + i = lo_server_add_socket(s[j], sock, 0, &addr, addr_len); + if (i < 0) + closesocket(sock); + + init_context(&s[j]->contexts[i]); + + lo_timetag_now(&now); + + // Subtract time waited from total timeout + diff = lo_timetag_diff(now, then); + tvdiff.tv_sec = stimeout.tv_sec - (int)diff; + tvdiff.tv_usec = stimeout.tv_usec - (diff * 1000000 + - (int)diff * 1000000); + + // Handle underflow + if (tvdiff.tv_usec < 0) { + tvdiff.tv_sec -= 1; + tvdiff.tv_usec = 1000000 + tvdiff.tv_usec; + } + if (tvdiff.tv_sec < 0) { + stimeout.tv_sec = 0; + stimeout.tv_usec = 0; + } + else + stimeout = tvdiff; + + timeout -= (int)(diff*1000); + if (timeout < 0) + timeout = 0; - if (s->protocol == LO_TCP) { - // If select() was reporting a new connection on the listening - // socket rather than a ready message, accept it and check again. - if (FD_ISSET(s->sockets[0].fd, &ps)) { - int sock = accept(s->sockets[0].fd, - (struct sockaddr *) &addr, &addr_len); - double diff; - struct timeval tvdiff; - - i = lo_server_add_socket(s, sock, 0, &addr, addr_len); - if (i < 0) - closesocket(sock); - - init_context(&s->contexts[i]); - - lo_timetag_now(&now); - - // Subtract time waited from total timeout - diff = lo_timetag_diff(now, then); - tvdiff.tv_sec = stimeout.tv_sec - (int)diff; - tvdiff.tv_usec = stimeout.tv_usec - (diff*1000000 - -(int)diff*1000000); - - // Handle underflow - if (tvdiff.tv_usec < 0) { - tvdiff.tv_sec -= 1; - tvdiff.tv_usec = 1000000 + tvdiff.tv_usec; + goto again; + } + else { + status[j] = 1; + } } - if (tvdiff.tv_sec < 0) { - stimeout.tv_sec = 0; - stimeout.tv_usec = 0; + for (i = 1; i < s[j]->sockets_len; i++) { + if (FD_ISSET(s[j]->sockets[i].fd, &ps)) + status[j] = 1; } - else - stimeout = tvdiff; - - goto again; } } - if (res || lo_server_next_event_delay(s) < 0.01) - return 1; + for (j = 0; j < num_servers; j++) { + if (lo_server_next_event_delay(s[j]) < 0.01) { + status[j] = 1; + } + } #endif #endif - return 0; + for (i = 0, j = 0; i < num_servers; i++) + j += status[i]; + + return j; } -int lo_server_recv_noblock(lo_server s, int timeout) +int lo_servers_recv_noblock(lo_server *s, int *recvd, int num_servers, + int timeout) { - int result = lo_server_wait(s, timeout); - if (result > 0) { - return lo_server_recv(s); - } else { + int i, total_bytes = 0; + if (!lo_servers_wait(s, recvd, num_servers, timeout)) { return 0; } + for (i = 0; i < num_servers; i++) { + if (recvd[i]) { + recvd[i] = lo_server_recv(s[i]); + total_bytes += recvd[i]; + } + } + return total_bytes; +} + +int lo_server_recv_noblock(lo_server s, int timeout) +{ + int status; + return lo_servers_recv_noblock(&s, &status, 1, timeout); } int lo_server_recv(lo_server s) diff -Nru liblo-0.29/src/server_thread.c liblo-0.30/src/server_thread.c --- liblo-0.29/src/server_thread.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/server_thread.c 2019-03-03 20:47:29.000000000 +0000 @@ -14,6 +14,10 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -50,10 +54,13 @@ static lo_server_thread alloc_server_thread(lo_server s) { + lo_server_thread st; + if (!s) return NULL; - lo_server_thread st = (lo_server_thread) - malloc(sizeof(struct _lo_server_thread)); + + st = (lo_server_thread) malloc(sizeof(struct _lo_server_thread)); + st->s = s; st->active = 0; st->done = 0; @@ -72,6 +79,15 @@ return st; } +lo_server_thread lo_server_thread_new_multicast_iface(const char *group, const char *port, + const char *iface, const char *ip, + lo_err_handler err_h) +{ + lo_server_thread st = alloc_server_thread( + lo_server_new_multicast_iface(group, port, iface, ip, err_h)); + return st; +} + lo_server_thread lo_server_thread_new_with_proto(const char *port, int proto, lo_err_handler err_h) @@ -274,6 +290,7 @@ #error "No threading implementation selected." #endif #endif + return 0; } void lo_server_thread_pp(lo_server_thread st) diff -Nru liblo-0.29/src/test_bidirectional_tcp.c liblo-0.30/src/test_bidirectional_tcp.c --- liblo-0.29/src/test_bidirectional_tcp.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/test_bidirectional_tcp.c 2019-03-03 20:47:29.000000000 +0000 @@ -1,10 +1,15 @@ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif -#include -#include +#ifdef HAVE_LIBPTHREAD #include +#endif + +#include #include +#include int generic_handler(const char *path, const char *types, lo_arg ** argv, int argc, lo_message data, void *user_data) diff -Nru liblo-0.29/src/testlo.c liblo-0.30/src/testlo.c --- liblo-0.29/src/testlo.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/testlo.c 2019-03-03 20:47:29.000000000 +0000 @@ -704,6 +704,13 @@ DOING("test_multicast"); +#ifdef ENABLE_IPV6 + // Print a warning but we let it fail, prefer to actually fix IPv6 + // support rather than just skip the test! + printf("WARNING: Compiled with --enable-ipv6, multicast not supported;" + "failure expected.\n"); +#endif + /* test multicast server and sender */ /* message is sent from st otherwise reply doesn't work */ ms = lo_server_new_multicast("224.0.1.1", "15432", error); @@ -1584,6 +1591,8 @@ lo_server s; char *server_url; lo_address a; + int testSizes[2] = { -1, 2048 }; + int i; DOING("test_nonblock"); @@ -1592,18 +1601,23 @@ lo_server_add_method(s, NULL, NULL, generic_handler, NULL); a = lo_address_new_from_url(server_url); - TEST(lo_server_recv_noblock(s, 0) == 0); - printf("Testing noblock API on %s\n", server_url); - lo_send(a, "/non-block-test", "f", 23.0); - int tries = 1000; - while (!lo_server_recv_noblock(s, 10) && --tries > 0) - { - } + for (i = 0; i < sizeof(testSizes) / sizeof(testSizes[0]); i++) { + lo_server_max_msg_size(s, testSizes[i]); - if (tries == 0) { - printf("lo_server_recv_noblock() test failed\n"); - exit(1); + TEST(lo_server_recv_noblock(s, 0) == 0); + printf("Testing noblock API on %s\n", server_url); + lo_send(a, "/non-block-test", "f", 23.0); + + int tries = 1000; + while (!lo_server_recv_noblock(s, 10) && --tries > 0) + { + } + + if (tries == 0) { + printf("lo_server_recv_noblock() test failed\n"); + exit(1); + } } free(server_url); diff -Nru liblo-0.29/src/tools/oscdump.c liblo-0.30/src/tools/oscdump.c --- liblo-0.29/src/tools/oscdump.c 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/tools/oscdump.c 2019-03-03 20:47:29.000000000 +0000 @@ -118,6 +118,12 @@ char *port=0, *group=0; int i=1; +#ifdef WIN32 +#ifdef HAVE_SETVBUF + setvbuf(stdout, 0, _IONBF, BUFSIZ); +#endif +#endif + if (argc > i && argv[i][0]=='-') { #ifdef HAVE_SETVBUF if (argv[i][1]=='L') { // line buffering diff -Nru liblo-0.29/src/tools/README liblo-0.30/src/tools/README --- liblo-0.29/src/tools/README 2017-08-11 15:35:29.000000000 +0000 +++ liblo-0.30/src/tools/README 2019-03-03 20:47:29.000000000 +0000 @@ -4,7 +4,8 @@ =================== oscsend and oscdump are OpenSound Control (OSC) tools using liblo. oscsend sends an OSC message specified by command line arguments, while oscdump -receives OSC messages and prints to standard output. +receives OSC messages and prints to standard output. oscsendfile transmits +all messages in a file containing the recorded output of oscdump. -oscsend and oscdump were originally developed by Kentaro Fukuchi. Now theay are +oscsend and oscdump were originally developed by Kentaro Fukuchi. Now they are part of liblo and maintained by liblo team.