mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-11 17:30:25 +00:00
Fix misc 21 (#1573)
* Make `sNew` in (unused) `code_800FC620.c` a string It is passed as a filename to `__osMallocDebug` so should be a nul-terminated string, not a char[3] missing an explicit \0 * Fix gcc warning in `JpegDecoder_ParseNextSymbol` about SLL on negative value -1U is an unsigned value, aka 0xFFFFFFFF I keep -1 because it seems that's what a jpeg standard has too References: https://stackoverflow.com/questions/40508958/shifting-a-negative-signed-value-is-undefined https://www.w3.org/Graphics/JPEG/itu-t81.pdf (page 105, figure F.12) * Small cleanup * Fix few mistakes (thanks gcc warnings) * Add `@bug` in file select settings draw code, using the wrong array * format * format main * rename arg for a happy formatter * Move important function call out of a printf
This commit is contained in:
parent
dc323052c3
commit
4c75260097
14 changed files with 47 additions and 39 deletions
|
@ -28,8 +28,8 @@ long long __ll_mul(long long left, long long right) {
|
|||
return left * right;
|
||||
}
|
||||
|
||||
void __ull_divremi(unsigned long long int* quotient, unsigned long long int* remainder,
|
||||
unsigned long long dividend, unsigned short divisor) {
|
||||
void __ull_divremi(unsigned long long int* quotient, unsigned long long int* remainder, unsigned long long dividend,
|
||||
unsigned short divisor) {
|
||||
*quotient = dividend / divisor;
|
||||
*remainder = dividend % divisor;
|
||||
}
|
||||
|
|
|
@ -7,24 +7,24 @@
|
|||
static char ldigs[] = "0123456789abcdef";
|
||||
static char udigs[] = "0123456789ABCDEF";
|
||||
|
||||
void _Litob(_Pft* args, char type) {
|
||||
void _Litob(_Pft* args, char code) {
|
||||
char buff[BUFF_LEN];
|
||||
const char* digs;
|
||||
int base;
|
||||
int i;
|
||||
unsigned long long num;
|
||||
|
||||
if (type == 'X') {
|
||||
if (code == 'X') {
|
||||
digs = udigs;
|
||||
} else {
|
||||
digs = ldigs;
|
||||
}
|
||||
|
||||
base = (type == 'o') ? 8 : ((type != 'x' && type != 'X') ? 10 : 16);
|
||||
base = (code == 'o') ? 8 : ((code != 'x' && code != 'X') ? 10 : 16);
|
||||
i = BUFF_LEN;
|
||||
num = args->v.ll;
|
||||
|
||||
if ((type == 'd' || type == 'i') && args->v.ll < 0) {
|
||||
if ((code == 'd' || code == 'i') && args->v.ll < 0) {
|
||||
num = -num;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define isdigit(x) (((x) >= '0' && (x) <= '9'))
|
||||
#define LDSIGN(x) (((unsigned short*)&(x))[0] & 0x8000)
|
||||
|
||||
#define ATOI(i, a) \
|
||||
for (i = 0; isdigit(*a); a++) \
|
||||
if (i < 999) \
|
||||
#define ATOI(i, a) \
|
||||
for (i = 0; isdigit(*a); a++) \
|
||||
if (i < 999) \
|
||||
i = *a + i * 10 - '0';
|
||||
|
||||
#define PUT(fmt, _size) \
|
||||
|
@ -24,17 +24,17 @@
|
|||
|
||||
#define MAX_PAD ((int)sizeof(spaces) - 1)
|
||||
|
||||
#define PAD(src, m) \
|
||||
if (m > 0) { \
|
||||
int i; \
|
||||
int j; \
|
||||
for (j = m; j > 0; j -= i) { \
|
||||
if ((unsigned)j > MAX_PAD) \
|
||||
i = MAX_PAD; \
|
||||
else \
|
||||
i = j; \
|
||||
PUT(src, i); \
|
||||
} \
|
||||
#define PAD(src, m) \
|
||||
if (m > 0) { \
|
||||
int i; \
|
||||
int j; \
|
||||
for (j = m; j > 0; j -= i) { \
|
||||
if ((unsigned)j > MAX_PAD) \
|
||||
i = MAX_PAD; \
|
||||
else \
|
||||
i = j; \
|
||||
PUT(src, i); \
|
||||
} \
|
||||
}
|
||||
|
||||
char spaces[] = " ";
|
||||
|
@ -69,7 +69,7 @@ int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap) {
|
|||
for (x.flags = 0; (t = strchr(fchar, *s)) != NULL; s++) {
|
||||
x.flags |= fbit[t - fchar];
|
||||
}
|
||||
|
||||
|
||||
if (*s == '*') {
|
||||
x.width = va_arg(ap, int);
|
||||
if (x.width < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue