Revision: 7151
http://skim-app.svn.sourceforge.net/skim-app/?rev=7151&view=rev
Author: hofman
Date: 2011-03-11 16:17:58 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
fix base64 string length
Modified Paths:
--------------
trunk/NSData_SKExtensions.m
Modified: trunk/NSData_SKExtensions.m
===================================================================
--- trunk/NSData_SKExtensions.m 2011-03-11 16:12:13 UTC (rev 7150)
+++ trunk/NSData_SKExtensions.m 2011-03-11 16:17:58 UTC (rev 7151)
@@ -242,10 +242,10 @@
#define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) *
BINARY_UNIT_SIZE)
// Byte accurate calculation of final buffer size
- size_t outputBufferSize = ((length / BINARY_UNIT_SIZE) + ((length %
BINARY_UNIT_SIZE) ? 1 : 0)) * BASE64_UNIT_SIZE + (outputBufferSize /
OUTPUT_LINE_LENGTH);
+ size_t outputBufferSize = ((length / BINARY_UNIT_SIZE) + ((length %
BINARY_UNIT_SIZE) ? 1 : 0)) * BASE64_UNIT_SIZE;
- // Include space for a terminating zero
- outputBufferSize += 1;
+ // Include space for newlines and a terminating zero
+ outputBufferSize += (outputBufferSize / OUTPUT_LINE_LENGTH) + 1;
// Allocate the output buffer
char *outputBuffer = (char *)malloc(outputBufferSize);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit