the_Foundation [release-1.0]

Archive: Cleanup

=> 8ab9feebb2a08ba6eed516494431b0df451cfeed

diff --git a/include/the_Foundation/archive.h b/include/the_Foundation/archive.h
index 782d232..68de5bd 100644
--- a/include/the_Foundation/archive.h
+++ b/include/the_Foundation/archive.h
@@ -41,7 +41,7 @@ struct Impl_ArchiveEntry {
     size_t   archPos;
     size_t   archSize;
     int      compression;
-    iBlock * data;
+    iBlock * data; /* NULL until uncompressed with `data_Archive()` */
 };
 
 iDeclareClass(Archive)
@@ -54,11 +54,11 @@ void    close_Archive       (iArchive *);
 iBool   isOpen_Archive      (const iArchive *);
 size_t  numEntries_Archive  (const iArchive *);
 
-const iArchiveEntry *   at_Archive          (const iArchive *, size_t index);
-const iArchiveEntry *   atPath_Archive      (const iArchive *, const iString *path);
+const iArchiveEntry *   entry_Archive   (const iArchive *, const iString *path);
+const iArchiveEntry *   entryAt_Archive (const iArchive *, size_t index);
 
-const iBlock *          data_Archive        (const iArchive *, size_t index);
-const iBlock *          dataPath_Archive    (const iArchive *, const iString *path);
+const iBlock *          data_Archive    (const iArchive *, const iString *path);
+const iBlock *          dataAt_Archive  (const iArchive *, size_t index);
 
 /** @name Iterators */
 ///@{
diff --git a/src/archive.c b/src/archive.c
index 608e53d..4880e44 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -220,6 +220,7 @@ void init_ArchiveEntry(iArchiveEntry *d) {
 }
 
 void deinit_ArchiveEntry(iArchiveEntry *d) {
+    delete_Block(d->data);
     deinit_String(&d->path);
 }
 
@@ -417,26 +418,26 @@ size_t numEntries_Archive(const iArchive *d) {
     return size_SortedArray(d->entries);
 }
 
-const iArchiveEntry *at_Archive(const iArchive *d, size_t index) {
+const iArchiveEntry *entryAt_Archive(const iArchive *d, size_t index) {
     if (index >= size_SortedArray(d->entries)) {
         return NULL;
     }
     return constAt_SortedArray(d->entries, index);
 }
 
-const iArchiveEntry *atPath_Archive(const iArchive *d, const iString *path) {
-    return at_Archive(d, findPath_Archive_(d, path));
+const iArchiveEntry *entry_Archive(const iArchive *d, const iString *path) {
+    return entryAt_Archive(d, findPath_Archive_(d, path));
 }
 
-const iBlock *data_Archive(const iArchive *d, size_t index) {
+const iBlock *dataAt_Archive(const iArchive *d, size_t index) {
     if (index >= size_SortedArray(d->entries)) {
         return NULL;
     }
     return loadEntry_Archive_(d, index)->data;
 }
 
-const iBlock *dataPath_Archive(const iArchive *d, const iString *path) {
-    return data_Archive(d, findPath_Archive_(d, path));
+const iBlock *data_Archive(const iArchive *d, const iString *path) {
+    return dataAt_Archive(d, findPath_Archive_(d, path));
 }
 
 /*----------------------------------------------------------------------------------------------*/
@@ -445,7 +446,7 @@ void init_ArchiveConstIterator(iArchiveConstIterator *d, const iArchive *archive
     if (archive) {
         d->archive = archive;
         d->index   = 0;
-        d->value   = at_Archive(archive, 0);
+        d->value   = entryAt_Archive(archive, 0);
     }
     else {
         iZap(*d);
@@ -454,7 +455,7 @@ void init_ArchiveConstIterator(iArchiveConstIterator *d, const iArchive *archive
 
 void next_ArchiveConstIterator(iArchiveConstIterator *d) {
     if (d->archive && d->value) {
-        d->value = at_Archive(d->archive, ++d->index);
+        d->value = entryAt_Archive(d->archive, ++d->index);
     }
 }
 
diff --git a/tests/t_archive.c b/tests/t_archive.c
index ebf3091..1e2fc30 100644
--- a/tests/t_archive.c
+++ b/tests/t_archive.c
@@ -18,7 +18,7 @@ int main(int argc, char **argv) {
                 if (arg) {
                     const iString *entryPath = value_CommandLineArg(arg, 0);
                     printf("decompressing: %s\n", cstr_String(entryPath));
-                    const iBlock *data = dataPath_Archive(arch, entryPath);
+                    const iBlock *data = data_Archive(arch, entryPath);
                     printf("got %zu bytes\n", size_Block(data));
                     fwrite(constData_Block(data), size_Block(data), 1, stderr);
                     continue;
Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/release-1.0/cdiff/8ab9feebb2a08ba6eed516494431b0df451cfeed
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
27.813223 milliseconds
Gemini-to-HTML Time
0.592063 milliseconds

This content has been proxied by September (ba2dc).