Style fixes.

This commit is contained in:
Adrien Destugues
2014-08-13 15:02:19 +02:00
parent 87e8603d9f
commit c53c7dded2
+13 -12
View File
@@ -50,7 +50,7 @@ void SerialApp::MessageReceived(BMessage* message)
{ {
case kMsgOpenPort: case kMsgOpenPort:
{ {
if(message->FindString("port name", &fPortPath) == B_OK) if (message->FindString("port name", &fPortPath) == B_OK)
{ {
fSerialPort.Open(fPortPath); fSerialPort.Open(fPortPath);
release_sem(fSerialLock); release_sem(fSerialLock);
@@ -71,7 +71,7 @@ void SerialApp::MessageReceived(BMessage* message)
ssize_t length; ssize_t length;
message->FindData("data", B_RAW_TYPE, (const void**)&bytes, message->FindData("data", B_RAW_TYPE, (const void**)&bytes,
&length); &length);
if(fLogFile->Write(bytes, length) != length) if (fLogFile->Write(bytes, length) != length)
{ {
// TODO error handling // TODO error handling
} }
@@ -108,7 +108,7 @@ void SerialApp::MessageReceived(BMessage* message)
fLogFile = new BFile(&directory, filename, fLogFile = new BFile(&directory, filename,
B_WRITE_ONLY | B_CREATE_FILE | B_OPEN_AT_END); B_WRITE_ONLY | B_CREATE_FILE | B_OPEN_AT_END);
status_t error = fLogFile->InitCheck(); status_t error = fLogFile->InitCheck();
if(error != B_OK) if (error != B_OK)
{ {
puts(strerror(error)); puts(strerror(error));
} }
@@ -125,19 +125,19 @@ void SerialApp::MessageReceived(BMessage* message)
parity_mode parity; parity_mode parity;
uint32 flowcontrol; uint32 flowcontrol;
if(message->FindInt32("databits", (int32*)&dataBits) == B_OK) if (message->FindInt32("databits", (int32*)&dataBits) == B_OK)
fSerialPort.SetDataBits(dataBits); fSerialPort.SetDataBits(dataBits);
if(message->FindInt32("stopbits", (int32*)&stopBits) == B_OK) if (message->FindInt32("stopbits", (int32*)&stopBits) == B_OK)
fSerialPort.SetStopBits(stopBits); fSerialPort.SetStopBits(stopBits);
if(message->FindInt32("parity", (int32*)&parity) == B_OK) if (message->FindInt32("parity", (int32*)&parity) == B_OK)
fSerialPort.SetParityMode(parity); fSerialPort.SetParityMode(parity);
if(message->FindInt32("flowcontrol", (int32*)&flowcontrol) == B_OK) if (message->FindInt32("flowcontrol", (int32*)&flowcontrol) == B_OK)
fSerialPort.SetFlowControl(flowcontrol); fSerialPort.SetFlowControl(flowcontrol);
if(message->FindInt32("baudrate", &baudrate) == B_OK) { if (message->FindInt32("baudrate", &baudrate) == B_OK) {
data_rate rate = (data_rate)baudrate; data_rate rate = (data_rate)baudrate;
fSerialPort.SetDataRate(rate); fSerialPort.SetDataRate(rate);
} }
@@ -152,7 +152,7 @@ void SerialApp::MessageReceived(BMessage* message)
bool SerialApp::QuitRequested() bool SerialApp::QuitRequested()
{ {
if(BApplication::QuitRequested()) { if (BApplication::QuitRequested()) {
SaveSettings(); SaveSettings();
return true; return true;
} }
@@ -174,7 +174,7 @@ void SerialApp::LoadSettings()
BFile file(path.Path(), B_READ_ONLY); BFile file(path.Path(), B_READ_ONLY);
BMessage message(kMsgSettings); BMessage message(kMsgSettings);
if(message.Unflatten(&file) != B_OK) if (message.Unflatten(&file) != B_OK)
{ {
message.AddInt32("parity", fSerialPort.ParityMode()); message.AddInt32("parity", fSerialPort.ParityMode());
message.AddInt32("databits", fSerialPort.DataBits()); message.AddInt32("databits", fSerialPort.DataBits());
@@ -212,7 +212,7 @@ status_t SerialApp::PollSerial(void*)
SerialApp* application = (SerialApp*)be_app; SerialApp* application = (SerialApp*)be_app;
char buffer[256]; char buffer[256];
for(;;) for (;;)
{ {
ssize_t bytesRead; ssize_t bytesRead;
@@ -228,11 +228,12 @@ status_t SerialApp::PollSerial(void*)
be_app_messenger.SendMessage(serialData); be_app_messenger.SendMessage(serialData);
} }
} }
// Should not reach this line anyway... // Should not reach this line anyway...
return B_OK; return B_OK;
} }
const char* SerialApp::kApplicationSignature const char* SerialApp::kApplicationSignature
= "application/x-vnd.haiku.SerialConnect"; = "application/x-vnd.haiku.SerialConnect";