Code formatting.

This commit is contained in:
Alexander Ljungberg committed 2012-05-13 14:26:19 +01:00
1 parent afbfde0909
commit 3525bd0183
3 files changed
+29 -29

No files matched your search

+2 -2
View File
@@ -69,7 +69,7 @@
{
var data = [[self alloc] init];
data.setBytes(bytesArray);
return data;
}
@@ -77,7 +77,7 @@
{
var data = [[self alloc] init];
data.setBase64String(aString);
return data;
}
+25 -25
View File
@@ -31,7 +31,7 @@ GLOBAL(CFData) = function()
this._bytes = NULL;
this._base64 = NULL;
}
};
CFData.prototype.propertyList = function()
{
@@ -39,7 +39,7 @@ CFData.prototype.propertyList = function()
this._propertyList = CFPropertyList.propertyListFromString(this.rawString());
return this._propertyList;
}
};
CFData.prototype.JSONObject = function()
{
@@ -55,7 +55,7 @@ CFData.prototype.JSONObject = function()
}
return this._JSONObject;
}
};
CFData.prototype.rawString = function()
{
@@ -78,7 +78,7 @@ CFData.prototype.rawString = function()
}
return this._rawString;
}
};
CFData.prototype.bytes = function()
{
@@ -87,9 +87,9 @@ CFData.prototype.bytes = function()
var bytes = CFData.stringToBytes(this.rawString());
this.setBytes(bytes);
}
return this._bytes;
}
};
CFData.prototype.base64 = function()
{
@@ -100,17 +100,17 @@ CFData.prototype.base64 = function()
base64 = CFData.encodeBase64Array(this._bytes);
else
base64 = CFData.encodeBase64String(this.rawString());
this.setBase64String(base64);
}
return this._base64;
}
};
GLOBAL(CFMutableData) = function()
{
CFData.call(this);
}
};
CFMutableData.prototype = new CFData();
@@ -133,35 +133,35 @@ CFMutableData.prototype.setPropertyList = function(/*PropertyList*/ aPropertyLis
this._propertyList = aPropertyList;
this._propertyListFormat = aFormat;
}
};
CFMutableData.prototype.setJSONObject = function(/*Object*/ anObject)
{
clearMutableData(this);
this._JSONObject = anObject
}
this._JSONObject = anObject;
};
CFMutableData.prototype.setRawString = function(/*String*/ aString)
{
clearMutableData(this);
this._rawString = aString;
}
};
CFMutableData.prototype.setBytes = function(/*Array*/ bytes)
{
clearMutableData(this);
this._bytes = bytes;
}
};
CFMutableData.prototype.setBase64String = function(/*String*/ aBase64String)
{
clearMutableData(this);
this._base64 = aBase64String;
}
};
// Base64 encoding and decoding
@@ -201,7 +201,7 @@ CFData.decodeBase64ToArray = function(input, strip)
return output.slice(0, -1 * pad);
return output;
}
};
CFData.encodeBase64Array = function(input)
{
@@ -239,23 +239,23 @@ CFData.encodeBase64Array = function(input)
}
return output.join("");
}
};
CFData.decodeBase64ToString = function(input, strip)
{
return CFData.bytesToString(CFData.decodeBase64ToArray(input, strip));
}
};
CFData.decodeBase64ToUtf16String = function(input, strip)
{
return CFData.bytesToUtf16String(CFData.decodeBase64ToArray(input, strip));
}
};
CFData.bytesToString = function(bytes)
{
// This is relatively efficient, I think:
return String.fromCharCode.apply(NULL, bytes);
}
};
CFData.stringToBytes = function(input)
{
@@ -264,7 +264,7 @@ CFData.stringToBytes = function(input)
temp.push(input.charCodeAt(i));
return temp;
}
};
CFData.encodeBase64String = function(input)
{
@@ -273,7 +273,7 @@ CFData.encodeBase64String = function(input)
temp.push(input.charCodeAt(i));
return CFData.encodeBase64Array(temp);
}
};
CFData.bytesToUtf16String = function(bytes)
{
@@ -283,7 +283,7 @@ CFData.bytesToUtf16String = function(bytes)
temp.push(bytes[i+1] << 8 | bytes[i]);
// This is relatively efficient, I think:
return String.fromCharCode.apply(NULL, temp);
}
};
CFData.encodeBase64Utf16String = function(input)
@@ -298,4 +298,4 @@ CFData.encodeBase64Utf16String = function(input)
}
return CFData.encodeBase64Array(temp);
}
};
+2 -2
View File
@@ -129,7 +129,7 @@ ConverterConversionException = @"ConverterConversionException";
if (!FILE.isReadable(temporaryPlistFilePath))
[CPException raise:ConverterConversionException reason:@"Unable to convert nib file."];
var plistContents = FILE.read(temporaryPlistFilePath, { charset:"UTF-8" });
var plistContents = FILE.read(temporaryPlistFilePath, { charset: "UTF-8" });
// Minor NS keyed archive to CP keyed archive conversion.
// Use Java directly because rhino's string.replace is *so slow*. 4 seconds vs. 1 millisecond.
@@ -142,7 +142,7 @@ ConverterConversionException = @"ConverterConversionException";
plistContents = plistContents.replace(/<string>[\u0000-\u0008\u000B\u000C\u000E-\u001F]<\/string>/g, function(c)
{
CPLog.warn("Warning: converting character 0x" + c.charCodeAt(8).toString(16) + " to base64 representation");
return "<string type=\"base64\">"+CFData.encodeBase64String(c.charAt(8))+"</string>";
return "<string type=\"base64\">" + CFData.encodeBase64String(c.charAt(8)) + "</string>";
});
}
finally