1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-3563: fix compiler warnings / type errors.

A previous commit made posix::read changed return value
from bool to int. However some callers still expected
bool and compared a bool<0 which is always false.
This commit is contained in:
benthompson15
2019-10-31 14:53:27 -05:00
parent 6b916675d5
commit 3a730a4222
6 changed files with 17 additions and 18 deletions

View File

@@ -43,7 +43,7 @@ CopyTask::~CopyTask()
bool CopyTask::run() bool CopyTask::run()
{ {
bool success; int success;
SMLogging* logger = SMLogging::get(); SMLogging* logger = SMLogging::get();
uint8_t buf[2048] = {0}; uint8_t buf[2048] = {0};
@@ -83,8 +83,7 @@ bool CopyTask::run()
sm_response *resp = (sm_response *) buf; sm_response *resp = (sm_response *) buf;
resp->returnCode = 0; resp->returnCode = 0;
success = write(*resp, 0); return write(*resp, 0);
return success;
} }
} }

View File

@@ -37,7 +37,7 @@ ListDirectoryTask::~ListDirectoryTask()
} }
#define check_error(msg, ret) \ #define check_error(msg, ret) \
if (success<0) \ if (!success) \
{ \ { \
handleError(msg, errno); \ handleError(msg, errno); \
return ret; \ return ret; \
@@ -85,8 +85,12 @@ bool ListDirectoryTask::run()
return true; return true;
} }
success = read(buf, getLength()); err = read(buf, getLength());
check_error("ListDirectoryTask read", false); if (err<0)
{
handleError("ListDirectoryTask read", errno);
return false;
}
listdir_cmd *cmd = (listdir_cmd *) buf; listdir_cmd *cmd = (listdir_cmd *) buf;
#ifdef SM_TRACE #ifdef SM_TRACE

View File

@@ -54,7 +54,7 @@ bool ReadTask::run()
return true; return true;
} }
bool success; int success;
success = read(buf, getLength()); success = read(buf, getLength());
check_error("ReadTask read cmd", false); check_error("ReadTask read cmd", false);
read_cmd *cmd = (read_cmd *) buf; read_cmd *cmd = (read_cmd *) buf;
@@ -103,8 +103,7 @@ bool ReadTask::run()
} }
if (resp->returnCode >= 0) if (resp->returnCode >= 0)
payloadLen = resp->returnCode; payloadLen = resp->returnCode;
success = write(*resp, payloadLen); return write(*resp, payloadLen);
return success;
} }

View File

@@ -48,7 +48,7 @@ StatTask::~StatTask()
bool StatTask::run() bool StatTask::run()
{ {
SMLogging* logger = SMLogging::get(); SMLogging* logger = SMLogging::get();
bool success; int success;
uint8_t buf[1024] = {0}; uint8_t buf[1024] = {0};
if (getLength() > 1023) { if (getLength() > 1023) {
@@ -84,8 +84,7 @@ bool StatTask::run()
payloadLen = 4; payloadLen = 4;
*((int32_t *) resp->payload) = errno; *((int32_t *) resp->payload) = errno;
} }
success = write(*resp, payloadLen); return write(*resp, payloadLen);
return success;
} }
} }

View File

@@ -44,7 +44,7 @@ TruncateTask::~TruncateTask()
bool TruncateTask::run() bool TruncateTask::run()
{ {
SMLogging* logger = SMLogging::get(); SMLogging* logger = SMLogging::get();
bool success; int success;
uint8_t buf[1024] = {0}; uint8_t buf[1024] = {0};
if (getLength() > 1023) { if (getLength() > 1023) {
@@ -79,8 +79,7 @@ bool TruncateTask::run()
sm_response *resp = (sm_response *) buf; sm_response *resp = (sm_response *) buf;
resp->returnCode = 0; resp->returnCode = 0;
success = write(*resp, 0); return write(*resp, 0);
return success;
} }
} }

View File

@@ -45,7 +45,7 @@ UnlinkTask::~UnlinkTask()
bool UnlinkTask::run() bool UnlinkTask::run()
{ {
SMLogging* logger = SMLogging::get(); SMLogging* logger = SMLogging::get();
bool success; int success;
uint8_t buf[1024] = {0}; uint8_t buf[1024] = {0};
if (getLength() > 1023) { if (getLength() > 1023) {
@@ -81,8 +81,7 @@ bool UnlinkTask::run()
sm_response *resp = (sm_response *) buf; sm_response *resp = (sm_response *) buf;
resp->returnCode = 0; resp->returnCode = 0;
success = write(*resp, 0); return write(*resp, 0);
return success;
} }
} }