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
a1526669
Commit
a1526669
authored
Apr 03, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Apr 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineps: Store the document title as a unicode string.
parent
c9ddabad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
30 deletions
+32
-30
escape.c
dlls/wineps.drv/escape.c
+4
-9
init.c
dlls/wineps.drv/init.c
+0
-13
ps.c
dlls/wineps.drv/ps.c
+14
-6
psdrv.h
dlls/wineps.drv/psdrv.h
+14
-2
No files found.
dlls/wineps.drv/escape.c
View file @
a1526669
...
...
@@ -378,7 +378,7 @@ INT PSDRV_StartPage( PHYSDEV dev )
}
if
(
physDev
->
job
.
PageNo
++
==
0
)
{
if
(
!
PSDRV_WriteHeader
(
dev
,
physDev
->
job
.
DocN
ame
))
if
(
!
PSDRV_WriteHeader
(
dev
,
physDev
->
job
.
doc_n
ame
))
return
0
;
}
...
...
@@ -457,12 +457,7 @@ INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc )
physDev
->
job
.
quiet
=
FALSE
;
physDev
->
job
.
in_passthrough
=
FALSE
;
physDev
->
job
.
had_passthrough_rect
=
FALSE
;
if
(
doc
->
lpszDocName
)
{
INT
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
doc
->
lpszDocName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
physDev
->
job
.
DocName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
WideCharToMultiByte
(
CP_ACP
,
0
,
doc
->
lpszDocName
,
-
1
,
physDev
->
job
.
DocName
,
len
,
NULL
,
NULL
);
}
else
physDev
->
job
.
DocName
=
NULL
;
physDev
->
job
.
doc_name
=
strdupW
(
doc
->
lpszDocName
);
return
physDev
->
job
.
id
;
}
...
...
@@ -492,8 +487,8 @@ INT PSDRV_EndDoc( PHYSDEV dev )
ClosePrinter
(
physDev
->
job
.
hprinter
);
physDev
->
job
.
hprinter
=
NULL
;
physDev
->
job
.
id
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
physDev
->
job
.
DocName
);
physDev
->
job
.
DocN
ame
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
physDev
->
job
.
doc_name
);
physDev
->
job
.
doc_n
ame
=
NULL
;
return
ret
;
}
dlls/wineps.drv/init.c
View file @
a1526669
...
...
@@ -41,7 +41,6 @@
#include "winnls.h"
#include "psdrv.h"
#include "winspool.h"
#include "wine/unicode.h"
#include "wine/library.h"
#include "wine/debug.h"
...
...
@@ -172,18 +171,6 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
return
TRUE
;
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
str
)
{
int
size
;
WCHAR
*
ret
;
if
(
!
str
)
return
NULL
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
return
ret
;
}
static
void
PSDRV_UpdateDevCaps
(
PSDRV_PDEVICE
*
physDev
)
{
PAGESIZE
*
page
;
...
...
dlls/wineps.drv/ps.c
View file @
a1526669
...
...
@@ -241,18 +241,23 @@ static INT PSDRV_WriteFeature(PHYSDEV dev, LPCSTR feature, LPCSTR value, LPCSTR
* in brackets. Truncate string to represent at most 0x80 characters.
*
*/
static
char
*
escape_title
(
LPC
STR
str
)
static
char
*
escape_title
(
LPC
WSTR
w
str
)
{
char
*
ret
,
*
cp
;
char
*
ret
,
*
cp
,
*
str
;
int
i
,
extra
=
0
;
if
(
!
str
)
if
(
!
w
str
)
{
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
1
);
*
ret
=
'\0'
;
return
ret
;
}
i
=
WideCharToMultiByte
(
CP_ACP
,
0
,
wstr
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
);
if
(
!
str
)
return
NULL
;
WideCharToMultiByte
(
CP_ACP
,
0
,
wstr
,
-
1
,
str
,
i
,
NULL
,
NULL
);
for
(
i
=
0
;
i
<
0x80
&&
str
[
i
];
i
++
)
{
if
(
!
isprint
(
str
[
i
]))
...
...
@@ -264,7 +269,7 @@ static char *escape_title(LPCSTR str)
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
+
1
);
memcpy
(
ret
,
str
,
i
);
ret
[
i
]
=
'\0'
;
return
ret
;
goto
done
;
}
extra
+=
2
;
/* two for the brackets */
...
...
@@ -285,11 +290,14 @@ static char *escape_title(LPCSTR str)
}
*
cp
++
=
')'
;
*
cp
=
'\0'
;
done:
HeapFree
(
GetProcessHeap
(),
0
,
str
);
return
ret
;
}
INT
PSDRV_WriteHeader
(
PHYSDEV
dev
,
LPCSTR
title
)
INT
PSDRV_WriteHeader
(
PHYSDEV
dev
,
LPC
W
STR
title
)
{
PSDRV_PDEVICE
*
physDev
=
get_psdrv_dev
(
dev
);
char
*
buf
,
*
escaped_title
;
...
...
@@ -299,7 +307,7 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCSTR title )
int
win_duplex
;
int
llx
,
lly
,
urx
,
ury
;
TRACE
(
"%s
\n
"
,
debugstr_
a
(
title
));
TRACE
(
"%s
\n
"
,
debugstr_
w
(
title
));
escaped_title
=
escape_title
(
title
);
buf
=
HeapAlloc
(
PSDRV_Heap
,
0
,
sizeof
(
psheader
)
+
...
...
dlls/wineps.drv/psdrv.h
View file @
a1526669
...
...
@@ -28,6 +28,7 @@
#include "wingdi.h"
#include "winspool.h"
#include "wine/unicode.h"
#include "wine/gdi_driver.h"
#include "wine/list.h"
...
...
@@ -347,7 +348,7 @@ typedef struct {
DWORD
id
;
/* Job id */
HANDLE
hprinter
;
/* Printer handle */
LPWSTR
output
;
/* Output file/port */
LP
STR
DocName
;
/* Document Name */
LP
WSTR
doc_name
;
/* Document Name */
BOOL
banding
;
/* Have we received a NEXTBAND */
BOOL
OutOfPage
;
/* Page header not sent yet */
INT
PageNo
;
...
...
@@ -491,7 +492,7 @@ extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor,
COLORREF
wincolor
)
DECLSPEC_HIDDEN
;
extern
char
PSDRV_UnicodeToANSI
(
int
u
)
DECLSPEC_HIDDEN
;
extern
INT
PSDRV_WriteHeader
(
PHYSDEV
dev
,
LPCSTR
title
)
DECLSPEC_HIDDEN
;
extern
INT
PSDRV_WriteHeader
(
PHYSDEV
dev
,
LPC
W
STR
title
)
DECLSPEC_HIDDEN
;
extern
INT
PSDRV_WriteFooter
(
PHYSDEV
dev
)
DECLSPEC_HIDDEN
;
extern
INT
PSDRV_WriteNewPage
(
PHYSDEV
dev
)
DECLSPEC_HIDDEN
;
extern
INT
PSDRV_WriteEndPage
(
PHYSDEV
dev
)
DECLSPEC_HIDDEN
;
...
...
@@ -580,5 +581,16 @@ extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HID
setlocale(LC_NUMERIC,tmplocale); \
} while (0)
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
str
)
{
int
size
;
WCHAR
*
ret
;
if
(
!
str
)
return
NULL
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
return
ret
;
}
#endif
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