[vlc-devel] [PATCH] keystore: keychain: fix warnings

Marvin Scholz epirat07 at gmail.com
Fri Jul 17 12:46:06 CEST 2020


LGTM, thanks!

On 17 Jul 2020, at 12:27, Alexandre Janniaux wrote:

> ../../../modules/keystore/keychain.m:431:58: warning: values of type 
> 'OSStatus' should not be used as format arguments; add an explicit
>       cast to 'int' instead [-Wformat]
>         msg_Err(p_keystore, "Storage failed (%i: '%s')", status, 
> [ErrorForStatus(status) UTF8String]);
>                                              ~~          ^~~~~~
>                                              %i          (int)
> ../../../include/vlc_messages.h:102:38: note: expanded from macro 
> 'msg_Err'
>     msg_Generic(p_this, VLC_MSG_ERR, __VA_ARGS__)
>                                      ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ../../../modules/keystore/keychain.m:459:58: warning: values of type 
> 'OSStatus' should not be used as format arguments; add an explicit
>       cast to 'int' instead [-Wformat]
>         msg_Warn(p_keystore, "lookup failed (%i: '%s')", status, 
> [ErrorForStatus(status) UTF8String]);
>                                              ~~          ^~~~~~
>                                              %i          (int)
> ../../../include/vlc_messages.h:104:39: note: expanded from macro 
> 'msg_Warn'
>     msg_Generic(p_this, VLC_MSG_WARN, __VA_ARGS__)
>                                       ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ../../../modules/keystore/keychain.m:465:76: warning: values of type 
> 'NSUInteger' should not be used as format arguments; add an
>       explicit cast to 'unsigned long' instead [-Wformat]
>     msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes", count);
>                                ~~~                                     
>     ^~~~~
>                                %lu                                     
>     (unsigned long)
> ../../../include/vlc_messages.h:106:38: note: expanded from macro 
> 'msg_Dbg'
>     msg_Generic(p_this, VLC_MSG_DBG, __VA_ARGS__)
>                                      ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ../../../modules/keystore/keychain.m:492:58: warning: values of type 
> 'OSStatus' should not be used as format arguments; add an explicit
>       cast to 'int' instead [-Wformat]
>             msg_Err(p_keystore, "Lookup error: %i (%s)", status, 
> [ErrorForStatus(status) UTF8String]);
>                                                ~~        ^~~~~~
>                                                %i        (int)
> ../../../include/vlc_messages.h:102:38: note: expanded from macro 
> 'msg_Err'
>     msg_Generic(p_this, VLC_MSG_ERR, __VA_ARGS__)
>                                      ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ../../../modules/keystore/keychain.m:538:58: warning: values of type 
> 'OSStatus' should not be used as format arguments; add an explicit
>       cast to 'int' instead [-Wformat]
>   CC       mux/dummy.lo
>         msg_Warn(p_keystore, "lookup failed (%i: '%s')", status, 
> [ErrorForStatus(status) UTF8String]);
>                                              ~~          ^~~~~~
>                                              %i          (int)
> ../../../include/vlc_messages.h:104:39: note: expanded from macro 
> 'msg_Warn'
>     msg_Generic(p_this, VLC_MSG_WARN, __VA_ARGS__)
>                                       ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ../../../modules/keystore/keychain.m:544:76: warning: values of type 
> 'NSUInteger' should not be used as format arguments; add an
>       explicit cast to 'unsigned long' instead [-Wformat]
>     msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes", count);
>                                ~~~                                     
>     ^~~~~
>                                %lu                                     
>     (unsigned long)
> ../../../include/vlc_messages.h:106:38: note: expanded from macro 
> 'msg_Dbg'
>     msg_Generic(p_this, VLC_MSG_DBG, __VA_ARGS__)
>                                      ^~~~~~~~~~~
> ../../../include/vlc_messages.h:98:30: note: expanded from macro 
> 'msg_Generic'
>                    __func__, __VA_ARGS__)
>                              ^~~~~~~~~~~
> ---
>  modules/keystore/keychain.m | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/modules/keystore/keychain.m b/modules/keystore/keychain.m
> index 353f152c93c..f5ccf36b636 100644
> --- a/modules/keystore/keychain.m
> +++ b/modules/keystore/keychain.m
> @@ -428,7 +428,7 @@ static int Store(vlc_keystore *p_keystore,
>          status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
>      }
>      if (status != errSecSuccess) {
> -        msg_Err(p_keystore, "Storage failed (%i: '%s')", status, 
> [ErrorForStatus(status) UTF8String]);
> +        msg_Err(p_keystore, "Storage failed (%i: '%s')", (int)status, 
> [ErrorForStatus(status) UTF8String]);
>          return VLC_EGENERIC;
>      }
>
> @@ -462,7 +462,7 @@ static unsigned int Find(vlc_keystore *p_keystore,
>
>      NSArray *listOfResults = (__bridge_transfer NSArray *)result;
>      NSUInteger count = listOfResults.count;
> -    msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes", count);
> +    msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes", (unsigned long)count);
>
>      vlc_keystore_entry *p_entries = calloc(count,
>                                             sizeof(vlc_keystore_entry));
> @@ -489,7 +489,7 @@ static unsigned int Find(vlc_keystore *p_keystore,
>          CFTypeRef secretResult = NULL;
>          status = SecItemCopyMatching((__bridge 
> CFDictionaryRef)passwordFetchQuery, &secretResult);
>          if (status != noErr) {
> -            msg_Err(p_keystore, "Lookup error: %i (%s)", status, 
> [ErrorForStatus(status) UTF8String]);
> +            msg_Err(p_keystore, "Lookup error: %i (%s)", (int)status, 
> [ErrorForStatus(status) UTF8String]);
>              vlc_keystore_release_entries(p_entries, (unsigned 
> int)count);
>              return 0;
>          }
> @@ -535,13 +535,14 @@ static unsigned int Remove(vlc_keystore 
> *p_keystore,
>      /* do a copy matching to see how many items we are going to 
> delete */
>      status = SecItemCopyMatching((__bridge CFDictionaryRef)query, 
> &result);
>      if (status != errSecSuccess) {
> -        msg_Warn(p_keystore, "lookup failed (%i: '%s')", status, 
> [ErrorForStatus(status) UTF8String]);
> +        msg_Warn(p_keystore, "lookup failed (%i: '%s')", (int)status, 
> [ErrorForStatus(status) UTF8String]);
>          return 0;
>      }
>
>      NSArray *listOfResults = (__bridge_transfer NSArray *)result;
>      NSUInteger count = listOfResults.count;
> -    msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes", count);
> +    msg_Dbg(p_keystore, "found %lu result(s) for the provided 
> attributes",
> +            (unsigned long)count);
>
>      /* delete everything!! */
>      status = SecItemDelete((__bridge CFDictionaryRef)query);
> -- 
> 2.27.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list