mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 13:54:30 +02:00
build fixes, declare variables at start of block, use size_t to avoid int vs long errors
This commit is contained in:
parent
bfd5328183
commit
0e6d90cf82
@ -242,12 +242,12 @@ static int exeflat(const char *srcfile, const char *dstfile,
|
|||||||
}
|
}
|
||||||
printf("Compressing kernel - %s format\n", (compress_sys_file)?"sys":"exe");
|
printf("Compressing kernel - %s format\n", (compress_sys_file)?"sys":"exe");
|
||||||
if (!compress_sys_file) {
|
if (!compress_sys_file) {
|
||||||
stubsize = stubexesize;
|
|
||||||
ULONG realsize;
|
ULONG realsize;
|
||||||
/* write header without relocations to file */
|
/* write header without relocations to file */
|
||||||
exe_header nheader = *header;
|
exe_header nheader = *header;
|
||||||
nheader.exRelocItems = 0;
|
nheader.exRelocItems = 0;
|
||||||
nheader.exHeaderSize = 2;
|
nheader.exHeaderSize = 2;
|
||||||
|
stubsize = stubexesize;
|
||||||
realsize = size + 32 - stubsize;
|
realsize = size + 32 - stubsize;
|
||||||
nheader.exPages = (UWORD)(realsize >> 9);
|
nheader.exPages = (UWORD)(realsize >> 9);
|
||||||
nheader.exExtraBytes = (UWORD)realsize & 511;
|
nheader.exExtraBytes = (UWORD)realsize & 511;
|
||||||
@ -391,7 +391,7 @@ static void write_header(FILE *dest, unsigned char * code, UWORD stubsize,
|
|||||||
if (0 == memcmp(kernel_config, "CONFIG", 6)) {
|
if (0 == memcmp(kernel_config, "CONFIG", 6)) {
|
||||||
unsigned long length = kernel_config[6] + kernel_config[7] * 256UL + 8;
|
unsigned long length = kernel_config[6] + kernel_config[7] * 256UL + 8;
|
||||||
if (length <= KERNEL_CONFIG_LENGTH) {
|
if (length <= KERNEL_CONFIG_LENGTH) {
|
||||||
memcpy(&code[2], kernel_config, length);
|
memcpy(&code[2], kernel_config, (size_t)length);
|
||||||
printf("Copied %lu bytes of kernel config block to header\n", length);
|
printf("Copied %lu bytes of kernel config block to header\n", length);
|
||||||
} else {
|
} else {
|
||||||
printf("Error: Found %lu bytes of kernel config block, too long!\n", length);
|
printf("Error: Found %lu bytes of kernel config block, too long!\n", length);
|
||||||
@ -417,7 +417,7 @@ int main(int argc, char **argv)
|
|||||||
int compress_sys_file;
|
int compress_sys_file;
|
||||||
char *buffer, *tmpexe, *cmdbuf, *entryexefilename = "", *entrydevfilename = "";
|
char *buffer, *tmpexe, *cmdbuf, *entryexefilename = "", *entrydevfilename = "";
|
||||||
FILE *dest, *source;
|
FILE *dest, *source;
|
||||||
long size;
|
size_t size;
|
||||||
static unsigned char execode[256 + 10 + 1];
|
static unsigned char execode[256 + 10 + 1];
|
||||||
static unsigned char devcode[256 + 10 + 1];
|
static unsigned char devcode[256 + 10 + 1];
|
||||||
FILE * entryf = NULL;
|
FILE * entryf = NULL;
|
||||||
@ -561,12 +561,12 @@ int main(int argc, char **argv)
|
|||||||
silentSegments, silentcount,
|
silentSegments, silentcount,
|
||||||
FALSE, stubexesize, 0, stubexesize >> 4, &header);
|
FALSE, stubexesize, 0, stubexesize >> 4, &header);
|
||||||
} else {
|
} else {
|
||||||
|
UBYTE deviceheader[16];
|
||||||
FILE * devfile = fopen("tmp.sys", "rb");
|
FILE * devfile = fopen("tmp.sys", "rb");
|
||||||
if (!devfile) {
|
if (!devfile) {
|
||||||
printf("Source file %s could not be opened\n", "tmp.sys");
|
printf("Source file %s could not be opened\n", "tmp.sys");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
UBYTE deviceheader[16];
|
|
||||||
if (fread(deviceheader, 1, sizeof deviceheader, devfile)
|
if (fread(deviceheader, 1, sizeof deviceheader, devfile)
|
||||||
!= sizeof deviceheader) {
|
!= sizeof deviceheader) {
|
||||||
printf("Source file %s could not be read\n", "tmp.sys");
|
printf("Source file %s could not be read\n", "tmp.sys");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user