mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
TRUE/FALSE in tools section (nw)
This commit is contained in:
parent
d01dd9360f
commit
864360160b
@ -78,7 +78,7 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens,
|
||||
uint16_t line_number; //, address;
|
||||
uint8_t b, shift;
|
||||
int i;
|
||||
int in_string = FALSE;
|
||||
int in_string = false;
|
||||
const basictoken_tableent *token_table;
|
||||
const char *token;
|
||||
|
||||
@ -122,7 +122,7 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens,
|
||||
while((mem_stream->read(&b, 1) > 0) && (b != 0x00))
|
||||
{
|
||||
if (b == 0x22)
|
||||
in_string = in_string ? FALSE : TRUE;
|
||||
in_string = in_string ? false : true;
|
||||
|
||||
if ((b & 0x80) && (!in_string))
|
||||
{
|
||||
@ -180,7 +180,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens,
|
||||
imgtoolerr_t err;
|
||||
imgtool::stream *mem_stream;
|
||||
char buf[1024];
|
||||
int eof = FALSE;
|
||||
int eof = false;
|
||||
uint32_t len;
|
||||
char c;
|
||||
int i, j, pos, in_quotes;
|
||||
@ -267,7 +267,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens,
|
||||
pos++;
|
||||
|
||||
/* when we start out, we are not within quotation marks */
|
||||
in_quotes = FALSE;
|
||||
in_quotes = false;
|
||||
|
||||
/* read until end of line */
|
||||
while(buf[pos] != '\0')
|
||||
@ -2953,7 +2953,7 @@ static const basictokens cocobas_tokens =
|
||||
{
|
||||
0x2600,
|
||||
3,
|
||||
TRUE,
|
||||
true,
|
||||
cocobas_tokenents,
|
||||
ARRAY_LENGTH(cocobas_tokenents)
|
||||
};
|
||||
@ -2997,7 +2997,7 @@ static const basictokens dragonbas_tokens =
|
||||
{
|
||||
0x2600,
|
||||
4,
|
||||
TRUE,
|
||||
true,
|
||||
dragonbas_tokenents,
|
||||
ARRAY_LENGTH(dragonbas_tokenents)
|
||||
};
|
||||
@ -3042,7 +3042,7 @@ static const basictokens vzbas_tokens =
|
||||
{
|
||||
0x7ae9,
|
||||
0,
|
||||
FALSE,
|
||||
false,
|
||||
vzbas_tokenents,
|
||||
ARRAY_LENGTH(vzbas_tokenents)
|
||||
};
|
||||
@ -3086,7 +3086,7 @@ static const basictokens bml3bas_tokens =
|
||||
{
|
||||
0x2600,
|
||||
3,
|
||||
TRUE,
|
||||
true,
|
||||
bml3bas_tokenents,
|
||||
ARRAY_LENGTH(bml3bas_tokenents)
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ static imgtoolerr_t convert_stream_eolns(imgtool::stream &source, imgtool::strea
|
||||
{
|
||||
size_t len, i, pos;
|
||||
char buffer[2000];
|
||||
int hit_cr = FALSE;
|
||||
int hit_cr = false;
|
||||
|
||||
while((len = source.read(buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
|
@ -744,7 +744,7 @@ static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, in
|
||||
goto done;
|
||||
}
|
||||
|
||||
err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL);
|
||||
err = floppy_load_track(floppy, head, track, true, &track_data_v, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
track_data = (uint8_t *) track_data_v;
|
||||
@ -961,7 +961,7 @@ static floperr_t coco_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int
|
||||
|
||||
static floperr_t coco_dmk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
|
||||
{
|
||||
return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length);
|
||||
return coco_dmk_seek_sector_in_track(floppy, head, track, sector, false, false, NULL, sector_length);
|
||||
}
|
||||
|
||||
|
||||
@ -976,7 +976,7 @@ static floperr_t coco_dmk_get_indexed_sector_info(floppy_image_legacy *floppy, i
|
||||
if (sector_index*2 >= DMK_TOC_LEN)
|
||||
return FLOPPY_ERROR_SEEKERROR;
|
||||
|
||||
err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL);
|
||||
err = floppy_load_track(floppy, head, track, false, &track_data_v, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
track_data = (uint8_t *) track_data_v;
|
||||
@ -1013,7 +1013,7 @@ static floperr_t internal_coco_dmk_read_sector(floppy_image_legacy *floppy, int
|
||||
uint16_t calculated_crc;
|
||||
uint8_t *sector_data;
|
||||
|
||||
err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length);
|
||||
err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, false, §or_data, §or_length);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -1039,7 +1039,7 @@ static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int
|
||||
uint8_t *sector_data;
|
||||
uint16_t crc;
|
||||
|
||||
err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length);
|
||||
err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, true, §or_data, §or_length);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -1058,22 +1058,22 @@ static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int
|
||||
|
||||
static floperr_t coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
|
||||
{
|
||||
return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen);
|
||||
return internal_coco_dmk_read_sector(floppy, head, track, sector, false, buffer, buflen);
|
||||
}
|
||||
|
||||
static floperr_t coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
|
||||
{
|
||||
return internal_coco_dmk_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam);
|
||||
return internal_coco_dmk_write_sector(floppy, head, track, sector, false, buffer, buflen, ddam);
|
||||
}
|
||||
|
||||
static floperr_t coco_dmk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
|
||||
{
|
||||
return internal_coco_dmk_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
|
||||
return internal_coco_dmk_read_sector(floppy, head, track, sector, true, buffer, buflen);
|
||||
}
|
||||
|
||||
static floperr_t coco_dmk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
|
||||
{
|
||||
return internal_coco_dmk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
|
||||
return internal_coco_dmk_write_sector(floppy, head, track, sector, true, buffer, buflen, ddam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,7 +147,7 @@ done:
|
||||
|
||||
static imgtoolerr_t imgtool_floppy_open(imgtool::image &image, imgtool::stream::ptr &&stream)
|
||||
{
|
||||
return imgtool_floppy_open_internal(image, std::move(stream), FALSE);
|
||||
return imgtool_floppy_open_internal(image, std::move(stream), false);
|
||||
}
|
||||
|
||||
|
||||
@ -301,12 +301,12 @@ int imgtool_floppy_make_class(int index, imgtool_class *imgclass)
|
||||
imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_FORMAT);
|
||||
assert(format);
|
||||
if (!format[index].construct)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
imgclass->derived_get_info = imgclass->get_info;
|
||||
imgclass->get_info = imgtool_floppy_get_info;
|
||||
imgclass->derived_param = (void *) &format[index];
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -777,12 +777,12 @@ int imgtool_validitychecks(void)
|
||||
int error = 0;
|
||||
imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS;
|
||||
imgtool_module_features features;
|
||||
int created_library = FALSE;
|
||||
int created_library = false;
|
||||
|
||||
if (!global_imgtool_library)
|
||||
{
|
||||
imgtool_init(FALSE, nullptr);
|
||||
created_library = TRUE;
|
||||
imgtool_init(false, nullptr);
|
||||
created_library = true;
|
||||
}
|
||||
|
||||
for (const auto &module : global_imgtool_library->modules())
|
||||
@ -1160,19 +1160,19 @@ imgtoolerr_t imgtool::partition::cannonicalize_path(uint32_t flags, const char *
|
||||
}
|
||||
|
||||
/* copy the path */
|
||||
in_path_separator = TRUE;
|
||||
in_path_separator = true;
|
||||
i = j = 0;
|
||||
do
|
||||
{
|
||||
if ((s[i] != '\0') && (s[i] != path_separator) && (s[i] != alt_path_separator))
|
||||
{
|
||||
new_path[j++] = s[i];
|
||||
in_path_separator = FALSE;
|
||||
in_path_separator = false;
|
||||
}
|
||||
else if (!in_path_separator)
|
||||
{
|
||||
new_path[j++] = '\0';
|
||||
in_path_separator = TRUE;
|
||||
in_path_separator = true;
|
||||
}
|
||||
}
|
||||
while(s[i++] != '\0');
|
||||
@ -1608,7 +1608,7 @@ imgtoolerr_t imgtool::partition::get_chain_string(const char *path, char *buffer
|
||||
uint64_t last_block;
|
||||
uint8_t cur_level = 0;
|
||||
int len, i;
|
||||
int comma_needed = FALSE;
|
||||
int comma_needed = false;
|
||||
|
||||
// determine the last block identifier
|
||||
chain[0].block = ~0;
|
||||
@ -1630,7 +1630,7 @@ imgtoolerr_t imgtool::partition::get_chain_string(const char *path, char *buffer
|
||||
buffer += len;
|
||||
buffer_len -= len;
|
||||
cur_level++;
|
||||
comma_needed = FALSE;
|
||||
comma_needed = false;
|
||||
}
|
||||
while(cur_level > chain[i].level)
|
||||
{
|
||||
@ -1650,7 +1650,7 @@ imgtoolerr_t imgtool::partition::get_chain_string(const char *path, char *buffer
|
||||
len = snprintf(buffer, buffer_len, "%u", (unsigned) chain[i].block);
|
||||
buffer += len;
|
||||
buffer_len -= len;
|
||||
comma_needed = TRUE;
|
||||
comma_needed = true;
|
||||
}
|
||||
|
||||
do
|
||||
|
@ -855,7 +855,7 @@ int CLIB_DECL main(int argc, char *argv[])
|
||||
goto cmderror;
|
||||
|
||||
/* initialize the imgtool core */
|
||||
imgtool_init(TRUE, nullptr);
|
||||
imgtool_init(true, nullptr);
|
||||
|
||||
if (c->lastargrepeats && (argc > c->maxargs))
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ static int hash_name(const char *name, int intl)
|
||||
}
|
||||
|
||||
|
||||
/* Returns TRUE if year is a leap year */
|
||||
/* Returns true if year is a leap year */
|
||||
static int is_leap(int year)
|
||||
{
|
||||
return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
|
||||
@ -818,18 +818,18 @@ static disk_type get_disk_type(imgtool::image &img)
|
||||
}
|
||||
|
||||
|
||||
/* Returns TRUE if the disk is formatted with the FastFileSystem */
|
||||
/* Returns true if the disk is formatted with the FastFileSystem */
|
||||
static int is_ffs(imgtool::image &img)
|
||||
{
|
||||
disk_type t = get_disk_type(img);
|
||||
|
||||
return ((t == DT_FFS ||
|
||||
t == DT_FFS_INTL ||
|
||||
t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
|
||||
t == DT_FFS_INTL_DIRC) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/* Returns TRUE if the disk uses the international mode */
|
||||
/* Returns true if the disk uses the international mode */
|
||||
static int is_intl(imgtool::image &img)
|
||||
{
|
||||
disk_type t = get_disk_type(img);
|
||||
@ -837,17 +837,17 @@ static int is_intl(imgtool::image &img)
|
||||
return ((t == DT_OFS_INTL ||
|
||||
t == DT_FFS_INTL ||
|
||||
t == DT_OFS_INTL_DIRC ||
|
||||
t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
|
||||
t == DT_FFS_INTL_DIRC) ? true : false);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/* Returns TRUE if the disk uses the directory cache mode */
|
||||
/* Returns true if the disk uses the directory cache mode */
|
||||
static int is_dirc(imgtool::image *img)
|
||||
{
|
||||
disk_type t = get_disk_type(img);
|
||||
|
||||
return ((t == DT_OFS_INTL_DIRC ||
|
||||
t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
|
||||
t == DT_FFS_INTL_DIRC) ? true : false);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1194,13 +1194,13 @@ static imgtoolerr_t fix_chksum(imgtool::image &img, int block, int bitmap)
|
||||
|
||||
static imgtoolerr_t fix_block_chksum(imgtool::image &img, int block)
|
||||
{
|
||||
return fix_chksum(img, block, FALSE);
|
||||
return fix_chksum(img, block, false);
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t fix_bitmap_chksum(imgtool::image &img, int block)
|
||||
{
|
||||
return fix_chksum(img, block, TRUE);
|
||||
return fix_chksum(img, block, true);
|
||||
}
|
||||
|
||||
|
||||
@ -1251,13 +1251,13 @@ static imgtoolerr_t bitmap_mark(imgtool::image &img, int block, int used)
|
||||
|
||||
static imgtoolerr_t bitmap_mark_used(imgtool::image &img, int block)
|
||||
{
|
||||
return bitmap_mark(img, block, TRUE);
|
||||
return bitmap_mark(img, block, true);
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t bitmap_mark_free(imgtool::image &img, int block)
|
||||
{
|
||||
return bitmap_mark(img, block, FALSE);
|
||||
return bitmap_mark(img, block, false);
|
||||
}
|
||||
|
||||
|
||||
@ -1600,7 +1600,7 @@ static imgtoolerr_t write_file_block_data(imgtool::image &img, int block, int si
|
||||
if (ret) return ret;
|
||||
|
||||
/* Verify data checksum */
|
||||
ret = get_block_chksum(img, block, &chksum, FALSE);
|
||||
ret = get_block_chksum(img, block, &chksum, false);
|
||||
if (ret) return ret;
|
||||
|
||||
if (db.chksum != chksum)
|
||||
@ -1707,13 +1707,13 @@ static imgtoolerr_t walk_file_ext_data(imgtool::image &img, int block, int *file
|
||||
|
||||
static imgtoolerr_t write_file_ext_data(imgtool::image &img, int block, int *filesize, imgtool::stream *destf)
|
||||
{
|
||||
return walk_file_ext_data(img, block, filesize, destf, TRUE);
|
||||
return walk_file_ext_data(img, block, filesize, destf, true);
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t clear_file_ext_data(imgtool::image &img, int block, int *filesize)
|
||||
{
|
||||
return walk_file_ext_data(img, block, filesize, NULL, FALSE);
|
||||
return walk_file_ext_data(img, block, filesize, NULL, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,22 +121,22 @@ static int page_buffer_verify( uint8_t *buffer, uint32_t size, int block_type)
|
||||
// checksum 1
|
||||
checksum_calc = page_buffer_calc_checksum_1( buffer, size, block_type);
|
||||
checksum_page = buffer_read_32_be( buffer + 0);
|
||||
if (checksum_calc != checksum_page) return FALSE;
|
||||
if (checksum_calc != checksum_page) return false;
|
||||
// checksum 2
|
||||
checksum_calc = page_buffer_calc_checksum_2( buffer);
|
||||
checksum_page = buffer_read_16_be( buffer + 6);
|
||||
if (checksum_calc != checksum_page) return FALSE;
|
||||
if (checksum_calc != checksum_page) return false;
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, uint32_t block, uint32_t *page)
|
||||
{
|
||||
switch (block_type)
|
||||
{
|
||||
case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE;
|
||||
case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE;
|
||||
default : return FALSE;
|
||||
case BLOCK_TYPE_BOOT : if (page) *page = block; return true;
|
||||
case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return true;
|
||||
default : return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ static int cfs_page_to_block( cybiko_file_system *cfs, uint32_t page, int *block
|
||||
{
|
||||
if (block_type) *block_type = BLOCK_TYPE_BOOT;
|
||||
if (block) *block = tmp;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
tmp -= cfs->block_count_boot;
|
||||
// file block
|
||||
@ -156,37 +156,37 @@ static int cfs_page_to_block( cybiko_file_system *cfs, uint32_t page, int *block
|
||||
{
|
||||
if (block_type) *block_type = BLOCK_TYPE_FILE;
|
||||
if (block) *block = tmp;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
tmp -= cfs->block_count_file;
|
||||
// error
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int cfs_page_read( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
|
||||
{
|
||||
if (page >= cfs->page_count) return FALSE;
|
||||
if (page >= cfs->page_count) return false;
|
||||
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
|
||||
cfs->stream->read(buffer, cfs->page_size);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_page_write( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
|
||||
{
|
||||
if (page >= cfs->page_count) return FALSE;
|
||||
if (page >= cfs->page_count) return false;
|
||||
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
|
||||
cfs->stream->write(buffer, cfs->page_size);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_read( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
|
||||
{
|
||||
uint8_t buffer_page[MAX_PAGE_SIZE];
|
||||
uint32_t page;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE;
|
||||
if (!cfs_page_read( cfs, buffer_page, page)) return FALSE;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
|
||||
if (!cfs_page_read( cfs, buffer_page, page)) return false;
|
||||
memcpy( buffer, buffer_page + 8, cfs->page_size - 10);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_write( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
|
||||
@ -198,9 +198,9 @@ static int cfs_block_write( cybiko_file_system *cfs, uint8_t *buffer, int block_
|
||||
buffer_write_16_be( buffer_page + 4, cfs->write_count++);
|
||||
buffer_write_16_be( buffer_page + 6, page_buffer_calc_checksum_2( buffer_page));
|
||||
buffer_write_16_be( buffer_page + cfs->page_size - 2, 0xFFFF);
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE;
|
||||
if (!cfs_page_write( cfs, buffer_page, page)) return FALSE;
|
||||
return TRUE;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
|
||||
if (!cfs_page_write( cfs, buffer_page, page)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_file_delete( cybiko_file_system *cfs, uint16_t file_id)
|
||||
@ -209,14 +209,14 @@ static int cfs_file_delete( cybiko_file_system *cfs, uint16_t file_id)
|
||||
int i;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
|
||||
{
|
||||
buffer[0] &= ~0x80;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *file)
|
||||
@ -226,7 +226,7 @@ static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *f
|
||||
file->blocks = file->size = 0;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
|
||||
{
|
||||
if (BLOCK_PART_ID(buffer) == 0)
|
||||
@ -238,7 +238,7 @@ static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *f
|
||||
file->blocks++;
|
||||
}
|
||||
}
|
||||
return (file->blocks > 0) ? TRUE : FALSE;
|
||||
return (file->blocks > 0) ? true : false;
|
||||
}
|
||||
|
||||
static int cfs_file_find( cybiko_file_system *cfs, const char *filename, uint16_t *file_id)
|
||||
@ -247,14 +247,14 @@ static int cfs_file_find( cybiko_file_system *cfs, const char *filename, uint16_
|
||||
int i;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (strncmp( filename, BLOCK_FILENAME(buffer), 40) == 0))
|
||||
{
|
||||
*file_id = i;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int cfs_verify(cybiko_file_system &cfs)
|
||||
@ -263,11 +263,11 @@ static int cfs_verify(cybiko_file_system &cfs)
|
||||
int i, block_type;
|
||||
for (i = 0; i < cfs.page_count; i++)
|
||||
{
|
||||
if (!cfs_page_read(&cfs, buffer, i)) return FALSE;
|
||||
if (!cfs_page_to_block(&cfs, i, &block_type, NULL)) return FALSE;
|
||||
if (!page_buffer_verify(buffer, cfs.page_size, block_type)) return FALSE;
|
||||
if (!cfs_page_read(&cfs, buffer, i)) return false;
|
||||
if (!cfs_page_to_block(&cfs, i, &block_type, NULL)) return false;
|
||||
if (!page_buffer_verify(buffer, cfs.page_size, block_type)) return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_init(cybiko_file_system &cfs, imgtool::stream::ptr &&stream, int flash_type)
|
||||
@ -278,12 +278,12 @@ static int cfs_init(cybiko_file_system &cfs, imgtool::stream::ptr &&stream, int
|
||||
case FLASH_TYPE_AT45DB041 : cfs.page_count = 2048; cfs.page_size = 264; break;
|
||||
case FLASH_TYPE_AT45DB081 : cfs.page_count = 4096; cfs.page_size = 264; break;
|
||||
case FLASH_TYPE_AT45DB161 : cfs.page_count = 4096; cfs.page_size = 528; break;
|
||||
default : return FALSE;
|
||||
default : return false;
|
||||
}
|
||||
cfs.block_count_boot = 5;
|
||||
cfs.block_count_file = cfs.page_count - cfs.block_count_boot;
|
||||
cfs.write_count = 0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_format( cybiko_file_system *cfs)
|
||||
@ -294,17 +294,17 @@ static int cfs_format( cybiko_file_system *cfs)
|
||||
memset( buffer, 0xFF, sizeof( buffer));
|
||||
for (i=0;i<cfs->block_count_boot;i++)
|
||||
{
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return false;
|
||||
}
|
||||
// file blocks
|
||||
memset( buffer, 0xFF, sizeof( buffer));
|
||||
buffer[0] &= ~0x80;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
}
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint16_t cfs_calc_free_blocks( cybiko_file_system *cfs)
|
||||
|
@ -113,19 +113,19 @@ static int page_buffer_verify( uint8_t *buffer, uint32_t size, int block_type)
|
||||
uint32_t checksum_page, checksum_calc;
|
||||
checksum_calc = page_buffer_calc_checksum( buffer + 2, size - 2);
|
||||
checksum_page = buffer_read_16_be( buffer + 0);
|
||||
if (checksum_calc != checksum_page) return FALSE;
|
||||
if (checksum_calc != checksum_page) return false;
|
||||
}
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, uint32_t block, uint32_t *page)
|
||||
{
|
||||
switch (block_type)
|
||||
{
|
||||
case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE;
|
||||
case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE;
|
||||
default : return FALSE;
|
||||
case BLOCK_TYPE_BOOT : if (page) *page = block; return true;
|
||||
case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return true;
|
||||
default : return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ static int cfs_page_to_block( cybiko_file_system *cfs, uint32_t page, int *block
|
||||
{
|
||||
if (block_type) *block_type = BLOCK_TYPE_BOOT;
|
||||
if (block) *block = tmp;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
tmp -= cfs->block_count_boot;
|
||||
// file block
|
||||
@ -145,37 +145,37 @@ static int cfs_page_to_block( cybiko_file_system *cfs, uint32_t page, int *block
|
||||
{
|
||||
if (block_type) *block_type = BLOCK_TYPE_FILE;
|
||||
if (block) *block = tmp;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
tmp -= cfs->block_count_file;
|
||||
// error
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int cfs_page_read( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
|
||||
{
|
||||
if (page >= cfs->page_count) return FALSE;
|
||||
if (page >= cfs->page_count) return false;
|
||||
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
|
||||
cfs->stream->read(buffer, cfs->page_size);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_page_write( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
|
||||
{
|
||||
if (page >= cfs->page_count) return FALSE;
|
||||
if (page >= cfs->page_count) return false;
|
||||
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
|
||||
cfs->stream->write(buffer, cfs->page_size);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_read( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
|
||||
{
|
||||
uint8_t buffer_page[MAX_PAGE_SIZE];
|
||||
uint32_t page;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE;
|
||||
if (!cfs_page_read( cfs, buffer_page, page)) return FALSE;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
|
||||
if (!cfs_page_read( cfs, buffer_page, page)) return false;
|
||||
memcpy( buffer, buffer_page + 2, cfs->page_size - 2);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_block_write( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
|
||||
@ -193,9 +193,9 @@ static int cfs_block_write( cybiko_file_system *cfs, uint8_t *buffer, int block_
|
||||
checksum = page_buffer_calc_checksum( buffer_page + 2, cfs->page_size - 2);
|
||||
}
|
||||
buffer_write_16_be( buffer_page + 0, checksum);
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE;
|
||||
if (!cfs_page_write( cfs, buffer_page, page)) return FALSE;
|
||||
return TRUE;
|
||||
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
|
||||
if (!cfs_page_write( cfs, buffer_page, page)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_file_delete( cybiko_file_system *cfs, uint16_t file_id)
|
||||
@ -204,14 +204,14 @@ static int cfs_file_delete( cybiko_file_system *cfs, uint16_t file_id)
|
||||
int i;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
|
||||
{
|
||||
buffer[0] &= ~0x80;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *file)
|
||||
@ -221,7 +221,7 @@ static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *f
|
||||
file->blocks = file->size = 0;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
|
||||
{
|
||||
if (BLOCK_PART_ID(buffer) == 0)
|
||||
@ -233,7 +233,7 @@ static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *f
|
||||
file->blocks++;
|
||||
}
|
||||
}
|
||||
return (file->blocks > 0) ? TRUE : FALSE;
|
||||
return (file->blocks > 0) ? true : false;
|
||||
}
|
||||
|
||||
static int cfs_file_find( cybiko_file_system *cfs, const char *filename, uint16_t *file_id)
|
||||
@ -242,14 +242,14 @@ static int cfs_file_find( cybiko_file_system *cfs, const char *filename, uint16_
|
||||
int i;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0) && (strcmp( filename, BLOCK_FILENAME(buffer)) == 0))
|
||||
{
|
||||
*file_id = i;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool cfs_verify(cybiko_file_system &cfs)
|
||||
@ -284,14 +284,14 @@ static int cfs_format(cybiko_file_system *cfs)
|
||||
memset( buffer, 0xFF, sizeof( buffer));
|
||||
for (i=0;i<cfs->block_count_boot;i++)
|
||||
{
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return false;
|
||||
}
|
||||
// file blocks
|
||||
memset( buffer, 0xFF, sizeof( buffer));
|
||||
buffer[0] &= ~0x80;
|
||||
for (i=0;i<cfs->block_count_file;i++)
|
||||
{
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE;
|
||||
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
|
||||
}
|
||||
// padding
|
||||
buffer[0] = 0xFF;
|
||||
@ -300,7 +300,7 @@ static int cfs_format(cybiko_file_system *cfs)
|
||||
cfs->stream->write(buffer, 1);
|
||||
}
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint16_t cfs_calc_free_blocks( cybiko_file_system *cfs)
|
||||
|
@ -381,7 +381,7 @@ static imgtoolerr_t fat_partition_open(imgtool::partition &partition, uint64_t f
|
||||
fat_partition_info *info;
|
||||
uint32_t fat_bits, total_sectors_l, total_sectors_h, sector_size;
|
||||
uint64_t available_sectors;
|
||||
//int has_extended_bios_param_block = TRUE;
|
||||
//int has_extended_bios_param_block = true;
|
||||
|
||||
info = fat_get_partition_info(partition);
|
||||
|
||||
@ -406,7 +406,7 @@ static imgtoolerr_t fat_partition_open(imgtool::partition &partition, uint64_t f
|
||||
else
|
||||
{
|
||||
fat_bits = 8;
|
||||
//has_extended_bios_param_block = FALSE;
|
||||
//has_extended_bios_param_block = false;
|
||||
}
|
||||
|
||||
info->fat_bits = fat_bits;
|
||||
@ -971,8 +971,8 @@ static imgtoolerr_t fat_set_file_size(imgtool::partition &partition, fat_file *f
|
||||
uint8_t dirent[32];
|
||||
size_t clear_size;
|
||||
void *clear_buffer = NULL;
|
||||
int delete_file = FALSE;
|
||||
int rest_free = FALSE;
|
||||
int delete_file = false;
|
||||
int rest_free = false;
|
||||
|
||||
disk_info = fat_get_partition_info(partition);
|
||||
|
||||
@ -981,7 +981,7 @@ static imgtoolerr_t fat_set_file_size(imgtool::partition &partition, fat_file *f
|
||||
/* special case */
|
||||
if (new_size == ~0)
|
||||
{
|
||||
delete_file = TRUE;
|
||||
delete_file = true;
|
||||
new_size = 0;
|
||||
}
|
||||
|
||||
@ -1070,7 +1070,7 @@ static imgtoolerr_t fat_set_file_size(imgtool::partition &partition, fat_file *f
|
||||
|
||||
/* did we write the last cluster? if so, the rest (if any) are free */
|
||||
if (write_cluster == 0xFFFFFFFF)
|
||||
rest_free = TRUE;
|
||||
rest_free = true;
|
||||
}
|
||||
}
|
||||
while((++i < new_cluster_count) || (cluster != 0xFFFFFFFF));
|
||||
@ -1735,7 +1735,7 @@ static imgtoolerr_t fat_lookup_path(imgtool::partition &partition, const char *p
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
bumped_sfn = FALSE;
|
||||
bumped_sfn = false;
|
||||
fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]);
|
||||
|
||||
do
|
||||
@ -1746,7 +1746,7 @@ static imgtoolerr_t fat_lookup_path(imgtool::partition &partition, const char *p
|
||||
|
||||
if (!core_stricmp(sfn, ent.short_filename))
|
||||
{
|
||||
bumped_sfn = TRUE;
|
||||
bumped_sfn = true;
|
||||
fat_bump_dirent(partition, created_entry, created_entry_len);
|
||||
fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]);
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ static imgtoolerr_t mac_file_read(struct mac_fileref *fileref, uint32_t len, voi
|
||||
err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer);
|
||||
if (err)
|
||||
return err;
|
||||
fileref->reload_buf = FALSE;
|
||||
fileref->reload_buf = false;
|
||||
|
||||
if (TAG_EXTRA_CHECKS)
|
||||
{
|
||||
@ -1233,7 +1233,7 @@ static imgtoolerr_t mac_file_read(struct mac_fileref *fileref, uint32_t len, voi
|
||||
dest = (uint8_t *)dest + run_len;
|
||||
fileref->crPs += run_len;
|
||||
if ((fileref->crPs % 512) == 0)
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
}
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
@ -1299,7 +1299,7 @@ static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, uint32_t len, co
|
||||
err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer);
|
||||
if (err)
|
||||
return err;
|
||||
fileref->reload_buf = FALSE;
|
||||
fileref->reload_buf = false;
|
||||
}
|
||||
run_len = 512 - (fileref->crPs % 512);
|
||||
if (run_len > len)
|
||||
@ -1338,7 +1338,7 @@ static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, uint32_t len, co
|
||||
src = (const uint8_t *)src + run_len;
|
||||
fileref->crPs += run_len;
|
||||
if ((fileref->crPs % 512) == 0)
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
}
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
@ -1376,7 +1376,7 @@ static imgtoolerr_t mac_file_tell(struct mac_fileref *fileref, uint32_t *filePos
|
||||
static imgtoolerr_t mac_file_seek(struct mac_fileref *fileref, uint32_t filePos)
|
||||
{
|
||||
if ((fileref->crPs / 512) != (filePos / 512))
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
fileref->crPs = filePos;
|
||||
|
||||
@ -1432,7 +1432,7 @@ static imgtoolerr_t mac_file_seteof(struct mac_fileref *fileref, uint32_t newEof
|
||||
if (fileref->crPs > newEof)
|
||||
{
|
||||
if ((fileref->crPs / 512) != (newEof / 512))
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
fileref->crPs = newEof;
|
||||
}
|
||||
@ -2092,9 +2092,9 @@ static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 file
|
||||
string)
|
||||
cat_info (I/O): on output, catalog info for this file extracted from the
|
||||
catalog file (may be NULL)
|
||||
If create_it is TRUE, created info will first be set according to the
|
||||
If create_it is true, created info will first be set according to the
|
||||
data from cat_info
|
||||
create_it (I): TRUE if entry should be created if not found
|
||||
create_it (I): true if entry should be created if not found
|
||||
|
||||
Return imgtool error code
|
||||
*/
|
||||
@ -2193,7 +2193,7 @@ static imgtoolerr_t mfs_file_open_internal(struct mac_l2_imgref *l2_img, const m
|
||||
|
||||
fileref->crPs = 0;
|
||||
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -2943,7 +2943,7 @@ static imgtoolerr_t hfs_open_extents_file(struct mac_l2_imgref *l2_img, const st
|
||||
|
||||
fileref->crPs = 0;
|
||||
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -2973,7 +2973,7 @@ static imgtoolerr_t hfs_open_cat_file(struct mac_l2_imgref *l2_img, const struct
|
||||
|
||||
fileref->crPs = 0;
|
||||
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -3074,7 +3074,7 @@ static imgtoolerr_t hfs_image_open(imgtool::image &image, imgtool::stream::ptr &
|
||||
err = hfs_open_extents_file(l2_img, &buf->hfs_mdb, &l2_img->u.hfs.extents_BT.fileref);
|
||||
if (err)
|
||||
return err;
|
||||
err = BT_open(&l2_img->u.hfs.extents_BT, hfs_extentKey_compare, TRUE);
|
||||
err = BT_open(&l2_img->u.hfs.extents_BT, hfs_extentKey_compare, true);
|
||||
if (err)
|
||||
return err;
|
||||
if ((l2_img->u.hfs.extents_BT.attributes & btha_bigKeysMask)
|
||||
@ -3093,7 +3093,7 @@ static imgtoolerr_t hfs_image_open(imgtool::image &image, imgtool::stream::ptr &
|
||||
BT_close(&l2_img->u.hfs.extents_BT);
|
||||
return err;
|
||||
}
|
||||
err = BT_open(&l2_img->u.hfs.cat_BT, hfs_catKey_compare, FALSE);
|
||||
err = BT_open(&l2_img->u.hfs.cat_BT, hfs_catKey_compare, false);
|
||||
if (err)
|
||||
{
|
||||
return err;
|
||||
@ -3245,7 +3245,7 @@ static imgtoolerr_t hfs_cat_open(struct mac_l2_imgref *l2_img, const char *path,
|
||||
assert(l2_img->format == L2I_HFS);
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(l2_img, path, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(l2_img, path, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_Folder)
|
||||
@ -3328,7 +3328,7 @@ static imgtoolerr_t hfs_cat_search(struct mac_l2_imgref *l2_img, uint32_t parID,
|
||||
mac_strcpy(search_key.cName, cName);
|
||||
|
||||
/* search key */
|
||||
err = BT_search_leaf_rec(&l2_img->u.hfs.cat_BT, &search_key, NULL, NULL, &rec, &rec_len, TRUE, NULL);
|
||||
err = BT_search_leaf_rec(&l2_img->u.hfs.cat_BT, &search_key, NULL, NULL, &rec, &rec_len, true, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -3466,7 +3466,7 @@ static imgtoolerr_t hfs_file_open_internal(struct mac_l2_imgref *l2_img, const h
|
||||
|
||||
fileref->crPs = 0;
|
||||
|
||||
fileref->reload_buf = TRUE;
|
||||
fileref->reload_buf = true;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -3564,7 +3564,7 @@ static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref,
|
||||
includes AB_num, it is that one. */
|
||||
err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key,
|
||||
NULL, NULL, &extents_BT_rec, &extents_BT_rec_len,
|
||||
FALSE, NULL);
|
||||
false, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -3710,7 +3710,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent);
|
||||
BTref (I/O): B-tree file handle to open (BTref->fileref must have been
|
||||
open previously)
|
||||
key_compare_func (I): function that compares two keys
|
||||
is_extent (I): TRUE if we are opening the extent B-tree (we want to do
|
||||
is_extent (I): true if we are opening the extent B-tree (we want to do
|
||||
extra checks in this case because the extent B-Tree may include extent
|
||||
records for the extent B-tree itself, and if an extent record for the
|
||||
extent B-tree is located in an extent that has not been defined by
|
||||
@ -3863,7 +3863,7 @@ static imgtoolerr_t BT_node_get_record(mac_BTref *BTref, void *node_buf, unsigne
|
||||
|
||||
BTref (I/O): open B-tree file handle
|
||||
node_buf (I): buffer with the node the record should be extracted from
|
||||
node_is_index (I): TRUE if node is index node
|
||||
node_is_index (I): true if node is index node
|
||||
recnum (I): index of record to read
|
||||
rec_ptr (O): set to point to start of record (key + data)
|
||||
rec_len (O): set to total length of record (key + data)
|
||||
@ -3952,7 +3952,7 @@ static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, in
|
||||
Check integrity of a complete B-tree
|
||||
|
||||
BTref (I/O): open B-tree file handle
|
||||
is_extent (I): TRUE if we are opening the extent B-tree (we want to do
|
||||
is_extent (I): true if we are opening the extent B-tree (we want to do
|
||||
extra checks in this case because the extent B-Tree may include extent
|
||||
records for the extent B-tree itself, and if an extent record for the
|
||||
extent B-tree is located in an extent that has not been defined by
|
||||
@ -3988,7 +3988,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
uint32_t run_bit_len;
|
||||
uint32_t actualFreeNodes;
|
||||
imgtoolerr_t err;
|
||||
uint32_t maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is TRUE */
|
||||
uint32_t maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is true */
|
||||
|
||||
if (is_extent)
|
||||
{
|
||||
@ -4004,7 +4004,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
maxExtentAB += get_UINT16BE(BTref->fileref.hfs.extents[j].numABlks);
|
||||
maxExtentNode = (uint64_t)maxExtentAB * 512 * BTref->fileref.l2_img->blocksperAB
|
||||
/ BTref->nodeSize;
|
||||
extentEOL = FALSE;
|
||||
extentEOL = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4137,7 +4137,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
if (i != 0)
|
||||
{
|
||||
/* extract first record */
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, 0, &rec1, &rec1_len);
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, true, 0, &rec1, &rec1_len);
|
||||
if (err)
|
||||
goto bail;
|
||||
|
||||
@ -4241,7 +4241,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
hfs_extent *extentData;
|
||||
|
||||
/* extract current leaf record */
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[0].buf, FALSE, data_nodes[0].cur_rec, &rec1, &rec1_len);
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[0].buf, false, data_nodes[0].cur_rec, &rec1, &rec1_len);
|
||||
if (err)
|
||||
goto bail;
|
||||
|
||||
@ -4251,7 +4251,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
/* the key is corrupt or does not concern the extent
|
||||
B-tree: set the extentEOL flag so that we stop looking for
|
||||
further extent records for the extent B-tree */
|
||||
extentEOL = TRUE;
|
||||
extentEOL = true;
|
||||
else
|
||||
{ /* this key concerns the extent B-tree: update maxExtentAB
|
||||
and maxExtentNode */
|
||||
@ -4263,7 +4263,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
/* the record is corrupt: set the extentEOL flag so
|
||||
that we stop looking for further extent records for the
|
||||
extent B-tree */
|
||||
extentEOL = TRUE;
|
||||
extentEOL = true;
|
||||
else
|
||||
{
|
||||
extentData = (hfs_extent*)rec1_data;
|
||||
@ -4312,7 +4312,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
|
||||
i--;
|
||||
if (i>0)
|
||||
{ /* extract first record of root if it is an index node */
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, data_nodes[i].cur_rec, &rec1, &rec1_len);
|
||||
err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, true, data_nodes[i].cur_rec, &rec1, &rec1_len);
|
||||
if (err)
|
||||
goto bail;
|
||||
}
|
||||
@ -4517,11 +4517,11 @@ bail:
|
||||
record_ID (O): set to the index of the record in the node (may be NULL)
|
||||
record_ptr (O): set to point to record in node buffer (may be NULL)
|
||||
record_len (O): set to total record len (may be NULL)
|
||||
search_exact_match (I): if TRUE, the function will search for a record
|
||||
equal to search_key; if FALSE, the function will search for the
|
||||
search_exact_match (I): if true, the function will search for a record
|
||||
equal to search_key; if false, the function will search for the
|
||||
greatest record less than or equal to search_key
|
||||
match_found (O): set to TRUE if an exact match for search_key has been
|
||||
found (only makes sense if search_exact_match is FALSE) (may be NULL)
|
||||
match_found (O): set to true if an exact match for search_key has been
|
||||
found (only makes sense if search_exact_match is false) (may be NULL)
|
||||
|
||||
Return imgtool error code
|
||||
*/
|
||||
@ -4585,7 +4585,7 @@ static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key,
|
||||
return IMGTOOLERR_FILENOTFOUND;
|
||||
|
||||
if (match_found)
|
||||
*match_found = FALSE;
|
||||
*match_found = false;
|
||||
|
||||
if (node_ID)
|
||||
*node_ID = 0;
|
||||
@ -4702,7 +4702,7 @@ static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerat
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
||||
/* get current record */
|
||||
err = BT_node_get_keyed_record(enumerator->BTref, enumerator->BTref->node_buf, FALSE, enumerator->cur_rec, record_ptr, rec_len);
|
||||
err = BT_node_get_keyed_record(enumerator->BTref, enumerator->BTref->node_buf, false, enumerator->cur_rec, record_ptr, rec_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -5631,7 +5631,7 @@ static imgtoolerr_t mac_image_readfile(imgtool::partition &partition, const char
|
||||
return err;
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_File)
|
||||
@ -5710,7 +5710,7 @@ static imgtoolerr_t mac_image_writefile(imgtool::partition &partition, const cha
|
||||
set_UINT16BE(&cat_info.flFinderInfo.location.h, 0);
|
||||
|
||||
/* resolve path and create file */
|
||||
err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, TRUE);
|
||||
err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, true);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -5752,7 +5752,7 @@ static imgtoolerr_t mac_image_listforks(imgtool::partition &partition, const cha
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_File)
|
||||
@ -5790,7 +5790,7 @@ static imgtoolerr_t mac_image_getattrs(imgtool::partition &partition, const char
|
||||
int i;
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_File)
|
||||
@ -5858,7 +5858,7 @@ static imgtoolerr_t mac_image_setattrs(imgtool::partition &partition, const char
|
||||
int i;
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_File)
|
||||
@ -5912,7 +5912,7 @@ static imgtoolerr_t mac_image_setattrs(imgtool::partition &partition, const char
|
||||
}
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, TRUE);
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, true);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -6066,7 +6066,7 @@ static int load_icon(uint32_t *dest, const void *resource_fork, uint64_t resourc
|
||||
uint32_t resource_type, uint16_t resource_id, int width, int height, int bpp,
|
||||
const uint32_t *palette, int has_mask)
|
||||
{
|
||||
int success = FALSE;
|
||||
int success = false;
|
||||
int y, x, color, is_masked;
|
||||
uint32_t pixel;
|
||||
const uint8_t *src;
|
||||
@ -6107,7 +6107,7 @@ static int load_icon(uint32_t *dest, const void *resource_fork, uint64_t resourc
|
||||
dest[y * width + x] = pixel;
|
||||
}
|
||||
}
|
||||
success = TRUE;
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -6284,26 +6284,26 @@ static imgtoolerr_t mac_image_geticoninfo(imgtool::partition &partition, const c
|
||||
|
||||
/* fetch 32x32 icons (ICN#, icl4, icl8) */
|
||||
if (load_icon((uint32_t *) iconinfo->icon32x32, resource_fork, resource_fork_length,
|
||||
/* ICN# */ 0x49434E23, resource_id, 32, 32, 1, mac_palette_1bpp, TRUE))
|
||||
/* ICN# */ 0x49434E23, resource_id, 32, 32, 1, mac_palette_1bpp, true))
|
||||
{
|
||||
iconinfo->icon32x32_specified = 1;
|
||||
|
||||
load_icon((uint32_t *) iconinfo->icon32x32, resource_fork, resource_fork_length,
|
||||
/* icl4 */ 0x69636C34, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE);
|
||||
/* icl4 */ 0x69636C34, resource_id, 32, 32, 4, mac_palette_4bpp, false);
|
||||
load_icon((uint32_t *) iconinfo->icon32x32, resource_fork, resource_fork_length,
|
||||
/* icl8 */ 0x69636C38, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE);
|
||||
/* icl8 */ 0x69636C38, resource_id, 32, 32, 8, mac_palette_8bpp, false);
|
||||
}
|
||||
|
||||
/* fetch 16x16 icons (ics#, ics4, ics8) */
|
||||
if (load_icon((uint32_t *) iconinfo->icon16x16, resource_fork, resource_fork_length,
|
||||
/* ics# */ 0x69637323, resource_id, 16, 16, 1, mac_palette_1bpp, TRUE))
|
||||
/* ics# */ 0x69637323, resource_id, 16, 16, 1, mac_palette_1bpp, true))
|
||||
{
|
||||
iconinfo->icon16x16_specified = 1;
|
||||
|
||||
load_icon((uint32_t *) iconinfo->icon32x32, resource_fork, resource_fork_length,
|
||||
/* ics4 */ 0x69637334, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE);
|
||||
/* ics4 */ 0x69637334, resource_id, 32, 32, 4, mac_palette_4bpp, false);
|
||||
load_icon((uint32_t *) iconinfo->icon32x32, resource_fork, resource_fork_length,
|
||||
/* ics8 */ 0x69637338, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE);
|
||||
/* ics8 */ 0x69637338, resource_id, 32, 32, 8, mac_palette_8bpp, false);
|
||||
}
|
||||
|
||||
done:
|
||||
@ -6333,7 +6333,7 @@ static imgtoolerr_t mac_image_suggesttransfer(imgtool::partition &partition, con
|
||||
if (path)
|
||||
{
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE);
|
||||
err = mac_lookup_path(image, path, &parID, filename, &cat_info, false);
|
||||
if (err)
|
||||
return err;
|
||||
if (cat_info.dataRecType != hcrt_File)
|
||||
|
@ -215,12 +215,12 @@ static int os9_interpret_dirent(void *entry, char **filename, uint32_t *lsn, int
|
||||
*filename = NULL;
|
||||
*lsn = 0;
|
||||
if (corrupt)
|
||||
*corrupt = FALSE;
|
||||
*corrupt = false;
|
||||
|
||||
if (entry_b[28] != '\0')
|
||||
{
|
||||
if (corrupt)
|
||||
*corrupt = TRUE;
|
||||
*corrupt = true;
|
||||
}
|
||||
|
||||
for (i = 0; (i < 28) && !(entry_b[i] & 0x80); i++)
|
||||
|
@ -942,8 +942,8 @@ static imgtoolerr_t prodos_put_dirent(imgtool::image &image,
|
||||
size_t finfo_offset;
|
||||
uint8_t buffer[BLOCK_SIZE];
|
||||
int fork_num;
|
||||
int needs_finfo = FALSE;
|
||||
int needs_xfinfo = FALSE;
|
||||
int needs_finfo = false;
|
||||
int needs_xfinfo = false;
|
||||
uint8_t *info_ptr;
|
||||
uint8_t *finfo;
|
||||
uint8_t *xfinfo;
|
||||
@ -1231,7 +1231,7 @@ static imgtoolerr_t prodos_fill_file(imgtool::image &image, uint8_t *bitmap,
|
||||
{
|
||||
/* we are on a recently allocated key block; start fresh */
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
dirty = TRUE;
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1239,12 +1239,12 @@ static imgtoolerr_t prodos_fill_file(imgtool::image &image, uint8_t *bitmap,
|
||||
err = prodos_load_block(image, key_block, buffer);
|
||||
if (err)
|
||||
return err;
|
||||
dirty = FALSE;
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
sub_block_allocated = FALSE;
|
||||
sub_block_allocated = false;
|
||||
|
||||
sub_block = buffer[i + 256];
|
||||
sub_block <<= 8;
|
||||
@ -1256,7 +1256,7 @@ static imgtoolerr_t prodos_fill_file(imgtool::image &image, uint8_t *bitmap,
|
||||
err = prodos_alloc_block(image, bitmap, &new_sub_block);
|
||||
if (err)
|
||||
return err;
|
||||
sub_block_allocated = TRUE;
|
||||
sub_block_allocated = true;
|
||||
}
|
||||
else if ((block_index >= blockcount) && (sub_block != 0))
|
||||
{
|
||||
@ -1268,7 +1268,7 @@ static imgtoolerr_t prodos_fill_file(imgtool::image &image, uint8_t *bitmap,
|
||||
/* did we change the block? */
|
||||
if (new_sub_block != sub_block)
|
||||
{
|
||||
dirty = TRUE;
|
||||
dirty = true;
|
||||
buffer[i + 0] = new_sub_block >> 0;
|
||||
buffer[i + 256] = new_sub_block >> 8;
|
||||
if (sub_block == 0)
|
||||
@ -1373,7 +1373,7 @@ static imgtoolerr_t prodos_set_file_block_count(imgtool::image &image, prodos_di
|
||||
if (depth > 2)
|
||||
{
|
||||
/* remove this block's children */
|
||||
err = prodos_fill_file(image, bitmap, block, FALSE, depth - 1, 0, 0);
|
||||
err = prodos_fill_file(image, bitmap, block, false, depth - 1, 0, 0);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ static imgtoolerr_t prodos_set_file_block_count(imgtool::image &image, prodos_di
|
||||
if (new_blockcount > 0)
|
||||
{
|
||||
/* fill out the file tree */
|
||||
err = prodos_fill_file(image, bitmap, key_pointer, FALSE, depth, new_blockcount, 0);
|
||||
err = prodos_fill_file(image, bitmap, key_pointer, false, depth, new_blockcount, 0);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ uint32_t update_pack_index(psion_pack *pack)
|
||||
if(data == 0xff)
|
||||
{
|
||||
pack->eop = pack->stream->tell() - 1;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else if (data == 0x02)
|
||||
{
|
||||
@ -129,7 +129,7 @@ uint32_t update_pack_index(psion_pack *pack)
|
||||
} while (pack->stream->size() > pack->stream->tell());
|
||||
|
||||
// corrupted image
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
int seek_next_record(imgtool::stream &stream, uint8_t id)
|
||||
@ -156,7 +156,7 @@ int seek_next_record(imgtool::stream &stream, uint8_t id)
|
||||
if (id == rec_id)
|
||||
{
|
||||
stream.seek(-2, SEEK_CUR);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
size = data;
|
||||
}
|
||||
@ -166,7 +166,7 @@ int seek_next_record(imgtool::stream &stream, uint8_t id)
|
||||
|
||||
} while (stream.size() > stream.tell());
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if there are multiple files with the same name, only the first is found
|
||||
|
@ -376,7 +376,7 @@ static int check_fname(const char filename[10])
|
||||
|
||||
|
||||
/* check and copy file name */
|
||||
space_found_flag = FALSE;
|
||||
space_found_flag = false;
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
switch (filename[i])
|
||||
@ -388,7 +388,7 @@ static int check_fname(const char filename[10])
|
||||
case ' ':
|
||||
/* illegal in a file name, but file names shorter than 10
|
||||
characters are padded with spaces */
|
||||
space_found_flag = TRUE;
|
||||
space_found_flag = true;
|
||||
break;
|
||||
default:
|
||||
/* all other characters are legal (though non-ASCII characters,
|
||||
@ -1980,10 +1980,10 @@ static int win_read_catalog(struct ti99_lvl2_imgref *l2_img, int DDR_AU, ti99_ca
|
||||
|
||||
l2_img: image reference
|
||||
fpath: path of the file to search
|
||||
parent_ref_valid: set to TRUE if either the file was found or the file was
|
||||
parent_ref_valid: set to true if either the file was found or the file was
|
||||
not found but its parent dir was
|
||||
parent_ref: reference to parent dir (0 for root)
|
||||
out_is_dir: TRUE if element is a directory
|
||||
out_is_dir: true if element is a directory
|
||||
catalog_index: on output, index of file catalog entry (may be NULL)
|
||||
*/
|
||||
static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath, int *parent_ref_valid, int *parent_ref, int *out_is_dir, int *catalog_index)
|
||||
@ -1993,12 +1993,12 @@ static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
const char *element_start, *element_end;
|
||||
int element_len;
|
||||
char element[10];
|
||||
int is_dir = FALSE;
|
||||
int is_dir = false;
|
||||
|
||||
|
||||
cur_catalog = & l2_img->dsk.catalogs[0];
|
||||
if (parent_ref_valid)
|
||||
(* parent_ref_valid) = FALSE;
|
||||
(* parent_ref_valid) = false;
|
||||
if (parent_ref)
|
||||
*parent_ref = 0;
|
||||
|
||||
@ -2012,7 +2012,7 @@ static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
return IMGTOOLERR_BADFILENAME;
|
||||
/* last path element */
|
||||
if ((!element_end) && parent_ref_valid)
|
||||
(* parent_ref_valid) = TRUE;
|
||||
(* parent_ref_valid) = true;
|
||||
|
||||
/* generate file name */
|
||||
memcpy(element, element_start, element_len);
|
||||
@ -2023,7 +2023,7 @@ static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
{
|
||||
if (! memcmp(element, cur_catalog->subdirs[i].name, 10))
|
||||
{
|
||||
is_dir = TRUE;
|
||||
is_dir = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2035,7 +2035,7 @@ static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
{
|
||||
if (! memcmp(element, cur_catalog->files[i].name, 10))
|
||||
{
|
||||
is_dir = FALSE;
|
||||
is_dir = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2079,11 +2079,11 @@ static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
|
||||
l2_img: image reference
|
||||
fpath: path of the file to search
|
||||
parent_ref_valid: set to TRUE if either the file was found or the file was
|
||||
parent_ref_valid: set to true if either the file was found or the file was
|
||||
not found but its parent dir was
|
||||
parent_ddr_AU: parent DDR AU address (0 for root)
|
||||
parent_catalog: catalog of parent dir (cannot be NULL)
|
||||
out_is_dir: TRUE if element is a directory
|
||||
out_is_dir: true if element is a directory
|
||||
catalog_index: on output, index of file catalog entry (may be NULL)
|
||||
*/
|
||||
static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath,
|
||||
@ -2094,11 +2094,11 @@ static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
const char *element_start, *element_end;
|
||||
int element_len;
|
||||
char element[10];
|
||||
int is_dir = FALSE;
|
||||
int is_dir = false;
|
||||
int errorcode;
|
||||
|
||||
if (parent_ref_valid)
|
||||
(* parent_ref_valid) = FALSE;
|
||||
(* parent_ref_valid) = false;
|
||||
if (parent_ddr_AU)
|
||||
*parent_ddr_AU = 0;
|
||||
|
||||
@ -2116,7 +2116,7 @@ static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
return IMGTOOLERR_BADFILENAME;
|
||||
/* last path element */
|
||||
if ((!element_end) && parent_ref_valid)
|
||||
(* parent_ref_valid) = TRUE;
|
||||
(* parent_ref_valid) = true;
|
||||
|
||||
/* generate file name */
|
||||
memcpy(element, element_start, element_len);
|
||||
@ -2127,7 +2127,7 @@ static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
{
|
||||
if (! memcmp(element, parent_catalog->subdirs[i].name, 10))
|
||||
{
|
||||
is_dir = TRUE;
|
||||
is_dir = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2139,7 +2139,7 @@ static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *f
|
||||
{
|
||||
if (! memcmp(element, parent_catalog->files[i].name, 10))
|
||||
{
|
||||
is_dir = FALSE;
|
||||
is_dir = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2338,7 +2338,7 @@ static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file)
|
||||
{
|
||||
unsigned oldfdr_AU, oldfdr_physrecinAU;
|
||||
unsigned newfdr_AU, newfdr_physrecinAU;
|
||||
int allocated = FALSE;
|
||||
int allocated = false;
|
||||
int errorcode;
|
||||
unsigned cursibFDR_basefphysrec;
|
||||
|
||||
@ -2359,7 +2359,7 @@ static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file)
|
||||
if (errorcode)
|
||||
return errorcode;
|
||||
newfdr_physrecinAU = 0;
|
||||
allocated = TRUE;
|
||||
allocated = true;
|
||||
}
|
||||
|
||||
set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, newfdr_AU);
|
||||
@ -3020,7 +3020,7 @@ static int open_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, const char *fpath
|
||||
{
|
||||
if (get_UINT16BE(cur_fdr->clusters[i][0]) == 0)
|
||||
{
|
||||
pastendoflist_flag = TRUE;
|
||||
pastendoflist_flag = true;
|
||||
break;
|
||||
}
|
||||
sibFDR_AUlen += get_UINT16BE(cur_fdr->clusters[i][1])
|
||||
@ -5115,7 +5115,7 @@ static imgtoolerr_t win_image_deletefile(imgtool::partition &partition, const ch
|
||||
if (get_UINT16BE(fdr.clusters[i][0]) == 0)
|
||||
{
|
||||
endsibFDR_index = cursibFDR_index;
|
||||
pastendoflist_flag = TRUE;
|
||||
pastendoflist_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static bool read_avi(void *file, int frame, bitmap_yuy16 &bitmap, int16_t *lsoun
|
||||
// read the frame
|
||||
avi_file::error avierr = avifile->read_video_frame(frame, bitmap);
|
||||
if (avierr != avi_file::error::NONE)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// read the samples
|
||||
const avi_file::movie_info &aviinfo = avifile->get_movie_info();
|
||||
@ -335,7 +335,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap)
|
||||
// if we haven't seen lead-in yet, detect it
|
||||
if (!video.saw_leadin)
|
||||
{
|
||||
video.saw_leadin = TRUE;
|
||||
video.saw_leadin = true;
|
||||
printf("%6d.%d: lead-in code detected\n", frame, fieldnum);
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap)
|
||||
// if we haven't seen lead-in yet, detect it
|
||||
if (!video.saw_leadout)
|
||||
{
|
||||
video.saw_leadout = TRUE;
|
||||
video.saw_leadout = true;
|
||||
printf("%6d.%d: lead-out code detected\n", frame, fieldnum);
|
||||
if (video.last_frame != -1)
|
||||
printf("%6d.%d: final frame number was %d\n", frame, fieldnum, video.last_frame);
|
||||
@ -372,7 +372,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap)
|
||||
if (!video.saw_leadin)
|
||||
{
|
||||
printf("%6d.%d: detected frame number but never saw any lead-in (WARNING)\n", frame, fieldnum);
|
||||
video.saw_leadin = TRUE;
|
||||
video.saw_leadin = true;
|
||||
}
|
||||
|
||||
// if this is the first frame, make sure it's 1
|
||||
|
@ -396,7 +396,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3 && argc != 4)
|
||||
goto usage;
|
||||
result = join_file(argv[2], (argc >= 4) ? argv[3] : nullptr, TRUE);
|
||||
result = join_file(argv[2], (argc >= 4) ? argv[3] : nullptr, true);
|
||||
}
|
||||
|
||||
/* verify command */
|
||||
@ -404,7 +404,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
goto usage;
|
||||
result = join_file(argv[2], nullptr, FALSE);
|
||||
result = join_file(argv[2], nullptr, false);
|
||||
}
|
||||
else
|
||||
goto usage;
|
||||
|
@ -393,11 +393,11 @@ static const dasm_table_entry dasm_table[] =
|
||||
|
||||
static int parse_options(int argc, char *argv[], options *opts)
|
||||
{
|
||||
int pending_base = FALSE;
|
||||
int pending_arch = FALSE;
|
||||
int pending_mode = FALSE;
|
||||
int pending_skip = FALSE;
|
||||
int pending_count = FALSE;
|
||||
bool pending_base = false;
|
||||
bool pending_arch = false;
|
||||
bool pending_mode = false;
|
||||
bool pending_skip = false;
|
||||
bool pending_count = false;
|
||||
|
||||
memset(opts, 0, sizeof(*opts));
|
||||
|
||||
@ -413,23 +413,23 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
goto usage;
|
||||
|
||||
if (tolower((uint8_t)curarg[1]) == 'a')
|
||||
pending_arch = TRUE;
|
||||
pending_arch = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'b')
|
||||
pending_base = TRUE;
|
||||
pending_base = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'f')
|
||||
opts->flipped = TRUE;
|
||||
opts->flipped = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'l')
|
||||
opts->lower = TRUE;
|
||||
opts->lower = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'm')
|
||||
pending_mode = TRUE;
|
||||
pending_mode = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 's')
|
||||
pending_skip = TRUE;
|
||||
pending_skip = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'c')
|
||||
pending_count = TRUE;
|
||||
pending_count = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'n')
|
||||
opts->norawbytes = TRUE;
|
||||
opts->norawbytes = true;
|
||||
else if (tolower((uint8_t)curarg[1]) == 'u')
|
||||
opts->upper = TRUE;
|
||||
opts->upper = true;
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
@ -446,7 +446,7 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
result = sscanf(&curarg[0], "%x", &opts->basepc);
|
||||
if (result != 1)
|
||||
goto usage;
|
||||
pending_base = FALSE;
|
||||
pending_base = false;
|
||||
}
|
||||
|
||||
// mode
|
||||
@ -454,7 +454,7 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
{
|
||||
if (sscanf(curarg, "%d", &opts->mode) != 1)
|
||||
goto usage;
|
||||
pending_mode = FALSE;
|
||||
pending_mode = false;
|
||||
}
|
||||
|
||||
// architecture
|
||||
@ -467,7 +467,7 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
if (curarch == ARRAY_LENGTH(dasm_table))
|
||||
goto usage;
|
||||
opts->dasm = &dasm_table[curarch];
|
||||
pending_arch = FALSE;
|
||||
pending_arch = false;
|
||||
}
|
||||
|
||||
// skip bytes
|
||||
@ -475,7 +475,7 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
{
|
||||
if (sscanf(curarg, "%d", &opts->skip) != 1)
|
||||
goto usage;
|
||||
pending_skip = FALSE;
|
||||
pending_skip = false;
|
||||
}
|
||||
|
||||
// size
|
||||
@ -483,7 +483,7 @@ static int parse_options(int argc, char *argv[], options *opts)
|
||||
{
|
||||
if (sscanf(curarg, "%d", &opts->count) != 1)
|
||||
goto usage;
|
||||
pending_count = FALSE;
|
||||
pending_count = false;
|
||||
}
|
||||
|
||||
// filename
|
||||
|
Loading…
Reference in New Issue
Block a user