changed code style
This commit is contained in:
@@ -189,8 +189,8 @@ string fetchData(TCPSocket* socket, bool& listening)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (newData == true) {
|
||||
if (socket->isValid() == true) {
|
||||
if (newData) {
|
||||
if (socket->isValid()) {
|
||||
datalen = socket->recv(data, sizeof(data));
|
||||
|
||||
if (datalen < 0) {
|
||||
@@ -204,14 +204,14 @@ string fetchData(TCPSocket* socket, bool& listening)
|
||||
if ((ss.str().length() >= 2
|
||||
&& ss.str()[ss.str().length()-2] == '\n'
|
||||
&& ss.str()[ss.str().length()-1] == '\n')
|
||||
|| listening == true)
|
||||
|| listening)
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (newInput == true) {
|
||||
else if (newInput) {
|
||||
getline(cin, message);
|
||||
message += '\n';
|
||||
|
||||
@@ -242,7 +242,7 @@ void connect(const char* host, int port, char* const *args, int argCount)
|
||||
string message;
|
||||
bool listening = false;
|
||||
|
||||
if (once == false) {
|
||||
if (!once) {
|
||||
cout << host << ": ";
|
||||
getline(cin, message);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ void connect(const char* host, int port, char* const *args, int argCount)
|
||||
if (strcasecmp(message.c_str(), "L") == 0
|
||||
|| strcasecmp(message.c_str(), "LISTEN") == 0) {
|
||||
listening = true;
|
||||
while (listening && cin.eof() == false) {
|
||||
while (listening && !cin.eof()) {
|
||||
string result(fetchData(socket, listening));
|
||||
cout << result;
|
||||
if (strcasecmp(result.c_str(), "LISTEN STOPPED") == 0)
|
||||
@@ -281,7 +281,7 @@ void connect(const char* host, int port, char* const *args, int argCount)
|
||||
cout << fetchData(socket, listening);
|
||||
}
|
||||
|
||||
} while (once == false && cin.eof() == false);
|
||||
} while (!once && !cin.eof());
|
||||
|
||||
delete socket;
|
||||
|
||||
|
||||
@@ -140,18 +140,18 @@ int main(int argc, char* argv[])
|
||||
if (result != RESULT_OK)
|
||||
cout << "unable to open " << opt.device << ": " << getResultCode(result) << endl;
|
||||
|
||||
if (device->isValid() == false)
|
||||
if (!device->isValid())
|
||||
cout << "device " << opt.device << " not available" << endl;
|
||||
else {
|
||||
cout << "device opened" << endl;
|
||||
|
||||
fstream file(opt.dumpFile, ios::in | ios::binary);
|
||||
|
||||
if (file.is_open() == true) {
|
||||
if (file.is_open()) {
|
||||
|
||||
while (true) {
|
||||
unsigned char byte = file.get();
|
||||
if (file.eof() == true)
|
||||
if (file.eof())
|
||||
break;
|
||||
cout << hex << setw(2) << setfill('0')
|
||||
<< static_cast<unsigned>(byte) << endl;
|
||||
|
||||
Reference in New Issue
Block a user