diff options
Diffstat (limited to 'inc/util.h')
-rw-r--r-- | inc/util.h | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -38,7 +38,7 @@ // This is the maximum number of bytes needed in a "compacted meta header" // buffer, which is a buffer storing all of the compacted meta headers. #define COMPACTED_METADATA_BUFFER_SIZE \ - (S3_MAX_METADATA_COUNT * sizeof(S3_METADATA_HEADER_NAME_PREFIX "n: v")) + (S3_MAX_METADATA_COUNT * sizeof(S3_METADATA_HEADER_NAME_PREFIX "n: v")) // Maximum url encoded key size; since every single character could require // URL encoding, it's 3 times the size of a key (since each url encoded @@ -49,18 +49,18 @@ // https://s3.amazonaws.com/${BUCKET}/${KEY}?acl // 255 is the maximum bucket length #define MAX_URI_SIZE \ - ((sizeof("https://" S3_HOSTNAME "/") - 1) + 255 + 1 + \ - MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent" - 1)) + 1) + ((sizeof("https://" S3_HOSTNAME "/") - 1) + 255 + 1 + \ + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent" - 1)) + 1) // Maximum size of a canonicalized resource #define MAX_CANONICALIZED_RESOURCE_SIZE \ - (1 + 255 + 1 + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent") - 1) + 1) + (1 + 255 + 1 + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent") - 1) + 1) // Utilities ----------------------------------------------------------------- -// URL-encodes a string from [src] into [dest]. [dest] must have at least -// 3x the number of characters that [source] has. At most [maxSrcSize] bytes +// URL-encodes a string from [src] into [dest]. [dest] must have at least +// 3x the number of characters that [source] has. At most [maxSrcSize] bytes // from [src] are encoded; if more are present in [src], 0 is returned from // urlEncode, else nonzero is returned. int urlEncode(char *dest, const char *src, int maxSrcSize); @@ -70,15 +70,15 @@ int64_t parseIso8601Time(const char *str); uint64_t parseUnsignedInt(const char *str); -// base64 encode bytes. The output buffer must have at least -// ((4 * (inLen + 1)) / 3) bytes in it. Returns the number of bytes written +// base64 encode bytes. The output buffer must have at least +// ((4 * (inLen + 1)) / 3) bytes in it. Returns the number of bytes written // to [out]. int base64Encode(const unsigned char *in, int inLen, char *out); // Compute HMAC-SHA-1 with key [key] and message [message], storing result // in [hmac] void HMAC_SHA1(unsigned char hmac[20], const unsigned char *key, int key_len, - const unsigned char *message, int message_len); + const unsigned char *message, int message_len); // Compute a 64-bit hash values given a set of bytes uint64_t hash(const unsigned char *k, int length); |