From 2d8c20e14ccd6be77bd959d1a5a928e5f6b4ecee Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Sat, 2 Apr 2005 05:28:58 +0000 Subject: [lcd4linux @ 2005-04-02 05:28:58 by reinelt] fixed gcc4 warnings about signed/unsigned mismatches --- drv_Crystalfontz.c | 28 +++++++++++++++------------- drv_SimpleLCD.c | 9 ++++++--- drv_USBLCD.c | 9 ++++++--- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c index a92ff30..1dc6c71 100644 --- a/drv_Crystalfontz.c +++ b/drv_Crystalfontz.c @@ -1,4 +1,4 @@ -/* $Id: drv_Crystalfontz.c,v 1.32 2005/03/23 12:23:35 reinelt Exp $ +/* $Id: drv_Crystalfontz.c,v 1.33 2005/04/02 05:28:58 reinelt Exp $ * * new style driver for Crystalfontz display modules * @@ -23,6 +23,9 @@ * * * $Log: drv_Crystalfontz.c,v $ + * Revision 1.33 2005/04/02 05:28:58 reinelt + * fixed gcc4 warnings about signed/unsigned mismatches + * * Revision 1.32 2005/03/23 12:23:35 reinelt * fixed some signed/unsigned char mismatches in the Crystalfontz driver (ticket #12) * @@ -321,22 +324,22 @@ static void drv_CF_process_packet (void) static int drv_CF_poll (void) { - unsigned char buffer[32]; - /* read into RingBuffer */ while (1) { + char buffer[32]; int num, n; num = drv_generic_serial_poll(buffer, sizeof(buffer)); if (num <= 0) break; /* put result into RingBuffer */ for (n = 0; n < num; n++) { - RingBuffer[RingWPos++] = buffer[n]; + RingBuffer[RingWPos++] = (unsigned char)buffer[n]; if (RingWPos >= sizeof(RingBuffer)) RingWPos = 0; } } /* process RingBuffer */ while (1) { + unsigned char buffer[32]; int n, num, size; unsigned short crc; /* packet size */ @@ -395,11 +398,11 @@ static void drv_CF_send (const int cmd, int len, const unsigned char *data) if (len > Payload) { error ("%s: internal error: packet length %d exceeds payload size %d", Name, len, Payload); - len=sizeof(buffer)-1; + len = sizeof(buffer)-1; } - buffer[0]=cmd; - buffer[1]=len; + buffer[0] = cmd; + buffer[1] = len; memcpy (buffer+2, data, len); crc = CRC(buffer, len+2, 0xffff); buffer[len+2] = LSB(crc); @@ -409,14 +412,14 @@ static void drv_CF_send (const int cmd, int len, const unsigned char *data) debug ("Tx Packet %d len=%d", buffer[0], buffer[1]); #endif - drv_generic_serial_write (buffer, len+4); + drv_generic_serial_write ((char*)buffer, len+4); } static void drv_CF_write1 (const int row, const int col, const char *data, const int len) { - unsigned char cmd[3]="\021xy"; /* set cursor position */ + char cmd[3]="\021xy"; /* set cursor position */ if (row==0 && col==0) { drv_generic_serial_write ("\001", 1); /* cursor home */ @@ -475,7 +478,7 @@ static void drv_CF_write3 (const int row, const int col, const char *data, const static void drv_CF_defchar1 (const int ascii, const unsigned char *matrix) { int i; - unsigned char cmd[10]="\031n"; /* set custom char bitmap */ + char cmd[10]="\031n"; /* set custom char bitmap */ /* user-defineable chars start at 128, but are defined at 0 */ cmd[1]=(char)(ascii-CHAR0); @@ -506,7 +509,7 @@ static void drv_CF_defchar23 (const int ascii, const unsigned char *matrix) static int drv_CF_contrast (int contrast) { static unsigned char Contrast=0; - unsigned char buffer[2]; + char buffer[2]; /* -1 is used to query the current contrast */ if (contrast == -1) return Contrast; @@ -544,7 +547,7 @@ static int drv_CF_contrast (int contrast) static int drv_CF_backlight (int backlight) { static unsigned char Backlight=0; - unsigned char buffer[2]; + char buffer[2]; /* -1 is used to query the current backlight */ if (backlight == -1) return Backlight; @@ -563,7 +566,6 @@ static int drv_CF_backlight (int backlight) case 2: case 3: - buffer[0] = Backlight; drv_CF_send (14, 1, &Backlight); break; } diff --git a/drv_SimpleLCD.c b/drv_SimpleLCD.c index 85f91bf..eb449a6 100644 --- a/drv_SimpleLCD.c +++ b/drv_SimpleLCD.c @@ -1,4 +1,4 @@ -/* $Id: drv_SimpleLCD.c,v 1.1 2005/02/24 07:06:48 reinelt Exp $ +/* $Id: drv_SimpleLCD.c,v 1.2 2005/04/02 05:28:58 reinelt Exp $ * * driver for a simple serial terminal. * This driver simply send out caracters on the serial port, without any @@ -40,6 +40,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: drv_SimpleLCD.c,v $ + * Revision 1.2 2005/04/02 05:28:58 reinelt + * fixed gcc4 warnings about signed/unsigned mismatches + * * Revision 1.1 2005/02/24 07:06:48 reinelt * SimpleLCD driver added * @@ -123,12 +126,12 @@ static void drv_SL_write (const int row, const int col, const char *data, int le static int drv_SL_start (const char *section, const int quiet) { int rows=-1, cols=-1; - unsigned int flags=0; + int flags=0; char *s; cfg_number(section,"Options",0,0,0xffff,&flags); - if (drv_generic_serial_open(section, Name, flags) < 0) return -1; + if (drv_generic_serial_open(section, Name, (unsigned) flags) < 0) return -1; s=cfg_get(section, "Size", NULL); if (s==NULL || *s=='\0') { diff --git a/drv_USBLCD.c b/drv_USBLCD.c index ba9ab40..a1e8eba 100644 --- a/drv_USBLCD.c +++ b/drv_USBLCD.c @@ -1,4 +1,4 @@ -/* $Id: drv_USBLCD.c,v 1.20 2005/01/30 06:43:22 reinelt Exp $ +/* $Id: drv_USBLCD.c,v 1.21 2005/04/02 05:28:58 reinelt Exp $ * * new style driver for USBLCD displays * @@ -26,6 +26,9 @@ * * * $Log: drv_USBLCD.c,v $ + * Revision 1.21 2005/04/02 05:28:58 reinelt + * fixed gcc4 warnings about signed/unsigned mismatches + * * Revision 1.20 2005/01/30 06:43:22 reinelt * driver for LCD-Linux finished * @@ -165,8 +168,8 @@ static char Name[] = "USBLCD"; static char *Port = NULL; static int use_libusb = 0; static int usblcd_file; -static unsigned char *Buffer; -static unsigned char *BufPtr; +static char *Buffer; +static char *BufPtr; #ifdef HAVE_USB_H -- cgit v1.2.3