FLTK logo

[master] 3c37cd0 - Solves all "conversion" warnings in fluid for issue #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] 3c37cd0 - Solves all "conversion" warnings in fluid for issue #109. "Greg Ercolano" Feb 18, 2021  
 
commit 3c37cd033bcc1cc760868bb66772441bb8129acd
Author:     Greg Ercolano <erco@seriss.com>
AuthorDate: Thu Feb 18 16:37:51 2021 -0800
Commit:     Greg Ercolano <erco@seriss.com>
CommitDate: Thu Feb 18 16:37:51 2021 -0800

    Solves all "conversion" warnings in fluid for issue #109.

 fluid/ExternalCodeEditor_WIN32.cxx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git fluid/ExternalCodeEditor_WIN32.cxx fluid/ExternalCodeEditor_WIN32.cxx
index 45ad612..b05adc6 100644
--- fluid/ExternalCodeEditor_WIN32.cxx
+++ fluid/ExternalCodeEditor_WIN32.cxx
@@ -242,17 +242,18 @@ int ExternalCodeEditor::handle_changes(const char **code, int force) {
   // Changes? Load file. Be sure to fallthru to CloseHandle()
   int ret = 0;
   if ( changed || force ) {
-    char *buf = (char*)malloc(fsize.QuadPart + 1);
+    size_t buflen = size_t(fsize.QuadPart);
+    char *buf = (char*)malloc(buflen + 1);
     DWORD count;
-    if ( ReadFile(fh, buf, fsize.QuadPart, &count, 0) == 0 ) {
+    if ( ReadFile(fh, buf, buflen, &count, 0) == 0 ) {
       fl_alert("ERROR: ReadFile() failed for %s: %s",
                filename(), get_ms_errmsg());
       free((void*)buf); buf = 0;
       ret = -1;      // fallthru to CloseHandle()
-    } else if ( count != fsize.QuadPart ) {
+    } else if ( count != buflen ) {
       fl_alert("ERROR: ReadFile() failed for %s:\n"
                "expected %ld bytes, got %ld",
-               filename(), long(fsize.QuadPart), long(count));
+               filename(), long(buflen), long(count));
       free((void*)buf); buf = 0;
       ret = -1;      // fallthru to CloseHandle()
     } else {
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'.