mirror of
https://github.com/reactos/wine.git
synced 2025-02-23 22:40:55 +00:00
wineps: Store the document title as a unicode string.
This commit is contained in:
parent
c9ddabad22
commit
a152666920
@ -378,7 +378,7 @@ INT PSDRV_StartPage( PHYSDEV dev )
|
||||
}
|
||||
|
||||
if(physDev->job.PageNo++ == 0) {
|
||||
if(!PSDRV_WriteHeader( dev, physDev->job.DocName ))
|
||||
if(!PSDRV_WriteHeader( dev, physDev->job.doc_name ))
|
||||
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.DocName = NULL;
|
||||
HeapFree( GetProcessHeap(), 0, physDev->job.doc_name );
|
||||
physDev->job.doc_name = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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(LPCSTR str)
|
||||
static char *escape_title(LPCWSTR wstr)
|
||||
{
|
||||
char *ret, *cp;
|
||||
char *ret, *cp, *str;
|
||||
int i, extra = 0;
|
||||
|
||||
if(!str)
|
||||
if(!wstr)
|
||||
{
|
||||
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, LPCWSTR 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) +
|
||||
|
@ -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 */
|
||||
LPSTR DocName; /* Document Name */
|
||||
LPWSTR 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, LPCWSTR 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user