Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

namespace base64 category

Add a namespace to the base65 category to avoid clashing with client code.
  • Loading branch information...
commit eccfc09e62bcf7532eff65558c9d5fbb4d00a01e 1 parent 7e1a9bc
@elfredpagan elfredpagan authored
View
4 MPLib/MixpanelAPI.m
@@ -8,7 +8,7 @@
#import "MixpanelAPI.h"
#import "MixpanelEvent.h"
#import "CJSONDataSerializer.h"
-#import "NSData+Base64.h"
+#import "NSData+MPBase64.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -348,7 +348,7 @@ - (void)flush
error:nil];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
NSString *urlString = SERVER_URL;
- NSString *postBody = [NSString stringWithFormat:@"ip=1&data=%@", [data base64EncodedString]];
+ NSString *postBody = [NSString stringWithFormat:@"ip=1&data=%@", [data mp_base64EncodedString]];
if (self.testMode) {
NSLog(@"Mixpanel test mode is enabled");
postBody = [NSString stringWithFormat:@"test=1&%@", postBody];
View
10 MPLib/lib/NSData_Base64/NSData+Base64.h → MPLib/lib/NSData_Base64/NSData+MPBase64.h
@@ -14,20 +14,20 @@
#import <Foundation/Foundation.h>
-void *NewBase64Decode(
+void *MP_NewBase64Decode(
const char *inputBuffer,
size_t length,
size_t *outputLength);
-char *NewBase64Encode(
+char *MP_NewBase64Encode(
const void *inputBuffer,
size_t length,
bool separateLines,
size_t *outputLength);
-@interface NSData (Base64)
+@interface NSData (MP_Base64)
-+ (NSData *)dataFromBase64String:(NSString *)aString;
-- (NSString *)base64EncodedString;
++ (NSData *)mp_dataFromBase64String:(NSString *)aString;
+- (NSString *)mp_base64EncodedString;
@end
View
16 MPLib/lib/NSData_Base64/NSData+Base64.m → MPLib/lib/NSData_Base64/NSData+MPBase64.m
@@ -12,7 +12,7 @@
// appreciated but not required.
//
-#import "NSData+Base64.h"
+#import "NSData+MPBase64.h"
//
// Mapping from 6 bit pattern to ASCII character.
@@ -67,7 +67,7 @@
// returns the decoded buffer. Must be free'd by caller. Length is given by
// outputLength.
//
-void *NewBase64Decode(
+void *MP_NewBase64Decode(
const char *inputBuffer,
size_t length,
size_t *outputLength)
@@ -136,7 +136,7 @@
// returns the encoded buffer. Must be free'd by caller. Length is given by
// outputLength.
//
-char *NewBase64Encode(
+char *MP_NewBase64Encode(
const void *buffer,
size_t length,
bool separateLines,
@@ -247,7 +247,7 @@
return outputBuffer;
}
-@implementation NSData (Base64)
+@implementation NSData (MP_Base64)
//
// dataFromBase64String:
@@ -260,11 +260,11 @@ @implementation NSData (Base64)
//
// returns the autoreleased NSData representation of the base64 string
//
-+ (NSData *)dataFromBase64String:(NSString *)aString
++ (NSData *)mp_dataFromBase64String:(NSString *)aString
{
NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];
size_t outputLength;
- void *outputBuffer = NewBase64Decode([data bytes], [data length], &outputLength);
+ void *outputBuffer = MP_NewBase64Decode([data bytes], [data length], &outputLength);
NSData *result = [NSData dataWithBytes:outputBuffer length:outputLength];
free(outputBuffer);
return result;
@@ -279,11 +279,11 @@ + (NSData *)dataFromBase64String:(NSString *)aString
// returns an autoreleased NSString being the base 64 representation of the
// receiver.
//
-- (NSString *)base64EncodedString
+- (NSString *)mp_base64EncodedString
{
size_t outputLength;
char *outputBuffer =
- NewBase64Encode([self bytes], [self length], false, &outputLength);
+ MP_NewBase64Encode([self bytes], [self length], false, &outputLength);
NSString *result =
[[[NSString alloc]
View
12 MixpanelEventSample/MixpanelEventSample.xcodeproj/project.pbxproj
@@ -26,7 +26,7 @@
4E9018D411E81B3B00CAFD12 /* CSerializedJSONData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018C211E81B3B00CAFD12 /* CSerializedJSONData.m */; };
4E9018D511E81B3B00CAFD12 /* NSCharacterSet_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018C411E81B3B00CAFD12 /* NSCharacterSet_Extensions.m */; };
4E9018D611E81B3B00CAFD12 /* NSScanner_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018C611E81B3B00CAFD12 /* NSScanner_Extensions.m */; };
- 4E9018D711E81B3B00CAFD12 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018C911E81B3B00CAFD12 /* NSData+Base64.m */; };
+ 4E9018D711E81B3B00CAFD12 /* NSData+MPBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018C911E81B3B00CAFD12 /* NSData+MPBase64.m */; };
4E9018D811E81B3B00CAFD12 /* MixpanelAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018CB11E81B3B00CAFD12 /* MixpanelAPI.m */; };
4E9018D911E81B3B00CAFD12 /* MixpanelEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E9018CD11E81B3B00CAFD12 /* MixpanelEvent.m */; };
/* End PBXBuildFile section */
@@ -64,8 +64,8 @@
4E9018C411E81B3B00CAFD12 /* NSCharacterSet_Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCharacterSet_Extensions.m; sourceTree = "<group>"; };
4E9018C511E81B3B00CAFD12 /* NSScanner_Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSScanner_Extensions.h; sourceTree = "<group>"; };
4E9018C611E81B3B00CAFD12 /* NSScanner_Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSScanner_Extensions.m; sourceTree = "<group>"; };
- 4E9018C811E81B3B00CAFD12 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = "<group>"; };
- 4E9018C911E81B3B00CAFD12 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = "<group>"; };
+ 4E9018C811E81B3B00CAFD12 /* NSData+MPBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+MPBase64.h"; sourceTree = "<group>"; };
+ 4E9018C911E81B3B00CAFD12 /* NSData+MPBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MPBase64.m"; sourceTree = "<group>"; };
4E9018CA11E81B3B00CAFD12 /* MixpanelAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MixpanelAPI.h; sourceTree = "<group>"; };
4E9018CB11E81B3B00CAFD12 /* MixpanelAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MixpanelAPI.m; sourceTree = "<group>"; };
4E9018CC11E81B3B00CAFD12 /* MixpanelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MixpanelEvent.h; sourceTree = "<group>"; };
@@ -200,8 +200,8 @@
4E9018C711E81B3B00CAFD12 /* NSData_Base64 */ = {
isa = PBXGroup;
children = (
- 4E9018C811E81B3B00CAFD12 /* NSData+Base64.h */,
- 4E9018C911E81B3B00CAFD12 /* NSData+Base64.m */,
+ 4E9018C811E81B3B00CAFD12 /* NSData+MPBase64.h */,
+ 4E9018C911E81B3B00CAFD12 /* NSData+MPBase64.m */,
);
path = NSData_Base64;
sourceTree = "<group>";
@@ -284,7 +284,7 @@
4E9018D411E81B3B00CAFD12 /* CSerializedJSONData.m in Sources */,
4E9018D511E81B3B00CAFD12 /* NSCharacterSet_Extensions.m in Sources */,
4E9018D611E81B3B00CAFD12 /* NSScanner_Extensions.m in Sources */,
- 4E9018D711E81B3B00CAFD12 /* NSData+Base64.m in Sources */,
+ 4E9018D711E81B3B00CAFD12 /* NSData+MPBase64.m in Sources */,
4E9018D811E81B3B00CAFD12 /* MixpanelAPI.m in Sources */,
4E9018D911E81B3B00CAFD12 /* MixpanelEvent.m in Sources */,
);
Please sign in to comment.
Something went wrong with that request. Please try again.