From e5e83f5c812c2976354bb2293f86ca72aab92bc9 Mon Sep 17 00:00:00 2001 From: herp <> Date: Sun, 4 Jun 2000 21:43:50 +0000 Subject: [lcd4linux @ 2000-06-04 21:43:50 by herp] minor bugfix (zero length) --- Crystalfontz.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Crystalfontz.c') diff --git a/Crystalfontz.c b/Crystalfontz.c index 0f778f0..09d41d1 100644 --- a/Crystalfontz.c +++ b/Crystalfontz.c @@ -1,4 +1,5 @@ -/* +/* $Id: Crystalfontz.c,v 1.3 2000/06/04 21:43:50 herp Exp $ + * * driver for display modules from Crystalfontz * * Copyright 2000 by Herbert Rosmanith (herp@wildsau.idv.uni-linz.ac.at) @@ -17,6 +18,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * $Log: Crystalfontz.c,v $ + * Revision 1.3 2000/06/04 21:43:50 herp + * minor bugfix (zero length) + * + * */ #include @@ -220,6 +226,7 @@ static unsigned char p2[] = { 0x00,0x20,0x30,0x38,0x3c,0x3e,0x3f }; static void blacken(int bitfrom,int len,int pos,int startbyte,int endbyte) { + if (len<1) return; if (startbyte==endbyte) Barbuf[pos] |= (p1[bitfrom%XRES] & p2[1+((bitfrom+len-1)%XRES)]); @@ -229,12 +236,12 @@ static void blacken(int bitfrom,int len,int pos,int startbyte,int endbyte) { n=endbyte-startbyte-1; if (n>0) memset(Barbuf+pos+1,0x3f,n); Barbuf[pos+n+1] |= p2[1+((bitfrom+len-1)%XRES)]; - } } static void whiten(int bitfrom,int len,int pos,int startbyte,int endbyte) { + if (len<1) return; if (startbyte==endbyte) Barbuf[pos] &= (p2[bitfrom%XRES] | p1[1+((bitfrom+len-1)%XRES)]); -- cgit v1.2.3