Fix Windows (VS) compiler warnings in fluid
This commit is contained in:
parent
ed3ec2d036
commit
1a8b94162d
@ -1,4 +1,19 @@
|
||||
// experimental inline cast functions for the Fast Light Toolkit (FLTK)
|
||||
//
|
||||
// Experimental inline "cast functions" for the Fast Light Toolkit (FLTK).
|
||||
// See also issue #109: "VS2017 warnings when building fltk 1.4.x"
|
||||
//
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
// file is missing or damaged, see the license at:
|
||||
//
|
||||
// https://www.fltk.org/COPYING.php
|
||||
//
|
||||
// Please see the following page on how to report bugs and issues:
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
#include <FL/platform_types.h>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Code editor widget for the Fast Light Tool Kit (FLTK).
|
||||
// Syntax highlighting rewritten by erco@seriss.com 09/15/20.
|
||||
//
|
||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -165,7 +165,7 @@ int CodeEditor::auto_indent(int, CodeEditor* e) {
|
||||
*ptr = '\0';
|
||||
if (*text) {
|
||||
// use only a single 'insert' call to avoid redraw issues
|
||||
int n = strlen(text);
|
||||
size_t n = strlen(text);
|
||||
char *b = (char*)malloc(n+2);
|
||||
*b = '\n';
|
||||
strcpy(b+1, text);
|
||||
|
@ -1,6 +1,19 @@
|
||||
//
|
||||
// External code editor management class for Windows
|
||||
// External code editor management class for Windows
|
||||
//
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
// file is missing or damaged, see the license at:
|
||||
//
|
||||
// https://www.fltk.org/COPYING.php
|
||||
//
|
||||
// Please see the following page on how to report bugs and issues:
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
// Note: This entire file Windows only.
|
||||
|
||||
#include <FL/Fl.H> // Fl_Timeout_Handler..
|
||||
@ -243,8 +256,8 @@ int ExternalCodeEditor::handle_changes(const char **code, int force) {
|
||||
// Changes? Load file. Be sure to fallthru to CloseHandle()
|
||||
int ret = 0;
|
||||
if ( changed || force ) {
|
||||
size_t buflen = size_t(fsize.QuadPart);
|
||||
char *buf = (char*)malloc(buflen + 1);
|
||||
DWORD buflen = (DWORD)fsize.QuadPart;
|
||||
char *buf = (char*)malloc((size_t)buflen + 1);
|
||||
DWORD count;
|
||||
if ( ReadFile(fh, buf, buflen, &count, 0) == 0 ) {
|
||||
fl_alert("ERROR: ReadFile() failed for %s: %s",
|
||||
@ -378,7 +391,7 @@ static int save_file(const char *filename,
|
||||
return(-1);
|
||||
}
|
||||
// Write the file, being careful to CloseHandle() even on errs
|
||||
DWORD clen = strlen(code);
|
||||
DWORD clen = (DWORD)strlen(code);
|
||||
DWORD count = 0;
|
||||
int ret = 0;
|
||||
if ( WriteFile(fh, code, clen, &count, NULL) == 0 ) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// C function type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -500,7 +500,7 @@ void Fl_Code_Type::write_code1() {
|
||||
const char *ind = indent();
|
||||
while( (pch=strchr(c,'\n')) )
|
||||
{
|
||||
int line_len = pch - c;
|
||||
int line_len = int(pch - c);
|
||||
if (line_len < 1)
|
||||
write_c("\n");
|
||||
else
|
||||
|
@ -1,19 +1,7 @@
|
||||
//
|
||||
// Widget type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Each object described by Fluid is one of these objects. They
|
||||
// are all stored in a double-linked list.
|
||||
//
|
||||
// They "type" of the object is covered by the virtual functions.
|
||||
// There will probably be a lot of these virtual functions.
|
||||
//
|
||||
// The type browser is also a list of these objects, but they
|
||||
// are "factory" instances, not "real" ones. These objects exist
|
||||
// only so the "make" method can be called on them. They are
|
||||
// not in the linked list and are not written to files or
|
||||
// copied or otherwise examined.
|
||||
//
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -26,6 +14,18 @@
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
// Each object described by Fluid is one of these objects. They
|
||||
// are all stored in a double-linked list.
|
||||
//
|
||||
// The "type" of the object is covered by the virtual functions.
|
||||
// There will probably be a lot of these virtual functions.
|
||||
//
|
||||
// The type browser is also a list of these objects, but they
|
||||
// are "factory" instances, not "real" ones. These objects exist
|
||||
// only so the "make" method can be called on them. They are
|
||||
// not in the linked list and are not written to files or
|
||||
// copied or otherwise examined.
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Browser_.H>
|
||||
#include <FL/fl_draw.H>
|
||||
@ -682,7 +682,7 @@ int storestring(const char *n, const char * & p, int nostrip) {
|
||||
if (!nostrip) while (isspace((int)(unsigned char)*n)) n++;
|
||||
const char *e = n + strlen(n);
|
||||
if (!nostrip) while (e > n && isspace((int)(unsigned char)*(e-1))) e--;
|
||||
length = e-n;
|
||||
length = int(e-n);
|
||||
if (!length) n = 0;
|
||||
}
|
||||
if (n == p) return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Widget type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -379,7 +379,7 @@ void label_cb(Fl_Input* i, void *v) {
|
||||
if (v == LOAD) {
|
||||
i->static_value(current_widget->label());
|
||||
if (strlen(i->value()) >= oldlabellen) {
|
||||
oldlabellen = strlen(i->value())+128;
|
||||
oldlabellen = (int)strlen(i->value())+128;
|
||||
oldlabel = (char*)realloc(oldlabel,oldlabellen);
|
||||
}
|
||||
strcpy(oldlabel,i->value());
|
||||
@ -1343,7 +1343,7 @@ void user_data_type_cb(Fl_Input *i, void *v) {
|
||||
// "v_attributes" let user type in random code for attribute settings:
|
||||
|
||||
void v_input_cb(Fl_Input* i, void* v) {
|
||||
int n = fl_intptr_t(i->user_data());
|
||||
int n = fl_int(i->user_data());
|
||||
if (v == LOAD) {
|
||||
i->static_value(current_widget->extra_code(n));
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Pixmap (and other images) label support for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -55,7 +55,7 @@ void Fluid_Image::write_static() {
|
||||
pixmap_header_written = write_number;
|
||||
}
|
||||
write_c("static const char *%s[] = {\n", idata_name);
|
||||
write_cstring(img->data()[0], strlen(img->data()[0]));
|
||||
write_cstring(img->data()[0], (int)strlen(img->data()[0]));
|
||||
|
||||
int i;
|
||||
int ncolors, chars_per_color;
|
||||
@ -68,7 +68,7 @@ void Fluid_Image::write_static() {
|
||||
} else {
|
||||
for (i = 1; i <= ncolors; i ++) {
|
||||
write_c(",\n");
|
||||
write_cstring(img->data()[i], strlen(img->data()[i]));
|
||||
write_cstring(img->data()[i], (int)strlen(img->data()[i]));
|
||||
}
|
||||
}
|
||||
for (; i < img->count(); i ++) {
|
||||
@ -107,7 +107,7 @@ void Fluid_Image::write_static() {
|
||||
if (nData) {
|
||||
char *data = (char*)calloc(nData, 1);
|
||||
if (fread(data, nData, 1, f)==0) { /* ignore */ }
|
||||
write_cdata(data, nData);
|
||||
write_cdata(data, (int)nData);
|
||||
free(data);
|
||||
}
|
||||
fclose(f);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Code output routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2015 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -233,7 +233,7 @@ void write_cstring(const char *s, int length) {
|
||||
}
|
||||
|
||||
// write a C string, quoting characters if necessary:
|
||||
void write_cstring(const char *s) {write_cstring(s,strlen(s));}
|
||||
void write_cstring(const char *s) {write_cstring(s, (int)strlen(s));}
|
||||
|
||||
// write an array of C binary data (does not add a null):
|
||||
void write_cdata(const char *s, int length) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -1348,7 +1348,7 @@ public:
|
||||
int close();
|
||||
|
||||
FILE * desc() const { return _fpt;} // non null if file is open
|
||||
char * get_line(char * line, size_t s) const {return _fpt ? fgets(line, s, _fpt) : NULL;}
|
||||
char * get_line(char * line, size_t s) const {return _fpt ? fgets(line, (int)s, _fpt) : NULL;}
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
protected:
|
||||
@ -1767,7 +1767,7 @@ int main(int argc,char **argv) {
|
||||
int i, n = pm.plugins();
|
||||
for (i=0; i<n; i++) {
|
||||
Fl_Commandline_Plugin *pi = (Fl_Commandline_Plugin*)pm.plugin(i);
|
||||
if (pi) len += strlen(pi->help());
|
||||
if (pi) len += (int)strlen(pi->help());
|
||||
}
|
||||
char *buf = (char*)malloc(len+1);
|
||||
sprintf(buf, msg, argv[0]);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FLUID undo support for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2017 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -61,7 +61,7 @@ static char *undo_filename(int level) {
|
||||
|
||||
if (!undo_path_len) {
|
||||
fluid_prefs.getUserdataPath(undo_path, sizeof(undo_path));
|
||||
undo_path_len = strlen(undo_path);
|
||||
undo_path_len = (unsigned int)strlen(undo_path);
|
||||
}
|
||||
|
||||
// append filename: "undo_PID_LEVEL.fl"
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Widget panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -24,7 +24,7 @@ static void cb_(Fl_Tabs* o, void* v) {
|
||||
}
|
||||
|
||||
Fl_Menu_Item menu_[] = {
|
||||
{" Image Alignment ", 0, 0, (void*)(0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{" Image Alignment ", 0, 0, (void*)((fl_intptr_t)0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{"image over text", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_IMAGE_OVER_TEXT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"text over image", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_TEXT_OVER_IMAGE), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"text next to image", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_TEXT_NEXT_TO_IMAGE), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
@ -34,7 +34,7 @@ Fl_Menu_Item menu_[] = {
|
||||
};
|
||||
|
||||
Fl_Menu_Item menu_1[] = {
|
||||
{" Inside && Outside ", 0, 0, (void*)(0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{" Inside && Outside ", 0, 0, (void*)((fl_intptr_t)0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{"top left", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_TOP_LEFT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"top", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"top right", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_TOP_RIGHT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
@ -44,7 +44,7 @@ Fl_Menu_Item menu_1[] = {
|
||||
{"bottom left", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_BOTTOM_LEFT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"bottom", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_BOTTOM), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"bottom right", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_BOTTOM_RIGHT), 128, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{" Outside Alignment ", 0, 0, (void*)(0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{" Outside Alignment ", 0, 0, (void*)((fl_intptr_t)0xFFFFFFFF), 1, (uchar)FL_NORMAL_LABEL, 2, 11, 0},
|
||||
{"left top", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_LEFT_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"right top", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_RIGHT_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
{"left bottom", 0, 0, (void*)((fl_intptr_t)FL_ALIGN_LEFT_BOTTOM), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0},
|
||||
|
@ -5,7 +5,7 @@ code_name {.cxx}
|
||||
comment {//
|
||||
// Widget panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -46,7 +46,7 @@ Function {make_widget_panel()} {
|
||||
xywh {95 40 309 20} labelfont 1 labelsize 11 align 4
|
||||
} {
|
||||
Fl_Input {} {
|
||||
callback label_cb
|
||||
callback label_cb selected
|
||||
tooltip {The label text for the widget.
|
||||
Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 textsize 11 resizable
|
||||
}
|
||||
@ -134,7 +134,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te
|
||||
} {
|
||||
MenuItem {} {
|
||||
label { Image Alignment }
|
||||
user_data 0xFFFFFFFF
|
||||
user_data (fl_intptr_t)0xFFFFFFFF
|
||||
xywh {145 145 100 20} labelfont 2 labelsize 11 deactivate
|
||||
}
|
||||
MenuItem {} {
|
||||
@ -169,7 +169,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te
|
||||
} {
|
||||
MenuItem {} {
|
||||
label { Inside && Outside }
|
||||
user_data 0xFFFFFFFF
|
||||
user_data {(fl_intptr_t)0xFFFFFFFF}
|
||||
xywh {135 135 100 20} labelfont 2 labelsize 11 deactivate
|
||||
}
|
||||
MenuItem {} {
|
||||
@ -219,7 +219,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te
|
||||
}
|
||||
MenuItem {} {
|
||||
label { Outside Alignment }
|
||||
user_data 0xFFFFFFFF
|
||||
user_data {(fl_intptr_t)0xFFFFFFFF}
|
||||
xywh {125 125 100 20} labelfont 2 labelsize 11 deactivate
|
||||
}
|
||||
MenuItem {} {
|
||||
@ -674,7 +674,7 @@ wCallback->do_callback(wCallback, v);} open
|
||||
Fl_Button {} {
|
||||
label Revert
|
||||
callback revert_cb
|
||||
comment {Hidden Revert button} selected
|
||||
comment {Hidden Revert button}
|
||||
xywh {90 370 60 20} labelsize 11 hide
|
||||
}
|
||||
Fl_Button wLiveMode {
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Widget panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
|
Loading…
Reference in New Issue
Block a user