From 85d9730936ebd54d108ec7e05fd3dca2d13be2f9 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Fri, 1 May 2020 15:33:27 +0200 Subject: [PATCH] Add some missing (nullable) annotations Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/4750 --- app/core/gimpgradient.c | 2 +- app/core/gimpimage.c | 12 ++++++------ app/core/gimpscanconvert.c | 2 +- app/core/gimptagged.c | 2 +- app/widgets/gimpclipboard.c | 8 ++++---- libgimp/gimpprocedureconfig.c | 6 +++--- libgimpbase/gimputils.c | 30 +++++++++++++++++------------- 7 files changed, 33 insertions(+), 29 deletions(-) diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index 95fa7025cc..5f077cb50a 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -433,7 +433,7 @@ gimp_gradient_get_extension (GimpData *data) * gimp_gradient_get_color_at: * @gradient: a gradient * @context: a context - * @seg: a segment to seed the search with (or %NULL) + * @seg: (nullable): a segment to seed the search with (or %NULL) * @pos: position in the gradient (between 0.0 and 1.0) * @reverse: when %TRUE, use the reversed gradient * @blend_color_space: color space to use for blending RGB segments diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 4e57daad9f..fe2af80974 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -2176,9 +2176,9 @@ gimp_image_get_file_or_untitled (GimpImage *image) * gimp_image_get_file: * @image: A #GimpImage. * - * Get the file of the XCF image, or NULL if there is no file. + * Get the file of the XCF image, or %NULL if there is no file. * - * Returns: The file, or NULL. + * Returns: (nullable): The file, or %NULL. **/ GFile * gimp_image_get_file (GimpImage *image) @@ -2192,8 +2192,8 @@ gimp_image_get_file (GimpImage *image) * gimp_image_get_imported_file: * @image: A #GimpImage. * - * Returns: The file of the imported image, or NULL if the image has - * been saved as XCF after it was imported. + * Returns: (nullable): The file of the imported image, or %NULL if the image + * has been saved as XCF after it was imported. **/ GFile * gimp_image_get_imported_file (GimpImage *image) @@ -2207,8 +2207,8 @@ gimp_image_get_imported_file (GimpImage *image) * gimp_image_get_exported_file: * @image: A #GimpImage. * - * Returns: The file of the image last exported from this XCF file, or - * NULL if the image has never been exported. + * Returns: (nullable): The file of the image last exported from this XCF file, + * or %NULL if the image has never been exported. **/ GFile * gimp_image_get_exported_file (GimpImage *image) diff --git a/app/core/gimpscanconvert.c b/app/core/gimpscanconvert.c index 8ac3570ce7..3aaedf4700 100644 --- a/app/core/gimpscanconvert.c +++ b/app/core/gimpscanconvert.c @@ -270,7 +270,7 @@ gimp_scan_convert_add_bezier (GimpScanConvert *sc, * extend to a distance of more than @miter times @width from * the actual join point * @dash_offset: offset to apply on the dash pattern - * @dash_info: dash pattern or %NULL for a solid line + * @dash_info: (nullable): dash pattern or %NULL for a solid line * * Stroke the content of a GimpScanConvert. The next * gimp_scan_convert_render() will result in the outline of the diff --git a/app/core/gimptagged.c b/app/core/gimptagged.c index 0964a369ec..6edede712b 100644 --- a/app/core/gimptagged.c +++ b/app/core/gimptagged.c @@ -219,7 +219,7 @@ gimp_tagged_get_identifier (GimpTagged *tagged) * If the object does not want to support such remapping (objects not * stored in file for example) it can return %NULL. * - * Returns: checksum string if object needs identifier remapping, + * Returns: (nullable): checksum string if object needs identifier remapping, * %NULL otherwise. Returned string must be freed with #g_free(). **/ gchar * diff --git a/app/widgets/gimpclipboard.c b/app/widgets/gimpclipboard.c index 3919de316f..44ceac7e2f 100644 --- a/app/widgets/gimpclipboard.c +++ b/app/widgets/gimpclipboard.c @@ -570,7 +570,7 @@ gimp_clipboard_get_curve (Gimp *gimp) /** * gimp_clipboard_set_image: * @gimp: pointer to #Gimp - * @image: a #GimpImage, or %NULL. + * @image: (nullable): a #GimpImage, or %NULL. * * Offers the image in %GDK_SELECTION_CLIPBOARD. **/ @@ -620,7 +620,7 @@ gimp_clipboard_set_image (Gimp *gimp, /** * gimp_clipboard_set_buffer: * @gimp: pointer to #Gimp - * @buffer: a #GimpBuffer, or %NULL. + * @buffer: (nullable): a #GimpBuffer, or %NULL. * * Offers the buffer in %GDK_SELECTION_CLIPBOARD. **/ @@ -668,7 +668,7 @@ gimp_clipboard_set_buffer (Gimp *gimp, /** * gimp_clipboard_set_svg: * @gimp: pointer to #Gimp - * @svg: a string containing the SVG data, or %NULL + * @svg: (nullable): a string containing the SVG data, or %NULL * * Offers SVG data in %GDK_SELECTION_CLIPBOARD. **/ @@ -743,7 +743,7 @@ gimp_clipboard_set_text (Gimp *gimp, /** * gimp_clipboard_set_curve: * @gimp: pointer to #Gimp - * @curve: a #GimpCurve, or %NULL + * @curve: (nullable): a #GimpCurve, or %NULL * * Offers curve data in %GDK_SELECTION_CLIPBOARD. **/ diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c index 1624490ce7..3def738191 100644 --- a/libgimp/gimpprocedureconfig.c +++ b/libgimp/gimpprocedureconfig.c @@ -312,7 +312,7 @@ gimp_procedure_config_get_values (GimpProcedureConfig *config, /** * gimp_procedure_config_begin_run: * @config: a #GimpProcedureConfig - * @image: a #GimpImage or %NULL + * @image: (nullable): a #GimpImage or %NULL * @run_mode: the #GimpRunMode passed to a #GimpProcedure's run() * @args: the #GimpValueArray passed to a #GimpProcedure's run() * @@ -451,7 +451,7 @@ gimp_procedure_config_end_run (GimpProcedureConfig *config, * @original_image: the #GimpImage passed to run() * @run_mode: the #GimpRunMode passed to a #GimpProcedure's run() * @args: the #GimpValueArray passed to a #GimpProcedure's run() - * @mime_type: the exported file format's mime type, or %NULL. + * @mime_type: (nullable): exported file format's mime type, or %NULL. * * This is a variant of gimp_procedure_config_begin_run() to be used * by file export procedures using #GimpSaveProcedure. It must be @@ -506,7 +506,7 @@ gimp_procedure_config_end_run (GimpProcedureConfig *config, * argument is initialized with the default comment returned by * gimp_get_default_comment(). * - * Returns: (transfer none): The #GimpMetadata to be used for this + * Returns: (transfer none) (nullable): The #GimpMetadata to be used for this * export, or %NULL if @original_image doesn't have metadata. * * Since: 3.0 diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c index 514f68ee1d..90f60f90a2 100644 --- a/libgimpbase/gimputils.c +++ b/libgimpbase/gimputils.c @@ -84,7 +84,7 @@ static gboolean gimp_utils_gdb_available (gint major, /** * gimp_utf8_strtrim: - * @str: an UTF-8 encoded string (or %NULL) + * @str: (nullable): an UTF-8 encoded string (or %NULL) * @max_chars: the maximum number of characters before the string get * trimmed * @@ -522,7 +522,7 @@ gimp_file_show_in_file_manager (GFile *file, /** * gimp_strip_uline: - * @str: underline infested string (or %NULL) + * @str: (nullable): underline infested string (or %NULL) * * This function returns a copy of @str stripped of underline * characters. This comes in handy when needing to strip mnemonics @@ -586,7 +586,7 @@ gimp_strip_uline (const gchar *str) /** * gimp_escape_uline: - * @str: Underline infested string (or %NULL) + * @str: (nullable): Underline infested string (or %NULL) * * This function returns a copy of @str with all underline converted * to two adjacent underlines. This comes in handy when needing to display @@ -718,7 +718,7 @@ gimp_canonicalize_identifier (const gchar *identifier) * * Retrieves #GimpEnumDesc associated with the given value, or %NULL. * - * Returns: the value's #GimpEnumDesc. + * Returns: (nullable): the value's #GimpEnumDesc. * * Since: 2.2 **/ @@ -751,10 +751,12 @@ gimp_enum_get_desc (GEnumClass *enum_class, * gimp_enum_get_value: * @enum_type: the #GType of a registered enum * @value: an integer value - * @value_name: return location for the value's name (or %NULL) - * @value_nick: return location for the value's nick (or %NULL) - * @value_desc: return location for the value's translated description (or %NULL) - * @value_help: return location for the value's translated help (or %NULL) + * @value_name: (optional): return location for the value's name (or %NULL) + * @value_nick: (optional): return location for the value's nick (or %NULL) + * @value_desc: (optional): return location for the value's translated + * description (or %NULL) + * @value_help: (optional): return location for the value's translated help + * (or %NULL) * * Checks if @value is valid for the enum registered as @enum_type. * If the value exists in that enum, its name, nick and its translated @@ -942,7 +944,7 @@ gimp_enum_value_get_abbrev (GEnumClass *enum_class, * * Retrieves the first #GimpFlagsDesc that matches the given value, or %NULL. * - * Returns: the value's #GimpFlagsDesc. + * Returns: (nullable): the value's #GimpFlagsDesc. * * Since: 2.2 **/ @@ -975,10 +977,12 @@ gimp_flags_get_first_desc (GFlagsClass *flags_class, * gimp_flags_get_first_value: * @flags_type: the #GType of registered flags * @value: an integer value - * @value_name: return location for the value's name (or %NULL) - * @value_nick: return location for the value's nick (or %NULL) - * @value_desc: return location for the value's translated description (or %NULL) - * @value_help: return location for the value's translated help (or %NULL) + * @value_name: (optional): return location for the value's name (or %NULL) + * @value_nick: (optional): return location for the value's nick (or %NULL) + * @value_desc: (optional): return location for the value's translated + * description (or %NULL) + * @value_help: (optional): return location for the value's translated help + * (or %NULL) * * Checks if @value is valid for the flags registered as @flags_type. * If the value exists in that flags, its name, nick and its