[glib/wip/3v1n0/osx-declaration-mixes-fix] gosxcontenttype: Do not mix declarations with code
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/3v1n0/osx-declaration-mixes-fix] gosxcontenttype: Do not mix declarations with code
- Date: Tue, 20 Sep 2022 13:42:58 +0000 (UTC)
commit 5fc8a476c8da12c36040b33a0ea1930134039ddc
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Sep 20 15:41:08 2022 +0200
gosxcontenttype: Do not mix declarations with code
Fixes: #2759
gio/gosxcontenttype.m | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gio/gosxcontenttype.m b/gio/gosxcontenttype.m
index 6119bbcae8..fad028038a 100644
--- a/gio/gosxcontenttype.m
+++ b/gio/gosxcontenttype.m
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]