From 8ab9feebb2a08ba6eed516494431b0df451cfeed Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Fri, 23 Apr 2021 11:06:18 +0300

Subject: [PATCH 1/1] Archive: Cleanup

Revised the method names.


include/the_Foundation/archive.h | 10 +++++-----

src/archive.c | 17 +++++++++--------

tests/t_archive.c | 2 +-

3 files changed, 15 insertions(+), 14 deletions(-)

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;

};

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) {

 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) {

+const iArchiveEntry *entry_Archive(const iArchive *d, const iString *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) {

+const iBlock *data_Archive(const iArchive *d, const iString *path) {

}

/----------------------------------------------------------------------------------------------/

@@ -445,7 +446,7 @@ void init_ArchiveConstIterator(iArchiveConstIterator *d, const iArchive *archive

 if (archive) {

     d->archive = archive;

     d->index   = 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) {

 }

}

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));

                 printf("got %zu bytes\n", size_Block(data));

                 fwrite(constData_Block(data), size_Block(data), 1, stderr);

                 continue;

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/release-1.0/patch/8ab9feebb2a08ba6eed516494431b0df451cfeed.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
39.60028 milliseconds
Gemini-to-HTML Time
2.529687 milliseconds

This content has been proxied by September (ba2dc).