mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Changed the ROMFS terminator char
The ROMFS termination char is now 0xFF instead of 0x00 (in preparation of WOFS).
This commit is contained in:
parent
ed54aec47a
commit
01a8dcd9a5
4
mkfs.py
4
mkfs.py
@ -133,8 +133,8 @@ def mkfs( dirname, outname, flist, mode, compcmd ):
|
||||
# Report
|
||||
print "Encoded file %s (%d bytes real size, %d bytes after rounding, %d bytes total)" % ( fname, len( filedata ), actual, _fcnt )
|
||||
|
||||
# All done, write the final "0" (terminator)
|
||||
_add_data( 0, outfile, False )
|
||||
# All done, write the final "0xFF" (terminator)
|
||||
_add_data( 0xFF, outfile, False )
|
||||
outfile.write( "};\n\n#endif\n" );
|
||||
outfile.close()
|
||||
print "Done, total size is %d bytes" % _bytecnt
|
||||
|
11
src/romfs.c
11
src/romfs.c
@ -48,17 +48,14 @@ static u8 romfs_open_file( const char* fname, u8 *pbase, FD* pfd )
|
||||
i = 0;
|
||||
while( 1 )
|
||||
{
|
||||
if( pbase[ i ] == 0xFF )
|
||||
return FS_FILE_NOT_FOUND;
|
||||
// Read file name
|
||||
for( j = 0; j < DM_MAX_FNAME_LENGTH; j ++ )
|
||||
{
|
||||
fsname[ j ] = pbase[ i + j ];
|
||||
if( fsname[ j ] == 0 )
|
||||
{
|
||||
if( j == 0 )
|
||||
return FS_FILE_NOT_FOUND;
|
||||
else
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// ' i + j' now points at the '0' byte
|
||||
j = i + j + 1;
|
||||
@ -182,7 +179,7 @@ static struct dm_dirent* romfs_readdir_r( struct _reent *r, void *d, void *pdata
|
||||
FSDATA *pfsdata = ( FSDATA* )pdata;
|
||||
u8 *pbase = pfsdata->pbase;
|
||||
|
||||
if( pbase[ off ] == 0 )
|
||||
if( pbase[ off ] == 0xFF )
|
||||
return NULL;
|
||||
while( ( dm_shared_fname[ j ++ ] = pbase[ off ++ ] ) != '\0' );
|
||||
pent->fname = dm_shared_fname;
|
||||
|
@ -143,8 +143,8 @@ function mkfs( dirname, outname, flist, mode, compcmd )
|
||||
end
|
||||
end
|
||||
|
||||
-- All done, write the final "0" (terminator)
|
||||
_add_data( 0, outfile, false )
|
||||
-- All done, write the final "0xFF" (terminator)
|
||||
_add_data( 0xFF, outfile, false )
|
||||
outfile:write( "};\n\n#endif\n" );
|
||||
outfile:close()
|
||||
print( sf( "Done, total size is %d bytes", _bytecnt ) )
|
||||
|
Loading…
x
Reference in New Issue
Block a user