Code merge/PortAudio Script return error

* Correct return value on port audio script command
pull/1/head
David Freese 2015-02-08 08:41:07 -06:00
rodzic 279115cf2a
commit 3eb8e41d8f
6 zmienionych plików z 59 dodań i 36 usunięć

Wyświetl plik

@ -121,7 +121,7 @@ AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_CHECK_FUNCS([getaddrinfo gethostbyname hstrerror gmtime_r localtime_r memmove memset mkdir select setenv snprintf socket socketpair strcasecmp strcasestr strchr strdup strerror strlcpy strnlen strncasecmp strrchr strstr strtol uname unsetenv vsnprintf])
AC_CHECK_FUNCS([getaddrinfo gethostbyname hstrerror gmtime_r localtime_r memmove memset mkdir select setenv snprintf socket socketpair strcasecmp strcasestr strchr strdup strerror strlcpy strncpy strncmp strnlen strncasecmp strrchr strstr strtol uname unsetenv vsnprintf])
# Check for O_CLOEXEC
AC_FCNTL_FLAGS

Wyświetl plik

@ -1456,9 +1456,9 @@ int process_capture_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc)
if(cnt == PA_DEV_NOT_FOUND)
return script_invalid_parameter;
#else
return script_no_errors;
#endif // USE_PORTAUDIO
return script_no_errors;
}
/** ********************************************************
@ -1498,9 +1498,9 @@ int process_playback_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc)
if(cnt == PA_DEV_NOT_FOUND)
return script_invalid_parameter;
#else
#endif
return script_no_errors;
#endif // USE_PORTAUDIO
}
/** ********************************************************

Wyświetl plik

@ -7,6 +7,8 @@
// Dave Freese, W1HKJ
// Copyright (C) 2013
// Remi Chateauneu, F4ECW
// Copyright (C) 2015
// Robert Stiles, KK5VD
//
// This file is part of fldigi.
//
@ -30,6 +32,7 @@
#include <ctype.h>
#include <sys/stat.h>
#include <cstdlib>
#include <string>
#include "config.h"
#include "util.h"
@ -78,15 +81,6 @@ unsigned long ver2int(const char* version)
return v;
}
#if !HAVE_STRNLEN
size_t strnlen(const char* str, size_t len)
{
size_t n = strlen(str);
if (n > len) n = len;
return n;
}
#endif
#if !HAVE_STRCASESTR
# include <ctype.h>
// from git 1.6.1.2 compat/strcasestr.c
@ -127,6 +121,51 @@ size_t strlcpy(char *dest, const char *src, size_t size)
}
#endif // !HAVE_STRLCPY
#if !HAVE_STRNLEN
size_t strnlen(const char *s, size_t maxlen)
{
if((!s) || (maxlen < 1))
return 0;
size_t count = 0;
while(*s++ && (maxlen-- > 0))
count++;
return count;
}
#endif // !HAVE_STRNLEN
#if !HAVE_STRNCPY
char * strncpy(char *dst, const char *src, size_t maxlen)
{
if((!dst) || (!src) || (maxlen < 1))
return dst;
char *_dst = dst;
while(*src && *_dst && (--maxlen > 0))
*_dst++ = *src++;
*_dst = 0;
return dst;
}
#endif // !HAVE_STRNCPY
#if !HAVE_STRNCMP
int strncmp(const char *s1, const char *s2, size_t maxlen)
{
if((!s1) || (!s2) || (maxlen < 1))
return 0;
unsigned char *u1 = (unsigned char *)s1;
unsigned char *u2 = (unsigned char *)s2;
int dif = 0;
while(*u1 && *u2 && (maxlen-- > 0)) {
dif = *u1++ - *u2++;
if(dif) break;
}
return dif;
}
#endif // !HAVE_STRNCMP
#if !HAVE_SETENV
// from git 1.6.3.1 compat/setenv.c
int setenv(const char *name, const char *value, int replace)
@ -192,6 +231,7 @@ int unsetenv(const char *name)
}
#endif
#ifdef __MINGW32__
int set_cloexec(int fd, unsigned char v) { return 0; }
#else
@ -397,12 +437,12 @@ int test_process(int pid)
#include <winbase.h>
/// Retrieve the system error message for the last-error code
static const char * WindowsError(DWORD dw)
{
static const char * WindowsError(DWORD dw)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,

Wyświetl plik

@ -3061,7 +3061,7 @@ public:
{
XMLRPC_LOCK;
bool v = btnAutoSpot->value();
REQ(set_button, btnAutoSpot, params.getBoolean(0));
REQ(set_button, (Fl_Button *) btnAutoSpot, params.getBoolean(0));
*retval = xmlrpc_c::value_boolean(v);
}
};
@ -3078,7 +3078,7 @@ public:
{
XMLRPC_LOCK;
bool v = !btnAutoSpot->value();
REQ(set_button, btnAutoSpot, v);
REQ(set_button, (Fl_Button *) btnAutoSpot, v);
*retval = xmlrpc_c::value_boolean(v);
}
};

Wyświetl plik

@ -76,12 +76,6 @@
#include "estrings.h"
inline void trim_white_spaces(std::string &s)
{
while (s[0] == ' ') s.erase(0,1);
while (s[s.length() -1] == ' ') s.erase(s.length() - 1);
}
#define SND_BUF_LEN 65536
#define SND_RW_LEN (8 * SND_BUF_LEN)
// #define SRC_BUF_LEN (8*SND_BUF_LEN)
@ -1537,12 +1531,9 @@ SoundPort::device_iterator SoundPort::name_to_device(std::string &name, unsigned
std::string device_name;
bool match_found = false;
trim_white_spaces(name);
for (i = devs.begin(); i != devs.end(); ++i) {
device_name.assign((*i)->name);
trim_white_spaces(device_name);
if(strncmp(device_name.c_str(), name.c_str(), 32) == 0)
match_found = true;

Wyświetl plik

@ -47,12 +47,6 @@ LOG_FILE_SOURCE(debug::LOG_AUDIO);
using namespace std;
inline void trim_white_spaces(std::string &s)
{
while (s[0] == ' ') s.erase(0,1);
while (s[s.length() -1] == ' ') s.erase(s.length() - 1);
}
double std_sample_rates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0,
32000.0, 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1.0 };
@ -179,14 +173,12 @@ static void init_portaudio(void)
}
// add to menu
if (ilist->dev->maxInputChannels > 0) {
trim_white_spaces(menu_item);
menu_item.assign(menu_item);
menuPortInDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);
}
if (ilist->dev->maxOutputChannels > 0) {
trim_white_spaces(menu_item);
menu_item.assign(menu_item);
menuPortOutDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);