Replace 8 and 16 bit custom types by stdint.h types

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2017-12-31 13:46:52 +01:00
parent c24cab6d1d
commit 13c0684497
20 changed files with 75 additions and 59 deletions

View File

@@ -1,6 +1,7 @@
%{
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -103,7 +104,7 @@ ULONG str2int( char *s )
while( *s )
{
r<<=8;
r|=(UBYTE)(*s++);
r|=(uint8_t)(*s++);
}
return( r );
}
@@ -116,7 +117,7 @@ ULONG str2int2( char *s, int length )
while(i < length)
{
r<<=8;
r|=(UBYTE)(s[i]);
r|=(uint8_t)(s[i]);
i++;
}
return( r );

View File

@@ -105,7 +105,7 @@ readUTF8Char(char *dest, char *src)
}
int
charmap_Add(char *input, UBYTE output)
charmap_Add(char *input, uint8_t output)
{
int i;
size_t input_length;

View File

@@ -4,6 +4,7 @@
#include <errno.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -331,7 +332,7 @@ fstk_RunMacroArg(SLONG s)
if ((sym = sym_FindMacroArg(s)) != NULL) {
pushcontext();
nCurrentStatus = STAT_isMacroArg;
sprintf(tzCurrentFileName, "%c", (UBYTE) s);
sprintf(tzCurrentFileName, "%c", (uint8_t) s);
CurrentFlexHandle = yy_scan_bytes(sym, strlen(sym));
yy_switch_to_buffer(CurrentFlexHandle);
} else

View File

@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
@@ -152,7 +153,7 @@ yy_create_buffer(FILE * f)
pBuffer->pBufferStart = pBuffer->pBufferRealStart + SAFETYMARGIN;
pBuffer->pBuffer = pBuffer->pBufferRealStart + SAFETYMARGIN;
size = fread(pBuffer->pBuffer, sizeof(UBYTE), size, f);
size = fread(pBuffer->pBuffer, sizeof(uint8_t), size, f);
pBuffer->pBuffer[size] = '\n';
pBuffer->pBuffer[size + 1] = 0;
@@ -211,7 +212,7 @@ lex_FloatAlloc(struct sLexFloat *token)
* start is greater than the end of the range.
*/
void
lex_CheckCharacterRange(UWORD start, UWORD end)
lex_CheckCharacterRange(uint16_t start, uint16_t end)
{
if (start > end || start < 1 || end > 127) {
errx(1, "Invalid character range (start: %u, end: %u)",
@@ -220,7 +221,7 @@ lex_CheckCharacterRange(UWORD start, UWORD end)
}
void
lex_FloatDeleteRange(ULONG id, UWORD start, UWORD end)
lex_FloatDeleteRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);
@@ -231,7 +232,7 @@ lex_FloatDeleteRange(ULONG id, UWORD start, UWORD end)
}
void
lex_FloatAddRange(ULONG id, UWORD start, UWORD end)
lex_FloatAddRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);
@@ -242,7 +243,7 @@ lex_FloatAddRange(ULONG id, UWORD start, UWORD end)
}
void
lex_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end)
lex_FloatDeleteFirstRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);
@@ -253,7 +254,7 @@ lex_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end)
}
void
lex_FloatAddFirstRange(ULONG id, UWORD start, UWORD end)
lex_FloatAddFirstRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);
@@ -264,7 +265,7 @@ lex_FloatAddFirstRange(ULONG id, UWORD start, UWORD end)
}
void
lex_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end)
lex_FloatDeleteSecondRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);
@@ -275,7 +276,7 @@ lex_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end)
}
void
lex_FloatAddSecondRange(ULONG id, UWORD start, UWORD end)
lex_FloatAddSecondRange(ULONG id, uint16_t start, uint16_t end)
{
lex_CheckCharacterRange(start, end);

View File

@@ -4,6 +4,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -24,9 +25,9 @@ struct Patch {
char tzFilename[_MAX_PATH + 1];
ULONG nLine;
ULONG nOffset;
UBYTE nType;
uint8_t nType;
ULONG nRPNSize;
UBYTE *pRPN;
uint8_t *pRPN;
struct Patch *pNext;
};
@@ -371,8 +372,8 @@ void
createpatch(ULONG type, struct Expression * expr)
{
struct Patch *pPatch;
UWORD rpndata;
UBYTE rpnexpr[2048];
uint16_t rpndata;
uint8_t rpnexpr[2048];
char tzSym[512];
ULONG rpnptr = 0, symptr;

View File

@@ -2,6 +2,7 @@
* Controls RPN expressions for objectfiles
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -46,7 +47,7 @@ rpn_Reset(struct Expression * expr)
/*
* Returns the next rpn byte in expression
*/
UWORD
uint16_t
rpn_PopByte(struct Expression * expr)
{
if (expr->nRPNOut == expr->nRPNLength) {

View File

@@ -3,6 +3,7 @@
*/
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -814,7 +815,7 @@ sym_AddMacro(char *tzSym)
/*
* Set whether to export all relocable symbols by default
*/
void sym_SetExportAll(BBOOL set) {
void sym_SetExportAll(uint8_t set) {
exportall = set;
}