Move to standard integer types #1147

This commit is contained in:
Alex Fabijanic
2017-10-05 17:03:11 -05:00
parent de64a1cbd2
commit 71531d1a75
10 changed files with 14 additions and 13 deletions

View File

@@ -4198,12 +4198,12 @@ void SQLExecutor::insertStatReuse()
Nullable<int> age(0); Nullable<int> age(0);
stat << "INSERT INTO " << ExecUtil::person() << "(LastName, FirstName, Address, Age) VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age); stat << "INSERT INTO " << ExecUtil::person() << "(LastName, FirstName, Address, Age) VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age);
stat.insertHint(); stat.insertHint();
for (size_t i = 1; i < 5; ++i) for (int i = 1; i < 5; ++i)
{ {
lastName = Var("Last Name " + NumberFormatter::format(i)); lastName = Var("Last Name " + NumberFormatter::format(i));
firstName = "First Name " + NumberFormatter::format(i); firstName = "First Name " + NumberFormatter::format(i);
address = "Address" + NumberFormatter::format(i); address = "Address" + NumberFormatter::format(i);
age = 10 + static_cast<int>(i); age = 10 + i;
stat.execute(); stat.execute();
} }
std::vector<int> rowCnt; std::vector<int> rowCnt;

View File

@@ -347,9 +347,10 @@ void DataTest::writeToCLOB(BinaryWriter& writer)
writer << (unsigned short) 50000; writer << (unsigned short) 50000;
writer << -123456; writer << -123456;
writer << (unsigned) 123456; writer << (unsigned) 123456;
#ifndef POCO_LONG_IS_64_BIT
writer << (long) -1234567890; writer << (long) -1234567890;
writer << (unsigned long) 1234567890; writer << (unsigned long) 1234567890;
#endif // POCO_LONG_IS_64_BIT
writer << (Int64) -1234567890; writer << (Int64) -1234567890;
writer << (UInt64) 1234567890; writer << (UInt64) 1234567890;
@@ -405,7 +406,7 @@ void DataTest::readFromCLOB(BinaryReader& reader)
unsigned uintv = 0; unsigned uintv = 0;
reader >> uintv; reader >> uintv;
assert (uintv == 123456); assert (uintv == 123456);
#ifndef POCO_LONG_IS_64_BIT
long longv = 0; long longv = 0;
reader >> longv; reader >> longv;
assert (longv == -1234567890); assert (longv == -1234567890);
@@ -413,7 +414,7 @@ void DataTest::readFromCLOB(BinaryReader& reader)
unsigned long ulongv = 0; unsigned long ulongv = 0;
reader >> ulongv; reader >> ulongv;
assert (ulongv == 1234567890); assert (ulongv == 1234567890);
#endif // POCO_LONG_IS_64_BIT
Int64 int64v = 0; Int64 int64v = 0;
reader >> int64v; reader >> int64v;
assert (int64v == -1234567890); assert (int64v == -1234567890);

View File

@@ -35,7 +35,7 @@ KillCursorsRequest::~KillCursorsRequest()
void KillCursorsRequest::buildRequest(BinaryWriter& writer) void KillCursorsRequest::buildRequest(BinaryWriter& writer)
{ {
writer << 0; // 0 - reserved for future use writer << 0; // 0 - reserved for future use
writer << _cursors.size(); writer << static_cast<Poco::UInt64>(_cursors.size());
for (std::vector<Int64>::iterator it = _cursors.begin(); it != _cursors.end(); ++it) for (std::vector<Int64>::iterator it = _cursors.begin(); it != _cursors.end(); ++it)
{ {
writer << *it; writer << *it;

View File

@@ -93,7 +93,7 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
int HTTPChunkedStreamBuf::writeToDevice(const char* buffer, std::streamsize length) int HTTPChunkedStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{ {
_chunkBuffer.clear(); _chunkBuffer.clear();
NumberFormatter::appendHex(_chunkBuffer, length); NumberFormatter::appendHex(_chunkBuffer, static_cast<Poco::UInt64>(length));
_chunkBuffer.append("\r\n", 2); _chunkBuffer.append("\r\n", 2);
_chunkBuffer.append(buffer, static_cast<std::string::size_type>(length)); _chunkBuffer.append(buffer, static_cast<std::string::size_type>(length));
_chunkBuffer.append("\r\n", 2); _chunkBuffer.append("\r\n", 2);

View File

@@ -69,7 +69,7 @@ void HTTPMessage::setVersion(const std::string& version)
void HTTPMessage::setContentLength(std::streamsize length) void HTTPMessage::setContentLength(std::streamsize length)
{ {
if (length != UNKNOWN_CONTENT_LENGTH) if (length != UNKNOWN_CONTENT_LENGTH)
set(CONTENT_LENGTH, NumberFormatter::format(length)); set(CONTENT_LENGTH, NumberFormatter::format(static_cast<Poco::UInt64>(length)));
else else
erase(CONTENT_LENGTH); erase(CONTENT_LENGTH);
} }

View File

@@ -261,7 +261,7 @@ void OAuth10Credentials::signHMACSHA1(Poco::Net::HTTPRequest& request, const std
std::string timestamp(_timestamp); std::string timestamp(_timestamp);
if (timestamp.empty()) if (timestamp.empty())
{ {
timestamp = Poco::NumberFormatter::format(Poco::Timestamp().epochTime()); timestamp = Poco::NumberFormatter::format(static_cast<Poco::UInt64>(Poco::Timestamp().epochTime()));
} }
std::string signature(createSignature(request, uri, params, nonce, timestamp)); std::string signature(createSignature(request, uri, params, nonce, timestamp));

View File

@@ -134,7 +134,7 @@ void RemoteSyslogChannel::log(const Message& msg)
m += ' '; m += ' ';
m += _name; m += _name;
m += ' '; m += ' ';
Poco::NumberFormatter::append(m, msg.getPid()); Poco::NumberFormatter::append(m, static_cast<Poco::UInt64>(msg.getPid()));
m += ' '; m += ' ';
m += msg.getSource(); m += msg.getSource();
} }

View File

@@ -111,7 +111,7 @@ void SMTPChannel::log(const Message& msg)
content << "Timestamp: " << DateTimeFormatter::format(msg.getTime(), DateTimeFormat::RFC822_FORMAT) << "\r\n"; content << "Timestamp: " << DateTimeFormatter::format(msg.getTime(), DateTimeFormat::RFC822_FORMAT) << "\r\n";
content << "Priority: " << NumberFormatter::format(msg.getPriority()) << "\r\n" content << "Priority: " << NumberFormatter::format(msg.getPriority()) << "\r\n"
<< "Process ID: " << NumberFormatter::format(msg.getPid()) << "\r\n" << "Process ID: " << msg.getPid() << "\r\n"
<< "Thread: " << msg.getThread() << " (ID: " << msg.getTid() << ")\r\n" << "Thread: " << msg.getThread() << " (ID: " << msg.getTid() << ")\r\n"
<< "Message text: " << msg.getText() << "\r\n\r\n"; << "Message text: " << msg.getText() << "\r\n\r\n";

View File

@@ -201,7 +201,7 @@ struct RedisTypeTraits<BulkString>
{ {
std::string s = value.value(); std::string s = value.value();
return marker return marker
+ NumberFormatter::format(s.length()) + NumberFormatter::format(static_cast<Poco::UInt64>(s.length()))
+ LineEnding::NEWLINE_CRLF + LineEnding::NEWLINE_CRLF
+ s + s
+ LineEnding::NEWLINE_CRLF; + LineEnding::NEWLINE_CRLF;

View File

@@ -932,7 +932,7 @@ ENTROPY_DEBUG(const char * label, unsigned long entropy) {
static unsigned long static unsigned long
generate_hash_secret_salt(XML_Parser parser) generate_hash_secret_salt(XML_Parser parser)
{ {
unsigned long entropy; Poco::UInt64 entropy;
(void)parser; (void)parser;
#if defined(EXPAT_POCO) #if defined(EXPAT_POCO)
Poco::RandomInputStream rstr; Poco::RandomInputStream rstr;