Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
19a965f5
Commit
19a965f5
authored
Sep 23, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Improve font version parsing.
parent
7c7e0bd5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
font.c
dlls/msi/font.c
+21
-18
No files found.
dlls/msi/font.c
View file @
19a965f5
...
...
@@ -145,24 +145,17 @@ static WCHAR *load_ttf_name_id( const WCHAR *filename, DWORD id )
ttRecord
.
uNameID
=
SWAPWORD
(
ttRecord
.
uNameID
);
if
(
ttRecord
.
uNameID
==
id
)
{
int
nPos
;
LPSTR
buf
;
ttRecord
.
uStringLength
=
SWAPWORD
(
ttRecord
.
uStringLength
);
ttRecord
.
uStringOffset
=
SWAPWORD
(
ttRecord
.
uStringOffset
);
nPos
=
SetFilePointer
(
handle
,
0
,
NULL
,
FILE_CURRENT
);
SetFilePointer
(
handle
,
tblDir
.
uOffset
+
ttRecord
.
uStringOffset
+
ttNTHeader
.
uStorageOffset
,
NULL
,
FILE_BEGIN
);
buf
=
msi_alloc_zero
(
ttRecord
.
uStringLength
+
1
)
;
if
(
!
(
buf
=
msi_alloc_zero
(
ttRecord
.
uStringLength
+
1
)))
goto
end
;
ReadFile
(
handle
,
buf
,
ttRecord
.
uStringLength
,
&
dwRead
,
NULL
);
if
(
strlen
(
buf
)
>
0
)
{
ret
=
strdupAtoW
(
buf
);
msi_free
(
buf
);
break
;
}
ret
=
strdupAtoW
(
buf
);
msi_free
(
buf
);
SetFilePointer
(
handle
,
nPos
,
NULL
,
FILE_BEGIN
)
;
break
;
}
}
...
...
@@ -179,6 +172,12 @@ static WCHAR *font_name_from_file( const WCHAR *filename )
if
((
name
=
load_ttf_name_id
(
filename
,
NAME_ID_FULL_FONT_NAME
)))
{
if
(
!
name
[
0
])
{
WARN
(
"empty font name
\n
"
);
msi_free
(
name
);
return
NULL
;
}
ret
=
msi_alloc
(
(
strlenW
(
name
)
+
strlenW
(
truetypeW
)
+
1
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
ret
,
name
);
strcatW
(
ret
,
truetypeW
);
...
...
@@ -189,22 +188,26 @@ static WCHAR *font_name_from_file( const WCHAR *filename )
WCHAR
*
msi_font_version_from_file
(
const
WCHAR
*
filename
)
{
static
const
WCHAR
dotzerodotzeroW
[]
=
{
'.'
,
'0'
,
'.'
,
'0'
,
0
};
WCHAR
*
version
,
*
p
,
*
ret
=
NULL
;
int
len
;
static
const
WCHAR
fmtW
[]
=
{
'%'
,
'u'
,
'.'
,
'%'
,
'u'
,
'.'
,
'0'
,
'.'
,
'0'
,
0
};
WCHAR
*
version
,
*
p
,
*
q
,
*
ret
=
NULL
;
if
((
version
=
load_ttf_name_id
(
filename
,
NAME_ID_VERSION
)))
{
int
len
,
major
=
0
,
minor
=
0
;
if
((
p
=
strchrW
(
version
,
';'
)))
*
p
=
0
;
p
=
version
;
while
(
*
p
&&
!
isdigitW
(
*
p
))
p
++
;
len
=
strlenW
(
p
)
+
strlenW
(
dotzerodotzeroW
)
+
1
;
ret
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
strcpyW
(
ret
,
p
);
if
((
p
=
strchrW
(
p
,
'.'
))
&&
!
(
p
=
strchrW
(
p
+
1
,
'.'
)))
if
((
q
=
strchrW
(
p
,
'.'
)))
{
strcatW
(
ret
,
dotzerodotzeroW
);
major
=
atoiW
(
p
);
p
=
++
q
;
while
(
*
q
&&
isdigitW
(
*
q
))
q
++
;
if
(
!*
q
||
*
q
==
' '
)
minor
=
atoiW
(
p
);
else
major
=
0
;
}
len
=
strlenW
(
fmtW
)
+
20
;
ret
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
sprintfW
(
ret
,
fmtW
,
major
,
minor
);
msi_free
(
version
);
}
return
ret
;
...
...
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