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
d535419d
Commit
d535419d
authored
Oct 02, 2009
by
Wim Lewis
Committed by
Alexandre Julliard
Oct 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Font metric cache file cleanups.
parent
dd6b7b7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
xfont.c
dlls/winex11.drv/xfont.c
+20
-10
No files found.
dlls/winex11.drv/xfont.c
View file @
d535419d
...
...
@@ -34,7 +34,9 @@
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -2156,8 +2158,10 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
*
* INIT ONLY
*/
static
BOOL
XFONT_ReadCachedMetrics
(
int
fd
,
int
res
,
unsigned
x_checksum
,
int
x_count
)
static
BOOL
XFONT_ReadCachedMetrics
(
const
char
*
path
,
int
res
,
unsigned
x_checksum
,
int
x_count
)
{
int
fd
=
open
(
path
,
O_RDONLY
);
if
(
fd
>=
0
)
{
unsigned
u
;
...
...
@@ -2270,6 +2274,8 @@ fail:
HeapFree
(
GetProcessHeap
(),
0
,
fontList
);
fontList
=
NULL
;
close
(
fd
);
}
else
{
TRACE
(
"fontcache '%s': %s
\n
"
,
path
,
strerror
(
errno
));
}
return
FALSE
;
}
...
...
@@ -2855,7 +2861,7 @@ static void X11DRV_FONT_InitX11Metrics( void )
{
char
**
x_pattern
;
unsigned
x_checksum
;
int
i
,
x_count
,
fd
,
buf_size
;
int
i
,
x_count
,
buf_size
;
char
*
buffer
;
HKEY
hkey
;
...
...
@@ -2879,7 +2885,7 @@ static void X11DRV_FONT_InitX11Metrics( void )
if
(
j
)
x_checksum
^=
__genericCheckSum
(
x_pattern
[
i
],
j
);
}
x_checksum
|=
X_PFONT_MAGIC
;
buf_size
=
128
;
buf_size
=
PATH_MAX
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buf_size
);
/* deal with systemwide font metrics cache */
...
...
@@ -2895,8 +2901,8 @@ static void X11DRV_FONT_InitX11Metrics( void )
if
(
buffer
[
0
]
)
{
fd
=
open
(
buffer
,
O_RDONLY
);
XFONT_ReadCachedMetrics
(
fd
,
DefResolution
,
x_checksum
,
x_count
);
TRACE
(
"system fontcache is '%s'
\n
"
,
buffer
);
XFONT_ReadCachedMetrics
(
buffer
,
DefResolution
,
x_checksum
,
x_count
);
}
if
(
fontList
==
NULL
)
{
...
...
@@ -2904,8 +2910,8 @@ static void X11DRV_FONT_InitX11Metrics( void )
buffer
=
XFONT_UserMetricsCache
(
buffer
,
&
buf_size
);
if
(
buffer
[
0
]
)
{
fd
=
open
(
buffer
,
O_RDONLY
);
XFONT_ReadCachedMetrics
(
fd
,
DefResolution
,
x_checksum
,
x_count
);
TRACE
(
"user fontcache is '%s'
\n
"
,
buffer
);
XFONT_ReadCachedMetrics
(
buffer
,
DefResolution
,
x_checksum
,
x_count
);
}
}
...
...
@@ -2914,11 +2920,15 @@ static void X11DRV_FONT_InitX11Metrics( void )
int
n_ff
=
XFONT_BuildMetrics
(
x_pattern
,
DefResolution
,
x_checksum
,
x_count
);
if
(
buffer
[
0
]
)
/* update cached metrics */
{
fd
=
open
(
buffer
,
O_CREAT
|
O_TRUNC
|
O_RDWR
,
0644
);
/* -rw-r--r-- */
if
(
XFONT_WriteCachedMetrics
(
fd
,
x_checksum
,
x_count
,
n_ff
)
==
FALSE
)
int
fd
=
open
(
buffer
,
O_CREAT
|
O_TRUNC
|
O_RDWR
,
0666
);
if
(
fd
<
0
)
{
WARN
(
"Unable to create fontcache '%s': %s
\n
"
,
buffer
,
strerror
(
errno
));
}
else
if
(
XFONT_WriteCachedMetrics
(
fd
,
x_checksum
,
x_count
,
n_ff
)
==
FALSE
)
{
WARN
(
"Unable to write to fontcache '%s'
\n
"
,
buffer
);
if
(
fd
>=
0
)
remove
(
buffer
);
/* couldn't write entire file */
remove
(
buffer
);
/* couldn't write entire file */
}
}
}
...
...
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