From 49295627b371a3479ded25c6bf32ad139652ecfd Mon Sep 17 00:00:00 2001 From: arr Date: Tue, 1 May 2018 22:39:55 -0700 Subject: [PATCH] Review feedback on types Removed some tabs --- csrc/pf_inner.c | 8 ++++---- csrc/pf_save.c | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/csrc/pf_inner.c b/csrc/pf_inner.c index 10041ba..57559bd 100644 --- a/csrc/pf_inner.c +++ b/csrc/pf_inner.c @@ -197,8 +197,8 @@ static void TraceNames( ExecToken Token, cell_t Level ) static uint64_t UdToUint64( ucell_t Lo, ucell_t Hi ) { return (( 2 * sizeof(ucell_t) == sizeof(uint64_t) ) - ? (((uint64_t)Lo) | (((uint64_t)Hi) >> (sizeof(ucell_t) * 8))) - : Lo ); + ? (((uint64_t)Lo) | (((uint64_t)Hi) >> (sizeof(ucell_t) * 8))) + : Lo); } /* Return TRUE if the unsigned double cell integer LO/HI is not greater @@ -207,8 +207,8 @@ static uint64_t UdToUint64( ucell_t Lo, ucell_t Hi ) static int UdIsUint64( ucell_t Lo, ucell_t Hi ) { return (( 2 * sizeof(ucell_t) == sizeof(uint64_t) ) - ? TRUE - : Hi == 0 ); + ? TRUE + : Hi == 0); } static const char *pfSelectFileModeCreate(cell_t fam ); diff --git a/csrc/pf_save.c b/csrc/pf_save.c index faa6d81..f72981e 100644 --- a/csrc/pf_save.c +++ b/csrc/pf_save.c @@ -315,7 +315,7 @@ cell_t ffSaveForth( const char *FileName, ExecToken EntryPoint, cell_t NameSize, /***************************************************************/ static int Write32ToFile( FileStream *fid, uint32_t Val ) { - size_t numw; + cell_t numw; uint8_t pad[4]; Write32BigEndian(pad,Val); @@ -332,8 +332,10 @@ static cell_t WriteChunkToFile( FileStream *fid, cell_t ID, char *Data, int32_t EvenNumW = EVENUP(NumBytes); - if( Write32ToFile( fid, ID ) < 0 ) goto error; - if( Write32ToFile( fid, EvenNumW ) < 0 ) goto error; + assert(ID <= UINT32_MAX); + if( Write32ToFile( fid, (uint32_t)ID ) < 0 ) goto error; + assert(EvenNumW <= UINT32_MAX); + if( Write32ToFile( fid, (uint32_t)EvenNumW ) < 0 ) goto error; numw = sdWriteFile( Data, 1, EvenNumW, fid ); if( numw != EvenNumW ) goto error; @@ -515,7 +517,7 @@ error: /***************************************************************/ static int32_t Read32FromFile( FileStream *fid, uint32_t *ValPtr ) { - size_t numr; + cell_t numr; uint8_t pad[4]; numr = sdReadFile( pad, 1, sizeof(pad), fid ); if( numr != sizeof(pad) ) return -1; @@ -533,7 +535,7 @@ PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPt uint32_t ChunkSize; uint32_t FormSize; uint32_t BytesLeft; - size_t numr; + cell_t numr; int isDicBigEndian; DBUG(("pfLoadDictionary( %s )\n", FileName )); -- 2.20.1