diff options
author | daniel <danieruru@gmail.com> | 2013-01-13 13:57:36 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-13 13:57:36 +0900 |
commit | bc916934671e2361798b6d544d595063f4708810 (patch) | |
tree | 51114527dddd10500e9b7188f113a776815cca9c /libvxi11client/libvxi11client.c | |
parent | 714b4e092f7dfc3bdbc6ea864e85cb144b1b7277 (diff) |
clean up some compiler warnings in the client
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r-- | libvxi11client/libvxi11client.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index c58ad3a..60e4609 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -1,6 +1,7 @@ #include <stdbool.h> #include <rpc/rpc.h> #include <netinet/in.h> +#include <unistd.h> #include <glib.h> #include <poll.h> #include "vxi11.h" @@ -25,7 +26,7 @@ static CLIENT* clnt = NULL; static CLIENT* abortclnt = NULL; -static Device_Link link; +static Device_Link devicelink; static GThread* interruptthread; static bool interruptchannelopen = false; static void (*interruptcallback)(void) = NULL; @@ -123,10 +124,10 @@ int vxi11_open(char* address, char* device) { Create_LinkResp* linkresp = create_link_1(&link_parms, clnt); if (linkresp != NULL && linkresp->error == 0) { - link = linkresp->lid; + devicelink = linkresp->lid; #ifdef DEBUG - printf("Link created, lid is %d, abort channel port %d\n", linkresp->lid, linkresp->abortPort); + printf("Link created, lid is %d, abort channel port %d\n", (int) linkresp->lid, linkresp->abortPort); #endif struct sockaddr_in serveraddr; @@ -164,8 +165,8 @@ int vxi11_readstatusbyte(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_ReadStbResp* resp = device_readstb_1(¶ms, clnt); if (resp != NULL && resp->error == 0) @@ -184,8 +185,8 @@ int vxi11_write(char* data, unsigned int len, bool waitlock, bool end) { if (clnt == NULL) return 0; - Device_WriteParms params = { .lid = link, .io_timeout = VXI11_DEFAULT_TIMEOUT, - .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) }; + Device_WriteParms params = { .lid = devicelink, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) }; params.data.data_len = len; params.data.data_val = data; @@ -206,9 +207,9 @@ int vxi11_read(char* buffer, unsigned int bufferlen, bool waitlock, bool termchr if (clnt == NULL) return 0; - Device_ReadParms params = { .lid = link, .requestSize = 256, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, false, termchrset), .termChar = - termchrset ? termchr : 0 }; + Device_ReadParms params = { .lid = devicelink, .requestSize = 256, .io_timeout = VXI11_DEFAULT_TIMEOUT, + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, false, termchrset), + .termChar = termchrset ? termchr : 0 }; Device_ReadResp* resp = device_read_1(¶ms, clnt); if (resp != NULL && resp->error == 0) { @@ -233,9 +234,9 @@ int vxi11_docmd(unsigned long cmd, bool waitforlock) { if (clnt == NULL) return 0; - Device_DocmdParms params = - { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .io_timeout = VXI11_DEFAULT_TIMEOUT, - .lock_timeout = VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0, .datasize = 0 }; + Device_DocmdParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0, + .datasize = 0 }; params.data_in.data_in_len = 0; params.data_in.data_in_val = NULL; @@ -257,8 +258,8 @@ int vxi11_trigger(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_trigger_1(¶ms, clnt); if (error->error == 0) @@ -274,8 +275,8 @@ int vxi11_trigger(bool waitforlock) { int vxi11_clear(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_clear_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -292,8 +293,8 @@ int vxi11_clear(bool waitforlock) { int vxi11_remote(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_remote_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -310,8 +311,8 @@ int vxi11_remote(bool waitforlock) { int vxi11_local(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_local_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -328,8 +329,8 @@ int vxi11_local(bool waitforlock) { int vxi11_lock(bool waitforlock) { if (clnt == NULL) return 0; - Device_LockParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_LockParms params = { .lid = devicelink, .flags = vxi11_generateflags(waitforlock, false, false), + .lock_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_lock_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -346,7 +347,7 @@ int vxi11_lock(bool waitforlock) { int vxi11_unlock() { if (clnt == NULL) return 0; - Device_Error* error = device_unlock_1(&link, clnt); + Device_Error* error = device_unlock_1(&devicelink, clnt); if (error != NULL && error->error == 0) return 1; else if (error == NULL) @@ -497,7 +498,7 @@ int vxi11_enable_srq(bool enable, char* handle, void (*callback)(void)) { else if (interruptthread == NULL) return 0; - Device_EnableSrqParms params = { .lid = link, .enable = enable }; + Device_EnableSrqParms params = { .lid = devicelink, .enable = enable }; if (enable) { if (handle != NULL) { params.handle.handle_val = handle; @@ -526,7 +527,7 @@ int vxi11_enable_srq(bool enable, char* handle, void (*callback)(void)) { int vxi11_abort() { if (abortclnt == NULL) return 0; - Device_Error* error = device_abort_1(&link, abortclnt); + Device_Error* error = device_abort_1(&devicelink, abortclnt); if (error != NULL && error->error == 0) return 1; else if (error == NULL) @@ -543,7 +544,7 @@ int vxi11_close() { if (clnt == NULL) return 0; - Device_Error* error = destroy_link_1(&link, clnt); + Device_Error* error = destroy_link_1(&devicelink, clnt); clnt_destroy(clnt); clnt = NULL; clnt_destroy(abortclnt); |