From db678df196ccd8f9f6fb336706cf5701d1e53aa6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 13 Aug 2019 19:15:19 +0200 Subject: apt-pkg: default visibility to hidden --- apt-pkg/contrib/arfile.h | 6 +-- apt-pkg/contrib/cdromutl.h | 12 +++-- apt-pkg/contrib/cmndline.h | 2 +- apt-pkg/contrib/configuration.h | 8 +-- apt-pkg/contrib/error.h | 4 +- apt-pkg/contrib/extracttar.h | 2 +- apt-pkg/contrib/fileutl.h | 80 ++++++++++++++--------------- apt-pkg/contrib/gpgv.h | 6 +-- apt-pkg/contrib/hashes.h | 6 +-- apt-pkg/contrib/hashsum_template.h | 100 ------------------------------------ apt-pkg/contrib/netrc.h | 2 +- apt-pkg/contrib/progress.h | 4 +- apt-pkg/contrib/proxy.h | 2 +- apt-pkg/contrib/srvrec.h | 10 ++-- apt-pkg/contrib/strutl.h | 101 ++++++++++++++++++------------------- 15 files changed, 124 insertions(+), 221 deletions(-) delete mode 100644 apt-pkg/contrib/hashsum_template.h (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/arfile.h b/apt-pkg/contrib/arfile.h index acbe2c3f8..9b13ed921 100644 --- a/apt-pkg/contrib/arfile.h +++ b/apt-pkg/contrib/arfile.h @@ -19,7 +19,7 @@ class FileFd; -class ARArchive +class APT_PUBLIC ARArchive { struct MemberHeader; public: @@ -41,8 +41,8 @@ class ARArchive const Member *FindMember(const char *Name) const; inline Member *Members() { return List; } - explicit ARArchive(FileFd &File); - ~ARArchive(); + APT_PUBLIC explicit ARArchive(FileFd &File); + APT_PUBLIC ~ARArchive(); }; // A member of the archive diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h index d355a297e..1384cea9a 100644 --- a/apt-pkg/contrib/cdromutl.h +++ b/apt-pkg/contrib/cdromutl.h @@ -9,14 +9,16 @@ #ifndef PKGLIB_CDROMUTL_H #define PKGLIB_CDROMUTL_H +#include + #include // mount cdrom, DeviceName (e.g. /dev/sr0) is optional -bool MountCdrom(std::string Path, std::string DeviceName=""); -bool UnmountCdrom(std::string Path); -bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2); -bool IsMounted(std::string &Path); -std::string FindMountPointForDevice(const char *device); +APT_PUBLIC bool MountCdrom(std::string Path, std::string DeviceName=""); +APT_PUBLIC bool UnmountCdrom(std::string Path); +APT_PUBLIC bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2); +APT_PUBLIC bool IsMounted(std::string &Path); +APT_PUBLIC std::string FindMountPointForDevice(const char *device); #endif diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h index 28ea9119e..40d384f02 100644 --- a/apt-pkg/contrib/cmndline.h +++ b/apt-pkg/contrib/cmndline.h @@ -48,7 +48,7 @@ class Configuration; -class CommandLine +class APT_PUBLIC CommandLine { public: struct Args; diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 33cdfbfe9..6ebf28d03 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -36,7 +36,7 @@ #include -class Configuration +class APT_PUBLIC Configuration { public: @@ -139,13 +139,13 @@ class Configuration }; }; -extern Configuration *_config; +APT_PUBLIC extern Configuration *_config; -bool ReadConfigFile(Configuration &Conf,const std::string &FName, +APT_PUBLIC bool ReadConfigFile(Configuration &Conf,const std::string &FName, bool const &AsSectional = false, unsigned const &Depth = 0); -bool ReadConfigDir(Configuration &Conf,const std::string &Dir, +APT_PUBLIC bool ReadConfigDir(Configuration &Conf,const std::string &Dir, bool const &AsSectional = false, unsigned const &Depth = 0); diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 5ab7b9f85..1609b8702 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -48,7 +48,7 @@ #include #include -class GlobalError /*{{{*/ +class APT_PUBLIC GlobalError /*{{{*/ { public: /*{{{*/ /** \brief a message can have one of following severity */ @@ -359,7 +359,7 @@ private: /*{{{*/ /*}}}*/ // The 'extra-ansi' syntax is used to help with collisions. -GlobalError *_GetErrorObj(); +APT_PUBLIC GlobalError *_GetErrorObj(); static struct { inline GlobalError* operator ->() { return _GetErrorObj(); } } _error APT_UNUSED; diff --git a/apt-pkg/contrib/extracttar.h b/apt-pkg/contrib/extracttar.h index 8d4c17924..a3c862a72 100644 --- a/apt-pkg/contrib/extracttar.h +++ b/apt-pkg/contrib/extracttar.h @@ -21,7 +21,7 @@ class pkgDirStream; -class ExtractTar +class APT_PUBLIC ExtractTar { protected: diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index f80457cd3..dd16aa754 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -35,7 +35,7 @@ #define APT_HAS_GZIP 1 class FileFdPrivate; -class FileFd +class APT_PUBLIC FileFd { friend class FileFdPrivate; friend class GzipFileFdPrivate; @@ -174,29 +174,29 @@ class FileFd APT_HIDDEN bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; -bool RunScripts(const char *Cnf); -bool CopyFile(FileFd &From,FileFd &To); -bool RemoveFile(char const * const Function, std::string const &FileName); -bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); -int GetLock(std::string File,bool Errors = true); -bool FileExists(std::string File); -bool RealFileExists(std::string File); -bool DirectoryExists(std::string const &Path); -bool CreateDirectory(std::string const &Parent, std::string const &Path); -time_t GetModificationTime(std::string const &Path); -bool Rename(std::string From, std::string To); +APT_PUBLIC bool RunScripts(const char *Cnf); +APT_PUBLIC bool CopyFile(FileFd &From,FileFd &To); +APT_PUBLIC bool RemoveFile(char const * const Function, std::string const &FileName); +APT_PUBLIC bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); +APT_PUBLIC int GetLock(std::string File,bool Errors = true); +APT_PUBLIC bool FileExists(std::string File); +APT_PUBLIC bool RealFileExists(std::string File); +APT_PUBLIC bool DirectoryExists(std::string const &Path); +APT_PUBLIC bool CreateDirectory(std::string const &Parent, std::string const &Path); +APT_PUBLIC time_t GetModificationTime(std::string const &Path); +APT_PUBLIC bool Rename(std::string From, std::string To); -std::string GetTempDir(); -std::string GetTempDir(std::string const &User); -FileFd* GetTempFile(std::string const &Prefix = "", +APT_PUBLIC std::string GetTempDir(); +APT_PUBLIC std::string GetTempDir(std::string const &User); +APT_PUBLIC FileFd* GetTempFile(std::string const &Prefix = "", bool ImmediateUnlink = true, FileFd * const TmpFd = NULL); // FIXME: GetTempFile should always return a buffered file -FileFd* GetTempFile(std::string const &Prefix, +APT_HIDDEN FileFd* GetTempFile(std::string const &Prefix, bool ImmediateUnlink , FileFd * const TmpFd, - bool Buffered) APT_HIDDEN; + bool Buffered); /** \brief Ensure the existence of the given Path * @@ -204,24 +204,24 @@ FileFd* GetTempFile(std::string const &Prefix, * /apt/ will be removed before CreateDirectory call. * \param Path which should exist after (successful) call */ -bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path); +APT_PUBLIC bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path); -std::vector GetListOfFilesInDir(std::string const &Dir, std::string const &Ext, +APT_PUBLIC std::vector GetListOfFilesInDir(std::string const &Dir, std::string const &Ext, bool const &SortList, bool const &AllowNoExt=false); -std::vector GetListOfFilesInDir(std::string const &Dir, std::vector const &Ext, +APT_PUBLIC std::vector GetListOfFilesInDir(std::string const &Dir, std::vector const &Ext, bool const &SortList); -std::vector GetListOfFilesInDir(std::string const &Dir, bool SortList); -std::string SafeGetCWD(); -void SetCloseExec(int Fd,bool Close); -void SetNonBlock(int Fd,bool Block); -bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); -pid_t ExecFork(); -pid_t ExecFork(std::set keep_fds); -void MergeKeepFdsFromConfiguration(std::set &keep_fds); -bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); +APT_PUBLIC std::vector GetListOfFilesInDir(std::string const &Dir, bool SortList); +APT_PUBLIC std::string SafeGetCWD(); +APT_PUBLIC void SetCloseExec(int Fd,bool Close); +APT_PUBLIC void SetNonBlock(int Fd,bool Block); +APT_PUBLIC bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); +APT_PUBLIC pid_t ExecFork(); +APT_PUBLIC pid_t ExecFork(std::set keep_fds); +APT_PUBLIC void MergeKeepFdsFromConfiguration(std::set &keep_fds); +APT_PUBLIC bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); // check if the given file starts with a PGP cleartext signature -bool StartsWithGPGClearTextSignature(std::string const &FileName); +APT_PUBLIC bool StartsWithGPGClearTextSignature(std::string const &FileName); /** change file attributes to requested known good values * @@ -233,7 +233,7 @@ bool StartsWithGPGClearTextSignature(std::string const &FileName); * @param group is the (new) group owning the file, e.g. root * @param mode is the access mode of the file, e.g. 0644 */ -bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode); +APT_PUBLIC bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode); /** * \brief Drop privileges @@ -246,23 +246,23 @@ bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * c * * \return true on success, false on failure with _error set */ -bool DropPrivileges(); +APT_PUBLIC bool DropPrivileges(); // File string manipulators -std::string flNotDir(std::string File); -std::string flNotFile(std::string File); -std::string flNoLink(std::string File); -std::string flExtension(std::string File); -std::string flCombine(std::string Dir,std::string File); +APT_PUBLIC std::string flNotDir(std::string File); +APT_PUBLIC std::string flNotFile(std::string File); +APT_PUBLIC std::string flNoLink(std::string File); +APT_PUBLIC std::string flExtension(std::string File); +APT_PUBLIC std::string flCombine(std::string Dir,std::string File); /** \brief Takes a file path and returns the absolute path */ -std::string flAbsPath(std::string File); +APT_PUBLIC std::string flAbsPath(std::string File); /** \brief removes superfluous /./ and // from path */ APT_HIDDEN std::string flNormalize(std::string file); // simple c++ glob -std::vector Glob(std::string const &pattern, int flags=0); +APT_PUBLIC std::vector Glob(std::string const &pattern, int flags=0); /** \brief Popen() implementation that execv() instead of using a shell * @@ -276,7 +276,7 @@ std::vector Glob(std::string const &pattern, int flags=0); * \param Sandbox True if this should run sandboxed * \return true on success, false on failure with _error set */ -bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr = true, bool Sandbox = false); +APT_PUBLIC bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr = true, bool Sandbox = false); APT_HIDDEN bool OpenConfigurationFileFd(std::string const &File, FileFd &Fd); diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 4d48e2914..1cabed4e6 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -39,7 +39,7 @@ class FileFd; * @param fd is used as a pipe for the standard output of gpgv * @param key is the specific one to be used instead of using all */ -void ExecGPGV(std::string const &File, std::string const &FileSig, +APT_PUBLIC void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd, int fd[2], std::string const &Key = "") APT_NORETURN; inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { @@ -70,7 +70,7 @@ inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &Fi * @param SignatureFile is the FileFd all signatures will be written to * @return true if the splitting was successful, false otherwise */ -bool SplitClearSignedFile(std::string const &InFile, FileFd * const ContentFile, +APT_PUBLIC bool SplitClearSignedFile(std::string const &InFile, FileFd * const ContentFile, std::vector * const ContentHeader, FileFd * const SignatureFile); /** \brief open a file which might be clear-signed @@ -84,6 +84,6 @@ bool SplitClearSignedFile(std::string const &InFile, FileFd * const ContentFile, * @param[out] MessageFile is the FileFd in which the file will be opened * @return true if opening was successful, otherwise false */ -bool OpenMaybeClearSignedFile(std::string const &ClearSignedFileName, FileFd &MessageFile); +APT_PUBLIC bool OpenMaybeClearSignedFile(std::string const &ClearSignedFileName, FileFd &MessageFile); #endif diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index e2a9927ef..422c1e023 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -24,7 +24,7 @@ class FileFd; // helper class that contains hash function name // and hash -class HashString +class APT_PUBLIC HashString { protected: std::string Type; @@ -61,7 +61,7 @@ class HashString static APT_PURE const char** SupportedHashes(); }; -class HashStringList +class APT_PUBLIC HashStringList { public: /** find best hash if no specific one is requested @@ -166,7 +166,7 @@ class HashStringList }; class PrivateHashes; -class Hashes +class APT_PUBLIC Hashes { PrivateHashes * const d; public: diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h deleted file mode 100644 index 61b047465..000000000 --- a/apt-pkg/contrib/hashsum_template.h +++ /dev/null @@ -1,100 +0,0 @@ -// -*- mode: cpp; mode: fold -*- -// Description /*{{{*/ -/* ###################################################################### - - HashSumValueTemplate - Generic Storage for a hash value - - ##################################################################### */ - /*}}}*/ -#ifndef APTPKG_HASHSUM_TEMPLATE_H -#define APTPKG_HASHSUM_TEMPLATE_H - -#include -#include -#include - -#include - - -class FileFd; - -template -class HashSumValue -{ - unsigned char Sum[N/8]; - - public: - - // Accessors - bool operator ==(const HashSumValue &rhs) const - { - return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0; - } - bool operator !=(const HashSumValue &rhs) const - { - return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0; - } - - std::string Value() const - { - char Conv[16] = - { '0','1','2','3','4','5','6','7','8','9','a','b', - 'c','d','e','f' - }; - char Result[((N/8)*2)+1]; - Result[(N/8)*2] = 0; - - // Convert each char into two letters - int J = 0; - int I = 0; - for (; I != (N/8)*2; J++,I += 2) - { - Result[I] = Conv[Sum[J] >> 4]; - Result[I + 1] = Conv[Sum[J] & 0xF]; - } - return std::string(Result); - } - - inline void Value(unsigned char S[N/8]) - { - for (int I = 0; I != sizeof(Sum); ++I) - S[I] = Sum[I]; - } - - inline operator std::string() const - { - return Value(); - } - - bool Set(APT::StringView Str) - { - return Hex2Num(Str,Sum,sizeof(Sum)); - } - inline void Set(unsigned char S[N/8]) - { - for (int I = 0; I != sizeof(Sum); ++I) - Sum[I] = S[I]; - } - - explicit HashSumValue(std::string const &Str) - { - memset(Sum,0,sizeof(Sum)); - Set(Str); - } - explicit HashSumValue(APT::StringView const &Str) - { - memset(Sum,0,sizeof(Sum)); - Set(Str); - } - APT_HIDDEN explicit HashSumValue(const char *Str) - { - memset(Sum,0,sizeof(Sum)); - Set(Str); - } - HashSumValue() - { - memset(Sum,0,sizeof(Sum)); - } -}; - -#endif diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h index b13f18187..444397900 100644 --- a/apt-pkg/contrib/netrc.h +++ b/apt-pkg/contrib/netrc.h @@ -22,5 +22,5 @@ class URI; class FileFd; -bool MaybeAddAuth(FileFd &NetRCFile, URI &Uri); +APT_PUBLIC bool MaybeAddAuth(FileFd &NetRCFile, URI &Uri); #endif diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h index 850d009fa..4d118ee99 100644 --- a/apt-pkg/contrib/progress.h +++ b/apt-pkg/contrib/progress.h @@ -26,7 +26,7 @@ class Configuration; -class OpProgress +class APT_PUBLIC OpProgress { unsigned long long Current; unsigned long long Total; @@ -62,7 +62,7 @@ class OpProgress virtual ~OpProgress() {}; }; -class OpTextProgress : public OpProgress +class APT_PUBLIC OpTextProgress : public OpProgress { protected: diff --git a/apt-pkg/contrib/proxy.h b/apt-pkg/contrib/proxy.h index 2cbcd07b4..f6d70ea8b 100644 --- a/apt-pkg/contrib/proxy.h +++ b/apt-pkg/contrib/proxy.h @@ -10,7 +10,7 @@ #define PKGLIB_PROXY_H class URI; -bool AutoDetectProxy(URI &URL); +APT_PUBLIC bool AutoDetectProxy(URI &URL); #endif diff --git a/apt-pkg/contrib/srvrec.h b/apt-pkg/contrib/srvrec.h index e22b7a1c6..e5d0f43a3 100644 --- a/apt-pkg/contrib/srvrec.h +++ b/apt-pkg/contrib/srvrec.h @@ -13,7 +13,9 @@ #include #include -class SrvRec +#include + +class APT_PUBLIC SrvRec { public: std::string target; @@ -40,15 +42,15 @@ class SrvRec /** \brief Get SRV records from host/port (builds the query string internally) */ -bool GetSrvRecords(std::string name, std::vector &Result); +APT_PUBLIC bool GetSrvRecords(std::string name, std::vector &Result); /** \brief Get SRV records for query string like: _http._tcp.example.com */ -bool GetSrvRecords(std::string host, int port, std::vector &Result); +APT_PUBLIC bool GetSrvRecords(std::string host, int port, std::vector &Result); /** \brief Pop a single SRV record from the vector of SrvRec taking * priority and weight into account */ -SrvRec PopFromSrvRecs(std::vector &Recs); +APT_PUBLIC SrvRec PopFromSrvRecs(std::vector &Recs); #endif diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 56487b60f..c25c6208a 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -29,35 +29,34 @@ namespace APT { namespace String { - std::string Strip(const std::string &s); - bool Endswith(const std::string &s, const std::string &ending); - bool Startswith(const std::string &s, const std::string &starting); - std::string Join(std::vector list, const std::string &sep); + APT_PUBLIC std::string Strip(const std::string &s); + APT_PUBLIC bool Endswith(const std::string &s, const std::string &ending); + APT_PUBLIC bool Startswith(const std::string &s, const std::string &starting); + APT_PUBLIC std::string Join(std::vector list, const std::string &sep); // Returns string display length honoring multi-byte characters - size_t DisplayLength(StringView str); - + APT_PUBLIC size_t DisplayLength(StringView str); } } -bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); -char *_strstrip(char *String); -char *_strrstrip(char *String); // right strip only -char *_strtabexpand(char *String,size_t Len); -bool ParseQuoteWord(const char *&String,std::string &Res); -bool ParseCWord(const char *&String,std::string &Res); -std::string QuoteString(const std::string &Str,const char *Bad); -std::string DeQuoteString(const std::string &Str); -std::string DeQuoteString(std::string::const_iterator const &begin, std::string::const_iterator const &end); +APT_PUBLIC bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); +APT_PUBLIC char *_strstrip(char *String); +APT_PUBLIC char *_strrstrip(char *String); // right strip only +APT_PUBLIC char *_strtabexpand(char *String,size_t Len); +APT_PUBLIC bool ParseQuoteWord(const char *&String,std::string &Res); +APT_PUBLIC bool ParseCWord(const char *&String,std::string &Res); +APT_PUBLIC std::string QuoteString(const std::string &Str,const char *Bad); +APT_PUBLIC std::string DeQuoteString(const std::string &Str); +APT_PUBLIC std::string DeQuoteString(std::string::const_iterator const &begin, std::string::const_iterator const &end); // unescape (\0XX and \xXX) from a string -std::string DeEscapeString(const std::string &input); +APT_PUBLIC std::string DeEscapeString(const std::string &input); -std::string SizeToStr(double Bytes); -std::string TimeToStr(unsigned long Sec); -std::string Base64Encode(const std::string &Str); -std::string OutputInDepth(const unsigned long Depth, const char* Separator=" "); -std::string URItoFileName(const std::string &URI); +APT_PUBLIC std::string SizeToStr(double Bytes); +APT_PUBLIC std::string TimeToStr(unsigned long Sec); +APT_PUBLIC std::string Base64Encode(const std::string &Str); +APT_PUBLIC std::string OutputInDepth(const unsigned long Depth, const char* Separator=" "); +APT_PUBLIC std::string URItoFileName(const std::string &URI); /** returns a datetime string as needed by HTTP/1.1 and Debian files. * * Note: The date will always be represented in a UTC timezone @@ -67,7 +66,7 @@ std::string URItoFileName(const std::string &URI); * of GMT as timezone instead. \b true means that the timezone should be denoted * as "+0000" while \b false uses "GMT". */ -std::string TimeRFC1123(time_t Date, bool const NumericTimezone); +APT_PUBLIC std::string TimeRFC1123(time_t Date, bool const NumericTimezone); /** parses time as needed by HTTP/1.1 and Debian files. * * HTTP/1.1 prefers dates in RFC1123 format (but the other two obsolete date formats @@ -83,22 +82,22 @@ std::string TimeRFC1123(time_t Date, bool const NumericTimezone); * parsing is successful, undefined otherwise. * @return \b true if parsing was successful, otherwise \b false. */ -bool RFC1123StrToTime(const std::string &str,time_t &time) APT_MUSTCHECK; -bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK; -std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0); -int StringToBool(const std::string &Text,int Default = -1); -bool ReadMessages(int Fd, std::vector &List); -bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0); -bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0); -bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len); -bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len); -bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length); +APT_PUBLIC bool RFC1123StrToTime(const std::string &str,time_t &time) APT_MUSTCHECK; +APT_PUBLIC bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK; +APT_PUBLIC std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0); +APT_PUBLIC int StringToBool(const std::string &Text,int Default = -1); +APT_PUBLIC bool ReadMessages(int Fd, std::vector &List); +APT_PUBLIC bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0); +APT_PUBLIC bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0); +APT_PUBLIC bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len); +APT_PUBLIC bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len); +APT_PUBLIC bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length); // input changing string split -bool TokSplitString(char Tok,char *Input,char **List, +APT_PUBLIC bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); // split a given string by a char -std::vector VectorizeString(std::string const &haystack, char const &split) APT_PURE; +APT_PUBLIC std::vector VectorizeString(std::string const &haystack, char const &split) APT_PURE; /* \brief Return a vector of strings from string "input" where "sep" * is used as the delimiter string. @@ -114,14 +113,14 @@ std::vector VectorizeString(std::string const &haystack, char const * if used the string is only split on maxsplit places and the last * item in the vector contains the remainder string. */ -std::vector StringSplit(std::string const &input, +APT_PUBLIC std::vector StringSplit(std::string const &input, std::string const &sep, unsigned int maxsplit=std::numeric_limits::max()) APT_PURE; -void ioprintf(std::ostream &out,const char *format,...) APT_PRINTF(2); -void strprintf(std::string &out,const char *format,...) APT_PRINTF(2); -char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_PRINTF(3); -bool CheckDomainList(const std::string &Host, const std::string &List); +APT_PUBLIC void ioprintf(std::ostream &out,const char *format,...) APT_PRINTF(2); +APT_PUBLIC void strprintf(std::string &out,const char *format,...) APT_PRINTF(2); +APT_PUBLIC char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_PRINTF(3); +APT_PUBLIC bool CheckDomainList(const std::string &Host, const std::string &List); /* Do some compat mumbo jumbo */ #define tolower_ascii tolower_ascii_inline @@ -144,7 +143,7 @@ static inline int isspace_ascii_inline(int const c) return (c >= 9 && c <= 13) || c == ' '; } -std::string StripEpoch(const std::string &VerStr); +APT_PUBLIC std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ inline APT_PURE int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ @@ -159,20 +158,20 @@ inline APT_PURE int name(const std::string& A,const char *B) {return func(A.begi inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} -int APT_PURE stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); -int APT_PURE stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +APT_PUBLIC int APT_PURE stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +APT_PUBLIC int APT_PURE stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); /* We assume that GCC 3 indicates that libstdc++3 is in use too. In that case the definition of string::const_iterator is not the same as const char * and we need these extra functions */ #if __GNUC__ >= 3 -int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +APT_PUBLIC int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +APT_PUBLIC int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +APT_PUBLIC int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +APT_PUBLIC int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); inline APT_PURE int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} @@ -183,12 +182,12 @@ APT_MKSTRCMP2(stringcmp,stringcmp) APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array -size_t APT_PURE strv_length(const char **str_array); +APT_PUBLIC size_t APT_PURE strv_length(const char **str_array); inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} -class URI +class APT_PUBLIC URI { void CopyFrom(const std::string &From); @@ -217,8 +216,8 @@ struct SubstVar const char *Subst; const std::string *Contents; }; -std::string SubstVar(std::string Str,const struct SubstVar *Vars); -std::string SubstVar(const std::string &Str,const std::string &Subst,const std::string &Contents); +APT_PUBLIC std::string SubstVar(std::string Str,const struct SubstVar *Vars); +APT_PUBLIC std::string SubstVar(const std::string &Str,const std::string &Subst,const std::string &Contents); struct RxChoiceList { @@ -226,7 +225,7 @@ struct RxChoiceList const char *Str; bool Hit; }; -unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, +APT_PUBLIC unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, const char **ListEnd); #endif -- cgit v1.2.3