Skip to content

Commit 249a63e

Browse files
committed
Fix some compiler warnings
1 parent 88df0b7 commit 249a63e

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

artpaint/controls/ColorSlider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ColorSlider::SetColors(BList* colors)
123123
uint32 numColors = colors->CountItems();
124124
uint32 step = ceil((float)RES / (numColors - 1));
125125

126-
for (int i = 0; i < numColors - 1; ++i) {
126+
for (uint32 i = 0; i < numColors - 1; ++i) {
127127
start.word = *((uint32*)colors->ItemAt(i));
128128
end.word = *((uint32*)colors->ItemAt(i + 1));
129129

@@ -134,7 +134,7 @@ ColorSlider::SetColors(BList* colors)
134134
float b_delta = (float)(end.bytes[0] - start.bytes[0]) / (float)step;
135135
float a_delta = (float)(end.bytes[3] - start.bytes[3]) / (float)step;
136136

137-
for (int j = 0; j < step; ++j) {
137+
for (uint32 j = 0; j < step; ++j) {
138138
*bits++ = pixel.word;
139139

140140
pixel.bytes[0] = min_c(255, pixel.bytes[0] + ceil(b_delta));

artpaint/layers/Layer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ Layer::calc_mini_image()
250250
while ((x < miniature_width) && (fLayerPreviewThreads == 0)) {
251251
color.word = *(big_image + ((int32)(y * dy)) * b_bpr + (int32)(x * dx));
252252

253-
*small_image++ = src_over_fixed(*small_image, color.word);
254-
253+
*small_image = src_over_fixed(*small_image, color.word);
254+
small_image++;
255255
x++;
256256
}
257257
y++;

artpaint/paintwindow/PaintWindow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ PaintWindow::openMenuBar()
10991099
{ "SEPARATOR", 0, 0, 0, NULL, "SEPARATOR" } // separator
11001100
};
11011101

1102-
for (uint32 i = 0; i < (sizeof(fileMenu) / sizeof(menu_item)); ++i) {
1102+
for (uint32 i = 0; i < B_COUNT_OF(fileMenu); ++i) {
11031103
_AddMenuItems(menu, fileMenu[i].label, fileMenu[i].what, fileMenu[i].shortcut,
11041104
fileMenu[i].modifiers, fileMenu[i].target, fileMenu[i].help);
11051105
}
@@ -1121,7 +1121,7 @@ PaintWindow::openMenuBar()
11211121
{ "SEPARATOR", 0, 0, 0, NULL, "SEPARATOR" } // separator
11221122
};
11231123

1124-
for (uint32 i = 0; i < (sizeof(editMenu) / sizeof(menu_item)); ++i) {
1124+
for (uint32 i = 0; i < B_COUNT_OF(editMenu); ++i) {
11251125
_AddMenuItems(menu, editMenu[i].label, editMenu[i].what, editMenu[i].shortcut,
11261126
editMenu[i].modifiers, editMenu[i].target, editMenu[i].help);
11271127
}
@@ -1341,7 +1341,7 @@ PaintWindow::openMenuBar()
13411341

13421342
float zoomLevels[] = {0.25, 0.50, 1.0, 2.0, 4.0, 8.0, 16.0};
13431343

1344-
for (int i = 0; i < sizeof(zoomLevels) / sizeof(float); ++i) {
1344+
for (uint32 i = 0; i < B_COUNT_OF(zoomLevels); ++i) {
13451345
a_message = new BMessage(HS_SET_MAGNIFYING_SCALE);
13461346
a_message->AddFloat("magnifying_scale", zoomLevels[i]);
13471347

@@ -1654,7 +1654,7 @@ PaintWindow::_PreferredSize(Image* image) const
16541654
if (status == B_OK && tokens && tokenCount > 0) {
16551655
for (int32 i = 0; i < tokenCount; ++i) {
16561656
if (client_window_info* windowInfo = get_window_info(tokens[i])) {
1657-
if (!windowInfo->is_mini && !windowInfo->show_hide_level > 0) {
1657+
if (!windowInfo->is_mini && !(windowInfo->show_hide_level > 0)) {
16581658
tabHeight = windowInfo->tab_height;
16591659
borderSize = windowInfo->border_size;
16601660
free(windowInfo);
@@ -1779,7 +1779,7 @@ PaintWindow::_SaveImage(BMessage* message)
17791779
}
17801780
// here translate the data using a BitmapStream-object
17811781
BBitmap* bitmap = fImageView->ReturnImage()->ReturnRenderedImage();
1782-
printf("Bitmap at 0,0: 0x%8lx\n", *((uint32*)(bitmap->Bits())));
1782+
printf("Bitmap at 0,0: 0x%8" B_PRIx32 "\n", *((uint32*)(bitmap->Bits())));
17831783

17841784
// TODO: check if we leak here
17851785
BBitmapStream* bitmapStream = new BBitmapStream(bitmap);

artpaint/paintwindow/StatusView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ StatusView::SetCoordinates(BPoint point, BPoint reference, bool use_reference)
150150
if (use_reference) {
151151
int32 dx = (int32)fabs(point.x - reference.x) + 1;
152152
int32 dy = (int32)fabs(point.y - reference.y) + 1;
153-
sprintf(coords, "X: %ld (%ld) Y: %ld (%ld)", x, dx, y, dy);
153+
sprintf(coords, "X: %" B_PRId32 " (%" B_PRId32 ") Y: %" B_PRId32 " (%" B_PRId32 ")", x, dx, y, dy);
154154
} else
155-
sprintf(coords, "X: %ld Y: %ld", x, y);
155+
sprintf(coords, "X: %" B_PRId32 " Y: %" B_PRId32, x, y);
156156

157157
coordinate_view->SetText(coords);
158158
}

artpaint/tools/Brush.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ Brush::print_brush(uint32** b)
475475
printf("Brush:\n");
476476
for (int32 y = 0; y < height_; y++) {
477477
for (int32 x = 0; x < width_; x++)
478-
printf("%ld ", b[y][x]);
478+
printf("%" B_PRIu32 " ", b[y][x]);
479479

480480
printf("\n");
481481
}

artpaint/tools/EllipseTool.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,12 @@ EllipseToolConfigView::MessageReceived(BMessage* message)
478478
switch (message->what) {
479479
case OPTION_CHANGED:
480480
{
481-
if (message->FindInt32("option") == FILL_ENABLED_OPTION)
481+
if (message->FindInt32("option") == FILL_ENABLED_OPTION) {
482482
if (fFillEllipse->Value() == B_CONTROL_ON)
483483
fLineWidth->SetEnabled(FALSE);
484484
else
485485
fLineWidth->SetEnabled(TRUE);
486+
}
486487
} break;
487488
}
488489
}

artpaint/viewmanipulators/TextManipulator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,14 @@ TextManipulator::Restore(const BMessage& settings)
510510
ssize_t dataSize;
511511
status |= settings.FindData("font", B_RAW_TYPE, &data, &dataSize);
512512
if (status == B_OK && dataSize == sizeof(BFont))
513-
memcpy(&fSettings.font, data, sizeof(BFont));
513+
fSettings.font = *(BFont*)data;
514514

515515
int32 i = 0;
516516
fSettings.text_color_array = new rgb_color[fSettings.text_array_length];
517517
while ((status |= settings.FindData("text_color_array", B_RGB_COLOR_TYPE, i,
518518
&data, &dataSize)) == B_OK) {
519519
if (dataSize == sizeof(rgb_color))
520-
memcpy(&fSettings.text_color_array[i], data, sizeof(rgb_color));
520+
fSettings.text_color_array[i] = *(rgb_color*)data;
521521
i++;
522522
}
523523

@@ -982,7 +982,7 @@ TextManipulatorSettings::operator==(const TextManipulatorSettings& s)
982982
bool
983983
TextManipulatorSettings::operator!=(const TextManipulatorSettings& settings)
984984
{
985-
return (*this != settings);
985+
return !(*this == settings);
986986
}
987987

988988

artpaint/windows/GlobalSetupWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ GlobalSetupWindow::TransparencyControlView::TransparencyControlView()
419419
BRect frame(0, 0, size * 250, size * 100);
420420

421421
fBgContainer = new PreviewPane(frame);
422-
BRect frameSwatch = (0, 0, size * 24, size * 24);
422+
BRect frameSwatch(0, 0, size * 24, size * 24);
423423

424424
fColorSwatch1 = new ColorSwatch(frameSwatch, "color1");
425425
fColorSwatch1->SetToolTip(B_TRANSLATE("Drop a color from the Colors window"));

0 commit comments

Comments
 (0)