mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Replace C types by stdint.h types
Not all occurrences have been replaced, in some cases they have been left as they were before (like in rgbgfx and when they are in the interface of a C standard library function). Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -82,7 +82,7 @@ size_t symvaluetostring(char *dest, size_t maxLength, char *sym)
|
||||
length = i;
|
||||
} else {
|
||||
uint32_t value = sym_GetConstantValue(sym);
|
||||
int fullLength = snprintf(dest, maxLength + 1, "$%X", value);
|
||||
int32_t fullLength = snprintf(dest, maxLength + 1, "$%X", value);
|
||||
|
||||
if (fullLength < 0) {
|
||||
fatalerror("snprintf encoding error");
|
||||
@@ -109,9 +109,9 @@ uint32_t str2int( char *s )
|
||||
return( r );
|
||||
}
|
||||
|
||||
uint32_t str2int2( char *s, int length )
|
||||
uint32_t str2int2( char *s, int32_t length )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
uint32_t r=0;
|
||||
i = (length - 4 < 0 ? 0 : length - 4);
|
||||
while(i < length)
|
||||
@@ -997,7 +997,7 @@ constlist_8bit_entry : /* empty */ {
|
||||
out_RelByte( &$1 );
|
||||
} | string {
|
||||
char *s = $1;
|
||||
int length = charmap_Convert(&s);
|
||||
int32_t length = charmap_Convert(&s);
|
||||
out_AbsByteGroup(s, length);
|
||||
free(s);
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ constlist_8bit_entry_single : /* empty */ {
|
||||
out_RelByte( &$1 );
|
||||
} | string {
|
||||
char *s = $1;
|
||||
int length = charmap_Convert(&s);
|
||||
int32_t length = charmap_Convert(&s);
|
||||
out_AbsByteGroup(s, length);
|
||||
free(s);
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ relocconst : T_ID
|
||||
| string
|
||||
{
|
||||
char *s = $1;
|
||||
int length = charmap_Convert(&s);
|
||||
int32_t length = charmap_Convert(&s);
|
||||
uint32_t r = str2int2(s, length);
|
||||
free(s);
|
||||
rpn_Number(&$$,r);
|
||||
|
||||
@@ -81,12 +81,12 @@ struct Charmap globalCharmap = {0};
|
||||
|
||||
extern struct Section *pCurrentSection;
|
||||
|
||||
int
|
||||
int32_t
|
||||
readUTF8Char(char *dest, char *src)
|
||||
{
|
||||
uint32_t state;
|
||||
uint32_t codep;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0, state = 0;; i++) {
|
||||
if (decode(&state, &codep, (uint8_t)src[i]) == 1) {
|
||||
@@ -104,10 +104,10 @@ readUTF8Char(char *dest, char *src)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
int32_t
|
||||
charmap_Add(char *input, uint8_t output)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
size_t input_length;
|
||||
char temp1i[CHARMAPLENGTH + 1], temp2i[CHARMAPLENGTH + 1], temp1o = 0,
|
||||
temp2o = 0;
|
||||
@@ -170,14 +170,14 @@ charmap_Add(char *input, uint8_t output)
|
||||
return ++charmap->count;
|
||||
}
|
||||
|
||||
int
|
||||
int32_t
|
||||
charmap_Convert(char **input)
|
||||
{
|
||||
struct Charmap *charmap;
|
||||
|
||||
char outchar[CHARMAPLENGTH + 1];
|
||||
char *buffer;
|
||||
int i, j, length;
|
||||
int32_t i, j, length;
|
||||
|
||||
if (pCurrentSection && pCurrentSection->charmap) {
|
||||
charmap = pCurrentSection->charmap;
|
||||
|
||||
@@ -86,7 +86,7 @@ pushcontext(void)
|
||||
fatalerror("No memory for context");
|
||||
}
|
||||
|
||||
int
|
||||
static int32_t
|
||||
popcontext(void)
|
||||
{
|
||||
struct sContext *pLastFile, **ppLastFile;
|
||||
@@ -150,7 +150,7 @@ popcontext(void)
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
int32_t
|
||||
fstk_GetLine(void)
|
||||
{
|
||||
struct sContext *pLastFile, **ppLastFile;
|
||||
@@ -227,7 +227,7 @@ FILE *
|
||||
fstk_FindFile(char *fname)
|
||||
{
|
||||
char path[_MAX_PATH];
|
||||
int i;
|
||||
int32_t i;
|
||||
FILE *f;
|
||||
|
||||
if ((f = fopen(fname, "rb")) != NULL || errno != ENOENT) {
|
||||
|
||||
@@ -146,7 +146,7 @@ uint32_t
|
||||
ParseSymbol(char *src, uint32_t size)
|
||||
{
|
||||
char dest[MAXSYMLEN + 1];
|
||||
int copied = 0, size_backup = size;
|
||||
int32_t copied = 0, size_backup = size;
|
||||
|
||||
while (size && copied < MAXSYMLEN) {
|
||||
if (*src == '\\') {
|
||||
|
||||
@@ -82,7 +82,7 @@ yyunput(char c)
|
||||
void
|
||||
yyunputstr(char *s)
|
||||
{
|
||||
int i, len;
|
||||
int32_t i, len;
|
||||
|
||||
len = strlen(s);
|
||||
|
||||
@@ -293,7 +293,7 @@ lexgetfloat(uint32_t nFloatMask)
|
||||
fatalerror("Internal error in lexgetfloat");
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
int32_t i = 0;
|
||||
|
||||
while ((nFloatMask & 1) == 0) {
|
||||
nFloatMask >>= 1;
|
||||
@@ -384,17 +384,17 @@ yylex_GetFloatMaskAndFloatLen(uint32_t *pnFloatMask, uint32_t *pnFloatLen)
|
||||
|
||||
char *s = pLexBuffer;
|
||||
uint32_t nOldFloatMask = 0;
|
||||
uint32_t nFloatMask = tFloatingFirstChar[(int)*s];
|
||||
uint32_t nFloatMask = tFloatingFirstChar[(int32_t)*s];
|
||||
|
||||
if (nFloatMask != 0) {
|
||||
s++;
|
||||
nOldFloatMask = nFloatMask;
|
||||
nFloatMask &= tFloatingSecondChar[(int)*s];
|
||||
nFloatMask &= tFloatingSecondChar[(int32_t)*s];
|
||||
|
||||
while (nFloatMask != 0) {
|
||||
s++;
|
||||
nOldFloatMask = nFloatMask;
|
||||
nFloatMask &= tFloatingChars[(int)*s];
|
||||
nFloatMask &= tFloatingChars[(int32_t)*s];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ CopyMacroArg(char *dest, size_t maxLength, char c)
|
||||
{
|
||||
size_t i;
|
||||
char *s;
|
||||
int argNum;
|
||||
int32_t argNum;
|
||||
|
||||
switch (c) {
|
||||
case '1':
|
||||
@@ -498,9 +498,9 @@ yylex_SymbolWriteChar(char *s, size_t index, char c)
|
||||
*/
|
||||
void yylex_TrimEnd(char *s, size_t index)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = (int)index - 1; i >= 0 && (s[i] == ' ' || s[i] == '\t'); i--)
|
||||
for (i = (int32_t)index - 1; i >= 0 && (s[i] == ' ' || s[i] == '\t'); i--)
|
||||
s[i] = 0;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ scanagain:
|
||||
struct sLexFloat *token = lexgetfloat(nFloatMask);
|
||||
|
||||
if (token->Callback) {
|
||||
int done = token->Callback(pLexBuffer, nFloatLen);
|
||||
int32_t done = token->Callback(pLexBuffer, nFloatLen);
|
||||
if (!done)
|
||||
goto scanagain;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
int yyparse(void);
|
||||
void setuplex(void);
|
||||
|
||||
int cldefines_index;
|
||||
int cldefines_size;
|
||||
int32_t cldefines_index;
|
||||
int32_t cldefines_size;
|
||||
char **cldefines;
|
||||
|
||||
clock_t nStartClock, nEndClock;
|
||||
@@ -140,7 +140,7 @@ opt_Parse(char *s)
|
||||
break;
|
||||
case 'z':
|
||||
if (strlen(&s[1]) <= 2) {
|
||||
int result;
|
||||
int32_t result;
|
||||
|
||||
result = sscanf(&s[1], "%x", &newopt.fillchar);
|
||||
if (!((result == EOF) || (result == 1))) {
|
||||
@@ -217,7 +217,7 @@ opt_AddDefine(char *s)
|
||||
void
|
||||
opt_ParseDefines()
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for(i = 0; i < cldefines_index; i += 2)
|
||||
{
|
||||
|
||||
@@ -331,7 +331,7 @@ addsymbol(struct sSymbol * pSym)
|
||||
void
|
||||
addexports(void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < HASHSIZE; i += 1) {
|
||||
struct sSymbol *pSym;
|
||||
@@ -667,7 +667,7 @@ out_NewAlignedSection(char *pzName, uint32_t secttype, int32_t alignment, int32_
|
||||
* Output an absolute byte (bypassing ROM/union checks)
|
||||
*/
|
||||
void
|
||||
out_AbsByteBypassCheck(int b)
|
||||
out_AbsByteBypassCheck(int32_t b)
|
||||
{
|
||||
checksectionoverflow(1);
|
||||
b &= 0xFF;
|
||||
@@ -683,14 +683,14 @@ out_AbsByteBypassCheck(int b)
|
||||
* Output an absolute byte
|
||||
*/
|
||||
void
|
||||
out_AbsByte(int b)
|
||||
out_AbsByte(int32_t b)
|
||||
{
|
||||
checkcodesection();
|
||||
out_AbsByteBypassCheck(b);
|
||||
}
|
||||
|
||||
void
|
||||
out_AbsByteGroup(char *s, int length)
|
||||
out_AbsByteGroup(char *s, int32_t length)
|
||||
{
|
||||
checkcodesection();
|
||||
checksectionoverflow(length);
|
||||
@@ -702,7 +702,7 @@ out_AbsByteGroup(char *s, int length)
|
||||
* Skip this many bytes
|
||||
*/
|
||||
void
|
||||
out_Skip(int skip)
|
||||
out_Skip(int32_t skip)
|
||||
{
|
||||
checksection();
|
||||
checksectionoverflow(skip);
|
||||
@@ -761,7 +761,7 @@ out_RelByte(struct Expression * expr)
|
||||
* Output an absolute word
|
||||
*/
|
||||
void
|
||||
out_AbsWord(int b)
|
||||
out_AbsWord(int32_t b)
|
||||
{
|
||||
checkcodesection();
|
||||
checksectionoverflow(2);
|
||||
|
||||
@@ -653,7 +653,7 @@ sym_AddReloc(char *tzSym)
|
||||
}
|
||||
|
||||
struct sSymbol *parent = pScope->pScope ? pScope->pScope : pScope;
|
||||
int parentLen = localPtr - tzSym;
|
||||
int32_t parentLen = localPtr - tzSym;
|
||||
|
||||
if (strchr(localPtr + 1, '.') != NULL) {
|
||||
fatalerror("'%s' is a nonsensical reference to a nested local symbol", tzSym);
|
||||
@@ -695,7 +695,7 @@ sym_AddReloc(char *tzSym)
|
||||
*
|
||||
* It returns 1 if the difference is defined, 0 if not.
|
||||
*/
|
||||
int
|
||||
int32_t
|
||||
sym_IsRelocDiffDefined(char *tzSym1, char *tzSym2)
|
||||
{
|
||||
/* Do nothing the first pass. */
|
||||
@@ -710,8 +710,8 @@ sym_IsRelocDiffDefined(char *tzSym1, char *tzSym2)
|
||||
if ((nsym2 = sym_FindSymbol(tzSym2)) == NULL)
|
||||
fatalerror("Symbol \"%s\" isn't defined.", tzSym2);
|
||||
|
||||
int s1reloc = (nsym1->nType & SYMF_RELOC) != 0;
|
||||
int s2reloc = (nsym2->nType & SYMF_RELOC) != 0;
|
||||
int32_t s1reloc = (nsym1->nType & SYMF_RELOC) != 0;
|
||||
int32_t s2reloc = (nsym2->nType & SYMF_RELOC) != 0;
|
||||
|
||||
/* Both are non-relocatable */
|
||||
if (!s1reloc && !s2reloc) return 1;
|
||||
|
||||
Reference in New Issue
Block a user