aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2015-02-17 21:12:20 +0000
committerVincent Richard <[email protected]>2015-02-17 21:12:20 +0000
commit52e5d74becd6ec100718be177bb60d12d80a774d (patch)
tree42fcc9227e038266a6e5bbbc1e908a8ddce2a258
parentSkip word on unexpected error when fixing broken words. (diff)
downloadvmime-52e5d74becd6ec100718be177bb60d12d80a774d.tar.gz
vmime-52e5d74becd6ec100718be177bb60d12d80a774d.zip
Made word/parameter constructor with 'string' explicit to avoid implicit use of default charset.
-rw-r--r--examples/example6.cpp2
-rw-r--r--src/vmime/parameter.hpp2
-rw-r--r--src/vmime/platforms/posix/posixFile.cpp12
-rw-r--r--src/vmime/platforms/windows/windowsFile.cpp12
-rw-r--r--src/vmime/word.hpp26
5 files changed, 47 insertions, 7 deletions
diff --git a/examples/example6.cpp b/examples/example6.cpp
index 5d8c7e64..27c6e157 100644
--- a/examples/example6.cpp
+++ b/examples/example6.cpp
@@ -639,7 +639,7 @@ static void connectStore()
: std::string(path.begin() + s, path.begin() + p);
if (!x.empty())
- newFolder = newFolder->getFolder(x);
+ newFolder = newFolder->getFolder(vmime::utility::path::component(x));
if (p == std::string::npos)
break;
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.