summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-12-06 17:54:42 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-12-06 17:54:42 +0000
commitd92a2e0c4e5060315ebce8bb26997227940f1662 (patch)
tree759499aac683a34dd4c3c5cf12406a0ead96e483 /src/lib
parent4c1762ee26e8ebdcb0b7b22aa191ee4b087ec52b (diff)
Cleanups/version bump/added missing drivers.mame0128u5
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/corefile.c48
-rw-r--r--src/lib/util/pool.c10
2 files changed, 29 insertions, 29 deletions
diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c
index 157ee455991..061d59523f8 100644
--- a/src/lib/util/corefile.c
+++ b/src/lib/util/corefile.c
@@ -223,29 +223,29 @@ void core_fclose(core_file *file)
/*-------------------------------------------------
- core_fcompress - enable/disable streaming file
+ core_fcompress - enable/disable streaming file
compression via zlib
-------------------------------------------------*/
file_error core_fcompress(core_file *file, int compress)
{
file_error result = FILERR_NONE;
-
+
/* can only do this for read-only and write-only cases */
if ((file->openflags & OPEN_FLAG_WRITE) != 0 && (file->openflags & OPEN_FLAG_READ) != 0)
return FILERR_INVALID_ACCESS;
-
+
/* if we have been compressing, flush and free the data */
if (file->zdata != NULL && !compress)
{
int zerr = Z_OK;
-
+
/* flush any remaining data if we are writing */
while ((file->openflags & OPEN_FLAG_WRITE) != 0 && zerr != Z_STREAM_END)
{
UINT32 actualdata;
file_error filerr;
-
+
/* deflate some more */
zerr = deflate(&file->zdata->stream, Z_FINISH);
if (zerr != Z_STREAM_END && zerr != Z_OK)
@@ -265,29 +265,29 @@ file_error core_fcompress(core_file *file, int compress)
file->zdata->stream.avail_out = sizeof(file->zdata->buffer);
}
}
-
+
/* end the appropriate operation */
if ((file->openflags & OPEN_FLAG_WRITE) != 0)
deflateEnd(&file->zdata->stream);
else
inflateEnd(&file->zdata->stream);
-
+
/* free memory */
free(file->zdata);
file->zdata = NULL;
}
-
+
/* if we are just starting to compress, allocate a new buffer */
if (file->zdata == NULL && compress)
{
int zerr;
-
+
/* allocate memory */
file->zdata = malloc(sizeof(*file->zdata));
if (file->zdata == NULL)
return FILERR_OUT_OF_MEMORY;
memset(file->zdata, 0, sizeof(file->zdata));
-
+
/* initialize the stream and compressor */
if ((file->openflags & OPEN_FLAG_WRITE) != 0)
{
@@ -297,7 +297,7 @@ file_error core_fcompress(core_file *file, int compress)
}
else
zerr = inflateInit(&file->zdata->stream);
-
+
/* on error, return an error */
if (zerr != Z_OK)
{
@@ -305,7 +305,7 @@ file_error core_fcompress(core_file *file, int compress)
file->zdata = NULL;
return FILERR_OUT_OF_MEMORY;
}
-
+
/* flush buffers */
file->bufferbytes = 0;
@@ -313,7 +313,7 @@ file_error core_fcompress(core_file *file, int compress)
file->zdata->realoffset = file->offset;
file->zdata->nextoffset = file->offset;
}
-
+
return result;
}
@@ -330,7 +330,7 @@ file_error core_fcompress(core_file *file, int compress)
int core_fseek(core_file *file, INT64 offset, int whence)
{
int err = 0;
-
+
/* error if compressing */
if (file->zdata != NULL)
return 1;
@@ -883,11 +883,11 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset,
/* if no compression, just pass through */
if (file->zdata == NULL)
return osd_read(file->file, buffer, offset, length, actual);
-
+
/* if the offset doesn't match the next offset, fail */
if (offset != file->zdata->nextoffset)
return FILERR_INVALID_ACCESS;
-
+
/* set up the destination */
file->zdata->stream.next_out = buffer;
file->zdata->stream.avail_out = length;
@@ -896,7 +896,7 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset,
file_error filerr;
UINT32 actualdata;
int zerr = Z_OK;
-
+
/* if we didn't make progress, report an error or the end */
if (file->zdata->stream.avail_in != 0)
zerr = inflate(&file->zdata->stream, Z_SYNC_FLUSH);
@@ -906,7 +906,7 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset,
file->zdata->nextoffset += *actual;
return (zerr == Z_STREAM_END) ? FILERR_NONE : FILERR_INVALID_DATA;
}
-
+
/* fetch more data if needed */
if (file->zdata->stream.avail_in == 0)
{
@@ -922,7 +922,7 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset,
/* we read everything */
*actual = length;
file->zdata->nextoffset += *actual;
- return FILERR_NONE;
+ return FILERR_NONE;
}
@@ -936,11 +936,11 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
/* if no compression, just pass through */
if (file->zdata == NULL)
return osd_write(file->file, buffer, offset, length, actual);
-
+
/* if the offset doesn't match the next offset, fail */
if (offset != file->zdata->nextoffset)
return FILERR_INVALID_ACCESS;
-
+
/* set up the source */
file->zdata->stream.next_in = (void *)buffer;
file->zdata->stream.avail_in = length;
@@ -949,7 +949,7 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
file_error filerr;
UINT32 actualdata;
int zerr;
-
+
/* if we didn't make progress, report an error or the end */
zerr = deflate(&file->zdata->stream, Z_NO_FLUSH);
if (zerr != Z_OK)
@@ -958,7 +958,7 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
file->zdata->nextoffset += *actual;
return FILERR_INVALID_DATA;
}
-
+
/* write more data if we are full up */
if (file->zdata->stream.avail_out == 0)
{
@@ -974,7 +974,7 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
/* we read everything */
*actual = length;
file->zdata->nextoffset += *actual;
- return FILERR_NONE;
+ return FILERR_NONE;
}
diff --git a/src/lib/util/pool.c b/src/lib/util/pool.c
index f19ec401507..479c61cbd21 100644
--- a/src/lib/util/pool.c
+++ b/src/lib/util/pool.c
@@ -147,7 +147,7 @@ object_pool *pool_alloc(void (*fail)(const char *message))
/* set the failure handler */
pool->fail = fail;
-
+
/* register the built-in types */
pool_type_register(pool, OBJTYPE_MEMORY, "Memory", memory_destruct);
@@ -196,7 +196,7 @@ void pool_type_register(object_pool *pool, object_type type, const char *friendl
void pool_clear(object_pool *pool)
{
object_entry *entry, *next;
-
+
/* iterate over all entries in the global list and free them */
for (entry = pool->globallist; entry != NULL; entry = next)
{
@@ -211,7 +211,7 @@ void pool_clear(object_pool *pool)
entry->globalnext = entry->globalprev = NULL;
pool->freelist = entry;
}
-
+
/* zap the hashtable */
memset(pool->hashtable, 0, sizeof(pool->hashtable));
}
@@ -320,7 +320,7 @@ void *pool_object_add_file_line(object_pool *pool, object_type _type, void *obje
entry->globalprev = NULL;
entry->globalnext = pool->globallist;
pool->globallist = entry;
-
+
/* hook up to the appropriate hash table */
entry->next = pool->hashtable[hashnum];
pool->hashtable[hashnum] = entry;
@@ -428,7 +428,7 @@ int pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *size
iter->last = iter->pool->globallist;
else
iter->last = iter->last->globalnext;
-
+
/* stop when we get one */
if (iter->last != NULL)
{