On Tue, 2019-02-26 at 22:44 +0100, Florian Weimer wrote:
> * Sérgio Basto:
> 
> >  stdio.h defines EOF as -1 , so if we want work with files
> > and use EOF character, we need use signed chars, though .
> 
> No, this is not how it works.
> 
> Most C interfaces (hopefully all of them, but I wouldn't be sure)
> that
> use in-band signaling for EOF return ints.  EOF is returned as int,
> and
> the characters are returned after casting them to unsigned char, even
> if
> char is signed on the architecture.
> 
> So getchar returns 255 when reading the character 'ÿ' in ISO-8859-1,
> and
> -1 for EOF.
> 
> It is a common mistake to use a char variable to store the result of
> getchar and similar functions because this way, you cannot tell 'ÿ'
> and
> EOF apart.  This leads either to premature detection of EOF, or
> infinite
> loops reading 'ÿ' over and over again, depending on the architecture.


OK , I made another patch [1] not touching ./Source/Common/gdcmString.h
and instead use definition of EOL, I use the default char of template
... 

[1]

https://src.fedoraproject.org/fork/sergiomb/rpms/gdcm/blob/master/f/gdcm-2.8.8-dont_use_EOF.patch
                                          
        
> Thanks,
> Florian
-- 
Sérgio M. B.
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to