[vlc-commits] [Git][videolan/vlc][master] macosx: Fix nullable warnings with NSString helpers extension

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Sep 5 03:02:57 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e6cea897 by Claudio Cambra at 2026-09-05T02:53:50+00:00
macosx: Fix nullable warnings with NSString helpers extension

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


1 changed file:

- modules/gui/macosx/extensions/NSString+Helpers.h


Changes:

=====================================
modules/gui/macosx/extensions/NSString+Helpers.h
=====================================
@@ -28,6 +28,8 @@
 #import <Cocoa/Cocoa.h>
 #import <vlc_input.h>
 
+NS_ASSUME_NONNULL_BEGIN
+
 #define NSTR(s) ((s) ? toNSStr(vlc_gettext(s)) : @"")
 
 /**
@@ -66,7 +68,7 @@ extern NSString *const kVLCMediaUnknown;
  * The returned string is autoreleased, so callers must take care of
  * setting up an appropriate @autoreleasepool block where suitable.
  */
-NSString *toNSStr(const char *str);
+NSString *toNSStr(const char * _Nullable str);
 
 /**
  * Takes the first value of an cocoa key string, and converts it to VLCs int representation.
@@ -136,7 +138,7 @@ bool fixIntfSettings(void);
 
  \param aString the string to parse
  */
-+ (NSInteger)timeInSecondsFromStringWithColons:(NSString *)aString;
++ (NSInteger)timeInSecondsFromStringWithColons:(nullable NSString *)aString;
 
 /**
  Creates an NSString from the given null-terminated C string
@@ -145,7 +147,7 @@ bool fixIntfSettings(void);
  This method allocates and initializes an NSString with the
  provided C string encoded as base64.
  */
-+ (instancetype)base64StringWithCString:(const char *)cstring;
++ (nullable instancetype)base64StringWithCString:(nullable const char *)cstring;
 
 /**
  Base64 encoded copy of the string
@@ -153,7 +155,7 @@ bool fixIntfSettings(void);
  Encode the string as Base64 string and return the result or
  nil on failure.
  */
-- (NSString *)base64EncodedString;
+- (nullable NSString *)base64EncodedString;
 
 /**
  Base64 decoded copy of the string
@@ -161,7 +163,7 @@ bool fixIntfSettings(void);
  Decode the string as Base64 string and return the result or
  nil on failure.
  */
-- (NSString *)base64DecodedString;
+- (nullable NSString *)base64DecodedString;
 
 /**
  Returns a copy of the receiver string, wrapped to the specified width
@@ -171,7 +173,7 @@ bool fixIntfSettings(void);
 
  \param width Width in pixel
  */
-- (NSString *)stringWrappedToWidth:(int)width;
+- (nullable NSString *)stringWrappedToWidth:(int)width;
 
 /**
  Returns a new string with a trailing number in the format of  "ORIGINALSTRING (2)"
@@ -179,13 +181,13 @@ bool fixIntfSettings(void);
  If there is no existing trailing number in the string, a starting value of " (2)" will be appended.
  If there is an existing trailing number in the string, the number value will be incremented.
  */
-- (NSString *)stringWithIncrementedTrailingNumber;
+- (nullable NSString *)stringWithIncrementedTrailingNumber;
 
 /**
  * Returns an array of file extensions from a semicolon-separated string of extensions,
  * stripping any leading "*." prefix.
  */
-+ (NSArray<NSString *> *)extensionsArrayFromVLCStyleString:(const char *)extensionsString;
++ (nullable NSArray<NSString *> *)extensionsArrayFromVLCStyleString:(nullable const char *)extensionsString;
 
 @end
 
@@ -197,7 +199,7 @@ bool fixIntfSettings(void);
 
  \warning Compatibility function, do not use in new code!
  */
-static inline NSString *B64DecNSStr(NSString *s) {
+static inline NSString * _Nullable B64DecNSStr(NSString * _Nullable s) {
     NSString *res = [s base64DecodedString];
 
     return (res == nil) ? @"" : res;
@@ -212,35 +214,37 @@ static inline NSString *B64DecNSStr(NSString *s) {
 
  \warning Compatibility function, do not use in new code!
  */
-static inline NSString *B64EncAndFree(char *cs) {
+static inline NSString * _Nullable B64EncAndFree(char * _Nullable cs) {
     NSString *res = [NSString base64StringWithCString:cs];
     free(cs);
 
     return (res == nil) ? @"" : res;
 }
 
-NSString * getVolumeTypeFromMountPath(NSString *mountPath);
+NSString * _Nullable getVolumeTypeFromMountPath(NSString * _Nullable mountPath);
 
-NSString * getBSDNodeFromMountPath(NSString *mountPath);
+NSString * _Nullable getBSDNodeFromMountPath(NSString * _Nullable mountPath);
 
 /**
  * Converts an ISO 3166-1 alpha-2 country code to its flag emoji.
  */
-NSString * flagEmojiStringForCountryCode(NSString *countryCode);
+NSString * _Nullable flagEmojiStringForCountryCode(NSString * _Nullable countryCode);
 
 /**
  * Converts VLC key string to a prettified version, for hotkey settings.
  * The returned string adapts similar how its done within the cocoa framework when setting this
  * key to menu items.
  */
-NSString * OSXStringKeyToString(NSString *theString);
+NSString * _Nullable OSXStringKeyToString(NSString * _Nullable theString);
 
 /**
  * Converts VLC key string to cocoa modifiers which can be used as setKeyEquivalent for menu items
  */
-NSString * VLCKeyToString(char *theChar);
+NSString * _Nullable VLCKeyToString(char * _Nullable theChar);
 
 /**
  * Converts VLC key to cocoa string which can be used as setKeyEquivalentModifierMask for menu items
  */
-unsigned int VLCModifiersToCocoa(char *theChar);
+unsigned int VLCModifiersToCocoa(char * _Nullable theChar);
+
+NS_ASSUME_NONNULL_END



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e6cea8973f91db15ff56da7b1ee1909cd8aefd38

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e6cea8973f91db15ff56da7b1ee1909cd8aefd38
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list