Fix MSVC compiler warnings (PR #267)

This commit is contained in:
fire-eggs 2021-08-30 10:51:29 -04:00 committed by Albrecht Schlosser
parent 975d34de43
commit 753631a0b5
4 changed files with 12 additions and 12 deletions

View File

@ -52,13 +52,13 @@ public:
} }
}; };
const float factor = 1.3; const float factor = 1.3f;
void shrink(Fl_Widget *wdgt, void *data) void shrink(Fl_Widget *wdgt, void *data)
{ {
Fl_Window *win = wdgt->window(); Fl_Window *win = wdgt->window();
int old = win->w(); int old = win->w();
win->size(old/factor, old/factor); win->size(int(old/factor), int(old/factor));
if (win->w() <= *(int*)data) wdgt->deactivate(); if (win->w() <= *(int*)data) wdgt->deactivate();
} }
@ -66,7 +66,7 @@ void enlarge(Fl_Widget *wdgt, void *data)
{ {
Fl_Window *win = wdgt->window(); Fl_Window *win = wdgt->window();
int old = win->w(); int old = win->w();
win->size(old*factor, old*factor); win->size(int(old*factor), int(old*factor));
((Fl_Widget*)data)->activate(); ((Fl_Widget*)data)->activate();
} }
@ -80,7 +80,7 @@ Fl_RGB_Image* prepare_shape(int w)
fl_color(FL_WHITE); fl_color(FL_WHITE);
fl_pie(2,2,w-4,w-4,0,360); fl_pie(2,2,w-4,w-4,0,360);
fl_color(FL_BLACK); fl_color(FL_BLACK);
fl_pie(0.7*w,w/2,w/4,w/4,0,360); fl_pie(int(0.7*w),w/2,w/4,w/4,0,360);
Fl_RGB_Image* img = surf->image(); Fl_RGB_Image* img = surf->image();
delete surf; delete surf;
Fl_Surface_Device::pop_current(); Fl_Surface_Device::pop_current();

View File

@ -102,7 +102,7 @@ public:
input->resize(X,Y,W,H); // Move Fl_Input widget there input->resize(X,Y,W,H); // Move Fl_Input widget there
char s[30]; sprintf(s, "%d", values[R][C]); // Load input widget with cell's current value char s[30]; sprintf(s, "%d", values[R][C]); // Load input widget with cell's current value
input->value(s); input->value(s);
input->position(0,strlen(s)); // Select entire input field input->position(0,int(strlen(s))); // Select entire input field
input->show(); // Show the input widget, now that we've positioned it input->show(); // Show the input widget, now that we've positioned it
input->take_focus(); input->take_focus();
} }

View File

@ -79,7 +79,7 @@ public:
input->resize(X,Y,W,H); // Move Fl_Input widget there input->resize(X,Y,W,H); // Move Fl_Input widget there
char s[30]; sprintf(s, "%d", values[R][C]); // Load input widget with cell's current value char s[30]; sprintf(s, "%d", values[R][C]); // Load input widget with cell's current value
input->value(s); input->value(s);
input->position(0,strlen(s)); // Select entire input field input->position(0, int(strlen(s))); // Select entire input field
input->show(); // Show the input widget, now that we've positioned it input->show(); // Show the input widget, now that we've positioned it
input->take_focus(); // Put keyboard focus into the input widget input->take_focus(); // Put keyboard focus into the input widget
} }

View File

@ -53,9 +53,9 @@ static void make_images() {
// A fading sphere // A fading sphere
uchar alpha = 255; uchar alpha = 255;
if (i < FRAMES / 2) if (i < FRAMES / 2)
alpha = 255 * (i / ((float) FRAMES / 2)); alpha = uchar(255 * (i / ((float) FRAMES / 2)));
else else
alpha = 255 * (((FRAMES / 2) - (i - FRAMES / 2)) / ((float) FRAMES / 2)); alpha = uchar(255 * (((FRAMES / 2) - (i - FRAMES / 2)) / ((float) FRAMES / 2)));
const int spherew = 60; const int spherew = 60;
const int spherex = (DIM - spherew) / 2; const int spherex = (DIM - spherew) / 2;
@ -71,11 +71,11 @@ static void make_images() {
continue; continue;
const float fill = dist / maxdist; const float fill = dist / maxdist;
const uchar grey = fill * 255; const uchar grey = uchar(fill * 255);
uchar myalpha = alpha; uchar myalpha = alpha;
if (fill > 0.9) if (fill > 0.9)
myalpha *= (1.0f - fill) * 10; myalpha *= uchar((1.0f - fill) * 10);
data[y * DIM * 4 + x * 4 + 0] = grey; data[y * DIM * 4 + x * 4 + 0] = grey;
data[y * DIM * 4 + x * 4 + 1] = grey; data[y * DIM * 4 + x * 4 + 1] = grey;
@ -85,9 +85,9 @@ static void make_images() {
} }
// A moving blob // A moving blob
const float pos = (i / (float) FRAMES) * 2 - 0.5; const float pos = (i / (float) FRAMES) * 2 - 0.5f;
const int xoffset = pos * DIM; const int xoffset = int(pos * DIM);
const int yoffset = 2 * DIM / 3; const int yoffset = 2 * DIM / 3;
const int w = DIM / 4; const int w = DIM / 4;