mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-14 18:29:51 +00:00
[NoCopyRendering] In non-VM case, use calloc to get a zerod buffer. (#869)
This commit is contained in:
parent
e748d053d1
commit
e90ba47a13
@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
AS_SUBCLASSING_RESTRICTED
|
AS_SUBCLASSING_RESTRICTED
|
||||||
@interface ASCGImageBuffer : NSObject
|
@interface ASCGImageBuffer : NSObject
|
||||||
|
|
||||||
|
/// Init a zero-filled buffer with the given length.
|
||||||
- (instancetype)initWithLength:(NSUInteger)length;
|
- (instancetype)initWithLength:(NSUInteger)length;
|
||||||
|
|
||||||
@property (readonly) void *mutableBytes NS_RETURNS_INNER_POINTER;
|
@property (readonly) void *mutableBytes NS_RETURNS_INNER_POINTER;
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
// Check the VM flag again because we may have failed above.
|
// Check the VM flag again because we may have failed above.
|
||||||
if (!_isVM) {
|
if (!_isVM) {
|
||||||
_mutableBytes = malloc(length);
|
_mutableBytes = calloc(1, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user