Commit d5373ef6 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wineps: Buffer data sent to printer port.

parent 75e87c30
...@@ -38,13 +38,41 @@ ...@@ -38,13 +38,41 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); 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 write_spool( print_ctx *ctx, const void *data, DWORD num )
{ {
DWORD written; DWORD written;
if (!WritePrinter(ctx->job.hprinter, (LPBYTE) data, num, &written) || (written != num)) if (ctx->job.data_cnt + num > ARRAY_SIZE(ctx->job.data))
{
if (!flush_spool(ctx))
return SP_OUTOFDISK; 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; return num;
} }
......
...@@ -502,7 +502,7 @@ INT PSDRV_WriteFooter( print_ctx *ctx ) ...@@ -502,7 +502,7 @@ INT PSDRV_WriteFooter( print_ctx *ctx )
sprintf(buf, psfooter, ctx->job.PageNo); 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"); WARN("WriteSpool error\n");
ret = 0; ret = 0;
} }
......
...@@ -352,6 +352,8 @@ typedef struct { ...@@ -352,6 +352,8 @@ typedef struct {
INT PageNo; INT PageNo;
BOOL quiet; /* Don't actually output anything */ BOOL quiet; /* Don't actually output anything */
enum passthrough passthrough_state; enum passthrough passthrough_state;
BYTE data[4096];
int data_cnt;
} JOB; } JOB;
typedef struct typedef struct
...@@ -519,7 +521,8 @@ extern BOOL PSDRV_WriteSetDownloadFont(print_ctx *ctx, BOOL vertical); ...@@ -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_WriteDownloadGlyphShow(print_ctx *ctx, const WORD *glyphs, UINT count);
extern BOOL PSDRV_EmptyDownloadList(print_ctx *ctx, BOOL write_undef); 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 */ #define MAX_G_NAME 31 /* max length of PS glyph name */
extern void get_glyph_name(HDC hdc, WORD index, char *name); extern void get_glyph_name(HDC hdc, WORD index, char *name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment