Huw Davies : wineps: Cope with '\r'-only end-of-line markers.
Alexandre Julliard
julliard at winehq.org
Tue Jan 22 14:52:23 CST 2013
Module: wine
Branch: master
Commit: cb3815aead2588030f002616ffbb03ab5eea760e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cb3815aead2588030f002616ffbb03ab5eea760e
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Jan 22 15:51:48 2013 +0000
wineps: Cope with '\r'-only end-of-line markers.
---
dlls/wineps.drv/ppd.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c
index a18c42c..adb6a21 100644
--- a/dlls/wineps.drv/ppd.c
+++ b/dlls/wineps.drv/ppd.c
@@ -266,7 +266,15 @@ static BOOL get_line( char *buf, int size, struct map_context *ctx )
{
if (ctx->pos > ctx->end) break;
buf[i] = *ctx->pos++;
- if (buf[i] == '\n')
+
+ /* \r\n -> \n */
+ if (buf[i] == '\r' && ctx->pos <= ctx->end && *ctx->pos == '\n')
+ {
+ ctx->pos++;
+ buf[i] = '\n';
+ }
+
+ if (buf[i] == '\n' || buf[i] == '\r')
{
i++;
break;
@@ -394,9 +402,11 @@ static BOOL PSDRV_PPDGetNextTuple(struct map_context *ctx, PPDTuple *tuple)
break;
} while(1);
- if(line[strlen(line)-1] != '\n') {
+ cp = line + strlen(line) - 1;
+ if (*cp != '\n' && *cp != '\r')
+ {
ERR("Line too long.\n");
- goto start;
+ goto start;
}
for(cp = line; !isspace(*cp) && *cp != ':'; cp++)
More information about the wine-cvs
mailing list