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
226
227
228
229
230
231

232
233
234
235
236
237
238
239
240
241
242
243
244

	char* ptr = buf_end;

	if (base > maxbase) return bad_base;
	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);

	*ptr-- = 0;

	while(val > 0) {
		if (ptr < buf_start) return bad_overflow;
		word rem = val % base;
		val /= base;
		char out = baseref[rem];
		if (lowercase && base < imaxbase)
			if (out >= 'A' && out <= 'Z')
				out += ('a' - 'A');
		*ptr-- = out;
	}

	if (newbuf != null) *newbuf = ptr + 1;
	return ok;







>
|




|







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

	char* ptr = buf_end;

	if (base > maxbase) return bad_base;
	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);

	*ptr-- = 0;
	if (val == 0) *ptr-- = '0';
	else while(val > 0) {
		if (ptr < buf_start) return bad_overflow;
		word rem = val % base;
		val /= base;
		char out = baseref[rem];
		if (lowercase && base <= imaxbase)
			if (out >= 'A' && out <= 'Z')
				out += ('a' - 'A');
		*ptr-- = out;
	}

	if (newbuf != null) *newbuf = ptr + 1;
	return ok;