diff options
| author | Vincent Richard <[email protected]> | 2015-02-17 21:12:20 +0000 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2015-02-17 21:12:20 +0000 |
| commit | 52e5d74becd6ec100718be177bb60d12d80a774d (patch) | |
| tree | 42fcc9227e038266a6e5bbbc1e908a8ddce2a258 /src | |
| parent | Skip word on unexpected error when fixing broken words. (diff) | |
| download | vmime-52e5d74becd6ec100718be177bb60d12d80a774d.tar.gz vmime-52e5d74becd6ec100718be177bb60d12d80a774d.zip | |
Made word/parameter constructor with 'string' explicit to avoid implicit use of default charset.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vmime/parameter.hpp | 2 | ||||
| -rw-r--r-- | src/vmime/platforms/posix/posixFile.cpp | 12 | ||||
| -rw-r--r-- | src/vmime/platforms/windows/windowsFile.cpp | 12 | ||||
| -rw-r--r-- | src/vmime/word.hpp | 26 |
4 files changed, 46 insertions, 6 deletions
diff --git a/src/vmime/parameter.hpp b/src/vmime/parameter.hpp index 682c391b..a97408b9 100644 --- a/src/vmime/parameter.hpp +++ b/src/vmime/parameter.hpp @@ -44,7 +44,7 @@ private: public: - parameter(const string& name); + explicit parameter(const string& name); parameter(const string& name, const word& value); parameter(const string& name, const string& value); diff --git a/src/vmime/platforms/posix/posixFile.cpp b/src/vmime/platforms/posix/posixFile.cpp index 9387414d..9093b52e 100644 --- a/src/vmime/platforms/posix/posixFile.cpp +++ b/src/vmime/platforms/posix/posixFile.cpp @@ -537,14 +537,22 @@ const vmime::utility::file::path posixFileSystemFactory::stringToPathImpl(const while ((offset = str.find_first_of("/", offset)) != vmime::string::npos) { if (offset != prev) - path.appendComponent(vmime::string(str.begin() + prev, str.begin() + offset)); + { + path.appendComponent + (vmime::utility::file::path::component + (vmime::string(str.begin() + prev, str.begin() + offset))); + } prev = offset + 1; offset++; } if (prev < str.length()) - path.appendComponent(vmime::string(str.begin() + prev, str.end())); + { + path.appendComponent + (vmime::utility::file::path::component + (vmime::string(str.begin() + prev, str.end()))); + } return (path); } diff --git a/src/vmime/platforms/windows/windowsFile.cpp b/src/vmime/platforms/windows/windowsFile.cpp index 5ecafa58..b743641b 100644 --- a/src/vmime/platforms/windows/windowsFile.cpp +++ b/src/vmime/platforms/windows/windowsFile.cpp @@ -69,14 +69,22 @@ const vmime::utility::file::path windowsFileSystemFactory::stringToPathImpl(cons while ((offset = str.find_first_of("\\", offset)) != vmime::string::npos) { if (offset != prev) - path.appendComponent(vmime::string(str.begin() + prev, str.begin() + offset)); + { + path.appendComponent + (vmime::utility::file::path::component + (vmime::string(str.begin() + prev, str.begin() + offset))); + } prev = offset + 1; offset++; } if (prev < str.length()) - path.appendComponent(vmime::string(str.begin() + prev, str.end())); + { + path.appendComponent + (vmime::utility::file::path::component + (vmime::string(str.begin() + prev, str.end()))); + } return (path); } diff --git a/src/vmime/word.hpp b/src/vmime/word.hpp index 2c6ecb57..e7d12715 100644 --- a/src/vmime/word.hpp +++ b/src/vmime/word.hpp @@ -44,10 +44,34 @@ class VMIME_EXPORT word : public headerFieldValue public: + /** Construct an empty word. + * Charset is set to the current locale charset. + */ word(); + + /** Construct a word by copying another word. + */ word(const word& w); - word(const string& buffer); // Defaults to local charset + + /** Construct a word using a string buffer. + * Charset is set to the current locale charset. + */ + explicit word(const string& buffer); + + /** Construct a word using a string buffer and a specified charset. + * + * @param buffer string buffer + * @param charset charset in which the string is encoded + */ word(const string& buffer, const charset& charset); + + /** Construct a word using a string buffer and a specified charset + * and language tag (RFC-1766). + * + * @param buffer string buffer + * @param charset charset in which the string is encoded + * @param lang language tag, in the format specified by RFC-1766 + */ word(const string& buffer, const charset& charset, const string& lang); /** Return the raw data for this encoded word. |
