mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Clean up of printf to use sprintf and return the error via the Baton
This commit is contained in:
parent
543a2cd1a3
commit
fc971dc834
1 changed files with 4 additions and 8 deletions
|
|
@ -217,13 +217,11 @@ void EIO_Open(uv_work_t* req) {
|
|||
|
||||
#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
|
||||
speed_t speed = data->baudRate;
|
||||
if ( ioctl( fd, IOSSIOSPEED, &speed ) == -1 )
|
||||
{
|
||||
printf( "Error %d calling ioctl( ..., IOSSIOSPEED, ... )\n", errno );
|
||||
if (ioctl(fd, IOSSIOSPEED, &speed) == -1) {
|
||||
sprintf(data->errorString, "Error %d calling ioctl( ..., IOSSIOSPEED, ... )\n", errno );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
data->result = fd;
|
||||
}
|
||||
|
||||
|
|
@ -231,11 +229,9 @@ void EIO_Write(uv_work_t* req) {
|
|||
QueuedWrite* queuedWrite = static_cast<QueuedWrite*>(req->data);
|
||||
WriteBaton* data = static_cast<WriteBaton*>(queuedWrite->baton);
|
||||
|
||||
data->result = write(data->fd, data->bufferData, data->bufferLength);
|
||||
if ( data->result == -1 ) {
|
||||
printf( "Error %d calling write(...)\n", errno );
|
||||
if (data->result = write(data->fd, data->bufferData, data->bufferLength) == -1) {
|
||||
sprintf(data->errorString, "Error %d calling write(...)\n", errno );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EIO_Close(uv_work_t* req) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue