Mercurial > hg > dmlib
diff tools/objlink.c @ 864:b111cccf45fc
Portability fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 05 Jan 2015 23:03:11 +0200 |
parents | daebbf28953d |
children | fc272f5f2d15 |
line wrap: on
line diff
--- a/tools/objlink.c Thu Jan 01 09:23:03 2015 +0200 +++ b/tools/objlink.c Mon Jan 05 23:03:11 2015 +0200 @@ -19,7 +19,7 @@ */ typedef struct { - ssize_t start, end; // Start and end address + int start, end; // Start and end address int type; // Type char *name; // Name of the block int placement; @@ -29,8 +29,8 @@ { char *name; // Description of memory model char *desc; - ssize_t size; // Total addressable memory size - ssize_t nmemBlocks; // Defined memory areas + int size; // Total addressable memory size + int nmemBlocks; // Defined memory areas DMMemBlock memBlocks[MAX_MEMBLOCKS]; } DMMemModel; @@ -39,7 +39,7 @@ char *filename; int type; int placement; - ssize_t addr; + int addr; } DMSourceFile; // Source file type @@ -134,10 +134,10 @@ Uint32 optInitValue = 0; int optInitValueType = 1; -ssize_t optCropStart, optCropEnd; +int optCropStart, optCropEnd; BOOL optCropOutput = FALSE; -ssize_t optLoadAddress = LA_AUTO; +int optLoadAddress = LA_AUTO; int optMemModel = 0; const DMMemModel *memModel = NULL; @@ -203,7 +203,7 @@ /* Memory block handling */ -void reserveMemBlock(ssize_t startAddr, ssize_t endAddr, const char *blockName, int blockType) +void reserveMemBlock(int startAddr, int endAddr, const char *blockName, int blockType) { if (startAddr > endAddr) { @@ -236,10 +236,10 @@ } -BOOL dmParseSection(const char *arg, ssize_t *sectStart, ssize_t *sectEnd, char **sectName, BOOL canHasName) +BOOL dmParseSection(const char *arg, int *sectStart, int *sectEnd, char **sectName, BOOL canHasName) { char sectMode, *sep, *str, *namesep; - ssize_t tmpi; + int tmpi; // Define reserved section // Create a copy of the argument @@ -323,7 +323,7 @@ BOOL dmParseInputFile(char *arg, const int type1, const int type2, const char *desc, BOOL requireAddr) { - ssize_t tmpi = 0; + int tmpi = 0; BOOL hasAddr = FALSE; char *sep; @@ -356,7 +356,7 @@ BOOL argHandleOpt(const int optN, char *optArg, char *currArg) { char *p; - ssize_t tmpi; + int tmpi; switch (optN) { case 0: @@ -456,7 +456,7 @@ case 12: { char *sectName = "Clear"; - ssize_t sectStart, sectEnd, sectLen; + int sectStart, sectEnd, sectLen; if (!dmParseSection(optArg, §Start, §End, §Name, TRUE)) return FALSE; @@ -513,10 +513,10 @@ } -int dmLoadPRG(const char *filename, BOOL forceAddr, const ssize_t destAddr) +int dmLoadPRG(const char *filename, BOOL forceAddr, const int destAddr) { FILE *f; - ssize_t dataSize, loadAddr, endAddr; + int dataSize, loadAddr, endAddr; Uint16 tmpAddr; // Open the input file @@ -572,10 +572,10 @@ } -int dmLoadRAW(const char *filename, const ssize_t destAddr) +int dmLoadRAW(const char *filename, const int destAddr) { FILE *f; - ssize_t dataSize, endAddr; + int dataSize, endAddr; // Open the input file if ((f = fopen(filename, "rb")) == NULL) @@ -683,9 +683,9 @@ fprintf(f, " +------------------------------------------+\n"); } -void memPrintEmpty(FILE *f, ssize_t n) +void memPrintEmpty(FILE *f, int n) { - ssize_t i; + int i; for (i = 0; i < n; i++) fprintf(f, " | |\n"); } @@ -701,7 +701,7 @@ { DMMemBlock *curr = &memBlocks[i]; char desc[512], *s; - ssize_t siz, kz; + int siz, kz; // Check for empty, unreserved areas if (prev != NULL) @@ -763,7 +763,7 @@ FILE *dfile = NULL; BOOL hasOverlaps; int i, j; - ssize_t startAddr, endAddr, dataSize, totalSize; + int startAddr, endAddr, dataSize, totalSize; dmInitProg("objlink", "Simple file-linker", "0.81", NULL, NULL); dmVerbosity = 1;