Added whitespaces to comments according to Google style guidelines "whitespace/comments"

This commit is contained in:
Stefan Persson 2012-12-05 12:10:16 +01:00
parent ce24cabff9
commit 8d90a4e14a
10 changed files with 40 additions and 40 deletions

View file

@ -102,12 +102,12 @@ void CallbackMainDispatcher::run() {
if (!cbd) {
continue;
}
//debuglog(333, "Callbackevent, signalled");
// debuglog(333, "Callbackevent, signalled");
TelldusCore::MutexLocker locker(&d->mutex);
//debuglog(333, "Callbackevent, locked");
// debuglog(333, "Callbackevent, locked");
for(CallbackList::iterator callback_it = d->callbackList.begin(); callback_it != d->callbackList.end(); ++callback_it) {
if ( (*callback_it)->type == cbd->type ) {
//debuglog((*callback_it)->id, "Callbackevent, sending");
// debuglog((*callback_it)->id, "Callbackevent, sending");
std::tr1::shared_ptr<TelldusCore::TDEventDispatcher> ptr(new TelldusCore::TDEventDispatcher(eventData, *callback_it, d->janitor));
d->eventThreadList.push_back(ptr);
}

View file

@ -89,9 +89,9 @@ void Client::run() {
while(d->running) {
if(!d->eventSocket.isConnected()) {
debuglog(555, "Client, Trying to (re)connect to TelldusEvents");
d->eventSocket.connect(L"TelldusEvents"); //try to reconnect to service
d->eventSocket.connect(L"TelldusEvents"); // try to reconnect to service
if(!d->eventSocket.isConnected()) {
//reconnect didn't succeed, wait a while and try again
// reconnect didn't succeed, wait a while and try again
msleep(2000);
continue;
}
@ -160,7 +160,7 @@ std::wstring Client::sendToService(const Message &msg) {
}
Socket s;
s.connect(L"TelldusClient");
if (!s.isConnected()) { //Connection failed
if (!s.isConnected()) { // sConnection failed
debuglog(555, "Connection failed");
msleep(500);
continue; // retry
@ -169,7 +169,7 @@ std::wstring Client::sendToService(const Message &msg) {
if (!s.isConnected()) { // Connection failed sometime during operation... (better check here, instead of 5 seconds timeout later)
msleep(500);
debuglog(555, "Error in write, should retry");
continue; //retry
continue; // retry
}
readData = s.read(1000); // TODO(stefan): changed to 10000 from 5000, how much does this do...?
if(readData == L"") {

View file

@ -40,7 +40,7 @@ Socket::Socket(SOCKET_T hPipe) {
Socket::~Socket(void) {
d->running = false;
SetEvent(d->readEvent); //signal for break
SetEvent(d->readEvent); // signal for break
if (d->hPipe != INVALID_HANDLE_VALUE) {
CloseHandle(d->hPipe);
d->hPipe = 0;
@ -68,10 +68,10 @@ void Socket::connect(const std::wstring &server) {
DWORD dwMode = PIPE_READMODE_MESSAGE;
fSuccess = SetNamedPipeHandleState(
d->hPipe, // pipe handle
&dwMode, // new pipe mode
NULL, // don't set maximum bytes
NULL); // don't set maximum time
d->hPipe, // pipe handle
&dwMode, // new pipe mode
NULL, // don't set maximum bytes
NULL); // don't set maximum time
if (!fSuccess) {
return;
@ -127,7 +127,7 @@ std::wstring Socket::read(int timeout) {
if (!fSuccess) {
DWORD err = GetLastError();
debuglog(static_cast<int>(err), "Something read error");
if(err != ERROR_OPERATION_ABORTED) { //gets this "error" always when nothing was reads
if(err != ERROR_OPERATION_ABORTED) { // gets this "error" always when nothing was reads
debuglog(static_cast<int>(err), "Socket read error");
}

View file

@ -102,16 +102,16 @@ void ConnectionListener::run() {
if (recreate) {
hPipe = CreateNamedPipe(
(const wchar_t *)d->pipename.c_str(), // pipe name
PIPE_ACCESS_DUPLEX | // read/write access
FILE_FLAG_OVERLAPPED, //Overlapped mode
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
BUFSIZE, // output buffer size
BUFSIZE, // input buffer size
0, // client time-out
&d->sa); // default security attribute
PIPE_ACCESS_DUPLEX | // read/write access
FILE_FLAG_OVERLAPPED, // Overlapped mode
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
BUFSIZE, // output buffer size
BUFSIZE, // input buffer size
0, // client time-out
&d->sa); // default security attribute
if (hPipe == INVALID_HANDLE_VALUE) {
return;
@ -130,7 +130,7 @@ void ConnectionListener::run() {
}
if(result == WAIT_TIMEOUT) {
//CloseHandle(hPipe);
// CloseHandle(hPipe);
continue;
}
BOOL connected = GetOverlappedResult(hPipe, &oOverlap, &cbBytesRead, false);

View file

@ -13,12 +13,12 @@
#include "service/Protocol.h"
#include "service/EventUpdateManager.h"
#include "common/Strings.h"
#include "common/common.h" //debug
#include "common/common.h" // debug
inline int random( unsigned int* seed ) {
#ifdef _WINDOWS
unsigned int randomNumber;
rand_s( &randomNumber ); //no seed needed
rand_s( &randomNumber ); // no seed needed
return randomNumber;
#else
return rand_r( seed );

View file

@ -24,7 +24,7 @@
#include <vector>
#endif // _LINUX
#include "common/common.h" //debug
#include "common/common.h" // debug
#include "common/EventHandler.h"
#include "common/Message.h"
#include "common/Socket.h"
@ -164,7 +164,7 @@ void EventUpdateManager::sendMessageToClients(EventUpdateData *data) {
it++;
} else {
//connection is dead, remove it
// connection is dead, remove it
debuglogservice(0, "Lost connection, removing it");
delete *it;
it = d->clients.erase(it);

View file

@ -111,7 +111,7 @@ int Settings::addNode(Node type) {
strCompleteRegPath.append(TelldusCore::intToWstring(intNodeId));
if (RegCreateKeyEx(d->rootKey, strCompleteRegPath.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, &dwDisp)) {
//fail
// fail
intNodeId = -1;
}
@ -123,12 +123,12 @@ int Settings::addNode(Node type) {
* Get next available device id
*/
int Settings::getNextNodeId(Node type) const {
//Private, no locks needed
// Private, no locks needed
int intReturn = -1;
HKEY hk;
DWORD dwDisp;
long lnExists = RegCreateKeyEx(d->rootKey, d->getNodePath(type).c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, &dwDisp); //create or open if already created
long lnExists = RegCreateKeyEx(d->rootKey, d->getNodePath(type).c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, &dwDisp); // create or open if already created
if(lnExists == ERROR_SUCCESS) {
DWORD dwLength = sizeof(DWORD);
@ -160,7 +160,7 @@ int Settings::removeNode(Node type, int intNodeId) {
long lngSuccess = RegDeleteKey(d->rootKey, strCompleteRegPath.c_str());
if(lngSuccess == ERROR_SUCCESS) {
//one of the deletions succeeded
// one of the deletions succeeded
return TELLSTICK_SUCCESS;
}
@ -180,7 +180,7 @@ std::wstring Settings::getSetting(const std::wstring &strName) const {
long lngStatus = RegQueryValueEx(hk, strName.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);
if(lngStatus == ERROR_MORE_DATA) {
//The buffer is to small, recreate it
// The buffer is to small, recreate it
delete[] Buff;
Buff = new wchar_t[dwLength];
lngStatus = RegQueryValueEx(hk, strName.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);
@ -208,7 +208,7 @@ std::wstring Settings::getStringSetting(Node type, int intNodeId, const std::wst
long lngStatus = RegQueryValueEx(hk, name.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);
if(lngStatus == ERROR_MORE_DATA) {
//The buffer is to small, recreate it
// The buffer is to small, recreate it
delete[] Buff;
Buff = new wchar_t[dwLength];
lngStatus = RegQueryValueEx(hk, name.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);

View file

@ -9,7 +9,7 @@
#include <list>
#include <memory>
#include "common/common.h" //debug
#include "common/common.h" // debug
#include "common/EventHandler.h"
#include "service/ClientCommunicationHandler.h"
#include "service/ConnectionListener.h"

View file

@ -75,7 +75,7 @@ DWORD WINAPI TelldusWinService::deviceNotificationHandler( DWORD controlCode, DW
std::wstring name(pDevInf->dbcc_name);
transform(name.begin(), name.end(), name.begin(), toupper);
//Parse VID
// Parse VID
size_t posStart = name.find(L"VID_");
if (posStart == std::wstring::npos) {
return ERROR_CALL_NOT_IMPLEMENTED;
@ -87,7 +87,7 @@ DWORD WINAPI TelldusWinService::deviceNotificationHandler( DWORD controlCode, DW
}
std::wstring strVID = name.substr(posStart, posEnd-posStart);
//Parse PID
// Parse PID
posStart = name.find(L"PID_");
if (posStart == std::wstring::npos) {
return ERROR_CALL_NOT_IMPLEMENTED;
@ -125,7 +125,7 @@ DWORD WINAPI TelldusWinService::serviceControlHandler( DWORD controlCode, DWORD
void WINAPI TelldusWinService::serviceMain( DWORD argc, TCHAR* argv[] ) {
TelldusWinService instance;
//Enable debug if we hade this supplied
// Enable debug if we hade this supplied
for(unsigned int i = 1; i < argc; ++i) {
if (wcscmp(argv[i], L"--debug") == 0) {
Log::setDebug();
@ -165,7 +165,7 @@ void WINAPI TelldusWinService::serviceMain( DWORD argc, TCHAR* argv[] ) {
Log::notice("TelldusService started");
//Start our main-loop
// Start our main-loop
instance.tm->start();
Log::notice("TelldusService stopping");

View file

@ -8,7 +8,7 @@
#include <Dbt.h>
#include "service/TelldusWinService_win.h"
//#include <QCoreApplication>
// #include <QCoreApplication>
int main(int argc, char **argv) {
g_argc = argc;