You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-12-24 14:18:01 +03:00
Rename FUNCTION_DEBUG_* and consolidate ASSERT_* macros for consistency.
Rename FUNCTION_DEBUG_* macros to FUNCTION_LOG_* to more accurately reflect what they do. Further rename FUNCTION_DEBUG_RESULT* macros to FUNCTION_LOG_RETURN* to make it clearer that they return from the function as well as logging. Leave FUNCTION_TEST_* macros as they are. Consolidate the various ASSERT* macros into a single ASSERT macro that is always compiled out of production builds. It was difficult to figure out when an assert would be checked with all the different types in play. When ASSERTs are compiled in they will always be checked regardless of the log level -- tying these two concepts together was not a good idea.
This commit is contained in:
@@ -57,6 +57,10 @@
|
|||||||
<p>Ignore <id>SIGPIPE</id> signals and check <id>EPIPE</id> result instead.</p>
|
<p>Ignore <id>SIGPIPE</id> signals and check <id>EPIPE</id> result instead.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|
||||||
|
<release-item>
|
||||||
|
<p>Rename FUNCTION_DEBUG_* and consolidate ASSERT_* macros for consistency.</p>
|
||||||
|
</release-item>
|
||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<p>Make the <proper>C</proper> version of the <cmd>info</cmd> command conform to the <proper>Perl</proper> version.</p>
|
<p>Make the <proper>C</proper> version of the <cmd>info</cmd> command conform to the <proper>Perl</proper> version.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|||||||
102
src/Makefile
102
src/Makefile
@@ -175,34 +175,34 @@ install: pgbackrest
|
|||||||
command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/archive/common.c -o command/archive/common.o
|
$(CC) $(CFLAGS) -c command/archive/common.c -o command/archive/common.o
|
||||||
|
|
||||||
command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/cipherBlock.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/cipherBlock.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/archive/get/file.c -o command/archive/get/file.o
|
$(CC) $(CFLAGS) -c command/archive/get/file.c -o command/archive/get/file.o
|
||||||
|
|
||||||
command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h crypto/crypto.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h crypto/crypto.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/archive/get/get.c -o command/archive/get/get.o
|
$(CC) $(CFLAGS) -c command/archive/get/get.c -o command/archive/get/get.o
|
||||||
|
|
||||||
command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/archive/push/push.c -o command/archive/push/push.o
|
$(CC) $(CFLAGS) -c command/archive/push/push.c -o command/archive/push/push.o
|
||||||
|
|
||||||
command/command.o: command/command.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
command/command.o: command/command.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||||
$(CC) $(CFLAGS) -c command/command.c -o command/command.o
|
$(CC) $(CFLAGS) -c command/command.c -o command/command.o
|
||||||
|
|
||||||
command/control/control.o: command/control/control.c command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/control/control.o: command/control/control.c command/control/control.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/control/control.c -o command/control/control.o
|
$(CC) $(CFLAGS) -c command/control/control.c -o command/control/control.o
|
||||||
|
|
||||||
command/help/help.o: command/help/help.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
command/help/help.o: command/help/help.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||||
$(CC) $(CFLAGS) -c command/help/help.c -o command/help/help.o
|
$(CC) $(CFLAGS) -c command/help/help.c -o command/help/help.o
|
||||||
|
|
||||||
command/info/info.o: command/info/info.c command/archive/common.h command/info/info.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/crypto.h crypto/hash.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
command/info/info.o: command/info/info.c command/archive/common.h command/info/info.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/crypto.h crypto/hash.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c command/info/info.c -o command/info/info.o
|
$(CC) $(CFLAGS) -c command/info/info.c -o command/info/info.o
|
||||||
|
|
||||||
common/debug.o: common/debug.c common/debug.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/debug.o: common/debug.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/debug.c -o common/debug.o
|
$(CC) $(CFLAGS) -c common/debug.c -o common/debug.o
|
||||||
|
|
||||||
common/encode.o: common/encode.c common/debug.h common/encode.h common/encode/base64.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/encode.o: common/encode.c common/assert.h common/debug.h common/encode.h common/encode/base64.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/encode.c -o common/encode.o
|
$(CC) $(CFLAGS) -c common/encode.c -o common/encode.o
|
||||||
|
|
||||||
common/encode/base64.o: common/encode/base64.c common/debug.h common/encode/base64.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/encode/base64.o: common/encode/base64.c common/assert.h common/debug.h common/encode/base64.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/encode/base64.c -o common/encode/base64.o
|
$(CC) $(CFLAGS) -c common/encode/base64.c -o common/encode/base64.o
|
||||||
|
|
||||||
common/error.o: common/error.c common/error.auto.c common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h
|
common/error.o: common/error.c common/error.auto.c common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h
|
||||||
@@ -211,13 +211,13 @@ common/error.o: common/error.c common/error.auto.c common/error.auto.h common/er
|
|||||||
common/exec.o: common/exec.c common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h
|
common/exec.o: common/exec.c common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h
|
||||||
$(CC) $(CFLAGS) -c common/exec.c -o common/exec.o
|
$(CC) $(CFLAGS) -c common/exec.c -o common/exec.o
|
||||||
|
|
||||||
common/exit.o: common/exit.c command/command.h common/debug.h common/error.auto.h common/error.h common/exit.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h perl/exec.h protocol/client.h protocol/helper.h
|
common/exit.o: common/exit.c command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h perl/exec.h protocol/client.h protocol/helper.h
|
||||||
$(CC) $(CFLAGS) -c common/exit.c -o common/exit.o
|
$(CC) $(CFLAGS) -c common/exit.c -o common/exit.o
|
||||||
|
|
||||||
common/fork.o: common/fork.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/fork.o: common/fork.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/fork.c -o common/fork.o
|
$(CC) $(CFLAGS) -c common/fork.c -o common/fork.o
|
||||||
|
|
||||||
common/ini.o: common/ini.c common/debug.h common/error.auto.h common/error.h common/ini.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/ini.o: common/ini.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/ini.c -o common/ini.o
|
$(CC) $(CFLAGS) -c common/ini.c -o common/ini.o
|
||||||
|
|
||||||
common/io/bufferRead.o: common/io/bufferRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/bufferRead.o: common/io/bufferRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
@@ -226,7 +226,7 @@ common/io/bufferRead.o: common/io/bufferRead.c common/assert.h common/debug.h co
|
|||||||
common/io/bufferWrite.o: common/io/bufferWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferWrite.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/bufferWrite.o: common/io/bufferWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferWrite.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/bufferWrite.c -o common/io/bufferWrite.o
|
$(CC) $(CFLAGS) -c common/io/bufferWrite.c -o common/io/bufferWrite.o
|
||||||
|
|
||||||
common/io/filter/buffer.o: common/io/filter/buffer.c common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/filter/buffer.o: common/io/filter/buffer.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/filter/buffer.c -o common/io/filter/buffer.o
|
$(CC) $(CFLAGS) -c common/io/filter/buffer.c -o common/io/filter/buffer.o
|
||||||
|
|
||||||
common/io/filter/filter.o: common/io/filter/filter.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/filter/filter.o: common/io/filter/filter.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
@@ -235,7 +235,7 @@ common/io/filter/filter.o: common/io/filter/filter.c common/assert.h common/debu
|
|||||||
common/io/filter/group.o: common/io/filter/group.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/filter/group.o: common/io/filter/group.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/filter/group.c -o common/io/filter/group.o
|
$(CC) $(CFLAGS) -c common/io/filter/group.c -o common/io/filter/group.o
|
||||||
|
|
||||||
common/io/filter/size.o: common/io/filter/size.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/size.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/filter/size.o: common/io/filter/size.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/size.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/filter/size.c -o common/io/filter/size.o
|
$(CC) $(CFLAGS) -c common/io/filter/size.c -o common/io/filter/size.o
|
||||||
|
|
||||||
common/io/handleRead.o: common/io/handleRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/handleRead.o: common/io/handleRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
@@ -247,25 +247,25 @@ common/io/handleWrite.o: common/io/handleWrite.c common/assert.h common/debug.h
|
|||||||
common/io/http/client.o: common/io/http/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h
|
common/io/http/client.o: common/io/http/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h
|
||||||
$(CC) $(CFLAGS) -c common/io/http/client.c -o common/io/http/client.o
|
$(CC) $(CFLAGS) -c common/io/http/client.c -o common/io/http/client.o
|
||||||
|
|
||||||
common/io/http/common.o: common/io/http/common.c common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
common/io/http/common.o: common/io/http/common.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
||||||
$(CC) $(CFLAGS) -c common/io/http/common.c -o common/io/http/common.o
|
$(CC) $(CFLAGS) -c common/io/http/common.c -o common/io/http/common.o
|
||||||
|
|
||||||
common/io/http/header.o: common/io/http/header.c common/debug.h common/error.auto.h common/error.h common/io/http/header.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
common/io/http/header.o: common/io/http/header.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/header.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/http/header.c -o common/io/http/header.o
|
$(CC) $(CFLAGS) -c common/io/http/header.c -o common/io/http/header.o
|
||||||
|
|
||||||
common/io/http/query.o: common/io/http/query.c common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/io/http/query.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
common/io/http/query.o: common/io/http/query.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/io/http/query.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/http/query.c -o common/io/http/query.o
|
$(CC) $(CFLAGS) -c common/io/http/query.c -o common/io/http/query.o
|
||||||
|
|
||||||
common/io/io.o: common/io/io.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/io/io.o: common/io/io.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/io/io.c -o common/io/io.o
|
$(CC) $(CFLAGS) -c common/io/io.c -o common/io/io.o
|
||||||
|
|
||||||
common/io/read.o: common/io/read.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/read.o: common/io/read.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/read.c -o common/io/read.o
|
$(CC) $(CFLAGS) -c common/io/read.c -o common/io/read.o
|
||||||
|
|
||||||
common/io/tls/client.o: common/io/tls/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h crypto/crypto.h
|
common/io/tls/client.o: common/io/tls/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h crypto/crypto.h
|
||||||
$(CC) $(CFLAGS) -c common/io/tls/client.c -o common/io/tls/client.o
|
$(CC) $(CFLAGS) -c common/io/tls/client.c -o common/io/tls/client.o
|
||||||
|
|
||||||
common/io/write.o: common/io/write.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/io/write.o: common/io/write.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/io/write.c -o common/io/write.o
|
$(CC) $(CFLAGS) -c common/io/write.c -o common/io/write.o
|
||||||
|
|
||||||
common/lock.o: common/lock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
common/lock.o: common/lock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||||
@@ -277,13 +277,13 @@ common/log.o: common/log.c common/assert.h common/debug.h common/error.auto.h co
|
|||||||
common/memContext.o: common/memContext.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h
|
common/memContext.o: common/memContext.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/memContext.c -o common/memContext.o
|
$(CC) $(CFLAGS) -c common/memContext.c -o common/memContext.o
|
||||||
|
|
||||||
common/regExp.o: common/regExp.c common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
common/regExp.o: common/regExp.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
||||||
$(CC) $(CFLAGS) -c common/regExp.c -o common/regExp.o
|
$(CC) $(CFLAGS) -c common/regExp.c -o common/regExp.o
|
||||||
|
|
||||||
common/stackTrace.o: common/stackTrace.c common/assert.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h
|
common/stackTrace.o: common/stackTrace.c common/assert.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h
|
||||||
$(CC) $(CFLAGS) -c common/stackTrace.c -o common/stackTrace.o
|
$(CC) $(CFLAGS) -c common/stackTrace.c -o common/stackTrace.o
|
||||||
|
|
||||||
common/time.o: common/time.c common/debug.h common/logLevel.h common/stackTrace.h common/time.h common/type/convert.h
|
common/time.o: common/time.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/time.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/time.c -o common/time.o
|
$(CC) $(CFLAGS) -c common/time.c -o common/time.o
|
||||||
|
|
||||||
common/type/buffer.o: common/type/buffer.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
common/type/buffer.o: common/type/buffer.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
||||||
@@ -292,13 +292,13 @@ common/type/buffer.o: common/type/buffer.c common/assert.h common/debug.h common
|
|||||||
common/type/convert.o: common/type/convert.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
common/type/convert.o: common/type/convert.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||||
$(CC) $(CFLAGS) -c common/type/convert.c -o common/type/convert.o
|
$(CC) $(CFLAGS) -c common/type/convert.c -o common/type/convert.o
|
||||||
|
|
||||||
common/type/json.o: common/type/json.c common/debug.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/variantList.h
|
common/type/json.o: common/type/json.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/type/json.c -o common/type/json.o
|
$(CC) $(CFLAGS) -c common/type/json.c -o common/type/json.o
|
||||||
|
|
||||||
common/type/keyValue.o: common/type/keyValue.c common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
common/type/keyValue.o: common/type/keyValue.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/type/keyValue.c -o common/type/keyValue.o
|
$(CC) $(CFLAGS) -c common/type/keyValue.c -o common/type/keyValue.o
|
||||||
|
|
||||||
common/type/list.o: common/type/list.c common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h
|
common/type/list.o: common/type/list.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h
|
||||||
$(CC) $(CFLAGS) -c common/type/list.c -o common/type/list.o
|
$(CC) $(CFLAGS) -c common/type/list.c -o common/type/list.o
|
||||||
|
|
||||||
common/type/string.o: common/type/string.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
common/type/string.o: common/type/string.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
||||||
@@ -310,22 +310,22 @@ common/type/stringList.o: common/type/stringList.c common/assert.h common/debug.
|
|||||||
common/type/variant.o: common/type/variant.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
common/type/variant.o: common/type/variant.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/type/variant.c -o common/type/variant.o
|
$(CC) $(CFLAGS) -c common/type/variant.c -o common/type/variant.o
|
||||||
|
|
||||||
common/type/variantList.o: common/type/variantList.c common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
common/type/variantList.o: common/type/variantList.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h
|
||||||
$(CC) $(CFLAGS) -c common/type/variantList.c -o common/type/variantList.o
|
$(CC) $(CFLAGS) -c common/type/variantList.c -o common/type/variantList.o
|
||||||
|
|
||||||
common/type/xml.o: common/type/xml.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h common/type/xml.h
|
common/type/xml.o: common/type/xml.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h common/type/xml.h
|
||||||
$(CC) $(CFLAGS) -c common/type/xml.c -o common/type/xml.o
|
$(CC) $(CFLAGS) -c common/type/xml.c -o common/type/xml.o
|
||||||
|
|
||||||
common/wait.o: common/wait.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/convert.h common/wait.h
|
common/wait.o: common/wait.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/convert.h common/wait.h
|
||||||
$(CC) $(CFLAGS) -c common/wait.c -o common/wait.o
|
$(CC) $(CFLAGS) -c common/wait.c -o common/wait.o
|
||||||
|
|
||||||
compress/gzip.o: compress/gzip.c common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h compress/gzip.h
|
compress/gzip.o: compress/gzip.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h compress/gzip.h
|
||||||
$(CC) $(CFLAGS) -c compress/gzip.c -o compress/gzip.o
|
$(CC) $(CFLAGS) -c compress/gzip.c -o compress/gzip.o
|
||||||
|
|
||||||
compress/gzipCompress.o: compress/gzipCompress.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipCompress.h
|
compress/gzipCompress.o: compress/gzipCompress.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipCompress.h
|
||||||
$(CC) $(CFLAGS) -c compress/gzipCompress.c -o compress/gzipCompress.o
|
$(CC) $(CFLAGS) -c compress/gzipCompress.c -o compress/gzipCompress.o
|
||||||
|
|
||||||
compress/gzipDecompress.o: compress/gzipDecompress.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h
|
compress/gzipDecompress.o: compress/gzipDecompress.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h
|
||||||
$(CC) $(CFLAGS) -c compress/gzipDecompress.c -o compress/gzipDecompress.o
|
$(CC) $(CFLAGS) -c compress/gzipDecompress.c -o compress/gzipDecompress.o
|
||||||
|
|
||||||
config/config.o: config/config.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.c config/config.auto.h config/config.h config/define.auto.h config/define.h
|
config/config.o: config/config.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.c config/config.auto.h config/config.h config/define.auto.h config/define.h
|
||||||
@@ -334,10 +334,10 @@ config/config.o: config/config.c common/assert.h common/debug.h common/error.aut
|
|||||||
config/define.o: config/define.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h config/define.auto.c config/define.auto.h config/define.h
|
config/define.o: config/define.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h config/define.auto.c config/define.auto.h config/define.h
|
||||||
$(CC) $(CFLAGS) -c config/define.c -o config/define.o
|
$(CC) $(CFLAGS) -c config/define.c -o config/define.o
|
||||||
|
|
||||||
config/exec.o: config/exec.c common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h
|
config/exec.o: config/exec.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h
|
||||||
$(CC) $(CFLAGS) -c config/exec.c -o config/exec.o
|
$(CC) $(CFLAGS) -c config/exec.c -o config/exec.o
|
||||||
|
|
||||||
config/load.o: config/load.c command/command.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h
|
config/load.o: config/load.c command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h
|
||||||
$(CC) $(CFLAGS) -c config/load.c -o config/load.o
|
$(CC) $(CFLAGS) -c config/load.c -o config/load.o
|
||||||
|
|
||||||
config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||||
@@ -346,19 +346,19 @@ config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto.
|
|||||||
crypto/cipherBlock.o: crypto/cipherBlock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h
|
crypto/cipherBlock.o: crypto/cipherBlock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h
|
||||||
$(CC) $(CFLAGS) -c crypto/cipherBlock.c -o crypto/cipherBlock.o
|
$(CC) $(CFLAGS) -c crypto/cipherBlock.c -o crypto/cipherBlock.o
|
||||||
|
|
||||||
crypto/crypto.o: crypto/crypto.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h crypto/crypto.h
|
crypto/crypto.o: crypto/crypto.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h crypto/crypto.h
|
||||||
$(CC) $(CFLAGS) -c crypto/crypto.c -o crypto/crypto.o
|
$(CC) $(CFLAGS) -c crypto/crypto.c -o crypto/crypto.o
|
||||||
|
|
||||||
crypto/hash.o: crypto/hash.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h
|
crypto/hash.o: crypto/hash.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h
|
||||||
$(CC) $(CFLAGS) -c crypto/hash.c -o crypto/hash.o
|
$(CC) $(CFLAGS) -c crypto/hash.c -o crypto/hash.o
|
||||||
|
|
||||||
info/info.o: info/info.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h info/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
info/info.o: info/info.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h info/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||||
$(CC) $(CFLAGS) -c info/info.c -o info/info.o
|
$(CC) $(CFLAGS) -c info/info.c -o info/info.o
|
||||||
|
|
||||||
info/infoArchive.o: info/infoArchive.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
info/infoArchive.o: info/infoArchive.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c info/infoArchive.c -o info/infoArchive.o
|
$(CC) $(CFLAGS) -c info/infoArchive.c -o info/infoArchive.o
|
||||||
|
|
||||||
info/infoBackup.o: info/infoBackup.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
info/infoBackup.o: info/infoBackup.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c info/infoBackup.c -o info/infoBackup.o
|
$(CC) $(CFLAGS) -c info/infoBackup.c -o info/infoBackup.o
|
||||||
|
|
||||||
info/infoManifest.o: info/infoManifest.c common/error.auto.h common/error.h common/memContext.h common/type/buffer.h common/type/string.h info/infoManifest.h
|
info/infoManifest.o: info/infoManifest.c common/error.auto.h common/error.h common/memContext.h common/type/buffer.h common/type/string.h info/infoManifest.h
|
||||||
@@ -367,49 +367,49 @@ info/infoManifest.o: info/infoManifest.c common/error.auto.h common/error.h comm
|
|||||||
info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c info/infoPg.c -o info/infoPg.o
|
$(CC) $(CFLAGS) -c info/infoPg.c -o info/infoPg.o
|
||||||
|
|
||||||
main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h command/info/info.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h
|
main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h command/info/info.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h
|
||||||
$(CC) $(CFLAGS) -c main.c -o main.o
|
$(CC) $(CFLAGS) -c main.c -o main.o
|
||||||
|
|
||||||
perl/config.o: perl/config.c common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h
|
perl/config.o: perl/config.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h
|
||||||
$(CC) $(CFLAGS) -c perl/config.c -o perl/config.o
|
$(CC) $(CFLAGS) -c perl/config.c -o perl/config.o
|
||||||
|
|
||||||
perl/exec.o: perl/exec.c ../libc/LibC.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
perl/exec.o: perl/exec.c ../libc/LibC.h common/assert.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
||||||
$(CC) $(CFLAGS) -c perl/exec.c -o perl/exec.o
|
$(CC) $(CFLAGS) -c perl/exec.c -o perl/exec.o
|
||||||
|
|
||||||
postgres/interface.o: postgres/interface.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/v083.h postgres/interface/v084.h postgres/interface/v090.h postgres/interface/v091.h postgres/interface/v092.h postgres/interface/v093.h postgres/interface/v094.h postgres/interface/v095.h postgres/interface/v096.h postgres/interface/v100.h postgres/interface/v110.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
postgres/interface.o: postgres/interface.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/v083.h postgres/interface/v084.h postgres/interface/v090.h postgres/interface/v091.h postgres/interface/v092.h postgres/interface/v093.h postgres/interface/v094.h postgres/interface/v095.h postgres/interface/v096.h postgres/interface/v100.h postgres/interface/v110.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface.c -o postgres/interface.o
|
$(CC) $(CFLAGS) -c postgres/interface.c -o postgres/interface.o
|
||||||
|
|
||||||
postgres/interface/v083.o: postgres/interface/v083.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v083.auto.c postgres/interface/v083.h
|
postgres/interface/v083.o: postgres/interface/v083.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v083.auto.c postgres/interface/v083.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v083.c -o postgres/interface/v083.o
|
$(CC) $(CFLAGS) -c postgres/interface/v083.c -o postgres/interface/v083.o
|
||||||
|
|
||||||
postgres/interface/v084.o: postgres/interface/v084.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v084.auto.c postgres/interface/v084.h
|
postgres/interface/v084.o: postgres/interface/v084.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v084.auto.c postgres/interface/v084.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v084.c -o postgres/interface/v084.o
|
$(CC) $(CFLAGS) -c postgres/interface/v084.c -o postgres/interface/v084.o
|
||||||
|
|
||||||
postgres/interface/v090.o: postgres/interface/v090.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v090.auto.c postgres/interface/v090.h
|
postgres/interface/v090.o: postgres/interface/v090.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v090.auto.c postgres/interface/v090.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v090.c -o postgres/interface/v090.o
|
$(CC) $(CFLAGS) -c postgres/interface/v090.c -o postgres/interface/v090.o
|
||||||
|
|
||||||
postgres/interface/v091.o: postgres/interface/v091.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v091.auto.c postgres/interface/v091.h
|
postgres/interface/v091.o: postgres/interface/v091.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v091.auto.c postgres/interface/v091.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v091.c -o postgres/interface/v091.o
|
$(CC) $(CFLAGS) -c postgres/interface/v091.c -o postgres/interface/v091.o
|
||||||
|
|
||||||
postgres/interface/v092.o: postgres/interface/v092.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v092.auto.c postgres/interface/v092.h
|
postgres/interface/v092.o: postgres/interface/v092.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v092.auto.c postgres/interface/v092.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v092.c -o postgres/interface/v092.o
|
$(CC) $(CFLAGS) -c postgres/interface/v092.c -o postgres/interface/v092.o
|
||||||
|
|
||||||
postgres/interface/v093.o: postgres/interface/v093.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v093.auto.c postgres/interface/v093.h
|
postgres/interface/v093.o: postgres/interface/v093.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v093.auto.c postgres/interface/v093.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v093.c -o postgres/interface/v093.o
|
$(CC) $(CFLAGS) -c postgres/interface/v093.c -o postgres/interface/v093.o
|
||||||
|
|
||||||
postgres/interface/v094.o: postgres/interface/v094.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v094.auto.c postgres/interface/v094.h
|
postgres/interface/v094.o: postgres/interface/v094.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v094.auto.c postgres/interface/v094.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v094.c -o postgres/interface/v094.o
|
$(CC) $(CFLAGS) -c postgres/interface/v094.c -o postgres/interface/v094.o
|
||||||
|
|
||||||
postgres/interface/v095.o: postgres/interface/v095.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v095.auto.c postgres/interface/v095.h
|
postgres/interface/v095.o: postgres/interface/v095.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v095.auto.c postgres/interface/v095.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v095.c -o postgres/interface/v095.o
|
$(CC) $(CFLAGS) -c postgres/interface/v095.c -o postgres/interface/v095.o
|
||||||
|
|
||||||
postgres/interface/v096.o: postgres/interface/v096.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v096.auto.c postgres/interface/v096.h
|
postgres/interface/v096.o: postgres/interface/v096.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v096.auto.c postgres/interface/v096.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v096.c -o postgres/interface/v096.o
|
$(CC) $(CFLAGS) -c postgres/interface/v096.c -o postgres/interface/v096.o
|
||||||
|
|
||||||
postgres/interface/v100.o: postgres/interface/v100.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v100.auto.c postgres/interface/v100.h
|
postgres/interface/v100.o: postgres/interface/v100.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v100.auto.c postgres/interface/v100.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v100.c -o postgres/interface/v100.o
|
$(CC) $(CFLAGS) -c postgres/interface/v100.c -o postgres/interface/v100.o
|
||||||
|
|
||||||
postgres/interface/v110.o: postgres/interface/v110.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v110.auto.c postgres/interface/v110.h
|
postgres/interface/v110.o: postgres/interface/v110.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v110.auto.c postgres/interface/v110.h
|
||||||
$(CC) $(CFLAGS) -c postgres/interface/v110.c -o postgres/interface/v110.o
|
$(CC) $(CFLAGS) -c postgres/interface/v110.c -o postgres/interface/v110.o
|
||||||
|
|
||||||
postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h
|
postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h
|
||||||
@@ -418,7 +418,7 @@ postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h
|
|||||||
protocol/client.o: protocol/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h version.h
|
protocol/client.o: protocol/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h version.h
|
||||||
$(CC) $(CFLAGS) -c protocol/client.c -o protocol/client.o
|
$(CC) $(CFLAGS) -c protocol/client.c -o protocol/client.o
|
||||||
|
|
||||||
protocol/helper.o: protocol/helper.c common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h protocol/client.h protocol/helper.h
|
protocol/helper.o: protocol/helper.c common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h protocol/client.h protocol/helper.h
|
||||||
$(CC) $(CFLAGS) -c protocol/helper.c -o protocol/helper.o
|
$(CC) $(CFLAGS) -c protocol/helper.c -o protocol/helper.o
|
||||||
|
|
||||||
storage/driver/posix/common.o: storage/driver/posix/common.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h
|
storage/driver/posix/common.o: storage/driver/posix/common.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h
|
||||||
@@ -430,7 +430,7 @@ storage/driver/posix/fileRead.o: storage/driver/posix/fileRead.c common/assert.h
|
|||||||
storage/driver/posix/fileWrite.o: storage/driver/posix/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileWrite.h storage/fileWrite.intern.h version.h
|
storage/driver/posix/fileWrite.o: storage/driver/posix/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileWrite.h storage/fileWrite.intern.h version.h
|
||||||
$(CC) $(CFLAGS) -c storage/driver/posix/fileWrite.c -o storage/driver/posix/fileWrite.o
|
$(CC) $(CFLAGS) -c storage/driver/posix/fileWrite.c -o storage/driver/posix/fileWrite.o
|
||||||
|
|
||||||
storage/driver/posix/storage.o: storage/driver/posix/storage.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
storage/driver/posix/storage.o: storage/driver/posix/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
||||||
$(CC) $(CFLAGS) -c storage/driver/posix/storage.c -o storage/driver/posix/storage.o
|
$(CC) $(CFLAGS) -c storage/driver/posix/storage.c -o storage/driver/posix/storage.o
|
||||||
|
|
||||||
storage/driver/remote/fileRead.o: storage/driver/remote/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h storage/driver/remote/fileRead.h storage/driver/remote/storage.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
storage/driver/remote/fileRead.o: storage/driver/remote/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h storage/driver/remote/fileRead.h storage/driver/remote/storage.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
||||||
@@ -451,7 +451,7 @@ storage/fileRead.o: storage/fileRead.c common/assert.h common/debug.h common/err
|
|||||||
storage/fileWrite.o: storage/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/fileWrite.h storage/fileWrite.intern.h version.h
|
storage/fileWrite.o: storage/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/fileWrite.h storage/fileWrite.intern.h version.h
|
||||||
$(CC) $(CFLAGS) -c storage/fileWrite.c -o storage/fileWrite.o
|
$(CC) $(CFLAGS) -c storage/fileWrite.c -o storage/fileWrite.o
|
||||||
|
|
||||||
storage/helper.o: storage/helper.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/client.h protocol/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/driver/remote/storage.h storage/driver/s3/storage.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h
|
storage/helper.o: storage/helper.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/client.h protocol/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/driver/remote/storage.h storage/driver/s3/storage.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h
|
||||||
$(CC) $(CFLAGS) -c storage/helper.c -o storage/helper.o
|
$(CC) $(CFLAGS) -c storage/helper.c -o storage/helper.o
|
||||||
|
|
||||||
storage/storage.o: storage/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
storage/storage.o: storage/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Archive Push Command
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "command/archive/common.h"
|
#include "command/archive/common.h"
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
@@ -30,11 +29,11 @@ Check for ok/error status files in the spool in/out directory
|
|||||||
bool
|
bool
|
||||||
archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool confessOnError)
|
archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool confessOnError)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, archiveMode);
|
FUNCTION_LOG_PARAM(ENUM, archiveMode);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, confessOnError);
|
FUNCTION_LOG_PARAM(BOOL, confessOnError);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -118,7 +117,7 @@ archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool confe
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -127,14 +126,14 @@ Is the segment partial?
|
|||||||
bool
|
bool
|
||||||
walIsPartial(const String *walSegment)
|
walIsPartial(const String *walSegment)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(walSegment != NULL);
|
ASSERT(walSegment != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(walIsSegment(walSegment));
|
ASSERT(walIsSegment(walSegment));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, strEndsWithZ(walSegment, WAL_SEGMENT_PARTIAL_EXT));
|
FUNCTION_LOG_RETURN(BOOL, strEndsWithZ(walSegment, WAL_SEGMENT_PARTIAL_EXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -143,11 +142,11 @@ Is the file a segment or some other file (e.g. .history, .backup, etc)
|
|||||||
bool
|
bool
|
||||||
walIsSegment(const String *walSegment)
|
walIsSegment(const String *walSegment)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(walSegment != NULL);
|
ASSERT(walSegment != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Create the regular expression to identify WAL segments if it does not already exist
|
// Create the regular expression to identify WAL segments if it does not already exist
|
||||||
static RegExp *regExpSegment = NULL;
|
static RegExp *regExpSegment = NULL;
|
||||||
@@ -161,7 +160,7 @@ walIsSegment(const String *walSegment)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, regExpMatch(regExpSegment, walSegment));
|
FUNCTION_LOG_RETURN(BOOL, regExpMatch(regExpSegment, walSegment));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -173,16 +172,16 @@ have multiple files that match the segment, though more than one match is not a
|
|||||||
String *
|
String *
|
||||||
walSegmentFind(const Storage *storage, const String *archiveId, const String *walSegment)
|
walSegmentFind(const Storage *storage, const String *archiveId, const String *walSegment)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STORAGE, storage);
|
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, archiveId);
|
FUNCTION_LOG_PARAM(STRING, archiveId);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(storage != NULL);
|
ASSERT(storage != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(archiveId != NULL);
|
ASSERT(archiveId != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(walSegment != NULL);
|
ASSERT(walSegment != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(walIsSegment(walSegment));
|
ASSERT(walIsSegment(walSegment));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
@@ -214,7 +213,7 @@ walSegmentFind(const Storage *storage, const String *archiveId, const String *wa
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -223,16 +222,16 @@ Get the next WAL segment given a WAL segment and WAL segment size
|
|||||||
String *
|
String *
|
||||||
walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgVersion)
|
walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgVersion)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, walSegmentSize);
|
FUNCTION_LOG_PARAM(SIZE, walSegmentSize);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, pgVersion);
|
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(walSegment != NULL);
|
ASSERT(walSegment != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(strSize(walSegment) == 24);
|
ASSERT(strSize(walSegment) == 24);
|
||||||
FUNCTION_DEBUG_ASSERT(UINT32_MAX % walSegmentSize == walSegmentSize - 1);
|
ASSERT(UINT32_MAX % walSegmentSize == walSegmentSize - 1);
|
||||||
FUNCTION_DEBUG_ASSERT(pgVersion >= PG_VERSION_11 || walSegmentSize == 16 * 1024 * 1024);
|
ASSERT(pgVersion >= PG_VERSION_11 || walSegmentSize == 16 * 1024 * 1024);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Extract WAL parts
|
// Extract WAL parts
|
||||||
uint32_t timeline = 0;
|
uint32_t timeline = 0;
|
||||||
@@ -263,7 +262,7 @@ walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgV
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, strNewFmt("%08X%08X%08X", timeline, major, minor));
|
FUNCTION_LOG_RETURN(STRING, strNewFmt("%08X%08X%08X", timeline, major, minor));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -272,13 +271,13 @@ Build a list of WAL segments based on a beginning WAL and number of WAL in the r
|
|||||||
StringList *
|
StringList *
|
||||||
walSegmentRange(const String *walSegmentBegin, size_t walSegmentSize, unsigned int pgVersion, unsigned int range)
|
walSegmentRange(const String *walSegmentBegin, size_t walSegmentSize, unsigned int pgVersion, unsigned int range)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegmentBegin);
|
FUNCTION_LOG_PARAM(STRING, walSegmentBegin);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, walSegmentSize);
|
FUNCTION_LOG_PARAM(SIZE, walSegmentSize);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, pgVersion);
|
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(range > 0);
|
ASSERT(range > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
@@ -305,5 +304,5 @@ walSegmentRange(const String *walSegmentBegin, size_t walSegmentSize, unsigned i
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING_LIST, result);
|
FUNCTION_LOG_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ Archive Get File
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Check if a WAL file exists in the repository
|
Check if a WAL file exists in the repository
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_ARCHIVE_GET_CHECK_RESULT_TYPE \
|
#define FUNCTION_LOG_ARCHIVE_GET_CHECK_RESULT_TYPE \
|
||||||
ArchiveGetCheckResult
|
ArchiveGetCheckResult
|
||||||
#define FUNCTION_DEBUG_ARCHIVE_GET_CHECK_RESULT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_ARCHIVE_GET_CHECK_RESULT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(&value, "ArchiveGetCheckResult", buffer, bufferSize)
|
objToLog(&value, "ArchiveGetCheckResult", buffer, bufferSize)
|
||||||
|
|
||||||
typedef struct ArchiveGetCheckResult
|
typedef struct ArchiveGetCheckResult
|
||||||
@@ -33,13 +33,13 @@ typedef struct ArchiveGetCheckResult
|
|||||||
ArchiveGetCheckResult
|
ArchiveGetCheckResult
|
||||||
archiveGetCheck(const String *archiveFile, CipherType cipherType, const String *cipherPass)
|
archiveGetCheck(const String *archiveFile, CipherType cipherType, const String *cipherPass)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, archiveFile);
|
FUNCTION_LOG_PARAM(STRING, archiveFile);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
// cipherPass omitted for security
|
// cipherPass omitted for security
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(archiveFile != NULL);
|
ASSERT(archiveFile != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
ArchiveGetCheckResult result = {0};
|
ArchiveGetCheckResult result = {0};
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ archiveGetCheck(const String *archiveFile, CipherType cipherType, const String *
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(ARCHIVE_GET_CHECK_RESULT, result);
|
FUNCTION_LOG_RETURN(ARCHIVE_GET_CHECK_RESULT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -114,15 +114,15 @@ Copy a file from the archive to the specified destination
|
|||||||
int
|
int
|
||||||
archiveGetFile(const String *archiveFile, const String *walDestination, CipherType cipherType, const String *cipherPass)
|
archiveGetFile(const String *archiveFile, const String *walDestination, CipherType cipherType, const String *cipherPass)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, archiveFile);
|
FUNCTION_LOG_PARAM(STRING, archiveFile);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walDestination);
|
FUNCTION_LOG_PARAM(STRING, walDestination);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
// cipherPass omitted for security
|
// cipherPass omitted for security
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(archiveFile != NULL);
|
ASSERT(archiveFile != NULL);
|
||||||
FUNCTION_TEST_ASSERT(walDestination != NULL);
|
ASSERT(walDestination != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// By default result indicates WAL segment not found
|
// By default result indicates WAL segment not found
|
||||||
int result = 1;
|
int result = 1;
|
||||||
@@ -173,5 +173,5 @@ archiveGetFile(const String *archiveFile, const String *walDestination, CipherTy
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(INT, result);
|
FUNCTION_LOG_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ Archive Get Command
|
|||||||
#include "command/archive/common.h"
|
#include "command/archive/common.h"
|
||||||
#include "command/archive/get/file.h"
|
#include "command/archive/get/file.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/fork.h"
|
#include "common/fork.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -27,15 +26,15 @@ Clean the queue and prepare a list of WAL segments that the async process should
|
|||||||
static StringList *
|
static StringList *
|
||||||
queueNeed(const String *walSegment, bool found, size_t queueSize, size_t walSegmentSize, unsigned int pgVersion)
|
queueNeed(const String *walSegment, bool found, size_t queueSize, size_t walSegmentSize, unsigned int pgVersion)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, walSegment);
|
FUNCTION_LOG_PARAM(STRING, walSegment);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, found);
|
FUNCTION_LOG_PARAM(BOOL, found);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, queueSize);
|
FUNCTION_LOG_PARAM(SIZE, queueSize);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, walSegmentSize);
|
FUNCTION_LOG_PARAM(SIZE, walSegmentSize);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, pgVersion);
|
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(walSegment != NULL);
|
ASSERT(walSegment != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
StringList *result = strLstNew();
|
StringList *result = strLstNew();
|
||||||
|
|
||||||
@@ -90,7 +89,7 @@ queueNeed(const String *walSegment, bool found, size_t queueSize, size_t walSegm
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING_LIST, result);
|
FUNCTION_LOG_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -99,7 +98,7 @@ Push a WAL segment to the repository
|
|||||||
int
|
int
|
||||||
cmdArchiveGet(void)
|
cmdArchiveGet(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
// Set the result assuming the archive file will not be found
|
// Set the result assuming the archive file will not be found
|
||||||
int result = 1;
|
int result = 1;
|
||||||
@@ -293,5 +292,5 @@ cmdArchiveGet(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(INT, result);
|
FUNCTION_LOG_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Push a WAL segment to the repository
|
|||||||
void
|
void
|
||||||
cmdArchivePush(void)
|
cmdArchivePush(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -127,5 +127,5 @@ cmdArchivePush(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ Common Command Routines
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
@@ -23,11 +22,11 @@ Capture time at the very start of main so total time is more accurate
|
|||||||
void
|
void
|
||||||
cmdInit(void)
|
cmdInit(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
timeBegin = timeMSec();
|
timeBegin = timeMSec();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -36,11 +35,11 @@ Begin the command
|
|||||||
void
|
void
|
||||||
cmdBegin(bool logOption)
|
cmdBegin(bool logOption)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, logOption);
|
FUNCTION_LOG_PARAM(BOOL, logOption);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(cfgCommand() != cfgCmdNone);
|
ASSERT(cfgCommand() != cfgCmdNone);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// This is fairly expensive log message to generate so skip it if it won't be output
|
// This is fairly expensive log message to generate so skip it if it won't be output
|
||||||
if (logWill(cfgLogLevelDefault()))
|
if (logWill(cfgLogLevelDefault()))
|
||||||
@@ -157,7 +156,7 @@ cmdBegin(bool logOption)
|
|||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -166,12 +165,12 @@ End the command
|
|||||||
void
|
void
|
||||||
cmdEnd(int code, const String *errorMessage)
|
cmdEnd(int code, const String *errorMessage)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, code);
|
FUNCTION_LOG_PARAM(INT, code);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, errorMessage);
|
FUNCTION_LOG_PARAM(STRING, errorMessage);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(cfgCommand() != cfgCmdNone);
|
ASSERT(cfgCommand() != cfgCmdNone);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Skip this log message if it won't be output. It's not too expensive but since we skipped cmdBegin(), may as well.
|
// Skip this log message if it won't be output. It's not too expensive but since we skipped cmdBegin(), may as well.
|
||||||
if (logWill(cfgLogLevelDefault()))
|
if (logWill(cfgLogLevelDefault()))
|
||||||
@@ -199,5 +198,5 @@ cmdEnd(int code, const String *errorMessage)
|
|||||||
// Reset timeBegin in case there is another command following this one
|
// Reset timeBegin in case there is another command following this one
|
||||||
timeBegin = timeMSec();
|
timeBegin = timeMSec();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ lockStopFileName(const String *stanza)
|
|||||||
|
|
||||||
String *result = strNewFmt("%s/%s.stop", strPtr(cfgOptionStr(cfgOptLockPath)), stanza != NULL ? strPtr(stanza) : "all");
|
String *result = strNewFmt("%s/%s.stop", strPtr(cfgOptionStr(cfgOptLockPath)), stanza != NULL ? strPtr(stanza) : "all");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -27,7 +27,7 @@ Test for the existence of a stop file
|
|||||||
void
|
void
|
||||||
lockStopTest(void)
|
lockStopTest(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -44,5 +44,5 @@ lockStopTest(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Help Command
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/handleWrite.h"
|
#include "common/io/handleWrite.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
@@ -24,15 +23,15 @@ Helper function for helpRender() to make output look good on a console
|
|||||||
static String *
|
static String *
|
||||||
helpRenderText(const String *text, size_t indent, bool indentFirst, size_t length)
|
helpRenderText(const String *text, size_t indent, bool indentFirst, size_t length)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, text);
|
FUNCTION_LOG_PARAM(STRING, text);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, indent);
|
FUNCTION_LOG_PARAM(SIZE, indent);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, indentFirst);
|
FUNCTION_LOG_PARAM(BOOL, indentFirst);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, length);
|
FUNCTION_LOG_PARAM(SIZE, length);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(text != NULL);
|
ASSERT(text != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(length > 0);
|
ASSERT(length > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *result = strNew("");
|
String *result = strNew("");
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ helpRenderText(const String *text, size_t indent, bool indentFirst, size_t lengt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -75,9 +74,9 @@ Helper function for helpRender() to output values as strings
|
|||||||
static const String *
|
static const String *
|
||||||
helpRenderValue(const Variant *value)
|
helpRenderValue(const Variant *value)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(VARIANT, value);
|
FUNCTION_LOG_PARAM(VARIANT, value);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
const String *result = NULL;
|
const String *result = NULL;
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ helpRenderValue(const Variant *value)
|
|||||||
result = varStrForce(value);
|
result = varStrForce(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(CONST_STRING, result);
|
FUNCTION_LOG_RETURN(CONST_STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -138,7 +137,7 @@ Render help to a string
|
|||||||
static String *
|
static String *
|
||||||
helpRender(void)
|
helpRender(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
String *result = strNew(PROJECT_NAME " " PROJECT_VERSION);
|
String *result = strNew(PROJECT_NAME " " PROJECT_VERSION);
|
||||||
|
|
||||||
@@ -380,7 +379,7 @@ helpRender(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -389,7 +388,7 @@ Render help and output to stdout
|
|||||||
void
|
void
|
||||||
cmdHelp(void)
|
cmdHelp(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -397,5 +396,5 @@ cmdHelp(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,19 +80,19 @@ stanzaStatus(const int code, const String *message, Variant *stanzaInfo)
|
|||||||
FUNCTION_TEST_PARAM(INT, code);
|
FUNCTION_TEST_PARAM(INT, code);
|
||||||
FUNCTION_TEST_PARAM(STRING, message);
|
FUNCTION_TEST_PARAM(STRING, message);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, stanzaInfo);
|
FUNCTION_TEST_PARAM(VARIANT, stanzaInfo);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(code >= 0 && code <= 3);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(stanzaInfo != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(code >= 0 && code <= 3);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
ASSERT(stanzaInfo != NULL);
|
||||||
|
|
||||||
Variant *stanzaStatus = varNewStr(STANZA_KEY_STATUS_STR);
|
Variant *stanzaStatus = varNewStr(STANZA_KEY_STATUS_STR);
|
||||||
KeyValue *statusKv = kvPutKv(varKv(stanzaInfo), stanzaStatus);
|
KeyValue *statusKv = kvPutKv(varKv(stanzaInfo), stanzaStatus);
|
||||||
|
|
||||||
kvAdd(statusKv, varNewStr(STATUS_KEY_CODE_STR), varNewInt(code));
|
kvAdd(statusKv, varNewStr(STATUS_KEY_CODE_STR), varNewInt(code));
|
||||||
kvAdd(statusKv, varNewStr(STATUS_KEY_MESSAGE_STR), varNewStr(message));
|
kvAdd(statusKv, varNewStr(STATUS_KEY_MESSAGE_STR), varNewStr(message));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -106,12 +106,12 @@ archiveDbList(const String *stanza, const InfoPgData *pgData, VariantList *archi
|
|||||||
FUNCTION_TEST_PARAM(INFO_PG_DATAP, pgData);
|
FUNCTION_TEST_PARAM(INFO_PG_DATAP, pgData);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, archiveSection);
|
FUNCTION_TEST_PARAM(VARIANT, archiveSection);
|
||||||
FUNCTION_TEST_PARAM(BOOL, currentDb);
|
FUNCTION_TEST_PARAM(BOOL, currentDb);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(stanza != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(pgData != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(archiveSection != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(stanza != NULL);
|
||||||
|
ASSERT(pgData != NULL);
|
||||||
|
ASSERT(archiveSection != NULL);
|
||||||
|
|
||||||
// With multiple DB versions, the backup.info history-id may not be the same as archive.info history-id, so the
|
// With multiple DB versions, the backup.info history-id may not be the same as archive.info history-id, so the
|
||||||
// archive path must be built by retrieving the archive id given the db version and system id of the backup.info file.
|
// archive path must be built by retrieving the archive id given the db version and system id of the backup.info file.
|
||||||
// If there is no match, an error will be thrown.
|
// If there is no match, an error will be thrown.
|
||||||
@@ -185,7 +185,7 @@ archiveDbList(const String *stanza, const InfoPgData *pgData, VariantList *archi
|
|||||||
varLstAdd(archiveSection, archiveInfo);
|
varLstAdd(archiveSection, archiveInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -197,11 +197,11 @@ backupList(VariantList *backupSection, InfoBackup *info)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, backupSection);
|
FUNCTION_TEST_PARAM(VARIANT, backupSection);
|
||||||
FUNCTION_TEST_PARAM(INFO_BACKUP, info);
|
FUNCTION_TEST_PARAM(INFO_BACKUP, info);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(backupSection != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(info != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(backupSection != NULL);
|
||||||
|
ASSERT(info != NULL);
|
||||||
|
|
||||||
// For each current backup, get the label and corresponding data and build the backup section
|
// For each current backup, get the label and corresponding data and build the backup section
|
||||||
for (unsigned int keyIdx = 0; keyIdx < infoBackupDataTotal(info); keyIdx++)
|
for (unsigned int keyIdx = 0; keyIdx < infoBackupDataTotal(info); keyIdx++)
|
||||||
{
|
{
|
||||||
@@ -263,7 +263,7 @@ backupList(VariantList *backupSection, InfoBackup *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -275,10 +275,10 @@ stanzaInfoList(const String *stanza, StringList *stanzaList)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, stanza);
|
FUNCTION_TEST_PARAM(STRING, stanza);
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, stanzaList);
|
FUNCTION_TEST_PARAM(STRING_LIST, stanzaList);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(stanzaList != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(stanzaList != NULL);
|
||||||
|
|
||||||
VariantList *result = varLstNew();
|
VariantList *result = varLstNew();
|
||||||
bool stanzaFound = false;
|
bool stanzaFound = false;
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ stanzaInfoList(const String *stanza, StringList *stanzaList)
|
|||||||
varLstAdd(result, stanzaInfo);
|
varLstAdd(result, stanzaInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, result);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -411,10 +411,10 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, stanzaInfo);
|
FUNCTION_TEST_PARAM(KEY_VALUE, stanzaInfo);
|
||||||
FUNCTION_TEST_PARAM(STRING, resultStr);
|
FUNCTION_TEST_PARAM(STRING, resultStr);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(stanzaInfo != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(stanzaInfo != NULL);
|
||||||
|
|
||||||
VariantList *dbSection = kvGetList(stanzaInfo, varNewStr(STANZA_KEY_DB_STR));
|
VariantList *dbSection = kvGetList(stanzaInfo, varNewStr(STANZA_KEY_DB_STR));
|
||||||
VariantList *archiveSection = kvGetList(stanzaInfo, varNewStr(KEY_ARCHIVE_STR));
|
VariantList *archiveSection = kvGetList(stanzaInfo, varNewStr(KEY_ARCHIVE_STR));
|
||||||
VariantList *backupSection = kvGetList(stanzaInfo, varNewStr(STANZA_KEY_BACKUP_STR));
|
VariantList *backupSection = kvGetList(stanzaInfo, varNewStr(STANZA_KEY_BACKUP_STR));
|
||||||
@@ -532,7 +532,7 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr)
|
|||||||
strCat(resultStr, strPtr(backupResult));
|
strCat(resultStr, strPtr(backupResult));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -541,7 +541,7 @@ Render the information for the stanza based on the command parameters.
|
|||||||
static String *
|
static String *
|
||||||
infoRender(void)
|
infoRender(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
@@ -623,7 +623,7 @@ infoRender(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -632,7 +632,7 @@ Render info and output to stdout
|
|||||||
void
|
void
|
||||||
cmdInfo(void)
|
cmdInfo(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelDebug);
|
FUNCTION_LOG_VOID(logLevelDebug);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -640,5 +640,5 @@ cmdInfo(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,30 +7,19 @@ Assert Routines
|
|||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
For very important asserts that are shipped with the production code
|
Asserts are used in test code to ensure that certain conditions are true. They are ommitted from production builds.
|
||||||
***********************************************************************************************************************************/
|
|
||||||
#define ASSERT(condition) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
if (!(condition)) \
|
|
||||||
THROW_FMT(AssertError, "assertion '%s' failed", #condition); \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
|
||||||
Used for assertions that should only be run when debugging. Ideal for conditions that need to be tested during development but
|
|
||||||
be too expensive to ship with the production code.
|
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#define ASSERT_DEBUG(condition) \
|
#define ASSERT(condition) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
THROW_FMT(AssertError, "debug assertion '%s' failed", #condition); \
|
THROW_FMT(AssertError, "assertion '%s' failed", #condition); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
#else
|
#else
|
||||||
#define ASSERT_DEBUG(condition)
|
#define ASSERT(condition)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Debug Routines
|
|||||||
#ifndef COMMON_DEBUG_H
|
#ifndef COMMON_DEBUG_H
|
||||||
#define COMMON_DEBUG_H
|
#define COMMON_DEBUG_H
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/stackTrace.h"
|
#include "common/stackTrace.h"
|
||||||
#include "common/type/convert.h"
|
#include "common/type/convert.h"
|
||||||
|
|
||||||
@@ -30,65 +31,65 @@ Base function debugging macros
|
|||||||
In debug mode parameters will always be recorded in the stack trace while in production mode they will only be recorded when the log
|
In debug mode parameters will always be recorded in the stack trace while in production mode they will only be recorded when the log
|
||||||
level is set to debug or trace.
|
level is set to debug or trace.
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_LEVEL() \
|
#define FUNCTION_LOG_LEVEL() \
|
||||||
FUNCTION_DEBUG_logLevel
|
FUNCTION_LOG_logLevel
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define FUNCTION_DEBUG_BEGIN_BASE(logLevel) \
|
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \
|
||||||
LogLevel FUNCTION_DEBUG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
|
LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
|
||||||
\
|
\
|
||||||
{ \
|
{ \
|
||||||
stackTraceParamLog();
|
stackTraceParamLog();
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_END_BASE() \
|
#define FUNCTION_LOG_END_BASE() \
|
||||||
LOG_WILL(FUNCTION_DEBUG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
LOG_WILL(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_PARAM_BASE_BEGIN() \
|
#define FUNCTION_LOG_PARAM_BASE_BEGIN() \
|
||||||
stackTraceTestStop() \
|
stackTraceTestStop() \
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_PARAM_BASE_END() \
|
#define FUNCTION_LOG_PARAM_BASE_END() \
|
||||||
stackTraceTestStart()
|
stackTraceTestStart()
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_DEBUG_BEGIN_BASE(logLevel) \
|
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \
|
||||||
LogLevel FUNCTION_DEBUG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
|
LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
|
||||||
\
|
\
|
||||||
if (logWill(FUNCTION_DEBUG_LEVEL())) \
|
if (logWill(FUNCTION_LOG_LEVEL())) \
|
||||||
{ \
|
{ \
|
||||||
stackTraceParamLog()
|
stackTraceParamLog()
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_END_BASE() \
|
#define FUNCTION_LOG_END_BASE() \
|
||||||
LOG(FUNCTION_DEBUG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
LOG(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_PARAM_BASE_BEGIN()
|
#define FUNCTION_LOG_PARAM_BASE_BEGIN()
|
||||||
#define FUNCTION_DEBUG_PARAM_BASE_END()
|
#define FUNCTION_LOG_PARAM_BASE_END()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
General purpose function debugging macros
|
General purpose function debugging macros
|
||||||
|
|
||||||
FUNCTION_DEBUG_VOID() is provided as a shortcut for functions that have no parameters.
|
FUNCTION_LOG_VOID() is provided as a shortcut for functions that have no parameters.
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_BEGIN(logLevel) \
|
#define FUNCTION_LOG_BEGIN(logLevel) \
|
||||||
FUNCTION_DEBUG_BEGIN_BASE(logLevel)
|
FUNCTION_LOG_BEGIN_BASE(logLevel)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_END() \
|
#define FUNCTION_LOG_END() \
|
||||||
FUNCTION_DEBUG_END_BASE()
|
FUNCTION_LOG_END_BASE()
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_VOID(logLevel) \
|
#define FUNCTION_LOG_VOID(logLevel) \
|
||||||
FUNCTION_DEBUG_BEGIN_BASE(logLevel); \
|
FUNCTION_LOG_BEGIN_BASE(logLevel); \
|
||||||
FUNCTION_DEBUG_END_BASE()
|
FUNCTION_LOG_END_BASE()
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_PARAM(typeMacroPrefix, param) \
|
#define FUNCTION_LOG_PARAM(typeMacroPrefix, param) \
|
||||||
FUNCTION_DEBUG_PARAM_BASE_BEGIN(); \
|
FUNCTION_LOG_PARAM_BASE_BEGIN(); \
|
||||||
stackTraceParamAdd(FUNCTION_DEBUG_##typeMacroPrefix##_FORMAT(param, stackTraceParamBuffer(#param), STACK_TRACE_PARAM_MAX)); \
|
stackTraceParamAdd(FUNCTION_LOG_##typeMacroPrefix##_FORMAT(param, stackTraceParamBuffer(#param), STACK_TRACE_PARAM_MAX)); \
|
||||||
FUNCTION_DEBUG_PARAM_BASE_END()
|
FUNCTION_LOG_PARAM_BASE_END()
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_PARAM_PTR(typeName, param) \
|
#define FUNCTION_LOG_PARAM_PTR(typeName, param) \
|
||||||
FUNCTION_DEBUG_PARAM_BASE_BEGIN(); \
|
FUNCTION_LOG_PARAM_BASE_BEGIN(); \
|
||||||
stackTraceParamAdd(ptrToLog(param, typeName, stackTraceParamBuffer(#param), STACK_TRACE_PARAM_MAX )); \
|
stackTraceParamAdd(ptrToLog(param, typeName, stackTraceParamBuffer(#param), STACK_TRACE_PARAM_MAX )); \
|
||||||
FUNCTION_DEBUG_PARAM_BASE_END()
|
FUNCTION_LOG_PARAM_BASE_END()
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Functions and macros to render various data types
|
Functions and macros to render various data types
|
||||||
@@ -97,175 +98,162 @@ size_t objToLog(const void *object, const char *objectName, char *buffer, size_t
|
|||||||
size_t ptrToLog(const void *pointer, const char *pointerName, char *buffer, size_t bufferSize);
|
size_t ptrToLog(const void *pointer, const char *pointerName, char *buffer, size_t bufferSize);
|
||||||
size_t strzToLog(const char *string, char *buffer, size_t bufferSize);
|
size_t strzToLog(const char *string, char *buffer, size_t bufferSize);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_BOOL_TYPE \
|
#define FUNCTION_LOG_BOOL_TYPE \
|
||||||
bool
|
bool
|
||||||
#define FUNCTION_DEBUG_BOOL_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_BOOL_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtBoolToZ(value, buffer, bufferSize)
|
cvtBoolToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_BOOLP_TYPE \
|
#define FUNCTION_LOG_BOOLP_TYPE \
|
||||||
bool *
|
bool *
|
||||||
#define FUNCTION_DEBUG_BOOLP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_BOOLP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "bool *", buffer, bufferSize)
|
ptrToLog(value, "bool *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CHAR_TYPE \
|
#define FUNCTION_LOG_CHAR_TYPE \
|
||||||
char
|
char
|
||||||
#define FUNCTION_DEBUG_CHAR_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CHAR_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtCharToZ(value, buffer, bufferSize)
|
cvtCharToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CHARP_TYPE \
|
#define FUNCTION_LOG_CHARP_TYPE \
|
||||||
char *
|
char *
|
||||||
#define FUNCTION_DEBUG_CHARP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CHARP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "char *", buffer, bufferSize)
|
ptrToLog(value, "char *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CONST_CHARPP_TYPE \
|
#define FUNCTION_LOG_CONST_CHARPP_TYPE \
|
||||||
const char **
|
const char **
|
||||||
#define FUNCTION_DEBUG_CONST_CHARPP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CONST_CHARPP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "char **", buffer, bufferSize)
|
ptrToLog(value, "char **", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CHARPY_TYPE \
|
#define FUNCTION_LOG_CHARPY_TYPE \
|
||||||
char *[]
|
char *[]
|
||||||
#define FUNCTION_DEBUG_CHARPY_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CHARPY_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "char *[]", buffer, bufferSize)
|
ptrToLog(value, "char *[]", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_DOUBLE_TYPE \
|
#define FUNCTION_LOG_DOUBLE_TYPE \
|
||||||
double
|
double
|
||||||
#define FUNCTION_DEBUG_DOUBLE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_DOUBLE_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtDoubleToZ(value, buffer, bufferSize)
|
cvtDoubleToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_DOUBLEP_TYPE \
|
#define FUNCTION_LOG_DOUBLEP_TYPE \
|
||||||
double *
|
double *
|
||||||
#define FUNCTION_DEBUG_DOUBLEP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_DOUBLEP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "double *", buffer, bufferSize)
|
ptrToLog(value, "double *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_INT_TYPE \
|
#define FUNCTION_LOG_INT_TYPE \
|
||||||
int
|
int
|
||||||
#define FUNCTION_DEBUG_INT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_INT_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtIntToZ(value, buffer, bufferSize)
|
cvtIntToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_INTP_TYPE \
|
#define FUNCTION_LOG_INTP_TYPE \
|
||||||
int *
|
int *
|
||||||
#define FUNCTION_DEBUG_INTP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_INTP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "int *", buffer, bufferSize)
|
ptrToLog(value, "int *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_INT64_TYPE \
|
#define FUNCTION_LOG_INT64_TYPE \
|
||||||
int64_t
|
int64_t
|
||||||
#define FUNCTION_DEBUG_INT64_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_INT64_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtInt64ToZ(value, buffer, bufferSize)
|
cvtInt64ToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_ENUM_TYPE \
|
#define FUNCTION_LOG_ENUM_TYPE \
|
||||||
unsigned int
|
unsigned int
|
||||||
#define FUNCTION_DEBUG_ENUM_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_ENUM_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_UINT_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_UINT_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_FUNCTIONP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_FUNCTIONP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value == NULL ? NULL : (void *)1, "function *", buffer, bufferSize)
|
ptrToLog(value == NULL ? NULL : (void *)1, "function *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_MODE_TYPE \
|
#define FUNCTION_LOG_MODE_TYPE \
|
||||||
mode_t
|
mode_t
|
||||||
#define FUNCTION_DEBUG_MODE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_MODE_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtModeToZ(value, buffer, bufferSize)
|
cvtModeToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_TIMEMSEC_TYPE \
|
#define FUNCTION_LOG_TIMEMSEC_TYPE \
|
||||||
TimeMSec
|
TimeMSec
|
||||||
#define FUNCTION_DEBUG_TIMEMSEC_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_TIMEMSEC_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtUInt64ToZ(value, buffer, bufferSize)
|
cvtUInt64ToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UCHARP_TYPE \
|
#define FUNCTION_LOG_UCHARP_TYPE \
|
||||||
unsigned char *
|
unsigned char *
|
||||||
#define FUNCTION_DEBUG_UCHARP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UCHARP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "unsigned char *", buffer, bufferSize)
|
ptrToLog(value, "unsigned char *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_SIZE_TYPE \
|
#define FUNCTION_LOG_SIZE_TYPE \
|
||||||
size_t
|
size_t
|
||||||
#define FUNCTION_DEBUG_SIZE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_SIZE_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtSizeToZ(value, buffer, bufferSize)
|
cvtSizeToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UINT_TYPE \
|
#define FUNCTION_LOG_UINT_TYPE \
|
||||||
unsigned int
|
unsigned int
|
||||||
#define FUNCTION_DEBUG_UINT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UINT_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtUIntToZ(value, buffer, bufferSize)
|
cvtUIntToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UINTP_TYPE \
|
#define FUNCTION_LOG_UINTP_TYPE \
|
||||||
unsigned int *
|
unsigned int *
|
||||||
#define FUNCTION_DEBUG_UINTP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UINTP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "unsigned int *", buffer, bufferSize)
|
ptrToLog(value, "unsigned int *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UINT16_TYPE \
|
#define FUNCTION_LOG_UINT16_TYPE \
|
||||||
uint16_t
|
uint16_t
|
||||||
#define FUNCTION_DEBUG_UINT16_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UINT16_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_UINT_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_UINT_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UINT32_TYPE \
|
#define FUNCTION_LOG_UINT32_TYPE \
|
||||||
uint32_t
|
uint32_t
|
||||||
#define FUNCTION_DEBUG_UINT32_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UINT32_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_UINT_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_UINT_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_UINT64_TYPE \
|
#define FUNCTION_LOG_UINT64_TYPE \
|
||||||
uint64_t
|
uint64_t
|
||||||
#define FUNCTION_DEBUG_UINT64_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_UINT64_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtUInt64ToZ(value, buffer, bufferSize)
|
cvtUInt64ToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_VOIDP_TYPE \
|
#define FUNCTION_LOG_VOIDP_TYPE \
|
||||||
void *
|
void *
|
||||||
#define FUNCTION_DEBUG_VOIDP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_VOIDP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "void *", buffer, bufferSize)
|
ptrToLog(value, "void *", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CONST_VOIDP_TYPE \
|
#define FUNCTION_LOG_CONST_VOIDP_TYPE \
|
||||||
const void *
|
const void *
|
||||||
#define FUNCTION_DEBUG_CONST_VOIDP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CONST_VOIDP_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_VOIDP_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_VOIDP_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_VOIDPP_TYPE \
|
#define FUNCTION_LOG_VOIDPP_TYPE \
|
||||||
void **
|
void **
|
||||||
#define FUNCTION_DEBUG_VOIDPP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_VOIDPP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "void **", buffer, bufferSize)
|
ptrToLog(value, "void **", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_STRINGZ_TYPE \
|
#define FUNCTION_LOG_STRINGZ_TYPE \
|
||||||
const char *
|
const char *
|
||||||
#define FUNCTION_DEBUG_STRINGZ_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_STRINGZ_FORMAT(value, buffer, bufferSize) \
|
||||||
strzToLog(value, buffer, bufferSize)
|
strzToLog(value, buffer, bufferSize)
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
|
||||||
Assert function to be used with function debugging
|
|
||||||
|
|
||||||
The assert statement is compiled into production code but only runs when the log level >= debug
|
|
||||||
***********************************************************************************************************************************/
|
|
||||||
#define FUNCTION_DEBUG_ASSERT(condition) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
if (!(condition)) \
|
|
||||||
THROW_FMT(AssertError, "function debug assertion '%s' failed", #condition); \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros to return function results (or void)
|
Macros to return function results (or void)
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_RESULT(typeMacroPrefix, result) \
|
#define FUNCTION_LOG_RETURN(typeMacroPrefix, result) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
FUNCTION_DEBUG_##typeMacroPrefix##_TYPE FUNCTION_DEBUG_RESULT_result = result; \
|
FUNCTION_LOG_##typeMacroPrefix##_TYPE FUNCTION_LOG_RETURN_result = result; \
|
||||||
\
|
\
|
||||||
STACK_TRACE_POP(); \
|
STACK_TRACE_POP(); \
|
||||||
\
|
\
|
||||||
if (logWill(FUNCTION_DEBUG_LEVEL())) \
|
if (logWill(FUNCTION_LOG_LEVEL())) \
|
||||||
{ \
|
{ \
|
||||||
char buffer[STACK_TRACE_PARAM_MAX]; \
|
char buffer[STACK_TRACE_PARAM_MAX]; \
|
||||||
\
|
\
|
||||||
FUNCTION_DEBUG_##typeMacroPrefix##_FORMAT(FUNCTION_DEBUG_RESULT_result, buffer, sizeof(buffer)); \
|
FUNCTION_LOG_##typeMacroPrefix##_FORMAT(FUNCTION_LOG_RETURN_result, buffer, sizeof(buffer)); \
|
||||||
LOG(FUNCTION_DEBUG_LEVEL(), 0, "=> %s", buffer); \
|
LOG(FUNCTION_LOG_LEVEL(), 0, "=> %s", buffer); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
return FUNCTION_DEBUG_RESULT_result; \
|
return FUNCTION_LOG_RETURN_result; \
|
||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_RESULT_VOID() \
|
#define FUNCTION_LOG_RETURN_VOID() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
STACK_TRACE_POP(); \
|
STACK_TRACE_POP(); \
|
||||||
\
|
\
|
||||||
LOG_WILL(FUNCTION_DEBUG_LEVEL(), 0, "=> void"); \
|
LOG_WILL(FUNCTION_LOG_LEVEL(), 0, "=> void"); \
|
||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
|
||||||
@@ -283,10 +271,10 @@ test macros are compiled out.
|
|||||||
stackTraceParamLog()
|
stackTraceParamLog()
|
||||||
|
|
||||||
#define FUNCTION_TEST_PARAM(typeMacroPrefix, param) \
|
#define FUNCTION_TEST_PARAM(typeMacroPrefix, param) \
|
||||||
FUNCTION_DEBUG_PARAM(typeMacroPrefix, param)
|
FUNCTION_LOG_PARAM(typeMacroPrefix, param)
|
||||||
|
|
||||||
#define FUNCTION_TEST_PARAM_PTR(typeName, param) \
|
#define FUNCTION_TEST_PARAM_PTR(typeName, param) \
|
||||||
FUNCTION_DEBUG_PARAM_PTR(typeName, param)
|
FUNCTION_LOG_PARAM_PTR(typeName, param)
|
||||||
|
|
||||||
#define FUNCTION_TEST_END() \
|
#define FUNCTION_TEST_END() \
|
||||||
}
|
}
|
||||||
@@ -295,27 +283,19 @@ test macros are compiled out.
|
|||||||
FUNCTION_TEST_BEGIN(); \
|
FUNCTION_TEST_BEGIN(); \
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
#define FUNCTION_TEST_ASSERT(condition) \
|
#define FUNCTION_TEST_RETURN(typeMacroPrefix, result) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (!(condition)) \
|
FUNCTION_LOG_##typeMacroPrefix##_TYPE FUNCTION_LOG_RETURN_result = result; \
|
||||||
THROW_FMT(AssertError, "function test assertion '%s' failed", #condition); \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
#define FUNCTION_TEST_RESULT(typeMacroPrefix, result) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
FUNCTION_DEBUG_##typeMacroPrefix##_TYPE FUNCTION_DEBUG_RESULT_result = result; \
|
|
||||||
\
|
\
|
||||||
if (stackTraceTest()) \
|
if (stackTraceTest()) \
|
||||||
STACK_TRACE_POP(); \
|
STACK_TRACE_POP(); \
|
||||||
\
|
\
|
||||||
return FUNCTION_DEBUG_RESULT_result; \
|
return FUNCTION_LOG_RETURN_result; \
|
||||||
} \
|
} \
|
||||||
while(0);
|
while(0);
|
||||||
|
|
||||||
#define FUNCTION_TEST_RESULT_VOID() \
|
#define FUNCTION_TEST_RETURN_VOID() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (stackTraceTest()) \
|
if (stackTraceTest()) \
|
||||||
@@ -328,10 +308,9 @@ test macros are compiled out.
|
|||||||
#define FUNCTION_TEST_PARAM_PTR(typeName, param)
|
#define FUNCTION_TEST_PARAM_PTR(typeName, param)
|
||||||
#define FUNCTION_TEST_END()
|
#define FUNCTION_TEST_END()
|
||||||
#define FUNCTION_TEST_VOID()
|
#define FUNCTION_TEST_VOID()
|
||||||
#define FUNCTION_TEST_ASSERT(condition)
|
#define FUNCTION_TEST_RETURN(typeMacroPrefix, result) \
|
||||||
#define FUNCTION_TEST_RESULT(typeMacroPrefix, result) \
|
|
||||||
return result
|
return result
|
||||||
#define FUNCTION_TEST_RESULT_VOID()
|
#define FUNCTION_TEST_RETURN_VOID()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ encodeToStr(EncodeType encodeType, const unsigned char *source, size_t sourceSiz
|
|||||||
else
|
else
|
||||||
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -54,7 +54,7 @@ encodeToStrSize(EncodeType encodeType, size_t sourceSize)
|
|||||||
else
|
else
|
||||||
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, destinationSize);
|
FUNCTION_TEST_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -74,7 +74,7 @@ decodeToBin(EncodeType encodeType, const char *source, unsigned char *destinatio
|
|||||||
else
|
else
|
||||||
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -95,7 +95,7 @@ decodeToBinSize(EncodeType encodeType, const char *source)
|
|||||||
else
|
else
|
||||||
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, destinationSize);
|
FUNCTION_TEST_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -121,7 +121,7 @@ decodeToBinValid(EncodeType encodeType, const char *source)
|
|||||||
}
|
}
|
||||||
TRY_END();
|
TRY_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, valid);
|
FUNCTION_TEST_RETURN(BOOL, valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -140,5 +140,5 @@ decodeToBinValidate(EncodeType encodeType, const char *source)
|
|||||||
else
|
else
|
||||||
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
ENCODE_TYPE_INVALID_ERROR(encodeType);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ encodeToStrBase64(const unsigned char *source, size_t sourceSize, char *destinat
|
|||||||
FUNCTION_TEST_PARAM(UCHARP, source);
|
FUNCTION_TEST_PARAM(UCHARP, source);
|
||||||
FUNCTION_TEST_PARAM(SIZE, sourceSize);
|
FUNCTION_TEST_PARAM(SIZE, sourceSize);
|
||||||
FUNCTION_TEST_PARAM(CHARP, destination);
|
FUNCTION_TEST_PARAM(CHARP, destination);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(source != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(destination != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(source != NULL);
|
||||||
|
ASSERT(destination != NULL);
|
||||||
|
|
||||||
unsigned int destinationIdx = 0;
|
unsigned int destinationIdx = 0;
|
||||||
|
|
||||||
// Encode the string from three bytes to four characters
|
// Encode the string from three bytes to four characters
|
||||||
@@ -67,7 +67,7 @@ encodeToStrBase64(const unsigned char *source, size_t sourceSize, char *destinat
|
|||||||
// Zero-terminate the string
|
// Zero-terminate the string
|
||||||
destination[destinationIdx] = 0;
|
destination[destinationIdx] = 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -88,7 +88,7 @@ encodeToStrSizeBase64(size_t sourceSize)
|
|||||||
encodeGroupTotal++;
|
encodeGroupTotal++;
|
||||||
|
|
||||||
// Four characters are needed to encode each group
|
// Four characters are needed to encode each group
|
||||||
FUNCTION_TEST_RESULT(SIZE, encodeGroupTotal * 4);
|
FUNCTION_TEST_RETURN(SIZE, encodeGroupTotal * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -149,7 +149,7 @@ decodeToBinBase64(const char *source, unsigned char *destination)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -179,7 +179,7 @@ decodeToBinSizeBase64(const char *source)
|
|||||||
destinationSize--;
|
destinationSize--;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, destinationSize);
|
FUNCTION_TEST_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -220,5 +220,5 @@ decodeToBinValidateBase64(const char *source)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,9 +221,9 @@ void errorInternalThrowSysFmt(
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_ERROR_TYPE_TYPE \
|
#define FUNCTION_LOG_ERROR_TYPE_TYPE \
|
||||||
ErrorType *
|
ErrorType *
|
||||||
#define FUNCTION_DEBUG_ERROR_TYPE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_ERROR_TYPE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "ErrorType", buffer, bufferSize)
|
objToLog(value, "ErrorType", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ Execute Process
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/exec.h"
|
#include "common/exec.h"
|
||||||
@@ -49,16 +48,16 @@ New object
|
|||||||
Exec *
|
Exec *
|
||||||
execNew(const String *command, const StringList *param, const String *name, TimeMSec timeout)
|
execNew(const String *command, const StringList *param, const String *name, TimeMSec timeout)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug)
|
FUNCTION_LOG_BEGIN(logLevelDebug)
|
||||||
FUNCTION_DEBUG_PARAM(STRING, command);
|
FUNCTION_LOG_PARAM(STRING, command);
|
||||||
FUNCTION_DEBUG_PARAM(STRING_LIST, param);
|
FUNCTION_LOG_PARAM(STRING_LIST, param);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, name);
|
FUNCTION_LOG_PARAM(STRING, name);
|
||||||
FUNCTION_DEBUG_PARAM(TIME_MSEC, timeout);
|
FUNCTION_LOG_PARAM(TIME_MSEC, timeout);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(command != NULL);
|
ASSERT(command != NULL);
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
ASSERT(name != NULL);
|
||||||
FUNCTION_TEST_ASSERT(timeout > 0);
|
ASSERT(timeout > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
Exec *this = NULL;
|
Exec *this = NULL;
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ execNew(const String *command, const StringList *param, const String *name, Time
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(EXEC, this);
|
FUNCTION_LOG_RETURN(EXEC, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -92,11 +91,11 @@ Execute command
|
|||||||
void
|
void
|
||||||
execOpen(Exec *this)
|
execOpen(Exec *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug)
|
FUNCTION_LOG_BEGIN(logLevelDebug)
|
||||||
FUNCTION_DEBUG_PARAM(EXEC, this);
|
FUNCTION_LOG_PARAM(EXEC, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Create pipes to communicate with the subprocess. The names of the pipes are from the perspective of the parent process since
|
// Create pipes to communicate with the subprocess. The names of the pipes are from the perspective of the parent process since
|
||||||
// the child process will use them only briefly before exec'ing.
|
// the child process will use them only briefly before exec'ing.
|
||||||
@@ -162,7 +161,7 @@ execOpen(Exec *this)
|
|||||||
// Set a callback so the handles will get freed
|
// Set a callback so the handles will get freed
|
||||||
memContextCallback(this->memContext, (MemContextCallback)execFree, this);
|
memContextCallback(this->memContext, (MemContextCallback)execFree, this);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -174,11 +173,11 @@ then the original error should be rethrown.
|
|||||||
static void
|
static void
|
||||||
execCheck(Exec *this)
|
execCheck(Exec *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(EXEC, this);
|
FUNCTION_LOG_PARAM(EXEC, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
int processStatus;
|
int processStatus;
|
||||||
int processResult;
|
int processResult;
|
||||||
@@ -209,7 +208,7 @@ execCheck(Exec *this)
|
|||||||
THROW_FMT(ExecuteError, "%s terminated unexpectedly on signal %d", strPtr(this->name), WTERMSIG(processStatus));
|
THROW_FMT(ExecuteError, "%s terminated unexpectedly on signal %d", strPtr(this->name), WTERMSIG(processStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -218,14 +217,14 @@ Read from the process
|
|||||||
void
|
void
|
||||||
execRead(Exec *this, Buffer *buffer, bool block)
|
execRead(Exec *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(EXEC, this);
|
FUNCTION_LOG_PARAM(EXEC, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
TRY_BEGIN()
|
TRY_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -238,7 +237,7 @@ execRead(Exec *this, Buffer *buffer, bool block)
|
|||||||
}
|
}
|
||||||
TRY_END();
|
TRY_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -247,13 +246,13 @@ Write to the process
|
|||||||
void
|
void
|
||||||
execWrite(Exec *this, Buffer *buffer)
|
execWrite(Exec *this, Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(EXEC, this);
|
FUNCTION_LOG_PARAM(EXEC, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
TRY_BEGIN()
|
TRY_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -267,7 +266,7 @@ execWrite(Exec *this, Buffer *buffer)
|
|||||||
}
|
}
|
||||||
TRY_END();
|
TRY_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -276,17 +275,17 @@ Is the process eof?
|
|||||||
bool
|
bool
|
||||||
execEof(Exec *this)
|
execEof(Exec *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(EXEC, this);
|
FUNCTION_LOG_PARAM(EXEC, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Check that the process is still running on eof
|
// Check that the process is still running on eof
|
||||||
if (ioHandleReadEof(this->ioReadHandle))
|
if (ioHandleReadEof(this->ioReadHandle))
|
||||||
execCheck(this);
|
execCheck(this);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, false);
|
FUNCTION_LOG_RETURN(BOOL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -297,11 +296,11 @@ execIoRead(const Exec *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(EXEC, this);
|
FUNCTION_TEST_PARAM(EXEC, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_READ, this->ioReadExec);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_READ, this->ioReadExec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -312,11 +311,11 @@ execIoWrite(const Exec *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(EXEC, this);
|
FUNCTION_TEST_PARAM(EXEC, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_WRITE, this->ioWriteExec);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_WRITE, this->ioWriteExec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -327,11 +326,11 @@ execMemContext(const Exec *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(EXEC, this);
|
FUNCTION_TEST_PARAM(EXEC, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, this->memContext);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -380,5 +379,5 @@ execFree(Exec *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ void execFree(Exec *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_EXEC_TYPE \
|
#define FUNCTION_LOG_EXEC_TYPE \
|
||||||
Exec *
|
Exec *
|
||||||
#define FUNCTION_DEBUG_EXEC_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_EXEC_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "Exec", buffer, bufferSize)
|
objToLog(value, "Exec", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ exitSignalName(int signalType)
|
|||||||
THROW(AssertError, "no name for signal none");
|
THROW(AssertError, "no name for signal none");
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, name);
|
FUNCTION_TEST_RETURN(STRINGZ, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -62,13 +62,13 @@ Catch signals
|
|||||||
static void
|
static void
|
||||||
exitOnSignal(int signalType)
|
exitOnSignal(int signalType)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, signalType);
|
FUNCTION_LOG_PARAM(INT, signalType);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
exit(exitSafe(errorTypeCode(&TermError), false, (SignalType)signalType));
|
exit(exitSafe(errorTypeCode(&TermError), false, (SignalType)signalType));
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -77,7 +77,7 @@ Setup signal handlers
|
|||||||
void
|
void
|
||||||
exitInit(void)
|
exitInit(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
signal(SIGHUP, exitOnSignal);
|
signal(SIGHUP, exitOnSignal);
|
||||||
signal(SIGINT, exitOnSignal);
|
signal(SIGINT, exitOnSignal);
|
||||||
@@ -86,7 +86,7 @@ exitInit(void)
|
|||||||
// Ignore SIGPIPE and check for EPIPE errors on write() instead
|
// Ignore SIGPIPE and check for EPIPE errors on write() instead
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -95,11 +95,11 @@ Do cleanup and return result code
|
|||||||
int
|
int
|
||||||
exitSafe(int result, bool error, SignalType signalType)
|
exitSafe(int result, bool error, SignalType signalType)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(INT, result);
|
FUNCTION_LOG_PARAM(INT, result);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, error);
|
FUNCTION_LOG_PARAM(BOOL, error);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, signalType);
|
FUNCTION_LOG_PARAM(ENUM, signalType);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
// Report error if one was thrown
|
// Report error if one was thrown
|
||||||
if (error)
|
if (error)
|
||||||
@@ -186,5 +186,5 @@ exitSafe(int result, bool error, SignalType signalType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return result - caller should immediate pass this result to exit()
|
// Return result - caller should immediate pass this result to exit()
|
||||||
FUNCTION_DEBUG_RESULT(INT, result);
|
FUNCTION_LOG_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ startup because the parent process may continue to run and perform work for some
|
|||||||
void
|
void
|
||||||
forkDetach(void)
|
forkDetach(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
// Change the working directory to / so we won't error if the old working directory goes away
|
// Change the working directory to / so we won't error if the old working directory goes away
|
||||||
THROW_ON_SYS_ERROR(chdir("/") == -1, PathMissingError, "unable to change directory to '/'");
|
THROW_ON_SYS_ERROR(chdir("/") == -1, PathMissingError, "unable to change directory to '/'");
|
||||||
@@ -27,5 +27,5 @@ forkDetach(void)
|
|||||||
THROW_ON_SYS_ERROR(close(STDOUT_FILENO) == -1, FileCloseError, "unable to close stdout");
|
THROW_ON_SYS_ERROR(close(STDOUT_FILENO) == -1, FileCloseError, "unable to close stdout");
|
||||||
THROW_ON_SYS_ERROR(close(STDERR_FILENO) == -1, FileCloseError, "unable to close stderr");
|
THROW_ON_SYS_ERROR(close(STDERR_FILENO) == -1, FileCloseError, "unable to close stderr");
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ iniGetInternal(const Ini *this, const String *section, const String *key)
|
|||||||
FUNCTION_TEST_PARAM(INI, this);
|
FUNCTION_TEST_PARAM(INI, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, section);
|
FUNCTION_TEST_PARAM(STRING, section);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(section != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(section != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
const Variant *result = NULL;
|
const Variant *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -71,7 +71,7 @@ iniGetInternal(const Ini *this, const String *section, const String *key)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_VARIANT, result);
|
FUNCTION_TEST_RETURN(CONST_VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -84,12 +84,12 @@ iniGet(const Ini *this, const String *section, const String *key)
|
|||||||
FUNCTION_TEST_PARAM(INI, this);
|
FUNCTION_TEST_PARAM(INI, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, section);
|
FUNCTION_TEST_PARAM(STRING, section);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(section != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(section != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
// Get the value
|
// Get the value
|
||||||
const Variant *result = iniGetInternal(this, section, key);
|
const Variant *result = iniGetInternal(this, section, key);
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ iniGet(const Ini *this, const String *section, const String *key)
|
|||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
THROW_FMT(FormatError, "section '%s', key '%s' does not exist", strPtr(section), strPtr(key));
|
THROW_FMT(FormatError, "section '%s', key '%s' does not exist", strPtr(section), strPtr(key));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_VARIANT, result);
|
FUNCTION_TEST_RETURN(CONST_VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -111,12 +111,12 @@ iniGetDefault(const Ini *this, const String *section, const String *key, Variant
|
|||||||
FUNCTION_TEST_PARAM(STRING, section);
|
FUNCTION_TEST_PARAM(STRING, section);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, defaultValue);
|
FUNCTION_TEST_PARAM(VARIANT, defaultValue);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(section != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(section != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
// Get the value
|
// Get the value
|
||||||
const Variant *result = iniGetInternal(this, section, key);
|
const Variant *result = iniGetInternal(this, section, key);
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ iniGetDefault(const Ini *this, const String *section, const String *key, Variant
|
|||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
result = defaultValue;
|
result = defaultValue;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_VARIANT, result);
|
FUNCTION_TEST_RETURN(CONST_VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -136,11 +136,11 @@ iniSectionKeyList(const Ini *this, const String *section)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INI, this);
|
FUNCTION_TEST_PARAM(INI, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, section);
|
FUNCTION_TEST_PARAM(STRING, section);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(section != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(section != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -159,7 +159,7 @@ iniSectionKeyList(const Ini *this, const String *section)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -170,10 +170,10 @@ iniSectionList(const Ini *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INI, this);
|
FUNCTION_TEST_PARAM(INI, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -185,7 +185,7 @@ iniSectionList(const Ini *this)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -197,10 +197,10 @@ iniParse(Ini *this, const String *content)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INI, this);
|
FUNCTION_TEST_PARAM(INI, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, content);
|
FUNCTION_TEST_PARAM(STRING, content);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
kvFree(this->store);
|
kvFree(this->store);
|
||||||
@@ -267,7 +267,7 @@ iniParse(Ini *this, const String *content)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END()
|
MEM_CONTEXT_END()
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -281,13 +281,13 @@ iniSet(Ini *this, const String *section, const String *key, const Variant *value
|
|||||||
FUNCTION_TEST_PARAM(STRING, section);
|
FUNCTION_TEST_PARAM(STRING, section);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, value);
|
FUNCTION_TEST_PARAM(VARIANT, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(section != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(section != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
Variant *sectionKey = varNewStr(section);
|
Variant *sectionKey = varNewStr(section);
|
||||||
@@ -300,7 +300,7 @@ iniSet(Ini *this, const String *section, const String *key, const Variant *value
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -316,5 +316,5 @@ iniFree(Ini *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ bool iniFileExists(const Ini *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_INI_TYPE \
|
#define FUNCTION_LOG_INI_TYPE \
|
||||||
Ini *
|
Ini *
|
||||||
#define FUNCTION_DEBUG_INI_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_INI_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "Ini", buffer, bufferSize)
|
objToLog(value, "Ini", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Buffer IO Read
|
Buffer IO Read
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/bufferRead.h"
|
#include "common/io/bufferRead.h"
|
||||||
#include "common/io/read.intern.h"
|
#include "common/io/read.intern.h"
|
||||||
@@ -27,11 +26,11 @@ New object
|
|||||||
IoBufferRead *
|
IoBufferRead *
|
||||||
ioBufferReadNew(const Buffer *buffer)
|
ioBufferReadNew(const Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoBufferRead *this = NULL;
|
IoBufferRead *this = NULL;
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ ioBufferReadNew(const Buffer *buffer)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_BUFFER_READ, this);
|
FUNCTION_LOG_RETURN(IO_BUFFER_READ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -53,14 +52,14 @@ Read data from the buffer
|
|||||||
size_t
|
size_t
|
||||||
ioBufferRead(IoBufferRead *this, Buffer *buffer, bool block)
|
ioBufferRead(IoBufferRead *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER_READ, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
size_t actualBytes = 0;
|
size_t actualBytes = 0;
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ ioBufferRead(IoBufferRead *this, Buffer *buffer, bool block)
|
|||||||
this->readPos += actualBytes;
|
this->readPos += actualBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, actualBytes);
|
FUNCTION_LOG_RETURN(SIZE, actualBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -91,14 +90,14 @@ ioBufferReadMove(IoBufferRead *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER_READ, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER_READ, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_BUFFER_READ, this);
|
FUNCTION_TEST_RETURN(IO_BUFFER_READ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -107,13 +106,13 @@ Have all bytes been read from the buffer?
|
|||||||
bool
|
bool
|
||||||
ioBufferReadEof(const IoBufferRead *this)
|
ioBufferReadEof(const IoBufferRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER_READ, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->eof);
|
FUNCTION_LOG_RETURN(BOOL, this->eof);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -124,11 +123,11 @@ ioBufferReadIo(const IoBufferRead *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER_READ, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER_READ, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_READ, this->io);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_READ, this->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -137,12 +136,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioBufferReadFree(IoBufferRead *this)
|
ioBufferReadFree(IoBufferRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER_READ, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER_READ, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ void ioBufferReadFree(IoBufferRead *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_READ_TYPE \
|
#define FUNCTION_LOG_IO_BUFFER_READ_TYPE \
|
||||||
IoBufferRead *
|
IoBufferRead *
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_READ_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_BUFFER_READ_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoBufferRead", buffer, bufferSize)
|
objToLog(value, "IoBufferRead", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Buffer IO Write
|
Buffer IO Write
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/bufferWrite.h"
|
#include "common/io/bufferWrite.h"
|
||||||
#include "common/io/write.intern.h"
|
#include "common/io/write.intern.h"
|
||||||
@@ -24,11 +23,11 @@ New object
|
|||||||
IoBufferWrite *
|
IoBufferWrite *
|
||||||
ioBufferWriteNew(Buffer *buffer)
|
ioBufferWriteNew(Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoBufferWrite *this = NULL;
|
IoBufferWrite *this = NULL;
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ ioBufferWriteNew(Buffer *buffer)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_BUFFER_WRITE, this);
|
FUNCTION_LOG_RETURN(IO_BUFFER_WRITE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -50,17 +49,17 @@ Write to the buffer
|
|||||||
void
|
void
|
||||||
ioBufferWrite(IoBufferWrite *this, Buffer *buffer)
|
ioBufferWrite(IoBufferWrite *this, Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER_WRITE, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
bufCat(this->write, buffer);
|
bufCat(this->write, buffer);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -72,14 +71,14 @@ ioBufferWriteMove(IoBufferWrite *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER_WRITE, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER_WRITE, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_BUFFER_WRITE, this);
|
FUNCTION_TEST_RETURN(IO_BUFFER_WRITE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -90,11 +89,11 @@ ioBufferWriteIo(const IoBufferWrite *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER_WRITE, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER_WRITE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_WRITE, this->io);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_WRITE, this->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -103,12 +102,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioBufferWriteFree(IoBufferWrite *this)
|
ioBufferWriteFree(IoBufferWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER_WRITE, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ void ioBufferWriteFree(IoBufferWrite *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_WRITE_TYPE \
|
#define FUNCTION_LOG_IO_BUFFER_WRITE_TYPE \
|
||||||
IoBufferWrite *
|
IoBufferWrite *
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_WRITE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_BUFFER_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoBufferWrite", buffer, bufferSize)
|
objToLog(value, "IoBufferWrite", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ New object
|
|||||||
IoBuffer *
|
IoBuffer *
|
||||||
ioBufferNew(void)
|
ioBufferNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
IoBuffer *this = NULL;
|
IoBuffer *this = NULL;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ ioBufferNew(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_BUFFER, this);
|
FUNCTION_LOG_RETURN(IO_BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -58,15 +58,15 @@ Move data from the input buffer to the output buffer
|
|||||||
void
|
void
|
||||||
ioBufferProcess(IoBuffer *this, const Buffer *input, Buffer *output)
|
ioBufferProcess(IoBuffer *this, const Buffer *input, Buffer *output)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, input);
|
FUNCTION_LOG_PARAM(BUFFER, input);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, output);
|
FUNCTION_LOG_PARAM(BUFFER, output);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(input != NULL);
|
ASSERT(input != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(output != NULL);
|
ASSERT(output != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Determine how much data needs to be copied and reduce if there is not enough space in the output
|
// Determine how much data needs to be copied and reduce if there is not enough space in the output
|
||||||
size_t copySize = bufUsed(input) - this->inputPos;
|
size_t copySize = bufUsed(input) - this->inputPos;
|
||||||
@@ -90,7 +90,7 @@ ioBufferProcess(IoBuffer *this, const Buffer *input, Buffer *output)
|
|||||||
this->inputPos += copySize;
|
this->inputPos += copySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -104,11 +104,11 @@ ioBufferInputSame(const IoBuffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -119,11 +119,11 @@ ioBufferFilter(const IoBuffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_BUFFER, this);
|
FUNCTION_TEST_PARAM(IO_BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this->filter);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -141,12 +141,12 @@ Free the filter group
|
|||||||
void
|
void
|
||||||
ioBufferFree(IoBuffer *this)
|
ioBufferFree(IoBuffer *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_BUFFER, this);
|
FUNCTION_LOG_PARAM(IO_BUFFER, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *ioBufferToLog(const IoBuffer *this);
|
String *ioBufferToLog(const IoBuffer *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_TYPE \
|
#define FUNCTION_LOG_IO_BUFFER_TYPE \
|
||||||
IoBuffer *
|
IoBuffer *
|
||||||
#define FUNCTION_DEBUG_IO_BUFFER_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_BUFFER_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, ioBufferToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, ioBufferToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
IO Filter Interface
|
IO Filter Interface
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/filter/filter.intern.h"
|
#include "common/io/filter/filter.intern.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -26,23 +25,22 @@ Allocations will be in the memory context of the caller.
|
|||||||
IoFilter *
|
IoFilter *
|
||||||
ioFilterNew(const String *type, void *driver, IoFilterInterface interface)
|
ioFilterNew(const String *type, void *driver, IoFilterInterface interface)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, type);
|
FUNCTION_LOG_PARAM(STRING, type);
|
||||||
FUNCTION_DEBUG_PARAM(VOIDP, driver);
|
FUNCTION_LOG_PARAM(VOIDP, driver);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_INTERFACE, interface);
|
FUNCTION_LOG_PARAM(IO_FILTER_INTERFACE, interface);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
ASSERT(type != NULL);
|
||||||
FUNCTION_TEST_ASSERT(driver != NULL);
|
ASSERT(driver != NULL);
|
||||||
// One of processIn or processInOut must be set
|
// One of processIn or processInOut must be set
|
||||||
FUNCTION_TEST_ASSERT(interface.in != NULL || interface.inOut != NULL);
|
ASSERT(interface.in != NULL || interface.inOut != NULL);
|
||||||
// But not both of them
|
// But not both of them
|
||||||
FUNCTION_TEST_ASSERT(!(interface.in != NULL && interface.inOut != NULL));
|
ASSERT(!(interface.in != NULL && interface.inOut != NULL));
|
||||||
// If the filter does not produce output then it should produce a result
|
// If the filter does not produce output then it should produce a result
|
||||||
FUNCTION_TEST_ASSERT(
|
ASSERT(interface.in == NULL || (interface.result != NULL && interface.done == NULL && interface.inputSame == NULL));
|
||||||
interface.in == NULL || (interface.result != NULL && interface.done == NULL && interface.inputSame == NULL));
|
// Filters that produce output will not always be able to dump all their output and will need to get the same input again
|
||||||
// Filters that produce output will not always be able to dump all their output and will need to get the same input again
|
ASSERT(interface.inOut == NULL || interface.inputSame != NULL);
|
||||||
FUNCTION_TEST_ASSERT(interface.inOut == NULL || interface.inputSame != NULL);
|
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoFilter *this = memNew(sizeof(IoFilter));
|
IoFilter *this = memNew(sizeof(IoFilter));
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -50,7 +48,7 @@ ioFilterNew(const String *type, void *driver, IoFilterInterface interface)
|
|||||||
this->driver = driver;
|
this->driver = driver;
|
||||||
this->interface = interface;
|
this->interface = interface;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_FILTER, this);
|
FUNCTION_LOG_RETURN(IO_FILTER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -62,14 +60,14 @@ ioFilterProcessIn(IoFilter *this, const Buffer *input)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, input);
|
FUNCTION_TEST_PARAM(BUFFER, input);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->interface.in != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(this->interface.in != NULL);
|
||||||
|
|
||||||
this->interface.in(this->driver, input);
|
this->interface.in(this->driver, input);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -82,15 +80,15 @@ ioFilterProcessInOut(IoFilter *this, const Buffer *input, Buffer *output)
|
|||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, input);
|
FUNCTION_TEST_PARAM(BUFFER, input);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, output);
|
FUNCTION_TEST_PARAM(BUFFER, output);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(output != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->interface.inOut != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(output != NULL);
|
||||||
|
ASSERT(this->interface.inOut != NULL);
|
||||||
|
|
||||||
this->interface.inOut(this->driver, input, output);
|
this->interface.inOut(this->driver, input, output);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -102,14 +100,14 @@ ioFilterMove(IoFilter *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this);
|
FUNCTION_TEST_RETURN(IO_FILTER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -122,11 +120,11 @@ ioFilterDone(const IoFilter *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->interface.done != NULL ? this->interface.done(this->driver) : !ioFilterInputSame(this));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->interface.done != NULL ? this->interface.done(this->driver) : !ioFilterInputSame(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -139,11 +137,11 @@ ioFilterInputSame(const IoFilter *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->interface.inputSame != NULL ? this->interface.inputSame(this->driver) : false);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->interface.inputSame != NULL ? this->interface.inputSame(this->driver) : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -156,11 +154,11 @@ ioFilterOutput(const IoFilter *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->interface.inOut != NULL);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->interface.inOut != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -171,11 +169,11 @@ ioFilterResult(const IoFilter *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, this->interface.result ? this->interface.result(this->driver) : NULL);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VARIANT, this->interface.result ? this->interface.result(this->driver) : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -188,9 +186,9 @@ ioFilterType(const IoFilter *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
FUNCTION_TEST_PARAM(IO_FILTER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_STRING, this->type);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(CONST_STRING, this->type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ const String *ioFilterType(const IoFilter *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_TYPE \
|
#define FUNCTION_LOG_IO_FILTER_TYPE \
|
||||||
IoFilter *
|
IoFilter *
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_FILTER_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoFilter", buffer, bufferSize)
|
objToLog(value, "IoFilter", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ bool ioFilterOutput(const IoFilter *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_INTERFACE_TYPE \
|
#define FUNCTION_LOG_IO_FILTER_INTERFACE_TYPE \
|
||||||
IoFilterInterface *
|
IoFilterInterface *
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_FILTER_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(&value, "IoFilterInterface", buffer, bufferSize)
|
objToLog(&value, "IoFilterInterface", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ IO Filter Group
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/filter/buffer.h"
|
#include "common/io/filter/buffer.h"
|
||||||
#include "common/io/filter/filter.intern.h"
|
#include "common/io/filter/filter.intern.h"
|
||||||
@@ -27,9 +26,9 @@ typedef struct IoFilterData
|
|||||||
} IoFilterData;
|
} IoFilterData;
|
||||||
|
|
||||||
// Macros for logging
|
// Macros for logging
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_DATA_TYPE \
|
#define FUNCTION_LOG_IO_FILTER_DATA_TYPE \
|
||||||
IoFilterData *
|
IoFilterData *
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_DATA_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_FILTER_DATA_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoFilterData", buffer, bufferSize)
|
objToLog(value, "IoFilterData", buffer, bufferSize)
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -57,7 +56,7 @@ New Object
|
|||||||
IoFilterGroup *
|
IoFilterGroup *
|
||||||
ioFilterGroupNew(void)
|
ioFilterGroupNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
IoFilterGroup *this = NULL;
|
IoFilterGroup *this = NULL;
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ ioFilterGroupNew(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_RETURN(IO_FILTER_GROUP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -79,14 +78,14 @@ Add a filter
|
|||||||
IoFilterGroup *
|
IoFilterGroup *
|
||||||
ioFilterGroupAdd(IoFilterGroup *this, IoFilter *filter)
|
ioFilterGroupAdd(IoFilterGroup *this, IoFilter *filter)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER, filter);
|
FUNCTION_LOG_PARAM(IO_FILTER, filter);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!this->opened && !this->closed);
|
ASSERT(!this->opened && !this->closed);
|
||||||
FUNCTION_TEST_ASSERT(filter != NULL);
|
ASSERT(filter != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Move the filter to this object's mem context
|
// Move the filter to this object's mem context
|
||||||
ioFilterMove(filter, this->memContext);
|
ioFilterMove(filter, this->memContext);
|
||||||
@@ -95,7 +94,7 @@ ioFilterGroupAdd(IoFilterGroup *this, IoFilter *filter)
|
|||||||
IoFilterData filterData = {.filter = filter};
|
IoFilterData filterData = {.filter = filter};
|
||||||
lstAdd(this->filterList, &filterData);
|
lstAdd(this->filterList, &filterData);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_RETURN(IO_FILTER_GROUP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -107,11 +106,11 @@ ioFilterGroupGet(IoFilterGroup *this, unsigned int filterIdx)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, filterIdx);
|
FUNCTION_TEST_PARAM(UINT, filterIdx);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER_DATA, (IoFilterData *)lstGet(this->filterList, filterIdx));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER_DATA, (IoFilterData *)lstGet(this->filterList, filterIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -122,11 +121,11 @@ Setup the filter group and allocate any required buffers.
|
|||||||
void
|
void
|
||||||
ioFilterGroupOpen(IoFilterGroup *this)
|
ioFilterGroupOpen(IoFilterGroup *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
@@ -174,7 +173,7 @@ ioFilterGroupOpen(IoFilterGroup *this)
|
|||||||
this->opened = true;
|
this->opened = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -183,17 +182,17 @@ Process filters
|
|||||||
void
|
void
|
||||||
ioFilterGroupProcess(IoFilterGroup *this, const Buffer *input, Buffer *output)
|
ioFilterGroupProcess(IoFilterGroup *this, const Buffer *input, Buffer *output)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, input);
|
FUNCTION_LOG_PARAM(BUFFER, input);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, output);
|
FUNCTION_LOG_PARAM(BUFFER, output);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_TEST_ASSERT(!this->flushing || input == NULL);
|
ASSERT(!this->flushing || input == NULL);
|
||||||
FUNCTION_TEST_ASSERT(output != NULL);
|
ASSERT(output != NULL);
|
||||||
FUNCTION_TEST_ASSERT(bufRemains(output) > 0);
|
ASSERT(bufRemains(output) > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Once input goes to NULL then flushing has started
|
// Once input goes to NULL then flushing has started
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -311,7 +310,7 @@ ioFilterGroupProcess(IoFilterGroup *this, const Buffer *input, Buffer *output)
|
|||||||
this->done = false;
|
this->done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -320,12 +319,12 @@ Close filter group and gather results
|
|||||||
void
|
void
|
||||||
ioFilterGroupClose(IoFilterGroup *this)
|
ioFilterGroupClose(IoFilterGroup *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
for (unsigned int filterIdx = 0; filterIdx < lstSize(this->filterList); filterIdx++)
|
for (unsigned int filterIdx = 0; filterIdx < lstSize(this->filterList); filterIdx++)
|
||||||
{
|
{
|
||||||
@@ -353,7 +352,7 @@ ioFilterGroupClose(IoFilterGroup *this)
|
|||||||
this->closed = true;
|
this->closed = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -364,12 +363,12 @@ ioFilterGroupDone(const IoFilterGroup *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->done);
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(this->opened && !this->closed);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -382,12 +381,12 @@ ioFilterGroupInputSame(const IoFilterGroup *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_TEST_PARAM(IO_FILTER_GROUP, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(this->opened && !this->closed);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -396,14 +395,14 @@ Get filter results
|
|||||||
const Variant *
|
const Variant *
|
||||||
ioFilterGroupResult(const IoFilterGroup *this, const String *filterType)
|
ioFilterGroupResult(const IoFilterGroup *this, const String *filterType)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, filterType);
|
FUNCTION_LOG_PARAM(STRING, filterType);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && this->closed);
|
ASSERT(this->opened && this->closed);
|
||||||
FUNCTION_TEST_ASSERT(filterType != NULL);
|
ASSERT(filterType != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
const Variant *result = NULL;
|
const Variant *result = NULL;
|
||||||
|
|
||||||
@@ -413,7 +412,7 @@ ioFilterGroupResult(const IoFilterGroup *this, const String *filterType)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(CONST_VARIANT, result);
|
FUNCTION_LOG_RETURN(CONST_VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -431,12 +430,12 @@ Free the filter group
|
|||||||
void
|
void
|
||||||
ioFilterGroupFree(IoFilterGroup *this)
|
ioFilterGroupFree(IoFilterGroup *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, this);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *ioFilterGroupToLog(const IoFilterGroup *this);
|
String *ioFilterGroupToLog(const IoFilterGroup *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_GROUP_TYPE \
|
#define FUNCTION_LOG_IO_FILTER_GROUP_TYPE \
|
||||||
IoFilterGroup *
|
IoFilterGroup *
|
||||||
#define FUNCTION_DEBUG_IO_FILTER_GROUP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_FILTER_GROUP_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, ioFilterGroupToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, ioFilterGroupToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ New object
|
|||||||
IoSize *
|
IoSize *
|
||||||
ioSizeNew(void)
|
ioSizeNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
IoSize *this = NULL;
|
IoSize *this = NULL;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ ioSizeNew(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_SIZE, this);
|
FUNCTION_LOG_RETURN(IO_SIZE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -57,17 +57,17 @@ Count bytes in the input
|
|||||||
void
|
void
|
||||||
ioSizeProcess(IoSize *this, const Buffer *input)
|
ioSizeProcess(IoSize *this, const Buffer *input)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_SIZE, this);
|
FUNCTION_LOG_PARAM(IO_SIZE, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, input);
|
FUNCTION_LOG_PARAM(BUFFER, input);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(input != NULL);
|
ASSERT(input != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
this->size += bufUsed(input);
|
this->size += bufUsed(input);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -78,11 +78,11 @@ ioSizeFilter(const IoSize *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_SIZE, this);
|
FUNCTION_TEST_PARAM(IO_SIZE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this->filter);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -100,11 +100,11 @@ Return filter result
|
|||||||
const Variant *
|
const Variant *
|
||||||
ioSizeResult(IoSize *this)
|
ioSizeResult(IoSize *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_SIZE, this);
|
FUNCTION_LOG_PARAM(IO_SIZE, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
Variant *result = NULL;
|
Variant *result = NULL;
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ ioSizeResult(IoSize *this)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(VARIANT, result);
|
FUNCTION_LOG_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -123,12 +123,12 @@ Free the filter group
|
|||||||
void
|
void
|
||||||
ioSizeFree(IoSize *this)
|
ioSizeFree(IoSize *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_SIZE, this);
|
FUNCTION_LOG_PARAM(IO_SIZE, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *ioSizeToLog(const IoSize *this);
|
String *ioSizeToLog(const IoSize *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_IO_SIZE_TYPE \
|
#define FUNCTION_LOG_IO_SIZE_TYPE \
|
||||||
IoSize *
|
IoSize *
|
||||||
#define FUNCTION_DEBUG_IO_SIZE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_SIZE_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, ioSizeToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, ioSizeToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ Handle IO Read
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/handleRead.h"
|
#include "common/io/handleRead.h"
|
||||||
#include "common/io/read.intern.h"
|
#include "common/io/read.intern.h"
|
||||||
@@ -29,11 +28,11 @@ New object
|
|||||||
IoHandleRead *
|
IoHandleRead *
|
||||||
ioHandleReadNew(const String *name, int handle, TimeMSec timeout)
|
ioHandleReadNew(const String *name, int handle, TimeMSec timeout)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, handle);
|
FUNCTION_LOG_PARAM(INT, handle);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(handle != -1);
|
ASSERT(handle != -1);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoHandleRead *this = NULL;
|
IoHandleRead *this = NULL;
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ ioHandleReadNew(const String *name, int handle, TimeMSec timeout)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_HANDLE_READ, this);
|
FUNCTION_LOG_RETURN(IO_HANDLE_READ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -57,15 +56,15 @@ Read data from the handle
|
|||||||
size_t
|
size_t
|
||||||
ioHandleRead(IoHandleRead *this, Buffer *buffer, bool block)
|
ioHandleRead(IoHandleRead *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_HANDLE_READ, this);
|
FUNCTION_LOG_PARAM(IO_HANDLE_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!bufFull(buffer));
|
ASSERT(!bufFull(buffer));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
ssize_t actualBytes = 0;
|
ssize_t actualBytes = 0;
|
||||||
|
|
||||||
@@ -109,7 +108,7 @@ ioHandleRead(IoHandleRead *this, Buffer *buffer, bool block)
|
|||||||
while (bufRemains(buffer) > 0 && !this->eof && block);
|
while (bufRemains(buffer) > 0 && !this->eof && block);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, (size_t)actualBytes);
|
FUNCTION_LOG_RETURN(SIZE, (size_t)actualBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -121,14 +120,14 @@ ioHandleReadMove(IoHandleRead *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_HANDLE_READ, this);
|
FUNCTION_TEST_PARAM(IO_HANDLE_READ, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_HANDLE_READ, this);
|
FUNCTION_TEST_RETURN(IO_HANDLE_READ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -137,13 +136,13 @@ Have all bytes been read from the buffer?
|
|||||||
bool
|
bool
|
||||||
ioHandleReadEof(const IoHandleRead *this)
|
ioHandleReadEof(const IoHandleRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_HANDLE_READ, this);
|
FUNCTION_LOG_PARAM(IO_HANDLE_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->eof);
|
FUNCTION_LOG_RETURN(BOOL, this->eof);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -154,11 +153,11 @@ ioHandleReadIo(const IoHandleRead *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_HANDLE_READ, this);
|
FUNCTION_TEST_PARAM(IO_HANDLE_READ, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_READ, this->io);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_READ, this->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -167,12 +166,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioHandleReadFree(IoHandleRead *this)
|
ioHandleReadFree(IoHandleRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_HANDLE_READ, this);
|
FUNCTION_LOG_PARAM(IO_HANDLE_READ, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ void ioHandleReadFree(IoHandleRead *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_HANDLE_READ_TYPE \
|
#define FUNCTION_LOG_IO_HANDLE_READ_TYPE \
|
||||||
IoHandleRead *
|
IoHandleRead *
|
||||||
#define FUNCTION_DEBUG_IO_HANDLE_READ_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_HANDLE_READ_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoHandleRead", buffer, bufferSize)
|
objToLog(value, "IoHandleRead", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ Handle IO Write
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/handleWrite.h"
|
#include "common/io/handleWrite.h"
|
||||||
#include "common/io/write.intern.h"
|
#include "common/io/write.intern.h"
|
||||||
@@ -27,9 +26,9 @@ New object
|
|||||||
IoHandleWrite *
|
IoHandleWrite *
|
||||||
ioHandleWriteNew(const String *name, int handle)
|
ioHandleWriteNew(const String *name, int handle)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, handle);
|
FUNCTION_LOG_PARAM(INT, handle);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
IoHandleWrite *this = NULL;
|
IoHandleWrite *this = NULL;
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ ioHandleWriteNew(const String *name, int handle)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_HANDLE_WRITE, this);
|
FUNCTION_LOG_RETURN(IO_HANDLE_WRITE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -52,18 +51,18 @@ Write to the handle
|
|||||||
void
|
void
|
||||||
ioHandleWrite(IoHandleWrite *this, Buffer *buffer)
|
ioHandleWrite(IoHandleWrite *this, Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_HANDLE_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_HANDLE_WRITE, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
THROW_ON_SYS_ERROR_FMT(
|
THROW_ON_SYS_ERROR_FMT(
|
||||||
write(this->handle, bufPtr(buffer), bufUsed(buffer)) == -1, FileWriteError, "unable to write to %s", strPtr(this->name));
|
write(this->handle, bufPtr(buffer), bufUsed(buffer)) == -1, FileWriteError, "unable to write to %s", strPtr(this->name));
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -75,14 +74,14 @@ ioHandleWriteMove(IoHandleWrite *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_HANDLE_WRITE, this);
|
FUNCTION_TEST_PARAM(IO_HANDLE_WRITE, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_HANDLE_WRITE, this);
|
FUNCTION_TEST_RETURN(IO_HANDLE_WRITE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -93,11 +92,11 @@ ioHandleWriteIo(const IoHandleWrite *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_HANDLE_WRITE, this);
|
FUNCTION_TEST_PARAM(IO_HANDLE_WRITE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_WRITE, this->io);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_WRITE, this->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -106,14 +105,14 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioHandleWriteFree(IoHandleWrite *this)
|
ioHandleWriteFree(IoHandleWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_HANDLE_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_HANDLE_WRITE, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -122,15 +121,15 @@ Write a string to the specified handle
|
|||||||
void
|
void
|
||||||
ioHandleWriteOneStr(int handle, const String *string)
|
ioHandleWriteOneStr(int handle, const String *string)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, handle);
|
FUNCTION_LOG_PARAM(INT, handle);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, string);
|
FUNCTION_LOG_PARAM(STRING, string);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(string != NULL);
|
ASSERT(string != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (write(handle, strPtr(string), strSize(string)) != (int)strSize(string))
|
if (write(handle, strPtr(string), strSize(string)) != (int)strSize(string))
|
||||||
THROW_SYS_ERROR(FileWriteError, "unable to write to handle");
|
THROW_SYS_ERROR(FileWriteError, "unable to write to handle");
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ void ioHandleWriteOneStr(int handle, const String *string);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_HANDLE_WRITE_TYPE \
|
#define FUNCTION_LOG_IO_HANDLE_WRITE_TYPE \
|
||||||
IoHandleWrite *
|
IoHandleWrite *
|
||||||
#define FUNCTION_DEBUG_IO_HANDLE_WRITE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_HANDLE_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoHandleWrite", buffer, bufferSize)
|
objToLog(value, "IoHandleWrite", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Http Client
|
Http Client
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/http/client.h"
|
#include "common/io/http/client.h"
|
||||||
#include "common/io/http/common.h"
|
#include "common/io/http/common.h"
|
||||||
@@ -61,15 +60,15 @@ Read content
|
|||||||
static size_t
|
static size_t
|
||||||
httpClientRead(HttpClient *this, Buffer *buffer, bool block)
|
httpClientRead(HttpClient *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(HTTP_CLIENT, this);
|
FUNCTION_LOG_PARAM(HTTP_CLIENT, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!bufFull(buffer));
|
ASSERT(!bufFull(buffer));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Read if EOF has not been reached
|
// Read if EOF has not been reached
|
||||||
size_t actualBytes = 0;
|
size_t actualBytes = 0;
|
||||||
@@ -133,7 +132,7 @@ httpClientRead(HttpClient *this, Buffer *buffer, bool block)
|
|||||||
tlsClientClose(this->tls);
|
tlsClientClose(this->tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, (size_t)actualBytes);
|
FUNCTION_LOG_RETURN(SIZE, (size_t)actualBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -142,13 +141,13 @@ Has all content been read?
|
|||||||
static bool
|
static bool
|
||||||
httpClientEof(const HttpClient *this)
|
httpClientEof(const HttpClient *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(HTTP_CLIENT, this);
|
FUNCTION_LOG_PARAM(HTTP_CLIENT, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->contentEof);
|
FUNCTION_LOG_RETURN(BOOL, this->contentEof);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -158,16 +157,16 @@ HttpClient *
|
|||||||
httpClientNew(
|
httpClientNew(
|
||||||
const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer, const String *caFile, const String *caPath)
|
const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer, const String *caFile, const String *caPath)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug)
|
FUNCTION_LOG_BEGIN(logLevelDebug)
|
||||||
FUNCTION_DEBUG_PARAM(STRING, host);
|
FUNCTION_LOG_PARAM(STRING, host);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, port);
|
FUNCTION_LOG_PARAM(UINT, port);
|
||||||
FUNCTION_DEBUG_PARAM(TIME_MSEC, timeout);
|
FUNCTION_LOG_PARAM(TIME_MSEC, timeout);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, verifyPeer);
|
FUNCTION_LOG_PARAM(BOOL, verifyPeer);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, caFile);
|
FUNCTION_LOG_PARAM(STRING, caFile);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, caPath);
|
FUNCTION_LOG_PARAM(STRING, caPath);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(host != NULL);
|
ASSERT(host != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
HttpClient *this = NULL;
|
HttpClient *this = NULL;
|
||||||
|
|
||||||
@@ -182,7 +181,7 @@ httpClientNew(
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(HTTP_CLIENT, this);
|
FUNCTION_LOG_RETURN(HTTP_CLIENT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -193,17 +192,17 @@ httpClientRequest(
|
|||||||
HttpClient *this, const String *verb, const String *uri, const HttpQuery *query, const HttpHeader *requestHeader,
|
HttpClient *this, const String *verb, const String *uri, const HttpQuery *query, const HttpHeader *requestHeader,
|
||||||
bool returnContent)
|
bool returnContent)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug)
|
FUNCTION_LOG_BEGIN(logLevelDebug)
|
||||||
FUNCTION_DEBUG_PARAM(HTTP_CLIENT, this);
|
FUNCTION_LOG_PARAM(HTTP_CLIENT, this);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, verb);
|
FUNCTION_LOG_PARAM(STRING, verb);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, uri);
|
FUNCTION_LOG_PARAM(STRING, uri);
|
||||||
FUNCTION_DEBUG_PARAM(HTTP_QUERY, query);
|
FUNCTION_LOG_PARAM(HTTP_QUERY, query);
|
||||||
FUNCTION_DEBUG_PARAM(HTTP_HEADER, requestHeader);
|
FUNCTION_LOG_PARAM(HTTP_HEADER, requestHeader);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(verb != NULL);
|
ASSERT(verb != NULL);
|
||||||
FUNCTION_TEST_ASSERT(uri != NULL);
|
ASSERT(uri != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Buffer for returned content
|
// Buffer for returned content
|
||||||
Buffer *result = NULL;
|
Buffer *result = NULL;
|
||||||
@@ -418,7 +417,7 @@ httpClientRequest(
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BUFFER, result);
|
FUNCTION_LOG_RETURN(BUFFER, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -429,11 +428,11 @@ httpClientIoRead(const HttpClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_READ, this->ioRead);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_READ, this->ioRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -444,11 +443,11 @@ httpClientResponseCode(const HttpClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, this->responseCode);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, this->responseCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -459,11 +458,11 @@ httpClientReponseHeader(const HttpClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_HEADER, this->responseHeader);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(HTTP_HEADER, this->responseHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -474,11 +473,11 @@ httpClientResponseMessage(const HttpClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
FUNCTION_TEST_PARAM(HTTP_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this->responseMessage);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, this->responseMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -494,5 +493,5 @@ httpClientFree(HttpClient *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ void httpClientFree(HttpClient *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_HTTP_CLIENT_TYPE \
|
#define FUNCTION_LOG_HTTP_CLIENT_TYPE \
|
||||||
HttpClient *
|
HttpClient *
|
||||||
#define FUNCTION_DEBUG_HTTP_CLIENT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_HTTP_CLIENT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "HttpClient", buffer, bufferSize)
|
objToLog(value, "HttpClient", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ httpUriEncode(const String *uri, bool path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ httpHeaderNew(const StringList *redactList)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_HEADER, this);
|
FUNCTION_TEST_RETURN(HTTP_HEADER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -50,12 +50,12 @@ httpHeaderAdd(HttpHeader *this, const String *key, const String *value)
|
|||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(STRING, value);
|
FUNCTION_TEST_PARAM(STRING, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
// Make sure the key does not already exist
|
// Make sure the key does not already exist
|
||||||
@@ -69,7 +69,7 @@ httpHeaderAdd(HttpHeader *this, const String *key, const String *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_HEADER, this);
|
FUNCTION_TEST_RETURN(HTTP_HEADER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -81,11 +81,11 @@ httpHeaderGet(const HttpHeader *this, const String *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
@@ -94,7 +94,7 @@ httpHeaderGet(const HttpHeader *this, const String *key)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -105,11 +105,11 @@ httpHeaderList(const HttpHeader *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, strLstSort(strLstNewVarLst(kvKeyList(this->kv)), sortOrderAsc));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, strLstSort(strLstNewVarLst(kvKeyList(this->kv)), sortOrderAsc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -121,14 +121,14 @@ httpHeaderMove(HttpHeader *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_HEADER, this);
|
FUNCTION_TEST_RETURN(HTTP_HEADER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -141,12 +141,12 @@ httpHeaderPut(HttpHeader *this, const String *key, const String *value)
|
|||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(STRING, value);
|
FUNCTION_TEST_PARAM(STRING, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
// Store the key
|
// Store the key
|
||||||
@@ -154,7 +154,7 @@ httpHeaderPut(HttpHeader *this, const String *key, const String *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_HEADER, this);
|
FUNCTION_TEST_RETURN(HTTP_HEADER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -166,12 +166,12 @@ httpHeaderRedact(const HttpHeader *this, const String *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
FUNCTION_TEST_PARAM(HTTP_HEADER, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->redactList != NULL && strLstExists(this->redactList, key));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->redactList != NULL && strLstExists(this->redactList, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -214,5 +214,5 @@ httpHeaderFree(HttpHeader *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *httpHeaderToLog(const HttpHeader *this);
|
String *httpHeaderToLog(const HttpHeader *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_HTTP_HEADER_TYPE \
|
#define FUNCTION_LOG_HTTP_HEADER_TYPE \
|
||||||
HttpHeader *
|
HttpHeader *
|
||||||
#define FUNCTION_DEBUG_HTTP_HEADER_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_HTTP_HEADER_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, httpHeaderToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, httpHeaderToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ httpQueryNew(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_QUERY, this);
|
FUNCTION_TEST_RETURN(HTTP_QUERY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -48,12 +48,12 @@ httpQueryAdd(HttpQuery *this, const String *key, const String *value)
|
|||||||
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(STRING, value);
|
FUNCTION_TEST_PARAM(STRING, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
// Make sure the key does not already exist
|
// Make sure the key does not already exist
|
||||||
@@ -67,7 +67,7 @@ httpQueryAdd(HttpQuery *this, const String *key, const String *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_QUERY, this);
|
FUNCTION_TEST_RETURN(HTTP_QUERY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -79,11 +79,11 @@ httpQueryGet(const HttpQuery *this, const String *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
@@ -92,7 +92,7 @@ httpQueryGet(const HttpQuery *this, const String *key)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -103,11 +103,11 @@ httpQueryList(const HttpQuery *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, strLstSort(strLstNewVarLst(kvKeyList(this->kv)), sortOrderAsc));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, strLstSort(strLstNewVarLst(kvKeyList(this->kv)), sortOrderAsc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -119,14 +119,14 @@ httpQueryMove(HttpQuery *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_QUERY, this);
|
FUNCTION_TEST_RETURN(HTTP_QUERY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -139,12 +139,12 @@ httpQueryPut(HttpQuery *this, const String *key, const String *value)
|
|||||||
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
FUNCTION_TEST_PARAM(HTTP_QUERY, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, key);
|
FUNCTION_TEST_PARAM(STRING, key);
|
||||||
FUNCTION_TEST_PARAM(STRING, value);
|
FUNCTION_TEST_PARAM(STRING, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
// Store the key
|
// Store the key
|
||||||
@@ -152,7 +152,7 @@ httpQueryPut(HttpQuery *this, const String *key, const String *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(HTTP_QUERY, this);
|
FUNCTION_TEST_RETURN(HTTP_QUERY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -191,7 +191,7 @@ httpQueryRender(const HttpQuery *this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -231,5 +231,5 @@ httpQueryFree(HttpQuery *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *httpQueryToLog(const HttpQuery *this);
|
String *httpQueryToLog(const HttpQuery *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_HTTP_QUERY_TYPE \
|
#define FUNCTION_LOG_HTTP_QUERY_TYPE \
|
||||||
HttpQuery *
|
HttpQuery *
|
||||||
#define FUNCTION_DEBUG_HTTP_QUERY_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_HTTP_QUERY_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, httpQueryToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, httpQueryToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
IO Functions
|
IO Functions
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -24,7 +23,7 @@ size_t
|
|||||||
ioBufferSize(void)
|
ioBufferSize(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(SIZE, bufferSize);
|
FUNCTION_TEST_RETURN(SIZE, bufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -36,7 +35,7 @@ ioBufferSizeSet(size_t bufferSizeParam)
|
|||||||
|
|
||||||
bufferSize = bufferSizeParam;
|
bufferSize = bufferSizeParam;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -47,10 +46,10 @@ ioReadBuf(IoRead *read)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_READ, read);
|
FUNCTION_TEST_PARAM(IO_READ, read);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(read != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(read != NULL);
|
||||||
|
|
||||||
Buffer *result = NULL;
|
Buffer *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -71,5 +70,5 @@ ioReadBuf(IoRead *read)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, result);
|
FUNCTION_TEST_RETURN(BUFFER, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ New object
|
|||||||
IoRead *
|
IoRead *
|
||||||
ioReadNew(void *driver, IoReadInterface interface)
|
ioReadNew(void *driver, IoReadInterface interface)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(VOIDP, driver);
|
FUNCTION_LOG_PARAM(VOIDP, driver);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ_INTERFACE, interface);
|
FUNCTION_LOG_PARAM(IO_READ_INTERFACE, interface);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(driver != NULL);
|
ASSERT(driver != NULL);
|
||||||
FUNCTION_TEST_ASSERT(interface.read != NULL);
|
ASSERT(interface.read != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoRead *this = NULL;
|
IoRead *this = NULL;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ ioReadNew(void *driver, IoReadInterface interface)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_READ, this);
|
FUNCTION_LOG_RETURN(IO_READ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -64,12 +64,12 @@ Open the IO
|
|||||||
bool
|
bool
|
||||||
ioReadOpen(IoRead *this)
|
ioReadOpen(IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!this->opened && !this->closed);
|
ASSERT(!this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Open if the driver has an open function
|
// Open if the driver has an open function
|
||||||
bool result = this->interface.open != NULL ? this->interface.open(this->driver) : true;
|
bool result = this->interface.open != NULL ? this->interface.open(this->driver) : true;
|
||||||
@@ -88,7 +88,7 @@ ioReadOpen(IoRead *this)
|
|||||||
this->opened = result;
|
this->opened = result;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -99,14 +99,14 @@ This is different from the overall eof because filters may still be holding buff
|
|||||||
static bool
|
static bool
|
||||||
ioReadEofDriver(const IoRead *this)
|
ioReadEofDriver(const IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->interface.eof != NULL ? this->interface.eof(this->driver) : false);
|
FUNCTION_LOG_RETURN(BOOL, this->interface.eof != NULL ? this->interface.eof(this->driver) : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -115,15 +115,15 @@ Read data from IO and process filters
|
|||||||
static void
|
static void
|
||||||
ioReadInternal(IoRead *this, Buffer *buffer, bool block)
|
ioReadInternal(IoRead *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Loop until EOF or the output buffer is full
|
// Loop until EOF or the output buffer is full
|
||||||
size_t bufferUsedBegin = bufUsed(buffer);
|
size_t bufferUsedBegin = bufUsed(buffer);
|
||||||
@@ -166,7 +166,7 @@ ioReadInternal(IoRead *this, Buffer *buffer, bool block)
|
|||||||
this->eofAll = ioReadEofDriver(this) && ioFilterGroupDone(this->filterGroup);
|
this->eofAll = ioReadEofDriver(this) && ioFilterGroupDone(this->filterGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -175,15 +175,15 @@ Read data and use buffered line read output when present
|
|||||||
size_t
|
size_t
|
||||||
ioRead(IoRead *this, Buffer *buffer)
|
ioRead(IoRead *this, Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, this->output);
|
FUNCTION_LOG_PARAM(BUFFER, this->output);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Store size of remaining portion of buffer to calculate total read at the end
|
// Store size of remaining portion of buffer to calculate total read at the end
|
||||||
size_t outputRemains = bufRemains(buffer);
|
size_t outputRemains = bufRemains(buffer);
|
||||||
@@ -205,7 +205,7 @@ ioRead(IoRead *this, Buffer *buffer)
|
|||||||
// Read data
|
// Read data
|
||||||
ioReadInternal(this, buffer, true);
|
ioReadInternal(this, buffer, true);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, outputRemains - bufRemains(buffer));
|
FUNCTION_LOG_RETURN(SIZE, outputRemains - bufRemains(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -216,13 +216,13 @@ The entire string to search for must fit within a single buffer.
|
|||||||
String *
|
String *
|
||||||
ioReadLine(IoRead *this)
|
ioReadLine(IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, this->output);
|
FUNCTION_LOG_PARAM(BUFFER, this->output);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Allocate the output buffer if it has not already been allocated. This buffer is not allocated at object creation because it
|
// Allocate the output buffer if it has not already been allocated. This buffer is not allocated at object creation because it
|
||||||
// is not always used.
|
// is not always used.
|
||||||
@@ -274,7 +274,7 @@ ioReadLine(IoRead *this)
|
|||||||
}
|
}
|
||||||
while (result == NULL);
|
while (result == NULL);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -283,12 +283,12 @@ Close the IO
|
|||||||
void
|
void
|
||||||
ioReadClose(IoRead *this)
|
ioReadClose(IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Close the filter group and gather results
|
// Close the filter group and gather results
|
||||||
ioFilterGroupClose(this->filterGroup);
|
ioFilterGroupClose(this->filterGroup);
|
||||||
@@ -301,7 +301,7 @@ ioReadClose(IoRead *this)
|
|||||||
this->closed = true;
|
this->closed = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -312,14 +312,14 @@ All driver reads are complete and all data has been flushed from the filters (if
|
|||||||
bool
|
bool
|
||||||
ioReadEof(const IoRead *this)
|
ioReadEof(const IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->eofAll);
|
FUNCTION_LOG_RETURN(BOOL, this->eofAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -332,29 +332,29 @@ ioReadFilterGroup(const IoRead *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_READ, this);
|
FUNCTION_TEST_PARAM(IO_READ, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER_GROUP, this->filterGroup);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER_GROUP, this->filterGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ioReadFilterGroupSet(IoRead *this, IoFilterGroup *filterGroup)
|
ioReadFilterGroupSet(IoRead *this, IoFilterGroup *filterGroup)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, filterGroup);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, filterGroup);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(filterGroup != NULL);
|
ASSERT(filterGroup != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->filterGroup == NULL);
|
ASSERT(this->filterGroup == NULL);
|
||||||
FUNCTION_TEST_ASSERT(!this->opened && !this->closed);
|
ASSERT(!this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
this->filterGroup = filterGroup;
|
this->filterGroup = filterGroup;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -363,12 +363,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioReadFree(IoRead *this)
|
ioReadFree(IoRead *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_READ, this);
|
FUNCTION_LOG_PARAM(IO_READ, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ void ioReadFree(IoRead *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_READ_TYPE \
|
#define FUNCTION_LOG_IO_READ_TYPE \
|
||||||
IoRead *
|
IoRead *
|
||||||
#define FUNCTION_DEBUG_IO_READ_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_READ_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoRead", buffer, bufferSize)
|
objToLog(value, "IoRead", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ IoRead *ioReadNew(void *driver, IoReadInterface interface);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_READ_INTERFACE_TYPE \
|
#define FUNCTION_LOG_IO_READ_INTERFACE_TYPE \
|
||||||
IoReadInterface
|
IoReadInterface
|
||||||
#define FUNCTION_DEBUG_IO_READ_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_READ_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(&value, "IoReadInterface", buffer, bufferSize)
|
objToLog(&value, "IoReadInterface", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ TLS Client
|
|||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/io/tls/client.h"
|
#include "common/io/tls/client.h"
|
||||||
@@ -51,16 +50,16 @@ TlsClient *
|
|||||||
tlsClientNew(
|
tlsClientNew(
|
||||||
const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer, const String *caFile, const String *caPath)
|
const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer, const String *caFile, const String *caPath)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug)
|
FUNCTION_LOG_BEGIN(logLevelDebug)
|
||||||
FUNCTION_DEBUG_PARAM(STRING, host);
|
FUNCTION_LOG_PARAM(STRING, host);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, port);
|
FUNCTION_LOG_PARAM(UINT, port);
|
||||||
FUNCTION_DEBUG_PARAM(TIME_MSEC, timeout);
|
FUNCTION_LOG_PARAM(TIME_MSEC, timeout);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, verifyPeer);
|
FUNCTION_LOG_PARAM(BOOL, verifyPeer);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, caFile);
|
FUNCTION_LOG_PARAM(STRING, caFile);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, caPath);
|
FUNCTION_LOG_PARAM(STRING, caPath);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(host != NULL);
|
ASSERT(host != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
TlsClient *this = NULL;
|
TlsClient *this = NULL;
|
||||||
|
|
||||||
@@ -113,7 +112,7 @@ tlsClientNew(
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(TLS_CLIENT, this);
|
FUNCTION_LOG_RETURN(TLS_CLIENT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -130,7 +129,7 @@ asn1ToStr(ASN1_STRING *nameAsn1)
|
|||||||
if (nameAsn1 == NULL)
|
if (nameAsn1 == NULL)
|
||||||
THROW(CryptoError, "TLS certificate name entry is missing");
|
THROW(CryptoError, "TLS certificate name entry is missing");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(
|
FUNCTION_TEST_RETURN(
|
||||||
STRING, strNewN(
|
STRING, strNewN(
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
(const char *)ASN1_STRING_data(nameAsn1),
|
(const char *)ASN1_STRING_data(nameAsn1),
|
||||||
@@ -148,13 +147,13 @@ Matching is always case-insensitive since DNS is case insensitive.
|
|||||||
static bool
|
static bool
|
||||||
tlsClientHostVerifyName(const String *host, const String *name)
|
tlsClientHostVerifyName(const String *host, const String *name)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, host);
|
FUNCTION_LOG_PARAM(STRING, host);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, name);
|
FUNCTION_LOG_PARAM(STRING, name);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(host != NULL);
|
ASSERT(host != NULL);
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
ASSERT(name != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Reject embedded nulls in certificate common or alternative name to prevent attacks like CVE-2009-4034
|
// Reject embedded nulls in certificate common or alternative name to prevent attacks like CVE-2009-4034
|
||||||
if (strlen(strPtr(name)) != strSize(name))
|
if (strlen(strPtr(name)) != strSize(name))
|
||||||
@@ -184,7 +183,7 @@ tlsClientHostVerifyName(const String *host, const String *name)
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -195,12 +194,12 @@ The certificate's Common Name and Subject Alternative Names are considered.
|
|||||||
static bool
|
static bool
|
||||||
tlsClientHostVerify(const String *host, X509 *certificate)
|
tlsClientHostVerify(const String *host, X509 *certificate)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, host);
|
FUNCTION_LOG_PARAM(STRING, host);
|
||||||
FUNCTION_DEBUG_PARAM(VOIDP, certificate);
|
FUNCTION_LOG_PARAM(VOIDP, certificate);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(host != NULL);
|
ASSERT(host != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -252,7 +251,7 @@ tlsClientHostVerify(const String *host, X509 *certificate)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -261,11 +260,11 @@ Open connection if this is a new client or if the connection was closed by the s
|
|||||||
void
|
void
|
||||||
tlsClientOpen(TlsClient *this)
|
tlsClientOpen(TlsClient *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace)
|
FUNCTION_LOG_BEGIN(logLevelTrace)
|
||||||
FUNCTION_DEBUG_PARAM(TLS_CLIENT, this);
|
FUNCTION_LOG_PARAM(TLS_CLIENT, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (this->session == NULL)
|
if (this->session == NULL)
|
||||||
{
|
{
|
||||||
@@ -396,7 +395,7 @@ tlsClientOpen(TlsClient *this)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -405,16 +404,16 @@ Read from the TLS session
|
|||||||
size_t
|
size_t
|
||||||
tlsClientRead(TlsClient *this, Buffer *buffer, bool block)
|
tlsClientRead(TlsClient *this, Buffer *buffer, bool block)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(TLS_CLIENT, this);
|
FUNCTION_LOG_PARAM(TLS_CLIENT, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, block);
|
FUNCTION_LOG_PARAM(BOOL, block);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->session != NULL);
|
ASSERT(this->session != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!bufFull(buffer));
|
ASSERT(!bufFull(buffer));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
ssize_t actualBytes = 0;
|
ssize_t actualBytes = 0;
|
||||||
|
|
||||||
@@ -467,7 +466,7 @@ tlsClientRead(TlsClient *this, Buffer *buffer, bool block)
|
|||||||
}
|
}
|
||||||
while (block && bufRemains(buffer) > 0);
|
while (block && bufRemains(buffer) > 0);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, (size_t)actualBytes);
|
FUNCTION_LOG_RETURN(SIZE, (size_t)actualBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -476,18 +475,18 @@ Write to the tls session
|
|||||||
void
|
void
|
||||||
tlsClientWrite(TlsClient *this, const Buffer *buffer)
|
tlsClientWrite(TlsClient *this, const Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(TLS_CLIENT, this);
|
FUNCTION_LOG_PARAM(TLS_CLIENT, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->session != NULL);
|
ASSERT(this->session != NULL);
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
cryptoError(SSL_write(this->session, bufPtr(buffer), (int)bufUsed(buffer)) != (int)bufUsed(buffer), "unable to write");
|
cryptoError(SSL_write(this->session, bufPtr(buffer), (int)bufUsed(buffer)) != (int)bufUsed(buffer), "unable to write");
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -496,11 +495,11 @@ Close the connection
|
|||||||
void
|
void
|
||||||
tlsClientClose(TlsClient *this)
|
tlsClientClose(TlsClient *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(TLS_CLIENT, this);
|
FUNCTION_LOG_PARAM(TLS_CLIENT, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Close the socket
|
// Close the socket
|
||||||
if (this->socket != -1)
|
if (this->socket != -1)
|
||||||
@@ -516,7 +515,7 @@ tlsClientClose(TlsClient *this)
|
|||||||
this->session = NULL;
|
this->session = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -525,13 +524,13 @@ Has session been closed by the server?
|
|||||||
bool
|
bool
|
||||||
tlsClientEof(const TlsClient *this)
|
tlsClientEof(const TlsClient *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(TLS_CLIENT, this);
|
FUNCTION_LOG_PARAM(TLS_CLIENT, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, this->session == NULL);
|
FUNCTION_LOG_RETURN(BOOL, this->session == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -542,11 +541,11 @@ tlsClientIoRead(const TlsClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(TLS_CLIENT, this);
|
FUNCTION_TEST_PARAM(TLS_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_READ, this->read);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_READ, this->read);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -557,11 +556,11 @@ tlsClientIoWrite(const TlsClient *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(TLS_CLIENT, this);
|
FUNCTION_TEST_PARAM(TLS_CLIENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_WRITE, this->write);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_WRITE, this->write);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -583,5 +582,5 @@ tlsClientFree(TlsClient *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ void tlsClientFree(TlsClient *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_TLS_CLIENT_TYPE \
|
#define FUNCTION_LOG_TLS_CLIENT_TYPE \
|
||||||
TlsClient *
|
TlsClient *
|
||||||
#define FUNCTION_DEBUG_TLS_CLIENT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_TLS_CLIENT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "TlsClient", buffer, bufferSize)
|
objToLog(value, "TlsClient", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ New object
|
|||||||
IoWrite *
|
IoWrite *
|
||||||
ioWriteNew(void *driver, IoWriteInterface interface)
|
ioWriteNew(void *driver, IoWriteInterface interface)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(VOIDP, driver);
|
FUNCTION_LOG_PARAM(VOIDP, driver);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE_INTERFACE, interface);
|
FUNCTION_LOG_PARAM(IO_WRITE_INTERFACE, interface);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(driver != NULL);
|
ASSERT(driver != NULL);
|
||||||
FUNCTION_TEST_ASSERT(interface.write != NULL);
|
ASSERT(interface.write != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
IoWrite *this = NULL;
|
IoWrite *this = NULL;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ ioWriteNew(void *driver, IoWriteInterface interface)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_WRITE, this);
|
FUNCTION_LOG_RETURN(IO_WRITE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -61,12 +61,12 @@ Open the IO
|
|||||||
void
|
void
|
||||||
ioWriteOpen(IoWrite *this)
|
ioWriteOpen(IoWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(!this->opened && !this->closed);
|
ASSERT(!this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (this->interface.open != NULL)
|
if (this->interface.open != NULL)
|
||||||
this->interface.open(this->driver);
|
this->interface.open(this->driver);
|
||||||
@@ -81,7 +81,7 @@ ioWriteOpen(IoWrite *this)
|
|||||||
this->opened = true;
|
this->opened = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -90,13 +90,13 @@ Write data to IO and process filters
|
|||||||
void
|
void
|
||||||
ioWrite(IoWrite *this, const Buffer *buffer)
|
ioWrite(IoWrite *this, const Buffer *buffer)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Only write if there is data to write
|
// Only write if there is data to write
|
||||||
if (buffer != NULL && bufUsed(buffer) > 0)
|
if (buffer != NULL && bufUsed(buffer) > 0)
|
||||||
@@ -115,7 +115,7 @@ ioWrite(IoWrite *this, const Buffer *buffer)
|
|||||||
while (ioFilterGroupInputSame(this->filterGroup));
|
while (ioFilterGroupInputSame(this->filterGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -124,14 +124,14 @@ Write linefeed-terminated string
|
|||||||
void
|
void
|
||||||
ioWriteLine(IoWrite *this, const String *string)
|
ioWriteLine(IoWrite *this, const String *string)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, string);
|
FUNCTION_LOG_PARAM(STRING, string);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
ASSERT(string != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -146,7 +146,7 @@ ioWriteLine(IoWrite *this, const String *string)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END()
|
MEM_CONTEXT_TEMP_END()
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -157,12 +157,12 @@ This does not end writing and if there are filters that are not done it might no
|
|||||||
void
|
void
|
||||||
ioWriteFlush(IoWrite *this)
|
ioWriteFlush(IoWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (bufUsed(this->output) > 0)
|
if (bufUsed(this->output) > 0)
|
||||||
{
|
{
|
||||||
@@ -170,7 +170,7 @@ ioWriteFlush(IoWrite *this)
|
|||||||
bufUsedZero(this->output);
|
bufUsedZero(this->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -179,12 +179,12 @@ Close the IO and write any additional data that has not been written yet
|
|||||||
void
|
void
|
||||||
ioWriteClose(IoWrite *this)
|
ioWriteClose(IoWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->opened && !this->closed);
|
ASSERT(this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Flush remaining data
|
// Flush remaining data
|
||||||
do
|
do
|
||||||
@@ -211,7 +211,7 @@ ioWriteClose(IoWrite *this)
|
|||||||
this->closed = true;
|
this->closed = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -224,30 +224,30 @@ ioWriteFilterGroup(const IoWrite *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(IO_WRITE, this);
|
FUNCTION_TEST_PARAM(IO_WRITE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->opened && this->closed);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER_GROUP, this->filterGroup);
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(this->opened && this->closed);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER_GROUP, this->filterGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ioWriteFilterGroupSet(IoWrite *this, IoFilterGroup *filterGroup)
|
ioWriteFilterGroupSet(IoWrite *this, IoFilterGroup *filterGroup)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
FUNCTION_DEBUG_PARAM(IO_FILTER_GROUP, filterGroup);
|
FUNCTION_LOG_PARAM(IO_FILTER_GROUP, filterGroup);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_TEST_ASSERT(filterGroup != NULL);
|
ASSERT(filterGroup != NULL);
|
||||||
FUNCTION_TEST_ASSERT(this->filterGroup == NULL);
|
ASSERT(this->filterGroup == NULL);
|
||||||
FUNCTION_TEST_ASSERT(!this->opened && !this->closed);
|
ASSERT(!this->opened && !this->closed);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
this->filterGroup = filterGroup;
|
this->filterGroup = filterGroup;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -256,12 +256,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
ioWriteFree(IoWrite *this)
|
ioWriteFree(IoWrite *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(IO_WRITE, this);
|
FUNCTION_LOG_PARAM(IO_WRITE, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ void ioWriteFree(IoWrite *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_WRITE_TYPE \
|
#define FUNCTION_LOG_IO_WRITE_TYPE \
|
||||||
IoWrite *
|
IoWrite *
|
||||||
#define FUNCTION_DEBUG_IO_WRITE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "IoWrite", buffer, bufferSize)
|
objToLog(value, "IoWrite", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ IoWrite *ioWriteNew(void *driver, IoWriteInterface interface);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_IO_WRITE_INTERFACE_TYPE \
|
#define FUNCTION_LOG_IO_WRITE_INTERFACE_TYPE \
|
||||||
IoWriteInterface
|
IoWriteInterface
|
||||||
#define FUNCTION_DEBUG_IO_WRITE_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_IO_WRITE_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(&value, "IoWriteInterface", buffer, bufferSize)
|
objToLog(&value, "IoWriteInterface", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ Lock Handler
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/handleWrite.h"
|
#include "common/io/handleWrite.h"
|
||||||
#include "common/lock.h"
|
#include "common/lock.h"
|
||||||
@@ -41,11 +40,11 @@ Acquire a lock using a file on the local filesystem
|
|||||||
static int
|
static int
|
||||||
lockAcquireFile(const String *lockFile, TimeMSec lockTimeout, bool failOnNoLock)
|
lockAcquireFile(const String *lockFile, TimeMSec lockTimeout, bool failOnNoLock)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, lockFile);
|
FUNCTION_LOG_PARAM(STRING, lockFile);
|
||||||
FUNCTION_DEBUG_PARAM(TIMEMSEC, lockTimeout);
|
FUNCTION_LOG_PARAM(TIMEMSEC, lockTimeout);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, failOnNoLock);
|
FUNCTION_LOG_PARAM(BOOL, failOnNoLock);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
@@ -118,7 +117,7 @@ lockAcquireFile(const String *lockFile, TimeMSec lockTimeout, bool failOnNoLock)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(INT, result);
|
FUNCTION_LOG_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -127,20 +126,20 @@ Release the current lock
|
|||||||
static void
|
static void
|
||||||
lockReleaseFile(int lockHandle, const String *lockFile)
|
lockReleaseFile(int lockHandle, const String *lockFile)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, lockHandle);
|
FUNCTION_LOG_PARAM(INT, lockHandle);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, lockFile);
|
FUNCTION_LOG_PARAM(STRING, lockFile);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
// Can't release lock if there isn't one
|
// Can't release lock if there isn't one
|
||||||
ASSERT_DEBUG(lockHandle != -1);
|
ASSERT(lockHandle != -1);
|
||||||
|
|
||||||
// Remove file first and then close it to release the lock. If we close it first then another process might grab the lock
|
// Remove file first and then close it to release the lock. If we close it first then another process might grab the lock
|
||||||
// right before the delete which means the file locked by the other process will get deleted.
|
// right before the delete which means the file locked by the other process will get deleted.
|
||||||
storageRemoveNP(storageLocalWrite(), lockFile);
|
storageRemoveNP(storageLocalWrite(), lockFile);
|
||||||
close(lockHandle);
|
close(lockHandle);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -152,18 +151,18 @@ backup), but the stanza commands all need to lock both.
|
|||||||
bool
|
bool
|
||||||
lockAcquire(const String *lockPath, const String *stanza, LockType lockType, TimeMSec lockTimeout, bool failOnNoLock)
|
lockAcquire(const String *lockPath, const String *stanza, LockType lockType, TimeMSec lockTimeout, bool failOnNoLock)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, lockPath);
|
FUNCTION_LOG_PARAM(STRING, lockPath);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, stanza);
|
FUNCTION_LOG_PARAM(STRING, stanza);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, lockType);
|
FUNCTION_LOG_PARAM(ENUM, lockType);
|
||||||
FUNCTION_DEBUG_PARAM(TIMEMSEC, lockTimeout);
|
FUNCTION_LOG_PARAM(TIMEMSEC, lockTimeout);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, failOnNoLock);
|
FUNCTION_LOG_PARAM(BOOL, failOnNoLock);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
// Don't allow failures when locking more than one file. This makes cleanup difficult and there are no known use cases.
|
// Don't allow failures when locking more than one file. This makes cleanup difficult and there are no known use cases.
|
||||||
ASSERT_DEBUG(failOnNoLock || lockType != lockTypeAll);
|
ASSERT(failOnNoLock || lockType != lockTypeAll);
|
||||||
|
|
||||||
// Don't allow another lock if one is already held
|
// Don't allow another lock if one is already held
|
||||||
if (lockTypeHeld != lockTypeNone)
|
if (lockTypeHeld != lockTypeNone)
|
||||||
@@ -207,7 +206,7 @@ lockAcquire(const String *lockPath, const String *stanza, LockType lockType, Tim
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -217,9 +216,9 @@ and the master process won't try to free it.
|
|||||||
bool
|
bool
|
||||||
lockClear(bool failOnNoLock)
|
lockClear(bool failOnNoLock)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, failOnNoLock);
|
FUNCTION_LOG_PARAM(BOOL, failOnNoLock);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -241,7 +240,7 @@ lockClear(bool failOnNoLock)
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -250,9 +249,9 @@ Release a lock type
|
|||||||
bool
|
bool
|
||||||
lockRelease(bool failOnNoLock)
|
lockRelease(bool failOnNoLock)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, failOnNoLock);
|
FUNCTION_LOG_PARAM(BOOL, failOnNoLock);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -277,5 +276,5 @@ lockRelease(bool failOnNoLock)
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|||||||
117
src/common/log.c
117
src/common/log.c
@@ -10,7 +10,6 @@ Log Handler
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -38,8 +37,8 @@ DEBUG_UNIT_EXTERN bool logTimestamp = false;
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Test Asserts
|
Test Asserts
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel) \
|
#define ASSERT_LOG_LEVEL(logLevel) \
|
||||||
FUNCTION_TEST_ASSERT(logLevel >= LOG_LEVEL_MIN && logLevel <= LOG_LEVEL_MAX)
|
ASSERT(logLevel >= LOG_LEVEL_MIN && logLevel <= LOG_LEVEL_MAX)
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Log buffer -- used to format log header and message
|
Log buffer -- used to format log header and message
|
||||||
@@ -69,10 +68,10 @@ logLevelEnum(const char *logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, logLevel);
|
FUNCTION_TEST_PARAM(STRINGZ, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(logLevel != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(logLevel != NULL);
|
||||||
|
|
||||||
LogLevel result = logLevelOff;
|
LogLevel result = logLevelOff;
|
||||||
|
|
||||||
// Search for the log level
|
// Search for the log level
|
||||||
@@ -84,7 +83,7 @@ logLevelEnum(const char *logLevel)
|
|||||||
if (result == LOG_LEVEL_TOTAL)
|
if (result == LOG_LEVEL_TOTAL)
|
||||||
THROW_FMT(AssertError, "log level '%s' not found", logLevel);
|
THROW_FMT(AssertError, "log level '%s' not found", logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, result);
|
FUNCTION_TEST_RETURN(ENUM, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -92,11 +91,11 @@ logLevelStr(LogLevel logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(logLevel <= LOG_LEVEL_MAX);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, logLevelList[logLevel]);
|
ASSERT(logLevel <= LOG_LEVEL_MAX);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, logLevelList[logLevel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -110,18 +109,18 @@ logInit(LogLevel logLevelStdOutParam, LogLevel logLevelStdErrParam, LogLevel log
|
|||||||
FUNCTION_TEST_PARAM(ENUM, logLevelStdErrParam);
|
FUNCTION_TEST_PARAM(ENUM, logLevelStdErrParam);
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevelFileParam);
|
FUNCTION_TEST_PARAM(ENUM, logLevelFileParam);
|
||||||
FUNCTION_TEST_PARAM(BOOL, logTimestampParam);
|
FUNCTION_TEST_PARAM(BOOL, logTimestampParam);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(logLevelStdOutParam <= LOG_LEVEL_MAX);
|
|
||||||
FUNCTION_TEST_ASSERT(logLevelStdErrParam <= LOG_LEVEL_MAX);
|
|
||||||
FUNCTION_TEST_ASSERT(logLevelFileParam <= LOG_LEVEL_MAX);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(logLevelStdOutParam <= LOG_LEVEL_MAX);
|
||||||
|
ASSERT(logLevelStdErrParam <= LOG_LEVEL_MAX);
|
||||||
|
ASSERT(logLevelFileParam <= LOG_LEVEL_MAX);
|
||||||
|
|
||||||
logLevelStdOut = logLevelStdOutParam;
|
logLevelStdOut = logLevelStdOutParam;
|
||||||
logLevelStdErr = logLevelStdErrParam;
|
logLevelStdErr = logLevelStdErrParam;
|
||||||
logLevelFile = logLevelFileParam;
|
logLevelFile = logLevelFileParam;
|
||||||
logTimestamp = logTimestampParam;
|
logTimestamp = logTimestampParam;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -134,10 +133,10 @@ logFileSet(const char *logFile)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, logFile);
|
FUNCTION_TEST_PARAM(STRINGZ, logFile);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(logFile != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(logFile != NULL);
|
||||||
|
|
||||||
// Close the file handle if it is already open
|
// Close the file handle if it is already open
|
||||||
if (logHandleFile != -1)
|
if (logHandleFile != -1)
|
||||||
{
|
{
|
||||||
@@ -164,7 +163,7 @@ logFileSet(const char *logFile)
|
|||||||
logFileBanner = false;
|
logFileBanner = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -177,11 +176,11 @@ logWillFile(LogLevel logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, logLevel <= logLevelFile && logHandleFile != -1);
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, logLevel <= logLevelFile && logHandleFile != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -189,11 +188,11 @@ logWillStdErr(LogLevel logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, logLevel <= logLevelStdErr);
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, logLevel <= logLevelStdErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -201,11 +200,11 @@ logWillStdOut(LogLevel logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, logLevel <= logLevelStdOut);
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, logLevel <= logLevelStdOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -213,11 +212,11 @@ logWill(LogLevel logLevel)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, logWillStdOut(logLevel) || logWillStdErr(logLevel) || logWillFile(logLevel));
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, logWillStdOut(logLevel) || logWillStdErr(logLevel) || logWillFile(logLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -230,14 +229,14 @@ logRange(LogLevel logLevel, LogLevel logRangeMin, LogLevel logRangeMax)
|
|||||||
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
FUNCTION_TEST_PARAM(ENUM, logLevel);
|
||||||
FUNCTION_TEST_PARAM(ENUM, logRangeMin);
|
FUNCTION_TEST_PARAM(ENUM, logRangeMin);
|
||||||
FUNCTION_TEST_PARAM(ENUM, logRangeMax);
|
FUNCTION_TEST_PARAM(ENUM, logRangeMax);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logRangeMin);
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logRangeMax);
|
|
||||||
FUNCTION_TEST_ASSERT(logRangeMin <= logRangeMax);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, logLevel >= logRangeMin && logLevel <= logRangeMax);
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
ASSERT_LOG_LEVEL(logRangeMin);
|
||||||
|
ASSERT_LOG_LEVEL(logRangeMax);
|
||||||
|
ASSERT(logRangeMin <= logRangeMax);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, logLevel >= logRangeMin && logLevel <= logRangeMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -251,17 +250,17 @@ logWrite(int handle, const char *message, size_t messageSize, const char *errorD
|
|||||||
FUNCTION_TEST_PARAM(STRINGZ, message);
|
FUNCTION_TEST_PARAM(STRINGZ, message);
|
||||||
FUNCTION_TEST_PARAM(SIZE, messageSize);
|
FUNCTION_TEST_PARAM(SIZE, messageSize);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, errorDetail);
|
FUNCTION_TEST_PARAM(STRINGZ, errorDetail);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(handle != -1);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(messageSize != 0);
|
|
||||||
FUNCTION_TEST_ASSERT(errorDetail != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(handle != -1);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
ASSERT(messageSize != 0);
|
||||||
|
ASSERT(errorDetail != NULL);
|
||||||
|
|
||||||
if ((size_t)write(handle, message, messageSize) != messageSize)
|
if ((size_t)write(handle, message, messageSize) != messageSize)
|
||||||
THROW_SYS_ERROR_FMT(FileWriteError, "unable to write %s", errorDetail);
|
THROW_SYS_ERROR_FMT(FileWriteError, "unable to write %s", errorDetail);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -278,13 +277,13 @@ logWriteIndent(int handle, const char *message, size_t indentSize, const char *e
|
|||||||
FUNCTION_TEST_PARAM(STRINGZ, message);
|
FUNCTION_TEST_PARAM(STRINGZ, message);
|
||||||
FUNCTION_TEST_PARAM(SIZE, indentSize);
|
FUNCTION_TEST_PARAM(SIZE, indentSize);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, errorDetail);
|
FUNCTION_TEST_PARAM(STRINGZ, errorDetail);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(handle != -1);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(indentSize > 0 && indentSize < sizeof(indentBuffer));
|
|
||||||
FUNCTION_TEST_ASSERT(errorDetail != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(handle != -1);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
ASSERT(indentSize > 0 && indentSize < sizeof(indentBuffer));
|
||||||
|
ASSERT(errorDetail != NULL);
|
||||||
|
|
||||||
// Indent all lines after the first
|
// Indent all lines after the first
|
||||||
const char *linefeedPtr = strchr(message, '\n');
|
const char *linefeedPtr = strchr(message, '\n');
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -302,7 +301,7 @@ logWriteIndent(int handle, const char *message, size_t indentSize, const char *e
|
|||||||
linefeedPtr = strchr(message, '\n');
|
linefeedPtr = strchr(message, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -321,19 +320,19 @@ logInternal(
|
|||||||
FUNCTION_TEST_PARAM(STRINGZ, functionName);
|
FUNCTION_TEST_PARAM(STRINGZ, functionName);
|
||||||
FUNCTION_TEST_PARAM(INT, code);
|
FUNCTION_TEST_PARAM(INT, code);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, format);
|
FUNCTION_TEST_PARAM(STRINGZ, format);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logLevel);
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logRangeMin);
|
|
||||||
FUNCTION_TEST_ASSERT_LOG_LEVEL(logRangeMax);
|
|
||||||
FUNCTION_TEST_ASSERT(logRangeMin <= logRangeMax);
|
|
||||||
FUNCTION_TEST_ASSERT(fileName != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(functionName != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(
|
|
||||||
(code == 0 && logLevel > logLevelError) || (logLevel == logLevelError && code != errorTypeCode(&AssertError)) ||
|
|
||||||
(logLevel == logLevelAssert && code == errorTypeCode(&AssertError)));
|
|
||||||
FUNCTION_TEST_ASSERT(format != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT_LOG_LEVEL(logLevel);
|
||||||
|
ASSERT_LOG_LEVEL(logRangeMin);
|
||||||
|
ASSERT_LOG_LEVEL(logRangeMax);
|
||||||
|
ASSERT(logRangeMin <= logRangeMax);
|
||||||
|
ASSERT(fileName != NULL);
|
||||||
|
ASSERT(functionName != NULL);
|
||||||
|
ASSERT(
|
||||||
|
(code == 0 && logLevel > logLevelError) || (logLevel == logLevelError && code != errorTypeCode(&AssertError)) ||
|
||||||
|
(logLevel == logLevelAssert && code == errorTypeCode(&AssertError)));
|
||||||
|
ASSERT(format != NULL);
|
||||||
|
|
||||||
size_t bufferPos = 0; // Current position in the buffer
|
size_t bufferPos = 0; // Current position in the buffer
|
||||||
|
|
||||||
// Add time
|
// Add time
|
||||||
@@ -416,5 +415,5 @@ logInternal(
|
|||||||
logWriteIndent(logHandleFile, logBuffer, indentSize, "log to file");
|
logWriteIndent(logHandleFile, logBuffer, indentSize, "log to file");
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ Memory Context Manager
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
@@ -82,7 +81,7 @@ memAllocInternal(size_t size, bool zero)
|
|||||||
memset(buffer, 0, size);
|
memset(buffer, 0, size);
|
||||||
|
|
||||||
// Return the buffer
|
// Return the buffer
|
||||||
FUNCTION_TEST_RESULT(VOIDP, buffer);
|
FUNCTION_TEST_RETURN(VOIDP, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -96,10 +95,10 @@ memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew, bool zeroNew
|
|||||||
FUNCTION_TEST_PARAM(SIZE, sizeOld);
|
FUNCTION_TEST_PARAM(SIZE, sizeOld);
|
||||||
FUNCTION_TEST_PARAM(SIZE, sizeNew);
|
FUNCTION_TEST_PARAM(SIZE, sizeNew);
|
||||||
FUNCTION_TEST_PARAM(BOOL, zeroNew);
|
FUNCTION_TEST_PARAM(BOOL, zeroNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(bufferOld != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(bufferOld != NULL);
|
||||||
|
|
||||||
// Allocate memory
|
// Allocate memory
|
||||||
void *bufferNew = realloc(bufferOld, sizeNew);
|
void *bufferNew = realloc(bufferOld, sizeNew);
|
||||||
|
|
||||||
@@ -112,7 +111,7 @@ memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew, bool zeroNew
|
|||||||
memset((unsigned char *)bufferNew + sizeOld, 0, sizeNew - sizeOld);
|
memset((unsigned char *)bufferNew + sizeOld, 0, sizeNew - sizeOld);
|
||||||
|
|
||||||
// Return the buffer
|
// Return the buffer
|
||||||
FUNCTION_TEST_RESULT(VOIDP, bufferNew);
|
FUNCTION_TEST_RETURN(VOIDP, bufferNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -123,13 +122,13 @@ memFreeInternal(void *buffer)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -141,10 +140,10 @@ memContextNewIndex(MemContext *memContext, bool allowFree)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, memContext);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, memContext);
|
||||||
FUNCTION_TEST_PARAM(BOOL, allowFree);
|
FUNCTION_TEST_PARAM(BOOL, allowFree);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(memContext != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(memContext != NULL);
|
||||||
|
|
||||||
// Try to find space for the new context
|
// Try to find space for the new context
|
||||||
unsigned int contextIdx;
|
unsigned int contextIdx;
|
||||||
|
|
||||||
@@ -185,7 +184,7 @@ memContextNewIndex(MemContext *memContext, bool allowFree)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, contextIdx);
|
FUNCTION_TEST_RETURN(UINT, contextIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -196,10 +195,10 @@ memContextNew(const char *name)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, name);
|
FUNCTION_TEST_PARAM(STRINGZ, name);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
// Check context name length
|
// Check context name length
|
||||||
if (strlen(name) == 0 || strlen(name) > MEM_CONTEXT_NAME_SIZE)
|
if (strlen(name) == 0 || strlen(name) > MEM_CONTEXT_NAME_SIZE)
|
||||||
THROW_FMT(AssertError, "context name length must be > 0 and <= %d", MEM_CONTEXT_NAME_SIZE);
|
THROW_FMT(AssertError, "context name length must be > 0 and <= %d", MEM_CONTEXT_NAME_SIZE);
|
||||||
@@ -228,7 +227,7 @@ memContextNew(const char *name)
|
|||||||
this->contextParent = memContextCurrent();
|
this->contextParent = memContextCurrent();
|
||||||
|
|
||||||
// Return context
|
// Return context
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, this);
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -241,11 +240,11 @@ memContextCallback(MemContext *this, void (*callbackFunction)(void *), void *cal
|
|||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
FUNCTION_TEST_PARAM(FUNCTIONP, callbackFunction);
|
FUNCTION_TEST_PARAM(FUNCTIONP, callbackFunction);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, callbackArgument);
|
FUNCTION_TEST_PARAM(VOIDP, callbackArgument);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(callbackFunction != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(callbackFunction != NULL);
|
||||||
|
|
||||||
// Error if context is not active
|
// Error if context is not active
|
||||||
if (this->state != memContextStateActive)
|
if (this->state != memContextStateActive)
|
||||||
THROW(AssertError, "cannot assign callback to inactive context");
|
THROW(AssertError, "cannot assign callback to inactive context");
|
||||||
@@ -262,7 +261,7 @@ memContextCallback(MemContext *this, void (*callbackFunction)(void *), void *cal
|
|||||||
this->callbackFunction = callbackFunction;
|
this->callbackFunction = callbackFunction;
|
||||||
this->callbackArgument = callbackArgument;
|
this->callbackArgument = callbackArgument;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -274,10 +273,10 @@ memContextCallbackClear(MemContext *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Error if context is not active or freeing
|
// Error if context is not active or freeing
|
||||||
ASSERT(this->state == memContextStateActive || this->state == memContextStateFreeing);
|
ASSERT(this->state == memContextStateActive || this->state == memContextStateFreeing);
|
||||||
|
|
||||||
@@ -288,7 +287,7 @@ memContextCallbackClear(MemContext *this)
|
|||||||
this->callbackFunction = NULL;
|
this->callbackFunction = NULL;
|
||||||
this->callbackArgument = NULL;
|
this->callbackArgument = NULL;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -343,7 +342,7 @@ memContextAlloc(size_t size, bool zero)
|
|||||||
memContextCurrent()->allocList[allocIdx].buffer = memAllocInternal(size, zero);
|
memContextCurrent()->allocList[allocIdx].buffer = memAllocInternal(size, zero);
|
||||||
|
|
||||||
// Return buffer
|
// Return buffer
|
||||||
FUNCTION_TEST_RESULT(VOIDP, memContextCurrent()->allocList[allocIdx].buffer);
|
FUNCTION_TEST_RETURN(VOIDP, memContextCurrent()->allocList[allocIdx].buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -354,10 +353,10 @@ memFind(const void *buffer)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Find memory allocation
|
// Find memory allocation
|
||||||
unsigned int allocIdx;
|
unsigned int allocIdx;
|
||||||
|
|
||||||
@@ -369,7 +368,7 @@ memFind(const void *buffer)
|
|||||||
if (allocIdx == memContextCurrent()->allocListSize)
|
if (allocIdx == memContextCurrent()->allocListSize)
|
||||||
THROW(AssertError, "unable to find allocation");
|
THROW(AssertError, "unable to find allocation");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, allocIdx);
|
FUNCTION_TEST_RETURN(UINT, allocIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -382,7 +381,7 @@ memNew(size_t size)
|
|||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VOIDP, memContextAlloc(size, true));
|
FUNCTION_TEST_RETURN(VOIDP, memContextAlloc(size, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -394,10 +393,10 @@ memGrowRaw(const void *buffer, size_t size)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Find the allocation
|
// Find the allocation
|
||||||
MemContextAlloc *alloc = &(memContextCurrent()->allocList[memFind(buffer)]);
|
MemContextAlloc *alloc = &(memContextCurrent()->allocList[memFind(buffer)]);
|
||||||
|
|
||||||
@@ -405,7 +404,7 @@ memGrowRaw(const void *buffer, size_t size)
|
|||||||
alloc->buffer = memReAllocInternal(alloc->buffer, alloc->size, size, false);
|
alloc->buffer = memReAllocInternal(alloc->buffer, alloc->size, size, false);
|
||||||
alloc->size = (unsigned int)size;
|
alloc->size = (unsigned int)size;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VOIDP, alloc->buffer);
|
FUNCTION_TEST_RETURN(VOIDP, alloc->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -418,7 +417,7 @@ memNewRaw(size_t size)
|
|||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VOIDP, memContextAlloc(size, false));
|
FUNCTION_TEST_RETURN(VOIDP, memContextAlloc(size, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -429,10 +428,10 @@ memFree(void *buffer)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Find the allocation
|
// Find the allocation
|
||||||
MemContextAlloc *alloc = &(memContextCurrent()->allocList[memFind(buffer)]);
|
MemContextAlloc *alloc = &(memContextCurrent()->allocList[memFind(buffer)]);
|
||||||
|
|
||||||
@@ -440,7 +439,7 @@ memFree(void *buffer)
|
|||||||
memFreeInternal(alloc->buffer);
|
memFreeInternal(alloc->buffer);
|
||||||
alloc->active = false;
|
alloc->active = false;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -454,10 +453,10 @@ memContextMove(MemContext *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
// Only move if a valid mem context is provided and the old and new parents are not the same
|
// Only move if a valid mem context is provided and the old and new parents are not the same
|
||||||
if (this != NULL && this->contextParent != parentNew)
|
if (this != NULL && this->contextParent != parentNew)
|
||||||
{
|
{
|
||||||
@@ -481,14 +480,14 @@ memContextMove(MemContext *this, MemContext *parentNew)
|
|||||||
// Find a place in the new parent context and assign it. The child list may be moved while finding a new index so store the
|
// Find a place in the new parent context and assign it. The child list may be moved while finding a new index so store the
|
||||||
// index and use it with (what might be) the new pointer.
|
// index and use it with (what might be) the new pointer.
|
||||||
contextIdx = memContextNewIndex(parentNew, false);
|
contextIdx = memContextNewIndex(parentNew, false);
|
||||||
ASSERT_DEBUG(parentNew->contextChildList[contextIdx] == NULL);
|
ASSERT(parentNew->contextChildList[contextIdx] == NULL);
|
||||||
parentNew->contextChildList[contextIdx] = this;
|
parentNew->contextChildList[contextIdx] = this;
|
||||||
|
|
||||||
// Assign new parent
|
// Assign new parent
|
||||||
this->contextParent = parentNew;
|
this->contextParent = parentNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -499,10 +498,10 @@ memContextSwitch(MemContext *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Error if context is not active
|
// Error if context is not active
|
||||||
if (this->state != memContextStateActive)
|
if (this->state != memContextStateActive)
|
||||||
THROW(AssertError, "cannot switch to inactive context");
|
THROW(AssertError, "cannot switch to inactive context");
|
||||||
@@ -510,7 +509,7 @@ memContextSwitch(MemContext *this)
|
|||||||
MemContext *memContextOld = memContextCurrent();
|
MemContext *memContextOld = memContextCurrent();
|
||||||
contextCurrent = this;
|
contextCurrent = this;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, memContextOld);
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, memContextOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -520,7 +519,7 @@ MemContext *
|
|||||||
memContextTop(void)
|
memContextTop(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, &contextTop);
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, &contextTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -530,7 +529,7 @@ MemContext *
|
|||||||
memContextCurrent(void)
|
memContextCurrent(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, contextCurrent);
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, contextCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -541,15 +540,15 @@ memContextName(MemContext *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Error if context is not active
|
// Error if context is not active
|
||||||
if (this->state != memContextStateActive)
|
if (this->state != memContextStateActive)
|
||||||
THROW(AssertError, "cannot get name for inactive context");
|
THROW(AssertError, "cannot get name for inactive context");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, this->name);
|
FUNCTION_TEST_RETURN(STRINGZ, this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -560,10 +559,10 @@ memContextFree(MemContext *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// If context is already freeing then return if memContextFree() is called again - this can happen in callbacks
|
// If context is already freeing then return if memContextFree() is called again - this can happen in callbacks
|
||||||
if (this->state != memContextStateFreeing)
|
if (this->state != memContextStateFreeing)
|
||||||
{
|
{
|
||||||
@@ -623,5 +622,5 @@ memContextFree(MemContext *this)
|
|||||||
memset(this, 0, sizeof(MemContext));
|
memset(this, 0, sizeof(MemContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,9 +192,9 @@ MEM_CONTEXT_TEMP_END();
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_MEM_CONTEXT_TYPE \
|
#define FUNCTION_LOG_MEM_CONTEXT_TYPE \
|
||||||
MemContext *
|
MemContext *
|
||||||
#define FUNCTION_DEBUG_MEM_CONTEXT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_MEM_CONTEXT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "MemContext", buffer, bufferSize)
|
objToLog(value, "MemContext", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ regExpError(int error)
|
|||||||
regerror(error, NULL, buffer, sizeof(buffer));
|
regerror(error, NULL, buffer, sizeof(buffer));
|
||||||
THROW(FormatError, buffer);
|
THROW(FormatError, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -42,10 +42,10 @@ regExpNew(const String *expression)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, expression);
|
FUNCTION_TEST_PARAM(STRING, expression);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(expression != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(expression != NULL);
|
||||||
|
|
||||||
RegExp *this = NULL;
|
RegExp *this = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_NEW_BEGIN("RegExp")
|
MEM_CONTEXT_NEW_BEGIN("RegExp")
|
||||||
@@ -67,7 +67,7 @@ regExpNew(const String *expression)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(REGEXP, this);
|
FUNCTION_TEST_RETURN(REGEXP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -79,11 +79,11 @@ regExpMatch(RegExp *this, const String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(REGEXP, this);
|
FUNCTION_TEST_PARAM(REGEXP, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
// Test for a match
|
// Test for a match
|
||||||
int result = regexec(&this->regExp, strPtr(string), 0, NULL, 0);
|
int result = regexec(&this->regExp, strPtr(string), 0, NULL, 0);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ regExpMatch(RegExp *this, const String *string)
|
|||||||
if (result != 0 && result != REG_NOMATCH) // {uncoverable - no error condition known}
|
if (result != 0 && result != REG_NOMATCH) // {uncoverable - no error condition known}
|
||||||
regExpError(result); // {+uncoverable}
|
regExpError(result); // {+uncoverable}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result == 0);
|
FUNCTION_TEST_RETURN(BOOL, result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -112,7 +112,7 @@ regExpFree(RegExp *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -124,11 +124,11 @@ regExpMatchOne(const String *expression, const String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, expression);
|
FUNCTION_TEST_PARAM(STRING, expression);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(expression != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(expression != NULL);
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
RegExp *regExp = regExpNew(expression);
|
RegExp *regExp = regExpNew(expression);
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ regExpMatchOne(const String *expression, const String *string)
|
|||||||
}
|
}
|
||||||
TRY_END();
|
TRY_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -183,5 +183,5 @@ regExpPrefix(const String *expression)
|
|||||||
result = strSubN(expression, 1, expressionIdx - 1);
|
result = strSubN(expression, 1, expressionIdx - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ String *regExpPrefix(const String *expression);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_REGEXP_TYPE \
|
#define FUNCTION_LOG_REGEXP_TYPE \
|
||||||
RegExp *
|
RegExp *
|
||||||
#define FUNCTION_DEBUG_REGEXP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_REGEXP_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "RegExp", buffer, bufferSize)
|
objToLog(value, "RegExp", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ Get parameters for the top function on the stack
|
|||||||
static const char *
|
static const char *
|
||||||
stackTraceParamIdx(int stackIdx)
|
stackTraceParamIdx(int stackIdx)
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(stackSize > 0);
|
ASSERT(stackSize > 0);
|
||||||
ASSERT_DEBUG(stackIdx < stackSize);
|
ASSERT(stackIdx < stackSize);
|
||||||
|
|
||||||
StackTraceData *data = &stackTrace[stackIdx];
|
StackTraceData *data = &stackTrace[stackIdx];
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ Get the next location where a parameter can be added in the param buffer
|
|||||||
char *
|
char *
|
||||||
stackTraceParamBuffer(const char *paramName)
|
stackTraceParamBuffer(const char *paramName)
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(stackSize > 0);
|
ASSERT(stackSize > 0);
|
||||||
|
|
||||||
StackTraceData *data = &stackTrace[stackSize - 1];
|
StackTraceData *data = &stackTrace[stackSize - 1];
|
||||||
size_t paramNameSize = strlen(paramName);
|
size_t paramNameSize = strlen(paramName);
|
||||||
@@ -236,7 +236,7 @@ Add a parameter to the function on the top of the stack
|
|||||||
void
|
void
|
||||||
stackTraceParamAdd(size_t bufferSize)
|
stackTraceParamAdd(size_t bufferSize)
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(stackSize > 0);
|
ASSERT(stackSize > 0);
|
||||||
|
|
||||||
StackTraceData *data = &stackTrace[stackSize - 1];
|
StackTraceData *data = &stackTrace[stackSize - 1];
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ Mark that parameters are being logged -- it none appear then the function is voi
|
|||||||
void
|
void
|
||||||
stackTraceParamLog(void)
|
stackTraceParamLog(void)
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(stackSize > 0);
|
ASSERT(stackSize > 0);
|
||||||
|
|
||||||
stackTrace[stackSize - 1].paramLog = true;
|
stackTrace[stackSize - 1].paramLog = true;
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ stackTracePop(void)
|
|||||||
void
|
void
|
||||||
stackTracePop(const char *fileName, const char *functionName)
|
stackTracePop(const char *fileName, const char *functionName)
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(stackSize > 0);
|
ASSERT(stackSize > 0);
|
||||||
|
|
||||||
stackSize--;
|
stackSize--;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ timeMSec(void)
|
|||||||
struct timeval currentTime;
|
struct timeval currentTime;
|
||||||
gettimeofday(¤tTime, NULL);
|
gettimeofday(¤tTime, NULL);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, ((TimeMSec)currentTime.tv_sec * MSEC_PER_SEC) + (TimeMSec)currentTime.tv_usec / MSEC_PER_USEC);
|
FUNCTION_TEST_RETURN(UINT64, ((TimeMSec)currentTime.tv_sec * MSEC_PER_SEC) + (TimeMSec)currentTime.tv_usec / MSEC_PER_USEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -41,5 +41,5 @@ sleepMSec(TimeMSec sleepMSec)
|
|||||||
delay.tv_usec = (time_t)(sleepMSec % MSEC_PER_SEC * 1000);
|
delay.tv_usec = (time_t)(sleepMSec % MSEC_PER_SEC * 1000);
|
||||||
select(0, NULL, NULL, NULL, &delay);
|
select(0, NULL, NULL, NULL, &delay);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ TimeMSec timeMSec(void);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_TIME_MSEC_TYPE \
|
#define FUNCTION_LOG_TIME_MSEC_TYPE \
|
||||||
TimeMSec
|
TimeMSec
|
||||||
#define FUNCTION_DEBUG_TIME_MSEC_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_TIME_MSEC_FORMAT(value, buffer, bufferSize) \
|
||||||
cvtUInt64ToZ(value, buffer, bufferSize)
|
cvtUInt64ToZ(value, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ Buffer Handler
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/type/buffer.h"
|
#include "common/type/buffer.h"
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ bufNew(size_t size)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -59,16 +58,16 @@ bufNewC(size_t size, const void *buffer)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
FUNCTION_TEST_PARAM(VOIDP, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Create object and copy data
|
// Create object and copy data
|
||||||
Buffer *this = bufNew(size);
|
Buffer *this = bufNew(size);
|
||||||
memcpy(this->buffer, buffer, this->size);
|
memcpy(this->buffer, buffer, this->size);
|
||||||
this->used = this->size;
|
this->used = this->size;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -79,16 +78,16 @@ bufNewStr(const String *string)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
// Create object and copy string
|
// Create object and copy string
|
||||||
Buffer *this = bufNew(strSize(string));
|
Buffer *this = bufNew(strSize(string));
|
||||||
memcpy(this->buffer, strPtr(string), bufSize(this));
|
memcpy(this->buffer, strPtr(string), bufSize(this));
|
||||||
this->used = bufSize(this);
|
this->used = bufSize(this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -99,16 +98,16 @@ bufNewZ(const char *string)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, string);
|
FUNCTION_TEST_PARAM(STRINGZ, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
// Create a new buffer and then copy the string into it.
|
// Create a new buffer and then copy the string into it.
|
||||||
Buffer *this = bufNew(strlen(string));
|
Buffer *this = bufNew(strlen(string));
|
||||||
memcpy(this->buffer, string, bufSize(this));
|
memcpy(this->buffer, string, bufSize(this));
|
||||||
this->used = bufSize(this);
|
this->used = bufSize(this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -120,14 +119,14 @@ bufCat(Buffer *this, const Buffer *cat)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, cat);
|
FUNCTION_TEST_PARAM(BUFFER, cat);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (cat != NULL)
|
if (cat != NULL)
|
||||||
bufCatC(this, cat->buffer, 0, cat->used);
|
bufCatC(this, cat->buffer, 0, cat->used);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -141,24 +140,24 @@ bufCatC(Buffer *this, const unsigned char *cat, size_t catOffset, size_t catSize
|
|||||||
FUNCTION_TEST_PARAM(UCHARP, cat);
|
FUNCTION_TEST_PARAM(UCHARP, cat);
|
||||||
FUNCTION_TEST_PARAM(SIZE, catOffset);
|
FUNCTION_TEST_PARAM(SIZE, catOffset);
|
||||||
FUNCTION_TEST_PARAM(SIZE, catSize);
|
FUNCTION_TEST_PARAM(SIZE, catSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(catSize == 0 || cat != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(catSize == 0 || cat != NULL);
|
||||||
|
|
||||||
if (catSize > 0)
|
if (catSize > 0)
|
||||||
{
|
{
|
||||||
if (this->used + catSize > bufSize(this))
|
if (this->used + catSize > bufSize(this))
|
||||||
bufResize(this, this->used + catSize);
|
bufResize(this, this->used + catSize);
|
||||||
|
|
||||||
// Just here to silence nonnull warnings from clang static analyzer
|
// Just here to silence nonnull warnings from clang static analyzer
|
||||||
ASSERT_DEBUG(this->buffer != NULL);
|
ASSERT(this->buffer != NULL);
|
||||||
|
|
||||||
memcpy(this->buffer + this->used, cat + catOffset, catSize);
|
memcpy(this->buffer + this->used, cat + catOffset, catSize);
|
||||||
this->used += catSize;
|
this->used += catSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -172,10 +171,10 @@ bufCatSub(Buffer *this, const Buffer *cat, size_t catOffset, size_t catSize)
|
|||||||
FUNCTION_TEST_PARAM(BUFFER, cat);
|
FUNCTION_TEST_PARAM(BUFFER, cat);
|
||||||
FUNCTION_TEST_PARAM(SIZE, catOffset);
|
FUNCTION_TEST_PARAM(SIZE, catOffset);
|
||||||
FUNCTION_TEST_PARAM(SIZE, catSize);
|
FUNCTION_TEST_PARAM(SIZE, catSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (cat != NULL)
|
if (cat != NULL)
|
||||||
{
|
{
|
||||||
ASSERT(catOffset <= cat->used);
|
ASSERT(catOffset <= cat->used);
|
||||||
@@ -184,7 +183,7 @@ bufCatSub(Buffer *this, const Buffer *cat, size_t catOffset, size_t catSize)
|
|||||||
bufCatC(this, cat->buffer, catOffset, catSize);
|
bufCatC(this, cat->buffer, catOffset, catSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -196,17 +195,17 @@ bufEq(const Buffer *this, const Buffer *compare)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, compare);
|
FUNCTION_TEST_PARAM(BUFFER, compare);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(compare != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(compare != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (this->used == compare->used)
|
if (this->used == compare->used)
|
||||||
result = memcmp(this->buffer, compare->buffer, compare->used) == 0;
|
result = memcmp(this->buffer, compare->buffer, compare->used) == 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -217,16 +216,16 @@ bufHex(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
String *result = strNew("");
|
String *result = strNew("");
|
||||||
|
|
||||||
for (unsigned int bufferIdx = 0; bufferIdx < bufSize(this); bufferIdx++)
|
for (unsigned int bufferIdx = 0; bufferIdx < bufSize(this); bufferIdx++)
|
||||||
strCatFmt(result, "%02x", this->buffer[bufferIdx]);
|
strCatFmt(result, "%02x", this->buffer[bufferIdx]);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -238,14 +237,14 @@ bufMove(Buffer *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -257,10 +256,10 @@ bufResize(Buffer *this, size_t size)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Only resize if it the new size is different
|
// Only resize if it the new size is different
|
||||||
if (this->size != size)
|
if (this->size != size)
|
||||||
{
|
{
|
||||||
@@ -268,7 +267,7 @@ bufResize(Buffer *this, size_t size)
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
// When setting size down to 0 the buffer should always be allocated
|
// When setting size down to 0 the buffer should always be allocated
|
||||||
ASSERT_DEBUG(this->buffer != NULL);
|
ASSERT(this->buffer != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
@@ -301,7 +300,7 @@ bufResize(Buffer *this, size_t size)
|
|||||||
this->limit = this->size;
|
this->limit = this->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
FUNCTION_TEST_RETURN(BUFFER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -312,11 +311,11 @@ bufFull(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->used == bufSize(this));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->used == bufSize(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -327,13 +326,13 @@ bufLimitClear(Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
this->limitSet = false;
|
this->limitSet = false;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -342,15 +341,15 @@ bufLimitSet(Buffer *this, size_t limit)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, limit);
|
FUNCTION_TEST_PARAM(SIZE, limit);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(limit <= this->size);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(limit <= this->size);
|
||||||
|
|
||||||
this->limit = limit;
|
this->limit = limit;
|
||||||
this->limitSet = true;
|
this->limitSet = true;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -361,11 +360,11 @@ bufPtr(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UCHARP, this->buffer);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UCHARP, this->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -376,11 +375,11 @@ bufRemains(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, bufSize(this) - this->used);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(SIZE, bufSize(this) - this->used);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -391,11 +390,11 @@ bufRemainsPtr(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UCHARP, this->buffer + this->used);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UCHARP, this->buffer + this->used);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -406,11 +405,11 @@ bufSize(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, this->limitSet ? this->limit : this->size);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(SIZE, this->limitSet ? this->limit : this->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -424,11 +423,11 @@ bufUsed(const Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, this->used);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(SIZE, this->used);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -437,14 +436,14 @@ bufUsedInc(Buffer *this, size_t inc)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, inc);
|
FUNCTION_TEST_PARAM(SIZE, inc);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(this->used + inc <= bufSize(this));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(this->used + inc <= bufSize(this));
|
||||||
|
|
||||||
this->used += inc;
|
this->used += inc;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -453,14 +452,14 @@ bufUsedSet(Buffer *this, size_t used)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, used);
|
FUNCTION_TEST_PARAM(SIZE, used);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(used <= bufSize(this));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(used <= bufSize(this));
|
||||||
|
|
||||||
this->used = used;
|
this->used = used;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -468,13 +467,13 @@ bufUsedZero(Buffer *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, this);
|
FUNCTION_TEST_PARAM(BUFFER, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
this->used = 0;
|
this->used = 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -506,5 +505,5 @@ bufFree(Buffer *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *bufToLog(const Buffer *this);
|
String *bufToLog(const Buffer *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_BUFFER_TYPE \
|
#define FUNCTION_LOG_BUFFER_TYPE \
|
||||||
Buffer *
|
Buffer *
|
||||||
#define FUNCTION_DEBUG_BUFFER_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_BUFFER_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, bufToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, bufToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ Convert Base Data Types
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/type/convert.h"
|
#include "common/type/convert.h"
|
||||||
|
|
||||||
@@ -27,15 +26,15 @@ cvtZToIntValid(int errNo, int base, const char *value, const char *endPtr, const
|
|||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, endPtr);
|
FUNCTION_TEST_PARAM(CHARP, endPtr);
|
||||||
FUNCTION_TEST_PARAM(CHARP, type);
|
FUNCTION_TEST_PARAM(CHARP, type);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(endPtr != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
ASSERT(endPtr != NULL);
|
||||||
|
|
||||||
if (errNo != 0 || *value == '\0' || isspace(*value) || *endPtr != '\0')
|
if (errNo != 0 || *value == '\0' || isspace(*value) || *endPtr != '\0')
|
||||||
THROW_FMT(FormatError, "unable to convert base %d string '%s' to %s", base, value, type);
|
THROW_FMT(FormatError, "unable to convert base %d string '%s' to %s", base, value, type);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -47,11 +46,11 @@ cvtZToInt64Internal(const char *value, const char *type, int base)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, type);
|
FUNCTION_TEST_PARAM(CHARP, type);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
ASSERT(type != NULL);
|
||||||
|
|
||||||
// Convert from string
|
// Convert from string
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *endPtr = NULL;
|
char *endPtr = NULL;
|
||||||
@@ -60,7 +59,7 @@ cvtZToInt64Internal(const char *value, const char *type, int base)
|
|||||||
// Validate the result
|
// Validate the result
|
||||||
cvtZToIntValid(errno, base, value, endPtr, type);
|
cvtZToIntValid(errno, base, value, endPtr, type);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT64, result);
|
FUNCTION_TEST_RETURN(INT64, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -72,11 +71,11 @@ cvtZToUInt64Internal(const char *value, const char *type, int base)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, type);
|
FUNCTION_TEST_PARAM(CHARP, type);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
ASSERT(type != NULL);
|
||||||
|
|
||||||
// Convert from string
|
// Convert from string
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *endPtr = NULL;
|
char *endPtr = NULL;
|
||||||
@@ -85,7 +84,7 @@ cvtZToUInt64Internal(const char *value, const char *type, int base)
|
|||||||
// Validate the result
|
// Validate the result
|
||||||
cvtZToIntValid(errno, base, value, endPtr, type);
|
cvtZToIntValid(errno, base, value, endPtr, type);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, result);
|
FUNCTION_TEST_RETURN(UINT64, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -98,16 +97,16 @@ cvtBoolToZ(bool value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(BOOL, value);
|
FUNCTION_TEST_PARAM(BOOL, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%s", cvtBoolToConstZ(value));
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%s", cvtBoolToConstZ(value));
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since booleans only have two possible values we can return a const with the value. This is useful when a boolean needs to be
|
// Since booleans only have two possible values we can return a const with the value. This is useful when a boolean needs to be
|
||||||
@@ -128,16 +127,16 @@ cvtCharToZ(char value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(BOOL, value);
|
FUNCTION_TEST_PARAM(BOOL, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%c", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%c", value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -150,10 +149,10 @@ cvtDoubleToZ(double value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(DOUBLE, value);
|
FUNCTION_TEST_PARAM(DOUBLE, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Convert to a string
|
// Convert to a string
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%lf", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%lf", value);
|
||||||
|
|
||||||
@@ -161,9 +160,9 @@ cvtDoubleToZ(double value, char *buffer, size_t bufferSize)
|
|||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
// Any formatted double should be at least 8 characters, i.e. 0.000000
|
// Any formatted double should be at least 8 characters, i.e. 0.000000
|
||||||
ASSERT_DEBUG(strlen(buffer) >= 8);
|
ASSERT(strlen(buffer) >= 8);
|
||||||
// Any formatted double should have a decimal point
|
// Any formatted double should have a decimal point
|
||||||
ASSERT_DEBUG(strchr(buffer, '.') != NULL);
|
ASSERT(strchr(buffer, '.') != NULL);
|
||||||
|
|
||||||
// Strip off any final 0s and the decimal point if there are no non-zero digits after it
|
// Strip off any final 0s and the decimal point if there are no non-zero digits after it
|
||||||
char *end = buffer + strlen(buffer) - 1;
|
char *end = buffer + strlen(buffer) - 1;
|
||||||
@@ -171,7 +170,7 @@ cvtDoubleToZ(double value, char *buffer, size_t bufferSize)
|
|||||||
while (*end == '0' || *end == '.')
|
while (*end == '0' || *end == '.')
|
||||||
{
|
{
|
||||||
// It should not be possible to go past the beginning because format "%lf" will always write a decimal point
|
// It should not be possible to go past the beginning because format "%lf" will always write a decimal point
|
||||||
ASSERT_DEBUG(end > buffer);
|
ASSERT(end > buffer);
|
||||||
|
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
@@ -183,7 +182,7 @@ cvtDoubleToZ(double value, char *buffer, size_t bufferSize)
|
|||||||
end[1] = 0;
|
end[1] = 0;
|
||||||
|
|
||||||
// Return string length
|
// Return string length
|
||||||
FUNCTION_TEST_RESULT(SIZE, (size_t)(end - buffer + 1));
|
FUNCTION_TEST_RETURN(SIZE, (size_t)(end - buffer + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
@@ -191,17 +190,17 @@ cvtZToDouble(const char *value)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
double result = 0;
|
double result = 0;
|
||||||
sscanf(value, "%lf", &result);
|
sscanf(value, "%lf", &result);
|
||||||
|
|
||||||
if (result == 0 && strcmp(value, "0") != 0)
|
if (result == 0 && strcmp(value, "0") != 0)
|
||||||
THROW_FMT(FormatError, "unable to convert string '%s' to double", value);
|
THROW_FMT(FormatError, "unable to convert string '%s' to double", value);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(DOUBLE, result);
|
FUNCTION_TEST_RETURN(DOUBLE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -214,16 +213,16 @@ cvtIntToZ(int value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(INT, value);
|
FUNCTION_TEST_PARAM(INT, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%d", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%d", value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -231,16 +230,16 @@ cvtZToIntBase(const char *value, int base)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
int64_t result = cvtZToInt64Internal(value, "int", base);
|
int64_t result = cvtZToInt64Internal(value, "int", base);
|
||||||
|
|
||||||
if (result > INT_MAX || result < INT_MIN)
|
if (result > INT_MAX || result < INT_MIN)
|
||||||
THROW_FMT(FormatError, "unable to convert base %d string '%s' to int", base, value);
|
THROW_FMT(FormatError, "unable to convert base %d string '%s' to int", base, value);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, (int)result);
|
FUNCTION_TEST_RETURN(INT, (int)result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -248,11 +247,11 @@ cvtZToInt(const char *value)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, cvtZToIntBase(value, 10));
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, cvtZToIntBase(value, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -265,16 +264,16 @@ cvtInt64ToZ(int64_t value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(INT64, value);
|
FUNCTION_TEST_PARAM(INT64, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%" PRId64, value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%" PRId64, value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
@@ -282,11 +281,11 @@ cvtZToInt64Base(const char *value, int base)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT64, cvtZToInt64Internal(value, "int64", base));
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT64, cvtZToInt64Internal(value, "int64", base));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
@@ -294,11 +293,11 @@ cvtZToInt64(const char *value)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT64, cvtZToInt64Base(value, 10));
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT64, cvtZToInt64Base(value, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -311,16 +310,16 @@ cvtModeToZ(mode_t value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(MODE, value);
|
FUNCTION_TEST_PARAM(MODE, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%04o", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%04o", value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -333,16 +332,16 @@ cvtSizeToZ(size_t value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(SIZE, value);
|
FUNCTION_TEST_PARAM(SIZE, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%zu", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%zu", value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -355,16 +354,16 @@ cvtUIntToZ(unsigned int value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(UINT, value);
|
FUNCTION_TEST_PARAM(UINT, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%u", value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%u", value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
@@ -372,17 +371,17 @@ cvtZToUIntBase(const char *value, int base)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
uint64_t result = cvtZToUInt64Internal(value, "unsigned int", base);
|
uint64_t result = cvtZToUInt64Internal(value, "unsigned int", base);
|
||||||
|
|
||||||
// Don't allow negative numbers even though strtoull() does and check max value
|
// Don't allow negative numbers even though strtoull() does and check max value
|
||||||
if (*value == '-' || result > UINT_MAX)
|
if (*value == '-' || result > UINT_MAX)
|
||||||
THROW_FMT(FormatError, "unable to convert base %d string '%s' to unsigned int", base, value);
|
THROW_FMT(FormatError, "unable to convert base %d string '%s' to unsigned int", base, value);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, (unsigned int)result);
|
FUNCTION_TEST_RETURN(UINT, (unsigned int)result);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
@@ -390,11 +389,11 @@ cvtZToUInt(const char *value)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, cvtZToUIntBase(value, 10));
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, cvtZToUIntBase(value, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -407,16 +406,16 @@ cvtUInt64ToZ(uint64_t value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_PARAM(UINT64, value);
|
FUNCTION_TEST_PARAM(UINT64, value);
|
||||||
FUNCTION_TEST_PARAM(CHARP, buffer);
|
FUNCTION_TEST_PARAM(CHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
size_t result = (size_t)snprintf(buffer, bufferSize, "%" PRIu64, value);
|
size_t result = (size_t)snprintf(buffer, bufferSize, "%" PRIu64, value);
|
||||||
|
|
||||||
if (result >= bufferSize)
|
if (result >= bufferSize)
|
||||||
THROW(AssertError, "buffer overflow");
|
THROW(AssertError, "buffer overflow");
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, result);
|
FUNCTION_TEST_RETURN(SIZE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@@ -424,17 +423,17 @@ cvtZToUInt64Base(const char *value, int base)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
uint64_t result = cvtZToUInt64Internal(value, "uint64", base);
|
uint64_t result = cvtZToUInt64Internal(value, "uint64", base);
|
||||||
|
|
||||||
// Don't allow negative numbers even though strtoull() does
|
// Don't allow negative numbers even though strtoull() does
|
||||||
if (*value == '-')
|
if (*value == '-')
|
||||||
THROW_FMT(FormatError, "unable to convert base %d string '%s' to uint64", base, value);
|
THROW_FMT(FormatError, "unable to convert base %d string '%s' to uint64", base, value);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, result);
|
FUNCTION_TEST_RETURN(UINT64, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@@ -442,9 +441,9 @@ cvtZToUInt64(const char *value)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, value);
|
FUNCTION_TEST_PARAM(CHARP, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, cvtZToUInt64Base(value, 10));
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT64, cvtZToUInt64Base(value, 10));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ jsonString(const char *jsonC, unsigned int *jsonPos)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, result);
|
FUNCTION_TEST_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -125,7 +125,7 @@ jsonNumeric(const char *jsonC, size_t strSize, unsigned int *jsonPos, unsigned i
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, result);
|
FUNCTION_TEST_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -138,11 +138,11 @@ whitespace.
|
|||||||
KeyValue *
|
KeyValue *
|
||||||
jsonToKv(const String *json)
|
jsonToKv(const String *json)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, json);
|
FUNCTION_LOG_PARAM(STRING, json);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(json != NULL);
|
ASSERT(json != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
KeyValue *result = kvNew();
|
KeyValue *result = kvNew();
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ jsonToKv(const String *json)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(KEY_VALUE, result);
|
FUNCTION_LOG_RETURN(KEY_VALUE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -322,10 +322,10 @@ jsonStringRender(String *json, const String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, json);
|
FUNCTION_TEST_PARAM(STRING, json);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(json != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(json != NULL);
|
||||||
|
|
||||||
// If string is null
|
// If string is null
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
{
|
{
|
||||||
@@ -383,7 +383,7 @@ jsonStringRender(String *json, const String *string)
|
|||||||
strCatChr(json, '"');
|
strCatChr(json, '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -396,12 +396,12 @@ kvToJsonInternal(const KeyValue *kv, String *indentSpace, String *indentDepth)
|
|||||||
FUNCTION_TEST_PARAM(KEY_VALUE, kv);
|
FUNCTION_TEST_PARAM(KEY_VALUE, kv);
|
||||||
FUNCTION_TEST_PARAM(STRING, indentSpace);
|
FUNCTION_TEST_PARAM(STRING, indentSpace);
|
||||||
FUNCTION_TEST_PARAM(STRING, indentDepth);
|
FUNCTION_TEST_PARAM(STRING, indentDepth);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(kv != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(indentSpace != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(indentDepth != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(kv != NULL);
|
||||||
|
ASSERT(indentSpace != NULL);
|
||||||
|
ASSERT(indentDepth != NULL);
|
||||||
|
|
||||||
String *result = strNew("{");
|
String *result = strNew("{");
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -498,7 +498,7 @@ kvToJsonInternal(const KeyValue *kv, String *indentSpace, String *indentDepth)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -511,12 +511,12 @@ whitespace.
|
|||||||
String *
|
String *
|
||||||
kvToJson(const KeyValue *kv, unsigned int indent)
|
kvToJson(const KeyValue *kv, unsigned int indent)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(KEY_VALUE, kv);
|
FUNCTION_LOG_PARAM(KEY_VALUE, kv);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, indent);
|
FUNCTION_LOG_PARAM(UINT, indent);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(kv != NULL);
|
ASSERT(kv != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@ kvToJson(const KeyValue *kv, unsigned int indent)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -560,12 +560,12 @@ needed.
|
|||||||
String *
|
String *
|
||||||
varToJson(const Variant *var, unsigned int indent)
|
varToJson(const Variant *var, unsigned int indent)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(VARIANT, var);
|
FUNCTION_LOG_PARAM(VARIANT, var);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, indent);
|
FUNCTION_LOG_PARAM(UINT, indent);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(var != NULL);
|
ASSERT(var != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
@@ -638,5 +638,5 @@ varToJson(const Variant *var, unsigned int indent)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ kvNew(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, this);
|
FUNCTION_TEST_RETURN(KEY_VALUE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -66,10 +66,10 @@ kvDup(const KeyValue *source)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, source);
|
FUNCTION_TEST_PARAM(KEY_VALUE, source);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(source != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(source != NULL);
|
||||||
|
|
||||||
KeyValue *this = kvNew();
|
KeyValue *this = kvNew();
|
||||||
|
|
||||||
// Duplicate all key/values
|
// Duplicate all key/values
|
||||||
@@ -88,7 +88,7 @@ kvDup(const KeyValue *source)
|
|||||||
|
|
||||||
this->keyList = varLstDup(source->keyList);
|
this->keyList = varLstDup(source->keyList);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, this);
|
FUNCTION_TEST_RETURN(KEY_VALUE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -100,11 +100,11 @@ kvGetIdx(const KeyValue *this, const Variant *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
// Search for the key
|
// Search for the key
|
||||||
unsigned int result = KEY_NOT_FOUND;
|
unsigned int result = KEY_NOT_FOUND;
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ kvGetIdx(const KeyValue *this, const Variant *key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, result);
|
FUNCTION_TEST_RETURN(UINT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -131,11 +131,11 @@ kvKeyList(const KeyValue *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, this->keyList);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VARIANT_LIST, this->keyList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -150,11 +150,11 @@ kvPutInternal(KeyValue *this, const Variant *key, Variant *value)
|
|||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, value);
|
FUNCTION_TEST_PARAM(VARIANT, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
// Find the key
|
// Find the key
|
||||||
unsigned int listIdx = kvGetIdx(this, key);
|
unsigned int listIdx = kvGetIdx(this, key);
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ kvPutInternal(KeyValue *this, const Variant *key, Variant *value)
|
|||||||
pair->value = value;
|
pair->value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -196,18 +196,18 @@ kvPut(KeyValue *this, const Variant *key, const Variant *value)
|
|||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, value);
|
FUNCTION_TEST_PARAM(VARIANT, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
kvPutInternal(this, key, varDup(value));
|
kvPutInternal(this, key, varDup(value));
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, this);
|
FUNCTION_TEST_RETURN(KEY_VALUE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -220,11 +220,11 @@ kvAdd(KeyValue *this, const Variant *key, const Variant *value)
|
|||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, value);
|
FUNCTION_TEST_PARAM(VARIANT, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
// Find the key
|
// Find the key
|
||||||
@@ -255,7 +255,7 @@ kvAdd(KeyValue *this, const Variant *key, const Variant *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, this);
|
FUNCTION_TEST_RETURN(KEY_VALUE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -270,11 +270,11 @@ kvPutKv(KeyValue *this, const Variant *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
KeyValue *result = NULL;
|
KeyValue *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
@@ -286,7 +286,7 @@ kvPutKv(KeyValue *this, const Variant *key)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, result);
|
FUNCTION_TEST_RETURN(KEY_VALUE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -298,11 +298,11 @@ kvGet(const KeyValue *this, const Variant *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
Variant *result = NULL;
|
Variant *result = NULL;
|
||||||
|
|
||||||
// Find the key
|
// Find the key
|
||||||
@@ -311,7 +311,7 @@ kvGet(const KeyValue *this, const Variant *key)
|
|||||||
if (listIdx != KEY_NOT_FOUND)
|
if (listIdx != KEY_NOT_FOUND)
|
||||||
result = ((KeyValuePair *)lstGet(this->list, listIdx))->value;
|
result = ((KeyValuePair *)lstGet(this->list, listIdx))->value;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, result);
|
FUNCTION_TEST_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -323,11 +323,11 @@ kvGetList(const KeyValue *this, const Variant *key)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, key);
|
FUNCTION_TEST_PARAM(VARIANT, key);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
VariantList *result = NULL;
|
VariantList *result = NULL;
|
||||||
|
|
||||||
// Get the value
|
// Get the value
|
||||||
@@ -339,7 +339,7 @@ kvGetList(const KeyValue *this, const Variant *key)
|
|||||||
else
|
else
|
||||||
result = varLstAdd(varLstNew(), varDup(value));
|
result = varLstAdd(varLstNew(), varDup(value));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, result);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -351,14 +351,14 @@ kvMove(KeyValue *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
FUNCTION_TEST_PARAM(KEY_VALUE, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, this);
|
FUNCTION_TEST_RETURN(KEY_VALUE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -374,5 +374,5 @@ kvFree(KeyValue *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ void kvFree(KeyValue *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_KEY_VALUE_TYPE \
|
#define FUNCTION_LOG_KEY_VALUE_TYPE \
|
||||||
KeyValue *
|
KeyValue *
|
||||||
#define FUNCTION_DEBUG_KEY_VALUE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_KEY_VALUE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "KeyValue", buffer, bufferSize)
|
objToLog(value, "KeyValue", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ lstNew(size_t itemSize)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(LIST, this);
|
FUNCTION_TEST_RETURN(LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -52,14 +52,14 @@ lstAdd(List *this, const void *item)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item);
|
FUNCTION_TEST_PARAM(VOIDP, item);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(item != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(item != NULL);
|
||||||
|
|
||||||
lstInsert(this, lstSize(this), item);
|
lstInsert(this, lstSize(this), item);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(LIST, this);
|
FUNCTION_TEST_RETURN(LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -71,16 +71,16 @@ lstGet(const List *this, unsigned int listIdx)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Ensure list index is in range
|
// Ensure list index is in range
|
||||||
if (listIdx >= this->listSize)
|
if (listIdx >= this->listSize)
|
||||||
THROW_FMT(AssertError, "cannot get index %u from list with %u value(s)", listIdx, this->listSize);
|
THROW_FMT(AssertError, "cannot get index %u from list with %u value(s)", listIdx, this->listSize);
|
||||||
|
|
||||||
// Return pointer to list item
|
// Return pointer to list item
|
||||||
FUNCTION_TEST_RESULT(VOIDP, this->list + (listIdx * this->itemSize));
|
FUNCTION_TEST_RETURN(VOIDP, this->list + (listIdx * this->itemSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -92,12 +92,12 @@ lstInsert(List *this, unsigned int listIdx, const void *item)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item);
|
FUNCTION_TEST_PARAM(VOIDP, item);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(listIdx <= lstSize(this));
|
|
||||||
FUNCTION_TEST_ASSERT(item != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(listIdx <= lstSize(this));
|
||||||
|
ASSERT(item != NULL);
|
||||||
|
|
||||||
// If list size = max then allocate more space
|
// If list size = max then allocate more space
|
||||||
if (this->listSize == this->listSizeMax)
|
if (this->listSize == this->listSizeMax)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ lstInsert(List *this, unsigned int listIdx, const void *item)
|
|||||||
memcpy(this->list + (listIdx * this->itemSize), item, this->itemSize);
|
memcpy(this->list + (listIdx * this->itemSize), item, this->itemSize);
|
||||||
this->listSize++;
|
this->listSize++;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(LIST, this);
|
FUNCTION_TEST_RETURN(LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -142,11 +142,11 @@ lstMemContext(const List *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(MEM_CONTEXT, this->memContext);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(MEM_CONTEXT, this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -158,14 +158,14 @@ lstMove(List *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextMove(this->memContext, parentNew);
|
memContextMove(this->memContext, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(LIST, this);
|
FUNCTION_TEST_RETURN(LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -176,11 +176,11 @@ lstSize(const List *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, this->listSize);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, this->listSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -192,14 +192,14 @@ lstSort(List *this, int (*comparator)(const void *, const void*))
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(LIST, this);
|
FUNCTION_TEST_PARAM(LIST, this);
|
||||||
FUNCTION_TEST_PARAM(FUNCTIONP, comparator);
|
FUNCTION_TEST_PARAM(FUNCTIONP, comparator);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(comparator != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(comparator != NULL);
|
||||||
|
|
||||||
qsort(this->list, this->listSize, this->itemSize, comparator);
|
qsort(this->list, this->listSize, this->itemSize, comparator);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(LIST, this);
|
FUNCTION_TEST_RETURN(LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -224,5 +224,5 @@ lstFree(List *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *lstToLog(const List *this);
|
String *lstToLog(const List *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_LIST_TYPE \
|
#define FUNCTION_LOG_LIST_TYPE \
|
||||||
List *
|
List *
|
||||||
#define FUNCTION_DEBUG_LIST_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_LIST_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, lstToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, lstToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ String Handler
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
#include "common/type/string.h"
|
#include "common/type/string.h"
|
||||||
@@ -43,10 +42,10 @@ strNew(const char *string)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, string);
|
FUNCTION_TEST_PARAM(STRINGZ, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
// Create object
|
// Create object
|
||||||
String *this = memNew(sizeof(String));
|
String *this = memNew(sizeof(String));
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -56,7 +55,7 @@ strNew(const char *string)
|
|||||||
this->common.buffer = memNewRaw(this->common.size + 1);
|
this->common.buffer = memNewRaw(this->common.size + 1);
|
||||||
strcpy(this->common.buffer, string);
|
strcpy(this->common.buffer, string);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -70,10 +69,10 @@ strNewBuf(const Buffer *buffer)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, buffer);
|
FUNCTION_TEST_PARAM(BUFFER, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
|
||||||
// Create object
|
// Create object
|
||||||
String *this = memNew(sizeof(String));
|
String *this = memNew(sizeof(String));
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -84,7 +83,7 @@ strNewBuf(const Buffer *buffer)
|
|||||||
memcpy(this->common.buffer, (char *)bufPtr(buffer), this->common.size);
|
memcpy(this->common.buffer, (char *)bufPtr(buffer), this->common.size);
|
||||||
this->common.buffer[this->common.size] = 0;
|
this->common.buffer[this->common.size] = 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -95,10 +94,10 @@ strNewFmt(const char *format, ...)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, format);
|
FUNCTION_TEST_PARAM(STRINGZ, format);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(format != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(format != NULL);
|
||||||
|
|
||||||
// Create object
|
// Create object
|
||||||
String *this = memNew(sizeof(String));
|
String *this = memNew(sizeof(String));
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -115,7 +114,7 @@ strNewFmt(const char *format, ...)
|
|||||||
vsnprintf(this->common.buffer, this->common.size + 1, format, argumentList);
|
vsnprintf(this->common.buffer, this->common.size + 1, format, argumentList);
|
||||||
va_end(argumentList);
|
va_end(argumentList);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -129,10 +128,10 @@ strNewN(const char *string, size_t size)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, string);
|
FUNCTION_TEST_PARAM(CHARP, string);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
|
||||||
// Create object
|
// Create object
|
||||||
String *this = memNew(sizeof(String));
|
String *this = memNew(sizeof(String));
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -144,7 +143,7 @@ strNewN(const char *string, size_t size)
|
|||||||
this->common.buffer[this->common.size] = 0;
|
this->common.buffer[this->common.size] = 0;
|
||||||
|
|
||||||
// Return buffer
|
// Return buffer
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -155,16 +154,16 @@ strBase(const String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
const char *end = this->common.buffer + this->common.size;
|
const char *end = this->common.buffer + this->common.size;
|
||||||
|
|
||||||
while (end > this->common.buffer && *(end - 1) != '/')
|
while (end > this->common.buffer && *(end - 1) != '/')
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strNew(end));
|
FUNCTION_TEST_RETURN(STRING, strNew(end));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -176,12 +175,12 @@ strBeginsWith(const String *this, const String *beginsWith)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, beginsWith);
|
FUNCTION_TEST_PARAM(STRING, beginsWith);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(beginsWith != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, strBeginsWithZ(this, strPtr(beginsWith)));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(beginsWith != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, strBeginsWithZ(this, strPtr(beginsWith)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -190,18 +189,18 @@ strBeginsWithZ(const String *this, const char *beginsWith)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, beginsWith);
|
FUNCTION_TEST_PARAM(STRINGZ, beginsWith);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(beginsWith != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(beginsWith != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
unsigned int beginsWithSize = (unsigned int)strlen(beginsWith);
|
unsigned int beginsWithSize = (unsigned int)strlen(beginsWith);
|
||||||
|
|
||||||
if (this->common.size >= beginsWithSize)
|
if (this->common.size >= beginsWithSize)
|
||||||
result = strncmp(strPtr(this), beginsWith, beginsWithSize) == 0;
|
result = strncmp(strPtr(this), beginsWith, beginsWithSize) == 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -213,11 +212,11 @@ strCat(String *this, const char *cat)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, cat);
|
FUNCTION_TEST_PARAM(STRINGZ, cat);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(cat != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(cat != NULL);
|
||||||
|
|
||||||
// Determine length of string to append
|
// Determine length of string to append
|
||||||
size_t sizeGrow = strlen(cat);
|
size_t sizeGrow = strlen(cat);
|
||||||
|
|
||||||
@@ -231,7 +230,7 @@ strCat(String *this, const char *cat)
|
|||||||
strcpy(this->common.buffer + this->common.size, cat);
|
strcpy(this->common.buffer + this->common.size, cat);
|
||||||
this->common.size += sizeGrow;
|
this->common.size += sizeGrow;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -243,11 +242,11 @@ strCatChr(String *this, char cat)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(CHAR, cat);
|
FUNCTION_TEST_PARAM(CHAR, cat);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(cat != 0);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(cat != 0);
|
||||||
|
|
||||||
// Allocate and append character
|
// Allocate and append character
|
||||||
MEM_CONTEXT_BEGIN(this->memContext)
|
MEM_CONTEXT_BEGIN(this->memContext)
|
||||||
{
|
{
|
||||||
@@ -258,7 +257,7 @@ strCatChr(String *this, char cat)
|
|||||||
this->common.buffer[this->common.size++] = cat;
|
this->common.buffer[this->common.size++] = cat;
|
||||||
this->common.buffer[this->common.size] = 0;
|
this->common.buffer[this->common.size] = 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -270,11 +269,11 @@ strCatFmt(String *this, const char *format, ...)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, format);
|
FUNCTION_TEST_PARAM(STRINGZ, format);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(format != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(format != NULL);
|
||||||
|
|
||||||
// Determine how long the allocated string needs to be
|
// Determine how long the allocated string needs to be
|
||||||
va_list argumentList;
|
va_list argumentList;
|
||||||
va_start(argumentList, format);
|
va_start(argumentList, format);
|
||||||
@@ -294,7 +293,7 @@ strCatFmt(String *this, const char *format, ...)
|
|||||||
|
|
||||||
this->common.size += sizeGrow;
|
this->common.size += sizeGrow;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -306,12 +305,12 @@ strCmp(const String *this, const String *compare)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, compare);
|
FUNCTION_TEST_PARAM(STRING, compare);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(compare != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, strcmp(strPtr(this), strPtr(compare)));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(compare != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, strcmp(strPtr(this), strPtr(compare)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -320,12 +319,12 @@ strCmpZ(const String *this, const char *compare)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, compare);
|
FUNCTION_TEST_PARAM(STRINGZ, compare);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(compare != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, strcmp(strPtr(this), compare));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(compare != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, strcmp(strPtr(this), compare));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -343,7 +342,7 @@ strDup(const String *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
result = strNew(strPtr(this));
|
result = strNew(strPtr(this));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -356,7 +355,7 @@ strEmpty(const String *this)
|
|||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, strSize(this) == 0);
|
FUNCTION_TEST_RETURN(BOOL, strSize(this) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -368,12 +367,12 @@ strEndsWith(const String *this, const String *endsWith)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, endsWith);
|
FUNCTION_TEST_PARAM(STRING, endsWith);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(endsWith != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, strEndsWithZ(this, strPtr(endsWith)));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(endsWith != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, strEndsWithZ(this, strPtr(endsWith)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -382,18 +381,18 @@ strEndsWithZ(const String *this, const char *endsWith)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, endsWith);
|
FUNCTION_TEST_PARAM(STRINGZ, endsWith);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(endsWith != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(endsWith != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
unsigned int endsWithSize = (unsigned int)strlen(endsWith);
|
unsigned int endsWithSize = (unsigned int)strlen(endsWith);
|
||||||
|
|
||||||
if (this->common.size >= endsWithSize)
|
if (this->common.size >= endsWithSize)
|
||||||
result = strcmp(strPtr(this) + (this->common.size - endsWithSize), endsWith) == 0;
|
result = strcmp(strPtr(this) + (this->common.size - endsWithSize), endsWith) == 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -408,17 +407,17 @@ strEq(const String *this, const String *compare)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, compare);
|
FUNCTION_TEST_PARAM(STRING, compare);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(compare != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(compare != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (this->common.size == compare->common.size)
|
if (this->common.size == compare->common.size)
|
||||||
result = strcmp(strPtr(this), strPtr(compare)) == 0;
|
result = strcmp(strPtr(this), strPtr(compare)) == 0;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -427,12 +426,12 @@ strEqZ(const String *this, const char *compare)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, compare);
|
FUNCTION_TEST_PARAM(STRINGZ, compare);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(compare != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, strcmp(strPtr(this), compare) == 0);
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(compare != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, strcmp(strPtr(this), compare) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -443,14 +442,14 @@ strFirstUpper(String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
this->common.buffer[0] = (char)toupper(this->common.buffer[0]);
|
this->common.buffer[0] = (char)toupper(this->common.buffer[0]);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -461,14 +460,14 @@ strFirstLower(String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
this->common.buffer[0] = (char)tolower(this->common.buffer[0]);
|
this->common.buffer[0] = (char)tolower(this->common.buffer[0]);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -479,15 +478,15 @@ strUpper(String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
for (unsigned int idx = 0; idx <= this->common.size; idx++)
|
for (unsigned int idx = 0; idx <= this->common.size; idx++)
|
||||||
this->common.buffer[idx] = (char)toupper(this->common.buffer[idx]);
|
this->common.buffer[idx] = (char)toupper(this->common.buffer[idx]);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -498,15 +497,15 @@ strLower(String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
for (unsigned int idx = 0; idx <= this->common.size; idx++)
|
for (unsigned int idx = 0; idx <= this->common.size; idx++)
|
||||||
this->common.buffer[idx] = (char)tolower(this->common.buffer[idx]);
|
this->common.buffer[idx] = (char)tolower(this->common.buffer[idx]);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -517,16 +516,16 @@ strPath(const String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
const char *end = this->common.buffer + this->common.size;
|
const char *end = this->common.buffer + this->common.size;
|
||||||
|
|
||||||
while (end > this->common.buffer && *(end - 1) != '/')
|
while (end > this->common.buffer && *(end - 1) != '/')
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(
|
FUNCTION_TEST_RETURN(
|
||||||
STRING,
|
STRING,
|
||||||
strNewN(
|
strNewN(
|
||||||
this->common.buffer,
|
this->common.buffer,
|
||||||
@@ -548,7 +547,7 @@ strPtr(const String *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
result = this->common.buffer;
|
result = this->common.buffer;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CHARP, result);
|
FUNCTION_TEST_RETURN(CHARP, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -560,12 +559,12 @@ strQuote(const String *this, const String *quote)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, quote);
|
FUNCTION_TEST_PARAM(STRING, quote);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(quote != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strQuoteZ(this, strPtr(quote)));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(quote != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, strQuoteZ(this, strPtr(quote)));
|
||||||
}
|
}
|
||||||
|
|
||||||
String *
|
String *
|
||||||
@@ -574,12 +573,12 @@ strQuoteZ(const String *this, const char *quote)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, quote);
|
FUNCTION_TEST_PARAM(STRINGZ, quote);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(quote != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strNewFmt("%s%s%s", quote, strPtr(this), quote));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(quote != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, strNewFmt("%s%s%s", quote, strPtr(this), quote));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -592,17 +591,17 @@ strReplaceChr(String *this, char find, char replace)
|
|||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(CHAR, find);
|
FUNCTION_TEST_PARAM(CHAR, find);
|
||||||
FUNCTION_TEST_PARAM(CHAR, replace);
|
FUNCTION_TEST_PARAM(CHAR, replace);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
for (unsigned int stringIdx = 0; stringIdx < this->common.size; stringIdx++)
|
for (unsigned int stringIdx = 0; stringIdx < this->common.size; stringIdx++)
|
||||||
{
|
{
|
||||||
if (this->common.buffer[stringIdx] == find)
|
if (this->common.buffer[stringIdx] == find)
|
||||||
this->common.buffer[stringIdx] = replace;
|
this->common.buffer[stringIdx] = replace;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -614,12 +613,12 @@ strSub(const String *this, size_t start)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, start);
|
FUNCTION_TEST_PARAM(SIZE, start);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(start < this->common.size);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strSubN(this, start, this->common.size - start));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(start < this->common.size);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, strSubN(this, start, this->common.size - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -632,13 +631,13 @@ strSubN(const String *this, size_t start, size_t size)
|
|||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(SIZE, start);
|
FUNCTION_TEST_PARAM(SIZE, start);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(start < this->common.size);
|
|
||||||
FUNCTION_TEST_ASSERT(start + size <= this->common.size);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strNewN(this->common.buffer + start, size));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(start < this->common.size);
|
||||||
|
ASSERT(start + size <= this->common.size);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, strNewN(this->common.buffer + start, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -649,11 +648,11 @@ strSize(const String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(SIZE, this->common.size);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(SIZE, this->common.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -664,10 +663,10 @@ strTrim(String *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
// Nothing to trim if size is zero
|
// Nothing to trim if size is zero
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
{
|
{
|
||||||
@@ -704,7 +703,7 @@ strTrim(String *this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -716,10 +715,10 @@ strChr(const String *this, char chr)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
FUNCTION_TEST_PARAM(CHAR, chr);
|
FUNCTION_TEST_PARAM(CHAR, chr);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
@@ -730,7 +729,7 @@ strChr(const String *this, char chr)
|
|||||||
result = (int)(ptr - this->common.buffer);
|
result = (int)(ptr - this->common.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, result);
|
FUNCTION_TEST_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -741,11 +740,11 @@ strTrunc(String *this, int idx)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, this);
|
FUNCTION_TEST_PARAM(STRING, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(idx >= 0 && (size_t)idx <= this->common.size);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(idx >= 0 && (size_t)idx <= this->common.size);
|
||||||
|
|
||||||
if (this->common.size > 0)
|
if (this->common.size > 0)
|
||||||
{
|
{
|
||||||
// Reset the size to end at the index
|
// Reset the size to end at the index
|
||||||
@@ -760,7 +759,7 @@ strTrunc(String *this, int idx)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this);
|
FUNCTION_TEST_RETURN(STRING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -832,7 +831,7 @@ strSizeFormat(const uint64_t size)
|
|||||||
result = strNewFmt("%" PRIu64 "GB", size / (1024 * 1024 * 1024));
|
result = strNewFmt("%" PRIu64 "GB", size / (1024 * 1024 * 1024));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -855,5 +854,5 @@ strFree(String *this)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ typedef String *(*StrObjToLogFormat)(const void *object);
|
|||||||
|
|
||||||
size_t strObjToLog(const void *object, StrObjToLogFormat formatFunc, char *buffer, size_t bufferSize);
|
size_t strObjToLog(const void *object, StrObjToLogFormat formatFunc, char *buffer, size_t bufferSize);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_STRING_OBJECT_FORMAT(object, formatFunc, buffer, bufferSize) \
|
#define FUNCTION_LOG_STRING_OBJECT_FORMAT(object, formatFunc, buffer, bufferSize) \
|
||||||
strObjToLog(object, (StrObjToLogFormat)formatFunc, buffer, bufferSize)
|
strObjToLog(object, (StrObjToLogFormat)formatFunc, buffer, bufferSize)
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -133,19 +133,19 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *strToLog(const String *this);
|
String *strToLog(const String *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CONST_STRING_TYPE \
|
#define FUNCTION_LOG_CONST_STRING_TYPE \
|
||||||
const String *
|
const String *
|
||||||
#define FUNCTION_DEBUG_CONST_STRING_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CONST_STRING_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_STRING_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_STRING_TYPE \
|
#define FUNCTION_LOG_STRING_TYPE \
|
||||||
String *
|
String *
|
||||||
#define FUNCTION_DEBUG_STRING_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_STRING_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, strToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, strToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_STRINGP_TYPE \
|
#define FUNCTION_LOG_STRINGP_TYPE \
|
||||||
const String **
|
const String **
|
||||||
#define FUNCTION_DEBUG_STRINGP_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_STRINGP_FORMAT(value, buffer, bufferSize) \
|
||||||
ptrToLog(value, "String **", buffer, bufferSize)
|
ptrToLog(value, "String **", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ String List Handler
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
#include "common/type/list.h"
|
#include "common/type/list.h"
|
||||||
@@ -19,7 +18,7 @@ StringList *
|
|||||||
strLstNew(void)
|
strLstNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, (StringList *)lstNew(sizeof(String *)));
|
FUNCTION_TEST_RETURN(STRING_LIST, (StringList *)lstNew(sizeof(String *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -31,11 +30,11 @@ strLstAddInternal(StringList *this, String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, (StringList *)lstAdd((List *)this, &string));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, (StringList *)lstAdd((List *)this, &string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -48,11 +47,11 @@ strLstInsertInternal(StringList *this, unsigned int listIdx, String *string)
|
|||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, (StringList *)lstInsert((List *)this, listIdx, &string));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, (StringList *)lstInsert((List *)this, listIdx, &string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -64,12 +63,12 @@ strLstNewSplit(const String *string, const String *delimiter)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
FUNCTION_TEST_PARAM(STRING, delimiter);
|
FUNCTION_TEST_PARAM(STRING, delimiter);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(delimiter != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, strLstNewSplitZ(string, strPtr(delimiter)));
|
ASSERT(string != NULL);
|
||||||
|
ASSERT(delimiter != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, strLstNewSplitZ(string, strPtr(delimiter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
StringList *
|
StringList *
|
||||||
@@ -78,11 +77,11 @@ strLstNewSplitZ(const String *string, const char *delimiter)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, delimiter);
|
FUNCTION_TEST_PARAM(STRINGZ, delimiter);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(delimiter != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
ASSERT(delimiter != NULL);
|
||||||
|
|
||||||
// Create the list
|
// Create the list
|
||||||
StringList *this = strLstNew();
|
StringList *this = strLstNew();
|
||||||
|
|
||||||
@@ -113,7 +112,7 @@ strLstNewSplitZ(const String *string, const char *delimiter)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -129,12 +128,12 @@ strLstNewSplitSize(const String *string, const String *delimiter, size_t size)
|
|||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
FUNCTION_TEST_PARAM(STRING, delimiter);
|
FUNCTION_TEST_PARAM(STRING, delimiter);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(delimiter != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, strLstNewSplitSizeZ(string, strPtr(delimiter), size));
|
ASSERT(string != NULL);
|
||||||
|
ASSERT(delimiter != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING_LIST, strLstNewSplitSizeZ(string, strPtr(delimiter), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
StringList *
|
StringList *
|
||||||
@@ -144,11 +143,11 @@ strLstNewSplitSizeZ(const String *string, const char *delimiter, size_t size)
|
|||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, delimiter);
|
FUNCTION_TEST_PARAM(STRINGZ, delimiter);
|
||||||
FUNCTION_TEST_PARAM(SIZE, size);
|
FUNCTION_TEST_PARAM(SIZE, size);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(delimiter != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(string != NULL);
|
||||||
|
ASSERT(delimiter != NULL);
|
||||||
|
|
||||||
// Create the list
|
// Create the list
|
||||||
StringList *this = strLstNew();
|
StringList *this = strLstNew();
|
||||||
|
|
||||||
@@ -197,7 +196,7 @@ strLstNewSplitSizeZ(const String *string, const char *delimiter, size_t size)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -208,10 +207,10 @@ strLstNewVarLst(const VariantList *sourceList)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, sourceList);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, sourceList);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(sourceList != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(sourceList != NULL);
|
||||||
|
|
||||||
// Create the list
|
// Create the list
|
||||||
StringList *this = strLstNew();
|
StringList *this = strLstNew();
|
||||||
|
|
||||||
@@ -223,7 +222,7 @@ strLstNewVarLst(const VariantList *sourceList)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -234,10 +233,10 @@ strLstDup(const StringList *sourceList)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, sourceList);
|
FUNCTION_TEST_PARAM(STRING_LIST, sourceList);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(sourceList != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(sourceList != NULL);
|
||||||
|
|
||||||
// Create the list
|
// Create the list
|
||||||
StringList *this = strLstNew();
|
StringList *this = strLstNew();
|
||||||
|
|
||||||
@@ -249,7 +248,7 @@ strLstDup(const StringList *sourceList)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -261,10 +260,10 @@ strLstExists(const StringList *this, const String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
||||||
@@ -276,7 +275,7 @@ strLstExists(const StringList *this, const String *string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -285,10 +284,10 @@ strLstExistsZ(const StringList *this, const char *cstring)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, cstring);
|
FUNCTION_TEST_PARAM(STRINGZ, cstring);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
||||||
@@ -300,7 +299,7 @@ strLstExistsZ(const StringList *this, const char *cstring)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -312,10 +311,10 @@ strLstAdd(StringList *this, const String *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
||||||
@@ -324,7 +323,7 @@ strLstAdd(StringList *this, const String *string)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -336,10 +335,10 @@ strLstAddZ(StringList *this, const char *string)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, string);
|
FUNCTION_TEST_PARAM(STRINGZ, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
||||||
@@ -348,7 +347,7 @@ strLstAddZ(StringList *this, const char *string)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -360,11 +359,11 @@ strLstGet(const StringList *this, unsigned int listIdx)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, *(String **)lstGet((List *)this, listIdx));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, *(String **)lstGet((List *)this, listIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -378,10 +377,10 @@ strLstInsert(StringList *this, unsigned int listIdx, const String *string)
|
|||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
FUNCTION_TEST_PARAM(STRING, string);
|
FUNCTION_TEST_PARAM(STRING, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
||||||
@@ -390,7 +389,7 @@ strLstInsert(StringList *this, unsigned int listIdx, const String *string)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -403,10 +402,10 @@ strLstInsertZ(StringList *this, unsigned int listIdx, const char *string)
|
|||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, string);
|
FUNCTION_TEST_PARAM(STRINGZ, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
||||||
@@ -415,7 +414,7 @@ strLstInsertZ(StringList *this, unsigned int listIdx, const char *string)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, result);
|
FUNCTION_TEST_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -427,12 +426,12 @@ strLstJoin(const StringList *this, const char *separator)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, separator);
|
FUNCTION_TEST_PARAM(STRINGZ, separator);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(separator != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, strLstJoinQuote(this, separator, ""));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(separator != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, strLstJoinQuote(this, separator, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -445,12 +444,12 @@ strLstJoinQuote(const StringList *this, const char *separator, const char *quote
|
|||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, separator);
|
FUNCTION_TEST_PARAM(STRINGZ, separator);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, quote);
|
FUNCTION_TEST_PARAM(STRINGZ, quote);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(separator != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(quote != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(separator != NULL);
|
||||||
|
ASSERT(quote != NULL);
|
||||||
|
|
||||||
String *join = strNew("");
|
String *join = strNew("");
|
||||||
|
|
||||||
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
||||||
@@ -464,7 +463,7 @@ strLstJoinQuote(const StringList *this, const char *separator, const char *quote
|
|||||||
strCatFmt(join, "%s%s%s", quote, strPtr(strLstGet(this, listIdx)), quote);
|
strCatFmt(join, "%s%s%s", quote, strPtr(strLstGet(this, listIdx)), quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, join);
|
FUNCTION_TEST_RETURN(STRING, join);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -476,13 +475,13 @@ strLstMove(StringList *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
lstMove((List *)this, parentNew);
|
lstMove((List *)this, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -494,10 +493,10 @@ strLstPtr(const StringList *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
const char **list = memNew((strLstSize(this) + 1) * sizeof(char *));
|
const char **list = memNew((strLstSize(this) + 1) * sizeof(char *));
|
||||||
|
|
||||||
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
|
||||||
@@ -510,7 +509,7 @@ strLstPtr(const StringList *this)
|
|||||||
|
|
||||||
list[strLstSize(this)] = NULL;
|
list[strLstSize(this)] = NULL;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_CHARPP, list);
|
FUNCTION_TEST_RETURN(CONST_CHARPP, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -521,11 +520,11 @@ strLstSize(const StringList *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, lstSize((List *)this));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, lstSize((List *)this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -537,12 +536,12 @@ sortAscComparator(const void *item1, const void *item2)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item1);
|
FUNCTION_TEST_PARAM(VOIDP, item1);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item2);
|
FUNCTION_TEST_PARAM(VOIDP, item2);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(item1 != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(item2 != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, strCmp(*(String **)item1, *(String **)item2));
|
ASSERT(item1 != NULL);
|
||||||
|
ASSERT(item2 != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, strCmp(*(String **)item1, *(String **)item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -551,12 +550,12 @@ sortDescComparator(const void *item1, const void *item2)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item1);
|
FUNCTION_TEST_PARAM(VOIDP, item1);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, item2);
|
FUNCTION_TEST_PARAM(VOIDP, item2);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(item1 != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(item2 != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, strCmp(*(String **)item2, *(String **)item1));
|
ASSERT(item1 != NULL);
|
||||||
|
ASSERT(item2 != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, strCmp(*(String **)item2, *(String **)item1));
|
||||||
}
|
}
|
||||||
|
|
||||||
StringList *
|
StringList *
|
||||||
@@ -565,10 +564,10 @@ strLstSort(StringList *this, SortOrder sortOrder)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
FUNCTION_TEST_PARAM(STRING_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(ENUM, sortOrder);
|
FUNCTION_TEST_PARAM(ENUM, sortOrder);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
switch (sortOrder)
|
switch (sortOrder)
|
||||||
{
|
{
|
||||||
case sortOrderAsc:
|
case sortOrderAsc:
|
||||||
@@ -584,7 +583,7 @@ strLstSort(StringList *this, SortOrder sortOrder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, this);
|
FUNCTION_TEST_RETURN(STRING_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -608,5 +607,5 @@ strLstFree(StringList *this)
|
|||||||
|
|
||||||
lstFree((List *)this);
|
lstFree((List *)this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *strLstToLog(const StringList *this);
|
String *strLstToLog(const StringList *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_STRING_LIST_TYPE \
|
#define FUNCTION_LOG_STRING_LIST_TYPE \
|
||||||
StringList *
|
StringList *
|
||||||
#define FUNCTION_DEBUG_STRING_LIST_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_STRING_LIST_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, strLstToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, strLstToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Variant Data Type
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
#include "common/type/convert.h"
|
#include "common/type/convert.h"
|
||||||
@@ -49,11 +48,11 @@ varNewInternal(VariantType type, void *data, size_t dataSize)
|
|||||||
FUNCTION_TEST_PARAM(ENUM, type);
|
FUNCTION_TEST_PARAM(ENUM, type);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, data);
|
FUNCTION_TEST_PARAM(VOIDP, data);
|
||||||
FUNCTION_TEST_PARAM(SIZE, dataSize);
|
FUNCTION_TEST_PARAM(SIZE, dataSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(data != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(dataSize > 0);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(data != NULL);
|
||||||
|
ASSERT(dataSize > 0);
|
||||||
|
|
||||||
// Allocate memory for the variant and set the type
|
// Allocate memory for the variant and set the type
|
||||||
Variant *this = memNew(sizeof(Variant) + dataSize);
|
Variant *this = memNew(sizeof(Variant) + dataSize);
|
||||||
this->memContext = memContextCurrent();
|
this->memContext = memContextCurrent();
|
||||||
@@ -62,7 +61,7 @@ varNewInternal(VariantType type, void *data, size_t dataSize)
|
|||||||
// Copy data
|
// Copy data
|
||||||
memcpy((unsigned char *)this + sizeof(Variant), data, dataSize);
|
memcpy((unsigned char *)this + sizeof(Variant), data, dataSize);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, this);
|
FUNCTION_TEST_RETURN(VARIANT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -73,11 +72,11 @@ varData(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VOIDP, (void *)((unsigned char *)this + sizeof(Variant)));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VOIDP, (void *)((unsigned char *)this + sizeof(Variant)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -147,7 +146,7 @@ varDup(const Variant *this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, result);
|
FUNCTION_TEST_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -217,7 +216,7 @@ varEq(const Variant *this1, const Variant *this2)
|
|||||||
else
|
else
|
||||||
result = this1 == NULL && this2 == NULL;
|
result = this1 == NULL && this2 == NULL;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -228,11 +227,11 @@ varType(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, this->type);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, this->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -245,7 +244,7 @@ varNewBool(bool data)
|
|||||||
FUNCTION_TEST_PARAM(BOOL, data);
|
FUNCTION_TEST_PARAM(BOOL, data);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeBool, (void *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeBool, (void *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -256,13 +255,13 @@ varBool(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
ASSERT(this->type == varTypeBool);
|
ASSERT(this->type == varTypeBool);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, *((bool *)varData(this)));
|
FUNCTION_TEST_RETURN(BOOL, *((bool *)varData(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -273,10 +272,10 @@ varBoolForce(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
@@ -328,7 +327,7 @@ varBoolForce(const Variant *this)
|
|||||||
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeBool]);
|
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeBool]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -341,7 +340,7 @@ varNewDbl(double data)
|
|||||||
FUNCTION_TEST_PARAM(DOUBLE, data);
|
FUNCTION_TEST_PARAM(DOUBLE, data);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeDouble, (unsigned char *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeDouble, (unsigned char *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -352,13 +351,13 @@ varDbl(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
ASSERT(this->type == varTypeDouble);
|
ASSERT(this->type == varTypeDouble);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(DOUBLE, *((double *)varData(this)));
|
FUNCTION_TEST_RETURN(DOUBLE, *((double *)varData(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -369,10 +368,10 @@ varDblForce(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
double result = 0;
|
double result = 0;
|
||||||
|
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
@@ -417,7 +416,7 @@ varDblForce(const Variant *this)
|
|||||||
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeDouble]);
|
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeDouble]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(DOUBLE, result);
|
FUNCTION_TEST_RETURN(DOUBLE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -430,7 +429,7 @@ varNewInt(int data)
|
|||||||
FUNCTION_TEST_PARAM(INT, data);
|
FUNCTION_TEST_PARAM(INT, data);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeInt, (void *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeInt, (void *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -441,13 +440,13 @@ varInt(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
ASSERT(this->type == varTypeInt);
|
ASSERT(this->type == varTypeInt);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, *((int *)varData(this)));
|
FUNCTION_TEST_RETURN(INT, *((int *)varData(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -458,10 +457,10 @@ varIntForce(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
@@ -516,7 +515,7 @@ varIntForce(const Variant *this)
|
|||||||
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt]);
|
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, result);
|
FUNCTION_TEST_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -529,7 +528,7 @@ varNewInt64(int64_t data)
|
|||||||
FUNCTION_TEST_PARAM(INT64, data);
|
FUNCTION_TEST_PARAM(INT64, data);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeInt64, (void *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeInt64, (void *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -540,13 +539,13 @@ varInt64(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
ASSERT(this->type == varTypeInt64);
|
ASSERT(this->type == varTypeInt64);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT64, *((int64_t *)varData(this)));
|
FUNCTION_TEST_RETURN(INT64, *((int64_t *)varData(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -557,10 +556,10 @@ varInt64Force(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
int64_t result = 0;
|
int64_t result = 0;
|
||||||
|
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
@@ -610,7 +609,7 @@ varInt64Force(const Variant *this)
|
|||||||
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt64]);
|
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt64]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT64, result);
|
FUNCTION_TEST_RETURN(INT64, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -623,7 +622,7 @@ varNewUInt64(uint64_t data)
|
|||||||
FUNCTION_TEST_PARAM(UINT64, data);
|
FUNCTION_TEST_PARAM(UINT64, data);
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeUInt64, (void *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeUInt64, (void *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -634,13 +633,13 @@ varUInt64(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
ASSERT(this->type == varTypeUInt64);
|
ASSERT(this->type == varTypeUInt64);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, *((uint64_t *)varData(this)));
|
FUNCTION_TEST_RETURN(UINT64, *((uint64_t *)varData(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -651,10 +650,10 @@ varUInt64Force(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
uint64_t result = 0;
|
uint64_t result = 0;
|
||||||
|
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
@@ -715,7 +714,7 @@ varUInt64Force(const Variant *this)
|
|||||||
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeUInt64]);
|
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeUInt64]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT64, result);
|
FUNCTION_TEST_RETURN(UINT64, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -729,7 +728,7 @@ varNewKv(void)
|
|||||||
// Create a new kv for the variant
|
// Create a new kv for the variant
|
||||||
KeyValue *data = kvNew();
|
KeyValue *data = kvNew();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeKeyValue, (void *)&data, sizeof(data)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeKeyValue, (void *)&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -750,7 +749,7 @@ varKv(const Variant *this)
|
|||||||
result = *((KeyValue **)varData(this));
|
result = *((KeyValue **)varData(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(KEY_VALUE, result);
|
FUNCTION_TEST_RETURN(KEY_VALUE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -766,7 +765,7 @@ varNewStr(const String *data)
|
|||||||
// Create a copy of the string for the variant
|
// Create a copy of the string for the variant
|
||||||
String *dataCopy = strDup(data);
|
String *dataCopy = strDup(data);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeString, (void *)&dataCopy, sizeof(dataCopy)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeString, (void *)&dataCopy, sizeof(dataCopy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -785,7 +784,7 @@ varNewStrZ(const char *data)
|
|||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
dataCopy = strNew(data);
|
dataCopy = strNew(data);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeString, (void *)&dataCopy, sizeof(dataCopy)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeString, (void *)&dataCopy, sizeof(dataCopy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -806,7 +805,7 @@ varStr(const Variant *this)
|
|||||||
result = *((String **)varData(this));
|
result = *((String **)varData(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -817,10 +816,10 @@ varStrForce(const Variant *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT, this);
|
FUNCTION_TEST_PARAM(VARIANT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
|
|
||||||
switch (varType(this))
|
switch (varType(this))
|
||||||
@@ -880,7 +879,7 @@ varStrForce(const Variant *this)
|
|||||||
THROW_FMT(FormatError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeString]);
|
THROW_FMT(FormatError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -891,14 +890,14 @@ varNewVarLst(const VariantList *data)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, data);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, data);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(data != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(data != NULL);
|
||||||
|
|
||||||
// Copy variant list for the variant
|
// Copy variant list for the variant
|
||||||
VariantList *dataCopy = varLstDup(data);
|
VariantList *dataCopy = varLstDup(data);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, varNewInternal(varTypeVariantList, (void *)&dataCopy, sizeof(dataCopy)));
|
FUNCTION_TEST_RETURN(VARIANT, varNewInternal(varTypeVariantList, (void *)&dataCopy, sizeof(dataCopy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -919,7 +918,7 @@ varVarLst(const Variant *this)
|
|||||||
result = *((VariantList **)varData(this));
|
result = *((VariantList **)varData(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, result);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -1012,5 +1011,5 @@ varFree(Variant *this)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *varToLog(const Variant *this);
|
String *varToLog(const Variant *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CONST_VARIANT_TYPE \
|
#define FUNCTION_LOG_CONST_VARIANT_TYPE \
|
||||||
const FUNCTION_DEBUG_VARIANT_TYPE
|
const FUNCTION_LOG_VARIANT_TYPE
|
||||||
#define FUNCTION_DEBUG_CONST_VARIANT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CONST_VARIANT_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_VARIANT_FORMAT(value, buffer, bufferSize)
|
FUNCTION_LOG_VARIANT_FORMAT(value, buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_VARIANT_TYPE \
|
#define FUNCTION_LOG_VARIANT_TYPE \
|
||||||
Variant *
|
Variant *
|
||||||
#define FUNCTION_DEBUG_VARIANT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_VARIANT_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, varToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, varToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ VariantList *
|
|||||||
varLstNew(void)
|
varLstNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, (VariantList *)lstNew(sizeof(Variant *)));
|
FUNCTION_TEST_RETURN(VARIANT_LIST, (VariantList *)lstNew(sizeof(Variant *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -40,7 +40,7 @@ varLstNewStrLst(const StringList *stringList)
|
|||||||
varLstAdd(result, varNewStr(strLstGet(stringList, listIdx)));
|
varLstAdd(result, varNewStr(strLstGet(stringList, listIdx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, result);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -63,7 +63,7 @@ varLstDup(const VariantList *source)
|
|||||||
varLstAdd(result, varDup(varLstGet(source, listIdx)));
|
varLstAdd(result, varDup(varLstGet(source, listIdx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, result);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -75,11 +75,11 @@ varLstAdd(VariantList *this, Variant *data)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, data);
|
FUNCTION_TEST_PARAM(VARIANT, data);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, (VariantList *)lstAdd((List *)this, &data));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VARIANT_LIST, (VariantList *)lstAdd((List *)this, &data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -91,11 +91,11 @@ varLstGet(const VariantList *this, unsigned int listIdx)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, *(Variant **)lstGet((List *)this, listIdx));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VARIANT, *(Variant **)lstGet((List *)this, listIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -106,11 +106,11 @@ varLstSize(const VariantList *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, lstSize((List *)this));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, lstSize((List *)this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -122,13 +122,13 @@ varLstMove(VariantList *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
FUNCTION_TEST_PARAM(VARIANT_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(parentNew != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(parentNew != NULL);
|
||||||
|
|
||||||
lstMove((List *)this, parentNew);
|
lstMove((List *)this, parentNew);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT_LIST, this);
|
FUNCTION_TEST_RETURN(VARIANT_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -143,5 +143,5 @@ varLstFree(VariantList *this)
|
|||||||
|
|
||||||
lstFree((List *)this);
|
lstFree((List *)this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ void varLstFree(VariantList *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_VARIANT_LIST_TYPE \
|
#define FUNCTION_LOG_VARIANT_LIST_TYPE \
|
||||||
VariantList *
|
VariantList *
|
||||||
#define FUNCTION_DEBUG_VARIANT_LIST_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_VARIANT_LIST_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "VariantList", buffer, bufferSize)
|
objToLog(value, "VariantList", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CONST_VARIANT_LIST_TYPE \
|
#define FUNCTION_LOG_CONST_VARIANT_LIST_TYPE \
|
||||||
const VariantList *
|
const VariantList *
|
||||||
#define FUNCTION_DEBUG_CONST_VARIANT_LIST_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CONST_VARIANT_LIST_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "VariantList", buffer, bufferSize)
|
objToLog(value, "VariantList", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ XmlNodeList *
|
|||||||
xmlNodeLstNew(void)
|
xmlNodeLstNew(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(XML_NODE_LIST, (XmlNodeList *)lstNew(sizeof(XmlNode *)));
|
FUNCTION_TEST_RETURN(XML_NODE_LIST, (XmlNodeList *)lstNew(sizeof(XmlNode *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -63,11 +63,11 @@ xmlNodeLstGet(const XmlNodeList *this, unsigned int listIdx)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(UINT, listIdx);
|
FUNCTION_TEST_PARAM(UINT, listIdx);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE, *(XmlNode **)lstGet((List *)this, listIdx));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(XML_NODE, *(XmlNode **)lstGet((List *)this, listIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -78,11 +78,11 @@ xmlNodeLstSize(const XmlNodeList *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, lstSize((List *)this));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, lstSize((List *)this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -97,7 +97,7 @@ xmlNodeLstFree(XmlNodeList *this)
|
|||||||
|
|
||||||
lstFree((List *)this);
|
lstFree((List *)this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -108,14 +108,14 @@ xmlNodeNew(xmlNodePtr node)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(VOIDP, node);
|
FUNCTION_TEST_PARAM(VOIDP, node);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(node != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(node != NULL);
|
||||||
|
|
||||||
XmlNode *this = memNew(sizeof(XmlNode));
|
XmlNode *this = memNew(sizeof(XmlNode));
|
||||||
this->node = node;
|
this->node = node;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE, this);
|
FUNCTION_TEST_RETURN(XML_NODE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -127,11 +127,11 @@ xmlNodeLstAdd(XmlNodeList *this, xmlNodePtr node)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
FUNCTION_TEST_PARAM(XML_NODE_LIST, this);
|
||||||
FUNCTION_TEST_PARAM(VOIDP, node);
|
FUNCTION_TEST_PARAM(VOIDP, node);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(node != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(node != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
MEM_CONTEXT_BEGIN(lstMemContext((List *)this))
|
||||||
{
|
{
|
||||||
XmlNode *item = xmlNodeNew(node);
|
XmlNode *item = xmlNodeNew(node);
|
||||||
@@ -139,7 +139,7 @@ xmlNodeLstAdd(XmlNodeList *this, xmlNodePtr node)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE_LIST, this);
|
FUNCTION_TEST_RETURN(XML_NODE_LIST, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -151,11 +151,11 @@ xmlNodeAttribute(XmlNode *this, const String *name)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE, this);
|
FUNCTION_TEST_PARAM(XML_NODE, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, name);
|
FUNCTION_TEST_PARAM(STRING, name);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
String *result = NULL;
|
String *result = NULL;
|
||||||
xmlChar *value = xmlGetProp(this->node, (unsigned char *)strPtr(name));
|
xmlChar *value = xmlGetProp(this->node, (unsigned char *)strPtr(name));
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ xmlNodeAttribute(XmlNode *this, const String *name)
|
|||||||
xmlFree(value);
|
xmlFree(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -187,7 +187,7 @@ xmlNodeContent(XmlNode *this)
|
|||||||
xmlFree(content);
|
xmlFree(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, result);
|
FUNCTION_TEST_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -199,11 +199,11 @@ xmlNodeChildList(XmlNode *this, const String *name)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE, this);
|
FUNCTION_TEST_PARAM(XML_NODE, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, name);
|
FUNCTION_TEST_PARAM(STRING, name);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
XmlNodeList *list = xmlNodeLstNew();
|
XmlNodeList *list = xmlNodeLstNew();
|
||||||
|
|
||||||
for (xmlNodePtr currentNode = this->node->children; currentNode != NULL; currentNode = currentNode->next)
|
for (xmlNodePtr currentNode = this->node->children; currentNode != NULL; currentNode = currentNode->next)
|
||||||
@@ -212,7 +212,7 @@ xmlNodeChildList(XmlNode *this, const String *name)
|
|||||||
xmlNodeLstAdd(list, currentNode);
|
xmlNodeLstAdd(list, currentNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE_LIST, list);
|
FUNCTION_TEST_RETURN(XML_NODE_LIST, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -225,11 +225,11 @@ xmlNodeChildN(XmlNode *this, const String *name, unsigned int index, bool errorO
|
|||||||
FUNCTION_TEST_PARAM(XML_NODE, this);
|
FUNCTION_TEST_PARAM(XML_NODE, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, name);
|
FUNCTION_TEST_PARAM(STRING, name);
|
||||||
FUNCTION_TEST_PARAM(UINT, index);
|
FUNCTION_TEST_PARAM(UINT, index);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
XmlNode *child = NULL;
|
XmlNode *child = NULL;
|
||||||
unsigned int childIdx = 0;
|
unsigned int childIdx = 0;
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ xmlNodeChildN(XmlNode *this, const String *name, unsigned int index, bool errorO
|
|||||||
if (child == NULL && errorOnMissing)
|
if (child == NULL && errorOnMissing)
|
||||||
THROW_FMT(FormatError, "unable to find child '%s':%u in node '%s'", strPtr(name), index, this->node->name);
|
THROW_FMT(FormatError, "unable to find child '%s':%u in node '%s'", strPtr(name), index, this->node->name);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE, child);
|
FUNCTION_TEST_RETURN(XML_NODE, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNode *
|
XmlNode *
|
||||||
@@ -259,12 +259,12 @@ xmlNodeChild(XmlNode *this, const String *name, bool errorOnMissing)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE, this);
|
FUNCTION_TEST_PARAM(XML_NODE, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, name);
|
FUNCTION_TEST_PARAM(STRING, name);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE, xmlNodeChildN(this, name, 0, errorOnMissing));
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(XML_NODE, xmlNodeChildN(this, name, 0, errorOnMissing));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -275,10 +275,10 @@ xmlNodeChildTotal(XmlNode *this, const String *name)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_NODE, this);
|
FUNCTION_TEST_PARAM(XML_NODE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
unsigned int result = 0;
|
unsigned int result = 0;
|
||||||
|
|
||||||
for (xmlNodePtr currentNode = this->node->children; currentNode != NULL; currentNode = currentNode->next)
|
for (xmlNodePtr currentNode = this->node->children; currentNode != NULL; currentNode = currentNode->next)
|
||||||
@@ -287,7 +287,7 @@ xmlNodeChildTotal(XmlNode *this, const String *name)
|
|||||||
result++;
|
result++;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, result);
|
FUNCTION_TEST_RETURN(UINT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -303,7 +303,7 @@ xmlNodeFree(XmlNode *this)
|
|||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memFree(this);
|
memFree(this);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -315,11 +315,11 @@ xmlDocumentNewC(const unsigned char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(UCHARP, buffer);
|
FUNCTION_TEST_PARAM(UCHARP, buffer);
|
||||||
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
FUNCTION_TEST_PARAM(SIZE, bufferSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(bufferSize > 0);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(buffer != NULL);
|
||||||
|
ASSERT(bufferSize > 0);
|
||||||
|
|
||||||
// Initialize xml if it is not already initialized
|
// Initialize xml if it is not already initialized
|
||||||
static bool xmlInit = false;
|
static bool xmlInit = false;
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ xmlDocumentNewC(const unsigned char *buffer, size_t bufferSize)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_DOCUMENT, this);
|
FUNCTION_TEST_RETURN(XML_DOCUMENT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -364,12 +364,12 @@ xmlDocumentNewBuf(const Buffer *buffer)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(BUFFER, buffer);
|
FUNCTION_TEST_PARAM(BUFFER, buffer);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(buffer != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(bufSize(buffer) > 0);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_DOCUMENT, xmlDocumentNewC(bufPtr(buffer), bufSize(buffer)));
|
ASSERT(buffer != NULL);
|
||||||
|
ASSERT(bufSize(buffer) > 0);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(XML_DOCUMENT, xmlDocumentNewC(bufPtr(buffer), bufSize(buffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -380,12 +380,12 @@ xmlDocumentNewZ(const char *string)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CHARP, string);
|
FUNCTION_TEST_PARAM(CHARP, string);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(string != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(strlen(string) > 0);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_DOCUMENT, xmlDocumentNewC((const unsigned char *)string, strlen(string)));
|
ASSERT(string != NULL);
|
||||||
|
ASSERT(strlen(string) > 0);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(XML_DOCUMENT, xmlDocumentNewC((const unsigned char *)string, strlen(string)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -396,11 +396,11 @@ xmlDocumentRoot(const XmlDocument *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(XML_DOCUMENT, this);
|
FUNCTION_TEST_PARAM(XML_DOCUMENT, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(XML_NODE, this->root);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(XML_NODE, this->root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -421,5 +421,5 @@ xmlDocumentFree(XmlDocument *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,19 +64,19 @@ void xmlNodeLstFree(XmlNodeList *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_XML_DOCUMENT_TYPE \
|
#define FUNCTION_LOG_XML_DOCUMENT_TYPE \
|
||||||
XmlDocument *
|
XmlDocument *
|
||||||
#define FUNCTION_DEBUG_XML_DOCUMENT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_XML_DOCUMENT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "XmlDocument", buffer, bufferSize)
|
objToLog(value, "XmlDocument", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_XML_NODE_TYPE \
|
#define FUNCTION_LOG_XML_NODE_TYPE \
|
||||||
XmlNode *
|
XmlNode *
|
||||||
#define FUNCTION_DEBUG_XML_NODE_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_XML_NODE_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "XmlNode", buffer, bufferSize)
|
objToLog(value, "XmlNode", buffer, bufferSize)
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_XML_NODE_LIST_TYPE \
|
#define FUNCTION_LOG_XML_NODE_LIST_TYPE \
|
||||||
XmlNodeList *
|
XmlNodeList *
|
||||||
#define FUNCTION_DEBUG_XML_NODE_LIST_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_XML_NODE_LIST_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "XmlNodeList", buffer, bufferSize)
|
objToLog(value, "XmlNodeList", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ New wait handler
|
|||||||
Wait *
|
Wait *
|
||||||
waitNew(TimeMSec waitTime)
|
waitNew(TimeMSec waitTime)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(TIMEMSEC, waitTime);
|
FUNCTION_LOG_PARAM(TIMEMSEC, waitTime);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(waitTime >= 100 && waitTime <= 999999000);
|
ASSERT(waitTime >= 100 && waitTime <= 999999000);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Allocate wait object
|
// Allocate wait object
|
||||||
Wait *this = NULL;
|
Wait *this = NULL;
|
||||||
@@ -54,7 +54,7 @@ waitNew(TimeMSec waitTime)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(WAIT, this);
|
FUNCTION_LOG_RETURN(WAIT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -63,11 +63,11 @@ Wait and return whether the caller has more time left
|
|||||||
bool
|
bool
|
||||||
waitMore(Wait *this)
|
waitMore(Wait *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(WAIT, this);
|
FUNCTION_LOG_PARAM(WAIT, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ waitMore(Wait *this)
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -111,12 +111,12 @@ Free the wait
|
|||||||
void
|
void
|
||||||
waitFree(Wait *this)
|
waitFree(Wait *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(WAIT, this);
|
FUNCTION_LOG_PARAM(WAIT, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ void waitFree(Wait *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_WAIT_TYPE \
|
#define FUNCTION_LOG_WAIT_TYPE \
|
||||||
Wait *
|
Wait *
|
||||||
#define FUNCTION_DEBUG_WAIT_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_WAIT_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "Wait", buffer, bufferSize)
|
objToLog(value, "Wait", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ Gzip Compress
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/filter/filter.intern.h"
|
#include "common/io/filter/filter.intern.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -43,12 +42,12 @@ New object
|
|||||||
GzipCompress *
|
GzipCompress *
|
||||||
gzipCompressNew(int level, bool raw)
|
gzipCompressNew(int level, bool raw)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INT, level);
|
FUNCTION_LOG_PARAM(INT, level);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, raw);
|
FUNCTION_LOG_PARAM(BOOL, raw);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(level >= -1 && level <= 9);
|
ASSERT(level >= -1 && level <= 9);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
GzipCompress *this = NULL;
|
GzipCompress *this = NULL;
|
||||||
|
|
||||||
@@ -73,7 +72,7 @@ gzipCompressNew(int level, bool raw)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(GZIP_COMPRESS, this);
|
FUNCTION_LOG_RETURN(GZIP_COMPRESS, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -82,18 +81,18 @@ Compress data
|
|||||||
void
|
void
|
||||||
gzipCompressProcess(GzipCompress *this, const Buffer *uncompressed, Buffer *compressed)
|
gzipCompressProcess(GzipCompress *this, const Buffer *uncompressed, Buffer *compressed)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(GZIP_COMPRESS, this);
|
FUNCTION_LOG_PARAM(GZIP_COMPRESS, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, uncompressed);
|
FUNCTION_LOG_PARAM(BUFFER, uncompressed);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, compressed);
|
FUNCTION_LOG_PARAM(BUFFER, compressed);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(!this->done);
|
ASSERT(!this->done);
|
||||||
FUNCTION_DEBUG_ASSERT(this->stream != NULL);
|
ASSERT(this->stream != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(compressed != NULL);
|
ASSERT(compressed != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(!this->flush || uncompressed == NULL);
|
ASSERT(!this->flush || uncompressed == NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(this->flush || (!this->inputSame || this->stream->avail_in != 0));
|
ASSERT(this->flush || (!this->inputSame || this->stream->avail_in != 0));
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Flushing
|
// Flushing
|
||||||
if (uncompressed == NULL)
|
if (uncompressed == NULL)
|
||||||
@@ -129,7 +128,7 @@ gzipCompressProcess(GzipCompress *this, const Buffer *uncompressed, Buffer *comp
|
|||||||
// Can more input be provided on the next call?
|
// Can more input be provided on the next call?
|
||||||
this->inputSame = this->flush ? !this->done : this->stream->avail_in != 0;
|
this->inputSame = this->flush ? !this->done : this->stream->avail_in != 0;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -140,11 +139,11 @@ gzipCompressDone(const GzipCompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->done);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -155,11 +154,11 @@ gzipCompressFilter(const GzipCompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this->filter);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -170,11 +169,11 @@ gzipCompressInputSame(const GzipCompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_COMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -194,9 +193,9 @@ Free memory
|
|||||||
void
|
void
|
||||||
gzipCompressFree(GzipCompress *this)
|
gzipCompressFree(GzipCompress *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(GZIP_COMPRESS, this);
|
FUNCTION_LOG_PARAM(GZIP_COMPRESS, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
{
|
{
|
||||||
@@ -207,5 +206,5 @@ gzipCompressFree(GzipCompress *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *gzipCompressToLog(const GzipCompress *this);
|
String *gzipCompressToLog(const GzipCompress *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_GZIP_COMPRESS_TYPE \
|
#define FUNCTION_LOG_GZIP_COMPRESS_TYPE \
|
||||||
GzipCompress *
|
GzipCompress *
|
||||||
#define FUNCTION_DEBUG_GZIP_COMPRESS_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_GZIP_COMPRESS_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, gzipCompressToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, gzipCompressToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ New object
|
|||||||
GzipDecompress *
|
GzipDecompress *
|
||||||
gzipDecompressNew(bool raw)
|
gzipDecompressNew(bool raw)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, raw);
|
FUNCTION_LOG_PARAM(BOOL, raw);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
GzipDecompress *this = NULL;
|
GzipDecompress *this = NULL;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ gzipDecompressNew(bool raw)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(GZIP_DECOMPRESS, this);
|
FUNCTION_LOG_RETURN(GZIP_DECOMPRESS, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -73,16 +73,16 @@ Decompress data
|
|||||||
void
|
void
|
||||||
gzipDecompressProcess(GzipDecompress *this, const Buffer *compressed, Buffer *uncompressed)
|
gzipDecompressProcess(GzipDecompress *this, const Buffer *compressed, Buffer *uncompressed)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(GZIP_DECOMPRESS, this);
|
FUNCTION_LOG_PARAM(GZIP_DECOMPRESS, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, compressed);
|
FUNCTION_LOG_PARAM(BUFFER, compressed);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, uncompressed);
|
FUNCTION_LOG_PARAM(BUFFER, uncompressed);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(this->stream != NULL);
|
ASSERT(this->stream != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(compressed != NULL);
|
ASSERT(compressed != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(uncompressed != NULL);
|
ASSERT(uncompressed != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (!this->inputSame)
|
if (!this->inputSame)
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,7 @@ gzipDecompressProcess(GzipDecompress *this, const Buffer *compressed, Buffer *un
|
|||||||
// Is the same input expected on the next call?
|
// Is the same input expected on the next call?
|
||||||
this->inputSame = this->done ? false : this->stream->avail_in != 0;
|
this->inputSame = this->done ? false : this->stream->avail_in != 0;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -115,11 +115,11 @@ gzipDecompressDone(const GzipDecompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->done);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -130,11 +130,11 @@ gzipDecompressFilter(const GzipDecompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this->filter);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -145,11 +145,11 @@ gzipDecompressInputSame(const GzipDecompress *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
FUNCTION_TEST_PARAM(GZIP_DECOMPRESS, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -169,9 +169,9 @@ Free memory
|
|||||||
void
|
void
|
||||||
gzipDecompressFree(GzipDecompress *this)
|
gzipDecompressFree(GzipDecompress *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(GZIP_DECOMPRESS, this);
|
FUNCTION_LOG_PARAM(GZIP_DECOMPRESS, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
{
|
{
|
||||||
@@ -181,5 +181,5 @@ gzipDecompressFree(GzipDecompress *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *gzipDecompressToLog(const GzipDecompress *this);
|
String *gzipDecompressToLog(const GzipDecompress *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_GZIP_DECOMPRESS_TYPE \
|
#define FUNCTION_LOG_GZIP_DECOMPRESS_TYPE \
|
||||||
GzipDecompress *
|
GzipDecompress *
|
||||||
#define FUNCTION_DEBUG_GZIP_DECOMPRESS_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_GZIP_DECOMPRESS_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, gzipDecompressToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, gzipDecompressToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ Command and Option Configuration
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
@@ -148,7 +147,7 @@ cfgInit(void)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -158,7 +157,7 @@ ConfigCommand
|
|||||||
cfgCommand(void)
|
cfgCommand(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(ENUM, command);
|
FUNCTION_TEST_RETURN(ENUM, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -166,13 +165,13 @@ cfgCommandSet(ConfigCommand commandParam)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandParam);
|
FUNCTION_TEST_PARAM(ENUM, commandParam);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandParam <= cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandParam <= cfgCmdNone);
|
||||||
|
|
||||||
command = commandParam;
|
command = commandParam;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -182,7 +181,7 @@ bool
|
|||||||
cfgCommandHelp(void)
|
cfgCommandHelp(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(BOOL, help);
|
FUNCTION_TEST_RETURN(BOOL, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -194,7 +193,7 @@ cfgCommandHelpSet(bool helpParam)
|
|||||||
|
|
||||||
help = helpParam;
|
help = helpParam;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -208,11 +207,11 @@ cfgCommandDefIdFromId(ConfigCommand commandId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandId);
|
FUNCTION_TEST_PARAM(ENUM, commandId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandId < cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, (ConfigDefineCommand)commandId);
|
ASSERT(commandId < cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, (ConfigDefineCommand)commandId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -223,10 +222,10 @@ cfgCommandId(const char *commandName)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, commandName);
|
FUNCTION_TEST_PARAM(STRINGZ, commandName);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandName != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandName != NULL);
|
||||||
|
|
||||||
ConfigCommand commandId;
|
ConfigCommand commandId;
|
||||||
|
|
||||||
for (commandId = 0; commandId < cfgCmdNone; commandId++)
|
for (commandId = 0; commandId < cfgCmdNone; commandId++)
|
||||||
@@ -236,7 +235,7 @@ cfgCommandId(const char *commandName)
|
|||||||
if (commandId == cfgCmdNone)
|
if (commandId == cfgCmdNone)
|
||||||
THROW_FMT(AssertError, "invalid command '%s'", commandName);
|
THROW_FMT(AssertError, "invalid command '%s'", commandName);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, commandId);
|
FUNCTION_TEST_RETURN(ENUM, commandId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -247,11 +246,11 @@ cfgCommandName(ConfigCommand commandId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandId);
|
FUNCTION_TEST_PARAM(ENUM, commandId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandId < cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configCommandData[commandId].name);
|
ASSERT(commandId < cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configCommandData[commandId].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -271,7 +270,7 @@ cfgCommandParam(void)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING_LIST, paramList);
|
FUNCTION_TEST_RETURN(STRING_LIST, paramList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -279,17 +278,17 @@ cfgCommandParamSet(const StringList *param)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING_LIST, param);
|
FUNCTION_TEST_PARAM(STRING_LIST, param);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(param != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(param != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(configMemContext)
|
MEM_CONTEXT_BEGIN(configMemContext)
|
||||||
{
|
{
|
||||||
paramList = strLstDup(param);
|
paramList = strLstDup(param);
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -299,7 +298,7 @@ const String *
|
|||||||
cfgExe(void)
|
cfgExe(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(STRING, exe);
|
FUNCTION_TEST_RETURN(STRING, exe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -307,17 +306,17 @@ cfgExeSet(const String *exeParam)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, exeParam);
|
FUNCTION_TEST_PARAM(STRING, exeParam);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(exeParam != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(exeParam != NULL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(configMemContext)
|
MEM_CONTEXT_BEGIN(configMemContext)
|
||||||
{
|
{
|
||||||
exe = strDup(exeParam);
|
exe = strDup(exeParam);
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -326,11 +325,11 @@ Does this command require an immediate lock?
|
|||||||
bool
|
bool
|
||||||
cfgLockRequired(void)
|
cfgLockRequired(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_ASSERT(command != cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configCommandData[cfgCommand()].lockRequired);
|
ASSERT(command != cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configCommandData[cfgCommand()].lockRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -339,11 +338,11 @@ Get the lock type required for this command
|
|||||||
LockType
|
LockType
|
||||||
cfgLockType(void)
|
cfgLockType(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_ASSERT(command != cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, (LockType)configCommandData[cfgCommand()].lockType);
|
ASSERT(command != cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, (LockType)configCommandData[cfgCommand()].lockType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -352,11 +351,11 @@ Does this command log to a file?
|
|||||||
bool
|
bool
|
||||||
cfgLogFile(void)
|
cfgLogFile(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_ASSERT(command != cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configCommandData[cfgCommand()].logFile);
|
ASSERT(command != cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configCommandData[cfgCommand()].logFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -365,11 +364,11 @@ Get default log level -- used for log messages that are common to all commands
|
|||||||
LogLevel
|
LogLevel
|
||||||
cfgLogLevelDefault(void)
|
cfgLogLevelDefault(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_ASSERT(command != cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, (LogLevel)configCommandData[cfgCommand()].logLevelDefault);
|
ASSERT(command != cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, (LogLevel)configCommandData[cfgCommand()].logLevelDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -378,11 +377,11 @@ Get max stderr log level -- used to suppress error output for higher log levels,
|
|||||||
LogLevel
|
LogLevel
|
||||||
cfgLogLevelStdErrMax(void)
|
cfgLogLevelStdErrMax(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_ASSERT(command != cfgCmdNone);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, (LogLevel)configCommandData[cfgCommand()].logLevelStdErrMax);
|
ASSERT(command != cfgCmdNone);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, (LogLevel)configCommandData[cfgCommand()].logLevelStdErrMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -393,11 +392,11 @@ cfgOptionDefIdFromId(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, configOptionData[optionId].defineId);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, configOptionData[optionId].defineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -408,10 +407,10 @@ cfgOptionDefault(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
if (configOptionValue[optionId].defaultValue == NULL)
|
if (configOptionValue[optionId].defaultValue == NULL)
|
||||||
{
|
{
|
||||||
ConfigDefineOption optionDefId = cfgOptionDefIdFromId(optionId);
|
ConfigDefineOption optionDefId = cfgOptionDefIdFromId(optionId);
|
||||||
@@ -460,7 +459,7 @@ cfgOptionDefault(ConfigOption optionId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, configOptionValue[optionId].defaultValue);
|
FUNCTION_TEST_RETURN(VARIANT, configOptionValue[optionId].defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -469,10 +468,10 @@ cfgOptionDefaultSet(ConfigOption optionId, const Variant *defaultValue)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, defaultValue);
|
FUNCTION_TEST_PARAM(VARIANT, defaultValue);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(configMemContext)
|
MEM_CONTEXT_BEGIN(configMemContext)
|
||||||
{
|
{
|
||||||
if (configOptionValue[optionId].defaultValue != NULL)
|
if (configOptionValue[optionId].defaultValue != NULL)
|
||||||
@@ -490,7 +489,7 @@ cfgOptionDefaultSet(ConfigOption optionId, const Variant *defaultValue)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -501,11 +500,11 @@ cfgOptionIndex(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, configOptionData[optionId].index);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, configOptionData[optionId].index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -516,17 +515,17 @@ cfgOptionId(const char *optionName)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, optionName);
|
FUNCTION_TEST_PARAM(STRINGZ, optionName);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionName != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionName != NULL);
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
for (ConfigOption optionId = 0; optionId < CFG_OPTION_TOTAL; optionId++)
|
for (ConfigOption optionId = 0; optionId < CFG_OPTION_TOTAL; optionId++)
|
||||||
if (strcmp(optionName, configOptionData[optionId].name) == 0)
|
if (strcmp(optionName, configOptionData[optionId].name) == 0)
|
||||||
result = optionId;
|
result = optionId;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, result);
|
FUNCTION_TEST_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -537,11 +536,11 @@ cfgOptionIndexTotal(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, cfgDefOptionIndexTotal(configOptionData[optionId].defineId));
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, cfgDefOptionIndexTotal(configOptionData[optionId].defineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -553,11 +552,11 @@ cfgOptionIdFromDefId(ConfigDefineOption optionDefId, unsigned int index)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(UINT, index);
|
FUNCTION_TEST_PARAM(UINT, index);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(index < cfgDefOptionIndexTotal(optionDefId));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(index < cfgDefOptionIndexTotal(optionDefId));
|
||||||
|
|
||||||
// Search for the option
|
// Search for the option
|
||||||
ConfigOption optionId;
|
ConfigOption optionId;
|
||||||
|
|
||||||
@@ -566,10 +565,10 @@ cfgOptionIdFromDefId(ConfigDefineOption optionDefId, unsigned int index)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// If the mapping is not found then there is a bug in the code generator
|
// If the mapping is not found then there is a bug in the code generator
|
||||||
ASSERT_DEBUG(optionId != CFG_OPTION_TOTAL);
|
ASSERT(optionId != CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
// Return with original index
|
// Return with original index
|
||||||
FUNCTION_TEST_RESULT(ENUM, optionId + index);
|
FUNCTION_TEST_RETURN(ENUM, optionId + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -580,11 +579,11 @@ cfgOptionName(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configOptionData[optionId].name);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configOptionData[optionId].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -595,11 +594,11 @@ cfgOptionNegate(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configOptionValue[optionId].negate);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configOptionValue[optionId].negate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -608,13 +607,13 @@ cfgOptionNegateSet(ConfigOption optionId, bool negate)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
FUNCTION_TEST_PARAM(BOOL, negate);
|
FUNCTION_TEST_PARAM(BOOL, negate);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
configOptionValue[optionId].negate = negate;
|
configOptionValue[optionId].negate = negate;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -625,11 +624,11 @@ cfgOptionReset(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configOptionValue[optionId].reset);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configOptionValue[optionId].reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -638,13 +637,13 @@ cfgOptionResetSet(ConfigOption optionId, bool reset)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
FUNCTION_TEST_PARAM(BOOL, reset);
|
FUNCTION_TEST_PARAM(BOOL, reset);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
configOptionValue[optionId].reset = reset;
|
configOptionValue[optionId].reset = reset;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -655,88 +654,87 @@ cfgOption(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(VARIANT, configOptionValue[optionId].value);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(VARIANT, configOptionValue[optionId].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cfgOptionBool(ConfigOption optionId)
|
cfgOptionBool(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(varType(configOptionValue[optionId].value) == varTypeBool);
|
ASSERT(varType(configOptionValue[optionId].value) == varTypeBool);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, varBool(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(BOOL, varBool(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
cfgOptionDbl(ConfigOption optionId)
|
cfgOptionDbl(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(varType(configOptionValue[optionId].value) == varTypeDouble);
|
ASSERT(varType(configOptionValue[optionId].value) == varTypeDouble);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(DOUBLE, varDbl(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(DOUBLE, varDbl(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cfgOptionInt(ConfigOption optionId)
|
cfgOptionInt(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(varType(configOptionValue[optionId].value) == varTypeInt64);
|
ASSERT(varType(configOptionValue[optionId].value) == varTypeInt64);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(INT, varIntForce(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(INT, varIntForce(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
cfgOptionInt64(ConfigOption optionId)
|
cfgOptionInt64(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(varType(configOptionValue[optionId].value) == varTypeInt64);
|
ASSERT(varType(configOptionValue[optionId].value) == varTypeInt64);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(INT64, varInt64(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(INT64, varInt64(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
const KeyValue *
|
const KeyValue *
|
||||||
cfgOptionKv(ConfigOption optionId)
|
cfgOptionKv(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(varType(configOptionValue[optionId].value) == varTypeKeyValue);
|
ASSERT(varType(configOptionValue[optionId].value) == varTypeKeyValue);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(KEY_VALUE, varKv(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(KEY_VALUE, varKv(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
const VariantList *
|
const VariantList *
|
||||||
cfgOptionLst(ConfigOption optionId)
|
cfgOptionLst(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(
|
ASSERT(configOptionValue[optionId].value == NULL || varType(configOptionValue[optionId].value) == varTypeVariantList);
|
||||||
configOptionValue[optionId].value == NULL || varType(configOptionValue[optionId].value) == varTypeVariantList);
|
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (configOptionValue[optionId].value == NULL)
|
if (configOptionValue[optionId].value == NULL)
|
||||||
{
|
{
|
||||||
@@ -747,26 +745,25 @@ cfgOptionLst(ConfigOption optionId)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(VARIANT_LIST, varVarLst(configOptionValue[optionId].value));
|
FUNCTION_LOG_RETURN(VARIANT_LIST, varVarLst(configOptionValue[optionId].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
const String *
|
const String *
|
||||||
cfgOptionStr(ConfigOption optionId)
|
cfgOptionStr(ConfigOption optionId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, optionId);
|
FUNCTION_LOG_PARAM(ENUM, optionId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
FUNCTION_DEBUG_ASSERT(
|
ASSERT(configOptionValue[optionId].value == NULL || varType(configOptionValue[optionId].value) == varTypeString);
|
||||||
configOptionValue[optionId].value == NULL || varType(configOptionValue[optionId].value) == varTypeString);
|
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
const String *result = NULL;
|
const String *result = NULL;
|
||||||
|
|
||||||
if (configOptionValue[optionId].value != NULL)
|
if (configOptionValue[optionId].value != NULL)
|
||||||
result = varStr(configOptionValue[optionId].value);
|
result = varStr(configOptionValue[optionId].value);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(CONST_STRING, result);
|
FUNCTION_LOG_RETURN(CONST_STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -776,10 +773,10 @@ cfgOptionSet(ConfigOption optionId, ConfigSource source, const Variant *value)
|
|||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, source);
|
FUNCTION_TEST_PARAM(ENUM, source);
|
||||||
FUNCTION_TEST_PARAM(VARIANT, value);
|
FUNCTION_TEST_PARAM(VARIANT, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
MEM_CONTEXT_BEGIN(configMemContext)
|
MEM_CONTEXT_BEGIN(configMemContext)
|
||||||
{
|
{
|
||||||
// Set the source
|
// Set the source
|
||||||
@@ -862,7 +859,7 @@ cfgOptionSet(ConfigOption optionId, ConfigSource source, const Variant *value)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -873,11 +870,11 @@ cfgOptionSource(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, configOptionValue[optionId].source);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, configOptionValue[optionId].source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -888,11 +885,11 @@ cfgOptionTest(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, cfgOptionValid(optionId) && configOptionValue[optionId].value != NULL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, cfgOptionValid(optionId) && configOptionValue[optionId].value != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -903,11 +900,11 @@ cfgOptionValid(ConfigOption optionId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configOptionValue[optionId].valid);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configOptionValue[optionId].valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -916,11 +913,11 @@ cfgOptionValidSet(ConfigOption optionId, bool valid)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionId);
|
FUNCTION_TEST_PARAM(ENUM, optionId);
|
||||||
FUNCTION_TEST_PARAM(BOOL, valid);
|
FUNCTION_TEST_PARAM(BOOL, valid);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionId < CFG_OPTION_TOTAL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
configOptionValue[optionId].valid = valid;
|
configOptionValue[optionId].valid = valid;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Command and Option Configuration Definition
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "config/define.h"
|
#include "config/define.h"
|
||||||
@@ -194,13 +193,13 @@ cfgDefDataFind(
|
|||||||
FUNCTION_TEST_PARAM(INTP, dataDef);
|
FUNCTION_TEST_PARAM(INTP, dataDef);
|
||||||
FUNCTION_TEST_PARAM(VOIDPP, dataDefList);
|
FUNCTION_TEST_PARAM(VOIDPP, dataDefList);
|
||||||
FUNCTION_TEST_PARAM(UINTP, dataDefListSize);
|
FUNCTION_TEST_PARAM(UINTP, dataDefListSize);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(dataDefFound != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(dataDef != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(dataDefList != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(dataDefListSize != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(dataDefFound != NULL);
|
||||||
|
ASSERT(dataDef != NULL);
|
||||||
|
ASSERT(dataDefList != NULL);
|
||||||
|
ASSERT(dataDefListSize != NULL);
|
||||||
|
|
||||||
*dataDefFound = false;
|
*dataDefFound = false;
|
||||||
|
|
||||||
// Only proceed if there is data
|
// Only proceed if there is data
|
||||||
@@ -249,7 +248,7 @@ cfgDefDataFind(
|
|||||||
while(type != configDefDataTypeEnd);
|
while(type != configDefDataTypeEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, type) \
|
#define CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, type) \
|
||||||
@@ -268,14 +267,14 @@ unsigned int
|
|||||||
cfgDefCommandTotal(void)
|
cfgDefCommandTotal(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(UINT, sizeof(configDefineCommandData) / sizeof(ConfigDefineCommandData));
|
FUNCTION_TEST_RETURN(UINT, sizeof(configDefineCommandData) / sizeof(ConfigDefineCommandData));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
cfgDefOptionTotal(void)
|
cfgDefOptionTotal(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(UINT, sizeof(configDefineOptionData) / sizeof(ConfigDefineOptionData));
|
FUNCTION_TEST_RETURN(UINT, sizeof(configDefineOptionData) / sizeof(ConfigDefineOptionData));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -286,11 +285,11 @@ cfgDefCommandHelpDescription(ConfigDefineCommand commandDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configDefineCommandData[commandDefId].helpDescription);
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configDefineCommandData[commandDefId].helpDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -301,11 +300,11 @@ cfgDefCommandHelpSummary(ConfigDefineCommand commandDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configDefineCommandData[commandDefId].helpSummary);
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configDefineCommandData[commandDefId].helpSummary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -317,14 +316,14 @@ cfgDefOptionAllowList(ConfigDefineCommand commandDefId, ConfigDefineOption optio
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, dataDefFound);
|
FUNCTION_TEST_RETURN(BOOL, dataDefFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -334,15 +333,15 @@ cfgDefOptionAllowListValue(ConfigDefineCommand commandDefId, ConfigDefineOption
|
|||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(UINT, valueId);
|
FUNCTION_TEST_PARAM(UINT, valueId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(valueId < cfgDefOptionAllowListValueTotal(commandDefId, optionDefId));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(valueId < cfgDefOptionAllowListValueTotal(commandDefId, optionDefId));
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, (char *)dataDefList[valueId]);
|
FUNCTION_TEST_RETURN(STRINGZ, (char *)dataDefList[valueId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
@@ -351,14 +350,14 @@ cfgDefOptionAllowListValueTotal(ConfigDefineCommand commandDefId, ConfigDefineOp
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowList);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, dataDefListSize);
|
FUNCTION_TEST_RETURN(UINT, dataDefListSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the value matches a value in the allow list
|
// Check if the value matches a value in the allow list
|
||||||
@@ -369,12 +368,12 @@ cfgDefOptionAllowListValueValid(ConfigDefineCommand commandDefId, ConfigDefineOp
|
|||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, value);
|
FUNCTION_TEST_PARAM(STRINGZ, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
for (unsigned int valueIdx = 0; valueIdx < cfgDefOptionAllowListValueTotal(commandDefId, optionDefId); valueIdx++)
|
for (unsigned int valueIdx = 0; valueIdx < cfgDefOptionAllowListValueTotal(commandDefId, optionDefId); valueIdx++)
|
||||||
@@ -383,7 +382,7 @@ cfgDefOptionAllowListValueValid(ConfigDefineCommand commandDefId, ConfigDefineOp
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -395,14 +394,14 @@ cfgDefOptionAllowRange(ConfigDefineCommand commandDefId, ConfigDefineOption opti
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, dataDefFound);
|
FUNCTION_TEST_RETURN(BOOL, dataDefFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
@@ -411,14 +410,14 @@ cfgDefOptionAllowRangeMax(ConfigDefineCommand commandDefId, ConfigDefineOption o
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(
|
FUNCTION_TEST_RETURN(
|
||||||
DOUBLE, ((double)(((int64_t)(intptr_t)dataDefList[2]) + (((int64_t)(intptr_t)dataDefList[3]) * 1000000000L))) / 100);
|
DOUBLE, ((double)(((int64_t)(intptr_t)dataDefList[2]) + (((int64_t)(intptr_t)dataDefList[3]) * 1000000000L))) / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,14 +427,14 @@ cfgDefOptionAllowRangeMin(ConfigDefineCommand commandDefId, ConfigDefineOption o
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeAllowRange);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(
|
FUNCTION_TEST_RETURN(
|
||||||
DOUBLE, ((double)(((int64_t)(intptr_t)dataDefList[0]) + (((int64_t)(intptr_t)dataDefList[1]) * 1000000000L))) / 100);
|
DOUBLE, ((double)(((int64_t)(intptr_t)dataDefList[0]) + (((int64_t)(intptr_t)dataDefList[1]) * 1000000000L))) / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,11 +447,11 @@ cfgDefOptionDefault(ConfigDefineCommand commandDefId, ConfigDefineOption optionD
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDefault);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDefault);
|
||||||
|
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
@@ -460,7 +459,7 @@ cfgDefOptionDefault(ConfigDefineCommand commandDefId, ConfigDefineOption optionD
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (char *)dataDefList[0];
|
result = (char *)dataDefList[0];
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, result);
|
FUNCTION_TEST_RETURN(STRINGZ, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -472,14 +471,14 @@ cfgDefOptionDepend(ConfigDefineCommand commandDefId, ConfigDefineOption optionDe
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, dataDefFound);
|
FUNCTION_TEST_RETURN(BOOL, dataDefFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDefineOption
|
ConfigDefineOption
|
||||||
@@ -488,14 +487,14 @@ cfgDefOptionDependOption(ConfigDefineCommand commandDefId, ConfigDefineOption op
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, (ConfigDefineOption)dataDef);
|
FUNCTION_TEST_RETURN(ENUM, (ConfigDefineOption)dataDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -505,15 +504,15 @@ cfgDefOptionDependValue(ConfigDefineCommand commandDefId, ConfigDefineOption opt
|
|||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(UINT, valueId);
|
FUNCTION_TEST_PARAM(UINT, valueId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(valueId < cfgDefOptionDependValueTotal(commandDefId, optionDefId));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(valueId < cfgDefOptionDependValueTotal(commandDefId, optionDefId));
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, (char *)dataDefList[valueId]);
|
FUNCTION_TEST_RETURN(STRINGZ, (char *)dataDefList[valueId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
@@ -522,14 +521,14 @@ cfgDefOptionDependValueTotal(ConfigDefineCommand commandDefId, ConfigDefineOptio
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeDepend);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, dataDefListSize);
|
FUNCTION_TEST_RETURN(UINT, dataDefListSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the value matches a value in the allow list
|
// Check if the value matches a value in the allow list
|
||||||
@@ -540,12 +539,12 @@ cfgDefOptionDependValueValid(ConfigDefineCommand commandDefId, ConfigDefineOptio
|
|||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, value);
|
FUNCTION_TEST_PARAM(STRINGZ, value);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(value != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
for (unsigned int valueIdx = 0; valueIdx < cfgDefOptionDependValueTotal(commandDefId, optionDefId); valueIdx++)
|
for (unsigned int valueIdx = 0; valueIdx < cfgDefOptionDependValueTotal(commandDefId, optionDefId); valueIdx++)
|
||||||
@@ -554,7 +553,7 @@ cfgDefOptionDependValueValid(ConfigDefineCommand commandDefId, ConfigDefineOptio
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -566,11 +565,11 @@ cfgDefOptionHelpDescription(ConfigDefineCommand commandDefId, ConfigDefineOption
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeHelpDescription);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeHelpDescription);
|
||||||
|
|
||||||
const char *result = configDefineOptionData[optionDefId].helpDescription;
|
const char *result = configDefineOptionData[optionDefId].helpDescription;
|
||||||
@@ -578,7 +577,7 @@ cfgDefOptionHelpDescription(ConfigDefineCommand commandDefId, ConfigDefineOption
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (char *)dataDefList[0];
|
result = (char *)dataDefList[0];
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, result);
|
FUNCTION_TEST_RETURN(STRINGZ, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -589,13 +588,13 @@ cfgDefOptionHelpNameAlt(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, dataDefFound);
|
FUNCTION_TEST_RETURN(BOOL, dataDefFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -604,14 +603,14 @@ cfgDefOptionHelpNameAltValue(ConfigDefineOption optionDefId, unsigned int valueI
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
FUNCTION_TEST_PARAM(UINT, valueId);
|
FUNCTION_TEST_PARAM(UINT, valueId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(valueId < cfgDefOptionHelpNameAltValueTotal(optionDefId));
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
ASSERT(valueId < cfgDefOptionHelpNameAltValueTotal(optionDefId));
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, (char *)dataDefList[valueId]);
|
FUNCTION_TEST_RETURN(STRINGZ, (char *)dataDefList[valueId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
@@ -619,13 +618,13 @@ cfgDefOptionHelpNameAltValueTotal(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypeHelpNameAlt);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, dataDefListSize);
|
FUNCTION_TEST_RETURN(UINT, dataDefListSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -636,11 +635,11 @@ cfgDefOptionHelpSection(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configDefineOptionData[optionDefId].helpSection);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configDefineOptionData[optionDefId].helpSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -652,11 +651,11 @@ cfgDefOptionHelpSummary(ConfigDefineCommand commandDefId, ConfigDefineOption opt
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeHelpSummary);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeHelpSummary);
|
||||||
|
|
||||||
const char *result = configDefineOptionData[optionDefId].helpSummary;
|
const char *result = configDefineOptionData[optionDefId].helpSummary;
|
||||||
@@ -664,7 +663,7 @@ cfgDefOptionHelpSummary(ConfigDefineCommand commandDefId, ConfigDefineOption opt
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (char *)dataDefList[0];
|
result = (char *)dataDefList[0];
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, result);
|
FUNCTION_TEST_RETURN(STRINGZ, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -675,17 +674,17 @@ cfgDefOptionId(const char *optionName)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRINGZ, optionName);
|
FUNCTION_TEST_PARAM(STRINGZ, optionName);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionName != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionName != NULL);
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
for (ConfigDefineOption optionDefId = 0; optionDefId < cfgDefOptionTotal(); optionDefId++)
|
for (ConfigDefineOption optionDefId = 0; optionDefId < cfgDefOptionTotal(); optionDefId++)
|
||||||
if (strcmp(optionName, configDefineOptionData[optionDefId].name) == 0)
|
if (strcmp(optionName, configDefineOptionData[optionDefId].name) == 0)
|
||||||
result = optionDefId;
|
result = optionDefId;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, result);
|
FUNCTION_TEST_RETURN(INT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -696,11 +695,11 @@ cfgDefOptionIndexTotal(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(UINT, configDefineOptionData[optionDefId].indexTotal);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(UINT, configDefineOptionData[optionDefId].indexTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -712,11 +711,11 @@ cfgDefOptionInternal(ConfigDefineCommand commandDefId, ConfigDefineOption option
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeInternal);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeInternal);
|
||||||
|
|
||||||
bool result = configDefineOptionData[optionDefId].internal;
|
bool result = configDefineOptionData[optionDefId].internal;
|
||||||
@@ -724,7 +723,7 @@ cfgDefOptionInternal(ConfigDefineCommand commandDefId, ConfigDefineOption option
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (bool)dataDef;
|
result = (bool)dataDef;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -735,11 +734,11 @@ cfgDefOptionMulti(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(
|
||||||
BOOL,
|
BOOL,
|
||||||
configDefineOptionData[optionDefId].type == cfgDefOptTypeHash ||
|
configDefineOptionData[optionDefId].type == cfgDefOptTypeHash ||
|
||||||
configDefineOptionData[optionDefId].type == cfgDefOptTypeList);
|
configDefineOptionData[optionDefId].type == cfgDefOptTypeList);
|
||||||
@@ -753,11 +752,11 @@ cfgDefOptionName(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, configDefineOptionData[optionDefId].name);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRINGZ, configDefineOptionData[optionDefId].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -768,10 +767,10 @@ cfgDefOptionPrefix(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypePrefix);
|
CONFIG_DEFINE_DATA_FIND(-1, optionDefId, configDefDataTypePrefix);
|
||||||
|
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
@@ -779,7 +778,7 @@ cfgDefOptionPrefix(ConfigDefineOption optionDefId)
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (char *)dataDefList[0];
|
result = (char *)dataDefList[0];
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRINGZ, result);
|
FUNCTION_TEST_RETURN(STRINGZ, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -790,11 +789,11 @@ cfgDefOptionSecure(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configDefineOptionData[optionDefId].secure);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configDefineOptionData[optionDefId].secure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -806,11 +805,11 @@ cfgDefOptionRequired(ConfigDefineCommand commandDefId, ConfigDefineOption option
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeRequired);
|
CONFIG_DEFINE_DATA_FIND(commandDefId, optionDefId, configDefDataTypeRequired);
|
||||||
|
|
||||||
bool result = configDefineOptionData[optionDefId].required;
|
bool result = configDefineOptionData[optionDefId].required;
|
||||||
@@ -818,7 +817,7 @@ cfgDefOptionRequired(ConfigDefineCommand commandDefId, ConfigDefineOption option
|
|||||||
if (dataDefFound)
|
if (dataDefFound)
|
||||||
result = (bool)dataDef;
|
result = (bool)dataDef;
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, result);
|
FUNCTION_TEST_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -829,11 +828,11 @@ cfgDefOptionSection(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, configDefineOptionData[optionDefId].section);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(ENUM, configDefineOptionData[optionDefId].section);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -844,11 +843,11 @@ cfgDefOptionType(ConfigDefineOption optionDefId)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INT, configDefineOptionData[optionDefId].type);
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INT, configDefineOptionData[optionDefId].type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -860,10 +859,10 @@ cfgDefOptionValid(ConfigDefineCommand commandDefId, ConfigDefineOption optionDef
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
FUNCTION_TEST_PARAM(ENUM, commandDefId);
|
||||||
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
FUNCTION_TEST_PARAM(ENUM, optionDefId);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(commandDefId < cfgDefCommandTotal());
|
|
||||||
FUNCTION_TEST_ASSERT(optionDefId < cfgDefOptionTotal());
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, configDefineOptionData[optionDefId].commandValid & (1 << commandDefId));
|
ASSERT(commandDefId < cfgDefCommandTotal());
|
||||||
|
ASSERT(optionDefId < cfgDefOptionTotal());
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, configDefineOptionData[optionDefId].commandValid & (1 << commandDefId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ Load log settings
|
|||||||
StringList *
|
StringList *
|
||||||
cfgExecParam(ConfigCommand commandId, const KeyValue *optionReplace)
|
cfgExecParam(ConfigCommand commandId, const KeyValue *optionReplace)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, commandId);
|
FUNCTION_LOG_PARAM(ENUM, commandId);
|
||||||
FUNCTION_DEBUG_PARAM(KEY_VALUE, optionReplace);
|
FUNCTION_LOG_PARAM(KEY_VALUE, optionReplace);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
StringList *result = NULL;
|
StringList *result = NULL;
|
||||||
|
|
||||||
@@ -109,5 +109,5 @@ cfgExecParam(ConfigCommand commandId, const KeyValue *optionReplace)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING_LIST, result);
|
FUNCTION_LOG_RETURN(STRING_LIST, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Load log settings
|
|||||||
void
|
void
|
||||||
cfgLoadLogSetting(void)
|
cfgLoadLogSetting(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
// Initialize logging
|
// Initialize logging
|
||||||
LogLevel logLevelConsole = logLevelOff;
|
LogLevel logLevelConsole = logLevelOff;
|
||||||
@@ -48,7 +48,7 @@ cfgLoadLogSetting(void)
|
|||||||
|
|
||||||
logInit(logLevelConsole, logLevelStdErr, logLevelFile, logTimestamp);
|
logInit(logLevelConsole, logLevelStdErr, logLevelFile, logTimestamp);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -57,7 +57,7 @@ Update options that have complex rules
|
|||||||
void
|
void
|
||||||
cfgLoadUpdateOption(void)
|
cfgLoadUpdateOption(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
// Set default for repo-host-cmd
|
// Set default for repo-host-cmd
|
||||||
if (cfgOptionTest(cfgOptRepoHost) && cfgOptionSource(cfgOptRepoHostCmd) == cfgSourceDefault)
|
if (cfgOptionTest(cfgOptRepoHost) && cfgOptionSource(cfgOptRepoHostCmd) == cfgSourceDefault)
|
||||||
@@ -195,7 +195,7 @@ cfgLoadUpdateOption(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -215,10 +215,10 @@ Load the configuration
|
|||||||
void
|
void
|
||||||
cfgLoad(unsigned int argListSize, const char *argList[])
|
cfgLoad(unsigned int argListSize, const char *argList[])
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, argListSize);
|
FUNCTION_LOG_PARAM(UINT, argListSize);
|
||||||
FUNCTION_DEBUG_PARAM(CHARPY, argList);
|
FUNCTION_LOG_PARAM(CHARPY, argList);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
@@ -275,5 +275,5 @@ cfgLoad(unsigned int argListSize, const char *argList[])
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Command and Option Parse
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/ini.h"
|
#include "common/ini.h"
|
||||||
@@ -98,12 +97,12 @@ Convert the value passed into bytes and update valueDbl for range checking
|
|||||||
void
|
void
|
||||||
convertToByte(String **value, double *valueDbl)
|
convertToByte(String **value, double *valueDbl)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRINGP, value);
|
FUNCTION_LOG_PARAM(STRINGP, value);
|
||||||
FUNCTION_DEBUG_PARAM(DOUBLEP, valueDbl);
|
FUNCTION_LOG_PARAM(DOUBLEP, valueDbl);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(valueDbl != NULL);
|
ASSERT(valueDbl != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Make a copy of the value so it is not updated until we know the conversion will succeed
|
// Make a copy of the value so it is not updated until we know the conversion will succeed
|
||||||
String *result = strLower(strDup(*value));
|
String *result = strLower(strDup(*value));
|
||||||
@@ -181,7 +180,7 @@ convertToByte(String **value, double *valueDbl)
|
|||||||
else
|
else
|
||||||
THROW_FMT(FormatError, "value '%s' is not valid", strPtr(*value));
|
THROW_FMT(FormatError, "value '%s' is not valid", strPtr(*value));
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -219,17 +218,17 @@ cfgFileLoad( // NOTE: Pas
|
|||||||
const String *optConfigIncludePathDefault, // Current default for --config-include-path option
|
const String *optConfigIncludePathDefault, // Current default for --config-include-path option
|
||||||
const String *origConfigDefault) // Original --config option default (/etc/pgbackrest.conf)
|
const String *origConfigDefault) // Original --config option default (/etc/pgbackrest.conf)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM_PTR("ParseOption *", optionList);
|
FUNCTION_LOG_PARAM_PTR("ParseOption *", optionList);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, optConfigDefault);
|
FUNCTION_LOG_PARAM(STRING, optConfigDefault);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, optConfigIncludePathDefault);
|
FUNCTION_LOG_PARAM(STRING, optConfigIncludePathDefault);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, origConfigDefault);
|
FUNCTION_LOG_PARAM(STRING, origConfigDefault);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(optionList != NULL);
|
ASSERT(optionList != NULL);
|
||||||
FUNCTION_TEST_ASSERT(optConfigDefault != NULL);
|
ASSERT(optConfigDefault != NULL);
|
||||||
FUNCTION_TEST_ASSERT(optConfigIncludePathDefault != NULL);
|
ASSERT(optConfigIncludePathDefault != NULL);
|
||||||
FUNCTION_TEST_ASSERT(origConfigDefault != NULL);
|
ASSERT(origConfigDefault != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
bool loadConfig = true;
|
bool loadConfig = true;
|
||||||
bool loadConfigInclude = true;
|
bool loadConfigInclude = true;
|
||||||
@@ -357,7 +356,7 @@ cfgFileLoad( // NOTE: Pas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -369,10 +368,10 @@ logic to this critical path code.
|
|||||||
void
|
void
|
||||||
configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
|
configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, argListSize);
|
FUNCTION_LOG_PARAM(UINT, argListSize);
|
||||||
FUNCTION_DEBUG_PARAM(CHARPY, argList);
|
FUNCTION_LOG_PARAM(CHARPY, argList);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
// Initialize configuration
|
// Initialize configuration
|
||||||
cfgInit();
|
cfgInit();
|
||||||
@@ -459,7 +458,7 @@ configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
|
|||||||
bool reset = option & PARSE_RESET_FLAG;
|
bool reset = option & PARSE_RESET_FLAG;
|
||||||
|
|
||||||
// Make sure the option id is valid
|
// Make sure the option id is valid
|
||||||
ASSERT_DEBUG(optionId < CFG_OPTION_TOTAL);
|
ASSERT(optionId < CFG_OPTION_TOTAL);
|
||||||
|
|
||||||
// Error if this option is secure and cannot be passed on the command line
|
// Error if this option is secure and cannot be passed on the command line
|
||||||
if (cfgDefOptionSecure(cfgOptionDefIdFromId(optionId)))
|
if (cfgDefOptionSecure(cfgOptionDefIdFromId(optionId)))
|
||||||
@@ -567,7 +566,7 @@ configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
|
|||||||
{
|
{
|
||||||
// Find the first = char
|
// Find the first = char
|
||||||
const char *equalPtr = strchr(keyValue, '=');
|
const char *equalPtr = strchr(keyValue, '=');
|
||||||
ASSERT_DEBUG(equalPtr != NULL);
|
ASSERT(equalPtr != NULL);
|
||||||
|
|
||||||
// Get key and value
|
// Get key and value
|
||||||
String *key = strReplaceChr(
|
String *key = strReplaceChr(
|
||||||
@@ -1065,5 +1064,5 @@ configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Block Cipher
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/filter/filter.intern.h"
|
#include "common/io/filter/filter.intern.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -60,35 +59,35 @@ New block encrypt/decrypt object
|
|||||||
CipherBlock *
|
CipherBlock *
|
||||||
cipherBlockNew(CipherMode mode, CipherType cipherType, const Buffer *pass, const String *digestName)
|
cipherBlockNew(CipherMode mode, CipherType cipherType, const Buffer *pass, const String *digestName)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, mode);
|
FUNCTION_LOG_PARAM(ENUM, mode);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, pass);
|
FUNCTION_LOG_PARAM(BUFFER, pass);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, digestName);
|
FUNCTION_LOG_PARAM(STRING, digestName);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(cipherType == cipherTypeAes256Cbc);
|
ASSERT(cipherType == cipherTypeAes256Cbc);
|
||||||
FUNCTION_DEBUG_ASSERT(pass != NULL);
|
ASSERT(pass != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(bufSize(pass) > 0);
|
ASSERT(bufSize(pass) > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(
|
FUNCTION_LOG_RETURN(
|
||||||
CIPHER_BLOCK, cipherBlockNewC(mode, CIPHER_TYPE_AES_256_CBC, bufPtr(pass), bufSize(pass), strPtr(digestName)));
|
CIPHER_BLOCK, cipherBlockNewC(mode, CIPHER_TYPE_AES_256_CBC, bufPtr(pass), bufSize(pass), strPtr(digestName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CipherBlock *
|
CipherBlock *
|
||||||
cipherBlockNewC(CipherMode mode, const char *cipherName, const unsigned char *pass, size_t passSize, const char *digestName)
|
cipherBlockNewC(CipherMode mode, const char *cipherName, const unsigned char *pass, size_t passSize, const char *digestName)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, mode);
|
FUNCTION_LOG_PARAM(ENUM, mode);
|
||||||
FUNCTION_DEBUG_PARAM(STRINGZ, cipherName);
|
FUNCTION_LOG_PARAM(STRINGZ, cipherName);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, pass);
|
FUNCTION_LOG_PARAM(UCHARP, pass);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, passSize);
|
FUNCTION_LOG_PARAM(SIZE, passSize);
|
||||||
FUNCTION_DEBUG_PARAM(STRINGZ, digestName);
|
FUNCTION_LOG_PARAM(STRINGZ, digestName);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(cipherName != NULL);
|
ASSERT(cipherName != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(pass != NULL);
|
ASSERT(pass != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(passSize > 0);
|
ASSERT(passSize > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Only need to init once.
|
// Only need to init once.
|
||||||
if (!cryptoIsInit())
|
if (!cryptoIsInit())
|
||||||
@@ -141,7 +140,7 @@ cipherBlockNewC(CipherMode mode, const char *cipherName, const unsigned char *pa
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(CIPHER_BLOCK, this);
|
FUNCTION_LOG_RETURN(CIPHER_BLOCK, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -150,12 +149,12 @@ Determine how large the destination buffer should be
|
|||||||
size_t
|
size_t
|
||||||
cipherBlockProcessSizeC(CipherBlock *this, size_t sourceSize)
|
cipherBlockProcessSizeC(CipherBlock *this, size_t sourceSize)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_LOG_PARAM(CIPHER_BLOCK, this);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, sourceSize);
|
FUNCTION_LOG_PARAM(SIZE, sourceSize);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Destination size is source size plus one extra block
|
// Destination size is source size plus one extra block
|
||||||
size_t destinationSize = sourceSize + EVP_MAX_BLOCK_LENGTH;
|
size_t destinationSize = sourceSize + EVP_MAX_BLOCK_LENGTH;
|
||||||
@@ -164,7 +163,7 @@ cipherBlockProcessSizeC(CipherBlock *this, size_t sourceSize)
|
|||||||
if (this->mode == cipherModeEncrypt && !this->saltDone)
|
if (this->mode == cipherModeEncrypt && !this->saltDone)
|
||||||
destinationSize += CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN;
|
destinationSize += CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN;
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, destinationSize);
|
FUNCTION_LOG_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -173,16 +172,16 @@ Encrypt/decrypt data
|
|||||||
size_t
|
size_t
|
||||||
cipherBlockProcessC(CipherBlock *this, const unsigned char *source, size_t sourceSize, unsigned char *destination)
|
cipherBlockProcessC(CipherBlock *this, const unsigned char *source, size_t sourceSize, unsigned char *destination)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_LOG_PARAM(CIPHER_BLOCK, this);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, source);
|
FUNCTION_LOG_PARAM(UCHARP, source);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, sourceSize);
|
FUNCTION_LOG_PARAM(SIZE, sourceSize);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, destination);
|
FUNCTION_LOG_PARAM(UCHARP, destination);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(source != NULL || sourceSize == 0);
|
ASSERT(source != NULL || sourceSize == 0);
|
||||||
FUNCTION_DEBUG_ASSERT(destination != NULL);
|
ASSERT(destination != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Actual destination size
|
// Actual destination size
|
||||||
size_t destinationSize = 0;
|
size_t destinationSize = 0;
|
||||||
@@ -279,7 +278,7 @@ cipherBlockProcessC(CipherBlock *this, const unsigned char *source, size_t sourc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return actual destination size
|
// Return actual destination size
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, destinationSize);
|
FUNCTION_LOG_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -288,13 +287,13 @@ Flush the remaining data
|
|||||||
size_t
|
size_t
|
||||||
cipherBlockFlushC(CipherBlock *this, unsigned char *destination)
|
cipherBlockFlushC(CipherBlock *this, unsigned char *destination)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_LOG_PARAM(CIPHER_BLOCK, this);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, destination);
|
FUNCTION_LOG_PARAM(UCHARP, destination);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(destination != NULL);
|
ASSERT(destination != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Actual destination size
|
// Actual destination size
|
||||||
size_t destinationSize = 0;
|
size_t destinationSize = 0;
|
||||||
@@ -308,7 +307,7 @@ cipherBlockFlushC(CipherBlock *this, unsigned char *destination)
|
|||||||
THROW(CryptoError, "unable to flush");
|
THROW(CryptoError, "unable to flush");
|
||||||
|
|
||||||
// Return actual destination size
|
// Return actual destination size
|
||||||
FUNCTION_DEBUG_RESULT(SIZE, destinationSize);
|
FUNCTION_LOG_RETURN(SIZE, destinationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -317,15 +316,15 @@ Process function used by C filter
|
|||||||
void
|
void
|
||||||
cipherBlockProcess(CipherBlock *this, const Buffer *source, Buffer *destination)
|
cipherBlockProcess(CipherBlock *this, const Buffer *source, Buffer *destination)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_LOG_PARAM(CIPHER_BLOCK, this);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, source);
|
FUNCTION_LOG_PARAM(BUFFER, source);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, destination);
|
FUNCTION_LOG_PARAM(BUFFER, destination);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(destination != NULL);
|
ASSERT(destination != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(bufRemains(destination) > 0);
|
ASSERT(bufRemains(destination) > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Copy already buffered bytes
|
// Copy already buffered bytes
|
||||||
if (this->buffer != NULL && bufUsed(this->buffer) > 0)
|
if (this->buffer != NULL && bufUsed(this->buffer) > 0)
|
||||||
@@ -350,7 +349,7 @@ cipherBlockProcess(CipherBlock *this, const Buffer *source, Buffer *destination)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT_DEBUG(this->buffer == NULL || bufUsed(this->buffer) == 0);
|
ASSERT(this->buffer == NULL || bufUsed(this->buffer) == 0);
|
||||||
|
|
||||||
// Determine how much space is required in the output buffer
|
// Determine how much space is required in the output buffer
|
||||||
Buffer *outputActual = destination;
|
Buffer *outputActual = destination;
|
||||||
@@ -401,7 +400,7 @@ cipherBlockProcess(CipherBlock *this, const Buffer *source, Buffer *destination)
|
|||||||
cipherBlockProcess(this, source, destination);
|
cipherBlockProcess(this, source, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -412,11 +411,11 @@ cipherBlockDone(const CipherBlock *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->done && !this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->done && !this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -427,11 +426,11 @@ cipherBlockFilter(const CipherBlock *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(IO_FILTER, this->filter);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -442,11 +441,11 @@ cipherBlockInputSame(const CipherBlock *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_TEST_PARAM(CIPHER_BLOCK, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BOOL, this->inputSame);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BOOL, this->inputSame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -465,9 +464,9 @@ Free memory
|
|||||||
void
|
void
|
||||||
cipherBlockFree(CipherBlock *this)
|
cipherBlockFree(CipherBlock *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CIPHER_BLOCK, this);
|
FUNCTION_LOG_PARAM(CIPHER_BLOCK, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
{
|
{
|
||||||
@@ -480,5 +479,5 @@ cipherBlockFree(CipherBlock *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ Macros for function logging
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
String *cipherBlockToLog(const CipherBlock *this);
|
String *cipherBlockToLog(const CipherBlock *this);
|
||||||
|
|
||||||
#define FUNCTION_DEBUG_CIPHER_BLOCK_TYPE \
|
#define FUNCTION_LOG_CIPHER_BLOCK_TYPE \
|
||||||
CipherBlock *
|
CipherBlock *
|
||||||
#define FUNCTION_DEBUG_CIPHER_BLOCK_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CIPHER_BLOCK_FORMAT(value, buffer, bufferSize) \
|
||||||
FUNCTION_DEBUG_STRING_OBJECT_FORMAT(value, cipherBlockToLog, buffer, bufferSize)
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, cipherBlockToLog, buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ cryptoError(bool error, const char *description)
|
|||||||
if (error)
|
if (error)
|
||||||
cryptoErrorCode(ERR_get_error(), description);
|
cryptoErrorCode(ERR_get_error(), description);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -51,7 +51,7 @@ cryptoErrorCode(unsigned long code, const char *description)
|
|||||||
const char *errorMessage = ERR_reason_error_string(code);
|
const char *errorMessage = ERR_reason_error_string(code);
|
||||||
THROW_FMT(CryptoError, "%s: [%lu] %s", description, code, errorMessage == NULL ? "no details available" : errorMessage);
|
THROW_FMT(CryptoError, "%s: [%lu] %s", description, code, errorMessage == NULL ? "no details available" : errorMessage);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -62,10 +62,10 @@ cipherType(const String *name)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, name);
|
FUNCTION_TEST_PARAM(STRING, name);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(name != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(name != NULL);
|
||||||
|
|
||||||
CipherType result = cipherTypeNone;
|
CipherType result = cipherTypeNone;
|
||||||
|
|
||||||
if (strEq(name, CIPHER_TYPE_AES_256_CBC_STR))
|
if (strEq(name, CIPHER_TYPE_AES_256_CBC_STR))
|
||||||
@@ -73,7 +73,7 @@ cipherType(const String *name)
|
|||||||
else if (!strEq(name, CIPHER_TYPE_NONE_STR))
|
else if (!strEq(name, CIPHER_TYPE_NONE_STR))
|
||||||
THROW_FMT(AssertError, "invalid cipher name '%s'", strPtr(name));
|
THROW_FMT(AssertError, "invalid cipher name '%s'", strPtr(name));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(ENUM, result);
|
FUNCTION_TEST_RETURN(ENUM, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
const String *
|
const String *
|
||||||
@@ -90,7 +90,7 @@ cipherTypeName(CipherType type)
|
|||||||
else if (type != cipherTypeNone)
|
else if (type != cipherTypeNone)
|
||||||
THROW_FMT(AssertError, "invalid cipher type %u", type);
|
THROW_FMT(AssertError, "invalid cipher type %u", type);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_STRING, result);
|
FUNCTION_TEST_RETURN(CONST_STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -99,7 +99,7 @@ Initialize crypto
|
|||||||
void
|
void
|
||||||
cryptoInit(void)
|
cryptoInit(void)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_VOID(logLevelTrace);
|
FUNCTION_LOG_VOID(logLevelTrace);
|
||||||
|
|
||||||
if (!cryptoInitDone)
|
if (!cryptoInitDone)
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ cryptoInit(void)
|
|||||||
cryptoInitDone = true;
|
cryptoInitDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -130,7 +130,7 @@ bool
|
|||||||
cryptoIsInit(void)
|
cryptoIsInit(void)
|
||||||
{
|
{
|
||||||
FUNCTION_TEST_VOID();
|
FUNCTION_TEST_VOID();
|
||||||
FUNCTION_TEST_RESULT(BOOL, cryptoInitDone);
|
FUNCTION_TEST_RETURN(BOOL, cryptoInitDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -139,15 +139,15 @@ Generate random bytes
|
|||||||
void
|
void
|
||||||
cryptoRandomBytes(unsigned char *buffer, size_t size)
|
cryptoRandomBytes(unsigned char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, buffer);
|
FUNCTION_LOG_PARAM(UCHARP, buffer);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, size);
|
FUNCTION_LOG_PARAM(SIZE, size);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(buffer != NULL);
|
ASSERT(buffer != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(size > 0);
|
ASSERT(size > 0);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
RAND_bytes(buffer, (int)size);
|
RAND_bytes(buffer, (int)size);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ Cryptographic Hash
|
|||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/io/filter/filter.intern.h"
|
#include "common/io/filter/filter.intern.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@@ -46,11 +45,11 @@ New object
|
|||||||
CryptoHash *
|
CryptoHash *
|
||||||
cryptoHashNew(const String *type)
|
cryptoHashNew(const String *type)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, type);
|
FUNCTION_LOG_PARAM(STRING, type);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(type != NULL);
|
ASSERT(type != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
// Only need to init once
|
// Only need to init once
|
||||||
if (!cryptoIsInit())
|
if (!cryptoIsInit())
|
||||||
@@ -85,7 +84,7 @@ cryptoHashNew(const String *type)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(CRYPTO_HASH, this);
|
FUNCTION_LOG_RETURN(CRYPTO_HASH, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -94,19 +93,19 @@ Add message data to the hash
|
|||||||
void
|
void
|
||||||
cryptoHashProcessC(CryptoHash *this, const unsigned char *message, size_t messageSize)
|
cryptoHashProcessC(CryptoHash *this, const unsigned char *message, size_t messageSize)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CRYPTO_HASH, this);
|
FUNCTION_LOG_PARAM(CRYPTO_HASH, this);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, message);
|
FUNCTION_LOG_PARAM(UCHARP, message);
|
||||||
FUNCTION_DEBUG_PARAM(SIZE, messageSize);
|
FUNCTION_LOG_PARAM(SIZE, messageSize);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(this->hashContext != NULL);
|
ASSERT(this->hashContext != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(message != NULL);
|
ASSERT(message != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
cryptoError(!EVP_DigestUpdate(this->hashContext, message, messageSize), "unable to process message hash");
|
cryptoError(!EVP_DigestUpdate(this->hashContext, message, messageSize), "unable to process message hash");
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -118,14 +117,14 @@ cryptoHashProcess(CryptoHash *this, const Buffer *message)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CRYPTO_HASH, this);
|
FUNCTION_TEST_PARAM(CRYPTO_HASH, this);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, message);
|
FUNCTION_TEST_PARAM(BUFFER, message);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
|
||||||
cryptoHashProcessC(this, bufPtr(message), bufUsed(message));
|
cryptoHashProcessC(this, bufPtr(message), bufUsed(message));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -137,14 +136,14 @@ cryptoHashProcessStr(CryptoHash *this, const String *message)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(CRYPTO_HASH, this);
|
FUNCTION_TEST_PARAM(CRYPTO_HASH, this);
|
||||||
FUNCTION_TEST_PARAM(STRING, message);
|
FUNCTION_TEST_PARAM(STRING, message);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
|
||||||
cryptoHashProcessC(this, (const unsigned char *)strPtr(message), strSize(message));
|
cryptoHashProcessC(this, (const unsigned char *)strPtr(message), strSize(message));
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT_VOID();
|
FUNCTION_TEST_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -153,11 +152,11 @@ Get binary representation of the hash
|
|||||||
const Buffer *
|
const Buffer *
|
||||||
cryptoHash(CryptoHash *this)
|
cryptoHash(CryptoHash *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CRYPTO_HASH, this);
|
FUNCTION_LOG_PARAM(CRYPTO_HASH, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
if (this->hash == NULL)
|
if (this->hash == NULL)
|
||||||
{
|
{
|
||||||
@@ -174,7 +173,7 @@ cryptoHash(CryptoHash *this)
|
|||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BUFFER, this->hash);
|
FUNCTION_LOG_RETURN(BUFFER, this->hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -183,13 +182,13 @@ Get filter interface
|
|||||||
IoFilter *
|
IoFilter *
|
||||||
cryptoHashFilter(CryptoHash *this)
|
cryptoHashFilter(CryptoHash *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CRYPTO_HASH, this);
|
FUNCTION_LOG_PARAM(CRYPTO_HASH, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(IO_FILTER, this->filter);
|
FUNCTION_LOG_RETURN(IO_FILTER, this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -198,11 +197,11 @@ Get string representation of the hash as a filter result
|
|||||||
const Variant *
|
const Variant *
|
||||||
cryptoHashResult(CryptoHash *this)
|
cryptoHashResult(CryptoHash *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CRYPTO_HASH, this);
|
FUNCTION_LOG_PARAM(CRYPTO_HASH, this);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
Variant *result = NULL;
|
Variant *result = NULL;
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ cryptoHashResult(CryptoHash *this)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_END();
|
MEM_CONTEXT_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(VARIANT, result);
|
FUNCTION_LOG_RETURN(VARIANT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -221,9 +220,9 @@ Free memory
|
|||||||
void
|
void
|
||||||
cryptoHashFree(CryptoHash *this)
|
cryptoHashFree(CryptoHash *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(CRYPTO_HASH, this);
|
FUNCTION_LOG_PARAM(CRYPTO_HASH, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
{
|
{
|
||||||
@@ -233,7 +232,7 @@ cryptoHashFree(CryptoHash *this)
|
|||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -242,13 +241,13 @@ Get hash for one C buffer
|
|||||||
Buffer *
|
Buffer *
|
||||||
cryptoHashOneC(const String *type, const unsigned char *message, size_t messageSize)
|
cryptoHashOneC(const String *type, const unsigned char *message, size_t messageSize)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, type);
|
FUNCTION_LOG_PARAM(STRING, type);
|
||||||
FUNCTION_DEBUG_PARAM(UCHARP, message);
|
FUNCTION_LOG_PARAM(UCHARP, message);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(type != NULL);
|
ASSERT(type != NULL);
|
||||||
FUNCTION_DEBUG_ASSERT(message != NULL);
|
ASSERT(message != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
Buffer *result = NULL;
|
Buffer *result = NULL;
|
||||||
|
|
||||||
@@ -263,7 +262,7 @@ cryptoHashOneC(const String *type, const unsigned char *message, size_t messageS
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BUFFER, result);
|
FUNCTION_LOG_RETURN(BUFFER, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -275,12 +274,12 @@ cryptoHashOne(const String *type, Buffer *message)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, type);
|
FUNCTION_TEST_PARAM(STRING, type);
|
||||||
FUNCTION_TEST_PARAM(BUFFER, message);
|
FUNCTION_TEST_PARAM(BUFFER, message);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, cryptoHashOneC(type, bufPtr(message), bufSize(message)));
|
ASSERT(type != NULL);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BUFFER, cryptoHashOneC(type, bufPtr(message), bufSize(message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -292,12 +291,12 @@ cryptoHashOneStr(const String *type, String *message)
|
|||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(STRING, type);
|
FUNCTION_TEST_PARAM(STRING, type);
|
||||||
FUNCTION_TEST_PARAM(STRING, message);
|
FUNCTION_TEST_PARAM(STRING, message);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, cryptoHashOneC(type, (const unsigned char *)strPtr(message), strSize(message)));
|
ASSERT(type != NULL);
|
||||||
|
ASSERT(message != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(BUFFER, cryptoHashOneC(type, (const unsigned char *)strPtr(message), strSize(message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -306,15 +305,15 @@ Get hmac for one message/key
|
|||||||
Buffer *
|
Buffer *
|
||||||
cryptoHmacOne(const String *type, const Buffer *key, const Buffer *message)
|
cryptoHmacOne(const String *type, const Buffer *key, const Buffer *message)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, type);
|
FUNCTION_LOG_PARAM(STRING, type);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, key);
|
FUNCTION_LOG_PARAM(BUFFER, key);
|
||||||
FUNCTION_DEBUG_PARAM(BUFFER, message);
|
FUNCTION_LOG_PARAM(BUFFER, message);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(type != NULL);
|
ASSERT(type != NULL);
|
||||||
FUNCTION_TEST_ASSERT(key != NULL);
|
ASSERT(key != NULL);
|
||||||
FUNCTION_TEST_ASSERT(message != NULL);
|
ASSERT(message != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
const EVP_MD *hashType = EVP_get_digestbyname(strPtr(type));
|
const EVP_MD *hashType = EVP_get_digestbyname(strPtr(type));
|
||||||
ASSERT(hashType != NULL);
|
ASSERT(hashType != NULL);
|
||||||
@@ -325,5 +324,5 @@ cryptoHmacOne(const String *type, const Buffer *key, const Buffer *message)
|
|||||||
// Calculate the HMAC
|
// Calculate the HMAC
|
||||||
HMAC(hashType, bufPtr(key), (int)bufSize(key), bufPtr(message), bufSize(message), bufPtr(result), NULL);
|
HMAC(hashType, bufPtr(key), (int)bufSize(key), bufPtr(message), bufSize(message), bufPtr(result), NULL);
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(BUFFER, result);
|
FUNCTION_TEST_RETURN(BUFFER, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ Buffer *cryptoHmacOne(const String *type, const Buffer *key, const Buffer *messa
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_CRYPTO_HASH_TYPE \
|
#define FUNCTION_LOG_CRYPTO_HASH_TYPE \
|
||||||
CryptoHash *
|
CryptoHash *
|
||||||
#define FUNCTION_DEBUG_CRYPTO_HASH_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_CRYPTO_HASH_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "CryptoHash", buffer, bufferSize)
|
objToLog(value, "CryptoHash", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ infoHash(const Ini *ini)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INI, ini);
|
FUNCTION_TEST_PARAM(INI, ini);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(ini != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(ini != NULL);
|
||||||
|
|
||||||
CryptoHash *result = cryptoHashNew(HASH_TYPE_SHA1_STR);
|
CryptoHash *result = cryptoHashNew(HASH_TYPE_SHA1_STR);
|
||||||
|
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
@@ -104,7 +104,7 @@ infoHash(const Ini *ini)
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CRYPTO_HASH, result);
|
FUNCTION_TEST_RETURN(CRYPTO_HASH, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -113,15 +113,15 @@ Load and validate the info file (or copy)
|
|||||||
static bool
|
static bool
|
||||||
infoLoad(Info *this, const Storage *storage, bool copyFile, CipherType cipherType, const String *cipherPass)
|
infoLoad(Info *this, const Storage *storage, bool copyFile, CipherType cipherType, const String *cipherPass)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace)
|
FUNCTION_LOG_BEGIN(logLevelTrace)
|
||||||
FUNCTION_DEBUG_PARAM(INFO, this);
|
FUNCTION_LOG_PARAM(INFO, this);
|
||||||
FUNCTION_DEBUG_PARAM(STORAGE, storage);
|
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, copyFile); // Is this the copy file?
|
FUNCTION_LOG_PARAM(BOOL, copyFile); // Is this the copy file?
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
// cipherPass omitted for security
|
// cipherPass omitted for security
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ infoLoad(Info *this, const Storage *storage, bool copyFile, CipherType cipherTyp
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT(BOOL, result);
|
FUNCTION_LOG_RETURN(BOOL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -199,14 +199,14 @@ Load an Info object
|
|||||||
Info *
|
Info *
|
||||||
infoNew(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
infoNew(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STORAGE, storage);
|
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, fileName); // Full path/filename to load
|
FUNCTION_LOG_PARAM(STRING, fileName); // Full path/filename to load
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
// cipherPass omitted for security
|
// cipherPass omitted for security
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(fileName != NULL);
|
ASSERT(fileName != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
Info *this = NULL;
|
Info *this = NULL;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ infoNew(const Storage *storage, const String *fileName, CipherType cipherType, c
|
|||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
// Return buffer
|
// Return buffer
|
||||||
FUNCTION_DEBUG_RESULT(INFO, this);
|
FUNCTION_LOG_RETURN(INFO, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -275,11 +275,11 @@ infoCipherPass(const Info *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO, this);
|
FUNCTION_TEST_PARAM(INFO, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_STRING, this->cipherPass);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(CONST_STRING, this->cipherPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ini *
|
Ini *
|
||||||
@@ -287,11 +287,11 @@ infoIni(const Info *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO, this);
|
FUNCTION_TEST_PARAM(INFO, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INI, this->ini);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INI, this->ini);
|
||||||
}
|
}
|
||||||
|
|
||||||
String *
|
String *
|
||||||
@@ -299,11 +299,11 @@ infoFileName(const Info *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO, this);
|
FUNCTION_TEST_PARAM(INFO, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this->fileName);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, this->fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -312,12 +312,12 @@ Free the object
|
|||||||
void
|
void
|
||||||
infoFree(Info *this)
|
infoFree(Info *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INFO, this);
|
FUNCTION_LOG_PARAM(INFO, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ void infoFree(Info *this);
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Macros for function logging
|
Macros for function logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define FUNCTION_DEBUG_INFO_TYPE \
|
#define FUNCTION_LOG_INFO_TYPE \
|
||||||
Info *
|
Info *
|
||||||
#define FUNCTION_DEBUG_INFO_FORMAT(value, buffer, bufferSize) \
|
#define FUNCTION_LOG_INFO_FORMAT(value, buffer, bufferSize) \
|
||||||
objToLog(value, "Info", buffer, bufferSize)
|
objToLog(value, "Info", buffer, bufferSize)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ Create a new InfoArchive object
|
|||||||
InfoArchive *
|
InfoArchive *
|
||||||
infoArchiveNew(const Storage *storage, const String *fileName, bool ignoreMissing, CipherType cipherType, const String *cipherPass)
|
infoArchiveNew(const Storage *storage, const String *fileName, bool ignoreMissing, CipherType cipherType, const String *cipherPass)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_DEBUG_PARAM(STORAGE, storage);
|
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||||
FUNCTION_DEBUG_PARAM(STRING, fileName);
|
FUNCTION_LOG_PARAM(STRING, fileName);
|
||||||
FUNCTION_DEBUG_PARAM(BOOL, ignoreMissing);
|
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||||
FUNCTION_DEBUG_PARAM(ENUM, cipherType);
|
FUNCTION_LOG_PARAM(ENUM, cipherType);
|
||||||
// cipherPass omitted for security
|
// cipherPass omitted for security
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(fileName != NULL);
|
ASSERT(fileName != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
InfoArchive *this = NULL;
|
InfoArchive *this = NULL;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ infoArchiveNew(const Storage *storage, const String *fileName, bool ignoreMissin
|
|||||||
MEM_CONTEXT_NEW_END();
|
MEM_CONTEXT_NEW_END();
|
||||||
|
|
||||||
// Return buffer
|
// Return buffer
|
||||||
FUNCTION_DEBUG_RESULT(INFO_ARCHIVE, this);
|
FUNCTION_LOG_RETURN(INFO_ARCHIVE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -84,13 +84,13 @@ Checks the archive info file's DB section against the PG version and system id p
|
|||||||
void
|
void
|
||||||
infoArchiveCheckPg(const InfoArchive *this, unsigned int pgVersion, uint64_t pgSystemId)
|
infoArchiveCheckPg(const InfoArchive *this, unsigned int pgVersion, uint64_t pgSystemId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, pgVersion);
|
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||||
FUNCTION_DEBUG_PARAM(UINT64, pgSystemId);
|
FUNCTION_LOG_PARAM(UINT64, pgSystemId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *errorMsg = NULL;
|
String *errorMsg = NULL;
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ infoArchiveCheckPg(const InfoArchive *this, unsigned int pgVersion, uint64_t pgS
|
|||||||
THROW(ArchiveMismatchError, strPtr(errorMsg));
|
THROW(ArchiveMismatchError, strPtr(errorMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -127,14 +127,14 @@ const String *
|
|||||||
infoArchiveIdHistoryMatch(
|
infoArchiveIdHistoryMatch(
|
||||||
const InfoArchive *this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId)
|
const InfoArchive *this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, historyId);
|
FUNCTION_LOG_PARAM(UINT, historyId);
|
||||||
FUNCTION_DEBUG_PARAM(UINT, pgVersion);
|
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||||
FUNCTION_DEBUG_PARAM(UINT64, pgSystemId);
|
FUNCTION_LOG_PARAM(UINT64, pgSystemId);
|
||||||
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
FUNCTION_DEBUG_ASSERT(this != NULL);
|
ASSERT(this != NULL);
|
||||||
FUNCTION_DEBUG_END();
|
|
||||||
|
|
||||||
String *archiveId = NULL;
|
String *archiveId = NULL;
|
||||||
InfoPg *infoPg = infoArchivePg(this);
|
InfoPg *infoPg = infoArchivePg(this);
|
||||||
@@ -176,7 +176,7 @@ infoArchiveIdHistoryMatch(
|
|||||||
strPtr(pgVersionToStr(pgVersion)), pgSystemId);
|
strPtr(pgVersionToStr(pgVersion)), pgSystemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, archiveId);
|
FUNCTION_TEST_RETURN(STRING, archiveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -187,11 +187,11 @@ infoArchiveId(const InfoArchive *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(STRING, this->archiveId);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(STRING, this->archiveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -202,11 +202,11 @@ infoArchiveCipherPass(const InfoArchive *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(CONST_STRING, infoPgCipherPass(this->infoPg));
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(CONST_STRING, infoPgCipherPass(this->infoPg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -217,11 +217,11 @@ infoArchivePg(const InfoArchive *this)
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_BEGIN();
|
FUNCTION_TEST_BEGIN();
|
||||||
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_TEST_PARAM(INFO_ARCHIVE, this);
|
||||||
|
|
||||||
FUNCTION_TEST_ASSERT(this != NULL);
|
|
||||||
FUNCTION_TEST_END();
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
FUNCTION_TEST_RESULT(INFO_PG, this->infoPg);
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(INFO_PG, this->infoPg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@@ -230,12 +230,12 @@ Free the info
|
|||||||
void
|
void
|
||||||
infoArchiveFree(InfoArchive *this)
|
infoArchiveFree(InfoArchive *this)
|
||||||
{
|
{
|
||||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||||
FUNCTION_DEBUG_PARAM(INFO_ARCHIVE, this);
|
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||||
FUNCTION_DEBUG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
if (this != NULL)
|
if (this != NULL)
|
||||||
memContextFree(this->memContext);
|
memContextFree(this->memContext);
|
||||||
|
|
||||||
FUNCTION_DEBUG_RESULT_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user