[vlc-commits] macosx: fix moaar utf8 rendering issues
David Fuhrmann
git at videolan.org
Sat Aug 24 09:39:42 CEST 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Aug 24 09:39:24 2013 +0200| [37641596f63ae71dd00493f645f1f6a5347a5b06] | committer: David Fuhrmann
macosx: fix moaar utf8 rendering issues
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=37641596f63ae71dd00493f645f1f6a5347a5b06
---
modules/gui/macosx/AudioEffects.m | 2 +-
modules/gui/macosx/ConvertAndSave.m | 2 +-
modules/gui/macosx/MainMenu.m | 2 +-
modules/gui/macosx/StringUtility.h | 3 +++
modules/gui/macosx/bookmarks.m | 6 +++---
modules/gui/macosx/coredialogs.m | 4 ----
6 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/modules/gui/macosx/AudioEffects.m b/modules/gui/macosx/AudioEffects.m
index b38fbf4..899a926 100644
--- a/modules/gui/macosx/AudioEffects.m
+++ b/modules/gui/macosx/AudioEffects.m
@@ -473,7 +473,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
NSString *currentPreset = nil;
if (p_aout) {
char *psz_preset_string = var_GetNonEmptyString(p_aout, "equalizer-preset");
- currentPreset = [NSString stringWithFormat:@"%s", psz_preset_string];
+ currentPreset = toNSStr(psz_preset_string);
free(psz_preset_string);
vlc_object_release(p_aout);
}
diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m
index 55c02b9..a1e8726 100644
--- a/modules/gui/macosx/ConvertAndSave.m
+++ b/modules/gui/macosx/ConvertAndSave.m
@@ -572,7 +572,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
if (p_item) {
if (p_item->p_input) {
if (p_item->p_input->psz_uri != nil) {
- [self setMRL: [NSString stringWithFormat:@"%s", p_item->p_input->psz_uri]];
+ [self setMRL: toNSStr(p_item->p_input->psz_uri)];
[self updateDropView];
[self updateOKButton];
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 1082997..4e1d4a5 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -801,7 +801,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
NSMenuItem * o_mi_tmp;
for (NSUInteger x = 0; x < n; x++) {
- o_mi_tmp = [o_mu_device addItemWithTitle:[NSString stringWithFormat:@"%s", names[x]] action:@selector(toggleAudioDevice:) keyEquivalent:@""];
+ o_mi_tmp = [o_mu_device addItemWithTitle:toNSStr(names[x]) action:@selector(toggleAudioDevice:) keyEquivalent:@""];
[o_mi_tmp setTarget:self];
[o_mi_tmp setTag:[[NSString stringWithFormat:@"%s", ids[x]] intValue]];
}
diff --git a/modules/gui/macosx/StringUtility.h b/modules/gui/macosx/StringUtility.h
index c80087b..a412ff5 100644
--- a/modules/gui/macosx/StringUtility.h
+++ b/modules/gui/macosx/StringUtility.h
@@ -35,6 +35,9 @@
#define B64DecNSStr(s) [[VLCStringUtility sharedInstance] b64Decode: s]
#define B64EncAndFree(s) [[VLCStringUtility sharedInstance] b64EncodeAndFree: s]
+inline NSString *toNSStr(const char *str) {
+ return str != NULL ? [NSString stringWithUTF8String:str] : @"";
+}
unsigned int CocoaKeyToVLC(unichar i_key);
diff --git a/modules/gui/macosx/bookmarks.m b/modules/gui/macosx/bookmarks.m
index e8ef385..cf5f999 100644
--- a/modules/gui/macosx/bookmarks.m
+++ b/modules/gui/macosx/bookmarks.m
@@ -181,7 +181,7 @@ static VLCBookmarks *_o_sharedInstance = nil;
return;
}
- [o_edit_fld_name setStringValue: [NSString stringWithFormat:@"%s", pp_bookmarks[row]->psz_name]];
+ [o_edit_fld_name setStringValue: toNSStr(pp_bookmarks[row]->psz_name)];
int total = pp_bookmarks[row]->i_time_offset/ 1000000;
int hour = total / (60*60);
int min = (total - hour*60*60) / 60;
@@ -306,7 +306,7 @@ clear:
}
char *psz_uri = input_item_GetURI(input_GetItem(p_input));
- [[[VLCMain sharedInstance] wizard] initWithExtractValuesFrom: [NSString stringWithFormat:@"%lli", pp_bookmarks[i_first]->i_time_offset/1000000] to: [NSString stringWithFormat:@"%lli", pp_bookmarks[i_second]->i_time_offset/1000000] ofItem: [NSString stringWithFormat:@"%s", psz_uri]];
+ [[[VLCMain sharedInstance] wizard] initWithExtractValuesFrom: [NSString stringWithFormat:@"%lli", pp_bookmarks[i_first]->i_time_offset/1000000] to: [NSString stringWithFormat:@"%lli", pp_bookmarks[i_second]->i_time_offset/1000000] ofItem: toNSStr(psz_uri)];
free(psz_uri);
vlc_object_release(p_input);
@@ -395,7 +395,7 @@ clear:
else {
NSString * identifier = [theTableColumn identifier];
if ([identifier isEqualToString: @"description"])
- ret = [NSString stringWithFormat:@"%s", pp_bookmarks[row]->psz_name];
+ ret = toNSStr(pp_bookmarks[row]->psz_name);
else if ([identifier isEqualToString: @"size_offset"])
ret = [NSString stringWithFormat:@"%lli", pp_bookmarks[row]->i_byte_offset];
else if ([identifier isEqualToString: @"time_offset"]) {
diff --git a/modules/gui/macosx/coredialogs.m b/modules/gui/macosx/coredialogs.m
index 48b1bab..8e4a79f 100644
--- a/modules/gui/macosx/coredialogs.m
+++ b/modules/gui/macosx/coredialogs.m
@@ -29,10 +29,6 @@
/* for the icon in our custom error panel */
#import <ApplicationServices/ApplicationServices.h>
-NSString *toNSStr(const char *str) {
- return str != NULL ? [NSString stringWithUTF8String:str] : @"";
-}
-
/*****************************************************************************
* VLCCoreDialogProvider implementation
*****************************************************************************/
More information about the vlc-commits
mailing list