Clean up errno logs and sto* conversions
I learned that we should be using PLOG to log errno strings, and we
should be avoiding stoi, stol, etc... conversions and instead use the
built in Android ParseInt/ParseUint functions.
Bug: 150250606
Bug: 150245058
Test: Manual for CLI tools, VTS for everything else
Merged-In: Icdd8a6af8564d5de3bedd1bc934f7928eb5e66e9
Change-Id: Icdd8a6af8564d5de3bedd1bc934f7928eb5e66e9
(cherry picked from commit 1173a7253becba2b548057112372c8a94d9b6a41)
diff --git a/automotive/can/1.0/default/CanSocket.cpp b/automotive/can/1.0/default/CanSocket.cpp
index 86ccc0e..f379d5a 100644
--- a/automotive/can/1.0/default/CanSocket.cpp
+++ b/automotive/can/1.0/default/CanSocket.cpp
@@ -67,7 +67,7 @@
bool CanSocket::send(const struct canfd_frame& frame) {
const auto res = write(mSocket.get(), &frame, CAN_MTU);
if (res < 0) {
- LOG(DEBUG) << "CanSocket send failed: " << errno;
+ PLOG(DEBUG) << "CanSocket send failed";
return false;
}
if (res != CAN_MTU) {
@@ -102,7 +102,7 @@
const auto sel = selectRead(mSocket, kReadPooling);
if (sel == 0) continue; // timeout
if (sel == -1) {
- LOG(ERROR) << "Select failed: " << errno;
+ PLOG(ERROR) << "Select failed";
break;
}
@@ -130,7 +130,7 @@
if (errno == EAGAIN) continue;
errnoCopy = errno;
- LOG(ERROR) << "Failed to read CAN packet: " << strerror(errno) << " (" << errno << ")";
+ PLOG(ERROR) << "Failed to read CAN packet";
break;
}