mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:54:05 +00:00
wineps: Buffer data sent to printer port.
This commit is contained in:
parent
75e87c30ad
commit
d5373ef6f9
|
@ -38,13 +38,41 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||
|
||||
BOOL flush_spool( print_ctx *ctx )
|
||||
{
|
||||
DWORD written;
|
||||
|
||||
if (ctx->job.data_cnt)
|
||||
{
|
||||
if (!WritePrinter(ctx->job.hprinter, ctx->job.data, ctx->job.data_cnt, &written) ||
|
||||
written != ctx->job.data_cnt)
|
||||
return FALSE;
|
||||
}
|
||||
ctx->job.data_cnt = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD write_spool( print_ctx *ctx, const void *data, DWORD num )
|
||||
{
|
||||
DWORD written;
|
||||
|
||||
if (!WritePrinter(ctx->job.hprinter, (LPBYTE) data, num, &written) || (written != num))
|
||||
return SP_OUTOFDISK;
|
||||
if (ctx->job.data_cnt + num > ARRAY_SIZE(ctx->job.data))
|
||||
{
|
||||
if (!flush_spool(ctx))
|
||||
return SP_OUTOFDISK;
|
||||
}
|
||||
|
||||
if (ctx->job.data_cnt + num > ARRAY_SIZE(ctx->job.data))
|
||||
{
|
||||
if (!WritePrinter(ctx->job.hprinter, (LPBYTE) data, num, &written) ||
|
||||
written != num)
|
||||
return SP_OUTOFDISK;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(ctx->job.data + ctx->job.data_cnt, data, num);
|
||||
ctx->job.data_cnt += num;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ INT PSDRV_WriteFooter( print_ctx *ctx )
|
|||
|
||||
sprintf(buf, psfooter, ctx->job.PageNo);
|
||||
|
||||
if( write_spool( ctx, buf, strlen(buf) ) != strlen(buf) ) {
|
||||
if( write_spool( ctx, buf, strlen(buf) ) != strlen(buf) || !flush_spool(ctx) ) {
|
||||
WARN("WriteSpool error\n");
|
||||
ret = 0;
|
||||
}
|
||||
|
|
|
@ -352,6 +352,8 @@ typedef struct {
|
|||
INT PageNo;
|
||||
BOOL quiet; /* Don't actually output anything */
|
||||
enum passthrough passthrough_state;
|
||||
BYTE data[4096];
|
||||
int data_cnt;
|
||||
} JOB;
|
||||
|
||||
typedef struct
|
||||
|
@ -519,7 +521,8 @@ extern BOOL PSDRV_WriteSetDownloadFont(print_ctx *ctx, BOOL vertical);
|
|||
extern BOOL PSDRV_WriteDownloadGlyphShow(print_ctx *ctx, const WORD *glyphs, UINT count);
|
||||
extern BOOL PSDRV_EmptyDownloadList(print_ctx *ctx, BOOL write_undef);
|
||||
|
||||
extern DWORD write_spool( print_ctx *ctx, const void *data, DWORD num );
|
||||
extern BOOL flush_spool(print_ctx *ctx);
|
||||
extern DWORD write_spool(print_ctx *ctx, const void *data, DWORD num);
|
||||
|
||||
#define MAX_G_NAME 31 /* max length of PS glyph name */
|
||||
extern void get_glyph_name(HDC hdc, WORD index, char *name);
|
||||
|
|
Loading…
Reference in a new issue