From 6784ae807cf327bc1026dd7efa0bf7f4dd501a06 Mon Sep 17 00:00:00 2001
From: Albrecht Schlosser <albrechts.fltk@online.de>
Date: Tue, 10 Dec 2024 23:12:22 +0100
Subject: [PATCH] Fix compiler warnings (VS 2019)

Found with warning level: /W3
---
 src/Fl_win32.cxx                                | 2 +-
 src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx | 6 +++---
 test/trackball.c                                | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index a8fde1162..6ba193f3c 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1609,7 +1609,7 @@ content  key    keyboard layout
             } else {
               Fl::e_text = ( (Fl::e_state & FL_SHIFT) ? plus_other_char_utf8 : (char*)"+" );
             }
-            Fl::e_length = strlen(Fl::e_text);
+            Fl::e_length = (int)strlen(Fl::e_text);
           }
         }
         // end of processing of the +-containing key
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
index bc89e73df..4b74c76cb 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
@@ -154,7 +154,7 @@ int Fl_PDF_GDI_File_Surface::begin_job(const char *defaultfname, char **perr_mes
   char *buffer = new char[count];
   DEVMODEA *pDevMode = (DEVMODEA*)buffer;
   memset(buffer, 0, count);
-  pDevMode->dmSize = count;
+  pDevMode->dmSize = (WORD)count;
   count = DocumentPropertiesA(hwndOwner, hPr2, pdf_printer_name_, pDevMode, NULL, DM_OUT_BUFFER | DM_IN_PROMPT);
   ClosePrinter(hPr2);
   if (count == IDCANCEL || count < 0) { delete[] buffer; return 1; }
@@ -171,7 +171,7 @@ int Fl_PDF_GDI_File_Surface::begin_job(const char *defaultfname, char **perr_mes
   wchar_t        docName [256];
   wchar_t        outName [256];
   fl_utf8towc("FLTK", 4, docName, 256);
-  fl_utf8towc(fnfc.filename(), strlen(fnfc.filename()), outName, 256);
+  fl_utf8towc(fnfc.filename(), (unsigned int)strlen(fnfc.filename()), outName, 256);
   memset(&di, 0, sizeof(DOCINFOW));
   di.cbSize = sizeof(DOCINFOW);
   di.lpszDocName = (LPCWSTR)docName;
@@ -231,7 +231,7 @@ int Fl_PDF_GDI_File_Surface::begin_document(const char* outfname,
   di.cbSize = sizeof(DOCINFOW);
   di.lpszDocName = (LPCWSTR)docName;
   di.lpszOutput = (LPCWSTR)outName;
-  fl_utf8towc(outfname, strlen(outfname), outName, 256);
+  fl_utf8towc(outfname, (unsigned int)strlen(outfname), outName, 256);
   err = StartDocW(hPr, &di);
   if (err <= 0) {
     DWORD dw = GetLastError();
diff --git a/test/trackball.c b/test/trackball.c
index 7876bd541..398d537b4 100644
--- a/test/trackball.c
+++ b/test/trackball.c
@@ -66,7 +66,7 @@
  */
 static float tb_project_to_sphere(float, float, float);
 static void normalize_quat(float [4]);
-static float max_velocity = 0.1;
+static float max_velocity = 0.1f;
 
 void
 vzero(float *v)
-- 
GitLab