[AD] bug in pack_fgets, pack_fputs?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


They currently test *allegro_errno at the end of the functions
without clearing it at the start.
Index: src/file.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/file.c,v
retrieving revision 1.14
diff -u -r1.14 file.c
--- src/file.c	2001/06/23 10:14:58	1.14
+++ src/file.c	2001/07/19 04:09:15
@@ -1861,9 +1861,13 @@
  */
 char *pack_fgets(char *p, int max, PACKFILE *f)
 {
-   char *pmax = p+max - ucwidth(0);
+   char *pmax;
    int c;
-   
+
+   *allegro_errno = 0;
+
+   pmax = p+max - ucwidth(0);
+
    if (pack_feof(f)) {
       if (ucwidth(0) < max) usetc (p,0);
       return NULL;
@@ -1908,7 +1912,11 @@
  */
 int pack_fputs(AL_CONST char *p, PACKFILE *f)
 {
-   char *s = uconvert(p, U_CURRENT, NULL, U_UTF8, -1);
+   char *s;
+
+   *allegro_errno = 0;
+
+   s = uconvert(p, U_CURRENT, NULL, U_UTF8, -1);
 
    while (*s) {
       #if (defined ALLEGRO_DOS) || (defined ALLEGRO_WINDOWS)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/