Bugfix: Re-used a variable that I shouldn't have reused.

This commit is contained in:
tastytea 2018-11-25 07:28:41 +01:00
parent 74da3609fc
commit 7f87ab969c
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2)
project(libravatarserv
VERSION 0.2.1
VERSION 0.2.2
LANGUAGES CXX
)

View File

@ -61,16 +61,16 @@ int main()
uint16_t size = 80;
string digest = request.substr(8);
std::transform(digest.begin(), digest.end(), digest.begin(), ::tolower);
std::size_t pos = digest.find('?');
if (pos != std::string::npos)
std::size_t pos_digest = digest.find('?');
if (pos_digest != std::string::npos)
{
pos = digest.find("s=", pos);
if (pos != std::string::npos)
std::size_t pos_size = digest.find("s=", pos_digest);
if (pos_size != std::string::npos)
{
size = static_cast<uint16_t>(std::stoul(digest.substr(pos + 2)));
size = static_cast<uint16_t>(std::stoul(digest.substr(pos_size + 2)));
cout << size << endl;
}
digest = digest.substr(0, pos);
digest = digest.substr(0, pos_digest);
}
image::Image answer = image::get(digest, size);