From 3998d9bdeb2df660ccc1eed2d59eb74a69f3bd23 Mon Sep 17 00:00:00 2001 From: Joseph Malloch Date: Fri, 25 Oct 2024 10:13:57 -0300 Subject: [PATCH 1/2] Disallow negative speed multiplier in testsendfile.c; updated documentation; updated gitignore --- .gitignore | 4 ++++ src/tools/oscsendfile.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9cc48bbb..67b7026e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *~ *.lo *.la +*.DS_Store .deps .libs /Makefile @@ -10,6 +11,8 @@ /autom4te.cache/ /build/Makefile /build/Makefile.in +/cmake/Makefile +/cmake/Makefile.in /compile /config.guess /config.h @@ -55,6 +58,7 @@ /src/tools/Makefile.in /src/tools/oscdump /src/tools/oscsend +/src/tools/oscsendfile /stamp-h1 /test /test-driver diff --git a/src/tools/oscsendfile.c b/src/tools/oscsendfile.c index b0a7ff18..52c258a0 100644 --- a/src/tools/oscsendfile.c +++ b/src/tools/oscsendfile.c @@ -1,7 +1,9 @@ /* - * oscsend - Send OpenSound Control message. + * oscsendfile - Send OpenSound Control message. * * Copyright (C) 2016 Joseph Malloch + * + * Adapted from oscsend: * Copyright (C) 2008 Kentaro Fukuchi * * This program is free software; you can redistribute it and/or modify @@ -45,8 +47,8 @@ void usage(void) printf("oscsendfile version %s\n" "Copyright (C) 2016 Joseph Malloch\n" " adapted from oscsend.c (C) 2008 Kentaro Fukuchi\n\n" - "Usage: oscsend hostname port file \n" - "or oscsend url file \n" + "Usage: oscsendfile hostname port file \n" + "or oscsendfile url file \n" "Send OpenSound Control messages from a file via UDP.\n\n" "Description\n" "hostname: specifies the remote host's name.\n" @@ -55,7 +57,7 @@ void usage(void) " e.g. UDP \"osc.udp://localhost:9000\"\n" " Multicast \"osc.udp://224.0.1.9:9000\"\n" " TCP \"osc.tcp://localhost:9000\"\n" - "speed : specifies a speed multiplier.\n", + "speed : specifies a speed multiplier (must be > 0).\n", VERSION); printf("Example\n" "$ oscsendfile localhost 7777 myfile.txt 2.5\n"); @@ -451,6 +453,10 @@ int main(int argc, char **argv) if (argc > i+1) { // optional speed argument speed = atof(argv[i+1]); + if (speed <= 0.0) { + fprintf(stderr, "Negative speed multiplier is not supported.\n"); + exit(1); + } } ret = send_file(target, speed); From a723664f2e46bec45fa6b5b210a25f368d8d9652 Mon Sep 17 00:00:00 2001 From: Joseph Malloch Date: Fri, 8 Nov 2024 14:19:36 -0400 Subject: [PATCH 2/2] Skip value entries for LO_TRUE/LO_FALSE/LO_NIL/LO_INFINITUM created by oscdump. Thanks to @7890 for the patch! Related to radarsat1/liblo#111 --- src/tools/oscsendfile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/oscsendfile.c b/src/tools/oscsendfile.c index 52c258a0..8fd2ff38 100644 --- a/src/tools/oscsendfile.c +++ b/src/tools/oscsendfile.c @@ -221,15 +221,19 @@ lo_message create_message(char **argv) } case LO_TRUE: lo_message_add_true(message); + ++argi; break; case LO_FALSE: lo_message_add_false(message); + ++argi; break; case LO_NIL: lo_message_add_nil(message); + ++argi; break; case LO_INFINITUM: lo_message_add_infinitum(message); + ++argi; break; default: fprintf(stderr, "Type '%c' is not supported or invalid.\n",