diff options
Diffstat (limited to 'src/libical-glib/tools/generator.c')
-rw-r--r-- | src/libical-glib/tools/generator.c | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/src/libical-glib/tools/generator.c b/src/libical-glib/tools/generator.c index f178ec9d..cdd19f5d 100644 --- a/src/libical-glib/tools/generator.c +++ b/src/libical-glib/tools/generator.c @@ -1,16 +1,7 @@ /* - * Copyright (C) 2015 William Yu <williamyu@gnome.org> + * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org> * - * This library is free software; you can redistribute it and/or modify - * it under the terms of either: - * - * The LGPL as published by the Free Software Foundation, version - * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html - * - * Or: - * - * The Mozilla Public License Version 2.0. You may obtain a copy of - * the License at https://www.mozilla.org/MPL/ + * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0 */ #include "generator.h" @@ -329,26 +320,6 @@ gchar *get_lower_train_from_upper_camel(const gchar *upperCamel) return ret; } -void generate_header_method_get_type(FILE *out, Structure *structure) -{ - gchar *upperCamel; - gchar *lowerSnake; - Method *get_type; - - g_return_if_fail(out != NULL && structure != NULL); - upperCamel = g_strconcat(structure->nameSpace, structure->name, NULL); - lowerSnake = get_lower_snake_from_upper_camel(upperCamel); - g_free(upperCamel); - - get_type = method_new(); - get_type->ret = ret_new(); - get_type->ret->type = g_strdup("GType"); - get_type->name = g_strconcat(lowerSnake, "_get_type", NULL); - g_free(lowerSnake); - generate_header_method_proto(out, get_type, FALSE); - method_free(get_type); -} - void generate_header_method_new_full(FILE *out, Structure *structure) { gchar *upperCamel; @@ -707,8 +678,6 @@ void generate_header_method_protos(FILE *out, Structure *structure) write_str(privateHeader, privateHeaderComment); g_free(privateHeaderComment); generate_header_method_new_full(privateHeader, structure); - - generate_header_method_get_type(out, structure); } for (iter = g_list_first(structure->methods); iter != NULL; iter = g_list_next(iter)) { @@ -1667,7 +1636,7 @@ gchar *get_inline_parameter(Parameter *para) (void)g_stpcpy(buffer + strlen(buffer), translator); (void)g_stpcpy(buffer + strlen(buffer), " ("); if (para->translator == NULL && !is_enum_type(para->type)) - (void)g_stpcpy(buffer + strlen(buffer), "I_CAL_OBJECT ("); + (void)g_stpcpy(buffer + strlen(buffer), "I_CAL_OBJECT ((ICalObject *)"); } (void)g_stpcpy(buffer + strlen(buffer), para->name); @@ -2110,8 +2079,8 @@ gchar *get_source_run_time_checkers(Method *method, const gchar *namespace) nameSpaceUpperSnake = get_upper_snake_from_upper_camel(namespace); nameUpperSnake = get_upper_snake_from_upper_camel(trueType + i); typeCheck = - g_strconcat(nameSpaceUpperSnake, "_IS_", nameUpperSnake, " (", parameter->name, - ")", NULL); + g_strconcat(nameSpaceUpperSnake, "_IS_", nameUpperSnake, " ((", trueType, "*)", + parameter->name, ")", NULL); defaultValue = NULL; if (method->ret != NULL) { retTrueType = get_true_type(method->ret->type); @@ -2269,6 +2238,7 @@ static gint generate_library(const gchar *apis_dir) printf("The node cannot be parsed into a structure.\n"); xmlFreeDoc(doc); res = 1; + structure_free(structure); goto out; } @@ -2290,6 +2260,7 @@ static gint generate_library(const gchar *apis_dir) structure->name); xmlFreeDoc(doc); res = 1; + structure_free(structure); goto out; } } @@ -2308,6 +2279,7 @@ static gint generate_library(const gchar *apis_dir) printf("Please supply a default value for enum %s\n", enumeration->name); xmlFreeDoc(doc); res = 1; + structure_free(structure); goto out; } } |