Explorar o código

Be consistant and use an unsigned char * throughout

Eric Andersen %!s(int64=22) %!d(string=hai) anos
pai
achega
efdb21fff4
Modificáronse 2 ficheiros con 4 adicións e 3 borrados
  1. 1 1
      include/stdio.h
  2. 3 2
      libc/stdio/stdio.c

+ 1 - 1
include/stdio.h

@@ -60,7 +60,7 @@ struct _UC_FILE {
 
   unsigned char mode;
   unsigned char ungot;
-  char unbuf[2];	   /* The buffer for 'unbuffered' streams */
+  unsigned char unbuf[2];	   /* The buffer for 'unbuffered' streams */
 };
 
 typedef struct _UC_FILE FILE;

+ 3 - 2
libc/stdio/stdio.c

@@ -842,8 +842,9 @@ void setbuffer(FILE *fp, char *buf, size_t size)
 #endif
 
 #ifdef L_setvbuf
-int setvbuf(FILE *fp, char *buf, int mode, size_t size)
+int setvbuf(FILE *fp, char *ubuf, int mode, size_t size)
 {
+	unsigned char *buf = ubuf;
 	int allocated_buf_flag;
 
 	if ((mode < 0) || (mode > 2)) {	/* Illegal mode. */
@@ -877,7 +878,7 @@ int setvbuf(FILE *fp, char *buf, int mode, size_t size)
 		}
 	}
 
-	if (buf && (buf != (char *) fp->bufstart)) { /* Want different buffer. */
+	if (buf && (buf != fp->bufstart)) { /* Want different buffer. */
 		_free_stdio_buffer_of_file(fp);	/* Free the old buffer. */
 		fp->mode |= allocated_buf_flag;	/* Allocated? or FILE's builtin. */
 		fp->bufstart = buf;