# housekeeping

* zip.h removed old test symbols
* path_util fixed bug in mixed-separating-slash handling
* renamed ERR_OK to INFO_OK; allows searching for "return ERR_" to yield
all actual errors (instead of having to filter out ERR_OK)

This was SVN commit r3945.
This commit is contained in:
janwas 2006-06-04 22:27:40 +00:00
parent 61f40e4775
commit b8c131c431
70 changed files with 459 additions and 471 deletions

View File

@ -59,7 +59,7 @@ static inline size_t round_up_to_page(size_t size)
static inline LibError LibError_from_mmap(void* ret, bool warn_if_failed = true)
{
if(ret != MAP_FAILED)
return ERR_OK;
return INFO_OK;
return LibError_from_errno(warn_if_failed);
}
@ -177,7 +177,7 @@ static LibError validate_da(DynArray* da)
if(prot & ~(PROT_READ|PROT_WRITE|PROT_EXEC|DA_NOT_OUR_MEM))
WARN_RETURN(ERR_6);
return ERR_OK;
return INFO_OK;
}
#define CHECK_DA(da) RETURN_ERR(validate_da(da))
@ -206,7 +206,7 @@ LibError da_alloc(DynArray* da, size_t max_size)
da->prot = PROT_READ|PROT_WRITE;
da->pos = 0;
CHECK_DA(da);
return ERR_OK;
return INFO_OK;
}
@ -231,7 +231,7 @@ LibError da_wrap_fixed(DynArray* da, u8* p, size_t size)
da->prot = PROT_READ|PROT_WRITE|DA_NOT_OUR_MEM;
da->pos = 0;
CHECK_DA(da);
return ERR_OK;
return INFO_OK;
}
@ -260,7 +260,7 @@ LibError da_free(DynArray* da)
// da_free is supposed to be called even in the above case.
if(!was_wrapped)
RETURN_ERR(mem_release(p, size));
return ERR_OK;
return INFO_OK;
}
@ -303,7 +303,7 @@ LibError da_set_size(DynArray* da, size_t new_size)
da->cur_size = new_size;
CHECK_DA(da);
return ERR_OK;
return INFO_OK;
}
@ -323,7 +323,7 @@ LibError da_reserve(DynArray* da, size_t size)
if(da->pos + size > da->cur_size)
return da_set_size(da, da->cur_size + expand_amount);
return ERR_OK;
return INFO_OK;
}
@ -349,7 +349,7 @@ LibError da_set_prot(DynArray* da, int prot)
RETURN_ERR(mem_protect(da->base, da->cur_size, prot));
CHECK_DA(da);
return ERR_OK;
return INFO_OK;
}
@ -370,7 +370,7 @@ LibError da_read(DynArray* da, void* data, size_t size)
memcpy2(data, da->base+da->pos, size);
da->pos += size;
return ERR_OK;
return INFO_OK;
}
@ -388,7 +388,7 @@ LibError da_append(DynArray* da, const void* data, size_t size)
RETURN_ERR(da_reserve(da, size));
memcpy2(da->base+da->pos, data, size);
da->pos += size;
return ERR_OK;
return INFO_OK;
}
@ -449,7 +449,7 @@ LibError pool_create(Pool* p, size_t max_size, size_t el_size)
p->el_size = round_up(el_size, ALIGN);
p->freelist = 0;
RETURN_ERR(da_alloc(&p->da, max_size));
return ERR_OK;
return INFO_OK;
}
@ -622,7 +622,7 @@ LibError bucket_create(Bucket* b, size_t el_size)
*(u8**)b->bucket = 0; // terminate list
b->pos = round_up(sizeof(u8*), ALIGN);
b->num_buckets = 1;
return ERR_OK;
return INFO_OK;
}

View File

@ -235,7 +235,7 @@ LibError debug_write_crashlog(const wchar_t* text)
fwprintf(f, L"Last known activity:\n\n %ls\n", debug_log);
fclose(f);
return ERR_OK;
return INFO_OK;
}

View File

@ -415,7 +415,7 @@ const size_t DBG_FILE_LEN = 100;
*
* note: all of the output parameters are optional; we pass back as much
* information as is available and desired.
* @return LibError; ERR_OK iff any information was successfully
* @return LibError; INFO_OK iff any information was successfully
* retrieved and stored.
**/
extern LibError debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int* line);

View File

@ -702,7 +702,7 @@ LibError stl_get_container_info(const char* type_name, const u8* p, size_t size,
return ERR_STL_CNT_UNKNOWN; // NOWARN
if(!valid)
return ERR_STL_CNT_INVALID; // NOWARN
return ERR_OK;
return INFO_OK;
}
#endif

View File

@ -111,7 +111,7 @@ LibError in_record(const char* fn)
state = RECORD;
return ERR_OK;
return INFO_OK;
}
@ -135,7 +135,7 @@ LibError in_playback(const char* fn)
state = PLAYBACK;
return ERR_OK;
return INFO_OK;
}

View File

@ -106,7 +106,7 @@ LibError LibError_from_posix(int ret, bool warn_if_failed)
{
debug_assert(ret == 0 || ret == -1);
if(ret == 0)
return ERR_OK;
return INFO_OK;
return LibError_from_errno(warn_if_failed);
}

View File

@ -77,7 +77,7 @@ macros to simplify this task: function calls can be wrapped in an
Consider the following example:
LibError ret = doWork();
if(ret != ERR_OK) { warnUser(ret); return ret; }
if(ret != INFO_OK) { warnUser(ret); return ret; }
This can be replaced by:
CHECK_ERR(doWork());
@ -182,7 +182,7 @@ extern void error_description_r(LibError err, char* buf, size_t max_chars);
// conversion to/from other error code definitions.
// notes:
// - these functions will raise a warning (before returning any error code
// except ERR_OK) unless warn_if_failed is explicitly set to false.
// except INFO_OK) unless warn_if_failed is explicitly set to false.
// - other conversion routines (e.g. to/from Win32) are implemented in
// the corresponding modules to keep this header portable.
@ -344,10 +344,10 @@ STMT(\
// error code is usually negative; positive denotes warnings.
// if negative, absolute value must be within [ERR_MIN, ERR_MAX).
// ERR_OK doesn't really need a string, but must be part of enum LibError
// INFO_OK doesn't really need a string, but must be part of enum LibError
// due to compiler checks. (and calling error_description_r(0) should
// never happen, but we set the text accordingly..)
ERR(0, ERR_OK, "(but return value was 0 which indicates success)")
ERR(0, INFO_OK, "(but return value was 0 which indicates success)")
ERR(-1, ERR_FAIL, "Function failed (no details available)")
// note: these values are > 100 to allow multiplexing them with

View File

@ -448,7 +448,7 @@ LibError lfl_init(LFList* list)
list->head = 0;
atomic_add(&active_data_structures, 1);
return ERR_OK;
return INFO_OK;
}
@ -640,7 +640,7 @@ retry:
// call list_lookup to ensure # non-released nodes < # threads.
else
list_lookup(list, key, pos);
return ERR_OK;
return INFO_OK;
}
@ -698,7 +698,7 @@ LibError lfh_init(LFHash* hash, size_t num_entries)
}
}
return ERR_OK;
return INFO_OK;
}

View File

@ -355,7 +355,7 @@ LibError ogl_get_gfx_info()
// add "OpenGL" to differentiate this from the real driver version
// (returned by platform-specific detect routines).
snprintf(gfx_drv_ver, ARRAY_SIZE(gfx_drv_ver), "OpenGL %s", version);
return ERR_OK;
return INFO_OK;
}

View File

@ -69,7 +69,7 @@ bool path_is_subpath(const char* s1, const char* s2)
}
// if path is invalid, return a descriptive error code, otherwise ERR_OK.
// if path is invalid, return a descriptive error code, otherwise INFO_OK.
LibError path_validate(const char* path)
{
// disallow "/", because it would create a second 'root' (with name = "").
@ -105,11 +105,11 @@ LibError path_validate(const char* path)
break;
}
return ERR_OK;
return INFO_OK;
}
// if name is invalid, return a descriptive error code, otherwise ERR_OK.
// if name is invalid, return a descriptive error code, otherwise INFO_OK.
// (name is a path component, i.e. that between directory separators)
LibError path_component_validate(const char* name)
{
@ -131,7 +131,7 @@ LibError path_component_validate(const char* name)
break;
}
return ERR_OK;
return INFO_OK;
}
@ -185,7 +185,7 @@ LibError path_append(char* dst, const char* path1, const char* path2, uint flags
if(need_terminator)
strcpy(dst+len2, "/"); // safe
return ERR_OK;
return INFO_OK;
}
@ -208,7 +208,7 @@ LibError path_replace(char* dst, const char* src, const char* remove, const char
// prepend replace.
RETURN_ERR(path_append(dst, replace, start));
return ERR_OK;
return INFO_OK;
}
@ -222,22 +222,14 @@ LibError path_replace(char* dst, const char* src, const char* remove, const char
// characters up to the last dir separator, if any).
const char* path_name_only(const char* path)
{
// first try: look for portable '/'
const char* slash = strrchr(path, '/');
// not present
if(!slash)
{
// now look for platform-specific DIR_SEP
slash = strrchr(path, DIR_SEP);
// neither present, it's a filename only
if(!slash)
return path;
}
const char* portable_slash = strrchr(path, '/');
const char* platform_slash = strrchr(path, DIR_SEP);
// neither present, it's a filename only
if(!portable_slash && !platform_slash)
return path;
// TODO: take max of portableslash, nonportableslash
const char* name = slash+1;
return name;
// return name, i.e. component after the last portable or platform slash
return MAX(portable_slash, platform_slash)+1;
}
@ -347,7 +339,7 @@ LibError path_foreach_component(const char* path_org, PathComponentCb cb, void*
cur_component = slash+1;
}
return ERR_OK;
return INFO_OK;
}
@ -389,7 +381,7 @@ LibError path_package_set_dir(PathPackage* pp, const char* dir)
pp->end = pp->path+len;
pp->chars_left = ARRAY_SIZE(pp->path)-len;
return ERR_OK;
return INFO_OK;
}
@ -398,5 +390,5 @@ LibError path_package_set_dir(PathPackage* pp, const char* dir)
LibError path_package_append_file(PathPackage* pp, const char* path)
{
CHECK_ERR(strcpy_s(pp->end, pp->chars_left, path));
return ERR_OK;
return INFO_OK;
}

View File

@ -36,12 +36,12 @@
#include "posix.h" // PATH_MAX
// if path is invalid (see source for criteria), return a
// descriptive error code, otherwise ERR_OK.
// descriptive error code, otherwise INFO_OK.
extern LibError path_validate(const char* path);
#define CHECK_PATH(path) RETURN_ERR(path_validate(path))
// if name is invalid, (see source for criteria), return a
// descriptive error code, otherwise ERR_OK.
// descriptive error code, otherwise INFO_OK.
extern LibError path_component_validate(const char* name);
@ -49,10 +49,10 @@ extern LibError path_component_validate(const char* name);
// (equal counts as subpath)
extern bool path_is_subpath(const char* s1, const char* s2);
// if path is invalid, return a descriptive error code, otherwise ERR_OK.
// if path is invalid, return a descriptive error code, otherwise INFO_OK.
extern LibError path_validate(const char* path);
// if name is invalid, return a descriptive error code, otherwise ERR_OK.
// if name is invalid, return a descriptive error code, otherwise INFO_OK.
// (name is a path component, i.e. that between directory separators)
extern LibError path_component_validate(const char* name);
@ -112,7 +112,7 @@ extern const char* path_extension(const char* fn);
// ctx: context parameter that was passed to path_foreach_component.
// return: INFO_CB_CONTINUE to continue operation normally; anything else
// will cause path_foreach_component to abort immediately and return that.
// no need to 'abort' (e.g. return ERR_OK) after a filename is encountered -
// no need to 'abort' (e.g. return INFO_OK) after a filename is encountered -
// that's taken care of automatically.
//
// rationale:

View File

@ -121,7 +121,7 @@ static LibError Archive_reload(Archive* a, const char* fn, Handle)
RETURN_ERR(zip_populate_archive(&a->f, a));
a->is_loaded = 1;
return ERR_OK;
return INFO_OK;
}
static LibError Archive_validate(const Archive* a)
@ -131,13 +131,13 @@ static LibError Archive_validate(const Archive* a)
if(debug_is_pointer_bogus(a->ents))
WARN_RETURN(ERR_1);
return ERR_OK;
return INFO_OK;
}
static LibError Archive_to_string(const Archive* a, char* buf)
{
snprintf(buf, H_STRING_LEN, "(%u files)", a->num_files);
return ERR_OK;
return INFO_OK;
}
@ -169,7 +169,7 @@ static LibError archive_get_file_info(Archive* a, const char* fn, uintptr_t meme
if(memento)
{
ent = (ArchiveEntry*)memento;
return ERR_OK;
return INFO_OK;
}
else
{
@ -178,7 +178,7 @@ static LibError archive_get_file_info(Archive* a, const char* fn, uintptr_t meme
if(a->ents[i].atom_fn == atom_fn)
{
ent = &a->ents[i];
return ERR_OK;
return INFO_OK;
}
}
@ -211,7 +211,7 @@ LibError archive_enum(const Handle ha, const FileCB cb, const uintptr_t user)
return ret;
}
return ERR_OK;
return INFO_OK;
}
@ -223,7 +223,7 @@ LibError archive_allocate_entries(Archive* a, size_t num_entries)
a->ents = (ArchiveEntry*)mem_alloc(num_entries * sizeof(ArchiveEntry), 32);
if(!a->ents)
WARN_RETURN(ERR_NO_MEM);
return ERR_OK;
return INFO_OK;
}
@ -235,7 +235,7 @@ LibError archive_allocate_entries(Archive* a, size_t num_entries)
LibError archive_add_file(Archive* a, const ArchiveEntry* ent)
{
a->ents[a->num_files++] = *ent;
return ERR_OK;
return INFO_OK;
}
@ -290,7 +290,7 @@ LibError afile_stat(Handle ha, const char* fn, struct stat* s)
s->st_size = ent->ucsize;
s->st_mtime = ent->mtime;
return ERR_OK;
return INFO_OK;
}
@ -308,7 +308,7 @@ LibError afile_validate(const File* f)
WARN_RETURN(ERR_1);
// note: af->ctx is 0 if file is not compressed.
return ERR_OK;
return INFO_OK;
}
#define CHECK_AFILE(f) RETURN_ERR(afile_validate(f))
@ -359,7 +359,7 @@ LibError afile_open(const Handle ha, const char* fn, uintptr_t memento, uint fla
af->ctx = ctx;
af->is_mapped = 0;
CHECK_AFILE(f);
return ERR_OK;
return INFO_OK;
}
@ -371,7 +371,7 @@ LibError afile_close(File* f)
// other File fields don't need to be freed/cleared
comp_free(af->ctx);
af->ctx = 0;
return ERR_OK;
return INFO_OK;
}
@ -446,7 +446,7 @@ LibError afile_io_issue(File* f, off_t user_ofs, size_t max_output_size, void* u
RETURN_ERR(file_io_issue(&a->f, cofs, csize, cbuf, aio->io));
af->last_cofs += (off_t)csize;
return ERR_OK;
return INFO_OK;
}
@ -489,7 +489,7 @@ LibError afile_io_wait(FileIo* io, void*& buf, size_t& size)
size = raw_size;
}
return ERR_OK;
return INFO_OK;
}
@ -510,7 +510,7 @@ LibError afile_io_validate(const FileIo* io)
WARN_RETURN(ERR_1);
// <ctx> and <max_output_size> have no invariants we could check.
RETURN_ERR(file_io_validate(aio->io));
return ERR_OK;
return INFO_OK;
}
@ -548,7 +548,7 @@ public:
if(user_cb)
ret = user_cb(user_cb_ctx, ucblock, ucsize, bytes_processed);
if(ucsize_left == 0)
ret = ERR_OK;
ret = INFO_OK;
return ret;
}
@ -681,7 +681,7 @@ LibError afile_map(File* f, void*& p, size_t& size)
size = f->size;
af->is_mapped = 1;
return ERR_OK;
return INFO_OK;
}

View File

@ -179,7 +179,7 @@ static LibError read_and_compress_file(const char* atom_fn, uintptr_t ctx,
// note: no need to free cdata - it is owned by the
// compression context and can be reused.
return ERR_OK;
return INFO_OK;
}
@ -195,7 +195,7 @@ LibError archive_build_init(const char* P_archive_filename, Filenames V_fns,
for(ab->num_files = 0; ab->V_fns[ab->num_files]; ab->num_files++) {}
ab->i = 0;
return ERR_OK;
return INFO_OK;
}
@ -210,7 +210,7 @@ int archive_build_continue(ArchiveBuildState* ab)
break;
ArchiveEntry ent; void* file_contents; FileIOBuf buf;
if(read_and_compress_file(V_fn, ab->ctx, ent, file_contents, buf) == ERR_OK)
if(read_and_compress_file(V_fn, ab->ctx, ent, file_contents, buf) == INFO_OK)
{
(void)zip_archive_add_file(ab->za, &ent, file_contents);
(void)file_buf_free(buf);
@ -226,7 +226,7 @@ int archive_build_continue(ArchiveBuildState* ab)
comp_free(ab->ctx); ab->ctx = 0;
(void)zip_archive_finish(ab->za);
return ERR_OK;
return INFO_OK;
}
@ -251,7 +251,7 @@ LibError archive_build(const char* P_archive_filename, Filenames V_fns)
{
int ret = archive_build_continue(&ab);
RETURN_ERR(ret);
if(ret == ERR_OK)
return ERR_OK;
if(ret == INFO_OK)
return INFO_OK;
}
}

View File

@ -66,7 +66,7 @@ static LibError LibError_from_zlib(int zlib_err, bool warn_if_failed = true)
switch(zlib_err)
{
case Z_OK:
return ERR_OK;
return INFO_OK;
case Z_STREAM_END:
err = ERR_EOF; break;
case Z_MEM_ERROR:
@ -112,7 +112,7 @@ public:
{
next_out = 0;
avail_out = 0;
return ERR_OK;
return INFO_OK;
}
virtual LibError alloc_output(size_t in_size) = 0;
@ -266,7 +266,7 @@ have_out_mem:
next_out = out_mem;
avail_out = out_mem_size;
return ERR_OK;
return INFO_OK;
}
}; // class Compressor
@ -339,7 +339,7 @@ public:
{
size_t required_size = (size_t)deflateBound(&zs, (uLong)in_size);
RETURN_ERR(alloc_output_impl(required_size));
return ERR_OK;
return INFO_OK;
}
else
WARN_RETURN(ERR_LOGIC);
@ -396,7 +396,7 @@ public:
*out = zs.next_out - zs.total_out;
*out_size = zs.total_out;
return ERR_OK;
return INFO_OK;
}

View File

@ -80,7 +80,7 @@ static SingleAllocator<PathPackage> pp_allocator;
// prepare to iterate (once) over entries in the given directory.
// if ERR_OK is returned, <d> is ready for subsequent dir_next_ent calls and
// if INFO_OK is returned, <d> is ready for subsequent dir_next_ent calls and
// must be freed via dir_close.
LibError dir_open(const char* P_path, DirIterator* di)
{
@ -110,12 +110,12 @@ LibError dir_open(const char* P_path, DirIterator* di)
return LibError_from_errno();
(void)path_package_set_dir(pdi->pp, n_path);
return ERR_OK;
return INFO_OK;
}
// return ERR_DIR_END if all entries have already been returned once,
// another negative error code, or ERR_OK on success, in which case <ent>
// another negative error code, or INFO_OK on success, in which case <ent>
// describes the next (order is unspecified) directory entry.
LibError dir_next_ent(DirIterator* di, DirEnt* ent)
{
@ -167,7 +167,7 @@ get_another_entry:
ent->size = s.st_size;
ent->mtime = s.st_mtime;
ent->name = name;
return ERR_OK;
return INFO_OK;
}
@ -181,7 +181,7 @@ LibError dir_close(DirIterator* di)
errno = 0;
if(closedir(pdi->os_dir) < 0)
return LibError_from_errno();
return ERR_OK;
return INFO_OK;
}
@ -225,7 +225,7 @@ bool file_exists(const char* fn)
{
struct stat s;
const bool warn_if_failed = false;
return file_stat_impl(fn, &s, warn_if_failed) == ERR_OK;
return file_stat_impl(fn, &s, warn_if_failed) == INFO_OK;
}
@ -300,7 +300,7 @@ LibError file_validate(const File* f)
// note: don't check atom_fn - that complains at the end of
// file_open if flags & FILE_DONT_SET_FN and has no benefit, really.
return ERR_OK;
return INFO_OK;
}
@ -370,7 +370,7 @@ LibError file_open(const char* P_fn, uint flags, File* f)
pf->fd = fd;
CHECK_FILE(f);
return ERR_OK;
return INFO_OK;
}
@ -403,7 +403,7 @@ LibError file_close(File* f)
if(f->flags & FILE_WRITE)
file_cache_invalidate(f->atom_fn);
return ERR_OK;
return INFO_OK;
}
@ -466,7 +466,7 @@ LibError file_map(File* f, void*& p, size_t& size)
have_mapping:
p = pf->mapping;
size = f->size;
return ERR_OK;
return INFO_OK;
}
@ -487,7 +487,7 @@ LibError file_unmap(File* f)
// still more than one reference remaining - done.
if(--pf->map_refs > 0)
return ERR_OK;
return INFO_OK;
// no more references: remove the mapping
void* p = pf->mapping;
@ -509,7 +509,7 @@ LibError file_init()
// convenience
file_sector_size = sys_max_sector_size();
return ERR_OK;
return INFO_OK;
}
LibError file_shutdown()
@ -517,5 +517,5 @@ LibError file_shutdown()
stats_dump();
path_shutdown();
file_io_shutdown();
return ERR_OK;
return INFO_OK;
}

View File

@ -137,12 +137,12 @@ struct DirEnt
#define DIRENT_IS_DIR(p_ent) ((p_ent)->size == -1)
// prepare to iterate (once) over entries in the given directory.
// if ERR_OK is returned, <d> is ready for subsequent dir_next_ent calls and
// if INFO_OK is returned, <d> is ready for subsequent dir_next_ent calls and
// must be freed via dir_close.
extern LibError dir_open(const char* P_path, DirIterator* d);
// return ERR_DIR_END if all entries have already been returned once,
// another negative error code, or ERR_OK on success, in which case <ent>
// another negative error code, or INFO_OK on success, in which case <ent>
// describes the next (order is unspecified) directory entry.
extern LibError dir_next_ent(DirIterator* d, DirEnt* ent);

View File

@ -1070,7 +1070,7 @@ LibError file_buf_free(FileIOBuf buf, uint fb_flags)
const bool from_heap = (fb_flags & FB_FROM_HEAP) != 0;
if(!buf)
return ERR_OK;
return INFO_OK;
size_t size; const char* atom_fn;
bool actually_removed = extant_bufs.find_and_remove(buf, size, atom_fn);
@ -1107,7 +1107,7 @@ free_immediately:
stats_buf_free();
trace_notify_free(atom_fn, size);
return ERR_OK;
return INFO_OK;
}
@ -1137,7 +1137,7 @@ LibError file_buf_set_real_fn(FileIOBuf buf, const char* atom_fn)
// note: removing and reinserting would be easiest, but would
// mess up the epoch field.
extant_bufs.replace_owner(buf, atom_fn);
return ERR_OK;
return INFO_OK;
}
@ -1182,7 +1182,7 @@ LibError file_cache_add(FileIOBuf buf, size_t size, const char* atom_fn,
file_cache.add(atom_fn, buf, size, cost);
return ERR_OK;
return INFO_OK;
}
@ -1247,7 +1247,7 @@ LibError file_cache_invalidate(const char* P_fn)
free_padded_buf(cached_buf, size);
}
return ERR_OK;
return INFO_OK;
}

View File

@ -57,7 +57,7 @@ const size_t FILE_BLOCK_SIZE = 32*KiB;
// helper routine used by functions that call back to a FileIOCB.
//
// bytes_processed is 0 if return value != { ERR_OK, INFO_CB_CONTINUE }
// bytes_processed is 0 if return value != { INFO_OK, INFO_CB_CONTINUE }
// note: don't abort if = 0: zip callback may not actually
// output anything if passed very little data.
extern LibError file_io_call_back(const void* block, size_t size,

View File

@ -150,7 +150,7 @@ LibError file_io_issue(File* f, off_t ofs, size_t size, void* p, FileIo* io)
const BlockId disk_pos = block_cache_make_id(f->atom_fn, ofs);
stats_io_check_seek(disk_pos);
return ERR_OK;
return INFO_OK;
}
@ -197,7 +197,7 @@ LibError file_io_wait(FileIo* io, void*& p, size_t& size)
p = (void*)cb->aio_buf; // cast from volatile void*
size = bytes_transferred;
return ERR_OK;
return INFO_OK;
}
@ -207,7 +207,7 @@ LibError file_io_discard(FileIo* io)
memset(pio->cb, 0, sizeof(aiocb)); // prevent further use.
aiocb_allocator.free_(pio->cb);
pio->cb = 0;
return ERR_OK;
return INFO_OK;
}
@ -224,7 +224,7 @@ LibError file_io_validate(const FileIo* io)
if(cb->aio_lio_opcode != LIO_WRITE && cb->aio_lio_opcode != LIO_READ && cb->aio_lio_opcode != LIO_NOP)
WARN_RETURN(ERR_3);
// all other aiocb fields have no invariants we could check.
return ERR_OK;
return INFO_OK;
}
@ -253,7 +253,7 @@ size_t file_sector_size;
// helper routine used by functions that call back to a FileIOCB.
//
// bytes_processed is 0 if return value != { ERR_OK, INFO_CB_CONTINUE }
// bytes_processed is 0 if return value != { INFO_OK, INFO_CB_CONTINUE }
// note: don't abort if = 0: zip callback may not actually
// output anything if passed very little data.
LibError file_io_call_back(const void* block, size_t size,
@ -266,7 +266,7 @@ LibError file_io_call_back(const void* block, size_t size,
stats_cb_finish();
// failed - reset byte count in case callback didn't
if(ret != ERR_OK && ret != INFO_CB_CONTINUE)
if(ret != INFO_OK && ret != INFO_CB_CONTINUE)
bytes_processed = 0;
CHECK_ERR(ret); // user might not have raised a warning; make sure
@ -297,7 +297,7 @@ LibError file_io_get_buf(FileIOBuf* pbuf, size_t size,
// reading into temp buffers - ok.
if(!is_write && temp && cb != 0)
return ERR_OK;
return INFO_OK;
// reading and want buffer allocated.
if(!is_write && alloc)
@ -305,12 +305,12 @@ LibError file_io_get_buf(FileIOBuf* pbuf, size_t size,
*pbuf = file_buf_alloc(size, atom_fn, fb_flags);
if(!*pbuf) // very unlikely (size totally bogus or cache hosed)
WARN_RETURN(ERR_NO_MEM);
return ERR_OK;
return INFO_OK;
}
// writing from user-specified buffer - ok
if(is_write && user)
return ERR_OK;
return INFO_OK;
WARN_RETURN(ERR_INVALID_PARAM);
}
@ -446,7 +446,7 @@ class IOManager
RETURN_ERR(file_io_get_buf(pbuf, size, f->atom_fn, f->flags, cb));
return ERR_OK;
return INFO_OK;
}
void issue(IOSlot& slot)
@ -474,7 +474,7 @@ class IOManager
LibError ret = file_io_issue(f, ofs, issue_size, buf, &slot.io);
// transfer failed - loop will now terminate after
// waiting for all pending transfers to complete.
if(ret != ERR_OK)
if(ret != INFO_OK)
err = ret;
}
@ -533,7 +533,7 @@ class IOManager
{
size_t bytes_processed;
err = file_io_call_back(block, block_size, cb, ctx, bytes_processed);
if(err == INFO_CB_CONTINUE || err == ERR_OK)
if(err == INFO_CB_CONTINUE || err == INFO_OK)
total_processed += bytes_processed;
// else: processing failed.
// loop will now terminate after waiting for all
@ -626,7 +626,7 @@ public:
file_buf_add_padding(org_buf, size, ofs_misalign);
}
if(err != INFO_CB_CONTINUE && err != ERR_OK)
if(err != INFO_CB_CONTINUE && err != INFO_OK)
return (ssize_t)err;
return bytes_transferred;
}

View File

@ -33,7 +33,7 @@ LibError file_get_sorted_dirents(const char* P_path, DirEnts& dirents)
std::sort(dirents.begin(), dirents.end(), dirent_less);
(void)dir_close(&d);
return ERR_OK;
return INFO_OK;
}
@ -55,8 +55,8 @@ LibError file_get_sorted_dirents(const char* P_path, DirEnts& dirents)
// of converting from/to native path (we just give 'em the dirent name).
LibError file_enum(const char* P_path, const FileCB cb, const uintptr_t user)
{
LibError stat_err = ERR_OK; // first error encountered by stat()
LibError cb_err = ERR_OK; // first error returned by cb
LibError stat_err = INFO_OK; // first error encountered by stat()
LibError cb_err = INFO_OK; // first error returned by cb
DirEnts dirents;
RETURN_ERR(file_get_sorted_dirents(P_path, dirents));
@ -82,7 +82,7 @@ LibError file_enum(const char* P_path, const FileCB cb, const uintptr_t user)
}
}
if(cb_err != ERR_OK)
if(cb_err != INFO_OK)
return cb_err;
return stat_err;
}
@ -154,7 +154,7 @@ LibError dir_filtered_next_ent(DirIterator* di, DirEnt* ent, const char* filter)
}
}
return ERR_OK;
return INFO_OK;
}
@ -234,7 +234,7 @@ LibError vfs_dir_enum(const char* start_path, uint flags, const char* user_filte
}
while(!dir_queue.empty());
return ERR_OK;
return INFO_OK;
}
@ -271,7 +271,7 @@ void next_numbered_filename(const char* fn_fmt,
Handle hd = vfs_dir_open(dir);
if(hd > 0)
{
while(vfs_dir_next_ent(hd, &ent, 0) == ERR_OK)
while(vfs_dir_next_ent(hd, &ent, 0) == INFO_OK)
{
if(!DIRENT_IS_DIR(&ent) && sscanf(ent.name, name_fmt, &num) == 1)
max_num = MAX(num, max_num);
@ -282,9 +282,9 @@ void next_numbered_filename(const char* fn_fmt,
else
{
DirIterator it;
if(dir_open(dir, &it) == ERR_OK)
if(dir_open(dir, &it) == INFO_OK)
{
while(dir_next_ent(&it, &ent) == ERR_OK)
while(dir_next_ent(&it, &ent) == INFO_OK)
if(!DIRENT_IS_DIR(&ent) && sscanf(ent.name, name_fmt, &num) == 1)
max_num = MAX(num, max_num);
(void)dir_close(&it);

View File

@ -80,7 +80,7 @@ static LibError convert_path(char* dst, const char* src, Conversion conv = TO_NA
// end of string - done
if(c == '\0')
return ERR_OK;
return INFO_OK;
}
}
@ -185,7 +185,7 @@ LibError file_set_root_dir(const char* argv0, const char* rel_path)
// (note: already 0-terminated, since it's static)
n_root_dir_len = strlen(n_root_dir)+1; // +1 for trailing DIR_SEP
n_root_dir[n_root_dir_len-1] = DIR_SEP;
return ERR_OK;
return INFO_OK;
}

View File

@ -252,7 +252,7 @@ LibError trace_write_to_file(const char* trace_filename)
write_entry(f, ent);
(void)fclose(f);
return ERR_OK;
return INFO_OK;
}
@ -308,7 +308,7 @@ LibError trace_read_from_file(const char* trace_filename, Trace* t)
if(t->total_ents == 0)
WARN_RETURN(ERR_TRACE_EMPTY);
return ERR_OK;
return INFO_OK;
}
@ -332,7 +332,7 @@ void trace_gen_random(size_t num_entries)
struct stat s;
LibError ret = vfs_stat(atom_fn, &s);
// ought to apply due to vfs_exists above.
debug_assert(ret == ERR_OK && S_ISREG(s.st_mode));
debug_assert(ret == INFO_OK && S_ISREG(s.st_mode));
size = s.st_size;
break;
@ -460,6 +460,6 @@ LibError trace_run(const char* trace_filename, uint flags)
trace_clear();
return ERR_OK;
return INFO_OK;
}

View File

@ -119,7 +119,7 @@ static LibError VDir_reload(VDir* vd, const char* V_dir_path, Handle UNUSED(hvd)
RETURN_ERR(xdir_open(V_dir_path, &vd->di));
vd->di_valid = 1;
return ERR_OK;
return INFO_OK;
}
static LibError VDir_validate(const VDir* vd)
@ -127,7 +127,7 @@ static LibError VDir_validate(const VDir* vd)
// note: <di> is mostly opaque and cannot be validated.
if(vd->di.filter && !isprint(vd->di.filter[0]))
WARN_RETURN(ERR_1);
return ERR_OK;
return INFO_OK;
}
static LibError VDir_to_string(const VDir* vd, char* buf)
@ -138,7 +138,7 @@ static LibError VDir_to_string(const VDir* vd, char* buf)
if(!filter)
filter = "*";
snprintf(buf, H_STRING_LEN, "(\"%s\")", filter);
return ERR_OK;
return INFO_OK;
}
@ -275,7 +275,7 @@ static LibError VFile_reload(VFile* vf, const char* V_path, Handle)
// we're done if file is already open. need to check this because
// reload order (e.g. if resource opens a file) is unspecified.
if(xfile_is_open(&vf->f))
return ERR_OK;
return INFO_OK;
TFile* tf;
uint lf = (flags & FILE_WRITE)? LF_CREATE_MISSING : 0;
@ -300,20 +300,20 @@ static LibError VFile_reload(VFile* vf, const char* V_path, Handle)
vf->is_valid = 1;
vf->tf = tf;
return ERR_OK;
return INFO_OK;
}
static LibError VFile_validate(const VFile* vf)
{
// <ofs> doesn't have any invariant we can check.
RETURN_ERR(xfile_validate(&vf->f));
return ERR_OK;
return INFO_OK;
}
static LibError VFile_to_string(const VFile* UNUSED(vf), char* buf)
{
strcpy(buf, ""); // safe
return ERR_OK;
return INFO_OK;
}
@ -419,7 +419,7 @@ LibError vfs_load(const char* V_fn, FileIOBuf& buf, size_t& size,
// accept more data - this is all it gets and we need to
// translate return value to avoid confusing callers.
if(ret == INFO_CB_CONTINUE)
ret = ERR_OK;
ret = INFO_OK;
size = actual_size;
return ret;
}
@ -448,7 +448,7 @@ LibError vfs_load(const char* V_fn, FileIOBuf& buf, size_t& size,
stats_cache(CR_MISS, size, atom_fn);
(void)vfs_close(hf);
return ERR_OK;
return INFO_OK;
}
@ -529,7 +529,7 @@ static LibError VIo_validate(const VIo* vio)
static LibError VIo_to_string(const VIo* vio, char* buf)
{
snprintf(buf, H_STRING_LEN, "buf=%p size=%d", vio->buf, vio->size);
return ERR_OK;
return INFO_OK;
}
@ -621,7 +621,7 @@ static LibError reload_without_rebuild(const char* fn)
RETURN_ERR(h_reload(fn));
return ERR_OK;
return INFO_OK;
}
@ -726,7 +726,7 @@ LibError vfs_reload_changed_files()
for(uint i = 0; i < num_pending; i++)
RETURN_ERR(reload_without_rebuild(pending_reloads[i]));
return ERR_OK;
return INFO_OK;
}

View File

@ -184,7 +184,7 @@ LibError mount_realpath(const char* V_path, const Mount* m, char* P_real_path)
if(P_len != 0 && P_real_path[P_len-1] == '/')
P_real_path[P_len-1] = '\0';
return ERR_OK;
return INFO_OK;
}
@ -278,7 +278,7 @@ static bool archive_less(Handle hza1, Handle hza2)
typedef std::vector<Handle> Archives;
typedef Archives::const_iterator ArchiveCIt;
// return value is ERR_OK iff archives != 0 and the file should not be
// return value is INFO_OK iff archives != 0 and the file should not be
// added to VFS (e.g. because it is an archive).
static LibError enqueue_archive(const char* name, const char* P_archive_dir, Archives* archives)
{
@ -308,23 +308,23 @@ static LibError enqueue_archive(const char* name, const char* P_archive_dir, Arc
archives->push_back(archive);
// avoid also adding the archive file itself to VFS.
// (when caller sees ERR_OK, they skip the file)
// (when caller sees INFO_OK, they skip the file)
do_not_add_to_VFS_or_list:
return ERR_OK;
return INFO_OK;
}
static LibError mount_archive(TDir* td, const Mount& m)
{
ZipCBParams params(td, &m);
archive_enum(m.archive, afile_cb, (uintptr_t)&params);
return ERR_OK;
return INFO_OK;
}
static LibError mount_archives(TDir* td, Archives* archives, const Mount* mount)
{
// VFS_MOUNT_ARCHIVES flag wasn't set, or no archives present
if(archives->empty())
return ERR_OK;
return INFO_OK;
std::sort(archives->begin(), archives->end(), archive_less);
@ -339,7 +339,7 @@ static LibError mount_archives(TDir* td, Archives* archives, const Mount* mount)
mount_archive(td, m);
}
return ERR_OK;
return INFO_OK;
}
@ -365,7 +365,7 @@ static LibError enqueue_dir(TDir* parent_td, const char* name,
{
// caller doesn't want us to enqueue subdirectories; bail.
if(!dir_queue)
return ERR_OK;
return INFO_OK;
// skip versioning system directories - this avoids cluttering the
// VFS with hundreds of irrelevant files.
@ -373,7 +373,7 @@ static LibError enqueue_dir(TDir* parent_td, const char* name,
// strstr the entire path) and it is assumed the Zip file builder
// will take care of it.
if(!strcmp(name, "CVS") || !strcmp(name, ".svn"))
return ERR_OK;
return INFO_OK;
// prepend parent path to get complete pathname.
char P_path[PATH_MAX];
@ -384,7 +384,7 @@ static LibError enqueue_dir(TDir* parent_td, const char* name,
CHECK_ERR(tree_add_dir(parent_td, name, &td));
// .. and add it to the list of directories to visit.
dir_queue->push_back(TDirAndPath(td, P_path));
return ERR_OK;
return INFO_OK;
}
@ -418,10 +418,10 @@ static LibError add_ent(TDir* td, DirEnt* ent, const char* P_parent_path, const
// else: it's a file (dir_next_ent discards everything except for
// file and subdirectory entries).
if(enqueue_archive(name, m->P_name.c_str(), archives) == ERR_OK)
if(enqueue_archive(name, m->P_name.c_str(), archives) == INFO_OK)
// return value indicates this file shouldn't be added to VFS
// (see enqueue_archive)
return ERR_OK;
return INFO_OK;
// notify archive builder that this file could be archived but
// currently isn't; if there are too many of these, archive will be
@ -460,7 +460,7 @@ static LibError populate_dir(TDir* td, const char* P_path, const Mount* m,
{
// don't RETURN_ERR since we need to close d.
err = dir_next_ent(&d, &ent);
if(err != ERR_OK)
if(err != INFO_OK)
break;
err = add_ent(td, &ent, P_path, m, dir_queue, archives);
@ -468,7 +468,7 @@ static LibError populate_dir(TDir* td, const char* P_path, const Mount* m,
}
WARN_ERR(dir_close(&d));
return ERR_OK;
return INFO_OK;
}
@ -486,7 +486,7 @@ static LibError populate_dir(TDir* td, const char* P_path, const Mount* m,
// every single file to see if it's an archive (slow!).
static LibError mount_dir_tree(TDir* td, const Mount& m)
{
LibError err = ERR_OK;
LibError err = INFO_OK;
// add_ent fills these queues with dirs/archives if the corresponding
// flags are set.
@ -509,7 +509,7 @@ static LibError mount_dir_tree(TDir* td, const Mount& m)
const char* P_path = dir_queue.front().path.c_str();
LibError ret = populate_dir(td, P_path, &m, pdir_queue, parchives, m.flags);
if(err == ERR_OK)
if(err == INFO_OK)
err = ret;
// prevent searching for archives in subdirectories (slow!). this
@ -524,7 +524,7 @@ static LibError mount_dir_tree(TDir* td, const Mount& m)
// do not pass parchives because that has been set to 0!
mount_archives(td, &archives, &m);
return ERR_OK;
return INFO_OK;
}
@ -666,7 +666,7 @@ LibError mount_rebuild()
{
tree_clear();
remount_all();
return ERR_OK;
return INFO_OK;
}
@ -730,8 +730,8 @@ LibError mount_make_vfs_path(const char* P_path, char* V_path)
const char* remove = m.P_name.c_str();
const char* replace = m.V_mount_point.c_str();
if(path_replace(V_path, P_path, remove, replace) == ERR_OK)
return ERR_OK;
if(path_replace(V_path, P_path, remove, replace) == INFO_OK)
return INFO_OK;
}
WARN_RETURN(ERR_TNODE_NOT_FOUND);
@ -791,7 +791,7 @@ LibError vfs_set_write_target(const char* P_target_dir)
if(!strcmp(m.P_name.c_str(), P_target_dir))
{
write_target = &m;
return ERR_OK;
return INFO_OK;
}
}
@ -814,7 +814,7 @@ LibError set_mount_to_write_target(TFile* tf)
// opened for writing, which will change these values anyway.
tree_update_file(tf, 0, 0);
return ERR_OK;
return INFO_OK;
}
@ -858,12 +858,12 @@ LibError mount_attach_real_dir(RealDir* rd, const char* P_path, const Mount* m,
// note: do not cause this function to return an error if
// something goes wrong - this step is basically optional.
char N_path[PATH_MAX];
if(file_make_full_native_path(P_path, N_path) == ERR_OK)
if(file_make_full_native_path(P_path, N_path) == INFO_OK)
(void)dir_add_watch(N_path, &rd->watch);
}
#endif
return ERR_OK;
return INFO_OK;
}
@ -884,7 +884,7 @@ LibError mount_create_real_dir(const char* V_path, const Mount* m)
debug_assert(VFS_PATH_IS_DIR(V_path));
if(!m || m == MULTIPLE_MOUNTINGS || m->type != MT_FILE)
return ERR_OK;
return INFO_OK;
char P_path[PATH_MAX];
RETURN_ERR(mount_realpath(V_path, m, P_path));
@ -897,5 +897,5 @@ LibError mount_populate(TDir* td, RealDir* rd)
{
UNUSED2(td);
UNUSED2(rd);
return ERR_OK;
return INFO_OK;
}

View File

@ -294,7 +294,7 @@ class ConnectionBuilder
// note: this happens when trace contains by now
// deleted or unarchivable files.
TFile* tf;
if(tree_lookup(te->atom_fn, &tf) == ERR_OK)
if(tree_lookup(te->atom_fn, &tf) == INFO_OK)
if(is_archivable(tf))
add_connection(connections, te->atom_fn);
}
@ -320,7 +320,7 @@ public:
add_connections_from_runs(t, connections);
return ERR_OK;
return INFO_OK;
}
};
@ -602,14 +602,14 @@ static LibError vfs_opt_init(const char* trace_filename, const char* archive_fn_
Filenames V_fns = &fn_vector[0];
RETURN_ERR(archive_build_init(archive_fn, V_fns, &ab));
return ERR_OK;
return INFO_OK;
}
static int vfs_opt_continue()
{
int ret = archive_build_continue(&ab);
if(ret == ERR_OK)
if(ret == INFO_OK)
{
// do NOT delete source files! some apps might want to
// keep them (e.g. for source control), or name them differently.
@ -674,7 +674,7 @@ static LibError build_mini_archive(const char* mini_archive_fn_fmt)
next_numbered_filename(mini_archive_fn_fmt, &nfi, mini_archive_fn, use_vfs);
RETURN_ERR(archive_build(mini_archive_fn, V_fns));
return ERR_OK;
return INFO_OK;
}
@ -709,7 +709,7 @@ int vfs_opt_auto_build(const char* trace_filename,
RETURN_ERR(build_mini_archive(mini_archive_fn_fmt));
state = NOP;
return ERR_OK; // "finished"
return INFO_OK; // "finished"
}
}
@ -717,7 +717,7 @@ int vfs_opt_auto_build(const char* trace_filename,
{
int ret = vfs_opt_continue();
// just finished
if(ret == ERR_OK)
if(ret == INFO_OK)
state = NOP;
return ret;
}
@ -731,7 +731,7 @@ LibError vfs_opt_rebuild_main_archive(const char* trace_filename, const char* ar
{
int ret = vfs_opt_auto_build(trace_filename, archive_fn_fmt, 0, true);
RETURN_ERR(ret);
if(ret == ERR_OK)
return ERR_OK;
if(ret == INFO_OK)
return INFO_OK;
}
}

View File

@ -51,7 +51,7 @@ LibError file_open_vfs(const char* V_path, uint flags, TFile* tf,
RETURN_ERR(file_open(N_path, flags|FILE_DONT_SET_FN, f));
// file_open didn't set fc.atom_fn due to FILE_DONT_SET_FN.
f->atom_fn = file_make_unique_fn_copy(V_path);
return ERR_OK;
return INFO_OK;
}
static const FileProvider_VTbl archive_vtbl =
@ -99,7 +99,7 @@ static LibError vtbl_validate(const FileProvider_VTbl* vtbl)
WARN_RETURN(ERR_INVALID_PARAM);
if(vtbl->magic != vtbl_magic)
WARN_RETURN(ERR_CORRUPTED);
return ERR_OK;
return INFO_OK;
}
#define CHECK_VTBL(type) RETURN_ERR(vtbl_validate(type))
@ -163,7 +163,7 @@ const FileProvider_VTbl* vtbl = (c == 'F')? &file_vtbl : &archive_vtbl;
// note: don't assign these unless we succeed to avoid the
// false impression that all is well.
f->type = vtbl;
return ERR_OK;
return INFO_OK;
}
LibError xfile_close(File* f)
@ -173,7 +173,7 @@ LibError xfile_close(File* f)
// the dtor after reload fails.
// note: this takes care of checking the vtbl.
if(!xfile_is_open(f))
return ERR_OK;
return INFO_OK;
LibError ret = f->type->file_close(f);
f->type = 0;
return ret;

View File

@ -265,7 +265,7 @@ RealDir rd; // HACK; removeme
children.insert(name, node);
*pnode = node;
return ERR_OK;
return INFO_OK;
}
LibError find_and_add(const char* name, TNodeType type, TNode** pnode, const Mount* m = 0)
@ -447,7 +447,7 @@ static LibError lookup(TDir* td, const char* path, uint flags, TNode** pnode)
// success.
*pnode = p.node;
return ERR_OK;
return INFO_OK;
}
@ -567,7 +567,7 @@ LibError tree_add_file(TDir* td, const char* name,
stats_vfs_file_add(size);
set_most_recent_if_newer(mtime);
return ERR_OK;
return INFO_OK;
}
@ -576,7 +576,7 @@ LibError tree_add_dir(TDir* td, const char* name, TDir** ptd)
TNode* node;
RETURN_ERR(td->find_and_add(name, NT_DIR, &node));
*ptd = (TDir*)node;
return ERR_OK;
return INFO_OK;
}
@ -592,7 +592,7 @@ LibError tree_lookup_dir(const char* V_path, TDir** ptd, uint flags)
CHECK_ERR(lookup(td, V_path, flags, &node));
// directories should exist, so warn if this fails
*ptd = (TDir*)node;
return ERR_OK;
return INFO_OK;
}
@ -606,7 +606,7 @@ LibError tree_lookup(const char* V_path, TFile** pfile, uint flags)
LibError ret = lookup(tree_root, V_path, flags, &node);
RETURN_ERR(ret);
*pfile = (TFile*)node;
return ERR_OK;
return INFO_OK;
}
@ -647,7 +647,7 @@ LibError tree_add_path(const char* V_dir_path, const Mount* m, TDir** ptd)
AddPathCbParams p(m);
RETURN_ERR(path_foreach_component(V_dir_path, add_path_cb, &p));
*ptd = p.td;
return ERR_OK;
return INFO_OK;
}
@ -691,7 +691,7 @@ LibError tree_dir_open(const char* V_dir_path, DirIterator* di)
tdi->it = td->begin();
tdi->end = td->end();
tdi->td = td;
return ERR_OK;
return INFO_OK;
}
@ -725,7 +725,7 @@ LibError tree_dir_next_ent(DirIterator* di, DirEnt* ent)
debug_warn("invalid TNode type");
}
return ERR_OK;
return INFO_OK;
}
@ -735,7 +735,7 @@ LibError tree_dir_close(DirIterator* UNUSED(d))
// no further cleanup needed. we could zero out d but that might
// hide bugs; the iterator is safe (will not go beyond end) anyway.
return ERR_OK;
return INFO_OK;
}
@ -780,7 +780,7 @@ LibError tree_stat(const TFile* tf, struct stat* s)
s->st_size = tf->size;
s->st_mtime = tf->mtime;
return ERR_OK;
return INFO_OK;
}

View File

@ -73,7 +73,7 @@ enum TreeLookupFlags
// a higher-priority file of the same name already exists
// (used by VFile_reload when opening for writing).
//
// output params are only valid if ERR_OK is returned.
// output params are only valid if INFO_OK is returned.
extern LibError tree_lookup(const char* path, TFile** ptf, uint flags = 0);
// starting at VFS root, traverse <path> and pass back information
@ -87,7 +87,7 @@ extern LibError tree_lookup(const char* path, TFile** ptf, uint flags = 0);
// <path> can be to a file or dir (in which case it must end in '/',
// to make sure the last component is treated as a directory).
//
// output params are only valid if ERR_OK is returned.
// output params are only valid if INFO_OK is returned.
extern LibError tree_lookup_dir(const char* V_path, TDir** ptd, uint flags = 0);

View File

@ -365,7 +365,7 @@ static const u8* za_find_id(const u8* buf, size_t size, const void* start, u32 m
// search for ECDR in the last <max_scan_amount> bytes of the file.
// if found, fill <dst_ecdr> with a copy of the (little-endian) ECDR and
// return ERR_OK, otherwise IO error or ERR_CORRUPTED.
// return INFO_OK, otherwise IO error or ERR_CORRUPTED.
static LibError za_find_ecdr(File* f, size_t max_scan_amount, ECDR* dst_ecdr_le)
{
// don't scan more than the entire file
@ -386,7 +386,7 @@ static LibError za_find_ecdr(File* f, size_t max_scan_amount, ECDR* dst_ecdr_le)
if(ecdr_le)
{
*dst_ecdr_le = *ecdr_le;
ret = ERR_OK;
ret = INFO_OK;
}
file_buf_free(buf);
@ -413,17 +413,17 @@ completely_bogus:
// expected case: ECDR at EOF; no file comment (=> we only need to
// read 512 bytes)
LibError ret = za_find_ecdr(f, ECDR_SIZE, &ecdr_le);
if(ret == ERR_OK)
if(ret == INFO_OK)
{
have_ecdr:
ecdr_decompose(&ecdr_le, cd_entries, cd_ofs, cd_size);
return ERR_OK;
return INFO_OK;
}
// last resort: scan last 66000 bytes of file
// (the Zip archive comment field - up to 64k - may follow ECDR).
// if the zip file is < 66000 bytes, scan the whole file.
ret = za_find_ecdr(f, 66000u, &ecdr_le);
if(ret == ERR_OK)
if(ret == INFO_OK)
goto have_ecdr;
// both ECDR scans failed - this is not a valid Zip file.
@ -451,7 +451,7 @@ have_ecdr:
// analyse an opened Zip file; call back into archive.cpp to
// populate the Archive object with a list of the files it contains.
// returns ERR_OK on success, ERR_CORRUPTED if file is recognizable as
// returns INFO_OK on success, ERR_CORRUPTED if file is recognizable as
// a Zip file but invalid, otherwise ERR_UNKNOWN_FORMAT or IO error.
//
// fairly slow - must read Central Directory from disk
@ -471,7 +471,7 @@ LibError zip_populate_archive(File* f, Archive* a)
RETURN_ERR(file_io(f, cd_ofs, cd_size, &buf));
// iterate through Central Directory
LibError ret = ERR_OK;
LibError ret = INFO_OK;
const CDFH* cdfh = (const CDFH*)buf;
size_t ofs_to_next_cdfh = 0;
for(uint i = 0; i < cd_entries; i++)
@ -494,7 +494,7 @@ LibError zip_populate_archive(File* f, Archive* a)
if(ae.csize && ae.ucsize)
{
ret = archive_add_file(a, &ae);
if(ret != ERR_OK)
if(ret != INFO_OK)
break;
}
}
@ -605,7 +605,7 @@ LibError zip_archive_create(const char* zip_filename, ZipArchive** pza)
WARN_RETURN(ERR_NO_MEM);
*za = za_copy;
*pza = za;
return ERR_OK;
return INFO_OK;
}
@ -645,7 +645,7 @@ LibError zip_archive_add_file(ZipArchive* za, const ArchiveEntry* ae, void* file
za->cd_entries++;
return ERR_OK;
return INFO_OK;
}
@ -669,5 +669,5 @@ LibError zip_archive_finish(ZipArchive* za)
(void)file_close(&za->f);
(void)pool_destroy(&za->cdfhs);
za_mgr.release(za);
return ERR_OK;
return INFO_OK;
}

View File

@ -30,7 +30,7 @@ struct ArchiveEntry;
// analyse an opened Zip file; call back into archive.cpp to
// populate the Archive object with a list of the files it contains.
// returns ERR_OK on success, ERR_CORRUPTED if file is recognizable as
// returns INFO_OK on success, ERR_CORRUPTED if file is recognizable as
// a Zip file but invalid, otherwise ERR_UNKNOWN_FORMAT or IO error.
//
// fairly slow - must read Central Directory from disk
@ -70,8 +70,4 @@ extern LibError zip_archive_add_file(ZipArchive* za, const ArchiveEntry* ae, voi
// IO cost: writes out Central Directory to disk (about 70 bytes per file).
extern LibError zip_archive_finish(ZipArchive* za);
template<typename T> u32 u32_from_larger2(T x);
template<typename T> u16 u16_from_larger2(T x);
#endif // #ifndef ZIP_H__

View File

@ -121,7 +121,7 @@ public:
(void)ogl_tex_set_filter(ht, GL_NEAREST);
(void)ogl_tex_upload(ht);
return ERR_OK;
return INFO_OK;
}
void destroy()
@ -158,7 +158,7 @@ public:
WARN_RETURN(ERR_1);
if(ht < 0)
WARN_RETURN(ERR_2);
return ERR_OK;
return INFO_OK;
}
};
@ -214,13 +214,13 @@ static LibError Cursor_reload(Cursor* c, const char* name, Handle)
{
LibError err=c->gl_cursor.create(filename, hotspotx, hotspoty);
if (err == ERR_OK)
if (err == INFO_OK)
c->gl_sys_cursor = load_empty_sys_cursor();
return err;
}
return ERR_OK;
return INFO_OK;
}
static LibError Cursor_validate(const Cursor* c)
@ -230,14 +230,14 @@ static LibError Cursor_validate(const Cursor* c)
if(!c->sys_cursor)
RETURN_ERR(c->gl_cursor.validate());
return ERR_OK;
return INFO_OK;
}
static LibError Cursor_to_string(const Cursor* c, char* buf)
{
const char* type = c->sys_cursor? "sys" : "gl";
snprintf(buf, H_STRING_LEN, "(%s)", type);
return ERR_OK;
return INFO_OK;
}
@ -268,7 +268,7 @@ LibError cursor_draw(const char* name, int x, int y)
if(!name)
{
WARN_ERR(sys_cursor_set(0));
return ERR_OK;
return INFO_OK;
}
Handle hc = cursor_load(name);
@ -287,5 +287,5 @@ LibError cursor_draw(const char* name, int x, int y)
}
(void)cursor_free(hc);
return ERR_OK;
return INFO_OK;
}

View File

@ -87,7 +87,7 @@ static LibError Ogl_Shader_reload(Ogl_Shader* shdr, const char* filename, Handle
LibError err = ERR_FAIL;
if (shdr->id)
return ERR_OK;
return INFO_OK;
FileIOBuf file;
size_t file_size;
@ -148,7 +148,7 @@ static LibError Ogl_Shader_reload(Ogl_Shader* shdr, const char* filename, Handle
}
(void)file_buf_free(file);
return ERR_OK;
return INFO_OK;
fail_shadercreated:
pglDeleteObjectARB(shdr->id);
@ -173,13 +173,13 @@ static void Ogl_Shader_dtor(Ogl_Shader* shdr)
static LibError Ogl_Shader_validate(const Ogl_Shader* UNUSED(shdr))
{
// TODO
return ERR_OK;
return INFO_OK;
}
static LibError Ogl_Shader_to_string(const Ogl_Shader* UNUSED(shdr), char* buf)
{
snprintf(buf, H_STRING_LEN, "");
return ERR_OK;
return INFO_OK;
}
@ -212,7 +212,7 @@ LibError ogl_shader_attach(GLhandleARB program, Handle& h)
pglAttachObjectARB(program, shdr->id);
return ERR_OK;
return INFO_OK;
}
@ -283,7 +283,7 @@ static LibError do_load_shader(
// TODO: How will this work with automatic reload?
ogl_shader_free(hshader);
return ERR_OK;
return INFO_OK;
}
@ -291,7 +291,7 @@ static LibError do_load_shader(
static LibError Ogl_Program_reload(Ogl_Program* p, const char* filename, Handle h)
{
if (p->id)
return ERR_OK;
return INFO_OK;
oglCheck();
@ -377,7 +377,7 @@ static LibError Ogl_Program_reload(Ogl_Program* p, const char* filename, Handle
WARN_RETURN(ERR_SHDR_LINK);
}
return ERR_OK;
return INFO_OK;
}
@ -394,13 +394,13 @@ static void Ogl_Program_dtor(Ogl_Program* p)
static LibError Ogl_Program_validate(const Ogl_Program* UNUSED(p))
{
// TODO
return ERR_OK;
return INFO_OK;
}
static LibError Ogl_Program_to_string(const Ogl_Program* UNUSED(p), char* buf)
{
snprintf(buf, H_STRING_LEN, "");
return ERR_OK;
return INFO_OK;
}
@ -428,7 +428,7 @@ LibError ogl_program_use(Handle h)
if (!h)
{
pglUseProgramObjectARB(0);
return ERR_OK;
return INFO_OK;
}
Ogl_Program* p = H_USER_DATA(h, Ogl_Program);
@ -439,7 +439,7 @@ LibError ogl_program_use(Handle h)
}
pglUseProgramObjectARB(p->id);
return ERR_OK;
return INFO_OK;
}

View File

@ -409,7 +409,7 @@ static LibError OglTex_reload(OglTex* ot, const char* fn, Handle h)
{
// we're reusing a freed but still in-memory OglTex object
if(ot->flags & OT_IS_UPLOADED)
return ERR_OK;
return INFO_OK;
// if we don't already have the texture in memory (*), load from file.
// * this happens if the texture is "wrapped".
@ -424,7 +424,7 @@ static LibError OglTex_reload(OglTex* ot, const char* fn, Handle h)
if(ot->flags & OT_NEED_AUTO_UPLOAD)
(void)ogl_tex_upload(h);
return ERR_OK;
return INFO_OK;
}
static LibError OglTex_validate(const OglTex* ot)
@ -466,13 +466,13 @@ static LibError OglTex_validate(const OglTex* ot)
// .. note: don't check ot->fmt and ot->int_fmt - they aren't set
// until during ogl_tex_upload.
return ERR_OK;
return INFO_OK;
}
static LibError OglTex_to_string(const OglTex* ot, char* buf)
{
snprintf(buf, H_STRING_LEN, "id=%d", ot->id);
return ERR_OK;
return INFO_OK;
}
@ -585,7 +585,7 @@ LibError ogl_tex_set_filter(Handle ht, GLint filter)
warn_if_uploaded(ht, ot);
ot->state.filter = filter;
}
return ERR_OK;
return INFO_OK;
}
@ -605,7 +605,7 @@ LibError ogl_tex_set_wrap(Handle ht, GLint wrap)
warn_if_uploaded(ht, ot);
ot->state.wrap = wrap;
}
return ERR_OK;
return INFO_OK;
}
@ -690,7 +690,7 @@ static LibError get_mipmaps(Tex* t, GLint filter, uint q_flags, int* plevels_to_
*plevels_to_skip = TEX_BASE_LEVEL_ONLY;
if(!need_mipmaps)
return ERR_OK;
return INFO_OK;
// image already contains pregenerated mipmaps; we need do nothing.
// this is the nicest case, because they are fastest to load
@ -735,7 +735,7 @@ static LibError get_mipmaps(Tex* t, GLint filter, uint q_flags, int* plevels_to_
*plevels_to_skip = log2(reduce);
}
return ERR_OK;
return INFO_OK;
}
@ -806,7 +806,7 @@ LibError ogl_tex_upload(const Handle ht, GLenum fmt_ovr, uint q_flags_ovr, GLint
// upload already happened; no work to do.
// (this also happens if a cached texture is "loaded")
if(ot->flags & OT_IS_UPLOADED)
return ERR_OK;
return INFO_OK;
debug_assert(ot->flags & OT_TEX_VALID);
@ -851,7 +851,7 @@ LibError ogl_tex_upload(const Handle ht, GLenum fmt_ovr, uint q_flags_ovr, GLint
ot->flags &= ~OT_TEX_VALID;
}
return ERR_OK;
return INFO_OK;
}
@ -871,7 +871,7 @@ LibError ogl_tex_get_size(Handle ht, uint* w, uint* h, uint* bpp)
*h = ot->t.h;
if(bpp)
*bpp = ot->t.bpp;
return ERR_OK;
return INFO_OK;
}
@ -890,7 +890,7 @@ LibError ogl_tex_get_format(Handle ht, uint* flags, GLenum* fmt)
debug_warn("hasn't been defined yet!");
*fmt = ot->fmt;
}
return ERR_OK;
return INFO_OK;
}
@ -906,7 +906,7 @@ LibError ogl_tex_get_data(Handle ht, void** p)
H_DEREF(ht, OglTex, ot);
*p = tex_get_data(&ot->t);
return ERR_OK;
return INFO_OK;
}
@ -935,7 +935,7 @@ LibError ogl_tex_bind(Handle ht, uint unit)
if(ht == 0)
{
glDisable(GL_TEXTURE_2D);
return ERR_OK;
return INFO_OK;
}
// if this fails, the texture unit's state remains unchanged.
@ -951,7 +951,7 @@ LibError ogl_tex_bind(Handle ht, uint unit)
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ot->id);
return ERR_OK;
return INFO_OK;
}

View File

@ -70,7 +70,7 @@ LibError tex_validate(const Tex* t)
if(orientation == (TEX_BOTTOM_UP|TEX_TOP_DOWN))
WARN_RETURN(ERR_4);
return ERR_OK;
return INFO_OK;
}
#define CHECK_TEX(t) RETURN_ERR(tex_validate(t))
@ -94,14 +94,14 @@ LibError tex_validate_plain_format(uint bpp, uint flags)
if(grey)
{
if(bpp == 8 && !alpha)
return ERR_OK;
return INFO_OK;
WARN_RETURN(ERR_TEX_FMT_INVALID);
}
if(bpp == 24 && !alpha)
return ERR_OK;
return INFO_OK;
if(bpp == 32 && alpha)
return ERR_OK;
return INFO_OK;
WARN_RETURN(ERR_TEX_FMT_INVALID);
}
@ -254,7 +254,7 @@ static LibError add_mipmaps(Tex* t, uint w, uint h, uint bpp,
t->hm = hm;
t->ofs = 0;
return ERR_OK;
return INFO_OK;
}
@ -292,7 +292,7 @@ TIMER_ACCRUE(tc_plain_transform);
RETURN_ERR(tex_validate_plain_format(bpp, flags));
// .. nothing to do
if(!transforms)
return ERR_OK;
return INFO_OK;
// allocate copy of the image data.
// rationale: L1 cache is typically A2 => swapping in-place with a
@ -372,7 +372,7 @@ TIMER_ACCRUE(tc_plain_transform);
RETURN_ERR(add_mipmaps(t, w, h, bpp, new_data, data_size));
CHECK_TEX(t);
return ERR_OK;
return INFO_OK;
}
@ -392,7 +392,7 @@ LibError tex_transform(Tex* t, uint transforms)
remaining_transforms = target_flags ^ t->flags;
// we're finished (all required transforms have been done)
if(remaining_transforms == 0)
return ERR_OK;
return INFO_OK;
LibError ret = tex_codec_transform(t, remaining_transforms);
if(ret != 0)
@ -401,7 +401,7 @@ LibError tex_transform(Tex* t, uint transforms)
// last chance
RETURN_ERR(plain_transform(t, remaining_transforms));
return ERR_OK;
return INFO_OK;
}
@ -487,7 +487,7 @@ bool tex_is_known_extension(const char* filename)
{
const TexCodecVTbl* dummy;
// found codec for it => known extension
if(tex_codec_for_filename(filename, &dummy) == ERR_OK)
if(tex_codec_for_filename(filename, &dummy) == INFO_OK)
return true;
return false;
@ -527,7 +527,7 @@ LibError tex_wrap(uint w, uint h, uint bpp, uint flags, void* img, Tex* t)
t->ofs = (u8*)img - (u8*)reported_ptr;
CHECK_TEX(t);
return ERR_OK;
return INFO_OK;
}
@ -651,7 +651,7 @@ LibError tex_decode(const u8* data, size_t data_size, MEM_DTOR dtor, Tex* t)
flip_to_global_orientation(t);
return ERR_OK;
return INFO_OK;
}
@ -679,7 +679,7 @@ LibError tex_encode(Tex* t, const char* fn, DynArray* da)
WARN_RETURN(err);
}
return ERR_OK;
return INFO_OK;
}
@ -709,7 +709,7 @@ LibError tex_load(const char* fn, Tex* t, uint file_flags)
// wasn't compressed) or was replaced by a new buffer for the image data.
CHECK_TEX(t);
return ERR_OK;
return INFO_OK;
}
@ -722,7 +722,7 @@ LibError tex_write(Tex* t, const char* fn)
RETURN_ERR(tex_encode(t, fn, &da));
// write to disk
LibError ret = ERR_OK;
LibError ret = INFO_OK;
{
const size_t sector_aligned_size = round_up(da.cur_size, file_sector_size);
(void)da_set_size(&da, sector_aligned_size);

View File

@ -118,7 +118,7 @@ static LibError bmp_decode(DynArray* restrict da, Tex* restrict t)
t->h = h;
t->bpp = bpp;
t->flags = flags;
return ERR_OK;
return INFO_OK;
}

View File

@ -60,7 +60,7 @@ LibError tex_codec_for_filename(const char* fn, const TexCodecVTbl** c)
{
// we found it
if((*c)->is_ext(ext))
return ERR_OK;
return INFO_OK;
}
return ERR_UNKNOWN_FORMAT; // NOWARN
@ -78,7 +78,7 @@ LibError tex_codec_for_header(const u8* file, size_t file_size, const TexCodecVT
{
// we found it
if((*c)->is_hdr(file))
return ERR_OK;
return INFO_OK;
}
WARN_RETURN(ERR_UNKNOWN_FORMAT);
@ -105,8 +105,8 @@ LibError tex_codec_transform(Tex* t, uint transforms)
{
LibError err = c->transform(t, transforms);
// success
if(err == ERR_OK)
return ERR_OK;
if(err == INFO_OK)
return INFO_OK;
// something went wrong
else if(err != INFO_TEX_CODEC_CANNOT_HANDLE)
{
@ -164,7 +164,7 @@ LibError tex_codec_alloc_rows(const u8* data, size_t h, size_t pitch,
}
debug_assert(pos == end);
return ERR_OK;
return INFO_OK;
}
@ -175,5 +175,5 @@ LibError tex_codec_write(Tex* t, uint transforms, const void* hdr, size_t hdr_si
void* img_data = tex_get_data(t); const size_t img_size = tex_img_size(t);
RETURN_ERR(da_append(da, hdr, hdr_size));
RETURN_ERR(da_append(da, img_data, img_size));
return ERR_OK;
return INFO_OK;
}

View File

@ -301,7 +301,7 @@ static LibError s3tc_decompress(Tex* t)
t->ofs = 0;
t->bpp = out_bpp;
t->flags &= ~TEX_DXT;
return ERR_OK;
return INFO_OK;
}
@ -492,7 +492,7 @@ static LibError decode_pf(const DDPIXELFORMAT* pf, uint* bpp_, uint* flags_)
*bpp_ = bpp;
*flags_ = flags;
return ERR_OK;
return INFO_OK;
}
@ -580,7 +580,7 @@ static LibError decode_sd(const DDSURFACEDESC2* sd, uint* w_, uint* h_,
*h_ = h;
*bpp_ = bpp;
*flags_ = flags;
return ERR_OK;
return INFO_OK;
}
@ -618,7 +618,7 @@ static LibError dds_decode(DynArray* restrict da, Tex* restrict t)
t->h = h;
t->bpp = bpp;
t->flags = flags;
return ERR_OK;
return INFO_OK;
}
@ -640,7 +640,7 @@ static LibError dds_transform(Tex* t, uint transforms)
if(dxt && transform_dxt)
{
RETURN_ERR(s3tc_decompress(t));
return ERR_OK;
return INFO_OK;
}
// both are DXT (unsupported; there are no flags we can change while
// compressed) or requesting compression (not implemented) or

View File

@ -499,7 +499,7 @@ static LibError jpg_decode_impl(DynArray* da,
// mem data source.
(void)jpeg_finish_decompress(cinfo);
LibError ret = ERR_OK;
LibError ret = INFO_OK;
if(cinfo->err->num_warnings != 0)
ret = WARN_TEX_INVALID_DATA;
@ -560,7 +560,7 @@ static LibError jpg_encode_impl(Tex* t,
jpeg_finish_compress(cinfo);
LibError ret = ERR_OK;
LibError ret = INFO_OK;
if(cinfo->err->num_warnings != 0)
ret = WARN_TEX_INVALID_DATA;

View File

@ -146,7 +146,7 @@ static LibError png_decode_impl(DynArray* da,
t->bpp = bpp;
t->flags = flags;
return ERR_OK;
return INFO_OK;
}
@ -189,7 +189,7 @@ static LibError png_encode_impl(Tex* t,
png_set_rows(png_ptr, info_ptr, (png_bytepp)rows);
png_write_png(png_ptr, info_ptr, png_transforms, 0);
return ERR_OK;
return INFO_OK;
}

View File

@ -138,7 +138,7 @@ static LibError tga_decode(DynArray* restrict da, Tex* restrict t)
t->h = h;
t->bpp = bpp;
t->flags = flags;
return ERR_OK;
return INFO_OK;
}

View File

@ -64,7 +64,7 @@ static LibError UniFont_reload(UniFont* f, const char* fn, Handle UNUSED(h))
{
// already loaded
if(f->ht > 0)
return ERR_OK;
return INFO_OK;
f->glyphs_id = new glyphmap_id;
f->glyphs_size = new glyphmap_size;
@ -163,7 +163,7 @@ static LibError UniFont_reload(UniFont* f, const char* fn, Handle UNUSED(h))
}
f->ht = ht;
return ERR_OK;
return INFO_OK;
}
static LibError UniFont_validate(const UniFont* f)
@ -178,13 +178,13 @@ static LibError UniFont_validate(const UniFont* f)
WARN_RETURN(ERR_3);
if(f->ListBase == 0 || f->ListBase > 1000000) // suspicious
WARN_RETURN(ERR_4);
return ERR_OK;
return INFO_OK;
}
static LibError UniFont_to_string(const UniFont* UNUSED(f), char* buf)
{
snprintf(buf, H_STRING_LEN, "");
return ERR_OK;
return INFO_OK;
}
@ -208,7 +208,7 @@ LibError unifont_bind(const Handle h)
glListBase(f->ListBase);
BoundGlyphs = f->glyphs_id;
return ERR_OK;
return INFO_OK;
}
@ -308,11 +308,11 @@ LibError unifont_stringsize(const Handle h, const wchar_t* text, int& width, int
if (it == f->glyphs_size->end()) // Missing the missing glyph symbol - give up
{
debug_warn("Missing the missing glyph in a unifont!\n");
return ERR_OK;
return INFO_OK;
}
width += it->second; // Add the character's advance distance
}
return ERR_OK;
return INFO_OK;
}

View File

@ -313,7 +313,7 @@ have_idx:;
if(idx > last_in_use)
last_in_use = idx;
return ERR_OK;
return INFO_OK;
}
@ -321,7 +321,7 @@ static LibError free_idx(i32 idx)
{
if(first_free == -1 || idx < first_free)
first_free = idx;
return ERR_OK;
return INFO_OK;
}
@ -488,7 +488,7 @@ static void warn_if_invalid(HDATA* hd)
// have the resource validate its user_data
LibError err = vtbl->validate(hd->user);
debug_assert(err == ERR_OK);
debug_assert(err == INFO_OK);
// make sure empty space in control block isn't touched
// .. but only if we're not storing a filename there
@ -515,7 +515,7 @@ static LibError type_validate(H_Type type)
if(type->name == 0)
WARN_RETURN(ERR_INVALID_PARAM);
return ERR_OK;
return INFO_OK;
}
@ -567,7 +567,7 @@ static Handle reuse_existing_handle(uintptr_t key, H_Type type, uint flags)
static LibError call_init_and_reload(Handle h, H_Type type, HDATA* hd, const char* fn, va_list* init_args)
{
LibError err = ERR_OK;
LibError err = INFO_OK;
H_VTbl* vtbl = type; // exact same thing but for clarity
// init
@ -581,7 +581,7 @@ static LibError call_init_and_reload(Handle h, H_Type type, HDATA* hd, const cha
try
{
err = vtbl->reload(hd->user, fn, h);
if(err == ERR_OK)
if(err == INFO_OK)
warn_if_invalid(hd);
}
catch(std::bad_alloc)
@ -694,7 +694,7 @@ static LibError h_free_idx(i32 idx, HDATA* hd)
// still references open or caching requests it stays - do not release.
if(hd->refs > 0 || hd->keep_open)
return ERR_OK;
return INFO_OK;
// actually release the resource (call dtor, free control block).
@ -732,7 +732,7 @@ static LibError h_free_idx(i32 idx, HDATA* hd)
free_idx(idx);
return ERR_OK;
return INFO_OK;
}
@ -751,7 +751,7 @@ LibError h_free(Handle& h, H_Type type)
// 0-initialized or an error code; don't complain because this
// happens often and is harmless.
if(h_copy <= 0)
return ERR_OK;
return INFO_OK;
// this was a valid handle but was probably freed in the meantime.
// complain because this probably indicates a bug somewhere.
WARN_RETURN(ERR_INVALID_HANDLE);
@ -818,7 +818,7 @@ LibError h_reload(const char* fn)
hd->type->dtor(hd->user);
}
LibError ret = ERR_OK;
LibError ret = INFO_OK;
// now reload all affected handles
for(i32 i = 0; i <= last_in_use; i++)

View File

@ -182,7 +182,7 @@ static void Mem_dtor(Mem* m)
static LibError Mem_reload(Mem* m, const char* UNUSED(fn), Handle hm)
{
set_alloc(m->raw_p, hm);
return ERR_OK;
return INFO_OK;
}
static LibError Mem_validate(const Mem* m)
@ -195,7 +195,7 @@ static LibError Mem_validate(const Mem* m)
WARN_RETURN(ERR_3);
if(m->raw_size && m->raw_size < m->size)
WARN_RETURN(ERR_4);
return ERR_OK;
return INFO_OK;
}
static LibError Mem_to_string(const Mem* m, char* buf)
@ -210,7 +210,7 @@ static LibError Mem_to_string(const Mem* m, char* buf)
}
snprintf(buf, H_STRING_LEN, "p=%p size=%d owner=%s", m->p, m->size, owner_sym);
return ERR_OK;
return INFO_OK;
}
@ -253,7 +253,7 @@ LibError mem_free_h(Handle& hm)
LibError mem_free_p(void*& p)
{
if(!p)
return ERR_OK;
return INFO_OK;
Handle hm;
{
@ -318,7 +318,7 @@ LibError mem_assign_user(Handle hm, void* user_p, size_t user_size)
m->p = user_p;
m->size = user_size;
return ERR_OK;
return INFO_OK;
}
*/
@ -420,7 +420,7 @@ LibError mem_get(Handle hm, u8** pp, size_t* psize)
if(psize)
*psize = m->size;
// leave hm locked
return ERR_OK;
return INFO_OK;
}

View File

@ -182,7 +182,7 @@ LibError snd_dev_set(const char* alc_new_dev_name)
{
// already using that device - done. (don't re-init)
if(alc_dev_name && !strcmp(alc_dev_name, alc_new_dev_name))
return ERR_OK;
return INFO_OK;
// store name (need to copy it, since alc_init is called later,
// and it must then still be valid)
@ -195,7 +195,7 @@ LibError snd_dev_set(const char* alc_new_dev_name)
{
// already using default device - done. (don't re-init)
if(alc_dev_name == 0)
return ERR_OK;
return INFO_OK;
alc_dev_name = 0;
}
@ -232,7 +232,7 @@ static void alc_shutdown()
*/
static LibError alc_init()
{
LibError ret = ERR_OK;
LibError ret = INFO_OK;
#if WIN_LOADLIBRARY_HACK
HMODULE dlls[3];
@ -346,7 +346,7 @@ LibError snd_set_master_gain(float gain)
// position will get sent too.
// this isn't called often, so we don't care.
return ERR_OK;
return INFO_OK;
}
@ -561,7 +561,7 @@ LibError snd_set_max_voices(uint limit)
if(!al_src_allocated || limit < al_src_allocated)
{
al_src_cap = limit;
return ERR_OK;
return INFO_OK;
}
// user is requesting a cap higher than what we actually allocated.
// that's fine (not an error), but we won't set the cap, since it
@ -569,7 +569,7 @@ LibError snd_set_max_voices(uint limit)
// there's no return value to indicate this because the cap is
// precisely that - an upper limit only, we don't care if it can't be met.
else
return ERR_OK;
return INFO_OK;
}
@ -591,7 +591,7 @@ static LibError al_init()
{
// only take action on first call, OR when re-initializing.
if(al_initialized)
return ERR_OK;
return INFO_OK;
RETURN_ERR(alc_init());
@ -601,7 +601,7 @@ static LibError al_init()
al_src_init();
al_listener_latch();
return ERR_OK;
return INFO_OK;
}
@ -645,7 +645,7 @@ static LibError al_reinit()
// not yet initialized. settings have been saved, and will be
// applied by the component init routines called from al_init.
if(!al_initialized)
return ERR_OK;
return INFO_OK;
// re-init (stops all currently playing sounds)
al_shutdown();
@ -682,7 +682,7 @@ LibError snd_dev_prepare_enum()
WARN_RETURN(ERR_NO_SYS);
devs = (const char*)alcGetString(0, ALC_DEVICE_SPECIFIER);
return ERR_OK;
return INFO_OK;
}
@ -845,7 +845,7 @@ struct Stream
static LibError stream_issue(Stream* s)
{
if(s->active_ios >= MAX_IOS)
return ERR_OK;
return INFO_OK;
void* buf = io_buf_alloc();
if(!buf)
@ -854,7 +854,7 @@ static LibError stream_issue(Stream* s)
Handle h = vfs_io_issue(s->hf, STREAM_BUF_SIZE, buf);
RETURN_ERR(h);
s->ios[s->active_ios++] = h;
return ERR_OK;
return INFO_OK;
}
@ -885,7 +885,7 @@ static LibError stream_buf_get(Stream* s, void*& data, size_t& size)
// (next stream_buf_discard will free this buffer)
s->last_buf = data;
return ERR_OK;
return INFO_OK;
}
@ -941,7 +941,7 @@ static LibError stream_open(Stream* s, const char* fn)
for(int i = 0; i < MAX_IOS; i++)
RETURN_ERR(stream_issue(s));
return ERR_OK;
return INFO_OK;
}
@ -954,7 +954,7 @@ static LibError stream_open(Stream* s, const char* fn)
*/
static LibError stream_close(Stream* s)
{
LibError ret = ERR_OK;
LibError ret = INFO_OK;
LibError err;
// for each pending IO:
@ -995,7 +995,7 @@ static LibError stream_validate(const Stream* s)
if(s->active_ios > MAX_IOS)
WARN_RETURN(ERR_1);
// <last_buf> has no invariant we could check.
return ERR_OK;
return INFO_OK;
}
@ -1123,7 +1123,7 @@ static LibError SndData_reload(SndData* sd, const char* fn, Handle hsd)
RETURN_ERR(stream_open(&sd->s, fn));
sd->is_valid = 1;
return ERR_OK;
return INFO_OK;
}
// else: clip
@ -1175,7 +1175,7 @@ else
(void)file_buf_free(file);
return ERR_OK;
return INFO_OK;
}
static LibError SndData_validate(const SndData* sd)
@ -1190,14 +1190,14 @@ static LibError SndData_validate(const SndData* sd)
if(sd->is_stream)
RETURN_ERR(stream_validate(&sd->s));
return ERR_OK;
return INFO_OK;
}
static LibError SndData_to_string(const SndData* sd, char* buf)
{
const char* type = sd->is_stream? "stream" : "clip";
snprintf(buf, H_STRING_LEN, "%s; al_buf=%d", type, sd->al_buf);
return ERR_OK;
return INFO_OK;
}
@ -1302,7 +1302,7 @@ static void hsd_list_free_all()
* @param hsd Handle to SndData.
* @param al_buf buffer name.
* @return LibError, most commonly:
* ERR_OK = buffer has been returned; more are expected to be available.
* INFO_OK = buffer has been returned; more are expected to be available.
* ERR_EOF = buffer has been returned but is the last one
* (end of file reached)
* ERR_AGAIN = no buffer returned yet; still streaming in ATM.
@ -1310,7 +1310,7 @@ static void hsd_list_free_all()
*/
static LibError snd_data_buf_get(Handle hsd, ALuint& al_buf)
{
LibError err = ERR_OK;
LibError err = INFO_OK;
// in case H_DEREF fails
al_buf = 0;
@ -1346,7 +1346,7 @@ static LibError snd_data_buf_get(Handle hsd, ALuint& al_buf)
RETURN_ERR(err);
// al_buf valid and next IO issued successfully.
return ERR_OK;
return INFO_OK;
}
@ -1364,11 +1364,11 @@ static LibError snd_data_buf_free(Handle hsd, ALuint al_buf)
// clip: no-op (caller will later release hsd reference;
// when hsd actually unloads, sd->al_buf will be freed).
if(!sd->is_stream)
return ERR_OK;
return INFO_OK;
// stream: we had allocated an additional buffer, so free it now.
al_buf_free(al_buf);
return ERR_OK;
return INFO_OK;
}
@ -1638,7 +1638,7 @@ static LibError VSrc_reload(VSrc* vs, const char* fn, Handle hvs)
vs->hsd = snd_data_load(snd_fn, is_stream);
RETURN_ERR(vs->hsd);
return ERR_OK;
return INFO_OK;
}
static LibError VSrc_validate(const VSrc* vs)
@ -1654,13 +1654,13 @@ static LibError VSrc_validate(const VSrc* vs)
if(*(u8*)&vs->loop > 1 || *(u8*)&vs->relative > 1)
WARN_RETURN(ERR_4);
// <static_pri> and <cur_pri> have no invariant we could check.
return ERR_OK;
return INFO_OK;
}
static LibError VSrc_to_string(const VSrc* vs, char* buf)
{
snprintf(buf, H_STRING_LEN, "al_src = %d", vs->al_src);
return ERR_OK;
return INFO_OK;
}
@ -1810,7 +1810,7 @@ static void vsrc_free(VSrc* vs) { snd_free(vs->hvs); }
static LibError list_free_all()
{
list_foreach(vsrc_free);
return ERR_OK;
return INFO_OK;
}
@ -1886,14 +1886,14 @@ static double snd_update_time;
static LibError vsrc_update(VSrc* vs)
{
if(!vs->al_src)
return ERR_OK;
return INFO_OK;
FadeRet ret = fade(vs->fade, snd_update_time, vs->gain);
// auto-free after fadeout.
if(ret == FADE_TO_0_FINISHED)
{
vsrc_free(vs);
return ERR_OK; // don't continue - <vs> has been freed.
return INFO_OK; // don't continue - <vs> has been freed.
}
// fade in progress; latch current gain value.
else if(ret == FADE_CHANGED)
@ -1911,7 +1911,7 @@ static LibError vsrc_update(VSrc* vs)
if(num_queued == 0)
{
snd_free(vs->hvs);
return ERR_OK;
return INFO_OK;
}
}
// can still read from SndData
@ -1936,14 +1936,14 @@ static LibError vsrc_update(VSrc* vs)
alSourceQueueBuffers(vs->al_src, 1, &al_buf);
al_check("vsrc_update alSourceQueueBuffers");
}
while(to_fill-- && ret == ERR_OK);
while(to_fill-- && ret == INFO_OK);
// SndData has reported that no further buffers are available.
if(ret == ERR_EOF)
vs->flags |= VS_EOF;
}
return ERR_OK;
return INFO_OK;
}
@ -1958,7 +1958,7 @@ static LibError vsrc_grant(VSrc* vs)
{
// already playing - bail
if(vs->al_src)
return ERR_OK;
return INFO_OK;
// try to alloc source. if none are available, bail -
// we get called in that hope that one is available by snd_play.
@ -1983,7 +1983,7 @@ static LibError vsrc_grant(VSrc* vs)
alSourcePlay(vs->al_src);
AL_CHECK;
return ERR_OK;
return INFO_OK;
}
@ -2009,7 +2009,7 @@ static LibError vsrc_reclaim(VSrc* vs)
vsrc_deque_finished_bufs(vs);
al_src_free(vs->al_src);
return ERR_OK;
return INFO_OK;
}
@ -2044,7 +2044,7 @@ LibError snd_play(Handle hvs, float static_pri)
// either we get a source and playing begins immediately,
// or it'll be taken care of on next update.
vsrc_grant(vs);
return ERR_OK;
return INFO_OK;
}
@ -2068,7 +2068,7 @@ LibError snd_set_pos(Handle hvs, float x, float y, float z, bool relative)
vs->relative = relative;
vsrc_latch(vs);
return ERR_OK;
return INFO_OK;
}
@ -2100,7 +2100,7 @@ LibError snd_set_gain(Handle hvs, float gain)
vs->gain = gain;
vsrc_latch(vs);
return ERR_OK;
return INFO_OK;
}
@ -2125,7 +2125,7 @@ LibError snd_set_pitch(Handle hvs, float pitch)
vs->pitch = pitch;
vsrc_latch(vs);
return ERR_OK;
return INFO_OK;
}
@ -2153,7 +2153,7 @@ LibError snd_set_loop(Handle hvs, bool loop)
vs->loop = loop;
vsrc_latch(vs);
return ERR_OK;
return INFO_OK;
}
@ -2211,7 +2211,7 @@ LibError snd_fade(Handle hvs, float initial_gain, float final_gain,
(void)fade(fi, cur_time, vs->gain);
vsrc_latch(vs);
return ERR_OK;
return INFO_OK;
}
@ -2301,7 +2301,7 @@ static LibError vm_update()
list_foreach(reclaim, first_unimportant, 0);
list_foreach(grant, 0, first_unimportant);
return ERR_OK;
return INFO_OK;
}
@ -2325,7 +2325,7 @@ LibError snd_update(const float* pos, const float* dir, const float* up)
// this fails, so report success here (everything will work once
// sound is re-enabled).
if(!al_initialized)
return ERR_OK;
return INFO_OK;
if(pos)
al_listener_set_pos(pos, dir, up);
@ -2336,7 +2336,7 @@ LibError snd_update(const float* pos, const float* dir, const float* up)
snd_update_time = get_time(); // see decl
list_foreach((void (*)(VSrc*))vsrc_update);
return ERR_OK;
return INFO_OK;
}
@ -2383,7 +2383,7 @@ LibError snd_disable(bool disabled)
{
if(al_initialized)
debug_warn("already initialized => disable is pointless");
return ERR_OK;
return INFO_OK;
}
else
return snd_init();

View File

@ -172,7 +172,7 @@ extern int self_test_register(SelfTestRecord* r);
// set/cleared by run_self_test.
extern bool self_test_active;
#define TS_ASSERT_OK(expr) TS_ASSERT_EQUAL((expr), ERR_OK)
#define TS_ASSERT_OK(expr) TS_ASSERT_EQUAL((expr), INFO_OK)
#define TS_ASSERT_STR_EQUAL(str1, str2) TS_ASSERT(!strcmp((str1), (str2)))
#endif // #ifndef SELF_TEST_H__

View File

@ -614,7 +614,7 @@ void ia32_get_cpu_info()
// checks if there is an IA-32 CALL instruction right before ret_addr.
// returns ERR_OK if so and ERR_FAIL if not.
// returns INFO_OK if so and ERR_FAIL if not.
// also attempts to determine the call target. if that is possible
// (directly addressed relative or indirect jumps), it is stored in
// target, which is otherwise 0.
@ -635,13 +635,13 @@ LibError ia32_get_call_target(void* ret_addr, void** target)
if(len >= 5 && c[-5] == 0xE8)
{
*target = (u8*)ret_addr + *(i32*)(c-4);
return ERR_OK;
return INFO_OK;
}
// CALL r/m32 (FF /2)
// .. CALL [r32 + r32*s] => FF 14 SIB
if(len >= 3 && c[-3] == 0xFF && c[-2] == 0x14)
return ERR_OK;
return INFO_OK;
// .. CALL [disp32] => FF 15 disp32
if(len >= 6 && c[6] == 0xFF && c[-5] == 0x15)
{
@ -649,27 +649,27 @@ LibError ia32_get_call_target(void* ret_addr, void** target)
if(!debug_is_pointer_bogus(addr_of_target))
{
*target = *(void**)addr_of_target;
return ERR_OK;
return INFO_OK;
}
}
// .. CALL [r32] => FF 00-3F(!14/15)
if(len >= 2 && c[-2] == 0xFF && c[-1] < 0x40 && c[-1] != 0x14 && c[-1] != 0x15)
return ERR_OK;
return INFO_OK;
// .. CALL [r32 + r32*s + disp8] => FF 54 SIB disp8
if(len >= 4 && c[-4] == 0xFF && c[-3] == 0x54)
return ERR_OK;
return INFO_OK;
// .. CALL [r32 + disp8] => FF 50-57(!54) disp8
if(len >= 3 && c[-3] == 0xFF && (c[-2] & 0xF8) == 0x50 && c[-2] != 0x54)
return ERR_OK;
return INFO_OK;
// .. CALL [r32 + r32*s + disp32] => FF 94 SIB disp32
if(len >= 7 && c[-7] == 0xFF && c[-6] == 0x94)
return ERR_OK;
return INFO_OK;
// .. CALL [r32 + disp32] => FF 90-97(!94) disp32
if(len >= 6 && c[-6] == 0xFF && (c[-5] & 0xF8) == 0x90 && c[-5] != 0x94)
return ERR_OK;
return INFO_OK;
// .. CALL r32 => FF D0-D7
if(len >= 2 && c[-2] == 0xFF && (c[-1] & 0xF8) == 0xD0)
return ERR_OK;
return INFO_OK;
WARN_RETURN(ERR_CPU_UNKNOWN_OPCODE);
}

View File

@ -137,7 +137,7 @@ extern void ia32_get_current_context(void* pcontext);
extern void ia32_asm_init();
// checks if there is an IA-32 CALL instruction right before ret_addr.
// returns ERR_OK if so and ERR_FAIL if not.
// returns INFO_OK if so and ERR_FAIL if not.
// also attempts to determine the call target. if that is possible
// (directly addressed relative or indirect jumps), it is stored in
// target, which is otherwise 0.

View File

@ -209,7 +209,7 @@ extern LibError sys_clipboard_free(wchar_t* copy);
// it is no longer needed and can be freed after this call returns.
// hotspot (hx,hy) is the offset from its upper-left corner to the
// position where mouse clicks are registered.
// cursor is only valid when ERR_OK is returned; in that case, it must be
// cursor is only valid when INFO_OK is returned; in that case, it must be
// sys_cursor_free-ed when no longer needed.
extern LibError sys_cursor_create(uint w, uint h, void* bgra_img,
uint hx, uint hy, void** cursor);

View File

@ -601,7 +601,7 @@ static LibError wdll_shutdown()
// changes __puiHead!
}
return ERR_OK;
return INFO_OK;
}

View File

@ -63,7 +63,7 @@ static LibError get_ver(const char* module_path, char* out_ver, size_t out_ver_l
if(VerQueryValue(buf, subblock, (void**)&in_ver, &in_ver_len))
{
strcpy_s(out_ver, out_ver_len, in_ver);
ret = ERR_OK;
ret = INFO_OK;
}
}
}
@ -135,7 +135,7 @@ LibError dll_list_add(const char* name)
if(len > 0)
{
dll_list_pos += len;
return ERR_OK;
return INFO_OK;
}
// didn't fit; complain

View File

@ -258,7 +258,7 @@ static LibError aio_h_set(const int fd, const HANDLE h)
aio_hs[fd] = h;
unlock();
return ERR_OK;
return INFO_OK;
fail:
unlock();
@ -437,7 +437,7 @@ static LibError req_free(Req* r)
{
debug_assert(r->cb != 0 && "req_free: not currently in use");
r->cb = 0;
return ERR_OK;
return INFO_OK;
}
@ -598,7 +598,7 @@ static int aio_rw(struct aiocb* cb)
ok = TRUE;
// .. translate from Win32 result code to POSIX
LibError err = LibError_from_win32(ok);
if(err == ERR_OK)
if(err == INFO_OK)
ret = 0;
LibError_set_errno(err);
@ -799,7 +799,7 @@ int aio_fsync(int, struct aiocb*)
static LibError waio_init()
{
req_init();
return ERR_OK;
return INFO_OK;
}
@ -807,5 +807,5 @@ static LibError waio_shutdown()
{
req_cleanup();
aio_h_cleanup();
return ERR_OK;
return INFO_OK;
}

View File

@ -117,7 +117,7 @@ LibError win_get_cpu_info()
check_speedstep();
return ERR_OK;
return INFO_OK;
}
@ -163,7 +163,7 @@ LibError sys_on_each_cpu(void (*cb)())
// restore to original value
SetProcessAffinityMask(hProcess, process_affinity);
return ERR_OK;
return INFO_OK;
}
@ -315,13 +315,13 @@ LibError prof_start()
sem_init(&exit_flag, 0, 0);
pthread_create(&thread, 0, prof_thread_func, 0);
return ERR_OK;
return INFO_OK;
}
LibError prof_shutdown()
{
WARN_IF_FALSE(CloseHandle(prof_target_thread));
return ERR_OK;
return INFO_OK;
}

View File

@ -264,7 +264,7 @@ static const uint MAX_BREAKPOINTS = 4;
static LibError brk_disable_all_in_ctx(BreakInfo* UNUSED(bi), CONTEXT* context)
{
context->Dr7 &= ~brk_all_local_enables;
return ERR_OK;
return INFO_OK;
}
@ -340,7 +340,7 @@ have_reg:
context->Dr7 |= LE;
brk_all_local_enables |= LE;
return ERR_OK;
return INFO_OK;
}
@ -369,7 +369,7 @@ static LibError brk_do_request(HANDLE hThread, void* arg)
WARN_RETURN(ERR_FAIL);
RETURN_ERR(ret);
return ERR_OK;
return INFO_OK;
}
@ -752,7 +752,7 @@ static LibError wdbg_init(void)
pAddVectoredExceptionHandler(TRUE, vectored_exception_handler);
#endif
return ERR_OK;
return INFO_OK;
}

View File

@ -93,7 +93,7 @@ static LibError sym_init()
// don't use pthread_once because we need to return success/error code.
static uintptr_t already_initialized = 0;
if(!CAS(&already_initialized, 0, 1))
return ERR_OK;
return INFO_OK;
hProcess = GetCurrentProcess();
@ -120,7 +120,7 @@ static LibError sym_init()
IMAGE_NT_HEADERS* header = ImageNtHeader((void*)mod_base);
machine = header->FileHeader.Machine;
return ERR_OK;
return INFO_OK;
}
@ -128,7 +128,7 @@ static LibError sym_init()
static LibError sym_shutdown()
{
SymCleanup(hProcess);
return ERR_OK;
return INFO_OK;
}
@ -217,7 +217,7 @@ LibError debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file,
}
unlock();
return (successes != 0)? ERR_OK : ERR_FAIL;
return (successes != 0)? INFO_OK : ERR_FAIL;
}
@ -302,7 +302,7 @@ static LibError ia32_walk_stack(STACKFRAME64* sf)
sf->AddrPC .Offset = (DWORD64)target;
sf->AddrReturn.Offset = (DWORD64)ret_addr;
return ERR_OK;
return INFO_OK;
}
#endif // #if CPU_IA32 && !CONFIG_OMIT_FP
@ -416,13 +416,13 @@ static LibError walk_stack(StackFrameCallback cb, void* user_arg = 0, uint skip
0, SymFunctionTableAccess64, SymGetModuleBase64, 0);
// note: don't use LibError_from_win32 because it raises a warning,
// and this "fails" commonly (when no stack frames are left).
err = ok? ERR_OK : ERR_FAIL;
err = ok? INFO_OK : ERR_FAIL;
#endif
// no more frames found - abort. note: also test FP because
// StackWalk64 sometimes erroneously reports success.
void* fp = (void*)(uintptr_t)sf.AddrFrame .Offset;
if(err != ERR_OK || !fp)
if(err != INFO_OK || !fp)
return ret;
if(skip)
@ -454,7 +454,7 @@ static LibError nth_caller_cb(const STACKFRAME64* sf, void* user_arg)
// return its address
*pfunc = (void*)sf->AddrPC.Offset;
return ERR_OK;
return INFO_OK;
}
@ -477,7 +477,7 @@ void* debug_get_nth_caller(uint skip, void* pcontext)
LibError err = walk_stack(nth_caller_cb, &func, skip, (const CONTEXT*)pcontext);
unlock();
return (err == ERR_OK)? func : 0;
return (err == INFO_OK)? func : 0;
}
@ -617,7 +617,7 @@ static LibError out_check_limit()
}
// no limit hit, proceed normally
return ERR_OK;
return INFO_OK;
}
//----------------------------------------------------------------------------
@ -773,7 +773,7 @@ static LibError dump_string(const u8* p, size_t el_size)
}
out(L"\"%s\"", buf);
return ERR_OK;
return INFO_OK;
}
@ -817,7 +817,7 @@ static LibError dump_sequence(DebugIterator el_iterator, void* internal,
el_p = el_iterator(internal, el_size);
LibError ret = dump_string(el_p, el_size);
if(ret == ERR_OK)
if(ret == INFO_OK)
return ret;
}
@ -847,7 +847,7 @@ static LibError dump_sequence(DebugIterator el_iterator, void* internal,
continue;
}
dump_error(err, el_p); // nop if err == ERR_OK
dump_error(err, el_p); // nop if err == INFO_OK
// add separator unless this is the last element (can't just
// erase below due to additional "...").
if(i != num_elements_to_show-1)
@ -864,7 +864,7 @@ static LibError dump_sequence(DebugIterator el_iterator, void* internal,
state.level--;
if(fits_on_one_line)
out(L" }");
return ERR_OK;
return INFO_OK;
}
@ -902,7 +902,7 @@ static LibError determine_symbol_address(DWORD id, DWORD UNUSED(type_id), const
// pp is already correct (udt_dump_normal retrieved the offset;
// we do it that way so we can check it against the total
// UDT size for safety).
return ERR_OK;
return INFO_OK;
// this symbol is defined as static in another module =>
// there's nothing we can do.
@ -977,7 +977,7 @@ in_register:
debug_printf("SYM| %ws at %p flags=%X dk=%d sym->addr=%I64X addrofs=%X addr2=%I64X ofs2=%X\n", sym->Name, *pp, sym->Flags, data_kind, sym->Address, addrofs, addr2, ofs2);
return ERR_OK;
return INFO_OK;
}
@ -1157,7 +1157,7 @@ display_as_hex:
out(L" ('%hc')", c);
}
return ERR_OK;
return INFO_OK;
}
@ -1258,7 +1258,7 @@ static LibError dump_sym_enum(DWORD type_id, const u8* p, DumpState UNUSED(state
WARN_RETURN(ERR_SYM_TYPE_INFO_UNAVAILABLE);
out(L"%s", name);
LocalFree((HLOCAL)name);
return ERR_OK;
return INFO_OK;
}
}
@ -1267,7 +1267,7 @@ static LibError dump_sym_enum(DWORD type_id, const u8* p, DumpState UNUSED(state
// note: could goto here after a SGTI fails, but we fail instead
// to make sure those errors are noticed.
out(L"%I64d", enum_value);
return ERR_OK;
return INFO_OK;
}
@ -1296,9 +1296,9 @@ static LibError dump_sym_function_type(DWORD UNUSED(type_id), const u8* p, DumpS
lock();
out(L"0x%p", p);
if(err == ERR_OK)
if(err == INFO_OK)
out(L" (%hs)", name);
return ERR_OK;
return INFO_OK;
}
@ -1346,13 +1346,13 @@ static LibError dump_sym_pointer(DWORD type_id, const u8* p, DumpState state)
// bail if it's obvious the pointer is bogus
// (=> can't display what it's pointing to)
if(debug_is_pointer_bogus(p))
return ERR_OK;
return INFO_OK;
// avoid duplicates and circular references
if(ptr_already_visited(p))
{
out(L" (see above)");
return ERR_OK;
return INFO_OK;
}
// display what the pointer is pointing to.
@ -1420,7 +1420,7 @@ static LibError udt_get_child_type(const wchar_t* child_name,
*el_type_id = type_id;
*el_size = (size_t)size;
return ERR_OK;
return INFO_OK;
}
// (happens if called for containers that are treated as STL but are not)
@ -1452,14 +1452,14 @@ static LibError udt_dump_std(const wchar_t* wtype_name, const u8* p, size_t size
DWORD el_type_id;
size_t el_size;
err = udt_get_child_type(L"value_type", num_children, children, &el_type_id, &el_size);
if(err != ERR_OK)
if(err != INFO_OK)
goto not_valid_container;
// .. get iterator and # elements
size_t el_count;
DebugIterator el_iterator;
u8 it_mem[DEBUG_STL_MAX_ITERATOR_SIZE];
err = stl_get_container_info(ctype_name, p, size, el_size, &el_count, &el_iterator, it_mem);
if(err != ERR_OK)
if(err != INFO_OK)
goto not_valid_container;
return dump_sequence(el_iterator, it_mem, el_count, el_type_id, el_size, state);
not_valid_container:
@ -1486,7 +1486,7 @@ not_valid_container:
text = buf;
}
out(L"(%hs%hs)", text, stl_simplify_name(ctype_name));
return ERR_OK;
return INFO_OK;
}
@ -1554,7 +1554,7 @@ static LibError udt_dump_suppressed(const wchar_t* type_name, const u8* UNUSED(p
// (otherwise, lack of output may be taken for an error)
out(L" (..)");
return ERR_OK;
return INFO_OK;
}
@ -1632,7 +1632,7 @@ static LibError udt_dump_normal(const wchar_t* type_name, const u8* p, size_t si
}
displayed_anything = true;
dump_error(err, el_p); // nop if err == ERR_OK
dump_error(err, el_p); // nop if err == INFO_OK
out(fits_on_one_line? L", " : L"\r\n");
if(err == ERR_SYM_SINGLE_SYMBOL_LIMIT)
@ -1645,7 +1645,7 @@ static LibError udt_dump_normal(const wchar_t* type_name, const u8* p, size_t si
{
out_erase(2); // "{ " or "\r\n"
out(L"(%s)", type_name);
return ERR_OK;
return INFO_OK;
}
// remove trailing comma separator
@ -1657,7 +1657,7 @@ static LibError udt_dump_normal(const wchar_t* type_name, const u8* p, size_t si
out(L" }");
}
return ERR_OK;
return INFO_OK;
}
@ -1726,7 +1726,7 @@ static LibError dump_sym_unknown(DWORD type_id, const u8* UNUSED(p), DumpState U
debug_printf("SYM| unknown tag: %d\n", type_tag);
out(L"(unknown symbol type)");
return ERR_OK;
return INFO_OK;
}
@ -1837,7 +1837,7 @@ static LibError dump_frame_cb(const STACKFRAME64* sf, void* UNUSED(user_arg))
// an alternative would be to check if module=kernel32, but
// that would cut off callbacks as well.
if(!strcmp(func_name, "_BaseProcessStart@4"))
return ERR_OK;
return INFO_OK;
out(L"%hs (%hs:%d)\r\n", func_name, file, line);
}

View File

@ -168,7 +168,7 @@ static LibError wdir_watch_shutdown()
delete it->second;
watches.clear();
return ERR_OK;
return INFO_OK;
}
@ -268,7 +268,7 @@ LibError dir_add_watch(const char* dir, intptr_t* _reqnum)
}
done:
err = ERR_OK;
err = INFO_OK;
*_reqnum = reqnum;
fail:
@ -290,7 +290,7 @@ LibError dir_cancel_watch(const intptr_t reqnum)
// we're freeing a reference - done.
debug_assert(w->refs >= 1);
if(--w->refs != 0)
return ERR_OK;
return INFO_OK;
// contrary to dox, the RDC IOs do not issue a completion notification.
// no packet was received on the IOCP while or after cancelling in a test.
@ -375,7 +375,7 @@ static void get_packet()
// if a file change notification is pending, store its filename in <fn> and
// return ERR_OK; otherwise, return ERR_AGAIN ('none currently pending') or
// return INFO_OK; otherwise, return ERR_AGAIN ('none currently pending') or
// a negative error code.
// <fn> must hold at least PATH_MAX chars.
LibError dir_get_changed_file(char* fn)
@ -391,5 +391,5 @@ LibError dir_get_changed_file(char* fn)
strcpy_s(fn, PATH_MAX, fn_s.c_str());
pending_events.pop_front();
return ERR_OK;
return INFO_OK;
}

View File

@ -56,7 +56,7 @@ LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq)
if(dm.dmFields & (DWORD)DM_DISPLAYFREQUENCY && freq)
*freq = (int)dm.dmDisplayFrequency;
return ERR_OK;
return INFO_OK;
}
@ -69,7 +69,7 @@ LibError gfx_get_monitor_size(int& width_mm, int& height_mm)
width_mm = GetDeviceCaps(dc, HORZSIZE);
height_mm = GetDeviceCaps(dc, VERTSIZE);
ReleaseDC(0, dc);
return ERR_OK;
return INFO_OK;
}
@ -93,7 +93,7 @@ static LibError import_EnumDisplayDevices()
// so this resource leak is unavoidable.
}
return pEnumDisplayDevicesA? ERR_OK : ERR_FAIL;
return pEnumDisplayDevicesA? INFO_OK : ERR_FAIL;
}
@ -120,7 +120,7 @@ static LibError win_get_gfx_card()
if(dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
{
strcpy_s(gfx_card, ARRAY_SIZE(gfx_card), (const char*)dd.DeviceString);
return ERR_OK;
return INFO_OK;
}
}
}
@ -214,5 +214,5 @@ LibError win_get_gfx_info()
// don't exit before trying both
RETURN_ERR(err1);
RETURN_ERR(err2);
return ERR_OK;
return INFO_OK;
}

View File

@ -75,7 +75,7 @@ static LibError LibError_from_GLE(bool warn_if_failed = true)
LibError LibError_from_win32(DWORD ret, bool warn_if_failed)
{
if(ret != FALSE)
return ERR_OK;
return INFO_OK;
return LibError_from_GLE(warn_if_failed);
}

View File

@ -626,7 +626,7 @@ static LibError mmap_mem(void* start, size_t len, int prot, int flags, int fd, v
*pp = 0;
// make sure *pp won't be misinterpreted as an error
cassert(MAP_FAILED != 0);
return ERR_OK;
return INFO_OK;
}
}
@ -636,7 +636,7 @@ static LibError mmap_mem(void* start, size_t len, int prot, int flags, int fd, v
if(!p)
WARN_RETURN(ERR_NO_MEM);
*pp = p;
return ERR_OK;
return INFO_OK;
}
@ -673,7 +673,7 @@ static LibError mmap_file_access(int prot, int flags, DWORD& flProtect, DWORD& d
}
}
return ERR_OK;
return INFO_OK;
}
@ -721,7 +721,7 @@ static LibError mmap_file(void* start, size_t len, int prot, int flags,
WIN_RESTORE_LAST_ERROR;
*pp = p;
return ERR_OK;
return INFO_OK;
}

View File

@ -97,7 +97,7 @@ static LibError calc_gamma_ramp(float gamma, u16* ramp)
{
for(u16 i = 0; i < 256; i++)
ramp[i] = (i << 8);
return ERR_OK;
return INFO_OK;
}
const double inv_gamma = 1.0 / gamma;
@ -110,7 +110,7 @@ static LibError calc_gamma_ramp(float gamma, u16* ramp)
ramp[i] = fp_to_u16(pow(frac, inv_gamma));
}
return ERR_OK;
return INFO_OK;
}
@ -142,7 +142,7 @@ int SDL_SetGamma(float r, float g, float b)
LibError err1 = calc_gamma_ramp(r, cur_ramp[0]);
LibError err2 = calc_gamma_ramp(g, cur_ramp[1]);
LibError err3 = calc_gamma_ramp(b, cur_ramp[2]);
if(err1 != ERR_OK || err2 != ERR_OK || err3 != ERR_OK)
if(err1 != INFO_OK || err2 != INFO_OK || err3 != INFO_OK)
return -1;
if(!SetDeviceGammaRamp(hDC, cur_ramp))
@ -1265,7 +1265,7 @@ static LibError wsdl_init()
enable_kbd_hook(true);
return ERR_OK;
return INFO_OK;
}
@ -1283,7 +1283,7 @@ static LibError wsdl_shutdown()
enable_kbd_hook(false);
return ERR_OK;
return INFO_OK;
}

View File

@ -86,19 +86,19 @@ static LibError add_if_oal_dll(const DirEnt* ent, PathPackage* pp, StringSet* dl
// skip non-files.
if(!DIRENT_IS_DIR(ent))
return ERR_OK;
return INFO_OK;
// skip if not an OpenAL DLL.
const size_t len = strlen(fn);
const bool oal = len >= 7 && !stricmp(fn+len-7, "oal.dll");
const bool openal = strstr(fn, "OpenAL") != 0;
if(!oal && !openal)
return ERR_OK;
return INFO_OK;
// skip if already in StringSet (i.e. has already been dll_list_add-ed)
std::pair<StringSet::iterator, bool> ret = dlls->insert(fn);
if(!ret.second) // insert failed - element already there
return ERR_OK;
return INFO_OK;
RETURN_ERR(path_package_append_file(pp, fn));
return dll_list_add(pp->path);
@ -123,13 +123,13 @@ static LibError add_oal_dlls_in_dir(const char* dir, StringSet* dlls)
for(;;) // instead of while to avoid warning
{
LibError err = dir_next_ent(&d, &ent);
if(err != ERR_OK)
if(err != INFO_OK)
break;
(void)add_if_oal_dll(&ent, &pp, dlls);
}
(void)dir_close(&d);
return ERR_OK;
return INFO_OK;
}
@ -169,7 +169,7 @@ LibError win_get_snd_info()
{
strcpy_s(snd_card, SND_CARD_LEN, "(none)");
strcpy_s(snd_drv_ver, SND_DRV_VER_LEN, "(none)");
return ERR_OK;
return INFO_OK;
}
// find all DLLs related to OpenAL, retrieve their versions,
@ -179,5 +179,5 @@ LibError win_get_snd_info()
StringSet dlls; // ensures uniqueness
(void)add_oal_dlls_in_dir(win_exe_dir, &dlls);
(void)add_oal_dlls_in_dir(win_sys_dir, &dlls);
return ERR_OK;
return INFO_OK;
}

View File

@ -63,7 +63,7 @@ static LibError wsock_init()
debug_warn("WSAStartup failed");
}
return ERR_OK;
return INFO_OK;
}
WDLL_LOAD_NOTIFY("ws2_32", wsock_init);
@ -82,7 +82,7 @@ static LibError wsock_shutdown()
while(dll_refs-- > 0)
FreeLibrary(hWs2_32Dll);
return ERR_OK;
return INFO_OK;
}

View File

@ -378,7 +378,7 @@ LibError sys_clipboard_set(const wchar_t* text)
GlobalUnlock(hMem);
if(SetClipboardData(CF_UNICODETEXT, hMem) != 0)
err = ERR_OK;
err = INFO_OK;
}
}
@ -432,7 +432,7 @@ wchar_t* sys_clipboard_get()
LibError sys_clipboard_free(wchar_t* copy)
{
free(copy);
return ERR_OK;
return INFO_OK;
}
@ -468,7 +468,7 @@ static HCURSOR HCURSOR_from_ptr(void* p)
// it is no longer needed and can be freed after this call returns.
// hotspot (hx,hy) is the offset from its upper-left corner to the
// position where mouse clicks are registered.
// cursor is only valid when ERR_OK is returned; in that case, it must be
// cursor is only valid when INFO_OK is returned; in that case, it must be
// sys_cursor_free-ed when no longer needed.
LibError sys_cursor_create(uint w, uint h, void* bgra_img,
uint hx, uint hy, void** cursor)
@ -501,7 +501,7 @@ LibError sys_cursor_create(uint w, uint h, void* bgra_img,
WARN_RETURN(ERR_FAIL);
*cursor = ptr_from_HICON(hIcon);
return ERR_OK;
return INFO_OK;
}
LibError sys_cursor_create_empty(void **cursor)
@ -521,7 +521,7 @@ LibError sys_cursor_set(void* cursor)
(void)SetCursor(HCURSOR_from_ptr(cursor));
// return value (previous cursor) is useless.
return ERR_OK;
return INFO_OK;
}
@ -531,7 +531,7 @@ LibError sys_cursor_free(void* cursor)
{
// bail now to prevent potential confusion below; there's nothing to do.
if(!cursor)
return ERR_OK;
return INFO_OK;
// if the cursor being freed is active, restore the default arrow
// (just for safety).
@ -564,7 +564,7 @@ LibError sys_error_description_r(int err, char* buf, size_t max_chars)
if(!chars_output)
WARN_RETURN(ERR_FAIL);
debug_assert(chars_output < max_chars);
return ERR_OK;
return INFO_OK;
}
@ -596,7 +596,7 @@ wchar_t* sys_get_module_filename(void* addr, wchar_t* path)
inline LibError sys_get_executable_name(char* n_path, size_t buf_size)
{
DWORD nbytes = GetModuleFileName(0, n_path, (DWORD)buf_size);
return nbytes? ERR_OK : ERR_FAIL;
return nbytes? INFO_OK : ERR_FAIL;
}

View File

@ -199,7 +199,7 @@ static LibError choose_impl()
hrt_impl = HRT_TSC;
hrt_nominal_freq = cpu_freq;
hrt_res = (1.0 / hrt_nominal_freq);
return ERR_OK;
return INFO_OK;
}
}
#endif // TSC
@ -258,7 +258,7 @@ static LibError choose_impl()
hrt_impl = HRT_QPC;
hrt_nominal_freq = (double)qpc_freq;
hrt_res = (1.0 / hrt_nominal_freq);
return ERR_OK;
return INFO_OK;
}
}
#endif // QPC
@ -279,7 +279,7 @@ static LibError choose_impl()
DWORD timer_period; // [hectonanoseconds]
if(GetSystemTimeAdjustment(&adj, &timer_period, &adj_disabled))
hrt_res = (timer_period / 1e7);
return ERR_OK;
return INFO_OK;
}
hrt_impl = HRT_NONE;
@ -393,7 +393,7 @@ static LibError reset_impl_lk()
hrt_cal_ticks = ticks_lk();
}
return ERR_OK;
return INFO_OK;
}
@ -597,7 +597,7 @@ static inline LibError init_calibration_thread()
{
sem_init(&exit_flag, 0, 0);
pthread_create(&thread, 0, calibration_thread, 0);
return ERR_OK;
return INFO_OK;
}
@ -606,7 +606,7 @@ static inline LibError shutdown_calibration_thread()
sem_post(&exit_flag);
pthread_join(thread, 0);
sem_destroy(&exit_flag);
return ERR_OK;
return INFO_OK;
}
@ -741,7 +741,7 @@ static LibError wtime_init()
// first call latches start times
time_ns();
return ERR_OK;
return INFO_OK;
}

View File

@ -100,7 +100,7 @@ static bool ProgressiveBuildArchive()
}
else if(ret < 0)
DISPLAY_ERROR(L"Archive build failed");
else if(ret == ERR_OK)
else if(ret == INFO_OK)
g_GUI.SendEventToAll("archivebuildercomplete");
// in progress
else
@ -123,7 +123,7 @@ static int ProgressiveLoad()
switch(ret)
{
// no load active => no-op (skip code below)
case ERR_OK:
case INFO_OK:
return 0;
// current task didn't complete. we only care about this insofar as the
// load process is therefore not yet finished.

View File

@ -26,7 +26,7 @@ PSRETURN CVFSFile::Load(const char* filename, uint flags /* = 0 */)
}
LibError ret = vfs_load(filename, m_Buffer, m_BufferSize, flags);
if (ret != ERR_OK)
if (ret != INFO_OK)
{
LOG(ERROR, LOG_CATEGORY, "CVFSFile: file %s couldn't be opened (vfs_load: %d)", filename, ret);
return PSRETURN_CVFSFile_LoadFailed;

View File

@ -251,7 +251,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
{
// Open file with VFS
ret = vfs_load(m_ConfigFile[ns], buffer, buflen);
if(ret != ERR_OK)
if(ret != INFO_OK)
{
LOG(ERROR, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), ret);
return false;
@ -259,7 +259,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
}
else
{
if (file_open(m_ConfigFile[ns], 0, &f)!=ERR_OK)
if (file_open(m_ConfigFile[ns], 0, &f)!=INFO_OK)
{
LOG(ERROR, LOG_CATEGORY, "file_open for \"%s\" failed", m_ConfigFile[ns].c_str());
return false;

View File

@ -91,7 +91,7 @@ LibError LDR_BeginRegistering()
state = REGISTERING;
load_requests.clear();
return ERR_OK;
return INFO_OK;
}
@ -116,7 +116,7 @@ LibError LDR_Register(LoadFunc func, void* param, const wchar_t* description,
const LoadRequest lr(func, param, description, estimated_duration_ms);
load_requests.push_back(lr);
return ERR_OK;
return INFO_OK;
}
@ -134,7 +134,7 @@ LibError LDR_EndRegistering()
estimated_duration_tally = 0.0;
task_elapsed_time = 0.0;
total_estimated_duration = std::accumulate(load_requests.begin(), load_requests.end(), 0.0, DurationAdder());
return ERR_OK;
return INFO_OK;
}
@ -152,7 +152,7 @@ LibError LDR_Cancel()
// the queue doesn't need to be emptied now; that'll happen during the
// next LDR_StartRegistering. for now, it is sufficient to set the
// state, so that LDR_ProgressiveLoad is a no-op.
return ERR_OK;
return INFO_OK;
}
@ -217,7 +217,7 @@ LibError LDR_ProgressiveLoad(double time_budget, wchar_t* description,
// we're called unconditionally from the main loop, so this isn't
// an error; there is just nothing to do.
if(state != LOADING)
return ERR_OK;
return INFO_OK;
while(!load_requests.empty())
{
@ -320,11 +320,11 @@ LibError LDR_NonprogressiveLoad()
LibError ret = LDR_ProgressiveLoad(time_budget, description, ARRAY_SIZE(description), &progress_percent);
switch(ret)
{
case ERR_OK:
case INFO_OK:
debug_warn("No load in progress");
return ERR_OK;
return INFO_OK;
case INFO_ALL_COMPLETE:
return ERR_OK;
return INFO_OK;
case ERR_TIMED_OUT:
break; // continue loading
default:

View File

@ -52,7 +52,7 @@ XMLCh *XMLTranscode(const char *str)
int CVFSInputSource::OpenFile(const char *path, uint flags = 0)
{
LibError ret = vfs_load(path, m_pBuffer, m_BufferSize, flags);
if(ret != ERR_OK)
if(ret != INFO_OK)
{
LOG(ERROR, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (vfs_load: %d)", path, ret);
return -1;

View File

@ -115,7 +115,7 @@ void ScriptingHost::RunScript(const CStr& filename, JSObject* globalObject)
FileIOBuf buf;
size_t size;
if(vfs_load(fn, buf, size) != ERR_OK) // ERRTODO: translate/pass it on
if(vfs_load(fn, buf, size) != INFO_OK) // ERRTODO: translate/pass it on
throw PSERROR_Scripting_LoadFile_OpenFailed();
const char* script = (const char*)buf;

View File

@ -42,7 +42,7 @@ void CMusicPlayer::open(char* UNUSED(filename))
/*
void* p;
size_t sizeOfFile;
if(vfs_load(filename, p, sizeOfFile) != ERR_OK)
if(vfs_load(filename, p, sizeOfFile) != INFO_OK)
{
LOG(ERROR, LOG_CATEGORY, "CMusicPlayer::open(): vfs_load for %s failed!\n", filename);
return;