Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning and adaptive OS #421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Demo/YYKitDemo/T1Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
@property (nonatomic, assign) uint32_t participantsCount;
@property (nonatomic, assign) uint32_t targetCount; // 0 if no target items
@property (nonatomic, strong) NSString *rootUserID;
@property (nonatomic, strong) NSArray *contextIDs; //<
@property (nonatomic, strong) NSArray *contextIDs; ///<
@property (nonatomic, strong) NSArray *entityIDs;

@property (nonatomic, strong) NSArray *tweets; // Array<T1Tweet>
Expand Down
4 changes: 2 additions & 2 deletions Demo/YYKitDemo/WBStatusCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ - (void)setLayout:(WBStatusLayout *)layout {
[_profileView.avatarView setImageWithURL:layout.status.user.avatarLarge //profileImageURL
placeholder:nil
options:kNilOptions
manager:[WBStatusHelper avatarImageManager] //< 圆角头像manager,内置圆角处理
manager:[WBStatusHelper avatarImageManager] ///< 圆角头像manager,内置圆角处理
progress:nil
transform:nil
completion:nil];
Expand Down Expand Up @@ -981,7 +981,7 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
}

- (void)prepareForReuse {
// ignore
[super prepareForReuse];
}

- (void)setLayout:(WBStatusLayout *)layout {
Expand Down
2 changes: 1 addition & 1 deletion Demo/YYKitDemo/YYWebImageExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ - (void)setImageURL:(NSURL *)url {
}

- (void)prepareForReuse {
//nothing
[super prepareForReuse];
}

@end
Expand Down
4 changes: 2 additions & 2 deletions YYKit/Base/Quartz/YYCGUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ CGContextRef _Nullable YYCGContextCreateGrayBitmapContext(CGSize size, CGFloat s


/// Get main screen's scale.
CGFloat YYScreenScale();
CGFloat YYScreenScale(void);

/// Get main screen's size. Height is always larger than width.
CGSize YYScreenSize();
CGSize YYScreenSize(void);



Expand Down
4 changes: 2 additions & 2 deletions YYKit/Base/YYKitMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static inline bool dispatch_is_main_queue() {
/**
Submits a block for asynchronous execution on a main queue and returns immediately.
*/
static inline void dispatch_async_on_main_queue(void (^block)()) {
static inline void dispatch_async_on_main_queue(void (^block)(void)) {
if (pthread_main_np()) {
block();
} else {
Expand All @@ -302,7 +302,7 @@ static inline void dispatch_async_on_main_queue(void (^block)()) {
/**
Submits a block for execution on a main queue and waits until the block completes.
*/
static inline void dispatch_sync_on_main_queue(void (^block)()) {
static inline void dispatch_sync_on_main_queue(void (^block)(void)) {
if (pthread_main_np()) {
block();
} else {
Expand Down
6 changes: 3 additions & 3 deletions YYKit/Image/YYImageCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ CG_EXTERN NSString *_Nullable YYImageTypeGetExtension(YYImageType type);


/// Returns the shared DeviceRGB color space.
CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceRGB();
CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceRGB(void);

/// Returns the shared DeviceGray color space.
CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceGray();
CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceGray(void);

/// Returns whether a color space is DeviceRGB.
CG_EXTERN BOOL YYCGColorSpaceIsDeviceRGB(CGColorSpaceRef space);
Expand Down Expand Up @@ -446,7 +446,7 @@ CG_EXTERN CFDataRef _Nullable YYCGImageCreateEncodedData(CGImageRef imageRef, YY
/**
Whether WebP is available in YYImage.
*/
CG_EXTERN BOOL YYImageWebPAvailable();
CG_EXTERN BOOL YYImageWebPAvailable(void);

/**
Get a webp image frame count;
Expand Down
4 changes: 2 additions & 2 deletions YYKit/Model/NSObject+YYModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,9 @@ static void ModelSetValueForProperty(__unsafe_unretained id model,

case YYEncodingTypeBlock: {
if (isNull) {
((void (*)(id, SEL, void (^)()))(void *) objc_msgSend)((id)model, meta->_setter, (void (^)())NULL);
((void (*)(id, SEL, void (^)(void)))(void *) objc_msgSend)((id)model, meta->_setter, (void (^)(void))NULL);
} else if ([value isKindOfClass:YYNSBlockClass()]) {
((void (*)(id, SEL, void (^)()))(void *) objc_msgSend)((id)model, meta->_setter, (void (^)())value);
((void (*)(id, SEL, void (^)(void)))(void *) objc_msgSend)((id)model, meta->_setter, (void (^)(void))value);
}
} break;

Expand Down
4 changes: 2 additions & 2 deletions YYKit/Text/String/YYTextUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ static inline UTF32Char UTF16SurrogatePairToUTF32Char(UTF16Char char16[_Nonnull
Get the character set which should rotate in vertical form.
@return The shared character set.
*/
NSCharacterSet *YYTextVerticalFormRotateCharacterSet();
NSCharacterSet *YYTextVerticalFormRotateCharacterSet(void);

/**
Get the character set which should rotate and move in vertical form.
@return The shared character set.
*/
NSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet();
NSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet(void);

NS_ASSUME_NONNULL_END
YY_EXTERN_C_END
2 changes: 1 addition & 1 deletion YYKit/Utility/YYAsyncLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ - (void)_displayAsync:(BOOL)async {
if (task.willDisplay) task.willDisplay(self);
YYSentinel *sentinel = _sentinel;
int32_t value = sentinel.value;
BOOL (^isCancelled)() = ^BOOL() {
BOOL (^isCancelled)(void) = ^BOOL() {
return value != sentinel.value;
};
CGSize size = self.bounds.size;
Expand Down
4 changes: 3 additions & 1 deletion YYKit/Utility/YYDispatchQueuePool.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "YYDispatchQueuePool.h"
#import <UIKit/UIKit.h>
#import <libkern/OSAtomic.h>
#import <stdatomic.h>

#define MAX_QUEUE_COUNT 32

Expand Down Expand Up @@ -93,7 +94,8 @@ static void YYDispatchContextRelease(YYDispatchContext *context) {
}

static dispatch_queue_t YYDispatchContextGetQueue(YYDispatchContext *context) {
uint32_t counter = (uint32_t)OSAtomicIncrement32(&context->counter);
_Atomic uint32_t counter = atomic_fetch_add_explicit(&counter, 1, memory_order_relaxed);
counter = ++context->counter;
void *queue = context->queues[counter % context->queueCount];
return (__bridge dispatch_queue_t)(queue);
}
Expand Down