[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] warning fixes for mintlib



Attached.

Alan.
diff --git a/mintlib/do_stat.c b/mintlib/do_stat.c
index 714a9c9..19e5ba6 100644
--- a/mintlib/do_stat.c
+++ b/mintlib/do_stat.c
@@ -54,14 +54,13 @@ __sys_stat (const char *path, struct stat *st, int lflag, int exact)
 			st->st_rdev = (__dev_t) xattr.st_rdev;
 
 			if (exact) {
-				unsigned short *ptr;
-
-				ptr = (unsigned short *) &xattr.st_mtime;
-				st->st_mtime = __unixtime (ptr[0], ptr[1]);
-				ptr = (unsigned short *) &xattr.st_atime;
-				st->st_atime = __unixtime (ptr[0], ptr[1]);
-				ptr = (unsigned short *) &xattr.st_ctime;
-				st->st_ctime = __unixtime (ptr[0], ptr[1]);
+				union { unsigned short s[2]; unsigned long l; } data;
+				data.l = xattr.st_mtime;
+				st->st_mtime = __unixtime (data.s[0], data.s[1]);
+				data.l = xattr.st_atime;
+				st->st_atime = __unixtime (data.s[0], data.s[1]);
+				data.l = xattr.st_ctime;
+				st->st_ctime = __unixtime (data.s[0], data.s[1]);
 			}
 
 			st->st_size = (__off_t) xattr.st_size;
diff --git a/shadow/fgetspent_r.c b/shadow/fgetspent_r.c
index 6076f43..7678fe8 100644
--- a/shadow/fgetspent_r.c
+++ b/shadow/fgetspent_r.c
@@ -35,6 +35,7 @@ int __fgetspent_r (FILE* stream, struct spwd* result_buf, char* buffer,
   char* write_crs = buffer;
   size_t bytes_used = 0;
   char** fields[11];
+  void *tmp;
   int numerical_error = 0;
   
   enum parse_state { init = 0, namp = 1, pwdp = 2, lstchg = 3, min = 4, 
@@ -52,13 +53,20 @@ int __fgetspent_r (FILE* stream, struct spwd* result_buf, char* buffer,
   fields[0] = NULL;
   fields[1] = &result_buf->sp_namp;
   fields[2] = &result_buf->sp_pwdp;
-  fields[3] = (char**) &result_buf->sp_lstchg;
-  fields[4] = (char**) &result_buf->sp_min;
-  fields[5] = (char**) &result_buf->sp_max;
-  fields[6] = (char**) &result_buf->sp_warn;
-  fields[7] = (char**) &result_buf->sp_inact;
-  fields[8] = (char**) &result_buf->sp_expire;
-  fields[9] = (char**) &result_buf->sp_flag;
+  tmp = &result_buf->sp_lstchg;
+  fields[3] = (char**) tmp;
+  tmp = &result_buf->sp_min;
+  fields[4] = (char**) tmp;
+  tmp = &result_buf->sp_max;
+  fields[5] = (char**) tmp;
+  tmp = &result_buf->sp_warn;
+  fields[6] = (char**) tmp;
+  tmp = &result_buf->sp_inact;
+  fields[7] = (char**) tmp;
+  tmp = &result_buf->sp_expire;
+  fields[8] = (char**) tmp;
+  tmp = &result_buf->sp_flag;
+  fields[9] = (char**) tmp;
   fields[10] = NULL;
   
   *result = NULL;
diff --git a/shadow/sgetspent_r.c b/shadow/sgetspent_r.c
index 2e6da93..e077f4b 100644
--- a/shadow/sgetspent_r.c
+++ b/shadow/sgetspent_r.c
@@ -21,6 +21,7 @@ int __sgetspent_r (const char* stream, struct spwd* result_buf, char* buffer,
   char* write_crs = buffer;
   size_t bytes_used = 0;
   char** fields[11];
+  void *tmp;
   int numerical_error = 0;
   
   enum parse_state { init = 0, namp = 1, pwdp = 2, lstchg = 3, min = 4, 
@@ -38,13 +39,20 @@ int __sgetspent_r (const char* stream, struct spwd* result_buf, char* buffer,
   fields[0] = NULL;
   fields[1] = &result_buf->sp_namp;
   fields[2] = &result_buf->sp_pwdp;
-  fields[3] = (char**) &result_buf->sp_lstchg;
-  fields[4] = (char**) &result_buf->sp_min;
-  fields[5] = (char**) &result_buf->sp_max;
-  fields[6] = (char**) &result_buf->sp_warn;
-  fields[7] = (char**) &result_buf->sp_inact;
-  fields[8] = (char**) &result_buf->sp_expire;
-  fields[9] = (char**) &result_buf->sp_flag;
+  tmp = &result_buf->sp_lstchg;
+  fields[3] = (char**) tmp;
+  tmp = &result_buf->sp_min;
+  fields[4] = (char**) tmp;
+  tmp = &result_buf->sp_max;
+  fields[5] = (char**) tmp;
+  tmp = &result_buf->sp_warn;
+  fields[6] = (char**) tmp;
+  tmp = &result_buf->sp_inact;
+  fields[7] = (char**) tmp;
+  tmp = &result_buf->sp_expire;
+  fields[8] = (char**) tmp;
+  tmp = &result_buf->sp_flag;
+  fields[9] = (char**) tmp;
   fields[10] = NULL;
   
   *result = NULL;
diff --git a/stdio/printf-parse.h b/stdio/printf-parse.h
index cf1da1b..5d7c50e 100644
--- a/stdio/printf-parse.h
+++ b/stdio/printf-parse.h
@@ -23,7 +23,6 @@
 #include <printf.h>
 #include <stdint.h>
 #ifdef __MINT__
-# define UCHAR_T unsigned char
 # include <limits.h>
 #endif
 #include <stddef.h>
@@ -77,7 +76,7 @@ union printf_arg
 /* Read a simple integer from a string and update the string pointer.
    It is assumed that the first character is a digit.  */
 static inline unsigned int
-read_int (const UCHAR_T * *pstr)
+read_int (const char * *pstr)
 {
   unsigned int retval = **pstr - L_('0');
 
@@ -134,11 +133,11 @@ extern printf_function **__printf_function_table;
    remains the highest argument index used.  */
 #ifndef __MINT__
 static inline size_t
-parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
+parse_one_spec (const char *format, size_t posn, struct printf_spec *spec,
 		size_t *max_ref_arg, mbstate_t *ps)
 #else
 static inline size_t
-parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
+parse_one_spec (const char *format, size_t posn, struct printf_spec *spec,
 		size_t *max_ref_arg)
 #endif
 {
@@ -160,7 +159,7 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
   /* Test for positional argument.  */
   if (ISDIGIT (*format))
     {
-      const UCHAR_T *begin = format;
+      const char *begin = format;
 
       n = read_int (&format);
 
@@ -219,7 +218,7 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
     {
       /* The field width is given in an argument.
 	 A negative field width indicates left justification.  */
-      const UCHAR_T *begin = ++format;
+      const char *begin = ++format;
 
       if (ISDIGIT (*format))
 	{
@@ -256,7 +255,7 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
       if (*format == L_('*'))
 	{
 	  /* The precision is given in an argument.  */
-	  const UCHAR_T *begin = ++format;
+	  const char *begin = ++format;
 
 	  if (ISDIGIT (*format))
 	    {
diff --git a/stdio/vfprintf.c b/stdio/vfprintf.c
index 3883897..aad68a3 100644
--- a/stdio/vfprintf.c
+++ b/stdio/vfprintf.c
@@ -237,13 +237,13 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   int done;
 
   /* Current character in format string.  */
-  const UCHAR_T *f;
+  const CHAR_T *f;
 
   /* End of leading constant string.  */
-  const UCHAR_T *lead_str_end;
+  const CHAR_T *lead_str_end;
 
   /* Points to next format specifier.  */
-  const UCHAR_T *end_of_spec;
+  const CHAR_T *end_of_spec;
 
   /* Buffer intermediate results.  */
   char work_buffer[1000];
@@ -1200,8 +1200,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 #endif
 
   /* Write the literal text before the first format.  */
-  outstring ((const UCHAR_T *) format,
-	     lead_str_end - (const UCHAR_T *) format);
+  outstring ((const CHAR_T *) format,
+	     lead_str_end - (const CHAR_T *) format);
 
   /* If we only have to print a simple string, return now.  */
   if (*f == L_('\0'))
@@ -1302,7 +1302,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       /* Get width from argument.  */
     LABEL (width_asterics):
       {
-	const UCHAR_T *tmp;	/* Temporary value.  */
+	const CHAR_T *tmp;	/* Temporary value.  */
 
 	tmp = ++f;
 	if (ISDIGIT (*tmp) && read_int (&tmp) && *tmp == L_('$'))
@@ -1343,7 +1343,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       ++f;
       if (*f == L_('*'))
 	{
-	  const UCHAR_T *tmp;	/* Temporary value.  */
+	  const CHAR_T *tmp;	/* Temporary value.  */
 
 	  tmp = ++f;
 	  if (ISDIGIT (*tmp) && read_int (&tmp) > 0 && *tmp == L_('$'))
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index 5100f9e..ac56b6b 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -107,7 +107,7 @@ authdes_create (const char *servername, u_int window,
   /* syncaddr   - optional addr of host to sync with */
   /* ckey       - optional conversation key to use */
 {
-  u_char pkey_data[1024];
+  char pkey_data[1024];
   netobj pkey;
 
   if (!getpublickey (servername, pkey_data))
@@ -236,7 +236,7 @@ authdes_marshal (AUTH *auth, XDR *xdrs)
   des_block cryptbuf[2];
   des_block ivec;
   int status;
-  unsigned int len;
+  int32_t len;
   register int32_t *ixdr;
   struct timeval tval;