mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Integer conversions generating compiler warnings (#2024)
* Prevention of compiler warning due to usage of int instead of a size type * Conversion of status type to long to prevent compiler warnings * The returned number of read items from a buffer is specified in numbers of type "streamsize" Co-authored-by: Hartwig <git@skywind.eu>
This commit is contained in:
parent
08aeada7d5
commit
9185a925ce
@ -67,7 +67,7 @@ namespace dlib
|
||||
//! \return modified string ``s'' with spaces trimmed from left
|
||||
inline std::string& triml(std::string& s)
|
||||
{
|
||||
int pos(0);
|
||||
std::string::size_type pos(0);
|
||||
for ( ; s[pos] == ' ' || s[pos] == '\t' || s[pos] == '\r' || s[pos] == '\n' ; ++pos );
|
||||
s.erase(0, pos);
|
||||
return s;
|
||||
@ -78,7 +78,7 @@ namespace dlib
|
||||
//! \return modified string ``s'' with spaces trimmed from right
|
||||
inline std::string& trimr(std::string& s)
|
||||
{
|
||||
int pos(s.size());
|
||||
std::string::size_type pos(s.size());
|
||||
for ( ; pos && (s[pos-1] == ' ' || s[pos-1] == '\t' || s[pos-1] == '\r' || s[pos-1] == '\n') ; --pos );
|
||||
s.erase(pos, s.size()-pos);
|
||||
return s;
|
||||
|
@ -159,7 +159,7 @@ namespace dlib
|
||||
|
||||
// forward data from a to b
|
||||
char buf[200];
|
||||
int status;
|
||||
long status;
|
||||
bool error = false; // becomes true if one of the connections returns an error
|
||||
while (true)
|
||||
{
|
||||
@ -287,7 +287,7 @@ namespace dlib
|
||||
|
||||
// forward data from b to a
|
||||
char buf[200];
|
||||
int status;
|
||||
long status;
|
||||
bool error = false;
|
||||
while (true)
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ namespace dlib
|
||||
|
||||
|
||||
|
||||
unsigned long len = 0;
|
||||
std::streamsize len = 0;
|
||||
|
||||
// an array of 16 words
|
||||
uint32 x[16];
|
||||
@ -467,7 +467,7 @@ namespace dlib
|
||||
std::streambuf& inputbuf = *input.rdbuf();
|
||||
while(!at_end)
|
||||
{
|
||||
int num = inputbuf.sgetn(reinterpret_cast<char*>(temp),64);
|
||||
std::streamsize num = inputbuf.sgetn(reinterpret_cast<char*>(temp),64);
|
||||
len += num;
|
||||
|
||||
// if we hit the end of the stream then pad and add length
|
||||
|
Loading…
Reference in New Issue
Block a user