diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-06-03 12:25:57 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-06-03 12:46:12 (GMT) |
commit | 21fda3308975201eeebeacd98e2b587ef4448862 (patch) | |
tree | e8aebe473a636cf5a312814d4054d8af0d9ad6a6 /Swiften/IDN/StringPrep.cpp | |
parent | 10334c139670861d4860da59ad837fc3fe6fd41e (diff) | |
download | swift-contrib-21fda3308975201eeebeacd98e2b587ef4448862.zip swift-contrib-21fda3308975201eeebeacd98e2b587ef4448862.tar.bz2 |
Limit the use of the SafeString type.
Diffstat (limited to 'Swiften/IDN/StringPrep.cpp')
-rw-r--r-- | Swiften/IDN/StringPrep.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp index f8ebb2c..140e130 100644 --- a/Swiften/IDN/StringPrep.cpp +++ b/Swiften/IDN/StringPrep.cpp @@ -28,14 +28,14 @@ using namespace Swift; } template<typename StringType, typename ContainerType> - StringType getStringPrepared(const StringType& s, StringPrep::Profile profile) { + ContainerType getStringPrepared(const StringType& s, StringPrep::Profile profile) { ContainerType input(s.begin(), s.end()); input.resize(MAX_STRINGPREP_SIZE); if (stringprep(&input[0], MAX_STRINGPREP_SIZE, static_cast<Stringprep_profile_flags>(0), getLibIDNProfile(profile)) == 0) { - return StringType(&input[0]); + return input; } else { - return StringType(); + return ContainerType(); } } } @@ -43,11 +43,11 @@ using namespace Swift; namespace Swift { std::string StringPrep::getPrepared(const std::string& s, Profile profile) { - return getStringPrepared< std::string, std::vector<char> >(s, profile); + return std::string(vecptr(getStringPrepared< std::string, std::vector<char> >(s, profile))); } -SafeString StringPrep::getPrepared(const SafeString& s, Profile profile) { - return getStringPrepared<SafeString, std::vector<char, SafeAllocator<char> > >(s, profile); +SafeByteArray StringPrep::getPrepared(const SafeByteArray& s, Profile profile) { + return createSafeByteArray(reinterpret_cast<const char*>(vecptr(getStringPrepared<SafeByteArray, std::vector<char, SafeAllocator<char> > >(s, profile)))); } } |