Skip to content

Commit

Permalink
clear code
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Aug 23, 2023
1 parent 0e65add commit eda3bca
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/Environment/Apple/AppleUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool AppleGetUserDefaultsString( const Char * _key, Char * const _value, size_t
return false;
}

NSString * value = [defaults objectForKey:[[NSString alloc] initWithUTF8String:_key]];
NSString * _Nullable value = [defaults objectForKey:@(_key)];

if( value == nil )
{
Expand All @@ -88,7 +88,7 @@ bool AppleSetUserDefaultsString( const Char * _key, const Char * _value )
return false;
}

[defaults setObject:[[NSString alloc] initWithUTF8String:_value] forKey:[[NSString alloc] initWithUTF8String:_key]];
[defaults setObject:@(_value) forKey:@(_key)];

[defaults synchronize];

Expand All @@ -104,7 +104,7 @@ bool AppleRemoveUserDefaultsString( const Char * _key )
return false;
}

[defaults removeObjectForKey:[[NSString alloc] initWithUTF8String:_key]];
[defaults removeObjectForKey:@(_key)];

[defaults synchronize];

Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/MemoryStreamHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ namespace Mengine
MENGINE_ASSERTION_MEMORY_PANIC( memory );

void * memory_buffer = memory->newBuffer( _size );

MENGINE_UNUSED( memory_buffer );

MENGINE_ASSERTION_MEMORY_PANIC( memory_buffer );

return memory;
Expand All @@ -139,8 +139,8 @@ namespace Mengine
MENGINE_ASSERTION_MEMORY_PANIC( memory );

void * memory_buffer = memory->newBuffer( _size );

MENGINE_UNUSED( memory_buffer );

MENGINE_ASSERTION_MEMORY_PANIC( memory_buffer );

return memory;
Expand Down
3 changes: 1 addition & 2 deletions src/Kernel/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ namespace Mengine
void * compress_memory = compress_buffer->getBuffer();

size_t read_data = _stream->read( compress_memory, compress_size );

MENGINE_UNUSED( read_data );

MENGINE_ASSERTION_FATAL( read_data == (size_t)compress_size, "invalid read data '%zu' need '%zu'"
Expand Down Expand Up @@ -571,4 +570,4 @@ namespace Mengine
}
//////////////////////////////////////////////////////////////////////////
}
}
}}
3 changes: 0 additions & 3 deletions src/Platforms/SDLPlatform/SDLInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ namespace Mengine
int x;
int y;
Uint32 state = SDL_GetMouseState( &x, &y );

MENGINE_UNUSED( state );

mt::vec2f point;
Expand Down Expand Up @@ -146,7 +145,6 @@ namespace Mengine
int x;
int y;
Uint32 state = SDL_GetMouseState( &x, &y );

MENGINE_UNUSED( state );

mt::vec2f point;
Expand Down Expand Up @@ -244,7 +242,6 @@ namespace Mengine
int x;
int y;
Uint32 state = SDL_GetMouseState( &x, &y );

MENGINE_UNUSED( state );

this->calcCursorPosition_( _sdlWindow, x, y, _point );
Expand Down
18 changes: 9 additions & 9 deletions src/Plugins/AppleGameCenterPlugin/AppleGameCenterDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ - (BOOL) login:(void(^)(NSError* _Nullable))handler {
handler( nil );
}];

return true;
return YES;
}

- (BOOL) loadCompletedAchievements:(void(^)(NSError * _Nullable, NSArray * _Nullable))handler {
if( m_authenticateSuccess == false )
{
return false;
return NO;
}

[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray<GKAchievement *> * _Nullable achievements, NSError * _Nullable error) {
Expand Down Expand Up @@ -67,26 +67,26 @@ - (BOOL) loadCompletedAchievements:(void(^)(NSError * _Nullable, NSArray * _Null
handler( nil, cmpAch );
}];

return true;
return YES;
}

- (BOOL) resetAchievements:(void(^ _Nonnull)(NSError * __nullable error))handler {
if( m_authenticateSuccess == false )
{
return false;
return NO;
}

[GKAchievement resetAchievementsWithCompletionHandler:^(NSError * _Nullable error) {
handler( error );
}];

return true;
return YES;
}

- (BOOL) reportScore:(NSString*)identifier score:(int64_t)score response:(void(^)(NSError * _Nullable))handler {
if( m_authenticateSuccess == false )
{
return false;
return NO;
}

GKScore * scoreReporter = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
Expand All @@ -98,13 +98,13 @@ - (BOOL) reportScore:(NSString*)identifier score:(int64_t)score response:(void(^
handler(error);
}];

return true;
return YES;
}

- (BOOL) reportAchievementIdentifier:(NSString*)identifier percentComplete:(double)percent withBanner:(BOOL)banner response:(void(^)(NSError * _Nullable))handler {
if( m_authenticateSuccess == false )
{
return false;
return NO;
}

GKAchievement * achievement = [[GKAchievement alloc] initWithIdentifier:identifier];
Expand All @@ -115,7 +115,7 @@ - (BOOL) reportAchievementIdentifier:(NSString*)identifier percentComplete:(doub
handler(error);
}];

return true;
return YES;
}

@end
2 changes: 1 addition & 1 deletion src/Plugins/AppleMARSDKPlugin/AppleMARSDKService.mm
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
UIViewController * rootViewController = Helper::iOSGetRootViewController();

[[MARAd sharedInstance] showRewardVideoAd:rootViewController
itemName:[[NSString alloc] initWithUTF8String:_itemName.c_str()]
itemName:@(_itemName.c_str())
itemNum:_itemNum
delegate:m_adRewardedDelegate];
}
Expand Down
3 changes: 1 addition & 2 deletions src/SDLApplication/MengineUIKitDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ - (id)init {
continue;
}

id delegate = [c alloc];
id delegate = [[c alloc] init];

[self.m_applicationDelegates addObject:delegate];
}
Expand All @@ -27,7 +27,6 @@ - (id)init {
}

- (void)dealloc {
[self.m_applicationDelegates release];
self.m_applicationDelegates = nil;

[super dealloc];
Expand Down
1 change: 0 additions & 1 deletion src/Systems/OpenGLRenderSystem/OpenGLRenderImageLocked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace Mengine
);

void * buffer = memory->newBuffer( _size );

MENGINE_UNUSED( buffer );

MENGINE_ASSERTION_MEMORY_PANIC( buffer, "invalid new memory (%zu) rect from %u %u to %u %u"
Expand Down

0 comments on commit eda3bca

Please sign in to comment.