diff --git a/src/index/fsindexer.h b/src/index/fsindexer.h index e6ef0101..bcf218c2 100644 --- a/src/index/fsindexer.h +++ b/src/index/fsindexer.h @@ -27,7 +27,6 @@ #endif // IDX_THREADS class FIMissingStore; -struct PathStat; class DbUpdTask; class InternfileTask; diff --git a/src/index/mimetype.h b/src/index/mimetype.h index 419c95fd..7868fb5e 100644 --- a/src/index/mimetype.h +++ b/src/index/mimetype.h @@ -19,8 +19,9 @@ #include +#include "pathut.h" + class RclConfig; -struct PathStat; /** * Try to determine a mime type for file. diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index 5f87876c..aec272a5 100644 --- a/src/internfile/internfile.h +++ b/src/internfile/internfile.h @@ -37,7 +37,6 @@ class Doc; } class Uncomp; -struct PathStat; /** Storage for missing helper program info. We want to keep this out of the * FileInterner class, because the data will typically be accumulated by several diff --git a/src/utils/appformime.cpp b/src/utils/appformime.cpp index 6aa6f5ff..94e7bbd2 100644 --- a/src/utils/appformime.cpp +++ b/src/utils/appformime.cpp @@ -39,7 +39,6 @@ public: DesktopDb::AppMap *m_appdefs; }; -struct PathStat; FsTreeWalker::Status FstCb::processone( const string& fn, const struct PathStat*, FsTreeWalker::CbFlag flg) { diff --git a/src/utils/fstreewalk.h b/src/utils/fstreewalk.h index 90778ec0..0f8cb001 100644 --- a/src/utils/fstreewalk.h +++ b/src/utils/fstreewalk.h @@ -20,7 +20,7 @@ #include #include -struct PathStat; +#include "pathut.h" class FsTreeWalkerCB; diff --git a/src/utils/md5.cpp b/src/utils/md5.cpp index f4bab2cd..24ce25e5 100644 --- a/src/utils/md5.cpp +++ b/src/utils/md5.cpp @@ -28,6 +28,8 @@ #include #include +namespace MedocUtils { + #define PUT_BIT_LE(i, cp, value) do { \ (cp)[i] = uint8_t(((value) >> 8 * i) & 0xFF); \ } while (0) @@ -306,3 +308,5 @@ string& MD5HexScan(const string& xdigest, string& digest) } return digest; } + +} // End namespace MedocUtils diff --git a/src/utils/md5.h b/src/utils/md5.h index 6f86440e..35a89b6b 100644 --- a/src/utils/md5.h +++ b/src/utils/md5.h @@ -17,6 +17,9 @@ #include #include +#include + +namespace MedocUtils { #define MD5_BLOCK_LENGTH 64 #define MD5_DIGEST_LENGTH 16 @@ -33,10 +36,14 @@ void MD5Final(uint8_t [MD5_DIGEST_LENGTH], MD5_CTX *); void MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH]); /** md5 c++ utility wrappers */ -#include extern void MD5Final(std::string& digest, MD5_CTX *); extern std::string& MD5String(const std::string& data, std::string& digest); extern std::string& MD5HexPrint(const std::string& digest, std::string& out); extern std::string& MD5HexScan(const std::string& xdigest, std::string& digest); extern std::string MD5Hex(const std::string& data); + +} // End namespace MedocUtils + +using namespace MedocUtils; + #endif /* _MD5_H_ */ diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index e8f22b4f..9874c92b 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2019 J.F.Dockes +/* Copyright (C) 2004-2022 J.F.Dockes * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or @@ -189,6 +189,7 @@ using namespace std; #define PATHUT_SSIZE_T ssize_t #endif +namespace MedocUtils { #ifdef _WIN32 @@ -1643,3 +1644,5 @@ void pathut_init_mt() { path_home(); } + +} // End namespace MedocUtils diff --git a/src/utils/pathut.h b/src/utils/pathut.h index a6b29b43..17cf3172 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 J.F.Dockes +/* Copyright (C) 2004-2022 J.F.Dockes * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or @@ -22,6 +22,13 @@ #include #include #include +#include + +#ifndef _WIN32 +#include +#endif + +namespace MedocUtils { // Must be called in main thread before starting other threads extern void pathut_init_mt(); @@ -99,7 +106,6 @@ bool path_readable(const std::string& path); // Conversion between utf-8 and wide char file names. -#include bool wchartoutf8(const wchar_t *in, std::string& out, size_t len = 0); std::string wchartoutf8(const wchar_t *in, size_t len = 0); bool utf8towchar(const std::string& in, wchar_t *out, size_t obytescap); @@ -113,7 +119,6 @@ extern std::string path_shortpath(const std::string& path); #else // !_WIN32 -> -#include #define path_shortpath(path) (path) #ifndef O_BINARY #define O_BINARY 0 @@ -271,4 +276,8 @@ private: int flopen(); }; +} // End namespace MedocUtils + +using namespace MedocUtils; + #endif /* _PATHUT_H_INCLUDED_ */ diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 9d800191..2fe7c963 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2020 J.F.Dockes +/* Copyright (C) 2006-2022 J.F.Dockes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -53,6 +53,8 @@ using namespace std; +namespace MedocUtils { + int stringicmp(const string& s1, const string& s2) { return strcasecmp(s1.c_str(), s2.c_str()); @@ -1352,3 +1354,5 @@ string valToString(const vector& flags, unsigned int val) void smallut_init_mt() { } + +} // End namespace MedocUtils diff --git a/src/utils/smallut.h b/src/utils/smallut.h index b3cd499a..50c8b003 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2016 J.F.Dockes +/* Copyright (C) 2006-2022 J.F.Dockes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,10 @@ #include #include +struct tm; + +namespace MedocUtils { + // Miscellaneous mostly string-oriented small utilities // Note that none of the following code knows about utf-8. @@ -206,7 +210,6 @@ void catstrerror(std::string *reason, const char *what, int _errno); /** Portable timegm. MS C has _mkgmtime, but there is a bug in Gminw which * makes it inaccessible */ -struct tm; time_t portable_timegm(struct tm *tm); inline void leftzeropad(std::string& s, unsigned len) @@ -275,4 +278,8 @@ extern std::string flagsToString(const std::vector&, /// Translate a value into a name extern std::string valToString(const std::vector&, unsigned int val); +} // End namespace MedocUtils + +using namespace MedocUtils; + #endif /* _SMALLUT_H_INCLUDED_ */