summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-01 15:49:26 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-01 15:49:26 +0200
commitb42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 (patch)
treed73404c2fbacce379a57e2d03a6cd54558590859 /indra/test
parentcb3bd8865aa0f9fb8a247ea595cf1973057ba91f (diff)
Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/io.cpp36
-rw-r--r--indra/test/llbuffer_tut.cpp16
-rw-r--r--indra/test/llpipeutil.cpp2
-rw-r--r--indra/test/llsdmessagereader_tut.cpp2
-rw-r--r--indra/test/llstreamtools_tut.cpp2
5 files changed, 29 insertions, 29 deletions
diff --git a/indra/test/io.cpp b/indra/test/io.cpp
index 412f9ca1d2..3bb549a98a 100644
--- a/indra/test/io.cpp
+++ b/indra/test/io.cpp
@@ -155,7 +155,7 @@ namespace tut
void buffer_object::test<1>()
{
const char HELLO_WORLD[] = "hello world";
- const S32 str_len = strlen(HELLO_WORLD);
+ const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD));
LLChannelDescriptors ch = mBuffer.nextChannel();
mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len);
S32 count = mBuffer.countAfter(ch.in(), NULL);
@@ -170,7 +170,7 @@ namespace tut
void buffer_object::test<2>()
{
const char HELLO_WORLD[] = "hello world";
- const S32 str_len = strlen(HELLO_WORLD); /* Flawfinder: ignore */
+ const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD)); /* Flawfinder: ignore */
LLChannelDescriptors ch = mBuffer.nextChannel();
mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len);
mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len);
@@ -249,15 +249,15 @@ namespace tut
expected << "ContentLength: " << response.length() << "\r\n\r\n"
<< response;
LLChannelDescriptors ch = mBuffer.nextChannel();
- mBuffer.append(ch.in(), (U8*)request.c_str(), request.length());
- mBuffer.append(ch.out(), (U8*)response.c_str(), response.length());
+ mBuffer.append(ch.in(), (U8*)request.c_str(), static_cast<S32>(request.length()));
+ mBuffer.append(ch.out(), (U8*)response.c_str(), static_cast<S32>(response.length()));
S32 count = mBuffer.countAfter(ch.out(), NULL);
std::ostringstream header;
header << "ContentLength: " << count << "\r\n\r\n";
std::string head(header.str());
- mBuffer.prepend(ch.out(), (U8*)head.c_str(), head.length());
+ mBuffer.prepend(ch.out(), (U8*)head.c_str(), static_cast<S32>(head.length()));
char buffer[1024]; /* Flawfinder: ignore */
- S32 len = response.size() + head.length();
+ S32 len = static_cast<S32>(response.size() + head.length());
ensure_equals("same length", len, (S32)expected.str().length());
mBuffer.readAfter(ch.out(), NULL, (U8*)buffer, len);
buffer[len] = '\0';
@@ -282,7 +282,7 @@ namespace tut
text.append(lines[i]);
}
LLChannelDescriptors ch = mBuffer.nextChannel();
- mBuffer.append(ch.in(), (U8*)text.c_str(), text.length());
+ mBuffer.append(ch.in(), (U8*)text.c_str(), static_cast<S32>(text.length()));
const S32 BUFFER_LEN = 1024;
char buf[BUFFER_LEN];
S32 len;
@@ -411,7 +411,7 @@ namespace tut
void bas_object::test<1>()
{
const char HELLO_WORLD[] = "hello world";
- const S32 str_len = strlen(HELLO_WORLD); /* Flawfinder: ignore */
+ const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD)); /* Flawfinder: ignore */
LLChannelDescriptors ch = mBuffer.nextChannel();
LLBufferStream str(ch, &mBuffer);
mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len);
@@ -431,10 +431,10 @@ namespace tut
std::string ignore("ignore me");
LLChannelDescriptors ch = mBuffer.nextChannel();
LLBufferStream str(ch, &mBuffer);
- mBuffer.append(ch.in(), (U8*)part1.c_str(), part1.length());
- mBuffer.append(ch.in(), (U8*)part2.c_str(), part2.length());
- mBuffer.append(ch.out(), (U8*)ignore.c_str(), ignore.length());
- mBuffer.append(ch.in(), (U8*)part3.c_str(), part3.length());
+ mBuffer.append(ch.in(), (U8*)part1.c_str(), static_cast<S32>(part1.length()));
+ mBuffer.append(ch.in(), (U8*)part2.c_str(), static_cast<S32>(part2.length()));
+ mBuffer.append(ch.out(), (U8*)ignore.c_str(), static_cast<S32>(ignore.length()));
+ mBuffer.append(ch.in(), (U8*)part3.c_str(), static_cast<S32>(part3.length()));
std::string eat;
std::string my;
std::string shorts;
@@ -452,8 +452,8 @@ namespace tut
std::string part1("junk in ");
std::string part2("the trunk");
const S32 CHANNEL = 0;
- mBuffer.append(CHANNEL, (U8*)part1.c_str(), part1.length());
- mBuffer.append(CHANNEL, (U8*)part2.c_str(), part2.length());
+ mBuffer.append(CHANNEL, (U8*)part1.c_str(), static_cast<S32>(part1.length()));
+ mBuffer.append(CHANNEL, (U8*)part2.c_str(), static_cast<S32>(part2.length()));
U8* last = 0;
const S32 BUF_LEN = 128;
char buf[BUF_LEN];
@@ -475,7 +475,7 @@ namespace tut
{
std::string phrase("zippity do da!");
const S32 CHANNEL = 0;
- mBuffer.append(CHANNEL, (U8*)phrase.c_str(), phrase.length());
+ mBuffer.append(CHANNEL, (U8*)phrase.c_str(), static_cast<S32>(phrase.length()));
const S32 BUF_LEN = 128;
char buf[BUF_LEN];
S32 len = 7;
@@ -506,7 +506,7 @@ namespace tut
const S32 BUF_LEN = 128;
char buf[BUF_LEN];
S32 actual_len = BUF_LEN;
- S32 expected_len = h1.size() + h2.size();
+ S32 expected_len = static_cast<S32>(h1.size() + h2.size());
(void) mBuffer.readAfter(ch.out(), NULL, (U8*)buf, actual_len);
ensure_equals("streamed size", actual_len, expected_len);
buf[actual_len] = '\0';
@@ -728,7 +728,7 @@ namespace tut
"'circuit_code': i124,'group_id': '8615c885-9cf0-bf0a-6e40-0c11462aa652','limited_to_estate': i1,'look_at': [ i0, i0, i0],"
"'agent_id': '0e346d8b-4433-4d66-a6b0-fd37083abc4c','first_name': 'Kelly','start': 'url'}]}";
LLChannelDescriptors ch = mBuffer.nextChannel();
- mBuffer.append(ch.out(), (U8*)LOGIN_STREAM, strlen(LOGIN_STREAM)); /* Flawfinder: ignore */
+ mBuffer.append(ch.out(), (U8*)LOGIN_STREAM, static_cast<S32>(strlen(LOGIN_STREAM))); /* Flawfinder: ignore */
ch = mBuffer.nextChannel();
LLBufferStream istr(ch, &mBuffer);
LLSD data;
@@ -1130,7 +1130,7 @@ namespace tut
mPump->addChain(chain, NEVER_CHAIN_EXPIRY_SECS);
// We need to tickle the pump a little to set up the listen()
pump_loop(mPump, 0.1f);
- U32 count = mPump->runningChains();
+ auto count = mPump->runningChains();
ensure_equals("server chain onboard", count, 1);
LL_DEBUGS() << "** Server is up." << LL_ENDL;
diff --git a/indra/test/llbuffer_tut.cpp b/indra/test/llbuffer_tut.cpp
index 07cb4d5aed..330a4f288f 100644
--- a/indra/test/llbuffer_tut.cpp
+++ b/indra/test/llbuffer_tut.cpp
@@ -128,7 +128,7 @@ namespace tut
{
LLBufferArray bufferArray;
const char array[] = "SecondLife";
- S32 len = strlen(array);
+ S32 len = static_cast<S32>(strlen(array));
LLChannelDescriptors channelDescriptors = bufferArray.nextChannel();
bufferArray.append(channelDescriptors.in(), (U8*)array, len);
S32 count = bufferArray.countAfter(channelDescriptors.in(), NULL);
@@ -141,9 +141,9 @@ namespace tut
{
LLBufferArray bufferArray;
const char array[] = "SecondLife";
- S32 len = strlen(array);
+ S32 len = static_cast<S32>(strlen(array));
const char array1[] = "LindenLabs";
- S32 len1 = strlen(array1);
+ S32 len1 = static_cast<S32>(strlen(array1));
std::string str(array1);
str.append(array);
@@ -166,9 +166,9 @@ namespace tut
{
LLBufferArray bufferArray;
const char array[] = "SecondLife";
- S32 len = strlen(array);
+ S32 len = static_cast<S32>(strlen(array));
const char array1[] = "LindenLabs";
- S32 len1 = strlen(array1);
+ S32 len1 = static_cast<S32>(strlen(array1));
std::string str(array);
str.append(array1);
@@ -190,7 +190,7 @@ namespace tut
{
LLBufferArray bufferArray;
const char array[] = "SecondLife";
- S32 len = strlen(array) + 1;
+ S32 len = static_cast<S32>(strlen(array)) + 1;
std::string str(array);
LLChannelDescriptors channelDescriptors = bufferArray.nextChannel();
bufferArray.append(channelDescriptors.in(), (U8*)array, len);
@@ -208,7 +208,7 @@ namespace tut
void buffer_object_t::test<10>()
{
const char array[] = "SecondLife is a Virtual World";
- S32 len = strlen(array);
+ S32 len = static_cast<S32>(strlen(array));
LLBufferArray bufferArray;
bufferArray.append(0, (U8*)array, len);
@@ -229,7 +229,7 @@ namespace tut
void buffer_object_t::test<11>()
{
const char array[] = "SecondLife is a Virtual World";
- S32 len = strlen(array);
+ S32 len = static_cast<S32>(strlen(array));
LLBufferArray bufferArray;
bufferArray.append(0, (U8*)array, len);
diff --git a/indra/test/llpipeutil.cpp b/indra/test/llpipeutil.cpp
index c64cf21326..1dd4bdfa3c 100644
--- a/indra/test/llpipeutil.cpp
+++ b/indra/test/llpipeutil.cpp
@@ -60,7 +60,7 @@ LLIOPipe::EStatus LLPipeStringInjector::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- buffer->append(channels.out(), (U8*) mString.data(), mString.size());
+ buffer->append(channels.out(), (U8*) mString.data(), static_cast<S32>(mString.size()));
eos = true;
return STATUS_DONE;
}
diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp
index 38c4d870cb..dd6520ea33 100644
--- a/indra/test/llsdmessagereader_tut.cpp
+++ b/indra/test/llsdmessagereader_tut.cpp
@@ -318,7 +318,7 @@ namespace tut
inValue[1] = 1;
LLSDMessageReader msg = testType(inValue);
- msg.getBinaryData("block", "var", &(outValue[0]), inValue.size());
+ msg.getBinaryData("block", "var", &(outValue[0]), static_cast<S32>(inValue.size()));
ensure_equals("Ensure Binary", outValue, inValue);
}
}
diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp
index 68bd5e0ec9..970afb3b02 100644
--- a/indra/test/llstreamtools_tut.cpp
+++ b/indra/test/llstreamtools_tut.cpp
@@ -846,7 +846,7 @@ namespace tut
char buf[255] = {0};
fullread(is, buf, 255);
- ensure_memory_matches("fullread: read with newlines", (void*) buf, str.size()-1, (void*) str.c_str(), str.size()-1);
+ ensure_memory_matches("fullread: read with newlines", (void*) buf, static_cast<U32>(str.size())-1, (void*) str.c_str(), static_cast<U32>(str.size())-1);
is.clear();
is.str(str = "First Line.\nSecond Line\n");