diff options
author | 2016-10-22 16:37:12 +0200 | |
---|---|---|
committer | 2016-10-22 16:37:12 +0200 | |
commit | a6bdefec8c76e9878b634119c56438a7673b0385 (patch) | |
tree | 9b435836a12773fe5b84cf1fd04866ecd9ecc2da /src/lib/util | |
parent | 5f3d4fb33da4304e417a0e142e82e3d292646465 (diff) |
more TRUE/FALSE cleanup (nw)
Diffstat (limited to 'src/lib/util')
-rw-r--r-- | src/lib/util/png.cpp | 14 | ||||
-rw-r--r-- | src/lib/util/pool.cpp | 24 | ||||
-rw-r--r-- | src/lib/util/pool.h | 8 | ||||
-rw-r--r-- | src/lib/util/vbiparse.cpp | 6 | ||||
-rw-r--r-- | src/lib/util/vbiparse.h | 2 | ||||
-rw-r--r-- | src/lib/util/xmlfile.cpp | 10 | ||||
-rw-r--r-- | src/lib/util/zippath.cpp | 6 | ||||
-rw-r--r-- | src/lib/util/zippath.h | 4 |
8 files changed, 37 insertions, 37 deletions
diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index d1189d5ffc2..9069348c843 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -235,10 +235,10 @@ static png_error read_chunk(util::core_file &fp, uint8_t **data, uint32_t *type, process_chunk - process a PNG chunk -------------------------------------------------*/ -static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, uint32_t length, int *keepmem) +static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, uint32_t length, bool *keepmem) { /* default to not keeping memory */ - *keepmem = FALSE; + *keepmem = false; /* switch off of the type */ switch (type) @@ -258,14 +258,14 @@ static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, u case PNG_CN_PLTE: png->pnginfo->num_palette = length / 3; png->pnginfo->palette = data; - *keepmem = TRUE; + *keepmem = true; break; /* transparency information */ case PNG_CN_tRNS: png->pnginfo->num_trans = length; png->pnginfo->trans = data; - *keepmem = TRUE; + *keepmem = true; break; /* image data */ @@ -281,7 +281,7 @@ static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, u (*png->idata_next)->length = length; (*png->idata_next)->data = data; png->idata_next = &(*png->idata_next)->next; - *keepmem = TRUE; + *keepmem = true; break; /* gamma */ @@ -318,7 +318,7 @@ static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, u else pt->next = text; - *keepmem = TRUE; + *keepmem = true; break; } @@ -523,7 +523,7 @@ png_error png_read_file(util::core_file &fp, png_info *pnginfo) for ( ; ; ) { uint32_t chunk_type, chunk_length; - int keepmem; + bool keepmem; /* read a chunk */ error = read_chunk(fp, &chunk_data, &chunk_type, &chunk_length); diff --git a/src/lib/util/pool.cpp b/src/lib/util/pool.cpp index 1acb8d0d6e6..606a7aea4b6 100644 --- a/src/lib/util/pool.cpp +++ b/src/lib/util/pool.cpp @@ -367,11 +367,11 @@ void *pool_object_remove(object_pool *pool, void *object, int destruct) /*------------------------------------------------- - pool_object_exists - return TRUE if an + pool_object_exists - return true if an object exists in the pool -------------------------------------------------*/ -int pool_object_exists(object_pool *pool, object_type type, void *object) +bool pool_object_exists(object_pool *pool, object_type type, void *object) { int hashnum = hash_object(object); object_entry *entry; @@ -379,9 +379,9 @@ int pool_object_exists(object_pool *pool, object_type type, void *object) /* find the object in question */ for (entry = pool->hashtable[hashnum]; entry != nullptr; entry = entry->next) if (entry->object == object && (type == OBJTYPE_WILDCARD || entry->type->type == type)) - return TRUE; + return true; - return FALSE; + return false; } @@ -418,7 +418,7 @@ object_pool_iterator *pool_iterate_begin(object_pool *pool, object_type type) object pool -------------------------------------------------*/ -int pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *sizeptr, object_type *typeptr) +bool pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *sizeptr, object_type *typeptr) { /* if no previous entry, find the first */ if (iter->last == nullptr) @@ -435,11 +435,11 @@ int pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *size *sizeptr = iter->last->size; if (typeptr != nullptr) *typeptr = iter->last->type->type; - return TRUE; + return true; } /* nothing left */ - return FALSE; + return false; } @@ -479,7 +479,7 @@ void *pool_malloc_file_line(object_pool *pool, size_t size, const char *file, in void *pool_realloc_file_line(object_pool *pool, void *ptr, size_t size, const char *file, int line) { if (ptr != nullptr) - pool_object_remove(pool, ptr, FALSE); + pool_object_remove(pool, ptr, false); ptr = realloc(ptr, size); if (size != 0) pool_object_add_file_line(pool, OBJTYPE_MEMORY, ptr, size, file, line); @@ -551,7 +551,7 @@ static void report_failure(object_pool *pool, const char *format, ...) TESTING FUNCTIONS ***************************************************************************/ -static int has_memory_error; +static bool has_memory_error; /*------------------------------------------------- @@ -561,7 +561,7 @@ static int has_memory_error; static void memory_error(const char *message) { printf("memory test failure: %s\n", message); - has_memory_error = TRUE; + has_memory_error = true; } @@ -578,13 +578,13 @@ static void memory_error(const char *message) * @return An int. */ -int test_memory_pools(void) +bool test_memory_pools(void) { object_pool *pool; void *ptrs[16]; int i; - has_memory_error = FALSE; + has_memory_error = false; pool = pool_alloc_lib(memory_error); memset(ptrs, 0, sizeof(ptrs)); diff --git a/src/lib/util/pool.h b/src/lib/util/pool.h index a43dacd87b2..305fc9c5f51 100644 --- a/src/lib/util/pool.h +++ b/src/lib/util/pool.h @@ -57,7 +57,7 @@ struct object_pool_iterator; /* allocate a new object pool */ object_pool *pool_alloc_lib(void (*fail)(const char *message)); -/* register a new object type; returns TRUE if the type already existed and was overridden */ +/* register a new object type; returns true if the type already existed and was overridden */ void pool_type_register(object_pool *pool, object_type type, const char *friendly, void (*destructor)(void *, size_t)); /* free all allocated objects in a pool */ @@ -77,7 +77,7 @@ void *pool_object_add_file_line(object_pool *pool, object_type type, void *objec void *pool_object_remove(object_pool *pool, void *object, int destruct); /* does an object exist in the pool? */ -int pool_object_exists(object_pool *pool, object_type type, void *object); +bool pool_object_exists(object_pool *pool, object_type type, void *object); @@ -87,7 +87,7 @@ int pool_object_exists(object_pool *pool, object_type type, void *object); object_pool_iterator *pool_iterate_begin(object_pool *pool, object_type type); /* get the next object in the object pool */ -int pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *sizeptr, object_type *typeptr); +bool pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *sizeptr, object_type *typeptr); /* finish iterating over objects in an object pool */ void pool_iterate_end(object_pool_iterator *iter); @@ -110,7 +110,7 @@ char *pool_strdup_file_line(object_pool *pool, const char *str, const char *file /* ----- miscellaneous ----- */ /* internal unit tests */ -int test_memory_pools(void); +bool test_memory_pools(void); #endif /* __POOL_H__ */ diff --git a/src/lib/util/vbiparse.cpp b/src/lib/util/vbiparse.cpp index 42249ab6794..bfd145dd99f 100644 --- a/src/lib/util/vbiparse.cpp +++ b/src/lib/util/vbiparse.cpp @@ -174,7 +174,7 @@ int vbi_parse_manchester_code(const uint16_t *source, int sourcewidth, int sourc flag" from a line of video data -------------------------------------------------*/ -int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift) +bool vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift) { int histo[256] = { 0 }; int minval = 0xff; @@ -216,7 +216,7 @@ int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshif { if (PRINTF_WHITE_FLAG) printf("White flag NOT detected; threshold too low\n"); - return FALSE; + return false; } /* @@ -240,7 +240,7 @@ int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshif if (histo[x] > histo[peakval]) peakval = x; - /* return TRUE if it is above the 90% mark */ + /* return true if it is above the 90% mark */ result = (peakval > minval + 9 * (maxval - minval) / 10); if (PRINTF_WHITE_FLAG) printf("White flag %s: peak=%02X thresh=%02X\n", result ? "detected" : "NOT detected", peakval, minval + 9 * (maxval - minval) / 10); diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h index ed67a3fee9f..4ccb6a935c4 100644 --- a/src/lib/util/vbiparse.h +++ b/src/lib/util/vbiparse.h @@ -78,7 +78,7 @@ struct vbi_metadata int vbi_parse_manchester_code(const uint16_t *source, int sourcewidth, int sourceshift, int expectedbits, uint32_t *result); /* compute the "white flag" from a line of video data */ -int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift); +bool vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift); /* parse everything from a video frame */ void vbi_parse_all(const uint16_t *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi); diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index 98689283c4e..0676326fdd8 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -42,7 +42,7 @@ struct xml_parse_info ***************************************************************************/ /* expat interfaces */ -static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts); +static bool expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts); static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes); static void expat_data(void *data, const XML_Char *s, int len); static void expat_element_end(void *data, const XML_Char *name); @@ -695,7 +695,7 @@ static void *expat_realloc(void *ptr, size_t size) * @return An int. */ -static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) +static bool expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) { XML_Memory_Handling_Suite memcallbacks; @@ -715,7 +715,7 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt /* create a root node */ parse_info->rootnode = xml_file_create(); if (parse_info->rootnode == nullptr) - return FALSE; + return false; parse_info->curnode = parse_info->rootnode; /* create the XML parser */ @@ -726,7 +726,7 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt if (parse_info->parser == nullptr) { free(parse_info->rootnode); - return FALSE; + return false; } /* configure the parser */ @@ -737,7 +737,7 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt /* optional parser initialization step */ if (opts != nullptr && opts->init_parser != nullptr) (*opts->init_parser)(parse_info->parser); - return TRUE; + return true; } diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp index 2ee9082a817..f85e5c63b71 100644 --- a/src/lib/util/zippath.cpp +++ b/src/lib/util/zippath.cpp @@ -1048,8 +1048,8 @@ const osd::directory::entry *zippath_readdir(zippath_directory *directory) // ------------------------------------------------- -// zippath_is_zip - returns TRUE if this path is -// a ZIP path or FALSE if not +// zippath_is_zip - returns true if this path is +// a ZIP path or false if not // ------------------------------------------------- /** @@ -1062,7 +1062,7 @@ const osd::directory::entry *zippath_readdir(zippath_directory *directory) * @return An int. */ -int zippath_is_zip(zippath_directory *directory) +bool zippath_is_zip(zippath_directory *directory) { return directory->zipfile != nullptr; } diff --git a/src/lib/util/zippath.h b/src/lib/util/zippath.h index 89656e6cf10..3bef7fc9d39 100644 --- a/src/lib/util/zippath.h +++ b/src/lib/util/zippath.h @@ -63,8 +63,8 @@ void zippath_closedir(zippath_directory *directory); // reads a directory entry const osd::directory::entry *zippath_readdir(zippath_directory *directory); -// returns TRUE if this path is a ZIP path or FALSE if not -int zippath_is_zip(zippath_directory *directory); +// returns true if this path is a ZIP path or false if not +bool zippath_is_zip(zippath_directory *directory); } // namespace util |