PVS V547: always false comparisons
Change-Id: I1c7790ff0aa537b974bdc0fd65d76f277ea5f8cf Reviewed-on: https://review.haiku-os.org/c/1647 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
84a5d9f625
commit
6967695c4e
@@ -277,15 +277,16 @@ BScrollBar::BScrollBar(BMessage* data)
|
|||||||
int32 orientation;
|
int32 orientation;
|
||||||
if (data->FindInt32("_orient", &orientation) < B_OK) {
|
if (data->FindInt32("_orient", &orientation) < B_OK) {
|
||||||
fOrientation = B_VERTICAL;
|
fOrientation = B_VERTICAL;
|
||||||
if ((Flags() & B_SUPPORTS_LAYOUT) == 0) {
|
|
||||||
// just to make sure
|
|
||||||
SetResizingMode(fOrientation == B_VERTICAL
|
|
||||||
? B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT
|
|
||||||
: B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
fOrientation = (enum orientation)orientation;
|
fOrientation = (enum orientation)orientation;
|
||||||
|
|
||||||
|
if ((Flags() & B_SUPPORTS_LAYOUT) == 0) {
|
||||||
|
// just to make sure
|
||||||
|
SetResizingMode(fOrientation == B_VERTICAL
|
||||||
|
? B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT
|
||||||
|
: B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
if (data->FindFloat("_prop", &fProportion) < B_OK)
|
if (data->FindFloat("_prop", &fProportion) < B_OK)
|
||||||
fProportion = 0.0;
|
fProportion = 0.0;
|
||||||
|
|
||||||
|
|||||||
@@ -212,12 +212,6 @@ DormantNodeManager::RegisterAddOn(const char* path)
|
|||||||
status = QueryServer(SERVER_REGISTER_ADD_ON, &request, sizeof(request),
|
status = QueryServer(SERVER_REGISTER_ADD_ON, &request, sizeof(request),
|
||||||
&reply, sizeof(reply));
|
&reply, sizeof(reply));
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("DormantNodeManager::RegisterAddon failed, couldn't talk to "
|
|
||||||
"media server\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status < B_OK) {
|
|
||||||
ERROR("DormantNodeManager::RegisterAddon failed, couldn't talk to "
|
ERROR("DormantNodeManager::RegisterAddon failed, couldn't talk to "
|
||||||
"media server: %s\n", strerror(status));
|
"media server: %s\n", strerror(status));
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -486,9 +486,7 @@ TRoster::HandleRemoveApp(BMessage* request)
|
|||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
// get the parameters
|
// get the parameters
|
||||||
team_id team;
|
team_id team;
|
||||||
if (request->FindInt32("team", &team) != B_OK)
|
error = request->FindInt32("team", &team);
|
||||||
team = -1;
|
|
||||||
|
|
||||||
PRINT("team: %" B_PRId32 "\n", team);
|
PRINT("team: %" B_PRId32 "\n", team);
|
||||||
|
|
||||||
// remove the app
|
// remove the app
|
||||||
@@ -658,7 +656,6 @@ TRoster::HandleGetAppInfo(BMessage* request)
|
|||||||
|
|
||||||
BAutolock _(fLock);
|
BAutolock _(fLock);
|
||||||
|
|
||||||
status_t error = B_OK;
|
|
||||||
// get the parameters
|
// get the parameters
|
||||||
team_id team;
|
team_id team;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -673,38 +670,39 @@ TRoster::HandleGetAppInfo(BMessage* request)
|
|||||||
if (request->FindString("signature", &signature) != B_OK)
|
if (request->FindString("signature", &signature) != B_OK)
|
||||||
hasSignature = false;
|
hasSignature = false;
|
||||||
|
|
||||||
if (hasTeam)
|
if (hasTeam)
|
||||||
PRINT("team: %" B_PRId32 "\n", team);
|
PRINT("team: %" B_PRId32 "\n", team);
|
||||||
if (hasRef)
|
if (hasRef) {
|
||||||
PRINT("ref: %" B_PRId32 ", %" B_PRId64 ", %s\n", ref.device, ref.directory,
|
PRINT("ref: %" B_PRId32 ", %" B_PRId64 ", %s\n", ref.device,
|
||||||
ref.name);
|
ref.directory, ref.name);
|
||||||
if (hasSignature)
|
}
|
||||||
PRINT("signature: %s\n", signature);
|
if (hasSignature)
|
||||||
|
PRINT("signature: %s\n", signature);
|
||||||
|
|
||||||
// get the info
|
// get the info
|
||||||
RosterAppInfo* info = NULL;
|
RosterAppInfo* info = NULL;
|
||||||
if (error == B_OK) {
|
status_t error;
|
||||||
if (hasTeam) {
|
if (hasTeam) {
|
||||||
info = fRegisteredApps.InfoFor(team);
|
info = fRegisteredApps.InfoFor(team);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
SET_ERROR(error, B_BAD_TEAM_ID);
|
SET_ERROR(error, B_BAD_TEAM_ID);
|
||||||
} else if (hasRef) {
|
} else if (hasRef) {
|
||||||
info = fRegisteredApps.InfoFor(&ref);
|
info = fRegisteredApps.InfoFor(&ref);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
SET_ERROR(error, B_ERROR);
|
SET_ERROR(error, B_ERROR);
|
||||||
} else if (hasSignature) {
|
} else if (hasSignature) {
|
||||||
info = fRegisteredApps.InfoFor(signature);
|
info = fRegisteredApps.InfoFor(signature);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
SET_ERROR(error, B_ERROR);
|
SET_ERROR(error, B_ERROR);
|
||||||
} else {
|
} else {
|
||||||
// If neither of those has been supplied, the active application
|
// If neither of those has been supplied, the active application
|
||||||
// info is requested.
|
// info is requested.
|
||||||
if (fActiveApp)
|
if (fActiveApp)
|
||||||
info = fActiveApp;
|
info = fActiveApp;
|
||||||
else
|
else
|
||||||
SET_ERROR(error, B_ERROR);
|
SET_ERROR(error, B_ERROR);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reply to the request
|
// reply to the request
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
BMessage reply(B_REG_SUCCESS);
|
BMessage reply(B_REG_SUCCESS);
|
||||||
@@ -733,8 +731,8 @@ TRoster::HandleGetAppList(BMessage* request)
|
|||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
// get the parameters
|
// get the parameters
|
||||||
const char* signature;
|
const char* signature;
|
||||||
if (request->FindString("signature", &signature) != B_OK)
|
error = request->FindString("signature", &signature);
|
||||||
signature = NULL;
|
|
||||||
// reply to the request
|
// reply to the request
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
BMessage reply(B_REG_SUCCESS);
|
BMessage reply(B_REG_SUCCESS);
|
||||||
|
|||||||
@@ -705,19 +705,17 @@ KDiskDeviceManager::CreateDevice(const char* path, bool* newlyCreated)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == B_OK) {
|
// scan for partitions
|
||||||
// scan for partitions
|
_ScanPartition(device, false);
|
||||||
_ScanPartition(device, false);
|
device->UnmarkBusy(true);
|
||||||
device->UnmarkBusy(true);
|
|
||||||
|
|
||||||
_NotifyDeviceEvent(device, B_DEVICE_ADDED,
|
_NotifyDeviceEvent(device, B_DEVICE_ADDED,
|
||||||
B_DEVICE_REQUEST_DEVICE_LIST);
|
B_DEVICE_REQUEST_DEVICE_LIST);
|
||||||
|
|
||||||
if (newlyCreated)
|
if (newlyCreated)
|
||||||
*newlyCreated = true;
|
*newlyCreated = true;
|
||||||
|
|
||||||
return device->ID();
|
return device->ID();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
@@ -357,8 +357,8 @@ log_vwrite(log_context lc, int category, int level, const char *format,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!did_vsprintf) {
|
if (!did_vsprintf) {
|
||||||
(void)vsprintf(lc->buffer, format, args);
|
int len = vsnprintf(lc->buffer, LOG_BUFFER_SIZE, format, args);
|
||||||
if (strlen(lc->buffer) > (size_t)LOG_BUFFER_SIZE) {
|
if (len > (size_t)LOG_BUFFER_SIZE) {
|
||||||
syslog(LOG_CRIT,
|
syslog(LOG_CRIT,
|
||||||
"memory overrun in log_vwrite()");
|
"memory overrun in log_vwrite()");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ pthread_setcancelstate(int state, int *_oldState)
|
|||||||
|
|
||||||
// return the old state
|
// return the old state
|
||||||
if (_oldState != NULL) {
|
if (_oldState != NULL) {
|
||||||
*_oldState = (oldFlags & PTHREAD_CANCEL_ENABLE) != 0
|
*_oldState = (oldFlags & THREAD_CANCEL_ENABLED) != 0
|
||||||
? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE;
|
? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ load_driver_settings_from_file(int file, const char *driverName)
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
put_string(char **_buffer, fssh_size_t *_bufferSize, char *string)
|
put_string(char **_buffer, fssh_ssize_t *_bufferSize, char *string)
|
||||||
{
|
{
|
||||||
fssh_size_t length, reserved, quotes;
|
fssh_size_t length, reserved, quotes;
|
||||||
char *buffer = *_buffer, c;
|
char *buffer = *_buffer, c;
|
||||||
@@ -481,7 +481,7 @@ put_string(char **_buffer, fssh_size_t *_bufferSize, char *string)
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
put_chars(char **_buffer, fssh_size_t *_bufferSize, const char *chars)
|
put_chars(char **_buffer, fssh_ssize_t *_bufferSize, const char *chars)
|
||||||
{
|
{
|
||||||
char *buffer = *_buffer;
|
char *buffer = *_buffer;
|
||||||
fssh_size_t length;
|
fssh_size_t length;
|
||||||
@@ -507,7 +507,7 @@ put_chars(char **_buffer, fssh_size_t *_bufferSize, const char *chars)
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
put_char(char **_buffer, fssh_size_t *_bufferSize, char c)
|
put_char(char **_buffer, fssh_ssize_t *_bufferSize, char c)
|
||||||
{
|
{
|
||||||
char *buffer = *_buffer;
|
char *buffer = *_buffer;
|
||||||
|
|
||||||
@@ -527,15 +527,15 @@ put_char(char **_buffer, fssh_size_t *_bufferSize, char c)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
put_level_space(char **_buffer, fssh_size_t *_bufferSize, int32_t level)
|
put_level_space(char **_buffer, fssh_ssize_t *_bufferSize, int32_t level)
|
||||||
{
|
{
|
||||||
while (level-- > 0)
|
while (level-- > 0)
|
||||||
put_char(_buffer, _bufferSize, '\t');
|
put_char(_buffer, _bufferSize, '\t');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
put_parameter(char **_buffer, fssh_size_t *_bufferSize,
|
put_parameter(char **_buffer, fssh_ssize_t *_bufferSize,
|
||||||
struct fssh_driver_parameter *parameter, int32_t level, bool flat)
|
struct fssh_driver_parameter *parameter, int32_t level, bool flat)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
@@ -569,8 +569,6 @@ put_parameter(char **_buffer, fssh_size_t *_bufferSize,
|
|||||||
put_level_space(_buffer, _bufferSize, level);
|
put_level_space(_buffer, _bufferSize, level);
|
||||||
put_chars(_buffer, _bufferSize, flat ? "}" : "}\n");
|
put_chars(_buffer, _bufferSize, flat ? "}" : "}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return *_bufferSize >= 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -768,10 +766,10 @@ fssh_parse_driver_settings_string(const char *settingsString)
|
|||||||
*/
|
*/
|
||||||
fssh_status_t
|
fssh_status_t
|
||||||
fssh_get_driver_settings_string(void *_handle, char *buffer,
|
fssh_get_driver_settings_string(void *_handle, char *buffer,
|
||||||
fssh_size_t *_bufferSize, bool flat)
|
fssh_ssize_t *_bufferSize, bool flat)
|
||||||
{
|
{
|
||||||
settings_handle *handle = (settings_handle *)_handle;
|
settings_handle *handle = (settings_handle *)_handle;
|
||||||
fssh_size_t bufferSize = *_bufferSize;
|
fssh_ssize_t bufferSize = *_bufferSize;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
if (!check_handle(handle) || !buffer || *_bufferSize == 0)
|
if (!check_handle(handle) || !buffer || *_bufferSize == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user