summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Base64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Base64.cpp')
-rw-r--r--cpp/src/Ice/Base64.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/src/Ice/Base64.cpp b/cpp/src/Ice/Base64.cpp
index 803d5b15b85..1dd81bb2f96 100644
--- a/cpp/src/Ice/Base64.cpp
+++ b/cpp/src/Ice/Base64.cpp
@@ -49,8 +49,8 @@ IceInternal::Base64::encode(const vector<unsigned char>& plainSeq)
}
by4 = by1 >> 2;
- by5 = ((by1 & 0x3) << 4) | (by2 >> 4);
- by6 = ((by2 & 0xf) << 2) | (by3 >> 6);
+ by5 = static_cast<unsigned char>((by1 & 0x3) << 4) | (by2 >> 4);
+ by6 = static_cast<unsigned char>((by2 & 0xf) << 2) | (by3 >> 6);
by7 = by3 & 0x3f;
retval += encode(by4);
@@ -159,16 +159,16 @@ IceInternal::Base64::decode(const string& str)
by3 = decode(c3);
by4 = decode(c4);
- retval.push_back((by1 << 2) | (by2 >> 4));
+ retval.push_back(static_cast<unsigned char>(by1 << 2) | (by2 >> 4));
if(c3 != '=')
{
- retval.push_back(((by2 & 0xf) << 4) | (by3 >> 2));
+ retval.push_back(static_cast<unsigned char>((by2 & 0xf) << 4) | (by3 >> 2));
}
if(c4 != '=')
{
- retval.push_back(((by3 & 0x3) << 6) | by4);
+ retval.push_back(static_cast<unsigned char>((by3 & 0x3) << 6) | by4);
}
}
@@ -216,17 +216,17 @@ IceInternal::Base64::encode(unsigned char uc)
{
if(uc < 26)
{
- return 'A' + uc;
+ return 'A' + static_cast<char>(uc);
}
if(uc < 52)
{
- return 'a' + (uc - 26);
+ return 'a' + static_cast<char>(uc) - 26;
}
if(uc < 62)
{
- return '0' + (uc - 52);
+ return '0' + static_cast<char>(uc) - 52;
}
if(uc == 62)
@@ -242,17 +242,17 @@ IceInternal::Base64::decode(char c)
{
if(c >= 'A' && c <= 'Z')
{
- return c - 'A';
+ return static_cast<unsigned char>(c - 'A');
}
if(c >= 'a' && c <= 'z')
{
- return c - 'a' + 26;
+ return static_cast<unsigned char>(c - 'a' + 26);
}
if(c >= '0' && c <= '9')
{
- return c - '0' + 52;
+ return static_cast<unsigned char>(c - '0' + 52);
}
if(c == '+')