diff --git a/telldus-core/service/ControllerMessage.cpp b/telldus-core/service/ControllerMessage.cpp index 32746d95..a701ffea 100644 --- a/telldus-core/service/ControllerMessage.cpp +++ b/telldus-core/service/ControllerMessage.cpp @@ -71,7 +71,7 @@ int ControllerMessage::getIntParameter(const std::string &key) const { if (strValue.compare("") == 0) { return -1; } - if (strValue.substr(0,2).compare("0x") == 0) { + if (strValue.substr(0, 2).compare("0x") == 0) { return strtol(strValue.c_str(), NULL, 16); } return strtol(strValue.c_str(), NULL, 10); diff --git a/telldus-core/service/DeviceManager.cpp b/telldus-core/service/DeviceManager.cpp index cc4b56cc..e322c811 100644 --- a/telldus-core/service/DeviceManager.cpp +++ b/telldus-core/service/DeviceManager.cpp @@ -98,7 +98,7 @@ int DeviceManager::setDeviceLastSentCommand(int deviceId, int command, const std DeviceMap::iterator it = d->devices.find(deviceId); if (it != d->devices.end()) { TelldusCore::MutexLocker deviceLocker(it->second); - d->set.setDeviceState(deviceId, command,value); + d->set.setDeviceState(deviceId, command, value); it->second->setLastSentCommand(command, value); } else { diff --git a/telldus-core/service/ProtocolBrateck.cpp b/telldus-core/service/ProtocolBrateck.cpp index 836e1a35..ab03387c 100644 --- a/telldus-core/service/ProtocolBrateck.cpp +++ b/telldus-core/service/ProtocolBrateck.cpp @@ -14,12 +14,12 @@ int ProtocolBrateck::methods() const { std::string ProtocolBrateck::getStringForMethod(int method, unsigned char, Controller *) { const char S = '!'; const char L = 'V'; - const char B1[] = {L,S,L,S,0}; - const char BX[] = {S,L,L,S,0}; - const char B0[] = {S,L,S,L,0}; - const char BUP[] = {L,S,L,S,S,L,S,L,S,L,S,L,S,L,S,L,S,0}; - const char BSTOP[] = {S,L,S,L,L,S,L,S,S,L,S,L,S,L,S,L,S,0}; - const char BDOWN[] = {S,L,S,L,S,L,S,L,S,L,S,L,L,S,L,S,S,0}; + const char B1[] = {L, S, L, S, 0}; + const char BX[] = {S, L, L, S, 0}; + const char B0[] = {S, L, S, L, 0}; + const char BUP[] = {L, S, L, S, S, L, S, L, S, L, S, L, S, L, S, L, S, 0}; + const char BSTOP[] = {S, L, S, L, L, S, L, S, S, L, S, L, S, L, S, L, S, 0}; + const char BDOWN[] = {S, L, S, L, S, L, S, L, S, L, S, L, L, S, L, S, S, 0}; std::string strReturn; std::wstring strHouse = this->getStringParameter(L"house", L""); diff --git a/telldus-core/service/ProtocolEverflourish.cpp b/telldus-core/service/ProtocolEverflourish.cpp index a9defc2a..addf3680 100644 --- a/telldus-core/service/ProtocolEverflourish.cpp +++ b/telldus-core/service/ProtocolEverflourish.cpp @@ -33,7 +33,7 @@ std::string ProtocolEverflourish::getStringForMethod(int method, unsigned char, const char sssl = 84; // 0 const char slss = 69; // 1 - const char bits[2] = {sssl,slss}; + const char bits[2] = {sssl, slss}; int i, check; std::string strCode; @@ -42,7 +42,7 @@ std::string ProtocolEverflourish::getStringForMethod(int method, unsigned char, check = calculateChecksum(deviceCode); - char preamble[] = {'R', 5, 'T', 114,60,1,1,105,ssss,ssss,0}; + char preamble[] = {'R', 5, 'T', 114, 60, 1, 1, 105, ssss, ssss, 0}; strCode.append(preamble); for(i=15;i>=0;i--) { @@ -64,15 +64,15 @@ std::string ProtocolEverflourish::getStringForMethod(int method, unsigned char, // The calculation used in this function is provided by Frank Stevenson unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) { unsigned int bits[16] = { - 0xf ,0xa ,0x7 ,0xe, - 0xf ,0xd ,0x9 ,0x1, - 0x1 ,0x2 ,0x4 ,0x8, - 0x3 ,0x6 ,0xc ,0xb + 0xf, 0xa, 0x7, 0xe, + 0xf, 0xd, 0x9, 0x1, + 0x1, 0x2, 0x4, 0x8, + 0x3, 0x6, 0xc, 0xb }; unsigned int bit = 1; unsigned int res = 0x5; int i; - unsigned int lo,hi; + unsigned int lo, hi; if ((x&0x3)==3) { lo = x & 0x00ff; diff --git a/telldus-core/service/ProtocolFuhaote.cpp b/telldus-core/service/ProtocolFuhaote.cpp index 37704869..b80b0b83 100644 --- a/telldus-core/service/ProtocolFuhaote.cpp +++ b/telldus-core/service/ProtocolFuhaote.cpp @@ -14,10 +14,10 @@ int ProtocolFuhaote::methods() const { std::string ProtocolFuhaote::getStringForMethod(int method, unsigned char, Controller *) { const char S = 19; const char L = 58; - const char B0[] = {S,L,L,S,0}; - const char B1[] = {L,S,L,S,0}; - const char OFF[] = {S,L,S,L,S,L,L,S,0}; - const char ON[] = {S,L,L,S,S,L,S,L,0}; + const char B0[] = {S, L, L, S, 0}; + const char B1[] = {L, S, L, S, 0}; + const char OFF[] = {S, L, S, L, S, L, L, S, 0}; + const char ON[] = {S, L, L, S, S, L, S, L, 0}; std::string strReturn = "S"; std::wstring strCode = this->getStringParameter(L"code", L""); diff --git a/telldus-core/service/ProtocolNexa.cpp b/telldus-core/service/ProtocolNexa.cpp index 3036ff00..f06de6b9 100644 --- a/telldus-core/service/ProtocolNexa.cpp +++ b/telldus-core/service/ProtocolNexa.cpp @@ -151,7 +151,7 @@ std::string ProtocolNexa::getStringSelflearningForCode(int intHouse, int intCode // code |= 11; //b1011 } if (i % 2 == 0) { - strMessage.append(1,code); + strMessage.append(1, code); code = 0; } } diff --git a/telldus-core/service/ProtocolX10.cpp b/telldus-core/service/ProtocolX10.cpp index 51234065..ba9f11e1 100644 --- a/telldus-core/service/ProtocolX10.cpp +++ b/telldus-core/service/ProtocolX10.cpp @@ -9,7 +9,7 @@ #include #include -const unsigned char HOUSES[] = {6,0xE,2,0xA,1,9,5,0xD,7,0xF,3,0xB,0,8,4,0xC}; +const unsigned char HOUSES[] = {6, 0xE, 2, 0xA, 1, 9, 5, 0xD, 7, 0xF, 3, 0xB, 0, 8, 4, 0xC}; int ProtocolX10::methods() const { return TELLSTICK_TURNON | TELLSTICK_TURNOFF; @@ -17,10 +17,10 @@ int ProtocolX10::methods() const { std::string ProtocolX10::getStringForMethod(int method, unsigned char data, Controller *controller) { const unsigned char S = 59, L = 169; - const char B0[] = {S,S,0}; - const char B1[] = {S,L,0}; - const unsigned char START_CODE[] = {'S',255,1,255,1,255,1,100,255,1,180,0}; - const unsigned char STOP_CODE[] = {S,0}; + const char B0[] = {S, S, 0}; + const char B1[] = {S, L, 0}; + const unsigned char START_CODE[] = {'S', 255, 1, 255, 1, 255, 1, 100, 255, 1, 180, 0}; + const unsigned char STOP_CODE[] = {S, 0}; std::string strReturn = reinterpret_cast(START_CODE); std::string strComplement = ""; diff --git a/telldus-core/service/Sensor.cpp b/telldus-core/service/Sensor.cpp index 787bf4c9..d5002651 100644 --- a/telldus-core/service/Sensor.cpp +++ b/telldus-core/service/Sensor.cpp @@ -55,7 +55,7 @@ int Sensor::dataTypes() const { } void Sensor::setValue(int type, const std::string &value, time_t timestamp) { - if (value.substr(0,2).compare("0x") == 0) { + if (value.substr(0, 2).compare("0x") == 0) { int intval = strtol(value.c_str(), NULL, 16); d->values[type] = TelldusCore::intToString(intval); } else { diff --git a/telldus-core/service/TellStick.cpp b/telldus-core/service/TellStick.cpp index 4987118a..3fa0205a 100644 --- a/telldus-core/service/TellStick.cpp +++ b/telldus-core/service/TellStick.cpp @@ -38,7 +38,7 @@ std::string TellStick::createTPacket( const std::string &msg ) { } } - return TellStick::convertSToT(t0,t1,t2,t3,data); + return TellStick::convertSToT(t0, t1, t2, t3, data); } std::string TellStick::convertSToT( unsigned char t0, unsigned char t1, unsigned char t2, unsigned char t3, const std::string &data ) { diff --git a/telldus-core/service/TellStick_libftdi.cpp b/telldus-core/service/TellStick_libftdi.cpp index ce726b64..d31cdb0e 100644 --- a/telldus-core/service/TellStick_libftdi.cpp +++ b/telldus-core/service/TellStick_libftdi.cpp @@ -126,9 +126,9 @@ void TellStick::processData( const std::string &data ) { } else if (data[i] == 10) { // \n found if (d->message.substr(0, 2).compare("+V") == 0) { setFirmwareVersion(TelldusCore::charToInteger(d->message.substr(2).c_str())); - } else if (d->message.substr(0,2).compare("+R") == 0) { + } else if (d->message.substr(0, 2).compare("+R") == 0) { this->publishData(d->message.substr(2)); - } else if(d->message.substr(0,2).compare("+W") == 0) { + } else if(d->message.substr(0, 2).compare("+W") == 0) { this->decodePublishData(d->message.substr(2)); } d->message.clear(); diff --git a/telldus-core/service/main_unix.cpp b/telldus-core/service/main_unix.cpp index 97d9358e..6acb2a8a 100644 --- a/telldus-core/service/main_unix.cpp +++ b/telldus-core/service/main_unix.cpp @@ -82,9 +82,9 @@ int main(int argc, char **argv) { // This way anyone starting the daemon can read the pidfile immediately // Record the pid - fd = fopen(PID_FILE,"w"); + fd = fopen(PID_FILE, "w"); if (fd) { - fprintf(fd,"%d\n",pid); + fprintf(fd, "%d\n", pid); fclose(fd); } else { Log::error("Could not open pid file %s: %s", PID_FILE, strerror(errno));