[vlc-commits] macosx: Simplify usage of toNSStr and _NS

David Fuhrmann git at videolan.org
Sun Apr 26 09:48:55 CEST 2020


vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jun  9 19:37:41 2018 +0200| [739b7322a8cbddd68e5db0c01096448c570c4f62] | committer: David Fuhrmann

macosx: Simplify usage of toNSStr and _NS

Both correctly check for NULL char* already.

fixes #24638

(cherry picked from commit f31ea49802cd81a1104bb9ea60be46adaddf18e7)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=739b7322a8cbddd68e5db0c01096448c570c4f62
---

 modules/gui/macosx/prefs_widgets.m | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index a4bd1dbedc..e77e39805b 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -936,10 +936,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc];              \
         [self addSubview: self.label];
 
         /* build the textfield */
-        if (p_item->value.psz)
-            o_textfieldString = toNSStr(p_item->value.psz);
-        else
-            o_textfieldString = @"";
+        o_textfieldString = toNSStr(p_item->value.psz);
         if (p_item->i_type == CONFIG_ITEM_PASSWORD) {
             ADD_SECURETEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
                                 0, mainFrame.size.width - [self.label frame].size.width -
@@ -1127,10 +1124,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc];              \
         [self addSubview: o_button];
 
         /* build the textfield */
-        if (p_item->value.psz)
-            o_textfieldString = [NSString stringWithFormat: @"%s", (char *)p_item->value.psz];
-        else
-            o_textfieldString = @"";
+        o_textfieldString = toNSStr(p_item->value.psz);
         ADD_TEXTFIELD(o_textfield, mainFrame, 12, 2, mainFrame.size.width -
                       8 - [o_button frame].size.width,
                       o_itemTooltip, o_textfieldString)
@@ -2102,10 +2096,7 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
     [self addSubview: self.label];
 
     /* build the textfield */
-    if (p_item->value.psz)
-        o_textfieldString = _NS(p_item->value.psz);
-    else
-        o_textfieldString = @"";
+    o_textfieldString = _NS(p_item->value.psz);
     ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
                   mainFrame.size.height - 22, mainFrame.size.width -
                   [self.label frame].size.width - 2, toolTip, o_textfieldString)



More information about the vlc-commits mailing list