[En-Nut-Discussion] PATCH: Fix signed/unsigned mismatch warnings

Bernardo Innocenti bernie at develer.com
Thu Mar 17 06:33:53 CET 2005


Hello,

GCC 4.0 by default complains about signed/unsigned
mismatches.

The following patch fixes the problem by declaring
strings as "char" instead of "u_char" in several
places.

None of these changes should alter the generated code,
but I'd recommend comparing binaries before/after the
cure, just in case.


Index: crt/open.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/crt/open.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 open.c
--- crt/open.c	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ crt/open.c	17 Mar 2005 05:13:02 -0000
@@ -79,7 +79,7 @@
 int _open(CONST char *name, int mode)
 {
     NUTDEVICE *dev;
-    u_char dev_name[9];
+    char dev_name[9];
     u_char nidx;
     CONST char *nptr = name;
 
Index: fs/dirent.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/fs/dirent.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 dirent.c
--- fs/dirent.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ fs/dirent.c	17 Mar 2005 04:47:50 -0000
@@ -111,7 +111,7 @@ DIR *opendir(CONST char *name)
 {
     DIR *dir = 0;
     NUTDEVICE *dev;
-    u_char dev_name[9];
+    char dev_name[9];
     u_char nidx;
     CONST char *nptr = name;
 
Index: fs/fat.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/fs/fat.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 fat.c
--- fs/fat.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ fs/fat.c	17 Mar 2005 04:49:42 -0000
@@ -682,7 +682,7 @@ static DWORD FindFileATAPI(DRIVE_INFO * 
                 //
                 if (((pDirEntry->bFlags & 0x03) == bSearchFlags) &&
                     (pDirEntry->bIdentifierLength >= bLongNameLen) &&
-                    (strncmp(&pDirEntry->bName[0], pLongName, bLongNameLen) == 0)) {
+                    (strncmp((char *)&pDirEntry->bName[0], pLongName, bLongNameLen) == 0)) {
                     //
                     // We have found the file :-)
                     // 
Index: fs/pathops.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/fs/pathops.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 pathops.c
--- fs/pathops.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ fs/pathops.c	17 Mar 2005 04:47:31 -0000
@@ -65,7 +65,7 @@
 static int PathOperation(CONST char *path, int opcode)
 {
     NUTDEVICE *dev;
-    u_char dev_name[9];
+    char dev_name[9];
     u_char nidx;
     CONST char *nptr = path;
 
@@ -111,7 +111,7 @@ int access(CONST char *path, int what)
  *
  * \return Always -1 due to missing implementation.
  */
-long lseek(int fh, long pos, int whence)
+off_t lseek(int fh, off_t pos, int whence)
 {
     //IOCTL_ARG3 args;
 
@@ -155,7 +155,7 @@ int unlink(CONST char *path)
 int stat(CONST char *path, struct stat *s)
 {
     NUTDEVICE *dev;
-    u_char dev_name[9];
+    char dev_name[9];
     u_char nidx;
     CONST char *nptr = path;
     IOCTL_ARG2 args;
Index: include/unistd.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/unistd.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 unistd.h
--- include/unistd.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/unistd.h	17 Mar 2005 05:18:37 -0000
@@ -51,10 +51,12 @@
 
 #include <sys/types.h>
 
+typedef long off_t;
+
 __BEGIN_DECLS
 /* */
 extern int access(CONST char *path, int what);
-extern long lseek(int fh, long pos, int whence);
+extern off_t lseek(int fh, off_t pos, int whence);
 extern int rmdir(CONST char *path);
 extern int unlink(CONST char *path);
 __END_DECLS
Index: include/arpa/inet.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/arpa/inet.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 inet.h
--- include/arpa/inet.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/arpa/inet.h	17 Mar 2005 04:56:08 -0000
@@ -61,7 +61,7 @@ __BEGIN_DECLS
  * \file arpa/inet.h
  * \brief Internet address conversion.
  */
-extern u_long inet_addr(CONST  u_char *str);
+extern u_long inet_addr(CONST char *str);
 extern u_char *inet_ntoa(u_long addr);
 
 __END_DECLS
Index: include/dev/chat.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/dev/chat.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 chat.h
--- include/dev/chat.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/dev/chat.h	17 Mar 2005 04:51:41 -0000
@@ -93,9 +93,9 @@ typedef struct {
     int chat_fd;
     u_char chat_arg;
     u_char chat_aborts;
-    u_char *chat_abort[CHAT_MAX_ABORTS];
+    char *chat_abort[CHAT_MAX_ABORTS];
     u_char chat_abomat[CHAT_MAX_ABORTS];
-    u_char *chat_report_search;
+    char *chat_report_search;
     u_char chat_repmat;
     char chat_report_state;
 } NUTCHAT;
Index: include/dev/ppp.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/dev/ppp.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 ppp.h
--- include/dev/ppp.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/dev/ppp.h	17 Mar 2005 04:52:48 -0000
@@ -186,11 +186,11 @@ struct _PPPDCB {
 
     /*! \brief User authentication.
      */
-    u_char *dcb_user;
+    char *dcb_user;
 
     /*! \brief Password authentication.
      */
-    u_char *dcb_pass;
+    char *dcb_pass;
 
     /*! \brief Local IP address.
      */
Index: include/net/netdebug.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/net/netdebug.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 netdebug.h
--- include/net/netdebug.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/net/netdebug.h	17 Mar 2005 04:54:21 -0000
@@ -73,7 +73,7 @@ extern void NutTraceTcp(FILE *stream, u_
 extern void NutTracePPP(FILE *stream, u_char flags);
 
 extern void NutDumpTcpHeader(FILE *stream, u_char *ds, TCPSOCKET *sock, NETBUF *nb);
-extern void NutDumpSockState(FILE *stream, u_char state, u_char *lead, u_char *trail);
+extern void NutDumpSockState(FILE *stream, u_char state, char *lead, char *trail);
 extern void NutDumpSocketList(FILE *stream);
 
 extern void NutDumpLcpOption(FILE * stream, NETBUF * nb);
Index: include/pro/wins.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/pro/wins.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 wins.h
--- include/pro/wins.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/pro/wins.h	17 Mar 2005 05:11:01 -0000
@@ -51,7 +51,7 @@
 
 __BEGIN_DECLS
 /* Function prototypes. */
-extern int NutWinsNameQuery(u_char * name, u_long ipaddr);
+extern int NutWinsNameQuery(char * name, u_long ipaddr);
 
 __END_DECLS
 /* */
Index: include/sys/confos.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/sys/confos.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 confos.h
--- include/sys/confos.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/sys/confos.h	17 Mar 2005 04:45:04 -0000
@@ -76,7 +76,7 @@ typedef struct _CONFOS CONFOS;
 struct _CONFOS {
     u_char size;            /*!< \brief Size of this structure. */
     u_char magic[2];        /*!< \brief Magic cookie. */
-    u_char hostname[16];    /*!< \brief host name of the system. */
+    char   hostname[16];    /*!< \brief host name of the system. */
 };
 
 extern CONFOS confos;
Index: include/sys/device.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/sys/device.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 device.h
--- include/sys/device.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/sys/device.h	17 Mar 2005 04:45:56 -0000
@@ -138,7 +138,7 @@ struct _NUTDEVICE {
     /*! 
      * \brief Unique device name. 
      */
-    u_char dev_name[9];
+    char dev_name[9];
 
     /*! 
      * \brief Type of interface. 
Index: include/sys/thread.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/include/sys/thread.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 thread.h
--- include/sys/thread.h	17 Mar 2005 04:00:25 -0000	1.1.1.1
+++ include/sys/thread.h	17 Mar 2005 04:46:47 -0000
@@ -110,7 +110,7 @@ extern "C" {
     struct _NUTTHREADINFO {
         NUTTHREADINFO *volatile td_next;        /*!< \brief Linked list of all threads. */
         NUTTHREADINFO *td_qnxt; /*!< \brief Linked list of all queued thread. */
-        u_char td_name[9];      /*!< \brief Name of this thread. */
+        char td_name[9];        /*!< \brief Name of this thread. */
         u_char td_state;        /*!< \brief Operating state. One of TDS_ */
         uptr_t td_sp;           /*!< \brief Stack pointer. */
         u_char td_priority;     /*!< \brief Priority level. 0 is highest priority. */
@@ -152,7 +152,7 @@ extern "C" {
     extern void NutThreadSetSleepMode(u_char mode);
 #endif
 
-    extern HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize);
+    extern HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize);
     extern u_char NutThreadSetPriority(u_char level);
 
     extern void NutThreadKill(void);
@@ -167,7 +167,7 @@ extern "C" {
     extern void NutThreadRemoveQueue(NUTTHREADINFO * td, NUTTHREADINFO * volatile *tqpp);
 
     extern void NutThreadSwitch(void);
-    extern HANDLE GetThreadByName(u_char * name);
+    extern HANDLE GetThreadByName(char * name);
 
 /*!
  * \brief Macro for thread entry definitions.
Index: net/inet.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/net/inet.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 inet.c
--- net/inet.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ net/inet.c	17 Mar 2005 04:55:36 -0000
@@ -120,7 +120,7 @@
  *
  * \return IP address in network byte order.
  */
-u_long inet_addr(CONST u_char * str)
+u_long inet_addr(CONST char * str)
 {
     u_short num;
     u_long addr = 0;
Index: net/netdebug.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/net/netdebug.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 netdebug.c
--- net/netdebug.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ net/netdebug.c	17 Mar 2005 04:54:05 -0000
@@ -101,7 +101,7 @@ void NutDumpTcpHeader(FILE * stream, u_c
     fputs("\n", stream);
 }
 
-void NutDumpSockState(FILE * stream, u_char state, u_char * lead, u_char * trail)
+void NutDumpSockState(FILE * stream, u_char state, char * lead, char * trail)
 {
     if (lead)
         fputs(lead, stream);
Index: net/pppdebug.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/net/pppdebug.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 pppdebug.c
--- net/pppdebug.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ net/pppdebug.c	17 Mar 2005 04:54:47 -0000
@@ -190,7 +190,7 @@ void NutDumpLcp(FILE * stream, NETBUF * 
 
 void NutDumpPapOption(FILE * stream, NETBUF * nb)
 {
-    u_char *xcpo;
+    char *xcpo;
     u_short len;
     u_char i;
 
Index: os/thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 thread.c
--- os/thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/thread.c	17 Mar 2005 04:43:54 -0000
@@ -502,7 +502,7 @@ void NutThreadKill(void)
     killedThread = runningThread;
 }
 
-HANDLE GetThreadByName(u_char * name)
+HANDLE GetThreadByName(char * name)
 {
     NUTTHREADINFO *tdp;
 
Index: os/arch/arm_thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/arm_thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 arm_thread.c
--- os/arch/arm_thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/arm_thread.c	17 Mar 2005 05:24:42 -0000
@@ -185,7 +185,7 @@ void NutThreadSwitch(void)
  * \return Pointer to the NUTTHREADINFO structure or 0 to indicate an
  *         error.
  */
-HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize)
+HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize)
 {
     u_char *threadMem;
     SWITCHFRAME *sf;
Index: os/arch/avr_thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/avr_thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 avr_thread.c
--- os/arch/avr_thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/avr_thread.c	17 Mar 2005 05:15:40 -0000
@@ -338,7 +338,7 @@ void NutThreadSwitch(void)
  * \return Pointer to the NUTTHREADINFO structure or 0 to indicate an
  *         error.
  */
-HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize)
+HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize)
 {
     u_char *threadMem;
     SWITCHFRAME *sf;
Index: os/arch/h8_thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/h8_thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 h8_thread.c
--- os/arch/h8_thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/h8_thread.c	17 Mar 2005 05:24:55 -0000
@@ -131,7 +131,7 @@ void NutThreadSwitch(void)
  * \return Pointer to the NUTTHREADINFO structure or 0 to indicate an
  *         error.
  */
-HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize)
+HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize)
 {
     u_char *threadMem;
     SWITCHFRAME *sf;
Index: os/arch/m68k_thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/m68k_thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 m68k_thread.c
--- os/arch/m68k_thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/m68k_thread.c	17 Mar 2005 05:24:59 -0000
@@ -126,7 +126,7 @@ void NutThreadSwitch(void)
  * \return Pointer to the NUTTHREADINFO structure or 0 to indicate an
  *         error.
  */
-HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize)
+HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize)
 {
     u_char *threadMem;
     SWITCHFRAME *sf;
Index: os/arch/unix_nutinit.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/unix_nutinit.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 unix_nutinit.c
--- os/arch/unix_nutinit.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/unix_nutinit.c	17 Mar 2005 04:40:09 -0000
@@ -256,6 +256,8 @@ void *NutIRQSimulation(void *arg)
         }
         // printf("NutIRQSimulation: IRQ processed\n");
     }
+
+    return NULL;
 }
 
 /*!
Index: os/arch/unix_thread.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/unix_thread.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 unix_thread.c
--- os/arch/unix_thread.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/unix_thread.c	17 Mar 2005 04:42:55 -0000
@@ -173,7 +173,7 @@ void NutThreadSwitch(void)
  * \return Pointer to the NUTTHREADINFO structure or 0 to indicate an
  *         error.
  */
-HANDLE NutThreadCreate(u_char * name, void (*fn) (void *), void *arg, size_t stackSize)
+HANDLE NutThreadCreate(char * name, void (*fn) (void *), void *arg, size_t stackSize)
 {
 
     NUTTHREADINFO *td;
Index: os/arch/unix_timer.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/os/arch/unix_timer.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 unix_timer.c
--- os/arch/unix_timer.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ os/arch/unix_timer.c	17 Mar 2005 04:46:17 -0000
@@ -156,6 +156,8 @@ void *NutTimerSimulation(void *arg)
         // printf("NutTimerSimulation tick\n");
         NutIRQTrigger(irq_nr);
     }
+
+    return NULL;
 }
 
 /*!
Index: pro/dencode.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/dencode.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 dencode.c
--- pro/dencode.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/dencode.c	17 Mar 2005 05:07:29 -0000
@@ -91,7 +91,7 @@ static prog_char base64dtab[96] = {
  * be at most 3/4 the size of the encoded, and may be smaller if there
  * are padding characters (blanks, newlines).
  */
-char *NutDecodeBase64(u_char * str)
+char *NutDecodeBase64(char * str)
 {
     /* bug fix from Damian Slee. */
     char code;
Index: pro/dencode.h
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/dencode.h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 dencode.h
--- pro/dencode.h	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/dencode.h	17 Mar 2005 05:07:34 -0000
@@ -3,7 +3,7 @@
 
 #include <sys/types.h>
 
-extern char *NutDecodeBase64(u_char *str);
+extern char *NutDecodeBase64(char *str);
 extern int NutDecodeHex(char c);
 extern char *NutDecodePath(char *path);
 
Index: pro/ftpd.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/ftpd.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 ftpd.c
--- pro/ftpd.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/ftpd.c	17 Mar 2005 05:09:09 -0000
@@ -147,7 +147,7 @@ static prog_char rep_banner[] = "220 Nut
  *             Trailing carriage return or linefeed characters are
  *             cut off.
  */
-static void SplitCmdArg(u_char * line, u_char ** cmd, u_char ** args)
+static void SplitCmdArg(char * line, char ** cmd, char ** args)
 {
     /* Skip leading spaces. */
     while (*line && *line <= ' ') {
@@ -198,7 +198,7 @@ static void SplitCmdArg(u_char * line, u
  *
  * \return The number of converted byte values. Should be 6.
  */
-static int ParseIpPort(CONST u_char * arg, u_long * ip, u_short * port)
+static int ParseIpPort(CONST char * arg, u_long * ip, u_short * port)
 {
     int rc;
 
@@ -1000,8 +1000,8 @@ int NutFtpProcessUser(FTPSESSION * sessi
 int NutFtpProcessRequest(FTPSESSION * session, char *request)
 {
     int rc = 0;
-    u_char *cmd;
-    u_char *args;
+    char *cmd;
+    char *args;
 
     /* Split the line into command and argument part. */
     SplitCmdArg(request, &cmd, &args);
Index: pro/httpd.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/httpd.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 httpd.c
--- pro/httpd.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/httpd.c	17 Mar 2005 05:06:48 -0000
@@ -464,7 +464,7 @@ static void NutHttpProcessFileRequest(FI
     fd = _open(filename, _O_BINARY | _O_RDONLY);
     NutHeapFree(filename);
     if (fd == -1) {
-        u_char *index;
+        char *index;
         u_short urll;
 
 
Index: pro/resolv.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/resolv.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 resolv.c
--- pro/resolv.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/resolv.c	17 Mar 2005 05:05:10 -0000
@@ -85,8 +85,8 @@
 /*@{*/
 
 typedef struct {
-    u_char *doc_hostname;
-    u_char *doc_domain;
+    char *doc_hostname;
+    char *doc_domain;
     u_long doc_ip1;
     u_long doc_ip2;
 } DNSCONFIG;
@@ -103,13 +103,13 @@ typedef struct {
 } DNSHEADER;
 
 typedef struct {
-    u_char *doq_name;
+    char *doq_name;
     u_short doq_type;
     u_short doq_class;
 } DNSQUESTION;
 
 typedef struct {
-    u_char *dor_name;
+    char *dor_name;
     u_short dor_type;
     u_short dor_class;
     u_long dor_ttl;
@@ -150,7 +150,7 @@ static u_short AddShort(u_char * cp, u_s
     return 2;
 }
 
-static u_short AddName(u_char * cp, CONST u_char * name)
+static u_short AddName(u_char * cp, CONST char * name)
 {
     u_char *lcp;
     u_short rc = strlen(name) + 2;
@@ -163,7 +163,7 @@ static u_short AddName(u_char * cp, CONS
             *lcp = 0;
             name++;
         } else {
-            *cp++ = *name++;
+            *cp++ = (u_char)*name++;
             (*lcp)++;
         }
     }
@@ -193,7 +193,7 @@ static u_short ScanLong(u_char * cp, u_l
     return 4;
 }
 
-static u_short ScanName(u_char * cp, u_char ** npp)
+static u_short ScanName(u_char * cp, char ** npp)
 {
     u_char len;
     u_short rc;
@@ -207,8 +207,9 @@ static u_short ScanName(u_char * cp, u_c
     if ((*cp & 0xC0) == 0xC0)
         return 2;
 
-    rc = strlen(cp) + 1;
-    np = *npp = NutHeapAlloc(rc);
+    rc = strlen((char *)cp) + 1;
+    *npp = NutHeapAlloc(rc);
+    np = (u_char *)*npp;
     len = *cp++;
     while (len) {
         while (len--)
@@ -277,7 +278,7 @@ static u_short DecodeDnsHeader(DNSHEADER
     return rc;
 }
 
-static DNSQUESTION *CreateDnsQuestion(DNSQUESTION * doq, CONST u_char * name, u_short type)
+static DNSQUESTION *CreateDnsQuestion(DNSQUESTION * doq, CONST char * name, u_short type)
 {
     if (doq == 0)
         doq = NutHeapAllocClear(sizeof(DNSQUESTION));
@@ -363,7 +364,7 @@ static u_short DecodeDnsResource(DNSRESO
  * \param pdnsip IP address of the primary DNS server.
  * \param sdnsip IP address of the secondary DNS server.
  */
-void NutDnsConfig2(u_char * hostname, u_char * domain, u_long pdnsip, u_long sdnsip)
+void NutDnsConfig2(char * hostname, char * domain, u_long pdnsip, u_long sdnsip)
 {
     if (doc.doc_hostname) {
         NutHeapFree(doc.doc_hostname);
@@ -394,7 +395,7 @@ void NutDnsConfig2(u_char * hostname, u_
  * \param domain Name of the domain of the local host.
  * \param dnsip IP address of the DNS server.
  */
-void NutDnsConfig(u_char * hostname, u_char * domain, u_long dnsip)
+void NutDnsConfig(char * hostname, char * domain, u_long dnsip)
 {
     NutDnsConfig2(hostname, domain, dnsip, 0);
 }
@@ -410,19 +411,19 @@ void NutDnsConfig(u_char * hostname, u_c
  * \return IP address, which is zero, if the name could not
  *         be resolved.
  */
-u_long NutDnsGetResource(CONST u_char * hostname, CONST u_short type);
+u_long NutDnsGetResource(CONST char * hostname, CONST u_short type);
 
-u_long NutDnsGetHostByName(CONST u_char * hostname)
+u_long NutDnsGetHostByName(CONST char * hostname)
 {
     return NutDnsGetResource(hostname, 1);
 }
 
-u_long NutDnsGetMxByDomain(CONST u_char * hostname)
+u_long NutDnsGetMxByDomain(CONST char * hostname)
 {
     return NutDnsGetResource(hostname, 0x0F);
 }
 
-u_long NutDnsGetResource(CONST u_char * hostname, CONST u_short type)
+u_long NutDnsGetResource(CONST char * hostname, CONST u_short type)
 {
     u_long ip = 0;
     u_char *pkt;
Index: pro/wins.c
===================================================================
RCS file: /cvs/bakeoven/bakeoven/pro/wins.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 wins.c
--- pro/wins.c	17 Mar 2005 04:00:26 -0000	1.1.1.1
+++ pro/wins.c	17 Mar 2005 05:12:20 -0000
@@ -59,7 +59,7 @@ NutWinsNameQuery  (  "myboard", inet_add
 #include <stdio.h>
 #endif
 
-extern u_char toupper(u_char);
+extern int toupper(int);
 /* ********************************************************* */
 typedef struct {
     u_short id;
@@ -69,7 +69,7 @@ typedef struct {
     u_short authrr;
     u_short addrr;
     u_char namelen;
-    u_char name[33];
+    char name[33];
     u_short type;
     u_short class;              /* end of request */
     u_long ttl;
@@ -82,10 +82,10 @@ typedef struct {
 
 /* ********************************************************* */
 /* name : netbios label (15 chars max), ipaddr : network ordered IP address bytes */
-int NutWinsNameQuery(u_char * name, u_long ipaddr)
+int NutWinsNameQuery(char * name, u_long ipaddr)
 {
     WINSHEADER *pkt = NULL;
-    u_char *encoded = NULL;
+    char *encoded = NULL;
     UDPSOCKET *sock;
     u_long raddr;
     u_short rport;

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/




More information about the En-Nut-Discussion mailing list