Fix Visual Studio build warnings

This commit is contained in:
Albrecht Schlosser 2022-02-26 18:19:43 +01:00
parent e092b562ba
commit 7810cda145
4 changed files with 10 additions and 9 deletions

View File

@ -27,6 +27,7 @@
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Menu_.H>
#include <FL/fl_string_functions.h>
#include "../src/flstring.h"
/** \class Shortcut_Button
@ -299,7 +300,7 @@ int Fluid_Coord_Input::eval(uchar *&s, int prio) const {
int Fluid_Coord_Input::eval(const char *s) const
{
// duplicate the text, so we can modify it
uchar *buf = (uchar*)strdup(s);
uchar *buf = (uchar*)fl_strdup(s);
uchar *src = buf, *dst = buf;
// remove all whitespace to make the parser easier
for (;;) {

View File

@ -556,7 +556,7 @@ int Fl_Message_Box::handle(int e) {
case FL_KEYBOARD:
case FL_SHORTCUT:
if (Fl::event_key() == 'c' && mods == FL_COMMAND) {
Fl::copy(label(), strlen(label()), 1);
Fl::copy(label(), int(strlen(label())), 1);
return 1;
}
break;

View File

@ -712,7 +712,7 @@ void BlockWindow::draw() {
time_t curtime = time(NULL);
frames_ ++;
if (curtime > frame_time_) {
frames_per_second_ = (frames_per_second_ + 3 * frames_ / (curtime - frame_time_)) / 4;
frames_per_second_ = (frames_per_second_ + 3 * frames_ / int(curtime - frame_time_)) / 4;
frames_ = 0;
frame_time_ = curtime;
}
@ -1054,7 +1054,7 @@ void BlockWindow::timeout_cb(BlockWindow *bw) {
for (j = 0, b = c->blocks; j < BLOCK_ROWS; j ++, b ++) {
b->bomb = bw->num_colors_ > 3 && (rand() & 127) < bw->num_colors_;
b->color = 1 + (rand() % bw->num_colors_);
b->y = j * (BLOCK_SIZE + 8) + 24;
b->y = float(j * (BLOCK_SIZE + 8) + 24);
}
}
}

View File

@ -37,20 +37,20 @@ void arc(int xi, int yi, int w, int h, double a1, double a2)
double x = xi + rx + 0.5;
double y = yi + ry + 0.5;
double circ = M_PI*0.5*(rx+ry);
int i, segs = circ * (a2-a1) / 100;
int i, segs = int(circ * (a2-a1) / 100);
if (segs<3) segs = 3;
a1 = a1/180*M_PI;
a2 = a2/180*M_PI;
double step = (a2-a1)/segs;
int nx = x + cos(a1)*rx;
int ny = y - sin(a1)*ry;
int nx = int(x + cos(a1)*rx);
int ny = int(y - sin(a1)*ry);
fl_point(nx, ny);
for (i=segs; i>0; i--) {
a1 += step;
nx = x + cos(a1)*rx;
ny = y - sin(a1)*ry;
nx = int(x + cos(a1)*rx);
ny = int(y - sin(a1)*ry);
fl_point(nx, ny);
}
}