comparison tools/objlink.c @ 871:fc272f5f2d15

Make value type of dmGetIntVal() unsigned.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Feb 2015 20:27:12 +0200
parents b111cccf45fc
children 985225a93aeb
comparison
equal deleted inserted replaced
870:2711f99b40e5 871:fc272f5f2d15
132 BOOL optDescribe = FALSE, 132 BOOL optDescribe = FALSE,
133 optAllowOverlap = FALSE; 133 optAllowOverlap = FALSE;
134 134
135 Uint32 optInitValue = 0; 135 Uint32 optInitValue = 0;
136 int optInitValueType = 1; 136 int optInitValueType = 1;
137 int optCropStart, optCropEnd; 137 unsigned int optCropStart, optCropEnd;
138 BOOL optCropOutput = FALSE; 138 BOOL optCropOutput = FALSE;
139 139
140 int optLoadAddress = LA_AUTO; 140 int optLoadAddress = LA_AUTO;
141 141
142 int optMemModel = 0; 142 int optMemModel = 0;
234 const DMMemBlock *a = cva, *b = cvb; 234 const DMMemBlock *a = cva, *b = cvb;
235 return a->start - b->start; 235 return a->start - b->start;
236 } 236 }
237 237
238 238
239 BOOL dmParseSection(const char *arg, int *sectStart, int *sectEnd, char **sectName, BOOL canHasName) 239 BOOL dmParseSection(const char *arg, unsigned int *sectStart, unsigned int *sectEnd, char **sectName, BOOL canHasName)
240 { 240 {
241 char sectMode, *sep, *str, *namesep; 241 char sectMode, *sep, *str, *namesep;
242 int tmpi; 242 unsigned int tmpi;
243 243
244 // Define reserved section 244 // Define reserved section
245 // Create a copy of the argument 245 // Create a copy of the argument
246 if ((str = dm_strdup(arg)) == NULL) 246 if ((str = dm_strdup(arg)) == NULL)
247 { 247 {
321 } 321 }
322 322
323 323
324 BOOL dmParseInputFile(char *arg, const int type1, const int type2, const char *desc, BOOL requireAddr) 324 BOOL dmParseInputFile(char *arg, const int type1, const int type2, const char *desc, BOOL requireAddr)
325 { 325 {
326 int tmpi = 0; 326 unsigned int tmpi = 0;
327 BOOL hasAddr = FALSE; 327 BOOL hasAddr = FALSE;
328 char *sep; 328 char *sep;
329 329
330 if ((sep = strrchr(arg, ':')) != NULL) 330 if ((sep = strrchr(arg, ':')) != NULL)
331 { 331 {
354 354
355 355
356 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) 356 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
357 { 357 {
358 char *p; 358 char *p;
359 int tmpi; 359 unsigned int tmpi;
360 360
361 switch (optN) { 361 switch (optN) {
362 case 0: 362 case 0:
363 argShowHelp(); 363 argShowHelp();
364 exit(0); 364 exit(0);
454 break; 454 break;
455 455
456 case 12: 456 case 12:
457 { 457 {
458 char *sectName = "Clear"; 458 char *sectName = "Clear";
459 int sectStart, sectEnd, sectLen; 459 unsigned int sectStart, sectEnd, sectLen;
460 if (!dmParseSection(optArg, &sectStart, &sectEnd, &sectName, TRUE)) 460 if (!dmParseSection(optArg, &sectStart, &sectEnd, &sectName, TRUE))
461 return FALSE; 461 return FALSE;
462 462
463 // Allocate memory block 463 // Allocate memory block
464 sectLen = sectEnd - sectStart + 1; 464 sectLen = sectEnd - sectStart + 1;
492 if (!dmGetIntVal(optArg, &tmpi)) 492 if (!dmGetIntVal(optArg, &tmpi))
493 { 493 {
494 dmError("Invalid loading address '%s'.\n", optArg); 494 dmError("Invalid loading address '%s'.\n", optArg);
495 return FALSE; 495 return FALSE;
496 } 496 }
497 if (tmpi < 0 || tmpi >= 64*1024) 497 if (tmpi >= 64*1024)
498 { 498 {
499 dmError("Invalid or insane loading address %d/$%x!\n", 499 dmError("Invalid or insane loading address %d/$%x!\n",
500 tmpi); 500 tmpi);
501 return FALSE; 501 return FALSE;
502 } 502 }