git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2546 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -1636,7 +1636,7 @@ EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intcl | |||||
| if (client == NULL) { | if (client == NULL) { | ||||
| jack_error("jack_get_internal_client_name called with a NULL client"); | jack_error("jack_get_internal_client_name called with a NULL client"); | ||||
| return NULL; | return NULL; | ||||
| } else if (intclient < 0 || intclient >= CLIENT_NUM) { | |||||
| } else if (intclient >= CLIENT_NUM) { | |||||
| jack_error("jack_get_internal_client_name: incorrect client"); | jack_error("jack_get_internal_client_name: incorrect client"); | ||||
| return NULL; | return NULL; | ||||
| } else { | } else { | ||||
| @@ -1710,7 +1710,7 @@ EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack | |||||
| if (client == NULL) { | if (client == NULL) { | ||||
| jack_error("jack_internal_client_unload called with a NULL client"); | jack_error("jack_internal_client_unload called with a NULL client"); | ||||
| return (jack_status_t)(JackNoSuchClient | JackFailure); | return (jack_status_t)(JackNoSuchClient | JackFailure); | ||||
| } else if (intclient < 0 || intclient >= CLIENT_NUM) { | |||||
| } else if (intclient >= CLIENT_NUM) { | |||||
| jack_error("jack_internal_client_unload: incorrect client"); | jack_error("jack_internal_client_unload: incorrect client"); | ||||
| return (jack_status_t)(JackNoSuchClient | JackFailure); | return (jack_status_t)(JackNoSuchClient | JackFailure); | ||||
| } else { | } else { | ||||
| @@ -238,7 +238,7 @@ jackctl_parse_driver_params (jackctl_driver *driver_ptr, int argc, char* argv[]) | |||||
| unsigned long i; | unsigned long i; | ||||
| int opt; | int opt; | ||||
| JSList * node_ptr; | JSList * node_ptr; | ||||
| jackctl_parameter_t * param; | |||||
| jackctl_parameter_t * param = NULL; | |||||
| union jackctl_parameter_value value; | union jackctl_parameter_value value; | ||||
| if (argc <= 1) | if (argc <= 1) | ||||
| @@ -122,7 +122,7 @@ EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options | |||||
| { | { | ||||
| va_list ap; | va_list ap; | ||||
| va_start(ap, status); | va_start(ap, status); | ||||
| jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap); | |||||
| jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap); | |||||
| va_end(ap); | va_end(ap); | ||||
| return res; | return res; | ||||
| } | } | ||||
| @@ -75,7 +75,7 @@ int jack_midi_event_get(jack_midi_event_t *event, void* port_buffer, jack_nframe | |||||
| JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | ||||
| if (!buf || !buf->IsValid()) | if (!buf || !buf->IsValid()) | ||||
| return -EINVAL; | return -EINVAL; | ||||
| if (event_index < 0 || event_index >= buf->event_count) | |||||
| if (event_index >= buf->event_count) | |||||
| return -ENOBUFS; | return -ENOBUFS; | ||||
| JackMidiEvent* ev = &buf->events[event_index]; | JackMidiEvent* ev = &buf->events[event_index]; | ||||
| event->time = ev->time; | event->time = ev->time; | ||||
| @@ -107,7 +107,7 @@ jack_midi_data_t* jack_midi_event_reserve(void* port_buffer, jack_nframes_t time | |||||
| JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | ||||
| if (!buf && !buf->IsValid()) | if (!buf && !buf->IsValid()) | ||||
| return 0; | return 0; | ||||
| if (time < 0 || time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time)) | |||||
| if (time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time)) | |||||
| return 0; | return 0; | ||||
| return buf->ReserveEvent(time, data_size); | return buf->ReserveEvent(time, data_size); | ||||
| } | } | ||||
| @@ -119,7 +119,7 @@ int jack_midi_event_write(void* port_buffer, | |||||
| JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; | ||||
| if (!buf && !buf->IsValid()) | if (!buf && !buf->IsValid()) | ||||
| return -EINVAL; | return -EINVAL; | ||||
| if (time < 0 || time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time)) | |||||
| if (time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time)) | |||||
| return -EINVAL; | return -EINVAL; | ||||
| jack_midi_data_t* dest = buf->ReserveEvent(time, data_size); | jack_midi_data_t* dest = buf->ReserveEvent(time, data_size); | ||||
| if (!dest) | if (!dest) | ||||
| @@ -45,8 +45,8 @@ JackPort::JackPort() | |||||
| bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags) | bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags) | ||||
| { | { | ||||
| int id = GetPortTypeId(port_type); | |||||
| if (id < 0) | |||||
| jack_port_type_id_t id = GetPortTypeId(port_type); | |||||
| if (id == PORT_TYPES_MAX) | |||||
| return false; | return false; | ||||
| fTypeId = id; | fTypeId = id; | ||||
| fFlags = flags; | fFlags = flags; | ||||
| @@ -29,25 +29,22 @@ namespace Jack | |||||
| { | { | ||||
| static const JackPortType* port_types[] = | static const JackPortType* port_types[] = | ||||
| { | |||||
| &gAudioPortType, | |||||
| &gMidiPortType, | |||||
| }; | |||||
| enum | |||||
| { | { | ||||
| PORT_TYPES_MAX = sizeof(port_types) / sizeof(port_types[0]) | |||||
| &gAudioPortType, | |||||
| &gMidiPortType, | |||||
| }; | }; | ||||
| jack_port_type_id_t PORT_TYPES_MAX = sizeof(port_types) / sizeof(port_types[0]); | |||||
| jack_port_type_id_t GetPortTypeId(const char* port_type) | jack_port_type_id_t GetPortTypeId(const char* port_type) | ||||
| { | { | ||||
| for (int i = 0; i < PORT_TYPES_MAX; ++i) { | |||||
| for (jack_port_type_id_t i = 0; i < PORT_TYPES_MAX; ++i) { | |||||
| const JackPortType* type = port_types[i]; | const JackPortType* type = port_types[i]; | ||||
| assert(type != 0); | assert(type != 0); | ||||
| if (strcmp(port_type, type->name) == 0) | if (strcmp(port_type, type->name) == 0) | ||||
| return i; | return i; | ||||
| } | } | ||||
| return -1; | |||||
| return PORT_TYPES_MAX; | |||||
| } | } | ||||
| const JackPortType* GetPortType(jack_port_type_id_t type_id) | const JackPortType* GetPortType(jack_port_type_id_t type_id) | ||||
| @@ -27,6 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||
| extern jack_port_type_id_t PORT_TYPES_MAX; | |||||
| struct JackPortType | struct JackPortType | ||||
| { | { | ||||
| const char* name; | const char* name; | ||||
| @@ -823,7 +823,9 @@ struct JackInternalClientHandleResult : public JackResult | |||||
| struct JackInternalClientLoadRequest : public JackRequest | struct JackInternalClientLoadRequest : public JackRequest | ||||
| { | { | ||||
| #ifndef MAX_PATH | |||||
| #define MAX_PATH 256 | #define MAX_PATH 256 | ||||
| #endif | |||||
| int fRefNum; | int fRefNum; | ||||
| char fName[JACK_CLIENT_NAME_SIZE + 1]; | char fName[JACK_CLIENT_NAME_SIZE + 1]; | ||||
| @@ -65,7 +65,7 @@ class JackRunnableInterface | |||||
| namespace detail | namespace detail | ||||
| { | { | ||||
| class JackThread | |||||
| class EXPORT JackThread | |||||
| { | { | ||||
| public: | public: | ||||
| @@ -37,19 +37,22 @@ extern "C" | |||||
| } | } | ||||
| jack_varargs_t; | jack_varargs_t; | ||||
| static const char* jack_default_server_name (void) { | |||||
| static const char* jack_default_server_name (void) | |||||
| { | |||||
| const char *server_name; | const char *server_name; | ||||
| if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL) | if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL) | ||||
| server_name = "default"; | server_name = "default"; | ||||
| return server_name; | return server_name; | ||||
| } | } | ||||
| static inline void jack_varargs_init (jack_varargs_t *va) { | |||||
| static inline void jack_varargs_init (jack_varargs_t *va) | |||||
| { | |||||
| memset (va, 0, sizeof(jack_varargs_t)); | memset (va, 0, sizeof(jack_varargs_t)); | ||||
| va->server_name = (char*)jack_default_server_name(); | va->server_name = (char*)jack_default_server_name(); | ||||
| } | } | ||||
| static inline void jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va) { | |||||
| static inline void jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va) | |||||
| { | |||||
| // initialize default settings | // initialize default settings | ||||
| jack_varargs_init (va); | jack_varargs_init (va); | ||||
| @@ -35,7 +35,7 @@ int JackWinNamedPipe::Read(void* data, int len) | |||||
| { | { | ||||
| DWORD read; | DWORD read; | ||||
| BOOL res = ReadFile(fNamedPipe, data, len, &read, NULL); | BOOL res = ReadFile(fNamedPipe, data, len, &read, NULL); | ||||
| if (read != len) { | |||||
| if (read != (DWORD)len) { | |||||
| jack_error("Cannot read named pipe err = %ld", GetLastError()); | jack_error("Cannot read named pipe err = %ld", GetLastError()); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| @@ -47,7 +47,7 @@ int JackWinNamedPipe::Write(void* data, int len) | |||||
| { | { | ||||
| DWORD written; | DWORD written; | ||||
| BOOL res = WriteFile(fNamedPipe, data, len, &written, NULL); | BOOL res = WriteFile(fNamedPipe, data, len, &written, NULL); | ||||
| if (written != len) { | |||||
| if (written != (DWORD)len) { | |||||
| jack_error("Cannot write named pipe err = %ld", GetLastError()); | jack_error("Cannot write named pipe err = %ld", GetLastError()); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| @@ -23,6 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
| #define __JackWinThread__ | #define __JackWinThread__ | ||||
| #include "JackThread.h" | #include "JackThread.h" | ||||
| #include "JackExports.h" | |||||
| #include <windows.h> | #include <windows.h> | ||||
| namespace Jack | namespace Jack | ||||
| @@ -34,7 +35,7 @@ typedef DWORD (WINAPI *ThreadCallback)(void *arg); | |||||
| \brief Windows threads. | \brief Windows threads. | ||||
| */ | */ | ||||
| class JackWinThread : public detail::JackThread | |||||
| class EXPORT JackWinThread : public detail::JackThread | |||||
| { | { | ||||
| private: | private: | ||||