Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1603)

Unified Diff: third_party/modp_b64/modp_b64.h

Issue 11688006: Make modp_b64 and base::base64 compile on Win64 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/modp_b64/README.chromium ('k') | third_party/modp_b64/modp_b64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/modp_b64/modp_b64.h
===================================================================
--- third_party/modp_b64/modp_b64.h (revision 174668)
+++ third_party/modp_b64/modp_b64.h (working copy)
@@ -24,6 +24,8 @@
#ifndef MODP_B64
#define MODP_B64
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -53,7 +55,7 @@
* \endcode
*
*/
-int modp_b64_encode(char* dest, const char* str, int len);
+size_t modp_b64_encode(char* dest, const char* str, size_t len);
/**
* Decode a base64 encoded string
@@ -76,7 +78,7 @@
* if (len == -1) { error }
* \endcode
*/
-int modp_b64_decode(char* dest, const char* src, int len);
+size_t modp_b64_decode(char* dest, const char* src, size_t len);
/**
* Given a source string of length len, this returns the amount of
@@ -126,6 +128,8 @@
*/
#define modp_b64_encode_strlen(A) ((A + 2)/ 3 * 4)
+#define MODP_B64_ERROR ((size_t)-1)
+
#ifdef __cplusplus
}
@@ -134,7 +138,7 @@
inline std::string& modp_b64_encode(std::string& s)
{
std::string x(modp_b64_encode_len(s.size()), '\0');
- int d = modp_b64_encode(const_cast<char*>(x.data()), s.data(), s.size());
+ size_t d = modp_b64_encode(const_cast<char*>(x.data()), s.data(), (int)s.size());
x.erase(d, std::string::npos);
s.swap(x);
return s;
@@ -152,8 +156,8 @@
inline std::string& modp_b64_decode(std::string& s)
{
std::string x(modp_b64_decode_len(s.size()), '\0');
- int d = modp_b64_decode(const_cast<char*>(x.data()), s.data(), s.size());
- if (d < 0) {
+ size_t d = modp_b64_decode(const_cast<char*>(x.data()), s.data(), (int)s.size());
+ if (d == MODP_B64_ERROR) {
x.clear();
} else {
x.erase(d, std::string::npos);
« no previous file with comments | « third_party/modp_b64/README.chromium ('k') | third_party/modp_b64/modp_b64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698