ref: f5fcf6688b6a8fe502e94e531ec4e17f5b108e6e
parent: d30b160fe3b595c071d37345c51b35fffb2ad30c
author: cinap_lenrek <[email protected]>
date: Mon Jan 4 13:33:06 EST 2016
libmp: mistake in strtomp()
--- a/sys/src/libmp/port/strtomp.c
+++ b/sys/src/libmp/port/strtomp.c
@@ -199,18 +199,19 @@
}
if(base == 0){
- if(*a == '0'){
- a++;
- if(*a == 'x' || *a == 'X') {
- a++;
+ base = 10;
+ if(a[0] == '0'){
+ if(a[1] == 'x' || a[1] == 'X') {
+ a += 2;
base = 16;
- } else if(*a == 'b' || *a == 'B') {
- a++;
+ } else if(a[1] == 'b' || a[1] == 'B') {
+ a += 2;
base = 2;
- } else
+ } else if(a[1] >= '0' && a[1] <= '7') {
+ a++;
base = 8;
- } else
- base = 10;
+ }
+ }
}
switch(base){