summaryrefslogtreecommitdiff
path: root/plugins/JSON/Source/JSON_Base64.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
commit78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch)
tree8512c50df70b8dd80c919e88ade3419207c95956 /plugins/JSON/Source/JSON_Base64.cpp
parentce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff)
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/JSON/Source/JSON_Base64.cpp')
-rw-r--r--plugins/JSON/Source/JSON_Base64.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/JSON/Source/JSON_Base64.cpp b/plugins/JSON/Source/JSON_Base64.cpp
index fcde330b1a..fdf7930208 100644
--- a/plugins/JSON/Source/JSON_Base64.cpp
+++ b/plugins/JSON/Source/JSON_Base64.cpp
@@ -50,13 +50,13 @@ json_string JSONBase64::json_encode64(const unsigned char * binary, size_t bytes
}
inline json_char toBinary(json_char c){
- if (c == JSON_TEXT('+')){
+ if (c == JSON_TEXT('+')) {
return JSON_TEXT('>');
- } else if (c == JSON_TEXT('/')){
+ } else if (c == JSON_TEXT('/')) {
return JSON_TEXT('?');
- } else if (c < JSON_TEXT(':')){
+ } else if (c < JSON_TEXT(':')) {
return c + JSON_TEXT('\x04');
- } else if (c < JSON_TEXT('[')){
+ } else if (c < JSON_TEXT('[')) {
return c - JSON_TEXT('\x41');
}
return c - 71;
@@ -97,10 +97,10 @@ std::string JSONBase64::json_decode64(const json_string & encoded){
//now do the ones that might have padding, the first two characters can not be padding, so do them quickly
const char second = toBinary(runner[1]);
result += (toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
- if (runner[2] != '='){ //not two = pads
+ if (runner[2] != '=') { //not two = pads
const char third = toBinary(runner[2]);
result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
- if (runner[3] != '='){ //no padding
+ if (runner[3] != '=') { //no padding
result += ((third & 0x3) << 6) + toBinary(runner[3]);
}
}