efl/edbus: Make sure to compare EOF against an int from fgetc.
authorStefan Schmidt <stefan@datenfreihafen.org>
Mon, 11 Feb 2013 15:03:41 +0000 (15:03 +0000)
committerStefan Schmidt <stefan@datenfreihafen.org>
Mon, 11 Feb 2013 15:03:41 +0000 (15:03 +0000)
Fgetc() return an int to clearly detect EOF. If you want to read more about it:
http://stackoverflow.com/questions/11057259/fgetc-checking-eof

SVN revision: 83829

src/bin/edbus/utils.c

index 02e7fb0..47d8c77 100644 (file)
@@ -5,7 +5,7 @@ Eina_Bool
 file_read(const char *file_name, char **buffer)
 {
    FILE *xml_handler;
-   char data;
+   int data; /* fgetc needs int to detect EOF correctly */
    Eina_Strbuf *buf;
 
    xml_handler = fopen(file_name, "rt");
@@ -17,7 +17,7 @@ file_read(const char *file_name, char **buffer)
    buf = eina_strbuf_new();
 
    while ((data = fgetc(xml_handler)) != EOF)
-     eina_strbuf_append_char(buf, data);
+     eina_strbuf_append_char(buf, (char)data);
 
    fclose(xml_handler);
    *buffer = eina_strbuf_string_steal(buf);