Bringing over fix [r11920] from 1.3 current to the porting branch.
Fixes STR#3200 issue with filter() on Win32. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11922 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f20152e5f2
commit
108e6d7b0d
@ -834,7 +834,7 @@ static int count_filters(const char *filter) {
|
||||
//
|
||||
void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) {
|
||||
clear_filters();
|
||||
if ( ! in ) return;
|
||||
if ( ! in || in[0] == '\0' ) return;
|
||||
|
||||
int has_name = strchr(in, '\t') ? 1 : 0;
|
||||
char mode = has_name ? 'n' : 'w'; // parse mode: n=name, w=wildcard
|
||||
@ -842,9 +842,9 @@ void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) {
|
||||
// whatever input string is, our output won't be much longer in length..
|
||||
// use double length just for safety.
|
||||
size_t slen = strlen(in);
|
||||
char *wildprefix = new char[slen*2]; wildprefix[0] = 0;
|
||||
char *comp = new char[slen*2]; comp[0] = 0;
|
||||
char *name = new char[slen*2]; name[0] = 0;
|
||||
char *wildprefix = new char[(slen+1)*2]; wildprefix[0] = 0;
|
||||
char *comp = new char[(slen+1)*2]; comp[0] = 0;
|
||||
char *name = new char[(slen+1)*2]; name[0] = 0;
|
||||
|
||||
// Init
|
||||
int nwildcards = 0;
|
||||
@ -852,7 +852,7 @@ void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) {
|
||||
char **wildcards = new char*[maxfilters]; // parsed wildcards (can be several)
|
||||
int t;
|
||||
for ( t=0; t<maxfilters; t++ ) {
|
||||
wildcards[t] = new char[slen];
|
||||
wildcards[t] = new char[slen+1];
|
||||
wildcards[t][0] = '\0';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user