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