Fixing printf on mingw

This commit is contained in:
bzt 2022-11-21 05:33:59 +01:00
parent 1a36775605
commit be253ad7a7
3 changed files with 12 additions and 11 deletions

View File

@ -51,7 +51,7 @@ void gpt_maketable()
unsigned long int size, ps, total, l;
unsigned char *iso, *p;
uint16_t *u;
char isodate[17], key[64], *tmp, *name;
char isodate[64], key[64], *tmp, *name;
guid_t typeguid;
FILE *f;

View File

@ -31,15 +31,16 @@
#include "fs.h"
#ifdef __WIN32__
#include <windows.h>
#define ISHH(x) ((((x)>>30)&0xFFFFFFFF)==0xFFFFFFFF)
# include <windows.h>
# define ISHH(x) ((((x)>>30)&0xFFFFFFFF)==0xFFFFFFFF)
# define LL "I64"
#else
#define ISHH(x) (((x)>>30)==0x3FFFFFFFF)
#endif
#if defined(MACOSX) || __WORDSIZE == 32
#define LL "ll"
#else
#define LL "l"
# define ISHH(x) (((x)>>30)==0x3FFFFFFFF)
# if defined(MACOSX) || __WORDSIZE == 32
# define LL "ll"
# else
# define LL "l"
# endif
#endif
extern const char deflate_copyright[];
@ -349,7 +350,7 @@ void parsekernel(int idx, unsigned char *data, int v)
{ if(v) { printf("invalid\r\n"); } fprintf(stderr,"mkbootimg: initstack %s\r\n",lang[ERR_BADSIZE]); exit(1); }
if(v) printf("OK\r\n");
}
if(v) printf("Load segment: %016" LL "x size %" LL "dK offs %" LL "x ", core_addr, (core_size + bss + 1024)/1024, core_ptr);
if(v) printf("Load segment: %016" LL "x size %" LL "uK offs %" LL "x ", core_addr, (core_size + bss + 1024)/1024, core_ptr);
if(!ISHH(core_addr)) { if(v) { printf("invalid\r\n"); } fprintf(stderr,"mkbootimg: segment %s\r\n",lang[ERR_BADADDR]); exit(1); }
if(core_addr & 4095) { if(v) { printf("invalid\r\n"); } fprintf(stderr,"mkbootimg: segment %s\r\n",lang[ERR_PAGEALIGN]); exit(1); }
if(core_size + bss > 16 * 1024 * 1024) { if(v) { printf("invalid\r\n"); } fprintf(stderr,"mkbootimg: segment %s\r\n",lang[ERR_BIGSEG]); exit(1); }

View File

@ -71,7 +71,7 @@ unsigned char* readfileall(char *file)
data=(unsigned char*)malloc(read_size+1);
if(!data) { fprintf(stderr,"mkbootimg: %s\r\n",lang[ERR_MEM]); exit(1); }
memset(data,0,read_size+1);
fread(data,read_size,1,f);
fread(data,1,read_size,f);
data[read_size] = 0;
fclose(f);
}