mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
Merge branch 'osx-declaration-mixes-fix' into 'main'
gosxcontenttype: Do not mix declarations with code Closes #2759 See merge request GNOME/glib!2909
This commit is contained in:
commit
cf4d8a3bdc
@ -58,13 +58,18 @@ create_cfstring_from_cstr (const gchar *cstr)
|
||||
static gchar *
|
||||
create_cstr_from_cfstring (CFStringRef str)
|
||||
{
|
||||
CFIndex length;
|
||||
CFIndex maxlen;
|
||||
gchar *buffer;
|
||||
Boolean success;
|
||||
|
||||
g_return_val_if_fail (str != NULL, NULL);
|
||||
|
||||
CFIndex length = CFStringGetLength (str);
|
||||
CFIndex maxlen = CFStringGetMaximumSizeForEncoding (length, kCFStringEncodingUTF8);
|
||||
gchar *buffer = g_malloc (maxlen + 1);
|
||||
Boolean success = CFStringGetCString (str, (char *) buffer, maxlen,
|
||||
kCFStringEncodingUTF8);
|
||||
length = CFStringGetLength (str);
|
||||
maxlen = CFStringGetMaximumSizeForEncoding (length, kCFStringEncodingUTF8);
|
||||
buffer = g_malloc (maxlen + 1);
|
||||
success = CFStringGetCString (str, (char *) buffer, maxlen,
|
||||
kCFStringEncodingUTF8);
|
||||
CFRelease (str);
|
||||
if (success)
|
||||
return buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user