整形
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
|
||||
namespace CocoaTweet::OAuth {
|
||||
Key Key::fromJsonFile(const std::string _jsonFile) {
|
||||
|
||||
std::ifstream ifs(_jsonFile);
|
||||
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
|
||||
|
||||
auto j = nlohmann::json::parse(str);
|
||||
return Key(j["consumer_key"], j["consumer_secret"], j["access_token"], j["access_token_secret"]);
|
||||
}
|
||||
return Key(j["consumer_key"], j["consumer_secret"], j["access_token"],
|
||||
j["access_token_secret"]);
|
||||
}
|
||||
} // namespace CocoaTweet::OAuth
|
||||
|
||||
@@ -42,8 +42,7 @@ std::map<std::string, std::string> OAuth1::signature(
|
||||
std::cout << "significate base : " << significateBase << std::endl;
|
||||
std::cout << "hmac-sha1 : " << k64Sha1 << std::endl;
|
||||
|
||||
auto ret = std::map<std::string, std::string>{
|
||||
{"oauth_signature", k64Sha1}};
|
||||
auto ret = std::map<std::string, std::string>{{"oauth_signature", k64Sha1}};
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ std::string urlEncode(const std::string& _str) {
|
||||
(c == '.' || (c == '_') || (c == '-' || (c == '~')))) {
|
||||
out << c;
|
||||
} else {
|
||||
out << '%' << std::setw(2) << std::setfill('0') << std::hex << std::uppercase << (0xFF & static_cast<int>(c));
|
||||
out << '%' << std::setw(2) << std::setfill('0') << std::hex << std::uppercase
|
||||
<< (0xFF & static_cast<int>(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user