X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fconvto.h;h=1fc6848290bc84407b2c542890d68018ea8aef96;hb=635cb9d65f6d7f6758ae8ed874da00c8d94b6e39;hp=2f808d1fb3a722128a8047f8e6ca1973016a8fcf;hpb=874ce50b8dfa74567a426c11bbaef7cda9ad0299;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/convto.h b/include/convto.h index 2f808d1fb..1fc684829 100644 --- a/include/convto.h +++ b/include/convto.h @@ -1,8 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2014 Attila Molnar - * Copyright (C) 2006 Craig Edwards + * Copyright (C) 2017-2019 Sadie Powell + * Copyright (C) 2016 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -104,14 +104,14 @@ template<> inline char ConvToNum(const std::string& in) { // We specialise ConvToNum for char to avoid istringstream treating // the input as a character literal. - uint16_t num = ConvToNum(in); - return num <= UINT8_MAX ? num : 0; + int16_t num = ConvToNum(in); + return num >= INT8_MIN && num <= INT8_MAX ? num : 0; } template<> inline unsigned char ConvToNum(const std::string& in) { // We specialise ConvToNum for unsigned char to avoid istringstream // treating the input as a character literal. - int16_t num = ConvToNum(in); - return num >= INT8_MIN && num <= INT8_MAX ? num : 0; + uint16_t num = ConvToNum(in); + return num <= UINT8_MAX ? num : 0; }