Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f3434c25
Commit
f3434c25
authored
Sep 29, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed handling of Unicode strings used as filenames (reports by Martin
Fuchs).
parent
224063f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
parser.y
tools/wrc/parser.y
+30
-13
No files found.
tools/wrc/parser.y
View file @
f3434c25
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
#include "newstruc.h"
#include "newstruc.h"
#include "dumpres.h"
#include "dumpres.h"
#include "wine/wpp.h"
#include "wine/wpp.h"
#include "wine/unicode.h"
#include "parser.h"
#include "parser.h"
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winbase.h"
...
@@ -202,7 +203,7 @@ static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
...
@@ -202,7 +203,7 @@ static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
static raw_data_t *str2raw_data(string_t *str);
static raw_data_t *str2raw_data(string_t *str);
static raw_data_t *int2raw_data(int i);
static raw_data_t *int2raw_data(int i);
static raw_data_t *long2raw_data(int i);
static raw_data_t *long2raw_data(int i);
static raw_data_t *load_file(string_t *name);
static raw_data_t *load_file(string_t *name
, language_t *lang
);
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
static event_t *add_event(int key, int id, int flags, event_t *prev);
static event_t *add_event(int key, int id, int flags, event_t *prev);
...
@@ -1795,10 +1796,7 @@ raw_elements
...
@@ -1795,10 +1796,7 @@ raw_elements
;
;
/* File data or raw data */
/* File data or raw data */
file_raw: filename {
file_raw: filename { $$ = load_file($1,dup_language(currentlanguage)); }
$$ = load_file($1);
$$->lvc.language = dup_language(currentlanguage);
}
| raw_data { $$ = $1; }
| raw_data { $$ = $1; }
;
;
...
@@ -2282,14 +2280,18 @@ static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
...
@@ -2282,14 +2280,18 @@ static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
}
}
/* Raw data functions */
/* Raw data functions */
static raw_data_t *load_file(string_t *
name
)
static raw_data_t *load_file(string_t *
filename, language_t *lang
)
{
{
FILE *fp = NULL;
FILE *fp = NULL;
char *path;
char *path;
raw_data_t *rd;
raw_data_t *rd;
if(name->type != str_char)
string_t *name;
yyerror("Filename must be ASCII string"
);
int codepage = get_language_codepage(lang->id, lang->sub
);
/* FIXME: we may want to use utf-8 here */
if (codepage <= 0 && filename->type != str_char)
yyerror("Cannot convert filename to ASCII string");
name = convert_string( filename, str_char, codepage );
if (!(path = wpp_find_include(name->str.cstr, 1)))
if (!(path = wpp_find_include(name->str.cstr, 1)))
yyerror("Cannot open file %s", name->str.cstr);
yyerror("Cannot open file %s", name->str.cstr);
if (!(fp = fopen( path, "rb" )))
if (!(fp = fopen( path, "rb" )))
...
@@ -2302,6 +2304,8 @@ static raw_data_t *load_file(string_t *name)
...
@@ -2302,6 +2304,8 @@ static raw_data_t *load_file(string_t *name)
rd->data = (char *)xmalloc(rd->size);
rd->data = (char *)xmalloc(rd->size);
fread(rd->data, rd->size, 1, fp);
fread(rd->data, rd->size, 1, fp);
fclose(fp);
fclose(fp);
rd->lvc.language = lang;
free_string(name);
return rd;
return rd;
}
}
...
@@ -2678,13 +2682,11 @@ static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems)
...
@@ -2678,13 +2682,11 @@ static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems)
static string_t *make_filename(string_t *str)
static string_t *make_filename(string_t *str)
{
{
if(str->type == str_char)
{
char *cptr;
char *cptr;
if(str->type != str_char)
yyerror("Cannot handle UNICODE filenames");
/* Remove escaped backslash and convert to forward */
/* Remove escaped backslash and convert to forward */
cptr = str->str.cstr;
for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
{
{
if(cptr[1] == '\\')
if(cptr[1] == '\\')
...
@@ -2694,8 +2696,23 @@ static string_t *make_filename(string_t *str)
...
@@ -2694,8 +2696,23 @@ static string_t *make_filename(string_t *str)
}
}
*cptr = '/';
*cptr = '/';
}
}
}
else
{
WCHAR *wptr;
return str;
/* Remove escaped backslash and convert to forward */
for(wptr = str->str.wstr; (wptr = strchrW(wptr, '\\')) != NULL; wptr++)
{
if(wptr[1] == '\\')
{
memmove(wptr, wptr+1, strlenW(wptr));
str->size--;
}
*wptr = '/';
}
}
return str;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment