util  Check-in [e3d4aa2fb2]

Overview
Comment:fix dumb bugs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e3d4aa2fb278a865f16aa05824c712e3531f59a0c73dc941bc25a25c5f61f64b
User & Date: lexi on 2019-07-19 06:37:18
Other Links: manifest | tags
Context
2019-07-19
11:34
add mkpw check-in: 42ea2c7296 user: lexi tags: trunk
06:37
fix dumb bugs check-in: e3d4aa2fb2 user: lexi tags: trunk
06:06
fix typo check-in: a38de374f1 user: lexi tags: trunk
Changes

Modified ord.c from [aa1f140ed9] to [1556b70bdd].

   225    225   
   226    226   	char* ptr = buf_end;
   227    227   
   228    228   	if (base > maxbase) return bad_base;
   229    229   	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);
   230    230   
   231    231   	*ptr-- = 0;
   232         -	while(val > 0) {
          232  +	if (val == 0) *ptr-- = '0';
          233  +	else while(val > 0) {
   233    234   		if (ptr < buf_start) return bad_overflow;
   234    235   		word rem = val % base;
   235    236   		val /= base;
   236    237   		char out = baseref[rem];
   237         -		if (lowercase && base < imaxbase)
          238  +		if (lowercase && base <= imaxbase)
   238    239   			if (out >= 'A' && out <= 'Z')
   239    240   				out += ('a' - 'A');
   240    241   		*ptr-- = out;
   241    242   	}
   242    243   
   243    244   	if (newbuf != null) *newbuf = ptr + 1;
   244    245   	return ok;