mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 23:56:55 +08:00
Fix char * issues with constant strings.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4575 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+11
-10
@@ -74,10 +74,10 @@ int Fl_Input::shift_up_down_position(int p) {
|
|||||||
// of a decimal point). For back compatibility reasons, we always
|
// of a decimal point). For back compatibility reasons, we always
|
||||||
// allow the decimal point.
|
// allow the decimal point.
|
||||||
#ifdef HAVE_LOCALECONV
|
#ifdef HAVE_LOCALECONV
|
||||||
static char *standard_fp_chars = ".eE+-";
|
static const char *standard_fp_chars = ".eE+-";
|
||||||
static char *legal_fp_chars = 0L;
|
static const char *legal_fp_chars = 0L;
|
||||||
#else
|
#else
|
||||||
static char *legal_fp_chars = ".eE+-";
|
static const char *legal_fp_chars = ".eE+-";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int Fl_Input::handle_key() {
|
int Fl_Input::handle_key() {
|
||||||
@@ -106,16 +106,17 @@ int Fl_Input::handle_key() {
|
|||||||
}
|
}
|
||||||
// the following line is not a true memory leak because the array is only
|
// the following line is not a true memory leak because the array is only
|
||||||
// allocated once if required, and automatically freed when the program quits
|
// allocated once if required, and automatically freed when the program quits
|
||||||
legal_fp_chars = (char*)malloc(len+1);
|
char *chars = (char*)malloc(len+1);
|
||||||
strcpy(legal_fp_chars, standard_fp_chars);
|
legal_fp_chars = chars;
|
||||||
|
strcpy(chars, standard_fp_chars);
|
||||||
if (lc) {
|
if (lc) {
|
||||||
if (lc->decimal_point) strcat(legal_fp_chars, lc->decimal_point);
|
if (lc->decimal_point) strcat(chars, lc->decimal_point);
|
||||||
if (lc->mon_decimal_point) strcat(legal_fp_chars, lc->mon_decimal_point);
|
if (lc->mon_decimal_point) strcat(chars, lc->mon_decimal_point);
|
||||||
if (lc->positive_sign) strcat(legal_fp_chars, lc->positive_sign);
|
if (lc->positive_sign) strcat(chars, lc->positive_sign);
|
||||||
if (lc->negative_sign) strcat(legal_fp_chars, lc->negative_sign);
|
if (lc->negative_sign) strcat(chars, lc->negative_sign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // HAVE_LOCALECONV
|
||||||
|
|
||||||
// This is complex to allow "0xff12" hex to be typed:
|
// This is complex to allow "0xff12" hex to be typed:
|
||||||
if (!position() && (ascii == '+' || ascii == '-') ||
|
if (!position() && (ascii == '+' || ascii == '-') ||
|
||||||
|
|||||||
Reference in New Issue
Block a user