Skip to content

Commit

Permalink
[TIMOB-9111] Remove Base64Transcoder dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Nov 1, 2017
1 parent f86b735 commit a7782ce
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 343 deletions.
232 changes: 0 additions & 232 deletions iphone/Classes/Base64Transcoder.c

This file was deleted.

1 change: 0 additions & 1 deletion iphone/Classes/NSData+Additions.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Please see the LICENSE included with this distribution for details.
*/

#import "Base64Transcoder.h"
#import "NSData+Additions.h"
#import <CommonCrypto/CommonCryptor.h>

Expand Down
16 changes: 0 additions & 16 deletions iphone/Classes/ThirdpartyNS.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,6 @@
#define SCListener __TI_NS_SYMBOL(SCListener)
#endif

// Base64Transcoder
#ifndef EstimateBas64EncodedDataSize
#define EstimateBas64EncodedDataSize __TI_NS_SYMBOL(EstimateBas64EncodedDataSize)
#endif
#ifndef EstimateBas64DecodedDataSize
// libtiverify dependency
// EstimateBas64DecodedDataSize is now TI_EstimateBas64DecodedDataSize
#endif
#ifndef Base64EncodeData
#define Base64EncodeData __TI_NS_SYMBOL(Base64EncodeData)
#endif
#ifndef Base64DecodeData
// libtiverify dependency
// Base64DecodeData is now TI_Base64DecodeData
#endif

// PlausibleDatabase
#ifndef PlausibleDatabase
#define PlausibleDatabase __TI_NS_SYMBOL(PlausibleDatabase)
Expand Down
18 changes: 6 additions & 12 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#ifdef USE_TI_UIWEBVIEW

#import "TiUIWebView.h"
#import "Base64Transcoder.h"
#import "Mimetypes.h"
#import "TiApp.h"
#import "TiBlob.h"
Expand Down Expand Up @@ -641,6 +640,7 @@ - (void)loadLocalURL
- (void)setBasicAuthentication:(NSArray *)args
{
ENSURE_ARG_COUNT(args, 2);

NSString *username = [args objectAtIndex:0];
NSString *password = [args objectAtIndex:1];

Expand All @@ -650,18 +650,12 @@ - (void)setBasicAuthentication:(NSArray *)args
}

NSString *toEncode = [NSString stringWithFormat:@"%@:%@", username, password];
const char *data = [toEncode UTF8String];
size_t len = [toEncode length];

char *base64Result;
size_t theResultLength;
bool result = Base64AllocAndEncodeData(data, len, &base64Result, &theResultLength);
if (result) {
NSData *theData = [NSData dataWithBytes:base64Result length:theResultLength];
free(base64Result);
NSString *string = [[[NSString alloc] initWithData:theData encoding:NSUTF8StringEncoding] autorelease];
NSData *data = [toEncode dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64Encoded = [data base64EncodedStringWithOptions:0];

if (base64Encoded != nil) {
RELEASE_TO_NIL(basicCredentials);
basicCredentials = [[NSString stringWithFormat:@"Basic %@", string] retain];
basicCredentials = [[NSString stringWithFormat:@"Basic %@", base64Encoded] retain];
if (url != nil) {
[self setUrl_:[NSArray arrayWithObject:[url absoluteString]]];
}
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#import "TiFile.h"
#import "WebFont.h"

bool Base64AllocAndEncodeData(const void *inInputData, size_t inInputDataSize, char **outOutputDataPtr, size_t *outOutputDataSize);

typedef enum {
BAD_DEST_OFFSET = -1,
BAD_SRC_OFFSET = -2,
Expand Down
26 changes: 0 additions & 26 deletions iphone/Classes/TiUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#import <CommonCrypto/CommonDigest.h>
#import <QuartzCore/QuartzCore.h>

#import "Base64Transcoder.h"
#import "ImageLoader.h"
#import "TiApp.h"
#import "TiBase.h"
Expand Down Expand Up @@ -36,31 +35,6 @@
static NSDictionary *sizeMap = nil;
static NSString *kAppUUIDString = @"com.appcelerator.uuid"; // don't obfuscate

bool Base64AllocAndEncodeData(const void *inInputData, size_t inInputDataSize, char **outOutputDataPtr, size_t *outOutputDataSize)
{
//outsize is the same as *outOutputDataSize, but is a local copy.
size_t outSize = EstimateBas64EncodedDataSize(inInputDataSize);
char *outData = NULL;
if (outSize > 0) {
outData = malloc(sizeof(char) * outSize);
}
if (outData == NULL) {
*outOutputDataSize = 0;
*outOutputDataPtr = NULL;
return NO;
}
bool result = Base64EncodeData(inInputData, inInputDataSize, outData, &outSize);
if (!result) {
free(outData);
*outOutputDataSize = 0;
*outOutputDataPtr = NULL;
return NO;
}
*outOutputDataSize = outSize;
*outOutputDataPtr = outData;
return YES;
}

@implementation TiUtils

+ (TiOrientationFlags)TiOrientationFlagsFromObject:(id)args
Expand Down

0 comments on commit a7782ce

Please sign in to comment.