FLTK logo

[master] ef86d9a - Fix more MSVC warnings in test apps (#109)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] ef86d9a - Fix more MSVC warnings in test apps (#109) "Albrecht Schlosser" Aug 31, 2021  
 
commit ef86d9acedc8d8a5005cdae45070cfc5f5789964
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Tue Aug 31 17:49:31 2021 +0200
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Tue Aug 31 17:49:31 2021 +0200

    Fix more MSVC warnings in test apps (#109)
    
     - test/checkers.cxx
     - test/cube.cxx
     - test/offscreen.cxx
     - test/unittest_simple_terminal.cxx
     - test/utf8.cxx

 test/checkers.cxx                 |  2 +-
 test/cube.cxx                     |  4 ++--
 test/offscreen.cxx                |  4 ++--
 test/unittest_simple_terminal.cxx |  2 +-
 test/utf8.cxx                     | 12 ++++++------
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git test/checkers.cxx test/checkers.cxx
index 95e670c..24dd47c 100644
--- test/checkers.cxx
+++ test/checkers.cxx
@@ -1305,7 +1305,7 @@ int didabort(void) {
 }
 
 int main(int argc, char **argv) {
-  seed = time(0);
+  seed = (int)time(0);
   newgame();
 #ifdef BOTH
   fl_register_images();
diff --git test/cube.cxx test/cube.cxx
index c067d49..733af20 100644
--- test/cube.cxx
+++ test/cube.cxx
@@ -100,14 +100,14 @@ void cube_box::draw() {
     glEnable(GL_DEPTH_TEST);
     glFrustum(-1,1,-1,1,2,10000);
     glTranslatef(0,0,-10);
-    glClearColor(0.4, 0.4, 0.4, 0);
+    glClearColor(0.4f, 0.4f, 0.4f, 0);
   }
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glPushMatrix();
   glRotatef(float(lasttime*1.6),0,0,1);
   glRotatef(float(lasttime*4.2),1,0,0);
   glRotatef(float(lasttime*2.3),0,1,0);
-  glTranslatef(-1.0, 1.2f, -1.5);
+  glTranslatef(-1.0f, 1.2f, -1.5f);
   glScalef(float(size),float(size),float(size));
   drawcube(wire);
   glPopMatrix();
diff --git test/offscreen.cxx test/offscreen.cxx
index b22218f..c43ffaa 100644
--- test/offscreen.cxx
+++ test/offscreen.cxx
@@ -33,7 +33,7 @@ static const int win_size = 512;
 static const int first_useful_color = 56;
 static const int last_useful_color = 255;
 static const int num_iterations = 300;
-static const double max_line_width = 9.0;
+static const int max_line_width = 9;
 static const double delta_time = 0.1;
 
 /*****************************************************************************/
@@ -256,7 +256,7 @@ int main(int argc, char **argv)
 
   main_window->show(argc, argv);
 
-  srand(time(NULL)); // seed the random sequence generator
+  srand((unsigned int)time(NULL)); // seed the random sequence generator
 
   Fl::add_timeout(delta_time, oscr_anim);
 
diff --git test/unittest_simple_terminal.cxx test/unittest_simple_terminal.cxx
index bfda6fe..645f996 100644
--- test/unittest_simple_terminal.cxx
+++ test/unittest_simple_terminal.cxx
@@ -88,7 +88,7 @@ public:
       { 0x33333300, FL_COURIER_BOLD, 14 },  // "\033[8m"      8   white 20%
       { 0x1a1a1a00, FL_COURIER_BOLD, 14 },  // "\033[9m"      9   white 10%
     };
-    int tty_h = (h/3.5);
+    int tty_h = (int)(h/3.5);
     int tty_y1 = y+(tty_h*0)+20;
     int tty_y2 = y+(tty_h*1)+40;
     int tty_y3 = y+(tty_h*2)+60;
diff --git test/utf8.cxx test/utf8.cxx
index f4b8ff3..062e4ba 100644
--- test/utf8.cxx
+++ test/utf8.cxx
@@ -324,8 +324,8 @@ static void create_font_widget()
   ulong c;
   for (c = ' '+1; c < 127; c++) {
     if (!(c&0x1f)) label[i++]='\n';
-    if (c=='@') label[i++]=c;
-    label[i++]=c;
+    if (c == '@') label[i++] = '@';
+    label[i++] = (char)c;
   }
   label[i++] = '\n';
   for (c = 0xA1; c < 0x600; c += 9) {
@@ -491,8 +491,8 @@ public:
   void drawtext(int X, int Y, int W, int H) {
     fl_color(textcolor());
     fl_font(textfont(), textsize());
-    fl_rtl_draw(value(), strlen(value()),
-                X + W, Y + fl_height() -fl_descent());
+    fl_rtl_draw(value(), (int)strlen(value()),
+                X + W, Y + fl_height() - fl_descent());
   }
 };
 
@@ -570,8 +570,8 @@ int main(int argc, char** argv)
     "\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xe2\xee\xf6\xfc\xe3\x31\x32\x33";
 
   char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1);
-  int l = fl_utf8froma(utf8, (strlen(latin1) * 5 + 1), latin1, strlen(latin1));
-
+  int l = fl_utf8froma(utf8, (unsigned int)strlen(latin1) * 5 + 1,
+                       latin1, (unsigned int)strlen(latin1));
   make_font_chooser();
   extra_font = FL_TIMES_BOLD_ITALIC;
 
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.