diff --git a/docs/01-telldus-core.dox b/docs/01-telldus-core.dox index d7df9100..b5987450 100644 --- a/docs/01-telldus-core.dox +++ b/docs/01-telldus-core.dox @@ -44,7 +44,7 @@ * \code * int intNumberOfDevices = tdGetNumberOfDevices(); * for (int i = 0; i < intNumberOfDevices; i++) { - * int id = tdGetDeviceId( index ); + * int id = tdGetDeviceId( i ); * char *name = tdGetName( id ); * printf("%d\t%s\n", id, name); * tdReleaseString(name); diff --git a/examples/python/callbacks.py b/examples/python/callbacks.py index 2108fd28..a5a02a27 100644 --- a/examples/python/callbacks.py +++ b/examples/python/callbacks.py @@ -58,11 +58,11 @@ def rawcallbackfunction(data, controllerId, callbackId, context): print string_at(data) if (platform.system() == 'Windows'): - CMPFUNC = WINFUNCTYPE(c_void_p, c_int, c_int, POINTER(c_ubyte), c_int, c_void_p) #first is return type - CMPFUNCRAW = WINFUNCTYPE(c_void_p, POINTER(c_ubyte), c_int, c_int, c_void_p) + CMPFUNC = WINFUNCTYPE(None, c_int, c_int, POINTER(c_ubyte), c_int, c_void_p) #first is return type + CMPFUNCRAW = WINFUNCTYPE(None, POINTER(c_ubyte), c_int, c_int, c_void_p) else: - CMPFUNC = CFUNCTYPE(c_void_p, c_int, c_int, POINTER(c_ubyte), c_int, c_void_p) - CMPFUNCRAW = CFUNCTYPE(c_void_p, POINTER(c_ubyte), c_int, c_int, c_void_p) + CMPFUNC = CFUNCTYPE(None, c_int, c_int, POINTER(c_ubyte), c_int, c_void_p) + CMPFUNCRAW = CFUNCTYPE(None, POINTER(c_ubyte), c_int, c_int, c_void_p) cmp_func = CMPFUNC(callbackfunction) cmp_funcraw = CMPFUNCRAW(rawcallbackfunction) @@ -73,4 +73,4 @@ lib.tdRegisterDeviceEvent(cmp_func, 0) print "Waiting for events..." while(1): - time.sleep(0.5) #don't exit \ No newline at end of file + time.sleep(0.5) #don't exit diff --git a/examples/python/sensors/sensorscallback.py b/examples/python/sensors/sensorscallback.py index 7a592b89..8dc5ffd8 100644 --- a/examples/python/sensors/sensorscallback.py +++ b/examples/python/sensors/sensorscallback.py @@ -29,9 +29,9 @@ def callbackfunction(protocol, model, id, dataType, value, timestamp, callbackId if (platform.system() == 'Windows'): - CMPFUNC = WINFUNCTYPE(c_void_p, POINTER(c_ubyte), POINTER(c_ubyte), c_int, c_int, POINTER(c_ubyte), c_int, c_int, c_void_p) #first is return type + CMPFUNC = WINFUNCTYPE(None, POINTER(c_ubyte), POINTER(c_ubyte), c_int, c_int, POINTER(c_ubyte), c_int, c_int, c_void_p) #first is return type else: - CMPFUNC = CFUNCTYPE(c_void_p, POINTER(c_ubyte), POINTER(c_ubyte), c_int, c_int, POINTER(c_ubyte), c_int, c_int, c_void_p) + CMPFUNC = CFUNCTYPE(None, POINTER(c_ubyte), POINTER(c_ubyte), c_int, c_int, POINTER(c_ubyte), c_int, c_int, c_void_p) cmp_func = CMPFUNC(callbackfunction) diff --git a/telldus-core/client/telldus-core.cpp b/telldus-core/client/telldus-core.cpp index 9af1e040..5d351468 100644 --- a/telldus-core/client/telldus-core.cpp +++ b/telldus-core/client/telldus-core.cpp @@ -332,7 +332,7 @@ void WINAPI tdInit(void) { * @since Version 2.0.0 **/ int WINAPI tdRegisterDeviceEvent( TDDeviceEvent eventFunction, void *context ) { - eventFunction; Client *client = Client::getInstance(); + Client *client = Client::getInstance(); return client->registerEvent( CallbackStruct::DeviceEvent, (void *)eventFunction, context ); } @@ -1013,7 +1013,7 @@ char * WINAPI tdGetErrorString(int intErrorNo) { "Received an unknown response", "Syntax error", "Broken pipe" - "An error occured while communicating with the Telldus Service" + "An error occurred while communicating with the Telldus Service" }; std::string strReturn; intErrorNo = abs(intErrorNo); //We don't use negative values here. diff --git a/telldus-core/common/Strings.cpp b/telldus-core/common/Strings.cpp index 5bee53a9..c1f53411 100644 --- a/telldus-core/common/Strings.cpp +++ b/telldus-core/common/Strings.cpp @@ -39,7 +39,7 @@ std::wstring TelldusCore::charToWstring(const char *value) { size_t outbytesLeft = utf8Length*sizeof(wchar_t); //Copy the instring - char *inString = new char[strlen(value)+1]; + char *inString = new char[utf8Length+1]; strcpy(inString, value); //Create buffer for output diff --git a/telldus-core/service/ControllerManager.cpp b/telldus-core/service/ControllerManager.cpp index 2ccfa9a6..449bf0eb 100644 --- a/telldus-core/service/ControllerManager.cpp +++ b/telldus-core/service/ControllerManager.cpp @@ -199,9 +199,10 @@ void ControllerManager::loadStoredControllers() { int id = d->settings.getNodeId(Settings::Controller, i); d->controllers[id].controller = NULL; d->controllers[id].name = d->settings.getName(Settings::Controller, id); - d->controllers[id].type = d->settings.getControllerType(id); + const int type = d->settings.getControllerType(id); + d->controllers[id].type = type; d->controllers[id].serial = d->settings.getControllerSerial(id); - signalControllerEvent(id, TELLSTICK_DEVICE_ADDED, 0, L""); + signalControllerEvent(id, TELLSTICK_DEVICE_ADDED, type, L""); } } diff --git a/telldus-core/tdadmin/main.cpp b/telldus-core/tdadmin/main.cpp index cb4b3b59..66f7fcb0 100644 --- a/telldus-core/tdadmin/main.cpp +++ b/telldus-core/tdadmin/main.cpp @@ -47,6 +47,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage (state); case ARGP_KEY_ARG: + if (state->next == state->argc) { + argp_usage (state); + } command = arg; action = state->argv[state->next]; state->next = state->argc;