summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gnome.org>2004-02-29 16:07:16 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-02-29 16:07:16 +0000
commit47fda49984479473eac39c8bee7ec7fd80a76e69 (patch)
treeb99767a466ac2eadd843895f423f7ceb58b141e7
parent403dc26c95b7d2b3a57eef535d14ff38ab653d7e (diff)
downloadlibcroco-47fda49984479473eac39c8bee7ec7fd80a76e69.tar.gz
remove the usage of '...' in switch/case statements as this is not
2004-02-29 Dodji Seketeli <dodji@gnome.org> * src/cr-rgb.c,src/cr-tknzr.c: remove the usage of '...' in switch/case statements as this is not portable across c89 compilers.
-rw-r--r--ChangeLog5
-rw-r--r--src/cr-rgb.c48
-rw-r--r--src/cr-tknzr.c11
3 files changed, 38 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d82c73..3040d3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2004-02-29 Dodji Seketeli <dodji@gnome.org>
+ * src/cr-rgb.c,src/cr-tknzr.c: remove the usage of '...' in switch/case statements
+ as this is not portable across c89 compilers.
+
+2004-02-29 Dodji Seketeli <dodji@gnome.org>
+
* src/cr-rgb.c:
(cr_rgb_set): fixed a stupid bug here.
diff --git a/src/cr-rgb.c b/src/cr-rgb.c
index 011c653..d3d0590 100644
--- a/src/cr-rgb.c
+++ b/src/cr-rgb.c
@@ -392,23 +392,23 @@ cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex)
{
for (i = 0 ;i < 3 ; i++)
{
- switch (a_hex[i])
+ if (a_hex[i] >= '0' && a_hex[i] <= '9')
{
- case '0' ... '9':
colors[i] = a_hex[i] - '0';
colors[i] = (colors[i] << 4) | colors[i] ;
- break ;
-
- case 'a' ... 'z':
+ }
+ else if (a_hex[i] >= 'a' && a_hex[i] <= 'z')
+ {
colors[i] = 10 + a_hex[i] - 'a';
colors[i] = (colors[i] << 4) | colors[i] ;
- break ;
-
- case 'A' ... 'Z':
+ }
+ else if (a_hex[i] >= 'A' && a_hex[i] <= 'Z')
+ {
colors[i] = 10 + a_hex[i] - 'A';
colors[i] = (colors[i] << 4) | colors[i] ;
- break ;
- default:
+ }
+ else
+ {
status = CR_UNKNOWN_TYPE_ERROR ;
}
}
@@ -416,31 +416,29 @@ cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex)
else if (strlen (a_hex) == 6)
{
for (i = 0 ; i < 6 ; i++)
- {
-
- switch (a_hex[i])
+ {
+ if (a_hex[i] >='0' && a_hex[i] <= '9')
{
- case '0' ... '9':
colors[i/2] <<= 4 ;
colors[i/2] |= a_hex[i] - '0';
status = CR_OK ;
- break ;
-
- case 'a' ... 'z':
+ }
+ else if (a_hex[i] >= 'a' && a_hex[i] <= 'z')
+ {
colors[i/2] <<= 4 ;
colors[i/2] |= 10 + a_hex[i] - 'a';
status = CR_OK ;
- break ;
-
- case 'A' ... 'Z':
+ }
+ else if (a_hex[i] >= 'A' && a_hex[i] <= 'Z')
+ {
colors[i/2] <<= 4 ;
colors[i/2] |= 10 + a_hex[i] - 'A';
- status = CR_OK ;
- break ;
-
- default:
+ status = CR_OK ;
+ }
+ else
+ {
status = CR_UNKNOWN_TYPE_ERROR ;
- }
+ }
}
}
else
diff --git a/src/cr-tknzr.c b/src/cr-tknzr.c
index 830f35e..2b9e06f 100644
--- a/src/cr-tknzr.c
+++ b/src/cr-tknzr.c
@@ -2507,7 +2507,16 @@ cr_tknzr_get_next_token (CRTknzr *a_this, CRToken **a_tk)
}
break ;
- case '0' ... '9':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
case '.':
{
CRNum *num = NULL ;