diff options
Diffstat (limited to 'Swiften/IDN')
-rw-r--r-- | Swiften/IDN/IDNA.cpp | 6 | ||||
-rw-r--r-- | Swiften/IDN/IDNA.h | 4 | ||||
-rw-r--r-- | Swiften/IDN/StringPrep.cpp | 7 | ||||
-rw-r--r-- | Swiften/IDN/StringPrep.h | 4 |
4 files changed, 11 insertions, 10 deletions
diff --git a/Swiften/IDN/IDNA.cpp b/Swiften/IDN/IDNA.cpp index 0e76c0b..6b6c7a4 100644 --- a/Swiften/IDN/IDNA.cpp +++ b/Swiften/IDN/IDNA.cpp @@ -13,10 +13,10 @@ namespace Swift { -String IDNA::getEncoded(const String& domain) { +std::string IDNA::getEncoded(const std::string& domain) { char* output; - if (idna_to_ascii_8z(domain.getUTF8Data(), &output, 0) == IDNA_SUCCESS) { - String result(output); + if (idna_to_ascii_8z(domain.c_str(), &output, 0) == IDNA_SUCCESS) { + std::string result(output); free(output); return result; } diff --git a/Swiften/IDN/IDNA.h b/Swiften/IDN/IDNA.h index cc4144b..19af1e6 100644 --- a/Swiften/IDN/IDNA.h +++ b/Swiften/IDN/IDNA.h @@ -6,11 +6,11 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class IDNA { public: - static String getEncoded(const String& s); + static std::string getEncoded(const std::string& s); }; } diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp index d9e061e..ff01eed 100644 --- a/Swiften/IDN/StringPrep.cpp +++ b/Swiften/IDN/StringPrep.cpp @@ -8,6 +8,7 @@ #include <stringprep.h> #include <vector> +#include <cassert> namespace Swift { @@ -24,12 +25,12 @@ const Stringprep_profile* getLibIDNProfile(StringPrep::Profile profile) { return 0; } -String StringPrep::getPrepared(const String& s, Profile profile) { +std::string StringPrep::getPrepared(const std::string& s, Profile profile) { - std::vector<char> input(s.getUTF8String().begin(), s.getUTF8String().end()); + std::vector<char> 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 String(&input[0]); + return std::string(&input[0]); } else { return ""; diff --git a/Swiften/IDN/StringPrep.h b/Swiften/IDN/StringPrep.h index 3b27efa..f40553b 100644 --- a/Swiften/IDN/StringPrep.h +++ b/Swiften/IDN/StringPrep.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class StringPrep { @@ -18,6 +18,6 @@ namespace Swift { SASLPrep, }; - static String getPrepared(const String& s, Profile profile); + static std::string getPrepared(const std::string& s, Profile profile); }; } |