Compiler & warning related updates/fixes from Nelson
[sxemacs] / src / lstream.c
index 5152924..fb1e00c 100644 (file)
@@ -102,13 +102,13 @@ void Lstream_fungetc (Lstream *stream, int c)
        Function equivalents of the above macros.
 
 Lstream_data_count Lstream_read (Lstream *stream, void *data,
-                                 Lstream_data_count size)
+                                Lstream_data_count size)
        Read SIZE bytes of DATA from the stream.  Return the number of
        bytes read.  0 means EOF. -1 means an error occurred and no
        bytes were read.
 
 Lstream_data_count Lstream_write (Lstream *stream, void *data,
-                                  Lstream_data_count size)
+                                 Lstream_data_count size)
        Write SIZE bytes of DATA to the stream.  Return the number of
        bytes written.  -1 means an error occurred and no bytes were
        written.
@@ -154,11 +154,8 @@ static void
 print_lstream(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
        lstream_t lstr = XLSTREAM(obj);
-       char buf[200];
-
-       sprintf(buf, "#<INTERNAL OBJECT (SXEmacs bug?) (%s lstream) 0x%lx>",
-               lstr->imp->name, (long)lstr);
-       write_c_string(buf, printcharfun);
+       write_fmt_string(printcharfun, "#<INTERNAL OBJECT (SXEmacs bug?) (%s lstream) 0x%lx>",
+                        lstr->imp->name, (long)lstr);
 }
 
 static void finalize_lstream(void *header, int for_disksave)
@@ -189,7 +186,7 @@ aligned_sizeof_lstream(size_t lstream_type_specific_size)
 {
        return ALIGN_SIZE(offsetof(struct lstream_s, data) +
                          lstream_type_specific_size,
-                         ALIGNOF(max_align_t));
+                         ALIGNOF(sxe_max_align_t));
 }
 
 static inline size_t
@@ -240,7 +237,7 @@ static int lstream_type_count;
 
 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
 static void
-lstr_finaliser(void *obj, void *UNUSED(data))
+lstr_finaliser(void *obj, void *SXE_UNUSED(data))
 {
        finalize_lstream(obj, 0);
        return;
@@ -985,7 +982,9 @@ static Lisp_Object
 make_filedesc_stream_1(int filedesc, int offset, int count, int flags,
                       const char *mode)
 {
-       Lisp_Object obj;
+       Lisp_Object obj = Qnil;
+       if (filedesc < 0)
+               return obj;
        lstream_t lstr = Lstream_new(lstream_filedesc, mode);
        filedesc_stream_t fstr = FILEDESC_STREAM_DATA(lstr);