mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 22:04:26 +08:00
Fl_Input_ crashed on some platforms when wrapping international
text characters (STR #836) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4338 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -2,6 +2,8 @@ CHANGES IN FLTK 1.1.7
|
|||||||
|
|
||||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||||
#744, STR #745)
|
#744, STR #745)
|
||||||
|
- Fl_Input_ crashed on some platforms when wrapping
|
||||||
|
international text characters (STR #836)
|
||||||
- Fixed some BMP images loading bugs (STR #825)
|
- Fixed some BMP images loading bugs (STR #825)
|
||||||
- Fl_File_Chooser now returns directory names with a
|
- Fl_File_Chooser now returns directory names with a
|
||||||
trailing slash to avoid problems with relative
|
trailing slash to avoid problems with relative
|
||||||
|
|||||||
+10
-10
@@ -61,7 +61,7 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
|
|||||||
if (input_type()==FL_SECRET_INPUT) {
|
if (input_type()==FL_SECRET_INPUT) {
|
||||||
while (o<e && p < value_+size_) {*o++ = '*'; p++;}
|
while (o<e && p < value_+size_) {*o++ = '*'; p++;}
|
||||||
} else while (o<e) {
|
} else while (o<e) {
|
||||||
if (wrap() && (p >= value_+size_ || isspace(*p))) {
|
if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
|
||||||
word_wrap = w() - Fl::box_dw(box()) - 2;
|
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, o-lastspace_out);
|
||||||
if (p > lastspace+1) {
|
if (p > lastspace+1) {
|
||||||
@@ -593,7 +593,7 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
|
|||||||
// result in sub-optimal update when such wrapping does not happen
|
// result in sub-optimal update when such wrapping does not happen
|
||||||
// but it is too hard to figure out for now...
|
// but it is too hard to figure out for now...
|
||||||
if (wrap())
|
if (wrap())
|
||||||
while (b > 0 && !isspace(index(b))) b--;
|
while (b > 0 && !isspace(index(b) & 255)) b--;
|
||||||
|
|
||||||
// make sure we redraw the old selection or cursor:
|
// make sure we redraw the old selection or cursor:
|
||||||
if (mark_ < b) b = mark_;
|
if (mark_ < b) b = mark_;
|
||||||
@@ -716,34 +716,34 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
|||||||
// strip trailing control characters and spaces before pasting:
|
// strip trailing control characters and spaces before pasting:
|
||||||
const char* t = Fl::event_text();
|
const char* t = Fl::event_text();
|
||||||
const char* e = t+Fl::event_length();
|
const char* e = t+Fl::event_length();
|
||||||
if (input_type() != FL_MULTILINE_INPUT) while (e > t && isspace(*(e-1))) e--;
|
if (input_type() != FL_MULTILINE_INPUT) while (e > t && isspace(*(e-1) & 255)) e--;
|
||||||
if (!t || e <= t) return 1; // Int/float stuff will crash without this test
|
if (!t || e <= t) return 1; // Int/float stuff will crash without this test
|
||||||
if (input_type() == FL_INT_INPUT) {
|
if (input_type() == FL_INT_INPUT) {
|
||||||
while (isspace(*t) && t < e) t ++;
|
while (isspace(*t & 255) && t < e) t ++;
|
||||||
const char *p = t;
|
const char *p = t;
|
||||||
if (*p == '+' || *p == '-') p ++;
|
if (*p == '+' || *p == '-') p ++;
|
||||||
if (strncmp(p, "0x", 2) == 0) {
|
if (strncmp(p, "0x", 2) == 0) {
|
||||||
p += 2;
|
p += 2;
|
||||||
while (isxdigit(*p) && p < e) p ++;
|
while (isxdigit(*p & 255) && p < e) p ++;
|
||||||
} else {
|
} else {
|
||||||
while (isdigit(*p) && p < e) p ++;
|
while (isdigit(*p & 255) && p < e) p ++;
|
||||||
}
|
}
|
||||||
if (p < e) {
|
if (p < e) {
|
||||||
fl_beep(FL_BEEP_ERROR);
|
fl_beep(FL_BEEP_ERROR);
|
||||||
return 1;
|
return 1;
|
||||||
} else return replace(0, size(), t, e - t);
|
} else return replace(0, size(), t, e - t);
|
||||||
} else if (input_type() == FL_FLOAT_INPUT) {
|
} else if (input_type() == FL_FLOAT_INPUT) {
|
||||||
while (isspace(*t) && t < e) t ++;
|
while (isspace(*t & 255) && t < e) t ++;
|
||||||
const char *p = t;
|
const char *p = t;
|
||||||
if (*p == '+' || *p == '-') p ++;
|
if (*p == '+' || *p == '-') p ++;
|
||||||
while (isdigit(*p) && p < e) p ++;
|
while (isdigit(*p & 255) && p < e) p ++;
|
||||||
if (*p == '.') {
|
if (*p == '.') {
|
||||||
p ++;
|
p ++;
|
||||||
while (isdigit(*p) && p < e) p ++;
|
while (isdigit(*p & 255) && p < e) p ++;
|
||||||
if (*p == 'e' || *p == 'E') {
|
if (*p == 'e' || *p == 'E') {
|
||||||
p ++;
|
p ++;
|
||||||
if (*p == '+' || *p == '-') p ++;
|
if (*p == '+' || *p == '-') p ++;
|
||||||
while (isdigit(*p) && p < e) p ++;
|
while (isdigit(*p & 255) && p < e) p ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p < e) {
|
if (p < e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user