mirror of
https://github.com/Michaelangel007/apple2_prodos_utils.git
synced 2025-08-05 14:24:11 +00:00
Cleanup size_t warnings
This commit is contained in:
@@ -115,18 +115,19 @@
|
||||
|
||||
// --- Size ---
|
||||
|
||||
size_t File_Size( FILE *pFile )
|
||||
int File_Size( FILE *pFile )
|
||||
{
|
||||
fseek( pFile, 0L, SEEK_END );
|
||||
size_t size = ftell( pFile );
|
||||
fseek( pFile, 0L, SEEK_SET );
|
||||
|
||||
return size;
|
||||
return (int)size;
|
||||
}
|
||||
|
||||
int DSK_GetNumTracks()
|
||||
{
|
||||
return gnDskSize / (16 * DSK_SECTOR_SIZE);
|
||||
size_t tracks = gnDskSize / (16 * DSK_SECTOR_SIZE);
|
||||
return (int)tracks;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +210,7 @@ bool DskLoad( const char *dsk_filename, SectorOrder_e sector_order )
|
||||
else
|
||||
if( giInterleaveLastUsed == INTERLEAVE_DOS33_ORDER )
|
||||
{
|
||||
int nTracks = DSK_GetNumTracks();
|
||||
size_t nTracks = DSK_GetNumTracks();
|
||||
size_t offset = 0;
|
||||
|
||||
#if DEBUG_DSK_LOAD
|
||||
@@ -228,7 +229,7 @@ bool DskLoad( const char *dsk_filename, SectorOrder_e sector_order )
|
||||
if( iTracks == 0 )
|
||||
printf( "T0S%X -> %06X\n", iSector, src );
|
||||
#endif
|
||||
fseek( pFile, offset + src, SEEK_SET );
|
||||
fseek( pFile, (long)(offset + src), SEEK_SET );
|
||||
fread( &gaDsk[ offset + dst ], 1, DSK_SECTOR_SIZE, pFile );
|
||||
}
|
||||
|
||||
@@ -263,7 +264,7 @@ bool DskSave()
|
||||
|
||||
if( giInterleaveLastUsed == INTERLEAVE_PRODOS_ORDER )
|
||||
{
|
||||
int wrote = fwrite( gaDsk, 1, gnDskSize, pFile );
|
||||
size_t wrote = fwrite( gaDsk, 1, gnDskSize, pFile );
|
||||
(void) wrote;
|
||||
#if DEBUG_DSK_SAVE
|
||||
printf( "DskSave() wrote .po: %d\n", wrote );
|
||||
@@ -294,7 +295,7 @@ bool DskSave()
|
||||
printf( "%06X -> T0S%X\n", dst, iSector );
|
||||
#endif
|
||||
|
||||
fseek( pFile, offset + dst, SEEK_SET );
|
||||
fseek( pFile, (long)(offset + dst), SEEK_SET );
|
||||
fwrite( &gaDsk[ offset + src ], 1, DSK_SECTOR_SIZE, pFile );
|
||||
}
|
||||
|
||||
|
10
prodos.cpp
10
prodos.cpp
@@ -427,25 +427,23 @@ printf( "ERROR: Create Time not yet implemented\n" );
|
||||
bool doCopy( ProDOS_FileHeader_t *entry, const char *filename )
|
||||
{
|
||||
const char *pSrcFileName = filename;
|
||||
size_t nSrcLen = strlen( pSrcFileName );
|
||||
|
||||
int nSrcLen = (int) strlen( pSrcFileName );
|
||||
char *pExt = const_cast<char*>( file_GetExtension( pSrcFileName ) );
|
||||
char sExt[ 5 ] = ".???";
|
||||
size_t nExtLen = 0;
|
||||
int nExtLen = 0;
|
||||
bool bCopiedName = false;
|
||||
|
||||
|
||||
// Chop extension down to leading '.' plus max 3 chars
|
||||
if( pExt )
|
||||
{
|
||||
size_t nLen = string_CopyUpper( sExt, pExt, 4 ); // 3 char extension
|
||||
int nLen = string_CopyUpper( sExt, pExt, 4 ); // 3 char extension
|
||||
|
||||
pExt = sExt;
|
||||
nExtLen = nLen;
|
||||
}
|
||||
|
||||
const char *pBaseName = filename + nSrcLen;
|
||||
size_t nBaseLen = 0;
|
||||
int nBaseLen = 0;
|
||||
|
||||
// Chop off preceeding directory if there is one
|
||||
if( pBaseName )
|
||||
|
@@ -490,7 +490,7 @@ int prodos_FindFile( ProDOS_VolumeHeader_t *volume, const char *path, int base =
|
||||
if( !path )
|
||||
return base;
|
||||
|
||||
size_t nPathLen = strlen( path );
|
||||
int nPathLen = (int) strlen( path );
|
||||
if( nPathLen == 0 )
|
||||
return base;
|
||||
|
||||
@@ -505,7 +505,7 @@ int prodos_FindFile( ProDOS_VolumeHeader_t *volume, const char *path, int base =
|
||||
// Get path head
|
||||
int iDirName = nPathLen;
|
||||
char sDirName[16];
|
||||
size_t i;
|
||||
int i;
|
||||
|
||||
// Split path
|
||||
for( i = 0; i < nPathLen; i++ )
|
||||
@@ -680,7 +680,7 @@ void prodos_MetaGetFileName( ProDOS_FileHeader_t *pEntry, char sAttrib[ PRODOS_M
|
||||
|
||||
// Attribute meta-data
|
||||
const char sExt[] = "._META";
|
||||
const size_t nExt = strlen( sExt );
|
||||
const int nExt = (int) strlen( sExt );
|
||||
int nAttrib = string_CopyUpper( sAttrib + 0, pEntry->name, pEntry->len );
|
||||
/* */ string_CopyUpper( sAttrib + nAttrib, sExt , nExt );
|
||||
}
|
||||
@@ -1198,15 +1198,15 @@ bool ProDOS_FileAdd( const char *to_path, const char *from_filename, ProDOS_File
|
||||
|
||||
// Block Management
|
||||
|
||||
size_t nSrcSize = File_Size( pSrcFile );
|
||||
int nBlocksData = (nSrcSize + PRODOS_BLOCK_SIZE - 1) / PRODOS_BLOCK_SIZE;
|
||||
int nBlocksIndex = 0; // Num Blocks needed for meta (Index)
|
||||
int nBlocksTotal = 0;
|
||||
int nBlocksFree = 0;
|
||||
int nSrcSize = File_Size( pSrcFile );
|
||||
int nBlocksData = (nSrcSize + PRODOS_BLOCK_SIZE - 1) / PRODOS_BLOCK_SIZE;
|
||||
int nBlocksIndex = 0; // Num Blocks needed for meta (Index)
|
||||
int nBlocksTotal = 0;
|
||||
int nBlocksFree = 0;
|
||||
|
||||
int iNode = 0; // Master Index, Single Index, or 0 if none
|
||||
int iIndexBase = 0; // Single Index
|
||||
int iMasterIndex = 0; // master block points to N IndexBlocks
|
||||
int iNode = 0; // Master Index, Single Index, or 0 if none
|
||||
int iIndexBase = 0; // Single Index
|
||||
int iMasterIndex = 0; // master block points to N IndexBlocks
|
||||
|
||||
#if DEBUG_ATTRIB
|
||||
printf( "Source File Size: %06X (%d)\n", nSrcSize, nSrcSize );
|
||||
|
@@ -3,10 +3,10 @@
|
||||
// @param nLen - copy up to N chars. If zero will calculate source string length
|
||||
// @return Length of string not including NULL terminator
|
||||
// ========================================================================
|
||||
size_t string_CopyUpper( char *pDst, const char *pSrc, int nLen = 0 )
|
||||
int string_CopyUpper( char *pDst, const char *pSrc, int nLen = 0 )
|
||||
{
|
||||
if( !nLen )
|
||||
nLen = strlen( pSrc );
|
||||
nLen = (int) strlen( pSrc );
|
||||
|
||||
char *pBeg = pDst;
|
||||
|
||||
@@ -20,12 +20,12 @@ size_t string_CopyUpper( char *pDst, const char *pSrc, int nLen = 0 )
|
||||
if((c >= 'a') && (c <= 'z' ))
|
||||
c -= ('a' - 'A');
|
||||
|
||||
*pDst++ = c;
|
||||
*pDst++ = c;
|
||||
}
|
||||
|
||||
*pDst = 0;
|
||||
|
||||
return (pDst - pBeg);
|
||||
return (int)(pDst - pBeg);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user