From fef93ed3b48c76d34f8ee75f965021fee250d44e Mon Sep 17 00:00:00 2001 From: kelson42 Date: Mon, 5 Apr 2010 20:56:18 +0000 Subject: [PATCH] + fix --- src/zimlib/include/zim/endian.h | 1 + src/zimlib/include/zim/file.h | 5 +++- src/zimlib/include/zim/unicode.h | 2 +- src/zimlib/include/zim/zim.h | 44 +++++++++++++++++++++++--------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/zimlib/include/zim/endian.h b/src/zimlib/include/zim/endian.h index 79cc6b7..ad2b238 100644 --- a/src/zimlib/include/zim/endian.h +++ b/src/zimlib/include/zim/endian.h @@ -22,6 +22,7 @@ #include #include +#include /// Returns true, if machine is big-endian (high byte first). /// e.g. PowerPC diff --git a/src/zimlib/include/zim/file.h b/src/zimlib/include/zim/file.h index 3dd6a6b..cb28d76 100644 --- a/src/zimlib/include/zim/file.h +++ b/src/zimlib/include/zim/file.h @@ -51,6 +51,7 @@ namespace zim Article getArticle(size_type idx) const; Article getArticle(char ns, const std::string& url); + Article getArticleByUrl(const std::string& url); Article getArticleByTitle(size_type idx); Article getArticleByTitle(char ns, const std::string& title); @@ -77,10 +78,12 @@ namespace zim const_iterator begin(); const_iterator beginByTitle(); const_iterator end(); - std::pair findxByTitle(char ns, const std::string& title); std::pair findx(char ns, const std::string& url); + std::pair findx(const std::string& url); + std::pair findxByTitle(char ns, const std::string& title); const_iterator findByTitle(char ns, const std::string& title); const_iterator find(char ns, const std::string& url); + const_iterator find(const std::string& url); bool good() const { return impl.getPointer() != 0; } time_t getMTime() const { return impl->getMTime(); } diff --git a/src/zimlib/include/zim/unicode.h b/src/zimlib/include/zim/unicode.h index baf218b..c3e80e5 100644 --- a/src/zimlib/include/zim/unicode.h +++ b/src/zimlib/include/zim/unicode.h @@ -18,7 +18,7 @@ */ #include -#include +#include namespace zim { diff --git a/src/zimlib/include/zim/zim.h b/src/zimlib/include/zim/zim.h index edff32d..dc9b0fd 100644 --- a/src/zimlib/include/zim/zim.h +++ b/src/zimlib/include/zim/zim.h @@ -24,17 +24,27 @@ namespace zim { +// define 8 bit integer types +// + typedef unsigned char uint8_t; + typedef char int8_t; + +// define 16 bit integer types +// #if USHRT_MAX == 0xffff - typedef unsigned short uint16_t; + typedef unsigned short uint16_t; + typedef short int16_t; #elif UINT_MAX == 0xffff - typedef unsigned int uint16_t; + typedef unsigned int uint16_t; + typedef int int16_t; #elif ULONG_MAX == 0xffff - typedef unsigned long uint16_t; + typedef unsigned long uint16_t; + typedef long int16_t; #else @@ -45,17 +55,22 @@ namespace zim #endif +// define 32 bit integer types +// #if USHRT_MAX == 0xffffffffUL - typedef unsigned short size_type; + typedef unsigned short uint32_t; + typedef short int32_t; #elif UINT_MAX == 0xffffffffUL - typedef unsigned int size_type; + typedef unsigned int uint32_t; + typedef int int32_t; #elif ULONG_MAX == 0xffffffffUL - typedef unsigned long size_type; + typedef unsigned long uint32_t; + typedef long int32_t; #else @@ -63,21 +78,25 @@ namespace zim #include namespace zim { - typedef uint32_t size_type; #endif +// define 64 bit integer types +// #if UINT_MAX == 18446744073709551615ULL - typedef unsigned int offset_type; + typedef unsigned int uint64_t; + typedef int int64_t; #elif ULONG_MAX == 18446744073709551615ULL - typedef unsigned long offset_type; + typedef unsigned long uint64_t; + typedef long int64_t; #elif ULLONG_MAX == 18446744073709551615ULL - typedef unsigned long long offset_type; + typedef unsigned long long uint64_t; + typedef long long int64_t; #else @@ -85,10 +104,11 @@ namespace zim #include namespace zim { - typedef uint64_t offset_type; - #endif + typedef uint32_t size_type; + typedef uint64_t offset_type; + enum CompressionType { zimcompDefault,