[cups.bugs] [LOW] STR #2874: cupstestppd always warns on Windows and Mac files

David Geering dgeering at toshiba-tap.com
Fri Jul 4 09:08:44 PDT 2008


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

The logic in cupstestppd.c:check_basics is incorrect.

Following the logic in the source code, the first line ending it will come
across in a Windows or Mac file is a carriage return. If the next character
is a line feed, then the this character is discarded from the input stream
and the variable eol is set to EOL_CRLF, otherwise it is set to EOL_CR.

The next time the a carriage return is encountered in the input stream,
the variable 'mixed' is set to 1 because 'eol' is not equal to EOL_NONE,
even though the line ending may be legitimate. Ideally, 'mixed' should
only be set if the current line's ending is DIFFERENT from what is stored
in 'eol', not if an 'eol' has already been detected.

Basically, the first line's ending is detected correctly, but the second
line's ending triggers 'mixed = 1;' simply because 'eol != EOL_NONE'.

This only affects CRLF and CR line endings because the LF line endings
have an additional conditional before setting 'mixed = 1'; and this
conditional should be applied to CRLF and CR as well.

Attached is my proposed fix that works logically in my head but I have not
compiled or tested it.

Link: http://www.cups.org/str.php?L2874
Version: 1.4-current
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cupstestppd.c
URL: <https://lists.cups.org/pipermail/cups/attachments/20080704/ccc13d5d/attachment.c>


More information about the cups mailing list