Skip to content

Commit

Permalink
Cosmetic tweaks to match coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Jun 6, 2019
1 parent 75850de commit 2425c42
Show file tree
Hide file tree
Showing 8 changed files with 334 additions and 236 deletions.
14 changes: 7 additions & 7 deletions Headers/Foundation/NSBundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
* Sets the Java Android asset manager.
* The developer can call this method to enable asset loading via NSBundle.
*/
+ (void) setJavaAssetManager:(jobject)jassetManager withJNIEnv:(JNIEnv *)env;
+ (void) setJavaAssetManager: (jobject)jassetManager withJNIEnv: (JNIEnv *)env;

/**
* Returns the native Android asset manager.
Expand All @@ -566,22 +566,22 @@ GS_EXPORT NSString* const NSLoadedClasses;
* Uses `AASSET_MODE_UNKNOWN` to open the asset if it exists.
* The returned object must be released using AAsset_close().
*/
+ (AAsset *)assetForPath:(NSString *)path;
+ (AAsset *) assetForPath: (NSString *)path;

/**
* Returns the Android asset for the given path if path is in main bundle
* resources and asset exists.
* Uses the given mode to open the AAsset if it exists.
* The returned object must be released using AAsset_close().
*/
+ (AAsset *)assetForPath:(NSString *)path withMode:(int)mode;
+ (AAsset *) assetForPath: (NSString *)path withMode: (int)mode;

/**
* Returns the Android asset dir for the given path if path is in main bundle
* resources and the asset directory exists.
* The returned object must be released using AAssetDir_close().
*/
+ (AAssetDir *)assetDirForPath:(NSString *)path;
+ (AAssetDir *) assetDirForPath: (NSString *)path;

#endif /* __ANDROID__ */

Expand Down Expand Up @@ -648,7 +648,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
* </p>
*/
#define NSLocalizedString(key, comment) \
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
[[NSBundle mainBundle] localizedStringForKey: (key) value: @"" table: nil]

/**
* This function (macro) does the same as
Expand All @@ -666,7 +666,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
* different table.
*/
#define NSLocalizedStringFromTable(key, tbl, comment) \
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
[[NSBundle mainBundle] localizedStringForKey: (key) value: @"" table: (tbl)]

/**
* This function is the full-blown localization function (it
Expand All @@ -682,7 +682,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
* use when translating the string.
*/
#define NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment) \
[bundle localizedStringForKey:(key) value:@"" table:(tbl)]
[bundle localizedStringForKey: (key) value: @"" table: (tbl)]


#if defined(__cplusplus)
Expand Down
49 changes: 25 additions & 24 deletions Source/GSFileHandle.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ - (NSInteger) read: (void*)buf length: (NSUInteger)len
{
#ifdef __ANDROID__
if (asset)
{
result = AAsset_read(asset, buf, len);
}
{
result = AAsset_read(asset, buf, len);
}
else
#endif
#if USE_ZLIB
Expand Down Expand Up @@ -388,10 +388,10 @@ - (void) finalize

#ifdef __ANDROID__
if (asset)
{
AAsset_close(asset);
asset = NULL;
}
{
AAsset_close(asset);
asset = NULL;
}
else
#endif
if (closeOnDealloc == YES && descriptor != -1)
Expand Down Expand Up @@ -1092,10 +1092,11 @@ - (id) initForReadingAtPath: (NSString*)path
{
#ifdef __ANDROID__
asset = [NSBundle assetForPath:path withMode:AASSET_MODE_RANDOM];
if (asset) {
readOK = YES;
return self;
}
if (asset)
{
readOK = YES;
return self;
}
#endif

DESTROY(self);
Expand Down Expand Up @@ -1670,9 +1671,9 @@ - (unsigned long long) offsetInFile

#ifdef __ANDROID__
if (asset)
{
result = AAsset_seek(asset, 0, SEEK_CUR);
}
{
result = AAsset_seek(asset, 0, SEEK_CUR);
}
else
#endif
if (isStandardFile && descriptor >= 0)
Expand Down Expand Up @@ -1701,9 +1702,9 @@ - (unsigned long long) seekToEndOfFile

#ifdef __ANDROID__
if (asset)
{
result = AAsset_seek(asset, 0, SEEK_END);
}
{
result = AAsset_seek(asset, 0, SEEK_END);
}
else
#endif
if (isStandardFile && descriptor >= 0)
Expand Down Expand Up @@ -1732,9 +1733,9 @@ - (void) seekToFileOffset: (unsigned long long)pos

#ifdef __ANDROID__
if (asset)
{
result = AAsset_seek(asset, (off_t)pos, SEEK_SET);
}
{
result = AAsset_seek(asset, (off_t)pos, SEEK_SET);
}
else
#endif
if (isStandardFile && descriptor >= 0)
Expand Down Expand Up @@ -1773,10 +1774,10 @@ - (void) closeFile

#ifdef __ANDROID__
if (asset)
{
AAsset_close(asset);
asset = NULL;
}
{
AAsset_close(asset);
asset = NULL;
}
else
#endif
#if USE_ZLIB
Expand Down
14 changes: 5 additions & 9 deletions Source/GSTimSort.m
Original file line number Diff line number Diff line change
Expand Up @@ -627,15 +627,11 @@ - (void) suggestMerge
while (stackSize > 1)
{
NSInteger n = stackSize -2;
if ( (n >= 1
&& runStack[n-1].length <= (runStack[n].length
+ runStack[n+1].length)
)
|| (n >= 2
&& runStack[n-2].length <= (runStack[n].length
+ runStack[n-1].length)
)
)

if ((n >= 1 && runStack[n-1].length
<= (runStack[n].length + runStack[n+1].length))
|| (n >= 2 && runStack[n-2].length
<= (runStack[n].length + runStack[n-1].length)))
{
if (runStack[n-1].length < runStack[n+1].length)
{
Expand Down
Loading

0 comments on commit 2425c42

Please sign in to comment.