Fix 'always true' and 'always false' if statements

Change-Id: If4056c8767184785b24489a678af498842e54cef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2121
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Zotyamester
2020-09-10 19:48:19 +00:00
committed by Adrien Destugues
parent 471ecc8763
commit aae45bbcb4
5 changed files with 39 additions and 51 deletions
@@ -114,7 +114,8 @@ status_t INIT_ACCELERANT(int the_fd)
result = init_common(the_fd); result = init_common(the_fd);
/* bail out if the common initialization failed */ /* bail out if the common initialization failed */
if (result != B_OK) goto error0; if (result != B_OK)
goto error0;
// LOG now available: !NULL si // LOG now available: !NULL si
/* ensure that INIT_ACCELERANT is executed just once (copies should be clones) */ /* ensure that INIT_ACCELERANT is executed just once (copies should be clones) */
@@ -131,7 +132,8 @@ status_t INIT_ACCELERANT(int the_fd)
result = gx00_general_powerup(); result = gx00_general_powerup();
/* bail out if it failed */ /* bail out if it failed */
if (result != B_OK) goto error1; if (result != B_OK)
goto error1;
/* /*
Now would be a good time to figure out what video modes your card supports. Now would be a good time to figure out what video modes your card supports.
@@ -141,10 +143,8 @@ status_t INIT_ACCELERANT(int the_fd)
Everybody else get's a read-only clone. Everybody else get's a read-only clone.
*/ */
result = create_mode_list(); result = create_mode_list();
if (result != B_OK) if (result != B_OK)
{
goto error1; goto error1;
}
/* /*
Put the cursor at the start of the frame buffer. The typical 64x64 4 color Put the cursor at the start of the frame buffer. The typical 64x64 4 color
@@ -188,9 +188,6 @@ status_t INIT_ACCELERANT(int the_fd)
/* note that overlay is not in use (for gx00_bes_move_overlay()) */ /* note that overlay is not in use (for gx00_bes_move_overlay()) */
si->overlay.active = false; si->overlay.active = false;
/* bail out if something failed */
if (result != B_OK) goto error1;
/* initialise various cursor stuff*/ /* initialise various cursor stuff*/
gx00_crtc_cursor_init(); gx00_crtc_cursor_init();
@@ -28,7 +28,8 @@ static status_t init_common(int the_fd) {
gpd.magic = NV_PRIVATE_DATA_MAGIC; gpd.magic = NV_PRIVATE_DATA_MAGIC;
/* contact driver and get a pointer to the registers and shared data */ /* contact driver and get a pointer to the registers and shared data */
result = ioctl(fd, NV_GET_PRIVATE_DATA, &gpd, sizeof(gpd)); result = ioctl(fd, NV_GET_PRIVATE_DATA, &gpd, sizeof(gpd));
if (result != B_OK) goto error0; if (result != B_OK)
goto error0;
/* clone the shared area for our use */ /* clone the shared area for our use */
shared_info_area = clone_area(DRIVER_PREFIX " shared", (void **)&si, B_ANY_ADDRESS, shared_info_area = clone_area(DRIVER_PREFIX " shared", (void **)&si, B_ANY_ADDRESS,
@@ -112,7 +113,8 @@ status_t INIT_ACCELERANT(int the_fd)
result = init_common(the_fd); result = init_common(the_fd);
/* bail out if the common initialization failed */ /* bail out if the common initialization failed */
if (result != B_OK) goto error0; if (result != B_OK)
goto error0;
// LOG now available: !NULL si // LOG now available: !NULL si
/* ensure that INIT_ACCELERANT is executed just once (copies should be clones) */ /* ensure that INIT_ACCELERANT is executed just once (copies should be clones) */
@@ -126,7 +128,8 @@ status_t INIT_ACCELERANT(int the_fd)
result = nv_general_powerup(); result = nv_general_powerup();
/* bail out if it failed */ /* bail out if it failed */
if (result != B_OK) goto error1; if (result != B_OK)
goto error1;
/* /*
Now would be a good time to figure out what video modes your card supports. Now would be a good time to figure out what video modes your card supports.
@@ -136,10 +139,8 @@ status_t INIT_ACCELERANT(int the_fd)
Everybody else get's a read-only clone. Everybody else get's a read-only clone.
*/ */
result = create_mode_list(); result = create_mode_list();
if (result != B_OK) if (result != B_OK)
{
goto error1; goto error1;
}
/* /*
Put the cursor at the start of the frame buffer. Put the cursor at the start of the frame buffer.
@@ -188,9 +189,6 @@ status_t INIT_ACCELERANT(int the_fd)
/* note that overlay is not in use (for nv_bes_move_overlay()) */ /* note that overlay is not in use (for nv_bes_move_overlay()) */
si->overlay.active = false; si->overlay.active = false;
/* bail out if something failed */
if (result != B_OK) goto error1;
/* initialise various cursor stuff */ /* initialise various cursor stuff */
head1_cursor_init(); head1_cursor_init();
if (si->ps.secondary_head) head2_cursor_init(); if (si->ps.secondary_head) head2_cursor_init();
+7 -9
View File
@@ -28,7 +28,8 @@ static status_t init_common(int the_fd) {
gpd.magic = VIA_PRIVATE_DATA_MAGIC; gpd.magic = VIA_PRIVATE_DATA_MAGIC;
/* contact driver and get a pointer to the registers and shared data */ /* contact driver and get a pointer to the registers and shared data */
result = ioctl(fd, ENG_GET_PRIVATE_DATA, &gpd, sizeof(gpd)); result = ioctl(fd, ENG_GET_PRIVATE_DATA, &gpd, sizeof(gpd));
if (result != B_OK) goto error0; if (result != B_OK)
goto error0;
/* clone the shared area for our use */ /* clone the shared area for our use */
shared_info_area = clone_area(DRIVER_PREFIX " shared", (void **)&si, B_ANY_ADDRESS, shared_info_area = clone_area(DRIVER_PREFIX " shared", (void **)&si, B_ANY_ADDRESS,
@@ -112,14 +113,16 @@ status_t INIT_ACCELERANT(int the_fd) {
result = init_common(the_fd); result = init_common(the_fd);
/* bail out if the common initialization failed */ /* bail out if the common initialization failed */
if (result != B_OK) goto error0; if (result != B_OK)
goto error0;
// LOG now available: !NULL si // LOG now available: !NULL si
/* call the device specific init code */ /* call the device specific init code */
result = eng_general_powerup(); result = eng_general_powerup();
/* bail out if it failed */ /* bail out if it failed */
if (result != B_OK) goto error1; if (result != B_OK)
goto error1;
/* /*
Now would be a good time to figure out what video modes your card supports. Now would be a good time to figure out what video modes your card supports.
@@ -129,10 +132,8 @@ status_t INIT_ACCELERANT(int the_fd) {
Everybody else get's a read-only clone. Everybody else get's a read-only clone.
*/ */
result = create_mode_list(); result = create_mode_list();
if (result != B_OK) if (result != B_OK)
{
goto error1; goto error1;
}
/* /*
Put the cursor at the start of the frame buffer. Put the cursor at the start of the frame buffer.
@@ -176,9 +177,6 @@ status_t INIT_ACCELERANT(int the_fd) {
/* note that overlay is not in use (for eng_bes_move_overlay()) */ /* note that overlay is not in use (for eng_bes_move_overlay()) */
si->overlay.active = false; si->overlay.active = false;
/* bail out if something failed */
if (result != B_OK) goto error1;
/* initialise various cursor stuff */ /* initialise various cursor stuff */
head1_cursor_init(); head1_cursor_init();
if (si->ps.secondary_head) head2_cursor_init(); if (si->ps.secondary_head) head2_cursor_init();
@@ -1774,11 +1774,9 @@ emuxki_gpr_set(emuxki_dev *card, emuxki_gpr *gpr, int32 type, float *values)
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (values[i]>gpr->max_gain || values[i]<gpr->min_gain) if (values[i]>gpr->max_gain || values[i]<gpr->min_gain)
return; return;
index = (int32)(values[i] / gpr->granularity); index = values[i] / gpr->granularity;
if (index > sizeof(db_table)/sizeof(db_table[0])) if (index > sizeof(db_table)/sizeof(db_table[0]))
index = sizeof(db_table)/sizeof(db_table[0]); index = sizeof(db_table)/sizeof(db_table[0]);
else if (index < 0)
index = 0;
LOG(("emuxki_set_gpr gpr: %d \n", gpr->gpr + i)); LOG(("emuxki_set_gpr gpr: %d \n", gpr->gpr + i));
LOG(("emuxki_set_gpr values[i]: %g \n", values[i])); LOG(("emuxki_set_gpr values[i]: %g \n", values[i]));
LOG(("emuxki_set_gpr index: %u \n", index)); LOG(("emuxki_set_gpr index: %u \n", index));
@@ -572,30 +572,27 @@ FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
|| (statData.IsEsoteric() && volume->GetHideEsoteric())) { || (statData.IsEsoteric() && volume->GetHideEsoteric())) {
continue; continue;
} }
// get the name
size_t nameLen = 0;
const char *name = item.EntryNameAt(index, &nameLen);
if (!name || nameLen == 0) // bad data: skip it gracefully
continue;
// fill in the entry name -- checks whether the
// entry fits into the buffer
error = set_dirent_name(buffer, bufferSize, name, nameLen);
if (error == B_OK) { if (error == B_OK) {
// get the name // fill in the other data
size_t nameLen = 0; buffer->d_dev = volume->GetID();
const char *name = item.EntryNameAt(index, &nameLen); buffer->d_ino = VNode::GetIDFor(dirID, objectID);
if (!name || nameLen == 0) // bad data: skip it gracefully *count = 1;
continue;
// fill in the entry name -- checks whether the
// entry fits into the buffer
error = set_dirent_name(buffer, bufferSize, name,
nameLen);
if (error == B_OK) {
// fill in the other data
buffer->d_dev = volume->GetID();
buffer->d_ino = VNode::GetIDFor(dirID, objectID);
*count = 1;
PRINT(("Successfully read entry: dir: (%Ld: %ld, %ld), name: `%s', " PRINT(("Successfully read entry: dir: (%Ld: %ld, %ld), name: `%s', "
"id: (%Ld, %ld, %ld), reclen: %hu\n", node->GetID(), node->GetDirID(), "id: (%Ld, %ld, %ld), reclen: %hu\n", node->GetID(), node->GetDirID(),
node->GetObjectID(), buffer->d_name, buffer->d_ino, dirID, objectID, node->GetObjectID(), buffer->d_name, buffer->d_ino, dirID, objectID,
buffer->d_reclen)); buffer->d_reclen));
if (!strcmp("..", buffer->d_name)) if (!strcmp("..", buffer->d_name))
iterator->SetEncounteredDotDot(true); iterator->SetEncounteredDotDot(true);
done = true; done = true;
} }
}
} }
if (error == B_ENTRY_NOT_FOUND) { if (error == B_ENTRY_NOT_FOUND) {
if (iterator->EncounteredDotDot()) { if (iterator->EncounteredDotDot()) {