Commit 0e7e2ebc 0e7e2ebc391d0819f90ab6503a4deff3867a4c4d by Nicolas Perriault

use of strict equality operator in ClientUtils base64 related functions

1 parent f4511cf9
...@@ -70,35 +70,35 @@ ...@@ -70,35 +70,35 @@
70 while (i < len) { 70 while (i < len) {
71 do { 71 do {
72 c1 = BASE64_DECODE_CHARS[str.charCodeAt(i++) & 0xff]; 72 c1 = BASE64_DECODE_CHARS[str.charCodeAt(i++) & 0xff];
73 } while (i < len && c1 == -1); 73 } while (i < len && c1 === -1);
74 if (c1 == -1) { 74 if (c1 === -1) {
75 break; 75 break;
76 } 76 }
77 do { 77 do {
78 c2 = BASE64_DECODE_CHARS[str.charCodeAt(i++) & 0xff]; 78 c2 = BASE64_DECODE_CHARS[str.charCodeAt(i++) & 0xff];
79 } while (i < len && c2 == -1); 79 } while (i < len && c2 === -1);
80 if (c2 == -1) { 80 if (c2 === -1) {
81 break; 81 break;
82 } 82 }
83 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); 83 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
84 do { 84 do {
85 c3 = str.charCodeAt(i++) & 0xff; 85 c3 = str.charCodeAt(i++) & 0xff;
86 if (c3 == 61) 86 if (c3 === 61)
87 return out; 87 return out;
88 c3 = BASE64_DECODE_CHARS[c3]; 88 c3 = BASE64_DECODE_CHARS[c3];
89 } while (i < len && c3 == -1); 89 } while (i < len && c3 === -1);
90 if (c3 == -1) { 90 if (c3 === -1) {
91 break; 91 break;
92 } 92 }
93 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); 93 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
94 do { 94 do {
95 c4 = str.charCodeAt(i++) & 0xff; 95 c4 = str.charCodeAt(i++) & 0xff;
96 if (c4 == 61) { 96 if (c4 === 61) {
97 return out; 97 return out;
98 } 98 }
99 c4 = BASE64_DECODE_CHARS[c4]; 99 c4 = BASE64_DECODE_CHARS[c4];
100 } while (i < len && c4 == -1); 100 } while (i < len && c4 === -1);
101 if (c4 == -1) { 101 if (c4 === -1) {
102 break; 102 break;
103 } 103 }
104 out += String.fromCharCode(((c3 & 0x03) << 6) | c4); 104 out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
...@@ -117,14 +117,14 @@ ...@@ -117,14 +117,14 @@
117 var out = "", i = 0, len = str.length, c1, c2, c3; 117 var out = "", i = 0, len = str.length, c1, c2, c3;
118 while (i < len) { 118 while (i < len) {
119 c1 = str.charCodeAt(i++) & 0xff; 119 c1 = str.charCodeAt(i++) & 0xff;
120 if (i == len) { 120 if (i === len) {
121 out += BASE64_ENCODE_CHARS.charAt(c1 >> 2); 121 out += BASE64_ENCODE_CHARS.charAt(c1 >> 2);
122 out += BASE64_ENCODE_CHARS.charAt((c1 & 0x3) << 4); 122 out += BASE64_ENCODE_CHARS.charAt((c1 & 0x3) << 4);
123 out += "=="; 123 out += "==";
124 break; 124 break;
125 } 125 }
126 c2 = str.charCodeAt(i++); 126 c2 = str.charCodeAt(i++);
127 if (i == len) { 127 if (i === len) {
128 out += BASE64_ENCODE_CHARS.charAt(c1 >> 2); 128 out += BASE64_ENCODE_CHARS.charAt(c1 >> 2);
129 out += BASE64_ENCODE_CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); 129 out += BASE64_ENCODE_CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
130 out += BASE64_ENCODE_CHARS.charAt((c2 & 0xF) << 2); 130 out += BASE64_ENCODE_CHARS.charAt((c2 & 0xF) << 2);
......