mirror of https://github.com/fltk/fltk
Fixed build error in msvs because Fl ref to FULLSCREEN enum was not accessible in Fl_Widget. new inline is_fullscreen() getter has been implemented to avoid a build error with (at least) msvc compilers. Fixed a ton of warnings / problems when bilding on windows 64 bits target with ms toolchain. cleaned up about 200 warnings raised when building win74 targets.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9325 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
37ea8ba9e6
commit
8809c5d65d
12
FL/Fl.H
12
FL/Fl.H
|
@ -43,6 +43,16 @@ class Fl_Window;
|
|||
class Fl_Image;
|
||||
struct Fl_Label;
|
||||
|
||||
// Keep avoiding having the socket deps at that level but mke sure it will work in both 32 & 64 bit builds
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# if defined(_WIN64)
|
||||
# define FL_SOCKET unsigned __int64
|
||||
# else
|
||||
# define FL_SOCKET int
|
||||
# endif
|
||||
#else
|
||||
# define FL_SOCKET int
|
||||
#endif
|
||||
|
||||
/** \defgroup callback_functions Callback function typedefs
|
||||
\brief Typedefs defined in <FL/Fl.H> for callback or handler functions passed as function parameters.
|
||||
|
@ -81,7 +91,7 @@ typedef void (*Fl_Idle_Handler)(void *data);
|
|||
typedef void (*Fl_Old_Idle_Handler)();
|
||||
|
||||
/** Signature of add_fd functions passed as parameters */
|
||||
typedef void (*Fl_FD_Handler)(int fd, void *data);
|
||||
typedef void (*Fl_FD_Handler)(FL_SOCKET fd, void *data);
|
||||
|
||||
/** Signature of add_handler functions passed as parameters */
|
||||
typedef int (*Fl_Event_Handler)(int event);
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
See activate(), output(), visible(), changed(), set_visible_focus()
|
||||
*/
|
||||
enum {
|
||||
INACTIVE = 1<<0, ///< the widget can't receive focus, and is disabled but potentially visible
|
||||
INACTIVE = 1<<0, ///< the widget can't receive focus, and is disabled but potentially visible
|
||||
INVISIBLE = 1<<1, ///< the widget is not drawn, but can receive a few special events
|
||||
OUTPUT = 1<<2, ///< for output only
|
||||
NOBORDER = 1<<3, ///< don't draw a decoration (Fl_Window)
|
||||
|
@ -687,12 +687,18 @@ public:
|
|||
*/
|
||||
void clear_visible() {flags_ |= INVISIBLE;}
|
||||
|
||||
/** Returns whether the widget is in full screen mode
|
||||
\retval non 0 if in full screen mode
|
||||
*/
|
||||
unsigned int is_fullscreen() const {return (flags_ & FULLSCREEN);}
|
||||
|
||||
/** Returns whether the widget is active.
|
||||
\retval 0 if the widget is inactive
|
||||
\retval 0 if the widget is inacti
|
||||
\see active_r(), activate(), deactivate()
|
||||
*/
|
||||
unsigned int active() const {return !(flags_&INACTIVE);}
|
||||
|
||||
|
||||
/** Returns whether the widget and all of its parents are active.
|
||||
\retval 0 if this or any of the parent widgets are inactive
|
||||
\see active(), activate(), deactivate()
|
||||
|
|
|
@ -159,9 +159,9 @@ typedef int FL_COLOR;
|
|||
extern FL_EXPORT void fl_initialize(int*, char*[], const char*, FL_CMD_OPT*, int);
|
||||
inline void fl_finish() {}
|
||||
|
||||
typedef void (*FL_IO_CALLBACK) (int, void*);
|
||||
typedef void (*FL_IO_CALLBACK) (FL_SOCKET, void*);
|
||||
inline void fl_add_io_callback(int fd, short w, FL_IO_CALLBACK cb, void* v) {
|
||||
Fl::add_fd(fd,w,cb,v);}
|
||||
Fl::add_fd(fd, w, cb, v);}
|
||||
inline void fl_remove_io_callback(int fd, short, FL_IO_CALLBACK) {
|
||||
Fl::remove_fd(fd);} // removes all the callbacks!
|
||||
|
||||
|
|
|
@ -1432,7 +1432,7 @@ static bool prepare_shell_command(const char * &command) { // common pre-shell
|
|||
#if !defined(__MWERKS__)
|
||||
// Support the full piped shell command...
|
||||
void
|
||||
shell_pipe_cb(int, void*) {
|
||||
shell_pipe_cb(FL_SOCKET, void*) {
|
||||
char line[1024]=""; // Line from command output...
|
||||
|
||||
if (s_proc.get_line(line, sizeof(line)) != NULL) {
|
||||
|
|
|
@ -285,7 +285,7 @@ void Fl_Browser::insert(int line, FL_BLINE* item) {
|
|||
\param[in] d Optional pointer to user data to be associated with the new line.
|
||||
*/
|
||||
void Fl_Browser::insert(int line, const char* newtext, void* d) {
|
||||
int l = strlen(newtext);
|
||||
int l = (int) strlen(newtext);
|
||||
FL_BLINE* t = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
|
||||
t->length = (short)l;
|
||||
t->flags = 0;
|
||||
|
@ -320,7 +320,7 @@ void Fl_Browser::move(int to, int from) {
|
|||
void Fl_Browser::text(int line, const char* newtext) {
|
||||
if (line < 1 || line > lines) return;
|
||||
FL_BLINE* t = find_line(line);
|
||||
int l = strlen(newtext);
|
||||
int l = (int) strlen(newtext);
|
||||
if (l > t->length) {
|
||||
FL_BLINE* n = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
|
||||
replacing(t, n);
|
||||
|
|
|
@ -181,7 +181,7 @@ Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L)
|
|||
}
|
||||
|
||||
static void tick(void *v) {
|
||||
((Fl_Clock*)v)->value(time(0));
|
||||
((Fl_Clock*)v)->value((ulong) time(0));
|
||||
Fl::add_timeout(1.0, tick, v);
|
||||
}
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
|
|||
|
||||
#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__)
|
||||
strlcpy(filename, directory_, sizeof(filename));
|
||||
i = strlen(filename) - 1;
|
||||
i = (int) (strlen(filename) - 1);
|
||||
|
||||
if (i == 2 && filename[1] == ':' &&
|
||||
(filename[2] == '/' || filename[2] == '\\'))
|
||||
|
|
|
@ -896,7 +896,7 @@ Fl_File_Chooser::fileNameCB()
|
|||
|
||||
// Other key pressed - do filename completion as possible...
|
||||
num_files = fileList->size();
|
||||
min_match = strlen(filename);
|
||||
min_match = (int) strlen(filename);
|
||||
max_match = min_match + 1;
|
||||
first_line = 0;
|
||||
|
||||
|
@ -912,7 +912,7 @@ Fl_File_Chooser::fileNameCB()
|
|||
if (!first_line) {
|
||||
// First match; copy stuff over...
|
||||
strlcpy(matchname, file, sizeof(matchname));
|
||||
max_match = strlen(matchname);
|
||||
max_match = (int) strlen(matchname);
|
||||
|
||||
// Strip trailing /, if any...
|
||||
if (matchname[max_match - 1] == '/') {
|
||||
|
@ -950,14 +950,17 @@ Fl_File_Chooser::fileNameCB()
|
|||
fileList->redraw();
|
||||
} else if (max_match > min_match && first_line) {
|
||||
// Add the matching portion...
|
||||
fileName->replace(filename - pathname, filename - pathname + min_match,
|
||||
matchname);
|
||||
fileName->replace(
|
||||
(int) (filename - pathname),
|
||||
(int) (filename - pathname + min_match),
|
||||
matchname);
|
||||
|
||||
// Highlight it with the cursor at the end of the selection so
|
||||
// s/he can press the right arrow to accept the selection
|
||||
// (Tab and End also do this for both cases.)
|
||||
fileName->position(filename - pathname + max_match,
|
||||
filename - pathname + min_match);
|
||||
fileName->position(
|
||||
(int) (filename - pathname + max_match),
|
||||
(int) (filename - pathname + min_match));
|
||||
} else if (max_match == 0) {
|
||||
fileList->deselect(0);
|
||||
fileList->redraw();
|
||||
|
@ -1346,7 +1349,7 @@ Fl_File_Chooser::update_preview()
|
|||
|
||||
if (fp != NULL) {
|
||||
// Try reading the first 1k of data for a label...
|
||||
bytes = fread(preview_text_, 1, sizeof(preview_text_) - 1, fp);
|
||||
bytes = (int) fread(preview_text_, 1, sizeof(preview_text_) - 1, fp);
|
||||
preview_text_[bytes] = '\0';
|
||||
fclose(fp);
|
||||
} else {
|
||||
|
@ -1544,7 +1547,7 @@ Fl_File_Chooser::value(const char *filename)
|
|||
if (slash > pathname) slash[-1] = '/';
|
||||
|
||||
fileName->value(pathname);
|
||||
fileName->position(0, strlen(pathname));
|
||||
fileName->position(0, (int) strlen(pathname));
|
||||
okButton->activate();
|
||||
|
||||
// Then find the file in the file list and select it...
|
||||
|
@ -1610,8 +1613,8 @@ compare_dirnames(const char *a, const char *b) {
|
|||
int alen, blen;
|
||||
|
||||
// Get length of each string...
|
||||
alen = strlen(a) - 1;
|
||||
blen = strlen(b) - 1;
|
||||
alen = (int) (strlen(a) - 1);
|
||||
blen = (int) (strlen(b) - 1);
|
||||
|
||||
if (alen < 0 || blen < 0) return alen - blen;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void Fl_File_Input::update_buttons() {
|
|||
|
||||
end ++;
|
||||
|
||||
buttons_[i] = (short)fl_width(start, end - start);
|
||||
buttons_[i] = (short)fl_width(start, (int) (end - start));
|
||||
if (!i) buttons_[i] += Fl::box_dx(box()) + 6;
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ Fl_File_Input::handle_button(int event) // I - Event
|
|||
if (i < 0) {
|
||||
// Found the end; truncate the value and update the buttons...
|
||||
*start = '\0';
|
||||
value(newvalue, start - newvalue);
|
||||
value(newvalue, (int) (start - newvalue) );
|
||||
|
||||
// Then do the callbacks, if necessary...
|
||||
set_changed();
|
||||
|
|
|
@ -211,7 +211,7 @@ void Fl_System_Printer::rotate (float rot_angle)
|
|||
{
|
||||
XFORM mat;
|
||||
float angle;
|
||||
angle = - rot_angle * M_PI / 180.;
|
||||
angle = (float) - (rot_angle * M_PI / 180.);
|
||||
mat.eM11 = cos(angle);
|
||||
mat.eM12 = sin(angle);
|
||||
mat.eM21 = - mat.eM12;
|
||||
|
@ -247,8 +247,8 @@ static void do_translate(int x, int y)
|
|||
XFORM tr;
|
||||
tr.eM11 = tr.eM22 = 1;
|
||||
tr.eM12 = tr.eM21 = 0;
|
||||
tr.eDx = x;
|
||||
tr.eDy = y;
|
||||
tr.eDx = (FLOAT) x;
|
||||
tr.eDy = (FLOAT) y;
|
||||
ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,8 +254,8 @@ void Fl_Help_View::hv_draw(const char *t, int x, int y)
|
|||
int w = (int)fl_width(t);
|
||||
if (mouse_x>=x && mouse_x<x+w) {
|
||||
if (mouse_y>=y-fl_height()+fl_descent()&&mouse_y<=y+fl_descent()) {
|
||||
int f = current_pos;
|
||||
int l = f+strlen(t); // use 'quote_char' to calculate the true length of the HTML string
|
||||
int f = (int) current_pos;
|
||||
int l = (int) (f+strlen(t)); // use 'quote_char' to calculate the true length of the HTML string
|
||||
if (draw_mode==1) {
|
||||
selection_push_first = f;
|
||||
selection_push_last = l;
|
||||
|
@ -542,7 +542,7 @@ Fl_Help_View::draw()
|
|||
fl_xyline(xx + x() - leftline_, yy + y() + 1,
|
||||
xx + x() - leftline_ + ww + xtra_ww);
|
||||
}
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
|
||||
xx += ww;
|
||||
if ((fsize + 2) > hh)
|
||||
|
@ -564,7 +564,7 @@ Fl_Help_View::draw()
|
|||
xx + x() - leftline_ +
|
||||
(int)fl_width(buf));
|
||||
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
if (line < 31)
|
||||
line ++;
|
||||
xx = block->line[line];
|
||||
|
@ -596,7 +596,7 @@ Fl_Help_View::draw()
|
|||
if (underline) fl_xyline(xx + x() - leftline_, yy + y() + 1,
|
||||
xx + x() - leftline_ + ww);
|
||||
xx += ww;
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
}
|
||||
|
||||
needspace = 0;
|
||||
|
@ -607,7 +607,7 @@ Fl_Help_View::draw()
|
|||
|
||||
while (isspace((*ptr)&255))
|
||||
ptr ++;
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ Fl_Help_View::draw()
|
|||
ptr ++;
|
||||
|
||||
// end of command reached, set the supposed start of printed eord here
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
if (strcasecmp(buf, "HEAD") == 0)
|
||||
head = 1;
|
||||
else if (strcasecmp(buf, "BR") == 0)
|
||||
|
@ -901,7 +901,7 @@ Fl_Help_View::draw()
|
|||
needspace = 0;
|
||||
|
||||
ptr ++;
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
}
|
||||
else if (isspace((*ptr)&255))
|
||||
{
|
||||
|
@ -918,7 +918,7 @@ Fl_Help_View::draw()
|
|||
}
|
||||
|
||||
ptr ++;
|
||||
if (!pre) current_pos = ptr-value_;
|
||||
if (!pre) current_pos = (int) (ptr-value_);
|
||||
needspace = 1;
|
||||
}
|
||||
else if (*ptr == '&')
|
||||
|
@ -973,7 +973,7 @@ Fl_Help_View::draw()
|
|||
hv_draw(buf, xx + x() - leftline_, yy + y());
|
||||
if (underline) fl_xyline(xx + x() - leftline_, yy + y() + 1,
|
||||
xx + x() - leftline_ + ww);
|
||||
current_pos = ptr-value_;
|
||||
current_pos = (int) (ptr-value_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1035,7 +1035,7 @@ Fl_Help_View::find(const char *s, // I - String to find
|
|||
if (!*sp) {
|
||||
// Found a match!
|
||||
topline(b->y - b->h);
|
||||
return (b->end - value_);
|
||||
return (int) (b->end - value_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1517,7 +1517,7 @@ void Fl_Help_View::format() {
|
|||
yy = block->y + block->h - 4;
|
||||
hh = 0;
|
||||
block = add_block(start, xx, yy, hsize_, 0);
|
||||
row = block - blocks_;
|
||||
row = (int) (block - blocks_);
|
||||
needspace = 0;
|
||||
column = 0;
|
||||
line = 0;
|
||||
|
@ -1602,7 +1602,7 @@ void Fl_Help_View::format() {
|
|||
newalign = get_align(attrs, tolower(buf[1]) == 'h' ? CENTER : LEFT);
|
||||
talign = newalign;
|
||||
|
||||
cells[column] = block - blocks_;
|
||||
cells[column] = (int) (block - blocks_);
|
||||
|
||||
column += colspan;
|
||||
|
||||
|
@ -2752,7 +2752,7 @@ void Fl_Help_View::select_all()
|
|||
clear_global_selection();
|
||||
if (!value_) return;
|
||||
current_view = this;
|
||||
selection_drag_last = selection_last = strlen(value_);
|
||||
selection_drag_last = selection_last = (int) strlen(value_);
|
||||
selected = 1;
|
||||
}
|
||||
|
||||
|
@ -2858,7 +2858,7 @@ void Fl_Help_View::end_selection(int clipboard)
|
|||
// convert the select part of our html text into some kind of somewhat readable ASCII
|
||||
// and store it in the selection buffer
|
||||
char p = 0, pre = 0;;
|
||||
int len = strlen(value_);
|
||||
int len = (int) strlen(value_);
|
||||
char *txt = (char*)malloc(len+1), *d = txt;
|
||||
const char *s = value_, *cmd, *src;
|
||||
for (;;) {
|
||||
|
@ -2898,7 +2898,7 @@ void Fl_Help_View::end_selection(int clipboard)
|
|||
case CMD('d','t', 0 , 0 ): src = "\n "; break;
|
||||
case CMD('d','d', 0 , 0 ): src = "\n - "; break;
|
||||
}
|
||||
int n = s-value_;
|
||||
int n = (int) (s-value_);
|
||||
if (src && n>selection_first && n<=selection_last) {
|
||||
while (*src) {
|
||||
*d++ = *src++;
|
||||
|
@ -2918,7 +2918,7 @@ void Fl_Help_View::end_selection(int clipboard)
|
|||
}
|
||||
}
|
||||
}
|
||||
int n = s-value_;
|
||||
int n = (int) (s-value_);
|
||||
if (n>selection_first && n<=selection_last) {
|
||||
if (!pre && isspace(c&255)) c = ' ';
|
||||
if (p!=' '||c!=' ')
|
||||
|
@ -2927,7 +2927,7 @@ void Fl_Help_View::end_selection(int clipboard)
|
|||
}
|
||||
}
|
||||
*d = 0;
|
||||
Fl::copy(txt, strlen(txt), clipboard);
|
||||
Fl::copy(txt, (int) strlen(txt), clipboard);
|
||||
free(txt);
|
||||
}
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ int Fl_Input::handle_key() {
|
|||
// initialize the list of legal characters inside a floating point number
|
||||
#ifdef HAVE_LOCALECONV
|
||||
if (!legal_fp_chars) {
|
||||
int len = strlen(standard_fp_chars);
|
||||
size_t len = strlen(standard_fp_chars);
|
||||
struct lconv *lc = localeconv();
|
||||
if (lc) {
|
||||
if (lc->decimal_point) len += strlen(lc->decimal_point);
|
||||
|
|
|
@ -74,7 +74,7 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
|
|||
} else while (o<e) {
|
||||
if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
|
||||
word_wrap = w() - Fl::box_dw(box()) - 2;
|
||||
width_to_lastspace += (int)fl_width(lastspace_out, o-lastspace_out);
|
||||
width_to_lastspace += (int)fl_width(lastspace_out, (int) (o-lastspace_out));
|
||||
if (p > lastspace+1) {
|
||||
if (word_count && width_to_lastspace > word_wrap) {
|
||||
p = lastspace; o = lastspace_out; break;
|
||||
|
@ -90,7 +90,7 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
|
|||
if (c < ' ' || c == 127) {
|
||||
if (c=='\n' && input_type()==FL_MULTILINE_INPUT) {p--; break;}
|
||||
if (c == '\t' && input_type()==FL_MULTILINE_INPUT) {
|
||||
for (c = fl_utf_nb_char((uchar*)buf, o-buf)%8; c<8 && o<e; c++) {
|
||||
for (c = fl_utf_nb_char((uchar*)buf, (int) (o-buf))%8; c<8 && o<e; c++) {
|
||||
*o++ = ' ';
|
||||
}
|
||||
} else {
|
||||
|
@ -338,19 +338,19 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
|
|||
float x2 = (float)(X+W);
|
||||
int offset2;
|
||||
if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
|
||||
else offset2 = strlen(buf);
|
||||
else offset2 = (int) strlen(buf);
|
||||
fl_color(selection_color());
|
||||
fl_rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
|
||||
fl_color(fl_contrast(textcolor(), selection_color()));
|
||||
fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
|
||||
if (pp < e) {
|
||||
fl_color(tc);
|
||||
fl_draw(buf+offset2, strlen(buf+offset2), x2, (float)(Y+ypos+desc));
|
||||
fl_draw(buf+offset2, (int) strlen(buf+offset2), x2, (float)(Y+ypos+desc));
|
||||
}
|
||||
} else {
|
||||
// draw unselected text
|
||||
fl_color(tc);
|
||||
fl_draw(buf, strlen(buf), xpos, (float)(Y+ypos+desc));
|
||||
fl_draw(buf, (int) strlen(buf), xpos, (float)(Y+ypos+desc));
|
||||
}
|
||||
|
||||
if (do_mu) fl_pop_clip();
|
||||
|
@ -461,7 +461,8 @@ int Fl_Input_::line_end(int i) const {
|
|||
for (const char* p=value()+j; ;) {
|
||||
char buf[MAXBUF];
|
||||
p = expand(p, buf);
|
||||
if (p-value() >= i) return p-value();
|
||||
int k = (int) (p-value());
|
||||
if (k >= i) return k;
|
||||
p++;
|
||||
}
|
||||
} else {
|
||||
|
@ -489,7 +490,7 @@ int Fl_Input_::line_start(int i) const {
|
|||
for (const char* p=value()+j; ;) {
|
||||
char buf[MAXBUF];
|
||||
const char* e = expand(p, buf);
|
||||
if (e-value() >= i) return p-value();
|
||||
if ((int) (e-value()) >= i) return (int) (p-value());
|
||||
p = e+1;
|
||||
}
|
||||
} else return j;
|
||||
|
@ -535,7 +536,7 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
|
|||
if (f1 < f0) l = l+cw;
|
||||
}
|
||||
}
|
||||
newpos = l-value();
|
||||
newpos = (int) (l-value());
|
||||
|
||||
int newmark = drag ? mark() : newpos;
|
||||
if (Fl::event_clicks()) {
|
||||
|
@ -566,7 +567,7 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
|
|||
(newmark >= position() && newpos <= mark()) :
|
||||
(newmark >= mark() && newpos <= position()))) {
|
||||
Fl::event_clicks(0);
|
||||
newmark = newpos = l-value();
|
||||
newmark = newpos = (int) (l-value());
|
||||
}
|
||||
}
|
||||
position(newpos, newmark);
|
||||
|
@ -662,7 +663,7 @@ int Fl_Input_::up_down_position(int i, int keepmark) {
|
|||
int f = (int)expandpos(p, t, buf, 0);
|
||||
if (f <= up_down_pos) l = t; else r = t-1;
|
||||
}
|
||||
int j = l-value();
|
||||
int j = (int) (l-value());
|
||||
j = position(j, keepmark ? mark_ : j);
|
||||
was_up_down = 1;
|
||||
return j;
|
||||
|
@ -776,7 +777,7 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
|
|||
e++;
|
||||
ul = fl_utf8len((char)(value_ + e)[0]);
|
||||
}
|
||||
if (text && !ilen) ilen = strlen(text);
|
||||
if (text && !ilen) ilen = (int) strlen(text);
|
||||
if (e<=b && !ilen) return 0; // don't clobber undo for a null operation
|
||||
|
||||
// we must count UTF-8 *characters* to determine whether we can insert
|
||||
|
@ -1035,7 +1036,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
|||
if (p < e) {
|
||||
fl_beep(FL_BEEP_ERROR);
|
||||
return 1;
|
||||
} else return replace(0, size(), t, e - t);
|
||||
} else return replace(0, size(), t, (int) (e-t));
|
||||
} else if (input_type() == FL_FLOAT_INPUT) {
|
||||
while (isspace(*t & 255) && t < e) t ++;
|
||||
const char *p = t;
|
||||
|
@ -1053,9 +1054,9 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
|||
if (p < e) {
|
||||
fl_beep(FL_BEEP_ERROR);
|
||||
return 1;
|
||||
} else return replace(0, size(), t, e - t);
|
||||
} else return replace(0, size(), t, (int) (e-t));
|
||||
}
|
||||
return replace(position(), mark(), t, e-t);}
|
||||
return replace(position(), mark(), t, (int) (e-t));}
|
||||
|
||||
case FL_SHORTCUT:
|
||||
if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
|
||||
|
@ -1205,7 +1206,7 @@ int Fl_Input_::static_value(const char* str, int len) {
|
|||
\return non-zero if the new value is different than the current one
|
||||
*/
|
||||
int Fl_Input_::static_value(const char* str) {
|
||||
return static_value(str, str ? strlen(str) : 0);
|
||||
return static_value(str, str ? (int) strlen(str) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1241,7 +1242,7 @@ int Fl_Input_::value(const char* str, int len) {
|
|||
\see Fl_Input_::value(const char* str, int len), Fl_Input_::value()
|
||||
*/
|
||||
int Fl_Input_::value(const char* str) {
|
||||
return value(str, str ? strlen(str) : 0);
|
||||
return value(str, str ? (int) strlen(str) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@ int Fl_Menu_Item::size() const {
|
|||
int nest = 0;
|
||||
for (;;) {
|
||||
if (!m->text) {
|
||||
if (!nest) return (m-this+1);
|
||||
if (!nest) return (int) (m-this+1);
|
||||
nest--;
|
||||
} else if (m->flags & FL_SUBMENU) {
|
||||
nest++;
|
||||
|
@ -331,9 +331,9 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
|
|||
// s is a pointerto the utf8 string for the entire shortcut
|
||||
// k points only to the key part (minus the modifier keys)
|
||||
const char *k, *s = fl_shortcut_label(m->shortcut_, &k);
|
||||
if (fl_utf_nb_char((const unsigned char*)k, strlen(k))<=4) {
|
||||
if (fl_utf_nb_char((const unsigned char*)k, (int) strlen(k))<=4) {
|
||||
// a regular shortcut has a right-justified modifier followed by a left-justified key
|
||||
w1 = int(fl_width(s, k-s));
|
||||
w1 = int(fl_width(s, (int) (k-s)));
|
||||
if (w1 > hotModsw) hotModsw = w1;
|
||||
w1 = int(fl_width(k))+4;
|
||||
if (w1 > hotKeysw) hotKeysw = w1;
|
||||
|
@ -455,7 +455,7 @@ void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int eraseit) {
|
|||
fl_font(f, m->labelsize_ ? m->labelsize_ :
|
||||
button ? button->textsize() : FL_NORMAL_SIZE);
|
||||
const char *k, *s = fl_shortcut_label(m->shortcut_, &k);
|
||||
if (fl_utf_nb_char((const unsigned char*)k, strlen(k))<=4) {
|
||||
if (fl_utf_nb_char((const unsigned char*)k, (int) strlen(k))<=4) {
|
||||
// righ-align the modifiers and left-align the key
|
||||
char buf[32]; strcpy(buf, s); buf[k-s] = 0;
|
||||
fl_draw(buf, xx, yy, ww-shortcutWidth, hh, FL_ALIGN_RIGHT);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define SAFE_STRCAT(s) { len += strlen(s); if ( len >= namelen ) { *name='\0'; return(-2); } else strcat(name,(s)); }
|
||||
#define SAFE_STRCAT(s) { len += (int) strlen(s); if ( len >= namelen ) { *name='\0'; return(-2); } else strcat(name,(s)); }
|
||||
|
||||
/** Get the menu 'pathname' for the specified menuitem.
|
||||
|
||||
|
@ -81,7 +81,7 @@ int Fl_Menu_::item_pathname(char *name, int namelen, const Fl_Menu_Item *findite
|
|||
}
|
||||
} else { // end of submenu? pop
|
||||
char *ss = strrchr(name, '/');
|
||||
if ( ss ) { *ss = 0; len = strlen(name); } // "File/Edit" -> "File"
|
||||
if ( ss ) { *ss = 0; len = (int) strlen(name); } // "File/Edit" -> "File"
|
||||
else { name[0] = '\0'; len = 0; } // "File" -> ""
|
||||
continue;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ const Fl_Menu_Item * Fl_Menu_::find_item(const char *pathname) {
|
|||
int Fl_Menu_::find_index(const Fl_Menu_Item *item) const {
|
||||
Fl_Menu_Item *max = menu_+size();
|
||||
if (item<menu_ || item>=max) return(-1);
|
||||
return(item-menu_);
|
||||
return (int) (item-menu_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -172,7 +172,7 @@ int Fl_Menu_Item::insert(
|
|||
if (m->flags&FL_SUBMENU && !compare(item, m->text)) break;
|
||||
|
||||
if (!m->text) { /* create a new menu */
|
||||
int n = (index==-1) ? m-array : index;
|
||||
int n = (index==-1) ? (int) (m-array) : index;
|
||||
array = array_insert(array, msize, n, item, FL_SUBMENU|flags1);
|
||||
msize++;
|
||||
array = array_insert(array, msize, n+1, 0, 0);
|
||||
|
@ -188,7 +188,7 @@ int Fl_Menu_Item::insert(
|
|||
if (!(m->flags&FL_SUBMENU) && !compare(m->text,item)) break;
|
||||
|
||||
if (!m->text) { /* add a new menu item */
|
||||
int n = (index==-1) ? m-array : index;
|
||||
int n = (index==-1) ? (int) (m-array) : index;
|
||||
array = array_insert(array, msize, n, item, myflags|flags1);
|
||||
msize++;
|
||||
if (myflags & FL_SUBMENU) { // add submenu delimiter
|
||||
|
@ -205,7 +205,7 @@ int Fl_Menu_Item::insert(
|
|||
m->flags = myflags|flags1;
|
||||
|
||||
if (array == local_array) local_array_size = msize;
|
||||
return m-array;
|
||||
return (int) (m-array);
|
||||
}
|
||||
|
||||
|
||||
|
@ -366,7 +366,7 @@ int Fl_Menu_::insert(
|
|||
if (fl_menu_array_owner) {
|
||||
Fl_Menu_* o = fl_menu_array_owner;
|
||||
// the previous owner get's its own correctly-sized array:
|
||||
int value_offset = o->value_-local_array;
|
||||
int value_offset = (int) (o->value_-local_array);
|
||||
int n = local_array_size;
|
||||
Fl_Menu_Item* newMenu = o->menu_ = new Fl_Menu_Item[n];
|
||||
memcpy(newMenu, local_array, n*sizeof(Fl_Menu_Item));
|
||||
|
@ -396,7 +396,7 @@ int Fl_Menu_::insert(
|
|||
}
|
||||
int r = menu_->insert(index,label,shortcut,callback,userdata,flags);
|
||||
// if it rellocated array we must fix the pointer:
|
||||
int value_offset = value_-menu_;
|
||||
int value_offset = (int) (value_-menu_);
|
||||
menu_ = local_array; // in case it reallocated it
|
||||
if (value_) value_ = menu_+value_offset;
|
||||
return r;
|
||||
|
|
|
@ -86,7 +86,7 @@ static int dnulllen(const char *wp) {
|
|||
//
|
||||
static void dnullcat(char*&wp, const char *string, int n = -1 ) {
|
||||
//DEBUG printf("DEBUG: dnullcat IN: <"); dnullprint(wp); printf(">\n");
|
||||
int inlen = ( n < 0 ) ? strlen(string) : n;
|
||||
size_t inlen = ( n < 0 ) ? strlen(string) : n;
|
||||
if ( ! wp ) {
|
||||
wp = new char[inlen + 4];
|
||||
*(wp+0) = '\0';
|
||||
|
@ -114,7 +114,7 @@ static void dnullcat(char*&wp, const char *string, int n = -1 ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( n == -1 ) n = strlen(string);
|
||||
if ( n == -1 ) n = (int) strlen(string);
|
||||
strncpy(wp2, string, n);
|
||||
|
||||
// Leave string double-null terminated
|
||||
|
@ -306,7 +306,7 @@ int Fl_Native_File_Chooser::showfile() {
|
|||
}
|
||||
// SPACE FOR RETURNED FILENAME
|
||||
_ofn.lpstrFile = new WCHAR[fsize];
|
||||
_ofn.nMaxFile = fsize-1;
|
||||
_ofn.nMaxFile = (DWORD) fsize-1;
|
||||
_ofn.lpstrFile[0] = 0;
|
||||
_ofn.lpstrFile[1] = 0; // dnull
|
||||
// PARENT WINDOW
|
||||
|
@ -326,7 +326,7 @@ int Fl_Native_File_Chooser::showfile() {
|
|||
const char *p = _parsedfilt;
|
||||
while(*(p + strlen(p) + 1) != 0) p += strlen(p) + 1;
|
||||
p += strlen(p) + 2;
|
||||
MultiByteToWideChar(CP_UTF8, 0, _parsedfilt, p - _parsedfilt, wpattern, FNFC_MAX_PATH);
|
||||
MultiByteToWideChar(CP_UTF8, 0, _parsedfilt, (int) (p - _parsedfilt), wpattern, FNFC_MAX_PATH);
|
||||
_ofn.lpstrFilter = wpattern;
|
||||
} else {
|
||||
_ofn.lpstrFilter = NULL;
|
||||
|
@ -407,7 +407,7 @@ int Fl_Native_File_Chooser::showfile() {
|
|||
case BROWSE_MULTI_FILE: {
|
||||
// EXTRACT MULTIPLE FILENAMES
|
||||
const WCHAR *dirname = _ofn.lpstrFile;
|
||||
int dirlen = wcslen(dirname);
|
||||
size_t dirlen = wcslen(dirname);
|
||||
if ( dirlen > 0 ) {
|
||||
// WALK STRING SEARCHING FOR 'DOUBLE-NULL'
|
||||
// eg. "/dir/name\0foo1\0foo2\0foo3\0\0"
|
||||
|
|
|
@ -935,7 +935,7 @@ void Fl_PostScript_Graphics_Driver::font(int f, int s) {
|
|||
Fl_Font_Descriptor *desc = driver->font_descriptor();
|
||||
this->font_descriptor(desc);
|
||||
if (f < FL_FREE_FONT) {
|
||||
float ps_size = s;
|
||||
float ps_size = (float) s;
|
||||
fprintf(output, "/%s SF\n" , _fontNames[f]);
|
||||
#if defined(USE_X11)
|
||||
#if USE_XFT
|
||||
|
|
|
@ -741,7 +741,7 @@ char Fl_Preferences::set( const char *key, const char *text ) {
|
|||
|
||||
// convert a hex string to binary data
|
||||
static void *decodeHex( const char *src, int &size ) {
|
||||
size = strlen( src )/2;
|
||||
size = (int) strlen( src )/2;
|
||||
unsigned char *data = (unsigned char*)malloc( size ), *d = data;
|
||||
const char *s = src;
|
||||
for ( int i=size; i>0; i-- ) {
|
||||
|
@ -848,7 +848,7 @@ char Fl_Preferences::set( const char *key, const void *data, int dsize ) {
|
|||
*/
|
||||
int Fl_Preferences::size( const char *key ) {
|
||||
const char *v = node->get( key );
|
||||
return v ? strlen( v ) : 0 ;
|
||||
return (int) (v ? strlen( v ) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -956,7 +956,7 @@ static char makePath( const char *path ) {
|
|||
if (access(path, 0)) {
|
||||
const char *s = strrchr( path, '/' );
|
||||
if ( !s ) return 0;
|
||||
int len = s-path;
|
||||
size_t len = s-path;
|
||||
char *p = (char*)malloc( len+1 );
|
||||
memcpy( p, path, len );
|
||||
p[len] = 0;
|
||||
|
@ -997,7 +997,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
#ifdef WIN32
|
||||
# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
|
||||
# define FLPREFS_RESOURCEW L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
|
||||
int appDataLen = strlen(vendor) + strlen(application) + 8;
|
||||
size_t appDataLen = strlen(vendor) + strlen(application) + 8;
|
||||
DWORD type, nn;
|
||||
LONG err;
|
||||
HKEY key;
|
||||
|
@ -1006,7 +1006,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
case SYSTEM:
|
||||
err = RegOpenKeyW( HKEY_LOCAL_MACHINE, FLPREFS_RESOURCEW, &key );
|
||||
if (err == ERROR_SUCCESS) {
|
||||
nn = FL_PATH_MAX - appDataLen;
|
||||
nn = (DWORD) (FL_PATH_MAX - appDataLen);
|
||||
err = RegQueryValueExW( key, L"Common AppData", 0L, &type,
|
||||
(BYTE*)filename, &nn );
|
||||
if ( ( err != ERROR_SUCCESS ) && ( type == REG_SZ ) ) {
|
||||
|
@ -1019,7 +1019,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
case USER:
|
||||
err = RegOpenKeyW( HKEY_CURRENT_USER, FLPREFS_RESOURCEW, &key );
|
||||
if (err == ERROR_SUCCESS) {
|
||||
nn = FL_PATH_MAX - appDataLen;
|
||||
nn = (DWORD) (FL_PATH_MAX - appDataLen);
|
||||
err = RegQueryValueExW( key, L"AppData", 0L, &type,
|
||||
(BYTE*)filename, &nn );
|
||||
if ( ( err != ERROR_SUCCESS ) && ( type == REG_SZ ) ) {
|
||||
|
@ -1043,7 +1043,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
wcscpy(b, (xchar *) filename);
|
||||
#endif
|
||||
// filename[fl_unicode2utf(b, wcslen((xchar*)b), filename)] = 0;
|
||||
unsigned len = fl_utf8fromwc(filename, (FL_PATH_MAX-1), b, wcslen(b));
|
||||
unsigned len = fl_utf8fromwc(filename, (FL_PATH_MAX-1), b, (unsigned) wcslen(b));
|
||||
filename[len] = 0;
|
||||
free(b);
|
||||
}
|
||||
|
@ -1158,17 +1158,17 @@ int Fl_Preferences::RootNode::read() {
|
|||
for (;;) {
|
||||
if ( !fgets( buf, 1024, f ) ) break; // EOF or Error
|
||||
if ( buf[0]=='[' ) { // read a new group
|
||||
int end = strcspn( buf+1, "]\n\r" );
|
||||
size_t end = strcspn( buf+1, "]\n\r" );
|
||||
buf[ end+1 ] = 0;
|
||||
nd = prefs_->node->find( buf+1 );
|
||||
} else if ( buf[0]=='+' ) { // value of previous name/value pair spans multiple lines
|
||||
int end = strcspn( buf+1, "\n\r" );
|
||||
size_t end = strcspn( buf+1, "\n\r" );
|
||||
if ( end != 0 ) { // if entry is not empty
|
||||
buf[ end+1 ] = 0;
|
||||
nd->add( buf+1 );
|
||||
}
|
||||
} else { // read a name/value pair
|
||||
int end = strcspn( buf, "\n\r" );
|
||||
size_t end = strcspn( buf, "\n\r" );
|
||||
if ( end != 0 ) { // if entry is not empty
|
||||
buf[ end ] = 0;
|
||||
nd->set( buf );
|
||||
|
@ -1307,7 +1307,7 @@ int Fl_Preferences::Node::write( FILE *f ) {
|
|||
char *src = entry_[i].value;
|
||||
if ( src ) { // hack it into smaller pieces if needed
|
||||
fprintf( f, "%s:", entry_[i].name );
|
||||
int cnt, written;
|
||||
size_t cnt, written;
|
||||
for ( cnt = 0; cnt < 60; cnt++ )
|
||||
if ( src[cnt]==0 ) break;
|
||||
written = fwrite( src, cnt, 1, f );
|
||||
|
@ -1399,7 +1399,7 @@ void Fl_Preferences::Node::set( const char *line ) {
|
|||
} else {
|
||||
const char *c = strchr( line, ':' );
|
||||
if ( c ) {
|
||||
unsigned int len = c-line+1;
|
||||
size_t len = c-line+1;
|
||||
if ( len >= sizeof( nameBuffer ) )
|
||||
len = sizeof( nameBuffer );
|
||||
strlcpy( nameBuffer, line, len );
|
||||
|
@ -1415,8 +1415,8 @@ void Fl_Preferences::Node::set( const char *line ) {
|
|||
void Fl_Preferences::Node::add( const char *line ) {
|
||||
if ( lastEntrySet<0 || lastEntrySet>=nEntry_ ) return;
|
||||
char *&dst = entry_[ lastEntrySet ].value;
|
||||
int a = strlen( dst );
|
||||
int b = strlen( line );
|
||||
size_t a = strlen( dst );
|
||||
size_t b = strlen( line );
|
||||
dst = (char*)realloc( dst, a+b+1 );
|
||||
memcpy( dst+a, line, b+1 );
|
||||
dirty_ = 1;
|
||||
|
@ -1452,7 +1452,7 @@ char Fl_Preferences::Node::deleteEntry( const char *name ) {
|
|||
// - this method will always return a valid node (except for memory allocation problems)
|
||||
// - if the node was not found, 'find' will create the required branch
|
||||
Fl_Preferences::Node *Fl_Preferences::Node::find( const char *path ) {
|
||||
int len = strlen( path_ );
|
||||
int len = (int) strlen( path_ );
|
||||
if ( strncmp( path, path_, len ) == 0 ) {
|
||||
if ( path[ len ] == 0 )
|
||||
return this;
|
||||
|
@ -1494,9 +1494,9 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset
|
|||
return nn->search( path+2, 2 ); // do a relative search on the root node
|
||||
}
|
||||
}
|
||||
offset = strlen( path_ ) + 1;
|
||||
offset = (int) strlen( path_ ) + 1;
|
||||
}
|
||||
int len = strlen( path_ );
|
||||
int len = (int) strlen( path_ );
|
||||
if ( len < offset-1 ) return 0;
|
||||
len -= offset;
|
||||
if ( ( len <= 0 ) || ( strncmp( path, path_+offset, len ) == 0 ) ) {
|
||||
|
|
|
@ -174,7 +174,7 @@ void Fl_Text_Buffer::text(const char *t)
|
|||
free((void *) mBuf);
|
||||
|
||||
/* Start a new buffer with a gap of mPreferredGapSize at the end */
|
||||
int insertedLength = strlen(t);
|
||||
int insertedLength = (int) strlen(t);
|
||||
mBuf = (char *) malloc(insertedLength + mPreferredGapSize);
|
||||
mLength = insertedLength;
|
||||
mGapStart = insertedLength;
|
||||
|
@ -1117,7 +1117,7 @@ int Fl_Text_Buffer::insert_(int pos, const char *text)
|
|||
if (!text || !*text)
|
||||
return 0;
|
||||
|
||||
int insertedLength = strlen(text);
|
||||
int insertedLength = (int) strlen(text);
|
||||
|
||||
/* Prepare the buffer to receive the new text. If the new text fits in
|
||||
the current buffer, just move the gap (if necessary) to where
|
||||
|
@ -1616,9 +1616,9 @@ static int utf8_input_filter(char *buffer, // result buffer we fill with utf8
|
|||
q = buffer;
|
||||
while (q < buffer + buflen) {
|
||||
if (p >= endline) { // walked off end of input file's line buffer?
|
||||
r = fread(line, 1, sline, fp); // read another block of sline bytes from file
|
||||
r = (int) fread(line, 1, sline, fp); // read another block of sline bytes from file
|
||||
endline = line + r;
|
||||
if (r == 0) return q - buffer; // EOF? return bytes read into buffer[]
|
||||
if (r == 0) return (int) (q - buffer); // EOF? return bytes read into buffer[]
|
||||
p = line;
|
||||
}
|
||||
// Predict length of utf8 sequence
|
||||
|
@ -1629,7 +1629,7 @@ static int utf8_input_filter(char *buffer, // result buffer we fill with utf8
|
|||
if (p + l > endline) { // would walk off end of line buffer?
|
||||
memmove(line, p, endline - p); // re-jigger line buffer to get some room
|
||||
endline -= (p - line);
|
||||
r = fread(endline, 1, sline - (endline - line), fp); // re-fill line buffer
|
||||
r = (int) fread(endline, 1, sline - (endline - line), fp); // re-fill line buffer
|
||||
endline += r;
|
||||
p = line;
|
||||
if (endline - line < l) break; // sequence *still* extends past end? stop loop
|
||||
|
@ -1642,7 +1642,7 @@ static int utf8_input_filter(char *buffer, // result buffer we fill with utf8
|
|||
if (q + lq > buffer + buflen) { // encoding would walk off end of buffer[]?
|
||||
memmove(line, p, endline - p); // re-jigger line[] buffer for next call
|
||||
endline -= (p - line); // adjust end of line[] buffer for next call
|
||||
return q - buffer; // return what's decoded so far, caller will consume buffer
|
||||
return (int) (q - buffer); // return what's decoded so far, caller will consume buffer
|
||||
}
|
||||
memcpy(q, multibyte, lq);
|
||||
q += lq;
|
||||
|
@ -1652,7 +1652,7 @@ static int utf8_input_filter(char *buffer, // result buffer we fill with utf8
|
|||
}
|
||||
memmove(line, p, endline - p);
|
||||
endline -= (p - line);
|
||||
return q - buffer;
|
||||
return (int) (q - buffer);
|
||||
}
|
||||
|
||||
const char *Fl_Text_Buffer::file_encoding_warning_message =
|
||||
|
@ -1715,7 +1715,7 @@ int Fl_Text_Buffer::outputfile(const char *file,
|
|||
return 1;
|
||||
for (int n; (n = min(end - start, buflen)); start += n) {
|
||||
const char *p = text_range(start, start + n);
|
||||
int r = fwrite(p, 1, n, fp);
|
||||
int r = (int) fwrite(p, 1, n, fp);
|
||||
free((void *) p);
|
||||
if (r != n)
|
||||
break;
|
||||
|
|
|
@ -723,7 +723,7 @@ void Fl_Text_Display::insert(const char* text) {
|
|||
|
||||
int pos = mCursorPos;
|
||||
|
||||
mCursorToHint = pos + strlen( text );
|
||||
mCursorToHint = (int) (pos + strlen( text ));
|
||||
mBuffer->insert( pos, text );
|
||||
mCursorToHint = NO_HINT;
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ void Fl_Text_Display::overstrike(const char* text) {
|
|||
int startPos = mCursorPos;
|
||||
Fl_Text_Buffer *buf = mBuffer;
|
||||
int lineStart = buf->line_start( startPos );
|
||||
int textLen = strlen( text );
|
||||
int textLen = (int) strlen( text );
|
||||
int i, p, endPos, indent, startIndent, endIndent;
|
||||
const char *c;
|
||||
unsigned int ch;
|
||||
|
@ -3703,7 +3703,7 @@ int Fl_Text_Display::handle(int event) {
|
|||
}
|
||||
|
||||
const char* copy = buffer()->selection_text();
|
||||
if (*copy) Fl::copy(copy, strlen(copy), 0);
|
||||
if (*copy) Fl::copy(copy, (int) strlen(copy), 0);
|
||||
free((void*)copy);
|
||||
return 1;
|
||||
}
|
||||
|
@ -3737,7 +3737,7 @@ int Fl_Text_Display::handle(int event) {
|
|||
if ((Fl::event_state()&(FL_CTRL|FL_COMMAND)) && Fl::event_key()=='c') {
|
||||
if (!buffer()->selected()) return 1;
|
||||
const char *copy = buffer()->selection_text();
|
||||
if (*copy) Fl::copy(copy, strlen(copy), 1);
|
||||
if (*copy) Fl::copy(copy, (int) strlen(copy), 1);
|
||||
free((void*)copy);
|
||||
return 1;
|
||||
}
|
||||
|
@ -3746,7 +3746,7 @@ int Fl_Text_Display::handle(int event) {
|
|||
if ((Fl::event_state()&(FL_CTRL|FL_COMMAND)) && Fl::event_key()=='a') {
|
||||
buffer()->select(0,buffer()->length());
|
||||
const char *copy = buffer()->selection_text();
|
||||
if (*copy) Fl::copy(copy, strlen(copy), 0);
|
||||
if (*copy) Fl::copy(copy, (int) strlen(copy), 0);
|
||||
free((void*)copy);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ int Fl_Text_Editor::kf_shift_move(int c, Fl_Text_Editor* e) {
|
|||
fl_text_drag_me(e->insert_position(), e);
|
||||
char *copy = e->buffer()->selection_text();
|
||||
if (copy) {
|
||||
Fl::copy(copy, strlen(copy), 0);
|
||||
Fl::copy(copy, (int) strlen(copy), 0);
|
||||
free(copy);
|
||||
}
|
||||
return 1;
|
||||
|
@ -459,7 +459,7 @@ int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
|
|||
int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
|
||||
if (!e->buffer()->selected()) return 1;
|
||||
const char *copy = e->buffer()->selection_text();
|
||||
if (*copy) Fl::copy(copy, strlen(copy), 1);
|
||||
if (*copy) Fl::copy(copy, (int) strlen(copy), 1);
|
||||
free((void*)copy);
|
||||
e->show_insert_position();
|
||||
return 1;
|
||||
|
@ -488,7 +488,7 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
|
|||
int Fl_Text_Editor::kf_select_all(int, Fl_Text_Editor* e) {
|
||||
e->buffer()->select(0, e->buffer()->length());
|
||||
const char *copy = e->buffer()->selection_text();
|
||||
if (*copy) Fl::copy(copy, strlen(copy), 0);
|
||||
if (*copy) Fl::copy(copy, (int) strlen(copy), 0);
|
||||
free((void*)copy);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -572,7 +572,7 @@ int Fl_Tree::item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *
|
|||
if ( item->is_root() && showroot() == 0 ) break; // don't include root in path if showroot() off
|
||||
// Find name of current item
|
||||
const char *name = item->label() ? item->label() : "???"; // name for this item
|
||||
int len = strlen(name);
|
||||
int len = (int) strlen(name);
|
||||
// Add name to end of pathname[]
|
||||
for ( --len; len>=0; len-- ) {
|
||||
SAFE_RCAT(name[len]); // rcat name of item
|
||||
|
@ -1719,7 +1719,7 @@ Fl_Tree_Reason Fl_Tree::callback_reason() const {
|
|||
*/
|
||||
void Fl_Tree::load(Fl_Preferences &prefs)
|
||||
{
|
||||
int i, j, n, pn = strlen(prefs.path());
|
||||
int i, j, n, pn = (int) strlen(prefs.path());
|
||||
char *p;
|
||||
const char *path = prefs.path();
|
||||
if (strcmp(path, ".")==0)
|
||||
|
@ -1736,21 +1736,21 @@ void Fl_Tree::load(Fl_Preferences &prefs)
|
|||
for (i=0; i<n; i++) {
|
||||
// We must remove all fwd slashes in the key and value strings. Replace with backslash.
|
||||
char *key = strdup(prefs.entry(i));
|
||||
int kn = strlen(key);
|
||||
int kn = (int) strlen(key);
|
||||
for (j=0; j<kn; j++) {
|
||||
if (key[j]=='/') key[j]='\\';
|
||||
}
|
||||
char *val; prefs.get(key, val, "");
|
||||
int vn = strlen(val);
|
||||
int vn = (int) strlen(val);
|
||||
for (j=0; j<vn; j++) {
|
||||
if (val[j]=='/') val[j]='\\';
|
||||
}
|
||||
if (vn<40) {
|
||||
int sze = pn + strlen(key) + vn;
|
||||
size_t sze = pn + strlen(key) + vn;
|
||||
p = (char*)malloc(sze+5);
|
||||
sprintf(p, "%s/%s = %s", path, key, val);
|
||||
} else {
|
||||
int sze = pn + strlen(key) + 40;
|
||||
size_t sze = pn + strlen(key) + 40;
|
||||
p = (char*)malloc(sze+5);
|
||||
sprintf(p, "%s/%s = %.40s...", path, key, val);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ int Fl_Valuator::format(char* buffer) {
|
|||
// seems to be needed to get high precission
|
||||
snprintf(temp, sizeof(temp), "%.12f", A/B);
|
||||
// strip all trailing 0's
|
||||
for (i=strlen(temp)-1; i>0; i--) {
|
||||
for (i=(int) strlen(temp)-1; i>0; i--) {
|
||||
if (temp[i]!='0') break;
|
||||
}
|
||||
// count digits until we find the decimal point (or comma or whatever
|
||||
|
|
|
@ -68,7 +68,7 @@ Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
|
|||
if (*q == '\\') switch (*++q) {
|
||||
case '\r':
|
||||
case '\n':
|
||||
if (!fgets(q,(buffer+MAXSIZE+20)-q,f)) { /* no problem if we hit EOF */ } break;
|
||||
if (!fgets(q,(int) (buffer+MAXSIZE+20-q),f)) { /* no problem if we hit EOF */ } break;
|
||||
case 0:
|
||||
break;
|
||||
case 'x': {
|
||||
|
|
|
@ -98,8 +98,8 @@ static void set_selection_color(uchar r, uchar g, uchar b) {
|
|||
// simulation of XParseColor:
|
||||
int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
|
||||
if (*p == '#') p++;
|
||||
int n = strlen(p);
|
||||
int m = n/3;
|
||||
size_t n = strlen(p);
|
||||
size_t m = n/3;
|
||||
const char *pattern = 0;
|
||||
switch(m) {
|
||||
case 1: pattern = "%1x%1x%1x"; break;
|
||||
|
|
|
@ -242,7 +242,7 @@ static int fd_array_size = 0;
|
|||
static struct FD {
|
||||
int fd;
|
||||
short events;
|
||||
void (*cb)(int, void*);
|
||||
void (*cb)(FL_SOCKET, void*); // keep socket api opaque at this level to reduce multiplatform deps headaches
|
||||
void* arg;
|
||||
} *fd = 0;
|
||||
|
||||
|
@ -276,7 +276,7 @@ void fl_set_status(int x, int y, int w, int h)
|
|||
{
|
||||
}
|
||||
|
||||
void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
|
||||
void Fl::add_fd(int n, int events, void (*cb)(FL_SOCKET, void*), void *v) {
|
||||
remove_fd(n,events);
|
||||
int i = nfds++;
|
||||
if (i >= fd_array_size) {
|
||||
|
@ -294,7 +294,7 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
|
|||
if (n > maxfd) maxfd = n;
|
||||
}
|
||||
|
||||
void Fl::add_fd(int fd, void (*cb)(int, void*), void* v) {
|
||||
void Fl::add_fd(int fd, void (*cb)(FL_SOCKET, void*), void* v) {
|
||||
Fl::add_fd(fd, FL_READ, cb, v);
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
|
|||
else *o++ = *i++;
|
||||
}
|
||||
*o = 0;
|
||||
Fl::e_length = o - Fl::e_text;
|
||||
Fl::e_length = (int) (o - Fl::e_text);
|
||||
receiver.handle(FL_PASTE);
|
||||
delete [] Fl::e_text;
|
||||
Fl::e_text = 0;
|
||||
|
@ -598,9 +598,9 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
|
|||
HANDLE h = GetClipboardData(CF_UNICODETEXT);
|
||||
if (h) {
|
||||
wchar_t *memLock = (wchar_t*) GlobalLock(h);
|
||||
int utf16_len = wcslen(memLock);
|
||||
size_t utf16_len = wcslen(memLock);
|
||||
Fl::e_text = (char*) malloc (utf16_len * 4 + 1);
|
||||
int utf8_len = fl_utf8fromwc(Fl::e_text, utf16_len * 4, memLock, utf16_len);
|
||||
unsigned utf8_len = fl_utf8fromwc(Fl::e_text, (unsigned) (utf16_len * 4), memLock, (unsigned) utf16_len);
|
||||
*(Fl::e_text + utf8_len) = 0;
|
||||
LPSTR a,b;
|
||||
a = b = Fl::e_text;
|
||||
|
@ -609,7 +609,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
|
|||
else *b++ = *a++;
|
||||
}
|
||||
*b = 0;
|
||||
Fl::e_length = b - Fl::e_text;
|
||||
Fl::e_length = (int) (b - Fl::e_text);
|
||||
receiver.handle(FL_PASTE);
|
||||
GlobalUnlock(h);
|
||||
free(Fl::e_text);
|
||||
|
@ -769,7 +769,7 @@ static const struct {unsigned short vk, fltk, extended;} vktab[] = {
|
|||
{0xde, '\''},
|
||||
{VK_OEM_102, FL_Iso_Key}
|
||||
};
|
||||
static int ms2fltk(int vk, int extended) {
|
||||
static int ms2fltk(WPARAM vk, int extended) {
|
||||
static unsigned short vklut[256];
|
||||
static unsigned short extendedlut[256];
|
||||
if (!vklut[1]) { // init the table
|
||||
|
@ -1316,7 +1316,7 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by)
|
|||
X+=xoff;
|
||||
Y+=yoff;
|
||||
|
||||
if (w->flags() & Fl_Widget::FULLSCREEN) {
|
||||
if (w->is_fullscreen()) {
|
||||
X = Y = 0;
|
||||
bx = by = bt = 0;
|
||||
}
|
||||
|
@ -1489,9 +1489,10 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
|||
|
||||
// convert UTF-8 class_name to wchar_t for RegisterClassExW and CreateWindowExW
|
||||
|
||||
fl_utf8toUtf16(class_name,strlen(class_name), // in
|
||||
fl_utf8toUtf16(class_name,
|
||||
(unsigned)strlen(class_name), // in
|
||||
(unsigned short*)class_namew, // out
|
||||
sizeof(class_namew)/sizeof(wchar_t)); // max. size
|
||||
(unsigned)sizeof(class_namew)/sizeof(wchar_t)); // max. size
|
||||
|
||||
if (!class_name_list.has_name(class_name)) {
|
||||
WNDCLASSEXW wcw;
|
||||
|
@ -1606,14 +1607,14 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
|||
|
||||
WCHAR *lab = NULL;
|
||||
if (w->label()) {
|
||||
int l = strlen(w->label());
|
||||
size_t l = strlen(w->label());
|
||||
// lab = (WCHAR*) malloc((l + 1) * sizeof(short));
|
||||
// l = fl_utf2unicode((unsigned char*)w->label(), l, (xchar*)lab);
|
||||
// lab[l] = 0;
|
||||
unsigned wlen = fl_utf8toUtf16(w->label(), l, NULL, 0); // Pass NULL to query length
|
||||
unsigned wlen = fl_utf8toUtf16(w->label(), (unsigned) l, NULL, 0); // Pass NULL to query length
|
||||
wlen++;
|
||||
lab = (WCHAR *) malloc(sizeof(WCHAR)*wlen);
|
||||
wlen = fl_utf8toUtf16(w->label(), l, (unsigned short*)lab, wlen);
|
||||
wlen = fl_utf8toUtf16(w->label(), (unsigned) l, (unsigned short*)lab, wlen);
|
||||
lab[wlen] = 0;
|
||||
}
|
||||
x->xid = CreateWindowExW(
|
||||
|
@ -1627,7 +1628,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
|||
);
|
||||
if (lab) free(lab);
|
||||
|
||||
if (w->flags() & Fl_Widget::FULLSCREEN) {
|
||||
if (w->is_fullscreen()) {
|
||||
/* We need to make sure that the fullscreen is created on the
|
||||
default monitor, ie the desktop where the shortcut is located
|
||||
etc. This requires that CreateWindow is called with CW_USEDEFAULT
|
||||
|
@ -1686,7 +1687,7 @@ static LRESULT CALLBACK s_TimerProc(HWND hwnd, UINT msg,
|
|||
switch (msg) {
|
||||
case WM_TIMER:
|
||||
{
|
||||
unsigned int id = wParam - 1;
|
||||
unsigned int id = (unsigned) (wParam - 1);
|
||||
if (id < (unsigned int)win32_timer_used && win32_timers[id].handle) {
|
||||
Fl_Timeout_Handler cb = win32_timers[id].callback;
|
||||
void* data = win32_timers[id].data;
|
||||
|
@ -1836,13 +1837,13 @@ void Fl_Window::label(const char *name,const char *iname) {
|
|||
iconlabel_ = iname;
|
||||
if (shown() && !parent()) {
|
||||
if (!name) name = "";
|
||||
int l = strlen(name);
|
||||
size_t l = strlen(name);
|
||||
// WCHAR *lab = (WCHAR*) malloc((l + 1) * sizeof(short));
|
||||
// l = fl_utf2unicode((unsigned char*)name, l, (xchar*)lab);
|
||||
unsigned wlen = fl_utf8toUtf16(name, l, NULL, 0); // Pass NULL to query length
|
||||
unsigned wlen = fl_utf8toUtf16(name, (unsigned) l, NULL, 0); // Pass NULL to query length
|
||||
wlen++;
|
||||
unsigned short * lab = (unsigned short*)malloc(sizeof(unsigned short)*wlen);
|
||||
wlen = fl_utf8toUtf16(name, l, lab, wlen);
|
||||
wlen = fl_utf8toUtf16(name, (unsigned) l, lab, wlen);
|
||||
lab[wlen] = 0;
|
||||
SetWindowTextW(i->xid, (WCHAR *)lab);
|
||||
free(lab);
|
||||
|
|
|
@ -97,7 +97,7 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
|
|||
// also if it starts with "A:"
|
||||
if (value[0] && value[1]==':') start = a;
|
||||
#endif
|
||||
int t = strlen(value); if (isdirsep(value[t-1])) t--;
|
||||
int t = (int) strlen(value); if (isdirsep(value[t-1])) t--;
|
||||
if ((end+1-e+t) >= tolen) end += tolen - (end+1-e+t);
|
||||
memmove(a+t, e, end+1-e);
|
||||
end = a+t+(end-e);
|
||||
|
|
|
@ -54,7 +54,7 @@ int fl_filename_isdir(const char* n) {
|
|||
char fn[FL_PATH_MAX];
|
||||
int length;
|
||||
|
||||
length = strlen(n);
|
||||
length = (int) strlen(n);
|
||||
|
||||
#ifdef WIN32
|
||||
// This workaround brought to you by the fine folks at Microsoft!
|
||||
|
|
|
@ -62,7 +62,7 @@ static char avoidRecursion = 0;
|
|||
// pointer to one of the buttons or an Fl_Window* pointer to the
|
||||
// message window (message_form).
|
||||
static void button_cb(Fl_Widget *, void *val) {
|
||||
ret_val = (fl_intptr_t)val;
|
||||
ret_val = (int) (fl_intptr_t)val;
|
||||
message_form->hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ static int mbcs2utf(const char *s, int l, char *dst)
|
|||
if (!s) return 0;
|
||||
dstlen = (l * 6) + 6;
|
||||
mbwbuf = (xchar*)malloc(dstlen * sizeof(xchar));
|
||||
l = mbstowcs(mbwbuf, s, l);
|
||||
l = (int) mbstowcs(mbwbuf, s, l);
|
||||
/* l = fl_unicode2utf(mbwbuf, l, dst); */
|
||||
l = fl_utf8fromwc(dst, dstlen, mbwbuf, l);
|
||||
dst[l] = 0;
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
}
|
||||
*b = 0;
|
||||
Fl::e_text = currDragData;
|
||||
Fl::e_length = b - currDragData;
|
||||
Fl::e_length = (int) (b - currDragData);
|
||||
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE); // e_text will be invalid after this call
|
||||
Fl::e_number = old_event;
|
||||
SetForegroundWindow( hwnd );
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
q += len;
|
||||
}
|
||||
*q = 0;
|
||||
currDragSize = q - currDragData;
|
||||
currDragSize = (int) (q - currDragData);
|
||||
currDragData = (char*)realloc(currDragData, currDragSize + 1);
|
||||
GlobalUnlock( medium.hGlobal );
|
||||
ReleaseStgMedium( &medium );
|
||||
|
|
|
@ -118,7 +118,7 @@ fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n,
|
|||
if (!c || c == ' ' || c == '\n') {
|
||||
// test for word-wrap:
|
||||
if (word_start < p && wrap) {
|
||||
double newwidth = w + fl_width(word_end, o-word_end);
|
||||
double newwidth = w + fl_width(word_end, (int) (o-word_end) );
|
||||
if (word_end > buf && newwidth > maxw) { // break before this word
|
||||
o = word_end;
|
||||
p = word_start;
|
||||
|
@ -135,7 +135,7 @@ fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n,
|
|||
if (o > e) break; // don't overflow buffer
|
||||
|
||||
if (c == '\t') {
|
||||
for (c = fl_utf_nb_char((uchar*)buf, o-buf)%8; c<8 && o<e; c++)
|
||||
for (c = fl_utf_nb_char((uchar*)buf, (int) (o-buf) )%8; c<8 && o<e; c++)
|
||||
*o++ = ' ';
|
||||
} else if (c == '&' && fl_draw_shortcut && *(p+1)) {
|
||||
if (*(p+1) == '&') {p++; *o++ = '&';}
|
||||
|
@ -160,9 +160,9 @@ fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n,
|
|||
}
|
||||
}
|
||||
|
||||
width = w + fl_width(word_end, o-word_end);
|
||||
width = w + fl_width(word_end, (int) (o-word_end));
|
||||
*o = 0;
|
||||
n = o-buf;
|
||||
n = (int) (o-buf);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ void fl_draw(
|
|||
callthis(buf,buflen,xpos,ypos-desc);
|
||||
|
||||
if (underline_at && underline_at >= buf && underline_at < (buf + buflen))
|
||||
callthis("_",1,xpos+int(fl_width(buf,underline_at-buf)),ypos-desc);
|
||||
callthis("_",1,xpos+int(fl_width(buf,(int) (underline_at-buf))),ypos-desc);
|
||||
|
||||
if (!*e || (*e == '@' && e[1] != '@')) break;
|
||||
p = e;
|
||||
|
|
|
@ -78,7 +78,7 @@ static int n_buf = 0;
|
|||
|
||||
const char *fl_local_to_mac_roman(const char *t, int n)
|
||||
{
|
||||
if (n==-1) n = strlen(t);
|
||||
if (n==-1) n = (int) strlen(t);
|
||||
if (n<=n_buf) {
|
||||
n_buf = (n + 257) & 0x7fffff00;
|
||||
if (buf) free(buf);
|
||||
|
@ -99,7 +99,7 @@ const char *fl_local_to_mac_roman(const char *t, int n)
|
|||
|
||||
const char *fl_mac_roman_to_local(const char *t, int n)
|
||||
{
|
||||
if (n==-1) n = strlen(t);
|
||||
if (n==-1) n = (int) strlen(t);
|
||||
if (n<=n_buf) {
|
||||
n_buf = (n + 257) & 0x7fffff00;
|
||||
if (buf) free(buf);
|
||||
|
|
|
@ -57,20 +57,20 @@
|
|||
|
||||
|
||||
double fl_width(const char* c) {
|
||||
if (c) return fl_width(c, strlen(c));
|
||||
if (c) return fl_width(c, (int) strlen(c));
|
||||
else return 0.0f;
|
||||
}
|
||||
|
||||
void fl_draw(const char* str, int x, int y) {
|
||||
fl_draw(str, strlen(str), x, y);
|
||||
fl_draw(str, (int) strlen(str), x, y);
|
||||
}
|
||||
|
||||
void fl_draw(int angle, const char* str, int x, int y) {
|
||||
fl_draw(angle, str, strlen(str), x, y);//must be fixed!
|
||||
fl_draw(angle, str, (int) strlen(str), x, y);//must be fixed!
|
||||
}
|
||||
|
||||
void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
|
||||
if (c) fl_text_extents(c, strlen(c), dx, dy, w, h);
|
||||
if (c) fl_text_extents(c, (int) strlen(c), dx, dy, w, h);
|
||||
else {
|
||||
w = 0; h = 0;
|
||||
dx = 0; dy = 0;
|
||||
|
|
|
@ -72,7 +72,7 @@ inline Fl_Color shade_color(uchar gc, Fl_Color bc) {
|
|||
|
||||
static void frame_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
int b = strlen(c) / 4 + 1;
|
||||
int b = ((int) strlen(c)) / 4 + 1;
|
||||
|
||||
for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ static void frame_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
|||
|
||||
static void frame_round(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
int b = strlen(c) / 4 + 1;
|
||||
size_t b = strlen(c) / 4 + 1;
|
||||
|
||||
if (w==h) {
|
||||
for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2)
|
||||
|
@ -147,8 +147,8 @@ static void frame_round(int x, int y, int w, int h, const char *c, Fl_Color bc)
|
|||
static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
int i, j;
|
||||
int clen = strlen(c) - 1;
|
||||
int chalf = clen / 2;
|
||||
int clen = (int) strlen(c) - 1;
|
||||
int chalf = clen / 2;
|
||||
int cstep = 1;
|
||||
|
||||
if (h < (w * 2)) {
|
||||
|
@ -219,8 +219,8 @@ static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
|||
static void shade_round(int x, int y, int w, int h, const char *c, Fl_Color bc) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
int i;
|
||||
int clen = strlen(c) - 1;
|
||||
int chalf = clen / 2;
|
||||
int clen = (int) (strlen(c) - 1);
|
||||
int chalf = clen / 2;
|
||||
|
||||
if (w>h) {
|
||||
int d = h/2;
|
||||
|
|
|
@ -62,11 +62,11 @@ enumcbw(CONST LOGFONTW *lpelf,
|
|||
LPARAM p) {
|
||||
if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
|
||||
char *n = NULL;
|
||||
int l = wcslen(lpelf->lfFaceName);
|
||||
unsigned dstlen = fl_utf8fromwc(n, 0, (xchar*)lpelf->lfFaceName, l) + 1; // measure the string
|
||||
size_t l = wcslen(lpelf->lfFaceName);
|
||||
unsigned dstlen = fl_utf8fromwc(n, 0, (xchar*)lpelf->lfFaceName, (unsigned) l) + 1; // measure the string
|
||||
n = (char*) malloc(dstlen);
|
||||
//n[fl_unicode2utf((xchar*)lpelf->lfFaceName, l, n)] = 0;
|
||||
dstlen = fl_utf8fromwc(n, dstlen, (xchar*)lpelf->lfFaceName, l); // convert the string
|
||||
dstlen = fl_utf8fromwc(n, dstlen, (xchar*)lpelf->lfFaceName, (unsigned) l); // convert the string
|
||||
n[dstlen] = 0;
|
||||
for (int i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
|
||||
if (!strcmp(Fl::get_font_name((Fl_Font)i),n)) {free(n);return 1;}
|
||||
|
@ -146,10 +146,10 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
|||
// unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
|
||||
// fl_utf2unicode((unsigned char*)s->name+1, l, (xchar*)b);
|
||||
const char *nm = (const char*)s->name+1;
|
||||
int len = strlen(s->name+1);
|
||||
int l = fl_utf8toUtf16(nm, len, NULL, 0); // Pass NULL to query length required
|
||||
size_t len = strlen(s->name+1);
|
||||
unsigned l = fl_utf8toUtf16(nm, (unsigned) len, NULL, 0); // Pass NULL to query length required
|
||||
unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
|
||||
l = fl_utf8toUtf16(nm, len, b, (l+1)); // Now do the conversion
|
||||
l = fl_utf8toUtf16(nm, (unsigned) len, b, (l+1)); // Now do the conversion
|
||||
b[l] = 0;
|
||||
EnumFontFamiliesW(fl_gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0);
|
||||
free(b);
|
||||
|
|
108
src/fl_utf8.cxx
108
src/fl_utf8.cxx
|
@ -242,8 +242,8 @@ int fl_utf_strncasecmp(const char *s1, const char *s2, int n)
|
|||
*/
|
||||
int fl_utf_strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
int s1_l = strlen(s1);
|
||||
int s2_l = strlen(s2);
|
||||
int s1_l = (int) strlen(s1);
|
||||
int s2_l = (int) strlen(s2);
|
||||
|
||||
if (s1_l < s2_l) {
|
||||
return -1;
|
||||
|
@ -469,19 +469,19 @@ char * fl_utf2mbcs(const char *s)
|
|||
{
|
||||
if (!s) return NULL;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(s);
|
||||
size_t l = strlen(s);
|
||||
static char *buf = NULL;
|
||||
|
||||
// mbwbuf = (xchar*)realloc(mbwbuf, (l+6) * sizeof(xchar));
|
||||
// l = fl_utf2unicode((unsigned char*)s, l, mbwbuf);
|
||||
// mbwbuf[l] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(s, l, NULL, 0) + 7; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(s, (unsigned) l, NULL, 0) + 7; // Query length
|
||||
mbwbuf = (xchar*)realloc(mbwbuf, sizeof(xchar)*wn);
|
||||
l = fl_utf8toUtf16(s, l, (unsigned short *)mbwbuf, wn); // Convert string
|
||||
l = fl_utf8toUtf16(s, (unsigned) l, (unsigned short *)mbwbuf, wn); // Convert string
|
||||
mbwbuf[l] = 0;
|
||||
|
||||
buf = (char*)realloc(buf, l * 6 + 1);
|
||||
l = wcstombs(buf, mbwbuf, l * 6);
|
||||
buf = (char*)realloc(buf, (unsigned) (l * 6 + 1));
|
||||
l = (unsigned) wcstombs(buf, mbwbuf, (unsigned) l * 6);
|
||||
buf[l] = 0;
|
||||
return buf;
|
||||
#else
|
||||
|
@ -522,22 +522,22 @@ static xchar *wbuf1 = NULL;
|
|||
char *fl_getenv(const char* v)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(v);
|
||||
size_t l = strlen(v);
|
||||
// static xchar* wbuf = NULL;
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)v, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(v, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(v, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(v, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(v, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
xchar *ret = _wgetenv(wbuf);
|
||||
static char *buf = NULL;
|
||||
if (ret) {
|
||||
l = wcslen(ret);
|
||||
wn = fl_utf8fromwc(NULL, 0, ret, l) + 1; // query length
|
||||
l = (unsigned) wcslen(ret);
|
||||
wn = fl_utf8fromwc(NULL, 0, ret, (unsigned) l) + 1; // query length
|
||||
buf = (char*) realloc(buf, wn);
|
||||
// buf[fl_unicode2utf(ret, l, buf)] = 0;
|
||||
wn = fl_utf8fromwc(buf, wn, ret, l); // convert string
|
||||
wn = fl_utf8fromwc(buf, wn, ret, (unsigned) l); // convert string
|
||||
buf[wn] = 0;
|
||||
return buf;
|
||||
} else {
|
||||
|
@ -556,7 +556,7 @@ int fl_open(const char* f, int oflags, ...)
|
|||
pmode = va_arg (ap, int);
|
||||
va_end(ap);
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
unsigned l = (unsigned) strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
|
@ -574,19 +574,19 @@ int fl_open(const char* f, int oflags, ...)
|
|||
FILE *fl_fopen(const char* f, const char *mode)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
l = strlen(mode);
|
||||
// wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar) * (l+1));
|
||||
// wbuf1[fl_utf2unicode((const unsigned char*)mode, l, wbuf1)] = 0;
|
||||
wn = fl_utf8toUtf16(mode, l, NULL, 0) + 1; // Query length
|
||||
wn = fl_utf8toUtf16(mode, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(mode, l, (unsigned short *)wbuf1, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(mode, (unsigned) l, (unsigned short *)wbuf1, wn); // Convert string
|
||||
wbuf1[wn] = 0;
|
||||
return _wfopen(wbuf, wbuf1);
|
||||
#else
|
||||
|
@ -600,12 +600,12 @@ int fl_system(const char* f)
|
|||
# ifdef __MINGW32__
|
||||
return system(fl_utf2mbcs(f));
|
||||
# else
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wsystem(wbuf);
|
||||
# endif
|
||||
|
@ -620,14 +620,14 @@ int fl_execvp(const char *file, char *const *argv)
|
|||
#ifdef __MINGW32__
|
||||
return _execvp(fl_utf2mbcs(file), argv);
|
||||
#else
|
||||
int l = strlen(file);
|
||||
size_t l = strlen(file);
|
||||
int i, n, ret;
|
||||
xchar **ar;
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)file, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(file, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(file, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(file, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(file, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
|
||||
i = 0; n = 0;
|
||||
|
@ -639,9 +639,9 @@ int fl_execvp(const char *file, char *const *argv)
|
|||
l = strlen(argv[i]);
|
||||
// ar[i] = (xchar *)malloc(sizeof(xchar) * (l+1));
|
||||
// ar[i][fl_utf2unicode((const unsigned char*)argv[i], l, ar[i])] = 0;
|
||||
wn = fl_utf8toUtf16(argv[i], l, NULL, 0) + 1; // Query length
|
||||
wn = fl_utf8toUtf16(argv[i], (unsigned) l, NULL, 0) + 1; // Query length
|
||||
ar[i] = (xchar *)malloc(sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(argv[i], l, (unsigned short *)ar[i], wn); // Convert string
|
||||
wn = fl_utf8toUtf16(argv[i], (unsigned) l, (unsigned short *)ar[i], wn); // Convert string
|
||||
ar[i][wn] = 0;
|
||||
i++;
|
||||
}
|
||||
|
@ -665,12 +665,12 @@ int fl_execvp(const char *file, char *const *argv)
|
|||
int fl_chmod(const char* f, int mode)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wchmod(wbuf, mode);
|
||||
#else
|
||||
|
@ -681,12 +681,12 @@ int fl_chmod(const char* f, int mode)
|
|||
int fl_access(const char* f, int mode)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _waccess(wbuf, mode);
|
||||
#else
|
||||
|
@ -698,12 +698,12 @@ int fl_access(const char* f, int mode)
|
|||
int fl_stat(const char* f, struct stat *b)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wstat(wbuf, (struct _stat*)b);
|
||||
#else
|
||||
|
@ -723,9 +723,9 @@ char *fl_getcwd(char* b, int l)
|
|||
xchar *ret = _wgetcwd(wbuf, l);
|
||||
if (ret) {
|
||||
unsigned dstlen = l;
|
||||
l = wcslen(wbuf);
|
||||
l = (int) wcslen(wbuf);
|
||||
// b[fl_unicode2utf(wbuf, l, b)] = 0;
|
||||
dstlen = fl_utf8fromwc(b, dstlen, wbuf, l);
|
||||
dstlen = fl_utf8fromwc(b, dstlen, wbuf, (unsigned) l);
|
||||
b[dstlen] = 0;
|
||||
return b;
|
||||
} else {
|
||||
|
@ -740,12 +740,12 @@ char *fl_getcwd(char* b, int l)
|
|||
int fl_unlink(const char* f)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wunlink(wbuf);
|
||||
#else
|
||||
|
@ -756,12 +756,12 @@ int fl_unlink(const char* f)
|
|||
int fl_mkdir(const char* f, int mode)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(short) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wmkdir(wbuf);
|
||||
#else
|
||||
|
@ -773,12 +773,12 @@ int fl_mkdir(const char* f, int mode)
|
|||
int fl_rmdir(const char* f)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
size_t l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
return _wrmdir(wbuf);
|
||||
#else
|
||||
|
@ -789,15 +789,15 @@ int fl_rmdir(const char* f)
|
|||
int fl_rename(const char* f, const char *n)
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
size_t l = strlen(f);
|
||||
unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string
|
||||
wbuf[wn] = 0;
|
||||
l = strlen(n);
|
||||
wn = fl_utf8toUtf16(n, l, NULL, 0) + 1; // Query length
|
||||
wn = fl_utf8toUtf16(n, (unsigned) l, NULL, 0) + 1; // Query length
|
||||
wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn);
|
||||
wn = fl_utf8toUtf16(n, l, (unsigned short *)wbuf1, wn); // Convert string
|
||||
wn = fl_utf8toUtf16(n, (unsigned) l, (unsigned short *)wbuf1, wn); // Convert string
|
||||
wbuf1[wn] = 0;
|
||||
return _wrename(wbuf, wbuf1);
|
||||
#else
|
||||
|
@ -810,7 +810,7 @@ char fl_make_path( const char *path ) {
|
|||
if (fl_access(path, 0)) {
|
||||
const char *s = strrchr( path, '/' );
|
||||
if ( !s ) return 0;
|
||||
int len = s-path;
|
||||
size_t len = (size_t) (s-path);
|
||||
char *p = (char*)malloc( len+1 );
|
||||
memcpy( p, path, len );
|
||||
p[len] = 0;
|
||||
|
@ -826,7 +826,7 @@ void fl_make_path_for_file( const char *path )
|
|||
{
|
||||
const char *s = strrchr( path, '/' );
|
||||
if ( !s ) return;
|
||||
int len = s-path;
|
||||
size_t len = (s-path);
|
||||
char *p = (char*)malloc( len+1 );
|
||||
memcpy( p, path, len );
|
||||
p[len] = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ void fl_gettime(long* sec, long* usec) {
|
|||
# else
|
||||
struct timeb tp;
|
||||
ftime(&tp);
|
||||
*sec = tp.time;
|
||||
*sec = (long) tp.time;
|
||||
*usec = tp.millitm * 1000;
|
||||
# endif
|
||||
#else
|
||||
|
|
|
@ -35,7 +35,7 @@ int fl_scandir(const char *dirname, struct dirent ***namelist,
|
|||
struct dirent **dir = 0, *selectDir;
|
||||
unsigned long ret;
|
||||
|
||||
len = strlen(dirname);
|
||||
len = (int) strlen(dirname);
|
||||
findIn = (char *)malloc((size_t)(len+10));
|
||||
if (!findIn) return -1;
|
||||
strcpy(findIn, dirname);
|
||||
|
@ -58,10 +58,10 @@ int fl_scandir(const char *dirname, struct dirent ***namelist,
|
|||
/* unsigned short * wbuf = (unsigned short*)malloc(sizeof(short) *(len + 10)); */
|
||||
/* wbuf[fl_utf2unicode(findIn, strlen(findIn), wbuf)] = 0; */
|
||||
unsigned short *wbuf = NULL;
|
||||
unsigned wlen = fl_utf8toUtf16(findIn, strlen(findIn), NULL, 0); /* Pass NULL to query length */
|
||||
unsigned wlen = fl_utf8toUtf16(findIn, (unsigned) strlen(findIn), NULL, 0); /* Pass NULL to query length */
|
||||
wlen++; /* add a little extra for termination etc. */
|
||||
wbuf = (unsigned short*)malloc(sizeof(unsigned short)*wlen);
|
||||
wlen = fl_utf8toUtf16(findIn, strlen(findIn), wbuf, wlen); /* actually convert the filename */
|
||||
wlen = fl_utf8toUtf16(findIn, (unsigned) strlen(findIn), wbuf, wlen); /* actually convert the filename */
|
||||
wbuf[wlen] = 0; /* NULL terminate the resultant string */
|
||||
h = FindFirstFileW(wbuf, &findw); /* get a handle to the first filename in the search */
|
||||
free(wbuf); /* release the "wide" buffer before the pointer goes out of scope */
|
||||
|
@ -76,7 +76,7 @@ int fl_scandir(const char *dirname, struct dirent ***namelist,
|
|||
return nDir;
|
||||
}
|
||||
do {
|
||||
int l = wcslen(findw.cFileName);
|
||||
int l = (int) wcslen(findw.cFileName);
|
||||
int dstlen = l * 5 + 1;
|
||||
selectDir=(struct dirent*)malloc(sizeof(struct dirent)+dstlen);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
|
|||
|
||||
sprintf(temp, tformat, va_arg(ap, double));
|
||||
|
||||
bytes += strlen(temp);
|
||||
bytes += (int) strlen(temp);
|
||||
|
||||
if (bufptr) {
|
||||
if ((bufptr + strlen(temp)) > bufend) {
|
||||
|
@ -162,7 +162,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
|
|||
else
|
||||
sprintf(temp, tformat, va_arg(ap, int));
|
||||
|
||||
bytes += strlen(temp);
|
||||
bytes += (int) strlen(temp);
|
||||
|
||||
if (bufptr) {
|
||||
if ((bufptr + strlen(temp)) > bufend) {
|
||||
|
@ -180,7 +180,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
|
|||
|
||||
sprintf(temp, tformat, va_arg(ap, void *));
|
||||
|
||||
bytes += strlen(temp);
|
||||
bytes += (int) strlen(temp);
|
||||
|
||||
if (bufptr) {
|
||||
if ((bufptr + strlen(temp)) > bufend) {
|
||||
|
@ -199,7 +199,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
|
|||
if (bufptr) {
|
||||
if (width <= 1) *bufptr++ = va_arg(ap, int);
|
||||
else {
|
||||
if ((bufptr + width) > bufend) width = bufend - bufptr;
|
||||
if ((bufptr + width) > bufend) width = (int) (bufend - bufptr);
|
||||
|
||||
memcpy(bufptr, va_arg(ap, char *), (size_t)width);
|
||||
bufptr += width;
|
||||
|
@ -210,13 +210,13 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
|
|||
case 's' : /* String */
|
||||
if ((s = va_arg(ap, char *)) == NULL) s = "(null)";
|
||||
|
||||
slen = strlen(s);
|
||||
slen = (int) strlen(s);
|
||||
if (slen > width && prec != width) width = slen;
|
||||
|
||||
bytes += width;
|
||||
|
||||
if (bufptr) {
|
||||
if ((bufptr + width) > bufend) width = bufend - bufptr;
|
||||
if ((bufptr + width) > bufend) width = (int) (bufend - bufptr);
|
||||
|
||||
if (slen > width) slen = width;
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@
|
|||
#endif
|
||||
|
||||
struct interval {
|
||||
int first;
|
||||
int last;
|
||||
unsigned int first;
|
||||
unsigned int last;
|
||||
};
|
||||
|
||||
/* auxiliary function for binary search in interval table */
|
||||
|
|
|
@ -149,8 +149,8 @@ void CubeView::draw() {
|
|||
|
||||
glPushMatrix();
|
||||
|
||||
glTranslatef(xshift, yshift, 0);
|
||||
glRotatef(hAng,0,1,0); glRotatef(vAng,1,0,0);
|
||||
glTranslatef((GLfloat) xshift, (GLfloat) yshift, 0);
|
||||
glRotatef((GLfloat) hAng,0,1,0); glRotatef((GLfloat) vAng,1,0,0);
|
||||
glScalef(float(size),float(size),float(size));
|
||||
|
||||
drawCube();
|
||||
|
|
|
@ -46,10 +46,10 @@ public:
|
|||
* This function is called by the horizontal roller in CubeViewUI and the
|
||||
* initialize button in CubeViewUI.
|
||||
*/
|
||||
void v_angle(float angle){vAng=angle;};
|
||||
void v_angle(double angle){vAng=angle;}
|
||||
|
||||
// Return the rotation about the vertical (y ) axis.
|
||||
float v_angle(){return vAng;};
|
||||
double v_angle() const {return vAng;}
|
||||
|
||||
/* Set the rotation about the horizontal (x ) axis.
|
||||
*
|
||||
|
@ -57,23 +57,23 @@ public:
|
|||
* initialize button in CubeViewUI.
|
||||
*/
|
||||
|
||||
void h_angle(float angle){hAng=angle;};
|
||||
void h_angle(double angle){hAng=angle;}
|
||||
|
||||
// the rotation about the horizontal (x ) axis.
|
||||
float h_angle(){return hAng;};
|
||||
double h_angle() const {return hAng;}
|
||||
|
||||
/* Sets the x shift of the cube view camera.
|
||||
*
|
||||
* This function is called by the slider in CubeViewUI and the
|
||||
* initialize button in CubeViewUI.
|
||||
*/
|
||||
void panx(float x){xshift=x;};
|
||||
void panx(double x){xshift=x;}
|
||||
/* Sets the y shift of the cube view camera.
|
||||
*
|
||||
* This function is called by the slider in CubeViewUI and the
|
||||
* initialize button in CubeViewUI.
|
||||
*/
|
||||
void pany(float y){yshift=y;};
|
||||
void pany(double y){yshift=y;}
|
||||
|
||||
#if HAVE_GL
|
||||
/*The widget class draw() override.
|
||||
|
@ -98,8 +98,8 @@ private:
|
|||
void drawCube() { }
|
||||
#endif /* HAVE_GL */
|
||||
|
||||
float vAng,hAng;
|
||||
float xshift,yshift;
|
||||
double vAng,hAng;
|
||||
double xshift,yshift;
|
||||
|
||||
|
||||
float boxv0[3];float boxv1[3];
|
||||
|
|
|
@ -45,7 +45,7 @@ static void print(Fl_Widget *o, void *data)
|
|||
uchar *image_data = fl_read_image(NULL, 0, 0, win->w(), win->h(), 0);
|
||||
if( printer.start_job(1) ) return;
|
||||
if( printer.start_page() ) return;
|
||||
printer.scale(.7,.7);
|
||||
printer.scale(.7f,.7f);
|
||||
fl_draw_image(image_data, 0,0, win->w(), win->h());
|
||||
printer.end_page();
|
||||
delete image_data;
|
||||
|
|
Loading…
Reference in New Issue