From: Arjen M. <arj...@de...> - 2011-05-31 14:46:39
|
Hi Thorsten, I implemented the patch (with a bit more code to make it robust against a variety of issues), with this patch line endings are no longer a problem for the palette files. Regards, Arjen On 2011-05-30 13:53, Thorsten Behrens wrote: > Hi Arjen! > >>> BTW: You can also define a constant for the string length instead of >>> using integer literals in the code. >> Good thinking! Actually, as I look at the code, I see that it presumes >> that lines are never longer than 30 characters. > > If I understand http://en.wikipedia.org/wiki/Fgets corrytly, then the code > assumes lines to be no longer than 29 characters because fgets always > appends a NUL-byte to the string read (or do I misunderstand something > here?). This is why I also thought that you could omit changing the > lineending to a NUL-byte. Howevere, just changing all /r, /n to NUL is the > safest way, I guess. > >> If they are, the reading process will fail in an uneasy way. I will try >> and take care of that too. > > Why does it fail in an uneasy way? Will strlen not terminate, because > there is no NUL-byte in the string returned by fgets then? > DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. |