LCOV - code coverage report
Current view: top level - glib/gobject - gparamspecs.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 739 874 84.6 %
Date: 2024-04-23 05:16:05 Functions: 120 135 88.9 %
Branches: 154 280 55.0 %

           Branch data     Line data    Source code
       1                 :            : /* GObject - GLib Type, Object, Parameter and Signal Library
       2                 :            :  * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
       3                 :            :  * Copyright (C) 2010 Christian Persch
       4                 :            :  *
       5                 :            :  * SPDX-License-Identifier: LGPL-2.1-or-later
       6                 :            :  *
       7                 :            :  * This library is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU Lesser General Public
       9                 :            :  * License as published by the Free Software Foundation; either
      10                 :            :  * version 2.1 of the License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This library is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15                 :            :  * Lesser General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU Lesser General
      18                 :            :  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
      19                 :            :  */
      20                 :            : 
      21                 :            : /*
      22                 :            :  * MT safe
      23                 :            :  */
      24                 :            : 
      25                 :            : #include "config.h"
      26                 :            : 
      27                 :            : #include <string.h>
      28                 :            : 
      29                 :            : #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
      30                 :            : #define GLIB_DISABLE_DEPRECATION_WARNINGS
      31                 :            : #endif
      32                 :            : 
      33                 :            : #include "gparamspecs.h"
      34                 :            : #include "gtype-private.h"
      35                 :            : #include "gvaluecollector.h"
      36                 :            : 
      37                 :            : #include "gvaluearray.h"
      38                 :            : 
      39                 :            : 
      40                 :            : #define G_FLOAT_EPSILON         (1e-30)
      41                 :            : #define G_DOUBLE_EPSILON        (1e-90)
      42                 :            : 
      43                 :            : 
      44                 :            : /* --- param spec functions --- */
      45                 :            : static void
      46                 :          6 : param_char_init (GParamSpec *pspec)
      47                 :            : {
      48                 :          6 :   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
      49                 :            :   
      50                 :          6 :   cspec->minimum = 0x7f;
      51                 :          6 :   cspec->maximum = 0x80;
      52                 :          6 :   cspec->default_value = 0;
      53                 :          6 : }
      54                 :            : 
      55                 :            : static void
      56                 :          2 : param_char_set_default (GParamSpec *pspec,
      57                 :            :                         GValue     *value)
      58                 :            : {
      59                 :          2 :   value->data[0].v_int = G_PARAM_SPEC_CHAR (pspec)->default_value;
      60                 :          2 : }
      61                 :            : 
      62                 :            : static gboolean
      63                 :         15 : param_char_is_valid (GParamSpec   *pspec,
      64                 :            :                      const GValue *value)
      65                 :            : {
      66                 :         15 :   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
      67                 :         15 :   gint oval = value->data[0].v_int;
      68                 :            :   
      69   [ +  +  +  + ]:         15 :   return cspec->minimum <= oval && oval <= cspec->maximum;
      70                 :            : }
      71                 :            : 
      72                 :            : static gboolean
      73                 :         12 : param_char_validate (GParamSpec *pspec,
      74                 :            :                      GValue     *value)
      75                 :            : {
      76                 :         12 :   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
      77                 :         12 :   gint oval = value->data[0].v_int;
      78                 :            :   
      79         [ +  + ]:         12 :   value->data[0].v_int = CLAMP (value->data[0].v_int, cspec->minimum, cspec->maximum);
      80                 :            :   
      81                 :         12 :   return value->data[0].v_int != oval;
      82                 :            : }
      83                 :            : 
      84                 :            : static void
      85                 :          4 : param_uchar_init (GParamSpec *pspec)
      86                 :            : {
      87                 :          4 :   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
      88                 :            :   
      89                 :          4 :   uspec->minimum = 0;
      90                 :          4 :   uspec->maximum = 0xff;
      91                 :          4 :   uspec->default_value = 0;
      92                 :          4 : }
      93                 :            : 
      94                 :            : static void
      95                 :          0 : param_uchar_set_default (GParamSpec *pspec,
      96                 :            :                          GValue     *value)
      97                 :            : {
      98                 :          0 :   value->data[0].v_uint = G_PARAM_SPEC_UCHAR (pspec)->default_value;
      99                 :          0 : }
     100                 :            : 
     101                 :            : static gboolean
     102                 :         14 : param_uchar_is_valid (GParamSpec   *pspec,
     103                 :            :                       const GValue *value)
     104                 :            : {
     105                 :         14 :   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
     106                 :         14 :   guint oval = value->data[0].v_uint;
     107                 :            :   
     108   [ +  +  +  - ]:         14 :   return uspec->minimum <= oval && oval <= uspec->maximum;
     109                 :            : }
     110                 :            : 
     111                 :            : static gboolean
     112                 :          2 : param_uchar_validate (GParamSpec *pspec,
     113                 :            :                       GValue     *value)
     114                 :            : {
     115                 :          2 :   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
     116                 :          2 :   guint oval = value->data[0].v_uint;
     117                 :            :   
     118         [ -  + ]:          2 :   value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum);
     119                 :            :   
     120                 :          2 :   return value->data[0].v_uint != oval;
     121                 :            : }
     122                 :            : 
     123                 :            : static void
     124                 :        515 : param_boolean_set_default (GParamSpec *pspec,
     125                 :            :                            GValue     *value)
     126                 :            : {
     127                 :        515 :   value->data[0].v_int = G_PARAM_SPEC_BOOLEAN (pspec)->default_value;
     128                 :        515 : }
     129                 :            : 
     130                 :            : static gboolean
     131                 :      10289 : param_boolean_is_valid (GParamSpec   *pspec,
     132                 :            :                         const GValue *value)
     133                 :            : {
     134                 :      10289 :   int oval = value->data[0].v_int;
     135                 :            : 
     136   [ +  +  +  - ]:      10289 :   return oval == FALSE || oval == TRUE;
     137                 :            : }
     138                 :            : 
     139                 :            : static gboolean
     140                 :          2 : param_boolean_validate (GParamSpec *pspec,
     141                 :            :                         GValue     *value)
     142                 :            : {
     143                 :          2 :   gint oval = value->data[0].v_int;
     144                 :            :   
     145                 :          2 :   value->data[0].v_int = value->data[0].v_int != FALSE;
     146                 :            :   
     147                 :          2 :   return value->data[0].v_int != oval;
     148                 :            : }
     149                 :            : 
     150                 :            : static void
     151                 :        581 : param_int_init (GParamSpec *pspec)
     152                 :            : {
     153                 :        581 :   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
     154                 :            :   
     155                 :        581 :   ispec->minimum = 0x7fffffff;
     156                 :        581 :   ispec->maximum = 0x80000000;
     157                 :        581 :   ispec->default_value = 0;
     158                 :        581 : }
     159                 :            : 
     160                 :            : static void
     161                 :        197 : param_int_set_default (GParamSpec *pspec,
     162                 :            :                        GValue     *value)
     163                 :            : {
     164                 :        197 :   value->data[0].v_int = G_PARAM_SPEC_INT (pspec)->default_value;
     165                 :        197 : }
     166                 :            : 
     167                 :            : static gboolean
     168                 :   16241725 : param_int_is_valid (GParamSpec   *pspec,
     169                 :            :                     const GValue *value)
     170                 :            : {
     171                 :   16241725 :   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
     172                 :   16090858 :   int oval = value->data[0].v_int;
     173                 :            : 
     174   [ +  #  +  # ]:   16090858 :   return ispec->minimum <= oval && oval <= ispec->maximum;
     175                 :            : }
     176                 :            : 
     177                 :            : static gboolean
     178                 :         53 : param_int_validate (GParamSpec *pspec,
     179                 :            :                     GValue     *value)
     180                 :            : {
     181                 :         53 :   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
     182                 :         53 :   gint oval = value->data[0].v_int;
     183                 :            :   
     184         [ +  + ]:         53 :   value->data[0].v_int = CLAMP (value->data[0].v_int, ispec->minimum, ispec->maximum);
     185                 :            :   
     186                 :         53 :   return value->data[0].v_int != oval;
     187                 :            : }
     188                 :            : 
     189                 :            : static gint
     190                 :         25 : param_int_values_cmp (GParamSpec   *pspec,
     191                 :            :                       const GValue *value1,
     192                 :            :                       const GValue *value2)
     193                 :            : {
     194         [ +  + ]:         25 :   if (value1->data[0].v_int < value2->data[0].v_int)
     195                 :          2 :     return -1;
     196                 :            :   else
     197                 :         23 :     return value1->data[0].v_int > value2->data[0].v_int;
     198                 :            : }
     199                 :            : 
     200                 :            : static void
     201                 :        758 : param_uint_init (GParamSpec *pspec)
     202                 :            : {
     203                 :        758 :   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
     204                 :            :   
     205                 :        758 :   uspec->minimum = 0;
     206                 :        758 :   uspec->maximum = 0xffffffff;
     207                 :        758 :   uspec->default_value = 0;
     208                 :        758 : }
     209                 :            : 
     210                 :            : static void
     211                 :        269 : param_uint_set_default (GParamSpec *pspec,
     212                 :            :                         GValue     *value)
     213                 :            : {
     214                 :        269 :   value->data[0].v_uint = G_PARAM_SPEC_UINT (pspec)->default_value;
     215                 :        269 : }
     216                 :            : 
     217                 :            : static gboolean
     218                 :       5797 : param_uint_is_valid (GParamSpec   *pspec,
     219                 :            :                      const GValue *value)
     220                 :            : {
     221                 :       5797 :   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
     222                 :       5797 :   guint oval = value->data[0].v_uint;
     223                 :            :   
     224   [ +  +  +  - ]:       5797 :   return uspec->minimum <= oval && oval <= uspec->maximum;
     225                 :            : }
     226                 :            : 
     227                 :            : static gboolean
     228                 :          1 : param_uint_validate (GParamSpec *pspec,
     229                 :            :                      GValue     *value)
     230                 :            : {
     231                 :          1 :   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
     232                 :          1 :   guint oval = value->data[0].v_uint;
     233                 :            :   
     234         [ -  + ]:          1 :   value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum);
     235                 :            :   
     236                 :          1 :   return value->data[0].v_uint != oval;
     237                 :            : }
     238                 :            : 
     239                 :            : static gint
     240                 :          7 : param_uint_values_cmp (GParamSpec   *pspec,
     241                 :            :                        const GValue *value1,
     242                 :            :                        const GValue *value2)
     243                 :            : {
     244         [ -  + ]:          7 :   if (value1->data[0].v_uint < value2->data[0].v_uint)
     245                 :          0 :     return -1;
     246                 :            :   else
     247                 :          7 :     return value1->data[0].v_uint > value2->data[0].v_uint;
     248                 :            : }
     249                 :            : 
     250                 :            : static void
     251                 :          3 : param_long_init (GParamSpec *pspec)
     252                 :            : {
     253                 :          3 :   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
     254                 :            :   
     255                 :            : #if SIZEOF_LONG == 4
     256                 :            :   lspec->minimum = 0x7fffffff;
     257                 :            :   lspec->maximum = 0x80000000;
     258                 :            : #else /* SIZEOF_LONG != 4 (8) */
     259                 :          3 :   lspec->minimum = 0x7fffffffffffffff;
     260                 :          3 :   lspec->maximum = 0x8000000000000000;
     261                 :            : #endif
     262                 :          3 :   lspec->default_value = 0;
     263                 :          3 : }
     264                 :            : 
     265                 :            : static void
     266                 :          2 : param_long_set_default (GParamSpec *pspec,
     267                 :            :                         GValue     *value)
     268                 :            : {
     269                 :          2 :   value->data[0].v_long = G_PARAM_SPEC_LONG (pspec)->default_value;
     270                 :          2 : }
     271                 :            : 
     272                 :            : static gboolean
     273                 :          1 : param_long_is_valid (GParamSpec   *pspec,
     274                 :            :                      const GValue *value)
     275                 :            : {
     276                 :          1 :   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
     277                 :          1 :   glong oval = value->data[0].v_long;
     278                 :            :   
     279   [ -  +  -  - ]:          1 :   return lspec->minimum <= oval && oval <= lspec->maximum;
     280                 :            : }
     281                 :            : 
     282                 :            : static gboolean
     283                 :          1 : param_long_validate (GParamSpec *pspec,
     284                 :            :                      GValue     *value)
     285                 :            : {
     286                 :          1 :   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
     287                 :          1 :   glong oval = value->data[0].v_long;
     288                 :            :   
     289         [ -  + ]:          1 :   value->data[0].v_long = CLAMP (value->data[0].v_long, lspec->minimum, lspec->maximum);
     290                 :            :   
     291                 :          1 :   return value->data[0].v_long != oval;
     292                 :            : }
     293                 :            : 
     294                 :            : static gint
     295                 :          8 : param_long_values_cmp (GParamSpec   *pspec,
     296                 :            :                        const GValue *value1,
     297                 :            :                        const GValue *value2)
     298                 :            : {
     299         [ -  + ]:          8 :   if (value1->data[0].v_long < value2->data[0].v_long)
     300                 :          0 :     return -1;
     301                 :            :   else
     302                 :          8 :     return value1->data[0].v_long > value2->data[0].v_long;
     303                 :            : }
     304                 :            : 
     305                 :            : static void
     306                 :         27 : param_ulong_init (GParamSpec *pspec)
     307                 :            : {
     308                 :         27 :   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
     309                 :            :   
     310                 :         27 :   uspec->minimum = 0;
     311                 :            : #if SIZEOF_LONG == 4
     312                 :            :   uspec->maximum = 0xffffffff;
     313                 :            : #else /* SIZEOF_LONG != 4 (8) */
     314                 :         27 :   uspec->maximum = 0xffffffffffffffff;
     315                 :            : #endif
     316                 :         27 :   uspec->default_value = 0;
     317                 :         27 : }
     318                 :            : 
     319                 :            : static void
     320                 :          6 : param_ulong_set_default (GParamSpec *pspec,
     321                 :            :                          GValue     *value)
     322                 :            : {
     323                 :          6 :   value->data[0].v_ulong = G_PARAM_SPEC_ULONG (pspec)->default_value;
     324                 :          6 : }
     325                 :            : 
     326                 :            : static gboolean
     327                 :       1157 : param_ulong_is_valid (GParamSpec   *pspec,
     328                 :            :                       const GValue *value)
     329                 :            : {
     330                 :       1157 :   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
     331                 :       1157 :   gulong oval = value->data[0].v_ulong;
     332                 :            :   
     333   [ +  +  +  - ]:       1157 :   return uspec->minimum <= oval && oval <= uspec->maximum;
     334                 :            : }
     335                 :            : 
     336                 :            : static gboolean
     337                 :          1 : param_ulong_validate (GParamSpec *pspec,
     338                 :            :                       GValue     *value)
     339                 :            : {
     340                 :          1 :   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
     341                 :          1 :   gulong oval = value->data[0].v_ulong;
     342                 :            :   
     343         [ -  + ]:          1 :   value->data[0].v_ulong = CLAMP (value->data[0].v_ulong, uspec->minimum, uspec->maximum);
     344                 :            :   
     345                 :          1 :   return value->data[0].v_ulong != oval;
     346                 :            : }
     347                 :            : 
     348                 :            : static gint
     349                 :          7 : param_ulong_values_cmp (GParamSpec   *pspec,
     350                 :            :                         const GValue *value1,
     351                 :            :                         const GValue *value2)
     352                 :            : {
     353         [ -  + ]:          7 :   if (value1->data[0].v_ulong < value2->data[0].v_ulong)
     354                 :          0 :     return -1;
     355                 :            :   else
     356                 :          7 :     return value1->data[0].v_ulong > value2->data[0].v_ulong;
     357                 :            : }
     358                 :            : 
     359                 :            : static void
     360                 :          8 : param_int64_init (GParamSpec *pspec)
     361                 :            : {
     362                 :          8 :   GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec);
     363                 :            :   
     364                 :          8 :   lspec->minimum = G_MININT64;
     365                 :          8 :   lspec->maximum = G_MAXINT64;
     366                 :          8 :   lspec->default_value = 0;
     367                 :          8 : }
     368                 :            : 
     369                 :            : static void
     370                 :          2 : param_int64_set_default (GParamSpec *pspec,
     371                 :            :                         GValue     *value)
     372                 :            : {
     373                 :          2 :   value->data[0].v_int64 = G_PARAM_SPEC_INT64 (pspec)->default_value;
     374                 :          2 : }
     375                 :            : 
     376                 :            : static gboolean
     377                 :          4 : param_int64_is_valid (GParamSpec   *pspec,
     378                 :            :                       const GValue *value)
     379                 :            : {
     380                 :          4 :   GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec);
     381                 :          4 :   gint64 oval = value->data[0].v_int64;
     382                 :            :   
     383   [ +  +  +  - ]:          4 :   return lspec->minimum <= oval && oval <= lspec->maximum;
     384                 :            : }
     385                 :            : 
     386                 :            : static gboolean
     387                 :          1 : param_int64_validate (GParamSpec *pspec,
     388                 :            :                      GValue     *value)
     389                 :            : {
     390                 :          1 :   GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec);
     391                 :          1 :   gint64 oval = value->data[0].v_int64;
     392                 :            :   
     393         [ -  + ]:          1 :   value->data[0].v_int64 = CLAMP (value->data[0].v_int64, lspec->minimum, lspec->maximum);
     394                 :            :   
     395                 :          1 :   return value->data[0].v_int64 != oval;
     396                 :            : }
     397                 :            : 
     398                 :            : static gint
     399                 :          1 : param_int64_values_cmp (GParamSpec   *pspec,
     400                 :            :                        const GValue *value1,
     401                 :            :                        const GValue *value2)
     402                 :            : {
     403         [ -  + ]:          1 :   if (value1->data[0].v_int64 < value2->data[0].v_int64)
     404                 :          0 :     return -1;
     405                 :            :   else
     406                 :          1 :     return value1->data[0].v_int64 > value2->data[0].v_int64;
     407                 :            : }
     408                 :            : 
     409                 :            : static void
     410                 :          8 : param_uint64_init (GParamSpec *pspec)
     411                 :            : {
     412                 :          8 :   GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec);
     413                 :            :   
     414                 :          8 :   uspec->minimum = 0;
     415                 :          8 :   uspec->maximum = G_MAXUINT64;
     416                 :          8 :   uspec->default_value = 0;
     417                 :          8 : }
     418                 :            : 
     419                 :            : static void
     420                 :          2 : param_uint64_set_default (GParamSpec *pspec,
     421                 :            :                          GValue     *value)
     422                 :            : {
     423                 :          2 :   value->data[0].v_uint64 = G_PARAM_SPEC_UINT64 (pspec)->default_value;
     424                 :          2 : }
     425                 :            : 
     426                 :            : static gboolean
     427                 :          7 : param_uint64_is_valid (GParamSpec   *pspec,
     428                 :            :                        const GValue *value)
     429                 :            : {
     430                 :          7 :   GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec);
     431                 :          7 :   guint64 oval = value->data[0].v_uint64;
     432                 :            :   
     433   [ +  +  +  - ]:          7 :   return uspec->minimum <= oval && oval <= uspec->maximum;
     434                 :            : }
     435                 :            : 
     436                 :            : static gboolean
     437                 :          1 : param_uint64_validate (GParamSpec *pspec,
     438                 :            :                       GValue     *value)
     439                 :            : {
     440                 :          1 :   GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec);
     441                 :          1 :   guint64 oval = value->data[0].v_uint64;
     442                 :            :   
     443         [ -  + ]:          1 :   value->data[0].v_uint64 = CLAMP (value->data[0].v_uint64, uspec->minimum, uspec->maximum);
     444                 :            :   
     445                 :          1 :   return value->data[0].v_uint64 != oval;
     446                 :            : }
     447                 :            : 
     448                 :            : static gint
     449                 :          1 : param_uint64_values_cmp (GParamSpec   *pspec,
     450                 :            :                         const GValue *value1,
     451                 :            :                         const GValue *value2)
     452                 :            : {
     453         [ -  + ]:          1 :   if (value1->data[0].v_uint64 < value2->data[0].v_uint64)
     454                 :          0 :     return -1;
     455                 :            :   else
     456                 :          1 :     return value1->data[0].v_uint64 > value2->data[0].v_uint64;
     457                 :            : }
     458                 :            : 
     459                 :            : static void
     460                 :          1 : param_unichar_init (GParamSpec *pspec)
     461                 :            : {
     462                 :          1 :   GParamSpecUnichar *uspec = G_PARAM_SPEC_UNICHAR (pspec);
     463                 :            :   
     464                 :          1 :   uspec->default_value = 0;
     465                 :          1 : }
     466                 :            : 
     467                 :            : static void
     468                 :          0 : param_unichar_set_default (GParamSpec *pspec,
     469                 :            :                          GValue     *value)
     470                 :            : {
     471                 :          0 :   value->data[0].v_uint = G_PARAM_SPEC_UNICHAR (pspec)->default_value;
     472                 :          0 : }
     473                 :            : 
     474                 :            : static gboolean
     475                 :          2 : param_unichar_is_valid (GParamSpec   *pspec,
     476                 :            :                         const GValue *value)
     477                 :            : {
     478                 :          2 :   return g_unichar_validate (value->data[0].v_uint);
     479                 :            : }
     480                 :            : 
     481                 :            : static gboolean
     482                 :          2 : param_unichar_validate (GParamSpec *pspec,
     483                 :            :                         GValue     *value)
     484                 :            : {
     485                 :          2 :   gunichar oval = value->data[0].v_uint;
     486                 :          2 :   gboolean changed = FALSE;
     487                 :            : 
     488         [ +  + ]:          2 :   if (!g_unichar_validate (oval))
     489                 :            :     {
     490                 :          1 :       value->data[0].v_uint = 0;
     491                 :          1 :       changed = TRUE;
     492                 :            :     }
     493                 :            : 
     494                 :          2 :   return changed;
     495                 :            : }
     496                 :            : 
     497                 :            : static gint
     498                 :          0 : param_unichar_values_cmp (GParamSpec   *pspec,
     499                 :            :                         const GValue *value1,
     500                 :            :                         const GValue *value2)
     501                 :            : {
     502         [ #  # ]:          0 :   if (value1->data[0].v_uint < value2->data[0].v_uint)
     503                 :          0 :     return -1;
     504                 :            :   else
     505                 :          0 :     return value1->data[0].v_uint > value2->data[0].v_uint;
     506                 :            : }
     507                 :            : 
     508                 :            : static void
     509                 :       1575 : param_enum_init (GParamSpec *pspec)
     510                 :            : {
     511                 :       1575 :   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
     512                 :            :   
     513                 :       1575 :   espec->enum_class = NULL;
     514                 :       1575 :   espec->default_value = 0;
     515                 :       1575 : }
     516                 :            : 
     517                 :            : static void
     518                 :          0 : param_enum_finalize (GParamSpec *pspec)
     519                 :            : {
     520                 :          0 :   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
     521                 :          0 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_ENUM));
     522                 :            :   
     523         [ #  # ]:          0 :   if (espec->enum_class)
     524                 :            :     {
     525                 :          0 :       g_type_class_unref (espec->enum_class);
     526                 :          0 :       espec->enum_class = NULL;
     527                 :            :     }
     528                 :            :   
     529                 :          0 :   parent_class->finalize (pspec);
     530                 :          0 : }
     531                 :            : 
     532                 :            : static void
     533                 :        620 : param_enum_set_default (GParamSpec *pspec,
     534                 :            :                         GValue     *value)
     535                 :            : {
     536                 :        620 :   value->data[0].v_long = G_PARAM_SPEC_ENUM (pspec)->default_value;
     537                 :        620 : }
     538                 :            : 
     539                 :            : static gboolean
     540                 :      11338 : param_enum_is_valid (GParamSpec   *pspec,
     541                 :            :                      const GValue *value)
     542                 :            : {
     543                 :      11338 :   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
     544                 :      11338 :   glong oval = value->data[0].v_long;
     545                 :            :   
     546                 :      11338 :   return g_enum_get_value (espec->enum_class, oval) != NULL;
     547                 :            : }
     548                 :            : 
     549                 :            : static gboolean
     550                 :          0 : param_enum_validate (GParamSpec *pspec,
     551                 :            :                      GValue     *value)
     552                 :            : {
     553                 :          0 :   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
     554                 :          0 :   glong oval = value->data[0].v_long;
     555                 :            :   
     556   [ #  #  #  # ]:          0 :   if (!espec->enum_class ||
     557                 :          0 :       !g_enum_get_value (espec->enum_class, value->data[0].v_long))
     558                 :          0 :     value->data[0].v_long = espec->default_value;
     559                 :            :   
     560                 :          0 :   return value->data[0].v_long != oval;
     561                 :            : }
     562                 :            : 
     563                 :            : static void
     564                 :        591 : param_flags_init (GParamSpec *pspec)
     565                 :            : {
     566                 :        591 :   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
     567                 :            :   
     568                 :        591 :   fspec->flags_class = NULL;
     569                 :        591 :   fspec->default_value = 0;
     570                 :        591 : }
     571                 :            : 
     572                 :            : static void
     573                 :          0 : param_flags_finalize (GParamSpec *pspec)
     574                 :            : {
     575                 :          0 :   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
     576                 :          0 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_FLAGS));
     577                 :            :   
     578         [ #  # ]:          0 :   if (fspec->flags_class)
     579                 :            :     {
     580                 :          0 :       g_type_class_unref (fspec->flags_class);
     581                 :          0 :       fspec->flags_class = NULL;
     582                 :            :     }
     583                 :            :   
     584                 :          0 :   parent_class->finalize (pspec);
     585                 :          0 : }
     586                 :            : 
     587                 :            : static void
     588                 :        131 : param_flags_set_default (GParamSpec *pspec,
     589                 :            :                          GValue     *value)
     590                 :            : {
     591                 :        131 :   value->data[0].v_ulong = G_PARAM_SPEC_FLAGS (pspec)->default_value;
     592                 :        131 : }
     593                 :            : 
     594                 :            : static gboolean
     595                 :       3950 : param_flags_is_valid (GParamSpec   *pspec,
     596                 :            :                       const GValue *value)
     597                 :            : {
     598                 :       3950 :   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
     599                 :       3950 :   gulong oval = value->data[0].v_ulong;
     600                 :            :   
     601                 :       3950 :   return (oval & ~fspec->flags_class->mask) == 0;
     602                 :            : }
     603                 :            : static gboolean
     604                 :          0 : param_flags_validate (GParamSpec *pspec,
     605                 :            :                       GValue     *value)
     606                 :            : {
     607                 :          0 :   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
     608                 :          0 :   gulong oval = value->data[0].v_ulong;
     609                 :            :   
     610         [ #  # ]:          0 :   if (fspec->flags_class)
     611                 :          0 :     value->data[0].v_ulong &= fspec->flags_class->mask;
     612                 :            :   else
     613                 :          0 :     value->data[0].v_ulong = fspec->default_value;
     614                 :            :   
     615                 :          0 :   return value->data[0].v_ulong != oval;
     616                 :            : }
     617                 :            : 
     618                 :            : static void
     619                 :          1 : param_float_init (GParamSpec *pspec)
     620                 :            : {
     621                 :          1 :   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
     622                 :            :   
     623                 :          1 :   fspec->minimum = -G_MAXFLOAT;
     624                 :          1 :   fspec->maximum = G_MAXFLOAT;
     625                 :          1 :   fspec->default_value = 0;
     626                 :          1 :   fspec->epsilon = G_FLOAT_EPSILON;
     627                 :          1 : }
     628                 :            : 
     629                 :            : static void
     630                 :          2 : param_float_set_default (GParamSpec *pspec,
     631                 :            :                          GValue     *value)
     632                 :            : {
     633                 :          2 :   value->data[0].v_float = G_PARAM_SPEC_FLOAT (pspec)->default_value;
     634                 :          2 : }
     635                 :            : 
     636                 :            : static gboolean
     637                 :          1 : param_float_is_valid (GParamSpec   *pspec,
     638                 :            :                       const GValue *value)
     639                 :            : {
     640                 :          1 :   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
     641                 :          1 :   gfloat oval = value->data[0].v_float;
     642                 :            :   
     643   [ -  +  -  - ]:          1 :   return fspec->minimum <= oval && oval <= fspec->maximum;
     644                 :            : }
     645                 :            : 
     646                 :            : static gboolean
     647                 :          1 : param_float_validate (GParamSpec *pspec,
     648                 :            :                       GValue     *value)
     649                 :            : {
     650                 :          1 :   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
     651                 :          1 :   gfloat oval = value->data[0].v_float;
     652                 :            :   
     653   [ -  +  +  - ]:          1 :   value->data[0].v_float = CLAMP (value->data[0].v_float, fspec->minimum, fspec->maximum);
     654                 :            :   
     655                 :          1 :   return value->data[0].v_float != oval;
     656                 :            : }
     657                 :            : 
     658                 :            : static gint
     659                 :          1 : param_float_values_cmp (GParamSpec   *pspec,
     660                 :            :                         const GValue *value1,
     661                 :            :                         const GValue *value2)
     662                 :            : {
     663                 :          1 :   gfloat epsilon = G_PARAM_SPEC_FLOAT (pspec)->epsilon;
     664                 :            :   
     665         [ -  + ]:          1 :   if (value1->data[0].v_float < value2->data[0].v_float)
     666                 :          0 :     return - (value2->data[0].v_float - value1->data[0].v_float > epsilon);
     667                 :            :   else
     668                 :          1 :     return value1->data[0].v_float - value2->data[0].v_float > epsilon;
     669                 :            : }
     670                 :            : 
     671                 :            : static void
     672                 :         15 : param_double_init (GParamSpec *pspec)
     673                 :            : {
     674                 :         15 :   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
     675                 :            :   
     676                 :         15 :   dspec->minimum = -G_MAXDOUBLE;
     677                 :         15 :   dspec->maximum = G_MAXDOUBLE;
     678                 :         15 :   dspec->default_value = 0;
     679                 :         15 :   dspec->epsilon = G_DOUBLE_EPSILON;
     680                 :         15 : }
     681                 :            : 
     682                 :            : static void
     683                 :          2 : param_double_set_default (GParamSpec *pspec,
     684                 :            :                           GValue     *value)
     685                 :            : {
     686                 :          2 :   value->data[0].v_double = G_PARAM_SPEC_DOUBLE (pspec)->default_value;
     687                 :          2 : }
     688                 :            : 
     689                 :            : static gboolean
     690                 :         86 : param_double_is_valid (GParamSpec   *pspec,
     691                 :            :                        const GValue *value)
     692                 :            : {
     693                 :         86 :   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
     694                 :         86 :   gfloat oval = value->data[0].v_double;
     695                 :            :   
     696   [ +  +  +  + ]:         86 :   return dspec->minimum <= oval && oval <= dspec->maximum;
     697                 :            : }
     698                 :            : 
     699                 :            : static gboolean
     700                 :         53 : param_double_validate (GParamSpec *pspec,
     701                 :            :                        GValue     *value)
     702                 :            : {
     703                 :         53 :   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
     704                 :         53 :   gdouble oval = value->data[0].v_double;
     705                 :            :   
     706   [ -  +  +  + ]:         53 :   value->data[0].v_double = CLAMP (value->data[0].v_double, dspec->minimum, dspec->maximum);
     707                 :            :   
     708                 :         53 :   return value->data[0].v_double != oval;
     709                 :            : }
     710                 :            : 
     711                 :            : static gint
     712                 :          1 : param_double_values_cmp (GParamSpec   *pspec,
     713                 :            :                          const GValue *value1,
     714                 :            :                          const GValue *value2)
     715                 :            : {
     716                 :          1 :   gdouble epsilon = G_PARAM_SPEC_DOUBLE (pspec)->epsilon;
     717                 :            :   
     718         [ -  + ]:          1 :   if (value1->data[0].v_double < value2->data[0].v_double)
     719                 :          0 :     return - (value2->data[0].v_double - value1->data[0].v_double > epsilon);
     720                 :            :   else
     721                 :          1 :     return value1->data[0].v_double - value2->data[0].v_double > epsilon;
     722                 :            : }
     723                 :            : 
     724                 :            : static void
     725                 :       1337 : param_string_init (GParamSpec *pspec)
     726                 :            : {
     727                 :       1337 :   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
     728                 :            :   
     729                 :       1337 :   sspec->default_value = NULL;
     730                 :       1337 :   sspec->cset_first = NULL;
     731                 :       1337 :   sspec->cset_nth = NULL;
     732                 :       1337 :   sspec->substitutor = '_';
     733                 :       1337 :   sspec->null_fold_if_empty = FALSE;
     734                 :       1337 :   sspec->ensure_non_null = FALSE;
     735                 :       1337 : }
     736                 :            : 
     737                 :            : static void
     738                 :          1 : param_string_finalize (GParamSpec *pspec)
     739                 :            : {
     740                 :          1 :   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
     741                 :          1 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_STRING));
     742                 :            :   
     743                 :          1 :   g_free (sspec->default_value);
     744                 :          1 :   g_free (sspec->cset_first);
     745                 :          1 :   g_free (sspec->cset_nth);
     746                 :          1 :   sspec->default_value = NULL;
     747                 :          1 :   sspec->cset_first = NULL;
     748                 :          1 :   sspec->cset_nth = NULL;
     749                 :            :   
     750                 :          1 :   parent_class->finalize (pspec);
     751                 :          1 : }
     752                 :            : 
     753                 :            : static void
     754                 :        184 : param_string_set_default (GParamSpec *pspec,
     755                 :            :                           GValue     *value)
     756                 :            : {
     757                 :        184 :   value->data[0].v_pointer = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
     758                 :        184 : }
     759                 :            : 
     760                 :            : static gboolean
     761                 :         16 : param_string_validate (GParamSpec *pspec,
     762                 :            :                        GValue     *value)
     763                 :            : {
     764                 :         16 :   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
     765                 :         16 :   gchar *string = value->data[0].v_pointer;
     766                 :         16 :   guint changed = 0;
     767                 :            :   
     768   [ +  +  +  + ]:         16 :   if (string && string[0])
     769                 :            :     {
     770                 :            :       gchar *s;
     771                 :            :       
     772   [ +  +  +  + ]:          9 :       if (sspec->cset_first && !strchr (sspec->cset_first, string[0]))
     773                 :            :         {
     774         [ +  + ]:          4 :           if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
     775                 :            :             {
     776                 :          1 :               value->data[0].v_pointer = g_strdup (string);
     777                 :          1 :               string = value->data[0].v_pointer;
     778                 :          1 :               value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
     779                 :            :             }
     780                 :          4 :           string[0] = sspec->substitutor;
     781                 :          4 :           changed++;
     782                 :            :         }
     783         [ +  + ]:          9 :       if (sspec->cset_nth)
     784         [ +  + ]:         12 :         for (s = string + 1; *s; s++)
     785         [ +  - ]:          8 :           if (!strchr (sspec->cset_nth, *s))
     786                 :            :             {
     787         [ +  + ]:          8 :               if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
     788                 :            :                 {
     789                 :          1 :                   value->data[0].v_pointer = g_strdup (string);
     790                 :          1 :                   s = (gchar*) value->data[0].v_pointer + (s - string);
     791                 :          1 :                   string = value->data[0].v_pointer;
     792                 :          1 :                   value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
     793                 :            :                 }
     794                 :          8 :               *s = sspec->substitutor;
     795                 :          8 :               changed++;
     796                 :            :             }
     797                 :            :     }
     798   [ +  +  +  -  :         16 :   if (sspec->null_fold_if_empty && string && string[0] == 0)
                   +  - ]
     799                 :            :     {
     800         [ +  + ]:          4 :       if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
     801                 :          3 :         g_free (value->data[0].v_pointer);
     802                 :            :       else
     803                 :          1 :         value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
     804                 :          4 :       value->data[0].v_pointer = NULL;
     805                 :          4 :       changed++;
     806                 :          4 :       string = value->data[0].v_pointer;
     807                 :            :     }
     808   [ +  +  +  - ]:         16 :   if (sspec->ensure_non_null && !string)
     809                 :            :     {
     810                 :          2 :       value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
     811                 :          2 :       value->data[0].v_pointer = g_strdup ("");
     812                 :          2 :       changed++;
     813                 :          2 :       string = value->data[0].v_pointer;
     814                 :            :     }
     815                 :            : 
     816                 :         16 :   return changed;
     817                 :            : }
     818                 :            : 
     819                 :            : static gboolean
     820                 :      85835 : param_string_is_valid (GParamSpec   *pspec,
     821                 :            :                        const GValue *value)
     822                 :            : {
     823                 :      85835 :   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
     824                 :      85835 :   gboolean ret = TRUE;
     825                 :            : 
     826   [ +  +  +  -  :      85835 :   if (sspec->cset_first != NULL || sspec->cset_nth != NULL ||
                   +  + ]
     827         [ +  + ]:      85830 :       sspec->ensure_non_null || sspec->null_fold_if_empty)
     828                 :            :     {
     829                 :          7 :       GValue tmp_value = G_VALUE_INIT;
     830                 :            : 
     831                 :          7 :       g_value_init (&tmp_value, G_VALUE_TYPE (value));
     832                 :          7 :       g_value_copy (value, &tmp_value);
     833                 :            : 
     834                 :          7 :       ret = !param_string_validate (pspec, &tmp_value);
     835                 :            : 
     836                 :          7 :       g_value_unset (&tmp_value);
     837                 :            :     }
     838                 :            : 
     839                 :      85835 :   return ret;
     840                 :            : }
     841                 :            : 
     842                 :            : static gint
     843                 :         19 : param_string_values_cmp (GParamSpec   *pspec,
     844                 :            :                          const GValue *value1,
     845                 :            :                          const GValue *value2)
     846                 :            : {
     847         [ +  - ]:         19 :   if (!value1->data[0].v_pointer)
     848         [ -  + ]:         19 :     return value2->data[0].v_pointer != NULL ? -1 : 0;
     849         [ #  # ]:          0 :   else if (!value2->data[0].v_pointer)
     850                 :          0 :     return value1->data[0].v_pointer != NULL;
     851                 :            :   else
     852                 :          0 :     return strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
     853                 :            : }
     854                 :            : 
     855                 :            : static void
     856                 :          2 : param_param_init (GParamSpec *pspec)
     857                 :            : {
     858                 :            :   /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
     859                 :          2 : }
     860                 :            : 
     861                 :            : static void
     862                 :          0 : param_param_set_default (GParamSpec *pspec,
     863                 :            :                          GValue     *value)
     864                 :            : {
     865                 :          0 :   value->data[0].v_pointer = NULL;
     866                 :          0 : }
     867                 :            : 
     868                 :            : static gboolean
     869                 :          2 : param_param_is_valid (GParamSpec   *pspec,
     870                 :            :                       const GValue *value)
     871                 :            : {
     872                 :          2 :   GParamSpec *param = value->data[0].v_pointer;
     873                 :            : 
     874         [ +  + ]:          2 :   if (param == NULL)
     875                 :          1 :     return FALSE;
     876                 :            : 
     877                 :          1 :   return g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
     878                 :            : }
     879                 :            : 
     880                 :            : static gboolean
     881                 :          2 : param_param_validate (GParamSpec *pspec,
     882                 :            :                       GValue     *value)
     883                 :            : {
     884                 :            :   /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
     885                 :          2 :   GParamSpec *param = value->data[0].v_pointer;
     886                 :          2 :   guint changed = 0;
     887                 :            :   
     888   [ +  +  -  + ]:          2 :   if (param && !g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec)))
     889                 :            :     {
     890                 :          0 :       g_param_spec_unref (param);
     891                 :          0 :       value->data[0].v_pointer = NULL;
     892                 :          0 :       changed++;
     893                 :            :     }
     894                 :            :   
     895                 :          2 :   return changed;
     896                 :            : }
     897                 :            : 
     898                 :            : static void
     899                 :        363 : param_boxed_init (GParamSpec *pspec)
     900                 :            : {
     901                 :            :   /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
     902                 :        363 : }
     903                 :            : 
     904                 :            : static void
     905                 :        154 : param_boxed_set_default (GParamSpec *pspec,
     906                 :            :                          GValue     *value)
     907                 :            : {
     908                 :        154 :   value->data[0].v_pointer = NULL;
     909                 :        154 : }
     910                 :            : 
     911                 :            : static gint
     912                 :          4 : param_boxed_values_cmp (GParamSpec    *pspec,
     913                 :            :                          const GValue *value1,
     914                 :            :                          const GValue *value2)
     915                 :            : {
     916                 :          4 :   guint8 *p1 = value1->data[0].v_pointer;
     917                 :          4 :   guint8 *p2 = value2->data[0].v_pointer;
     918                 :            : 
     919                 :            :   /* not much to compare here, try to at least provide stable lesser/greater result */
     920                 :            : 
     921         [ +  - ]:          4 :   return p1 < p2 ? -1 : p1 > p2;
     922                 :            : }
     923                 :            : 
     924                 :            : static void
     925                 :         94 : param_pointer_init (GParamSpec *pspec)
     926                 :            : {
     927                 :            :   /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
     928                 :         94 : }
     929                 :            : 
     930                 :            : static void
     931                 :         13 : param_pointer_set_default (GParamSpec *pspec,
     932                 :            :                            GValue     *value)
     933                 :            : {
     934                 :         13 :   value->data[0].v_pointer = NULL;
     935                 :         13 : }
     936                 :            : 
     937                 :            : static gint
     938                 :          3 : param_pointer_values_cmp (GParamSpec   *pspec,
     939                 :            :                           const GValue *value1,
     940                 :            :                           const GValue *value2)
     941                 :            : {
     942                 :          3 :   guint8 *p1 = value1->data[0].v_pointer;
     943                 :          3 :   guint8 *p2 = value2->data[0].v_pointer;
     944                 :            : 
     945                 :            :   /* not much to compare here, try to at least provide stable lesser/greater result */
     946                 :            : 
     947         [ +  - ]:          3 :   return p1 < p2 ? -1 : p1 > p2;
     948                 :            : }
     949                 :            : 
     950                 :            : static void
     951                 :          0 : param_value_array_init (GParamSpec *pspec)
     952                 :            : {
     953                 :          0 :   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
     954                 :            : 
     955                 :          0 :   aspec->element_spec = NULL;
     956                 :          0 :   aspec->fixed_n_elements = 0; /* disable */
     957                 :          0 : }
     958                 :            : 
     959                 :            : static inline guint
     960                 :          0 : value_array_ensure_size (GValueArray *value_array,
     961                 :            :                          guint        fixed_n_elements)
     962                 :            : {
     963                 :          0 :   guint changed = 0;
     964                 :            : 
     965         [ #  # ]:          0 :   if (fixed_n_elements)
     966                 :            :     {
     967         [ #  # ]:          0 :       while (value_array->n_values < fixed_n_elements)
     968                 :            :         {
     969                 :          0 :           g_value_array_append (value_array, NULL);
     970                 :          0 :           changed++;
     971                 :            :         }
     972         [ #  # ]:          0 :       while (value_array->n_values > fixed_n_elements)
     973                 :            :         {
     974                 :          0 :           g_value_array_remove (value_array, value_array->n_values - 1);
     975                 :          0 :           changed++;
     976                 :            :         }
     977                 :            :     }
     978                 :          0 :   return changed;
     979                 :            : }
     980                 :            : 
     981                 :            : static void
     982                 :          0 : param_value_array_finalize (GParamSpec *pspec)
     983                 :            : {
     984                 :          0 :   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
     985                 :          0 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_VALUE_ARRAY));
     986                 :            : 
     987         [ #  # ]:          0 :   if (aspec->element_spec)
     988                 :            :     {
     989                 :          0 :       g_param_spec_unref (aspec->element_spec);
     990                 :          0 :       aspec->element_spec = NULL;
     991                 :            :     }
     992                 :            : 
     993                 :          0 :   parent_class->finalize (pspec);
     994                 :          0 : }
     995                 :            : 
     996                 :            : static void
     997                 :          0 : param_value_array_set_default (GParamSpec *pspec,
     998                 :            :                                GValue     *value)
     999                 :            : {
    1000                 :          0 :   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
    1001                 :            : 
    1002   [ #  #  #  # ]:          0 :   if (!value->data[0].v_pointer && aspec->fixed_n_elements)
    1003                 :          0 :     value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
    1004                 :            : 
    1005         [ #  # ]:          0 :   if (value->data[0].v_pointer)
    1006                 :            :     {
    1007                 :            :       /* g_value_reset (value);  already done */
    1008                 :          0 :       value_array_ensure_size (value->data[0].v_pointer, aspec->fixed_n_elements);
    1009                 :            :     }
    1010                 :          0 : }
    1011                 :            : 
    1012                 :            : static gboolean
    1013                 :          0 : param_value_array_validate (GParamSpec *pspec,
    1014                 :            :                             GValue     *value)
    1015                 :            : {
    1016                 :          0 :   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
    1017                 :          0 :   GValueArray *value_array = value->data[0].v_pointer;
    1018                 :          0 :   guint changed = 0;
    1019                 :            : 
    1020   [ #  #  #  # ]:          0 :   if (!value->data[0].v_pointer && aspec->fixed_n_elements)
    1021                 :          0 :     value_array = value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
    1022                 :            : 
    1023         [ #  # ]:          0 :   if (value->data[0].v_pointer)
    1024                 :            :     {
    1025                 :            :       /* ensure array size validity */
    1026                 :          0 :       changed += value_array_ensure_size (value_array, aspec->fixed_n_elements);
    1027                 :            :       
    1028                 :            :       /* ensure array values validity against a present element spec */
    1029         [ #  # ]:          0 :       if (aspec->element_spec)
    1030                 :            :         {
    1031                 :          0 :           GParamSpec *element_spec = aspec->element_spec;
    1032                 :            :           guint i;
    1033                 :            :           
    1034         [ #  # ]:          0 :           for (i = 0; i < value_array->n_values; i++)
    1035                 :            :             {
    1036                 :          0 :               GValue *element = value_array->values + i;
    1037                 :            :               
    1038                 :            :               /* need to fixup value type, or ensure that the array value is initialized at all */
    1039         [ #  # ]:          0 :               if (!g_value_type_compatible (G_VALUE_TYPE (element), G_PARAM_SPEC_VALUE_TYPE (element_spec)))
    1040                 :            :                 {
    1041         [ #  # ]:          0 :                   if (G_VALUE_TYPE (element) != 0)
    1042                 :          0 :                     g_value_unset (element);
    1043                 :          0 :                   g_value_init (element, G_PARAM_SPEC_VALUE_TYPE (element_spec));
    1044                 :          0 :                   g_param_value_set_default (element_spec, element);
    1045                 :          0 :                   changed++;
    1046                 :            :                 }
    1047                 :            :               else
    1048                 :            :                 {
    1049                 :            :                   /* validate array value against element_spec */
    1050                 :          0 :                   changed += g_param_value_validate (element_spec, element);
    1051                 :            :                 }
    1052                 :            :             }
    1053                 :            :         }
    1054                 :            :     }
    1055                 :            : 
    1056                 :          0 :   return changed;
    1057                 :            : }
    1058                 :            : 
    1059                 :            : static gint
    1060                 :          0 : param_value_array_values_cmp (GParamSpec   *pspec,
    1061                 :            :                               const GValue *value1,
    1062                 :            :                               const GValue *value2)
    1063                 :            : {
    1064                 :          0 :   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
    1065                 :          0 :   GValueArray *value_array1 = value1->data[0].v_pointer;
    1066                 :          0 :   GValueArray *value_array2 = value2->data[0].v_pointer;
    1067                 :            : 
    1068   [ #  #  #  # ]:          0 :   if (!value_array1 || !value_array2)
    1069         [ #  # ]:          0 :     return value_array2 ? -1 : value_array1 != value_array2;
    1070                 :            : 
    1071         [ #  # ]:          0 :   if (value_array1->n_values != value_array2->n_values)
    1072         [ #  # ]:          0 :     return value_array1->n_values < value_array2->n_values ? -1 : 1;
    1073         [ #  # ]:          0 :   else if (!aspec->element_spec)
    1074                 :            :     {
    1075                 :            :       /* we need an element specification for comparisons, so there's not much
    1076                 :            :        * to compare here, try to at least provide stable lesser/greater result
    1077                 :            :        */
    1078         [ #  # ]:          0 :       return value_array1->n_values < value_array2->n_values ? -1 : value_array1->n_values > value_array2->n_values;
    1079                 :            :     }
    1080                 :            :   else /* value_array1->n_values == value_array2->n_values */
    1081                 :            :     {
    1082                 :            :       guint i;
    1083                 :            : 
    1084         [ #  # ]:          0 :       for (i = 0; i < value_array1->n_values; i++)
    1085                 :            :         {
    1086                 :          0 :           GValue *element1 = value_array1->values + i;
    1087                 :          0 :           GValue *element2 = value_array2->values + i;
    1088                 :            :           gint cmp;
    1089                 :            : 
    1090                 :            :           /* need corresponding element types, provide stable result otherwise */
    1091         [ #  # ]:          0 :           if (G_VALUE_TYPE (element1) != G_VALUE_TYPE (element2))
    1092         [ #  # ]:          0 :             return G_VALUE_TYPE (element1) < G_VALUE_TYPE (element2) ? -1 : 1;
    1093                 :          0 :           cmp = g_param_values_cmp (aspec->element_spec, element1, element2);
    1094         [ #  # ]:          0 :           if (cmp)
    1095                 :          0 :             return cmp;
    1096                 :            :         }
    1097                 :          0 :       return 0;
    1098                 :            :     }
    1099                 :            : }
    1100                 :            : 
    1101                 :            : static void
    1102                 :       2315 : param_object_init (GParamSpec *pspec)
    1103                 :            : {
    1104                 :            :   /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
    1105                 :       2315 : }
    1106                 :            : 
    1107                 :            : static void
    1108                 :        531 : param_object_set_default (GParamSpec *pspec,
    1109                 :            :                           GValue     *value)
    1110                 :            : {
    1111                 :        531 :   value->data[0].v_pointer = NULL;
    1112                 :        531 : }
    1113                 :            : 
    1114                 :            : static gboolean
    1115                 :      24854 : param_object_is_valid (GParamSpec   *pspec,
    1116                 :            :                        const GValue *value)
    1117                 :            : {
    1118                 :      24854 :   GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
    1119                 :      24855 :   GObject *object = value->data[0].v_pointer;
    1120                 :            : 
    1121   [ +  +  +  - ]:      42962 :   return object &&
    1122                 :      18104 :          g_value_type_compatible (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec));
    1123                 :            : }
    1124                 :            : 
    1125                 :            : static gboolean
    1126                 :       6753 : param_object_validate (GParamSpec *pspec,
    1127                 :            :                        GValue     *value)
    1128                 :            : {
    1129                 :       6753 :   GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
    1130                 :       6753 :   GObject *object = value->data[0].v_pointer;
    1131                 :       6753 :   guint changed = 0;
    1132                 :            :   
    1133   [ +  +  -  + ]:       6753 :   if (object && !g_value_type_compatible (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec)))
    1134                 :            :     {
    1135                 :          0 :       g_object_unref (object);
    1136                 :          0 :       value->data[0].v_pointer = NULL;
    1137                 :          0 :       changed++;
    1138                 :            :     }
    1139                 :            :   
    1140                 :       6753 :   return changed;
    1141                 :            : }
    1142                 :            : 
    1143                 :            : static gint
    1144                 :          9 : param_object_values_cmp (GParamSpec   *pspec,
    1145                 :            :                          const GValue *value1,
    1146                 :            :                          const GValue *value2)
    1147                 :            : {
    1148                 :          9 :   guint8 *p1 = value1->data[0].v_pointer;
    1149                 :          9 :   guint8 *p2 = value2->data[0].v_pointer;
    1150                 :            : 
    1151                 :            :   /* not much to compare here, try to at least provide stable lesser/greater result */
    1152                 :            : 
    1153         [ +  - ]:          9 :   return p1 < p2 ? -1 : p1 > p2;
    1154                 :            : }
    1155                 :            : 
    1156                 :            : static void
    1157                 :        645 : param_override_init (GParamSpec *pspec)
    1158                 :            : {
    1159                 :            :   /* GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec); */
    1160                 :        645 : }
    1161                 :            : 
    1162                 :            : static void
    1163                 :          1 : param_override_finalize (GParamSpec *pspec)
    1164                 :            : {
    1165                 :          1 :   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
    1166                 :          1 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_OVERRIDE));
    1167                 :            :   
    1168         [ +  - ]:          1 :   if (ospec->overridden)
    1169                 :            :     {
    1170                 :          1 :       g_param_spec_unref (ospec->overridden);
    1171                 :          1 :       ospec->overridden = NULL;
    1172                 :            :     }
    1173                 :            :   
    1174                 :          1 :   parent_class->finalize (pspec);
    1175                 :          1 : }
    1176                 :            : 
    1177                 :            : static void
    1178                 :         30 : param_override_set_default (GParamSpec *pspec,
    1179                 :            :                             GValue     *value)
    1180                 :            : {
    1181                 :         30 :   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
    1182                 :            : 
    1183                 :         30 :   g_param_value_set_default (ospec->overridden, value);
    1184                 :         30 : }
    1185                 :            : 
    1186                 :            : static gboolean
    1187                 :          4 : param_override_is_valid (GParamSpec   *pspec,
    1188                 :            :                          const GValue *value)
    1189                 :            : {
    1190                 :          4 :   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
    1191                 :            : 
    1192                 :          4 :   return g_param_value_is_valid (ospec->overridden, value);
    1193                 :            : }
    1194                 :            : 
    1195                 :            : static gboolean
    1196                 :          8 : param_override_validate (GParamSpec *pspec,
    1197                 :            :                          GValue     *value)
    1198                 :            : {
    1199                 :          8 :   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
    1200                 :            :   
    1201                 :          8 :   return g_param_value_validate (ospec->overridden, value);
    1202                 :            : }
    1203                 :            : 
    1204                 :            : static gint
    1205                 :          5 : param_override_values_cmp (GParamSpec   *pspec,
    1206                 :            :                            const GValue *value1,
    1207                 :            :                            const GValue *value2)
    1208                 :            : {
    1209                 :          5 :   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
    1210                 :            : 
    1211                 :          5 :   return g_param_values_cmp (ospec->overridden, value1, value2);
    1212                 :            : }
    1213                 :            : 
    1214                 :            : static void
    1215                 :          8 : param_gtype_init (GParamSpec *pspec)
    1216                 :            : {
    1217                 :          8 : }
    1218                 :            : 
    1219                 :            : static void
    1220                 :          5 : param_gtype_set_default (GParamSpec *pspec,
    1221                 :            :                          GValue     *value)
    1222                 :            : {
    1223                 :          5 :   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
    1224                 :            : 
    1225                 :          5 :   value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type);
    1226                 :          5 : }
    1227                 :            : 
    1228                 :            : static gboolean
    1229                 :         34 : param_gtype_is_valid (GParamSpec   *pspec,
    1230                 :            :                       const GValue *value)
    1231                 :            : {
    1232                 :         34 :   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
    1233                 :         34 :   GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer);
    1234                 :            :   
    1235         [ +  - ]:         68 :   return tspec->is_a_type == G_TYPE_NONE ||
    1236   [ +  +  +  + ]:         34 :          g_type_is_a (gtype, tspec->is_a_type);
    1237                 :            : }
    1238                 :            : 
    1239                 :            : static gboolean
    1240                 :          2 : param_gtype_validate (GParamSpec *pspec,
    1241                 :            :                       GValue     *value)
    1242                 :            : {
    1243                 :          2 :   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
    1244                 :          2 :   GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer);
    1245                 :          2 :   guint changed = 0;
    1246                 :            :   
    1247   [ +  -  +  -  :          2 :   if (tspec->is_a_type != G_TYPE_NONE && !g_type_is_a (gtype, tspec->is_a_type))
                   +  + ]
    1248                 :            :     {
    1249                 :          1 :       value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type);
    1250                 :          1 :       changed++;
    1251                 :            :     }
    1252                 :            :   
    1253                 :          2 :   return changed;
    1254                 :            : }
    1255                 :            : 
    1256                 :            : static gint
    1257                 :          3 : param_gtype_values_cmp (GParamSpec   *pspec,
    1258                 :            :                         const GValue *value1,
    1259                 :            :                         const GValue *value2)
    1260                 :            : {
    1261                 :          3 :   GType p1 = GPOINTER_TO_TYPE (value1->data[0].v_pointer);
    1262                 :          3 :   GType p2 = GPOINTER_TO_TYPE (value2->data[0].v_pointer);
    1263                 :            : 
    1264                 :            :   /* not much to compare here, try to at least provide stable lesser/greater result */
    1265                 :            : 
    1266         [ +  - ]:          3 :   return p1 < p2 ? -1 : p1 > p2;
    1267                 :            : }
    1268                 :            : 
    1269                 :            : static void
    1270                 :         63 : param_variant_init (GParamSpec *pspec)
    1271                 :            : {
    1272                 :         63 :   GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec);
    1273                 :            : 
    1274                 :         63 :   vspec->type = NULL;
    1275                 :         63 :   vspec->default_value = NULL;
    1276                 :         63 : }
    1277                 :            : 
    1278                 :            : static void
    1279                 :         11 : param_variant_finalize (GParamSpec *pspec)
    1280                 :            : {
    1281                 :         11 :   GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec);
    1282                 :         11 :   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_VARIANT));
    1283                 :            : 
    1284         [ +  + ]:         11 :   if (vspec->default_value)
    1285                 :          1 :     g_variant_unref (vspec->default_value);
    1286                 :         11 :   g_variant_type_free (vspec->type);
    1287                 :            : 
    1288                 :         11 :   parent_class->finalize (pspec);
    1289                 :         11 : }
    1290                 :            : 
    1291                 :            : static void
    1292                 :         18 : param_variant_set_default (GParamSpec *pspec,
    1293                 :            :                            GValue     *value)
    1294                 :            : {
    1295                 :         18 :   value->data[0].v_pointer = G_PARAM_SPEC_VARIANT (pspec)->default_value;
    1296                 :         18 :   value->data[1].v_uint |= G_VALUE_NOCOPY_CONTENTS;
    1297                 :         18 : }
    1298                 :            : 
    1299                 :            : static gboolean
    1300                 :        172 : param_variant_is_valid (GParamSpec   *pspec,
    1301                 :            :                         const GValue *value)
    1302                 :            : {
    1303                 :        172 :   GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec);
    1304                 :        172 :   GVariant *variant = value->data[0].v_pointer;
    1305                 :            : 
    1306         [ +  + ]:        172 :   if (variant == NULL)
    1307                 :        112 :     return vspec->default_value == NULL;
    1308                 :            :   else
    1309                 :         60 :     return g_variant_is_of_type (variant, vspec->type);
    1310                 :            : }
    1311                 :            : 
    1312                 :            : static gboolean
    1313                 :          2 : param_variant_validate (GParamSpec *pspec,
    1314                 :            :                         GValue     *value)
    1315                 :            : {
    1316                 :          2 :   GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec);
    1317                 :          2 :   GVariant *variant = value->data[0].v_pointer;
    1318                 :            : 
    1319   [ -  +  -  -  :          2 :   if ((variant == NULL && vspec->default_value != NULL) ||
                   +  - ]
    1320         [ +  + ]:          2 :       (variant != NULL && !g_variant_is_of_type (variant, vspec->type)))
    1321                 :            :     {
    1322                 :          1 :       g_param_value_set_default (pspec, value);
    1323                 :          1 :       return TRUE;
    1324                 :            :     }
    1325                 :            : 
    1326                 :          1 :   return FALSE;
    1327                 :            : }
    1328                 :            : 
    1329                 :            : /* g_variant_compare() can only be used with scalar types. */
    1330                 :            : static gboolean
    1331                 :         14 : variant_is_incomparable (GVariant *v)
    1332                 :            : {
    1333                 :         14 :   GVariantClass v_class = g_variant_classify (v);
    1334                 :            : 
    1335         [ +  - ]:         14 :   return (v_class == G_VARIANT_CLASS_HANDLE ||
    1336         [ +  - ]:         14 :           v_class == G_VARIANT_CLASS_VARIANT ||
    1337         [ +  + ]:         14 :           v_class ==  G_VARIANT_CLASS_MAYBE||
    1338         [ +  - ]:         12 :           v_class == G_VARIANT_CLASS_ARRAY ||
    1339   [ +  -  -  + ]:         28 :           v_class ==  G_VARIANT_CLASS_TUPLE ||
    1340                 :            :           v_class == G_VARIANT_CLASS_DICT_ENTRY);
    1341                 :            : }
    1342                 :            : 
    1343                 :            : static gint
    1344                 :         16 : param_variant_values_cmp (GParamSpec   *pspec,
    1345                 :            :                           const GValue *value1,
    1346                 :            :                           const GValue *value2)
    1347                 :            : {
    1348                 :         16 :   GVariant *v1 = value1->data[0].v_pointer;
    1349                 :         16 :   GVariant *v2 = value2->data[0].v_pointer;
    1350                 :            : 
    1351   [ +  +  +  + ]:         16 :   if (v1 == NULL && v2 == NULL)
    1352                 :          2 :     return 0;
    1353   [ +  +  +  - ]:         14 :   else if (v1 == NULL && v2 != NULL)
    1354                 :          2 :     return -1;
    1355   [ +  -  +  + ]:         12 :   else if (v1 != NULL && v2 == NULL)
    1356                 :          1 :     return 1;
    1357                 :            : 
    1358   [ +  +  +  + ]:         19 :   if (!g_variant_type_equal (g_variant_get_type (v1), g_variant_get_type (v2)) ||
    1359         [ -  + ]:         14 :       variant_is_incomparable (v1) ||
    1360                 :          6 :       variant_is_incomparable (v2))
    1361   [ +  +  +  + ]:          5 :     return g_variant_equal (v1, v2) ? 0 : (v1 < v2 ? -1 : 1);
    1362                 :            : 
    1363                 :          6 :   return g_variant_compare (v1, v2);
    1364                 :            : }
    1365                 :            : 
    1366                 :            : /* --- type initialization --- */
    1367                 :            : 
    1368                 :            : #define set_is_valid_vfunc(type,func) { \
    1369                 :            :   GParamSpecClass *class = g_type_class_ref (type); \
    1370                 :            :   class->value_is_valid = func; \
    1371                 :            :   g_type_class_unref (class); \
    1372                 :            : }
    1373                 :            : 
    1374                 :            : GType *g_param_spec_types = NULL;
    1375                 :            : 
    1376                 :            : void
    1377                 :        527 : _g_param_spec_types_init (void) 
    1378                 :            : {
    1379                 :        527 :   const guint n_types = 23;
    1380                 :            :   GType type, *spec_types;
    1381                 :            : #ifndef G_DISABLE_ASSERT
    1382                 :            :   GType *spec_types_bound;
    1383                 :            : #endif
    1384                 :            : 
    1385                 :        527 :   g_param_spec_types = g_new0 (GType, n_types);
    1386                 :        527 :   spec_types = g_param_spec_types;
    1387                 :            : #ifndef G_DISABLE_ASSERT
    1388                 :        527 :   spec_types_bound = g_param_spec_types + n_types;
    1389                 :            : #endif
    1390                 :            :   
    1391                 :            :   /* G_TYPE_PARAM_CHAR
    1392                 :            :    */
    1393                 :            :   {
    1394                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1395                 :            :       sizeof (GParamSpecChar),  /* instance_size */
    1396                 :            :       16,                       /* n_preallocs */
    1397                 :            :       param_char_init,          /* instance_init */
    1398                 :            :       G_TYPE_CHAR,              /* value_type */
    1399                 :            :       NULL,                     /* finalize */
    1400                 :            :       param_char_set_default,   /* value_set_default */
    1401                 :            :       param_char_validate,      /* value_validate */
    1402                 :            :       param_int_values_cmp,     /* values_cmp */
    1403                 :            :     };
    1404                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamChar"), &pspec_info);
    1405                 :        527 :     set_is_valid_vfunc (type, param_char_is_valid);
    1406                 :        527 :     *spec_types++ = type;
    1407                 :        527 :     g_assert (type == G_TYPE_PARAM_CHAR);
    1408                 :            :   }
    1409                 :            :   
    1410                 :            :   /* G_TYPE_PARAM_UCHAR
    1411                 :            :    */
    1412                 :            :   {
    1413                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1414                 :            :       sizeof (GParamSpecUChar), /* instance_size */
    1415                 :            :       16,                       /* n_preallocs */
    1416                 :            :       param_uchar_init,         /* instance_init */
    1417                 :            :       G_TYPE_UCHAR,             /* value_type */
    1418                 :            :       NULL,                     /* finalize */
    1419                 :            :       param_uchar_set_default,  /* value_set_default */
    1420                 :            :       param_uchar_validate,     /* value_validate */
    1421                 :            :       param_uint_values_cmp,    /* values_cmp */
    1422                 :            :     };
    1423                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamUChar"), &pspec_info);
    1424                 :        527 :     set_is_valid_vfunc (type, param_uchar_is_valid);
    1425                 :        527 :     *spec_types++ = type;
    1426                 :        527 :     g_assert (type == G_TYPE_PARAM_UCHAR);
    1427                 :            :   }
    1428                 :            :   
    1429                 :            :   /* G_TYPE_PARAM_BOOLEAN
    1430                 :            :    */
    1431                 :            :   {
    1432                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1433                 :            :       sizeof (GParamSpecBoolean), /* instance_size */
    1434                 :            :       16,                         /* n_preallocs */
    1435                 :            :       NULL,                       /* instance_init */
    1436                 :            :       G_TYPE_BOOLEAN,             /* value_type */
    1437                 :            :       NULL,                       /* finalize */
    1438                 :            :       param_boolean_set_default,  /* value_set_default */
    1439                 :            :       param_boolean_validate,     /* value_validate */
    1440                 :            :       param_int_values_cmp,       /* values_cmp */
    1441                 :            :     };
    1442                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamBoolean"), &pspec_info);
    1443                 :        527 :     set_is_valid_vfunc (type, param_boolean_is_valid);
    1444                 :        527 :     *spec_types++ = type;
    1445                 :        527 :     g_assert (type == G_TYPE_PARAM_BOOLEAN);
    1446                 :            :   }
    1447                 :            :   
    1448                 :            :   /* G_TYPE_PARAM_INT
    1449                 :            :    */
    1450                 :            :   {
    1451                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1452                 :            :       sizeof (GParamSpecInt),   /* instance_size */
    1453                 :            :       16,                       /* n_preallocs */
    1454                 :            :       param_int_init,           /* instance_init */
    1455                 :            :       G_TYPE_INT,               /* value_type */
    1456                 :            :       NULL,                     /* finalize */
    1457                 :            :       param_int_set_default,    /* value_set_default */
    1458                 :            :       param_int_validate,       /* value_validate */
    1459                 :            :       param_int_values_cmp,     /* values_cmp */
    1460                 :            :     };
    1461                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamInt"), &pspec_info);
    1462                 :        527 :     set_is_valid_vfunc (type, param_int_is_valid);
    1463                 :        527 :     *spec_types++ = type;
    1464                 :        527 :     g_assert (type == G_TYPE_PARAM_INT);
    1465                 :            :   }
    1466                 :            :   
    1467                 :            :   /* G_TYPE_PARAM_UINT
    1468                 :            :    */
    1469                 :            :   {
    1470                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1471                 :            :       sizeof (GParamSpecUInt),  /* instance_size */
    1472                 :            :       16,                       /* n_preallocs */
    1473                 :            :       param_uint_init,          /* instance_init */
    1474                 :            :       G_TYPE_UINT,              /* value_type */
    1475                 :            :       NULL,                     /* finalize */
    1476                 :            :       param_uint_set_default,   /* value_set_default */
    1477                 :            :       param_uint_validate,      /* value_validate */
    1478                 :            :       param_uint_values_cmp,    /* values_cmp */
    1479                 :            :     };
    1480                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamUInt"), &pspec_info);
    1481                 :        527 :     set_is_valid_vfunc (type, param_uint_is_valid);
    1482                 :        527 :     *spec_types++ = type;
    1483                 :        527 :     g_assert (type == G_TYPE_PARAM_UINT);
    1484                 :            :   }
    1485                 :            :   
    1486                 :            :   /* G_TYPE_PARAM_LONG
    1487                 :            :    */
    1488                 :            :   {
    1489                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1490                 :            :       sizeof (GParamSpecLong),  /* instance_size */
    1491                 :            :       16,                       /* n_preallocs */
    1492                 :            :       param_long_init,          /* instance_init */
    1493                 :            :       G_TYPE_LONG,              /* value_type */
    1494                 :            :       NULL,                     /* finalize */
    1495                 :            :       param_long_set_default,   /* value_set_default */
    1496                 :            :       param_long_validate,      /* value_validate */
    1497                 :            :       param_long_values_cmp,    /* values_cmp */
    1498                 :            :     };
    1499                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamLong"), &pspec_info);
    1500                 :        527 :     set_is_valid_vfunc (type, param_long_is_valid);
    1501                 :        527 :     *spec_types++ = type;
    1502                 :        527 :     g_assert (type == G_TYPE_PARAM_LONG);
    1503                 :            :   }
    1504                 :            :   
    1505                 :            :   /* G_TYPE_PARAM_ULONG
    1506                 :            :    */
    1507                 :            :   {
    1508                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1509                 :            :       sizeof (GParamSpecULong), /* instance_size */
    1510                 :            :       16,                       /* n_preallocs */
    1511                 :            :       param_ulong_init,         /* instance_init */
    1512                 :            :       G_TYPE_ULONG,             /* value_type */
    1513                 :            :       NULL,                     /* finalize */
    1514                 :            :       param_ulong_set_default,  /* value_set_default */
    1515                 :            :       param_ulong_validate,     /* value_validate */
    1516                 :            :       param_ulong_values_cmp,   /* values_cmp */
    1517                 :            :     };
    1518                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamULong"), &pspec_info);
    1519                 :        527 :     set_is_valid_vfunc (type, param_ulong_is_valid);
    1520                 :        527 :     *spec_types++ = type;
    1521                 :        527 :     g_assert (type == G_TYPE_PARAM_ULONG);
    1522                 :            :   }
    1523                 :            : 
    1524                 :            :   /* G_TYPE_PARAM_INT64
    1525                 :            :    */
    1526                 :            :   {
    1527                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1528                 :            :       sizeof (GParamSpecInt64),  /* instance_size */
    1529                 :            :       16,                       /* n_preallocs */
    1530                 :            :       param_int64_init,         /* instance_init */
    1531                 :            :       G_TYPE_INT64,             /* value_type */
    1532                 :            :       NULL,                     /* finalize */
    1533                 :            :       param_int64_set_default,  /* value_set_default */
    1534                 :            :       param_int64_validate,     /* value_validate */
    1535                 :            :       param_int64_values_cmp,   /* values_cmp */
    1536                 :            :     };
    1537                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamInt64"), &pspec_info);
    1538                 :        527 :     set_is_valid_vfunc (type, param_int64_is_valid);
    1539                 :        527 :     *spec_types++ = type;
    1540                 :        527 :     g_assert (type == G_TYPE_PARAM_INT64);
    1541                 :            :   }
    1542                 :            :   
    1543                 :            :   /* G_TYPE_PARAM_UINT64
    1544                 :            :    */
    1545                 :            :   {
    1546                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1547                 :            :       sizeof (GParamSpecUInt64), /* instance_size */
    1548                 :            :       16,                       /* n_preallocs */
    1549                 :            :       param_uint64_init,        /* instance_init */
    1550                 :            :       G_TYPE_UINT64,            /* value_type */
    1551                 :            :       NULL,                     /* finalize */
    1552                 :            :       param_uint64_set_default, /* value_set_default */
    1553                 :            :       param_uint64_validate,    /* value_validate */
    1554                 :            :       param_uint64_values_cmp,  /* values_cmp */
    1555                 :            :     };
    1556                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamUInt64"), &pspec_info);
    1557                 :        527 :     set_is_valid_vfunc (type, param_uint64_is_valid);
    1558                 :        527 :     *spec_types++ = type;
    1559                 :        527 :     g_assert (type == G_TYPE_PARAM_UINT64);
    1560                 :            :   }
    1561                 :            : 
    1562                 :            :   /* G_TYPE_PARAM_UNICHAR
    1563                 :            :    */
    1564                 :            :   {
    1565                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1566                 :            :       sizeof (GParamSpecUnichar), /* instance_size */
    1567                 :            :       16,                        /* n_preallocs */
    1568                 :            :       param_unichar_init,        /* instance_init */
    1569                 :            :       G_TYPE_UINT,               /* value_type */
    1570                 :            :       NULL,                      /* finalize */
    1571                 :            :       param_unichar_set_default, /* value_set_default */
    1572                 :            :       param_unichar_validate,    /* value_validate */
    1573                 :            :       param_unichar_values_cmp,  /* values_cmp */
    1574                 :            :     };
    1575                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamUnichar"), &pspec_info);
    1576                 :        527 :     set_is_valid_vfunc (type, param_unichar_is_valid);
    1577                 :        527 :     *spec_types++ = type;
    1578                 :        527 :     g_assert (type == G_TYPE_PARAM_UNICHAR);
    1579                 :            :   }
    1580                 :            : 
    1581                 :            :  /* G_TYPE_PARAM_ENUM
    1582                 :            :    */
    1583                 :            :   {
    1584                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1585                 :            :       sizeof (GParamSpecEnum),  /* instance_size */
    1586                 :            :       16,                       /* n_preallocs */
    1587                 :            :       param_enum_init,          /* instance_init */
    1588                 :            :       G_TYPE_ENUM,              /* value_type */
    1589                 :            :       param_enum_finalize,      /* finalize */
    1590                 :            :       param_enum_set_default,   /* value_set_default */
    1591                 :            :       param_enum_validate,      /* value_validate */
    1592                 :            :       param_long_values_cmp,    /* values_cmp */
    1593                 :            :     };
    1594                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamEnum"), &pspec_info);
    1595                 :        527 :     set_is_valid_vfunc (type, param_enum_is_valid);
    1596                 :        527 :     *spec_types++ = type;
    1597                 :        527 :     g_assert (type == G_TYPE_PARAM_ENUM);
    1598                 :            :   }
    1599                 :            :   
    1600                 :            :   /* G_TYPE_PARAM_FLAGS
    1601                 :            :    */
    1602                 :            :   {
    1603                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1604                 :            :       sizeof (GParamSpecFlags), /* instance_size */
    1605                 :            :       16,                       /* n_preallocs */
    1606                 :            :       param_flags_init,         /* instance_init */
    1607                 :            :       G_TYPE_FLAGS,             /* value_type */
    1608                 :            :       param_flags_finalize,     /* finalize */
    1609                 :            :       param_flags_set_default,  /* value_set_default */
    1610                 :            :       param_flags_validate,     /* value_validate */
    1611                 :            :       param_ulong_values_cmp,   /* values_cmp */
    1612                 :            :     };
    1613                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamFlags"), &pspec_info);
    1614                 :        527 :     set_is_valid_vfunc (type, param_flags_is_valid);
    1615                 :        527 :     *spec_types++ = type;
    1616                 :        527 :     g_assert (type == G_TYPE_PARAM_FLAGS);
    1617                 :            :   }
    1618                 :            :   
    1619                 :            :   /* G_TYPE_PARAM_FLOAT
    1620                 :            :    */
    1621                 :            :   {
    1622                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1623                 :            :       sizeof (GParamSpecFloat), /* instance_size */
    1624                 :            :       16,                       /* n_preallocs */
    1625                 :            :       param_float_init,         /* instance_init */
    1626                 :            :       G_TYPE_FLOAT,             /* value_type */
    1627                 :            :       NULL,                     /* finalize */
    1628                 :            :       param_float_set_default,  /* value_set_default */
    1629                 :            :       param_float_validate,     /* value_validate */
    1630                 :            :       param_float_values_cmp,   /* values_cmp */
    1631                 :            :     };
    1632                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamFloat"), &pspec_info);
    1633                 :        527 :     set_is_valid_vfunc (type, param_float_is_valid);
    1634                 :        527 :     *spec_types++ = type;
    1635                 :        527 :     g_assert (type == G_TYPE_PARAM_FLOAT);
    1636                 :            :   }
    1637                 :            :   
    1638                 :            :   /* G_TYPE_PARAM_DOUBLE
    1639                 :            :    */
    1640                 :            :   {
    1641                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1642                 :            :       sizeof (GParamSpecDouble),        /* instance_size */
    1643                 :            :       16,                               /* n_preallocs */
    1644                 :            :       param_double_init,                /* instance_init */
    1645                 :            :       G_TYPE_DOUBLE,                    /* value_type */
    1646                 :            :       NULL,                             /* finalize */
    1647                 :            :       param_double_set_default,         /* value_set_default */
    1648                 :            :       param_double_validate,            /* value_validate */
    1649                 :            :       param_double_values_cmp,          /* values_cmp */
    1650                 :            :     };
    1651                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamDouble"), &pspec_info);
    1652                 :        527 :     set_is_valid_vfunc (type, param_double_is_valid);
    1653                 :        527 :     *spec_types++ = type;
    1654                 :        527 :     g_assert (type == G_TYPE_PARAM_DOUBLE);
    1655                 :            :   }
    1656                 :            :   
    1657                 :            :   /* G_TYPE_PARAM_STRING
    1658                 :            :    */
    1659                 :            :   {
    1660                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1661                 :            :       sizeof (GParamSpecString),        /* instance_size */
    1662                 :            :       16,                               /* n_preallocs */
    1663                 :            :       param_string_init,                /* instance_init */
    1664                 :            :       G_TYPE_STRING,                    /* value_type */
    1665                 :            :       param_string_finalize,            /* finalize */
    1666                 :            :       param_string_set_default,         /* value_set_default */
    1667                 :            :       param_string_validate,            /* value_validate */
    1668                 :            :       param_string_values_cmp,          /* values_cmp */
    1669                 :            :     };
    1670                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamString"), &pspec_info);
    1671                 :        527 :     set_is_valid_vfunc (type, param_string_is_valid);
    1672                 :        527 :     *spec_types++ = type;
    1673                 :        527 :     g_assert (type == G_TYPE_PARAM_STRING);
    1674                 :            :   }
    1675                 :            :   
    1676                 :            :   /* G_TYPE_PARAM_PARAM
    1677                 :            :    */
    1678                 :            :   {
    1679                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1680                 :            :       sizeof (GParamSpecParam), /* instance_size */
    1681                 :            :       16,                       /* n_preallocs */
    1682                 :            :       param_param_init,         /* instance_init */
    1683                 :            :       G_TYPE_PARAM,             /* value_type */
    1684                 :            :       NULL,                     /* finalize */
    1685                 :            :       param_param_set_default,  /* value_set_default */
    1686                 :            :       param_param_validate,     /* value_validate */
    1687                 :            :       param_pointer_values_cmp, /* values_cmp */
    1688                 :            :     };
    1689                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamParam"), &pspec_info);
    1690                 :        527 :     set_is_valid_vfunc (type, param_param_is_valid);
    1691                 :        527 :     *spec_types++ = type;
    1692                 :        527 :     g_assert (type == G_TYPE_PARAM_PARAM);
    1693                 :            :   }
    1694                 :            :   
    1695                 :            :   /* G_TYPE_PARAM_BOXED
    1696                 :            :    */
    1697                 :            :   {
    1698                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1699                 :            :       sizeof (GParamSpecBoxed), /* instance_size */
    1700                 :            :       4,                        /* n_preallocs */
    1701                 :            :       param_boxed_init,         /* instance_init */
    1702                 :            :       G_TYPE_BOXED,             /* value_type */
    1703                 :            :       NULL,                     /* finalize */
    1704                 :            :       param_boxed_set_default,  /* value_set_default */
    1705                 :            :       NULL,                     /* value_validate */
    1706                 :            :       param_boxed_values_cmp,   /* values_cmp */
    1707                 :            :     };
    1708                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamBoxed"), &pspec_info);
    1709                 :        527 :     *spec_types++ = type;
    1710                 :        527 :     g_assert (type == G_TYPE_PARAM_BOXED);
    1711                 :            :   }
    1712                 :            : 
    1713                 :            :   /* G_TYPE_PARAM_POINTER
    1714                 :            :    */
    1715                 :            :   {
    1716                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1717                 :            :       sizeof (GParamSpecPointer),  /* instance_size */
    1718                 :            :       0,                           /* n_preallocs */
    1719                 :            :       param_pointer_init,          /* instance_init */
    1720                 :            :       G_TYPE_POINTER,              /* value_type */
    1721                 :            :       NULL,                        /* finalize */
    1722                 :            :       param_pointer_set_default,   /* value_set_default */
    1723                 :            :       NULL,
    1724                 :            :       param_pointer_values_cmp,    /* values_cmp */
    1725                 :            :     };
    1726                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamPointer"), &pspec_info);
    1727                 :        527 :     *spec_types++ = type;
    1728                 :        527 :     g_assert (type == G_TYPE_PARAM_POINTER);
    1729                 :            :   }
    1730                 :            :   
    1731                 :            :   /* G_TYPE_PARAM_VALUE_ARRAY
    1732                 :            :    */
    1733                 :            :   {
    1734                 :        527 :     /* const */ GParamSpecTypeInfo pspec_info = {
    1735                 :            :       sizeof (GParamSpecValueArray),    /* instance_size */
    1736                 :            :       0,                                /* n_preallocs */
    1737                 :            :       param_value_array_init,           /* instance_init */
    1738                 :            :       0xdeadbeef,                       /* value_type, assigned further down */
    1739                 :            :       param_value_array_finalize,       /* finalize */
    1740                 :            :       param_value_array_set_default,    /* value_set_default */
    1741                 :            :       param_value_array_validate,       /* value_validate */
    1742                 :            :       param_value_array_values_cmp,     /* values_cmp */
    1743                 :            :     };
    1744                 :        527 :     pspec_info.value_type = G_TYPE_VALUE_ARRAY;
    1745                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamValueArray"), &pspec_info);
    1746                 :        527 :     *spec_types++ = type;
    1747                 :        527 :     g_assert (type == G_TYPE_PARAM_VALUE_ARRAY);
    1748                 :            :   }
    1749                 :            : 
    1750                 :            :   /* G_TYPE_PARAM_OBJECT
    1751                 :            :    */
    1752                 :            :   {
    1753                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1754                 :            :       sizeof (GParamSpecObject), /* instance_size */
    1755                 :            :       16,                        /* n_preallocs */
    1756                 :            :       param_object_init,         /* instance_init */
    1757                 :            :       G_TYPE_OBJECT,             /* value_type */
    1758                 :            :       NULL,                      /* finalize */
    1759                 :            :       param_object_set_default,  /* value_set_default */
    1760                 :            :       param_object_validate,     /* value_validate */
    1761                 :            :       param_object_values_cmp,   /* values_cmp */
    1762                 :            :     };
    1763                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamObject"), &pspec_info);
    1764                 :        527 :     set_is_valid_vfunc (type, param_object_is_valid);
    1765                 :        527 :     *spec_types++ = type;
    1766                 :        527 :     g_assert (type == G_TYPE_PARAM_OBJECT);
    1767                 :            :   }
    1768                 :            : 
    1769                 :            :   /* G_TYPE_PARAM_OVERRIDE
    1770                 :            :    */
    1771                 :            :   {
    1772                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1773                 :            :       sizeof (GParamSpecOverride), /* instance_size */
    1774                 :            :       16,                        /* n_preallocs */
    1775                 :            :       param_override_init,       /* instance_init */
    1776                 :            :       G_TYPE_NONE,               /* value_type */
    1777                 :            :       param_override_finalize,   /* finalize */
    1778                 :            :       param_override_set_default, /* value_set_default */
    1779                 :            :       param_override_validate,    /* value_validate */
    1780                 :            :       param_override_values_cmp,  /* values_cmp */
    1781                 :            :     };
    1782                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamOverride"), &pspec_info);
    1783                 :        527 :     set_is_valid_vfunc (type, param_override_is_valid);
    1784                 :        527 :     *spec_types++ = type;
    1785                 :        527 :     g_assert (type == G_TYPE_PARAM_OVERRIDE);
    1786                 :            :   }
    1787                 :            : 
    1788                 :            :   /* G_TYPE_PARAM_GTYPE
    1789                 :            :    */
    1790                 :            :   {
    1791                 :        527 :     GParamSpecTypeInfo pspec_info = {
    1792                 :            :       sizeof (GParamSpecGType), /* instance_size */
    1793                 :            :       0,                        /* n_preallocs */
    1794                 :            :       param_gtype_init,         /* instance_init */
    1795                 :            :       0xdeadbeef,               /* value_type, assigned further down */
    1796                 :            :       NULL,                     /* finalize */
    1797                 :            :       param_gtype_set_default,  /* value_set_default */
    1798                 :            :       param_gtype_validate,     /* value_validate */
    1799                 :            :       param_gtype_values_cmp,   /* values_cmp */
    1800                 :            :     };
    1801                 :        527 :     pspec_info.value_type = G_TYPE_GTYPE;
    1802                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamGType"), &pspec_info);
    1803                 :        527 :     set_is_valid_vfunc (type, param_gtype_is_valid);
    1804                 :        527 :     *spec_types++ = type;
    1805                 :        527 :     g_assert (type == G_TYPE_PARAM_GTYPE);
    1806                 :            :   }
    1807                 :            : 
    1808                 :            :   /* G_TYPE_PARAM_VARIANT
    1809                 :            :    */
    1810                 :            :   {
    1811                 :        527 :     const GParamSpecTypeInfo pspec_info = {
    1812                 :            :       sizeof (GParamSpecVariant), /* instance_size */
    1813                 :            :       0,                          /* n_preallocs */
    1814                 :            :       param_variant_init,         /* instance_init */
    1815                 :            :       G_TYPE_VARIANT,             /* value_type */
    1816                 :            :       param_variant_finalize,     /* finalize */
    1817                 :            :       param_variant_set_default,  /* value_set_default */
    1818                 :            :       param_variant_validate,     /* value_validate */
    1819                 :            :       param_variant_values_cmp,   /* values_cmp */
    1820                 :            :     };
    1821                 :        527 :     type = g_param_type_register_static (g_intern_static_string ("GParamVariant"), &pspec_info);
    1822                 :        527 :     set_is_valid_vfunc (type, param_variant_is_valid);
    1823                 :        527 :     *spec_types++ = type;
    1824                 :        527 :     g_assert (type == G_TYPE_PARAM_VARIANT);
    1825                 :            :   }
    1826                 :            : 
    1827                 :        527 :   g_assert (spec_types == spec_types_bound);
    1828                 :        527 : }
    1829                 :            : 
    1830                 :            : /* --- GParamSpec initialization --- */
    1831                 :            : 
    1832                 :            : /**
    1833                 :            :  * g_param_spec_char:
    1834                 :            :  * @name: canonical name of the property specified
    1835                 :            :  * @nick: (nullable): nick name for the property specified
    1836                 :            :  * @blurb: (nullable): description of the property specified
    1837                 :            :  * @minimum: minimum value for the property specified
    1838                 :            :  * @maximum: maximum value for the property specified
    1839                 :            :  * @default_value: default value for the property specified
    1840                 :            :  * @flags: flags for the property specified
    1841                 :            :  *
    1842                 :            :  * Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
    1843                 :            :  *
    1844                 :            :  * Returns: (transfer full): a newly created parameter specification
    1845                 :            :  */
    1846                 :            : GParamSpec*
    1847                 :          6 : g_param_spec_char (const gchar *name,
    1848                 :            :                    const gchar *nick,
    1849                 :            :                    const gchar *blurb,
    1850                 :            :                    gint8        minimum,
    1851                 :            :                    gint8        maximum,
    1852                 :            :                    gint8        default_value,
    1853                 :            :                    GParamFlags  flags)
    1854                 :            : {
    1855                 :            :   GParamSpecChar *cspec;
    1856                 :            : 
    1857                 :          6 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    1858                 :            : 
    1859                 :          6 :   cspec = g_param_spec_internal (G_TYPE_PARAM_CHAR,
    1860                 :            :                                  name,
    1861                 :            :                                  nick,
    1862                 :            :                                  blurb,
    1863                 :            :                                  flags);
    1864                 :            :   
    1865                 :          6 :   cspec->minimum = minimum;
    1866                 :          6 :   cspec->maximum = maximum;
    1867                 :          6 :   cspec->default_value = default_value;
    1868                 :            :   
    1869                 :          6 :   return G_PARAM_SPEC (cspec);
    1870                 :            : }
    1871                 :            : 
    1872                 :            : /**
    1873                 :            :  * g_param_spec_uchar:
    1874                 :            :  * @name: canonical name of the property specified
    1875                 :            :  * @nick: (nullable): nick name for the property specified
    1876                 :            :  * @blurb: (nullable): description of the property specified
    1877                 :            :  * @minimum: minimum value for the property specified
    1878                 :            :  * @maximum: maximum value for the property specified
    1879                 :            :  * @default_value: default value for the property specified
    1880                 :            :  * @flags: flags for the property specified
    1881                 :            :  *
    1882                 :            :  * Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
    1883                 :            :  *
    1884                 :            :  * Returns: (transfer full): a newly created parameter specification
    1885                 :            :  */
    1886                 :            : GParamSpec*
    1887                 :          4 : g_param_spec_uchar (const gchar *name,
    1888                 :            :                     const gchar *nick,
    1889                 :            :                     const gchar *blurb,
    1890                 :            :                     guint8       minimum,
    1891                 :            :                     guint8       maximum,
    1892                 :            :                     guint8       default_value,
    1893                 :            :                     GParamFlags  flags)
    1894                 :            : {
    1895                 :            :   GParamSpecUChar *uspec;
    1896                 :            : 
    1897                 :          4 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    1898                 :            : 
    1899                 :          4 :   uspec = g_param_spec_internal (G_TYPE_PARAM_UCHAR,
    1900                 :            :                                  name,
    1901                 :            :                                  nick,
    1902                 :            :                                  blurb,
    1903                 :            :                                  flags);
    1904                 :            :   
    1905                 :          4 :   uspec->minimum = minimum;
    1906                 :          4 :   uspec->maximum = maximum;
    1907                 :          4 :   uspec->default_value = default_value;
    1908                 :            :   
    1909                 :          4 :   return G_PARAM_SPEC (uspec);
    1910                 :            : }
    1911                 :            : 
    1912                 :            : /**
    1913                 :            :  * g_param_spec_boolean:
    1914                 :            :  * @name: canonical name of the property specified
    1915                 :            :  * @nick: (nullable): nick name for the property specified
    1916                 :            :  * @blurb: (nullable): description of the property specified
    1917                 :            :  * @default_value: default value for the property specified
    1918                 :            :  * @flags: flags for the property specified
    1919                 :            :  *
    1920                 :            :  * Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
    1921                 :            :  * property. In many cases, it may be more appropriate to use an enum with
    1922                 :            :  * g_param_spec_enum(), both to improve code clarity by using explicitly named
    1923                 :            :  * values, and to allow for more values to be added in future without breaking
    1924                 :            :  * API.
    1925                 :            :  *
    1926                 :            :  * See g_param_spec_internal() for details on property names.
    1927                 :            :  *
    1928                 :            :  * Returns: (transfer full): a newly created parameter specification
    1929                 :            :  */
    1930                 :            : GParamSpec*
    1931                 :       2420 : g_param_spec_boolean (const gchar *name,
    1932                 :            :                       const gchar *nick,
    1933                 :            :                       const gchar *blurb,
    1934                 :            :                       gboolean     default_value,
    1935                 :            :                       GParamFlags  flags)
    1936                 :            : {
    1937                 :            :   GParamSpecBoolean *bspec;
    1938                 :            : 
    1939                 :       2420 :   g_return_val_if_fail (default_value == TRUE || default_value == FALSE, NULL);
    1940                 :            : 
    1941                 :       2420 :   bspec = g_param_spec_internal (G_TYPE_PARAM_BOOLEAN,
    1942                 :            :                                  name,
    1943                 :            :                                  nick,
    1944                 :            :                                  blurb,
    1945                 :            :                                  flags);
    1946                 :            :   
    1947                 :       2420 :   bspec->default_value = default_value;
    1948                 :            :   
    1949                 :       2420 :   return G_PARAM_SPEC (bspec);
    1950                 :            : }
    1951                 :            : 
    1952                 :            : /**
    1953                 :            :  * g_param_spec_int:
    1954                 :            :  * @name: canonical name of the property specified
    1955                 :            :  * @nick: (nullable): nick name for the property specified
    1956                 :            :  * @blurb: (nullable): description of the property specified
    1957                 :            :  * @minimum: minimum value for the property specified
    1958                 :            :  * @maximum: maximum value for the property specified
    1959                 :            :  * @default_value: default value for the property specified
    1960                 :            :  * @flags: flags for the property specified
    1961                 :            :  *
    1962                 :            :  * Creates a new #GParamSpecInt instance specifying a %G_TYPE_INT property.
    1963                 :            :  *
    1964                 :            :  * See g_param_spec_internal() for details on property names.
    1965                 :            :  *
    1966                 :            :  * Returns: (transfer full): a newly created parameter specification
    1967                 :            :  */
    1968                 :            : GParamSpec*
    1969                 :        581 : g_param_spec_int (const gchar *name,
    1970                 :            :                   const gchar *nick,
    1971                 :            :                   const gchar *blurb,
    1972                 :            :                   gint         minimum,
    1973                 :            :                   gint         maximum,
    1974                 :            :                   gint         default_value,
    1975                 :            :                   GParamFlags  flags)
    1976                 :            : {
    1977                 :            :   GParamSpecInt *ispec;
    1978                 :            : 
    1979                 :        581 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    1980                 :            : 
    1981                 :        581 :   ispec = g_param_spec_internal (G_TYPE_PARAM_INT,
    1982                 :            :                                  name,
    1983                 :            :                                  nick,
    1984                 :            :                                  blurb,
    1985                 :            :                                  flags);
    1986                 :            :   
    1987                 :        581 :   ispec->minimum = minimum;
    1988                 :        581 :   ispec->maximum = maximum;
    1989                 :        581 :   ispec->default_value = default_value;
    1990                 :            :   
    1991                 :        581 :   return G_PARAM_SPEC (ispec);
    1992                 :            : }
    1993                 :            : 
    1994                 :            : /**
    1995                 :            :  * g_param_spec_uint:
    1996                 :            :  * @name: canonical name of the property specified
    1997                 :            :  * @nick: (nullable): nick name for the property specified
    1998                 :            :  * @blurb: (nullable): description of the property specified
    1999                 :            :  * @minimum: minimum value for the property specified
    2000                 :            :  * @maximum: maximum value for the property specified
    2001                 :            :  * @default_value: default value for the property specified
    2002                 :            :  * @flags: flags for the property specified
    2003                 :            :  *
    2004                 :            :  * Creates a new #GParamSpecUInt instance specifying a %G_TYPE_UINT property.
    2005                 :            :  *
    2006                 :            :  * See g_param_spec_internal() for details on property names.
    2007                 :            :  *
    2008                 :            :  * Returns: (transfer full): a newly created parameter specification
    2009                 :            :  */
    2010                 :            : GParamSpec*
    2011                 :        758 : g_param_spec_uint (const gchar *name,
    2012                 :            :                    const gchar *nick,
    2013                 :            :                    const gchar *blurb,
    2014                 :            :                    guint        minimum,
    2015                 :            :                    guint        maximum,
    2016                 :            :                    guint        default_value,
    2017                 :            :                    GParamFlags  flags)
    2018                 :            : {
    2019                 :            :   GParamSpecUInt *uspec;
    2020                 :            : 
    2021                 :        758 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2022                 :            : 
    2023                 :        758 :   uspec = g_param_spec_internal (G_TYPE_PARAM_UINT,
    2024                 :            :                                  name,
    2025                 :            :                                  nick,
    2026                 :            :                                  blurb,
    2027                 :            :                                  flags);
    2028                 :            :   
    2029                 :        758 :   uspec->minimum = minimum;
    2030                 :        758 :   uspec->maximum = maximum;
    2031                 :        758 :   uspec->default_value = default_value;
    2032                 :            :   
    2033                 :        758 :   return G_PARAM_SPEC (uspec);
    2034                 :            : }
    2035                 :            : 
    2036                 :            : /**
    2037                 :            :  * g_param_spec_long:
    2038                 :            :  * @name: canonical name of the property specified
    2039                 :            :  * @nick: (nullable): nick name for the property specified
    2040                 :            :  * @blurb: (nullable): description of the property specified
    2041                 :            :  * @minimum: minimum value for the property specified
    2042                 :            :  * @maximum: maximum value for the property specified
    2043                 :            :  * @default_value: default value for the property specified
    2044                 :            :  * @flags: flags for the property specified
    2045                 :            :  *
    2046                 :            :  * Creates a new #GParamSpecLong instance specifying a %G_TYPE_LONG property.
    2047                 :            :  *
    2048                 :            :  * See g_param_spec_internal() for details on property names.
    2049                 :            :  *
    2050                 :            :  * Returns: (transfer full): a newly created parameter specification
    2051                 :            :  */
    2052                 :            : GParamSpec*
    2053                 :          3 : g_param_spec_long (const gchar *name,
    2054                 :            :                    const gchar *nick,
    2055                 :            :                    const gchar *blurb,
    2056                 :            :                    glong        minimum,
    2057                 :            :                    glong        maximum,
    2058                 :            :                    glong        default_value,
    2059                 :            :                    GParamFlags  flags)
    2060                 :            : {
    2061                 :            :   GParamSpecLong *lspec;
    2062                 :            : 
    2063                 :          3 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2064                 :            : 
    2065                 :          3 :   lspec = g_param_spec_internal (G_TYPE_PARAM_LONG,
    2066                 :            :                                  name,
    2067                 :            :                                  nick,
    2068                 :            :                                  blurb,
    2069                 :            :                                  flags);
    2070                 :            :   
    2071                 :          3 :   lspec->minimum = minimum;
    2072                 :          3 :   lspec->maximum = maximum;
    2073                 :          3 :   lspec->default_value = default_value;
    2074                 :            :   
    2075                 :          3 :   return G_PARAM_SPEC (lspec);
    2076                 :            : }
    2077                 :            : 
    2078                 :            : /**
    2079                 :            :  * g_param_spec_ulong:
    2080                 :            :  * @name: canonical name of the property specified
    2081                 :            :  * @nick: (nullable): nick name for the property specified
    2082                 :            :  * @blurb: (nullable): description of the property specified
    2083                 :            :  * @minimum: minimum value for the property specified
    2084                 :            :  * @maximum: maximum value for the property specified
    2085                 :            :  * @default_value: default value for the property specified
    2086                 :            :  * @flags: flags for the property specified
    2087                 :            :  *
    2088                 :            :  * Creates a new #GParamSpecULong instance specifying a %G_TYPE_ULONG
    2089                 :            :  * property.
    2090                 :            :  *
    2091                 :            :  * See g_param_spec_internal() for details on property names.
    2092                 :            :  *
    2093                 :            :  * Returns: (transfer full): a newly created parameter specification
    2094                 :            :  */
    2095                 :            : GParamSpec*
    2096                 :         27 : g_param_spec_ulong (const gchar *name,
    2097                 :            :                     const gchar *nick,
    2098                 :            :                     const gchar *blurb,
    2099                 :            :                     gulong       minimum,
    2100                 :            :                     gulong       maximum,
    2101                 :            :                     gulong       default_value,
    2102                 :            :                     GParamFlags  flags)
    2103                 :            : {
    2104                 :            :   GParamSpecULong *uspec;
    2105                 :            : 
    2106                 :         27 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2107                 :            : 
    2108                 :         27 :   uspec = g_param_spec_internal (G_TYPE_PARAM_ULONG,
    2109                 :            :                                  name,
    2110                 :            :                                  nick,
    2111                 :            :                                  blurb,
    2112                 :            :                                  flags);
    2113                 :            :   
    2114                 :         27 :   uspec->minimum = minimum;
    2115                 :         27 :   uspec->maximum = maximum;
    2116                 :         27 :   uspec->default_value = default_value;
    2117                 :            :   
    2118                 :         27 :   return G_PARAM_SPEC (uspec);
    2119                 :            : }
    2120                 :            : 
    2121                 :            : /**
    2122                 :            :  * g_param_spec_int64:
    2123                 :            :  * @name: canonical name of the property specified
    2124                 :            :  * @nick: (nullable): nick name for the property specified
    2125                 :            :  * @blurb: (nullable): description of the property specified
    2126                 :            :  * @minimum: minimum value for the property specified
    2127                 :            :  * @maximum: maximum value for the property specified
    2128                 :            :  * @default_value: default value for the property specified
    2129                 :            :  * @flags: flags for the property specified
    2130                 :            :  *
    2131                 :            :  * Creates a new #GParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
    2132                 :            :  *
    2133                 :            :  * See g_param_spec_internal() for details on property names.
    2134                 :            :  *
    2135                 :            :  * Returns: (transfer full): a newly created parameter specification
    2136                 :            :  */
    2137                 :            : GParamSpec*
    2138                 :          8 : g_param_spec_int64 (const gchar *name,
    2139                 :            :                     const gchar *nick,
    2140                 :            :                     const gchar *blurb,
    2141                 :            :                     gint64       minimum,
    2142                 :            :                     gint64       maximum,
    2143                 :            :                     gint64       default_value,
    2144                 :            :                     GParamFlags  flags)
    2145                 :            : {
    2146                 :            :   GParamSpecInt64 *lspec;
    2147                 :            :   
    2148                 :          8 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2149                 :            : 
    2150                 :          8 :   lspec = g_param_spec_internal (G_TYPE_PARAM_INT64,
    2151                 :            :                                  name,
    2152                 :            :                                  nick,
    2153                 :            :                                  blurb,
    2154                 :            :                                  flags);
    2155                 :            :   
    2156                 :          8 :   lspec->minimum = minimum;
    2157                 :          8 :   lspec->maximum = maximum;
    2158                 :          8 :   lspec->default_value = default_value;
    2159                 :            :   
    2160                 :          8 :   return G_PARAM_SPEC (lspec);
    2161                 :            : }
    2162                 :            : 
    2163                 :            : /**
    2164                 :            :  * g_param_spec_uint64:
    2165                 :            :  * @name: canonical name of the property specified
    2166                 :            :  * @nick: (nullable): nick name for the property specified
    2167                 :            :  * @blurb: (nullable): description of the property specified
    2168                 :            :  * @minimum: minimum value for the property specified
    2169                 :            :  * @maximum: maximum value for the property specified
    2170                 :            :  * @default_value: default value for the property specified
    2171                 :            :  * @flags: flags for the property specified
    2172                 :            :  *
    2173                 :            :  * Creates a new #GParamSpecUInt64 instance specifying a %G_TYPE_UINT64
    2174                 :            :  * property.
    2175                 :            :  *
    2176                 :            :  * See g_param_spec_internal() for details on property names.
    2177                 :            :  *
    2178                 :            :  * Returns: (transfer full): a newly created parameter specification
    2179                 :            :  */
    2180                 :            : GParamSpec*
    2181                 :          8 : g_param_spec_uint64 (const gchar *name,
    2182                 :            :                      const gchar *nick,
    2183                 :            :                      const gchar *blurb,
    2184                 :            :                      guint64      minimum,
    2185                 :            :                      guint64      maximum,
    2186                 :            :                      guint64      default_value,
    2187                 :            :                      GParamFlags  flags)
    2188                 :            : {
    2189                 :            :   GParamSpecUInt64 *uspec;
    2190                 :            :   
    2191                 :          8 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2192                 :            :   
    2193                 :          8 :   uspec = g_param_spec_internal (G_TYPE_PARAM_UINT64,
    2194                 :            :                                  name,
    2195                 :            :                                  nick,
    2196                 :            :                                  blurb,
    2197                 :            :                                  flags);
    2198                 :            :   
    2199                 :          8 :   uspec->minimum = minimum;
    2200                 :          8 :   uspec->maximum = maximum;
    2201                 :          8 :   uspec->default_value = default_value;
    2202                 :            :   
    2203                 :          8 :   return G_PARAM_SPEC (uspec);
    2204                 :            : }
    2205                 :            : 
    2206                 :            : /**
    2207                 :            :  * g_param_spec_unichar:
    2208                 :            :  * @name: canonical name of the property specified
    2209                 :            :  * @nick: (nullable): nick name for the property specified
    2210                 :            :  * @blurb: (nullable): description of the property specified
    2211                 :            :  * @default_value: default value for the property specified
    2212                 :            :  * @flags: flags for the property specified
    2213                 :            :  *
    2214                 :            :  * Creates a new #GParamSpecUnichar instance specifying a %G_TYPE_UINT
    2215                 :            :  * property. #GValue structures for this property can be accessed with
    2216                 :            :  * g_value_set_uint() and g_value_get_uint().
    2217                 :            :  *
    2218                 :            :  * See g_param_spec_internal() for details on property names.
    2219                 :            :  *
    2220                 :            :  * Returns: (transfer full): a newly created parameter specification
    2221                 :            :  */
    2222                 :            : GParamSpec*
    2223                 :          1 : g_param_spec_unichar (const gchar *name,
    2224                 :            :                       const gchar *nick,
    2225                 :            :                       const gchar *blurb,
    2226                 :            :                       gunichar     default_value,
    2227                 :            :                       GParamFlags  flags)
    2228                 :            : {
    2229                 :            :   GParamSpecUnichar *uspec;
    2230                 :            : 
    2231                 :          1 :   uspec = g_param_spec_internal (G_TYPE_PARAM_UNICHAR,
    2232                 :            :                                  name,
    2233                 :            :                                  nick,
    2234                 :            :                                  blurb,
    2235                 :            :                                  flags);
    2236                 :            :   
    2237                 :          1 :   uspec->default_value = default_value;
    2238                 :            :   
    2239                 :          1 :   return G_PARAM_SPEC (uspec);
    2240                 :            : }
    2241                 :            : 
    2242                 :            : /**
    2243                 :            :  * g_param_spec_enum:
    2244                 :            :  * @name: canonical name of the property specified
    2245                 :            :  * @nick: (nullable): nick name for the property specified
    2246                 :            :  * @blurb: (nullable): description of the property specified
    2247                 :            :  * @enum_type: a #GType derived from %G_TYPE_ENUM
    2248                 :            :  * @default_value: default value for the property specified
    2249                 :            :  * @flags: flags for the property specified
    2250                 :            :  *
    2251                 :            :  * Creates a new #GParamSpecEnum instance specifying a %G_TYPE_ENUM
    2252                 :            :  * property.
    2253                 :            :  *
    2254                 :            :  * See g_param_spec_internal() for details on property names.
    2255                 :            :  *
    2256                 :            :  * Returns: (transfer full): a newly created parameter specification
    2257                 :            :  */
    2258                 :            : GParamSpec*
    2259                 :       1575 : g_param_spec_enum (const gchar *name,
    2260                 :            :                    const gchar *nick,
    2261                 :            :                    const gchar *blurb,
    2262                 :            :                    GType        enum_type,
    2263                 :            :                    gint         default_value,
    2264                 :            :                    GParamFlags  flags)
    2265                 :            : {
    2266                 :            :   GParamSpecEnum *espec;
    2267                 :            :   GEnumClass *enum_class;
    2268                 :            :   
    2269                 :       1575 :   g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
    2270                 :            : 
    2271                 :       1575 :   enum_class = g_type_class_ref (enum_type);
    2272                 :            : 
    2273                 :       1575 :   g_return_val_if_fail (g_enum_get_value (enum_class, default_value) != NULL, NULL);
    2274                 :            :   
    2275                 :       1575 :   espec = g_param_spec_internal (G_TYPE_PARAM_ENUM,
    2276                 :            :                                  name,
    2277                 :            :                                  nick,
    2278                 :            :                                  blurb,
    2279                 :            :                                  flags);
    2280                 :            : 
    2281                 :       1575 :   espec->enum_class = enum_class;
    2282                 :       1575 :   espec->default_value = default_value;
    2283                 :       1575 :   G_PARAM_SPEC (espec)->value_type = enum_type;
    2284                 :            :   
    2285                 :       1575 :   return G_PARAM_SPEC (espec);
    2286                 :            : }
    2287                 :            : 
    2288                 :            : /**
    2289                 :            :  * g_param_spec_flags:
    2290                 :            :  * @name: canonical name of the property specified
    2291                 :            :  * @nick: (nullable): nick name for the property specified
    2292                 :            :  * @blurb: (nullable): description of the property specified
    2293                 :            :  * @flags_type: a #GType derived from %G_TYPE_FLAGS
    2294                 :            :  * @default_value: default value for the property specified
    2295                 :            :  * @flags: flags for the property specified
    2296                 :            :  *
    2297                 :            :  * Creates a new #GParamSpecFlags instance specifying a %G_TYPE_FLAGS
    2298                 :            :  * property.
    2299                 :            :  *
    2300                 :            :  * See g_param_spec_internal() for details on property names.
    2301                 :            :  *
    2302                 :            :  * Returns: (transfer full): a newly created parameter specification
    2303                 :            :  */
    2304                 :            : GParamSpec*
    2305                 :        591 : g_param_spec_flags (const gchar *name,
    2306                 :            :                     const gchar *nick,
    2307                 :            :                     const gchar *blurb,
    2308                 :            :                     GType        flags_type,
    2309                 :            :                     guint        default_value,
    2310                 :            :                     GParamFlags  flags)
    2311                 :            : {
    2312                 :            :   GParamSpecFlags *fspec;
    2313                 :            :   GFlagsClass *flags_class;
    2314                 :            :   
    2315                 :        591 :   g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL);
    2316                 :            : 
    2317                 :        591 :   flags_class = g_type_class_ref (flags_type);
    2318                 :            : 
    2319                 :        591 :   g_return_val_if_fail ((default_value & flags_class->mask) == default_value, NULL);
    2320                 :            :   
    2321                 :        591 :   fspec = g_param_spec_internal (G_TYPE_PARAM_FLAGS,
    2322                 :            :                                  name,
    2323                 :            :                                  nick,
    2324                 :            :                                  blurb,
    2325                 :            :                                  flags);
    2326                 :            :   
    2327                 :        591 :   fspec->flags_class = flags_class;
    2328                 :        591 :   fspec->default_value = default_value;
    2329                 :        591 :   G_PARAM_SPEC (fspec)->value_type = flags_type;
    2330                 :            :   
    2331                 :        591 :   return G_PARAM_SPEC (fspec);
    2332                 :            : }
    2333                 :            : 
    2334                 :            : /**
    2335                 :            :  * g_param_spec_float:
    2336                 :            :  * @name: canonical name of the property specified
    2337                 :            :  * @nick: (nullable): nick name for the property specified
    2338                 :            :  * @blurb: (nullable): description of the property specified
    2339                 :            :  * @minimum: minimum value for the property specified
    2340                 :            :  * @maximum: maximum value for the property specified
    2341                 :            :  * @default_value: default value for the property specified
    2342                 :            :  * @flags: flags for the property specified
    2343                 :            :  *
    2344                 :            :  * Creates a new #GParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
    2345                 :            :  *
    2346                 :            :  * See g_param_spec_internal() for details on property names.
    2347                 :            :  *
    2348                 :            :  * Returns: (transfer full): a newly created parameter specification
    2349                 :            :  */
    2350                 :            : GParamSpec*
    2351                 :          1 : g_param_spec_float (const gchar *name,
    2352                 :            :                     const gchar *nick,
    2353                 :            :                     const gchar *blurb,
    2354                 :            :                     gfloat       minimum,
    2355                 :            :                     gfloat       maximum,
    2356                 :            :                     gfloat       default_value,
    2357                 :            :                     GParamFlags  flags)
    2358                 :            : {
    2359                 :            :   GParamSpecFloat *fspec;
    2360                 :            : 
    2361                 :          1 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2362                 :            : 
    2363                 :          1 :   fspec = g_param_spec_internal (G_TYPE_PARAM_FLOAT,
    2364                 :            :                                  name,
    2365                 :            :                                  nick,
    2366                 :            :                                  blurb,
    2367                 :            :                                  flags);
    2368                 :            :   
    2369                 :          1 :   fspec->minimum = minimum;
    2370                 :          1 :   fspec->maximum = maximum;
    2371                 :          1 :   fspec->default_value = default_value;
    2372                 :            :   
    2373                 :          1 :   return G_PARAM_SPEC (fspec);
    2374                 :            : }
    2375                 :            : 
    2376                 :            : /**
    2377                 :            :  * g_param_spec_double:
    2378                 :            :  * @name: canonical name of the property specified
    2379                 :            :  * @nick: (nullable): nick name for the property specified
    2380                 :            :  * @blurb: (nullable): description of the property specified
    2381                 :            :  * @minimum: minimum value for the property specified
    2382                 :            :  * @maximum: maximum value for the property specified
    2383                 :            :  * @default_value: default value for the property specified
    2384                 :            :  * @flags: flags for the property specified
    2385                 :            :  *
    2386                 :            :  * Creates a new #GParamSpecDouble instance specifying a %G_TYPE_DOUBLE
    2387                 :            :  * property.
    2388                 :            :  *
    2389                 :            :  * See g_param_spec_internal() for details on property names.
    2390                 :            :  *
    2391                 :            :  * Returns: (transfer full): a newly created parameter specification
    2392                 :            :  */
    2393                 :            : GParamSpec*
    2394                 :         15 : g_param_spec_double (const gchar *name,
    2395                 :            :                      const gchar *nick,
    2396                 :            :                      const gchar *blurb,
    2397                 :            :                      gdouble      minimum,
    2398                 :            :                      gdouble      maximum,
    2399                 :            :                      gdouble      default_value,
    2400                 :            :                      GParamFlags  flags)
    2401                 :            : {
    2402                 :            :   GParamSpecDouble *dspec;
    2403                 :            : 
    2404                 :         15 :   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
    2405                 :            : 
    2406                 :         15 :   dspec = g_param_spec_internal (G_TYPE_PARAM_DOUBLE,
    2407                 :            :                                  name,
    2408                 :            :                                  nick,
    2409                 :            :                                  blurb,
    2410                 :            :                                  flags);
    2411                 :            :   
    2412                 :         15 :   dspec->minimum = minimum;
    2413                 :         15 :   dspec->maximum = maximum;
    2414                 :         15 :   dspec->default_value = default_value;
    2415                 :            :   
    2416                 :         15 :   return G_PARAM_SPEC (dspec);
    2417                 :            : }
    2418                 :            : 
    2419                 :            : /**
    2420                 :            :  * g_param_spec_string:
    2421                 :            :  * @name: canonical name of the property specified
    2422                 :            :  * @nick: (nullable): nick name for the property specified
    2423                 :            :  * @blurb: (nullable): description of the property specified
    2424                 :            :  * @default_value: (nullable): default value for the property specified
    2425                 :            :  * @flags: flags for the property specified
    2426                 :            :  *
    2427                 :            :  * Creates a new #GParamSpecString instance.
    2428                 :            :  *
    2429                 :            :  * See g_param_spec_internal() for details on property names.
    2430                 :            :  *
    2431                 :            :  * Returns: (transfer full): a newly created parameter specification
    2432                 :            :  */
    2433                 :            : GParamSpec*
    2434                 :       1337 : g_param_spec_string (const gchar *name,
    2435                 :            :                      const gchar *nick,
    2436                 :            :                      const gchar *blurb,
    2437                 :            :                      const gchar *default_value,
    2438                 :            :                      GParamFlags  flags)
    2439                 :            : {
    2440                 :       1337 :   GParamSpecString *sspec = g_param_spec_internal (G_TYPE_PARAM_STRING,
    2441                 :            :                                                    name,
    2442                 :            :                                                    nick,
    2443                 :            :                                                    blurb,
    2444                 :            :                                                    flags);
    2445                 :            : 
    2446                 :       1337 :   g_free (sspec->default_value);
    2447                 :       1337 :   sspec->default_value = g_strdup (default_value);
    2448                 :            :   
    2449                 :       1337 :   return G_PARAM_SPEC (sspec);
    2450                 :            : }
    2451                 :            : 
    2452                 :            : /**
    2453                 :            :  * g_param_spec_param:
    2454                 :            :  * @name: canonical name of the property specified
    2455                 :            :  * @nick: (nullable): nick name for the property specified
    2456                 :            :  * @blurb: (nullable): description of the property specified
    2457                 :            :  * @param_type: a #GType derived from %G_TYPE_PARAM
    2458                 :            :  * @flags: flags for the property specified
    2459                 :            :  *
    2460                 :            :  * Creates a new #GParamSpecParam instance specifying a %G_TYPE_PARAM
    2461                 :            :  * property.
    2462                 :            :  *
    2463                 :            :  * See g_param_spec_internal() for details on property names.
    2464                 :            :  *
    2465                 :            :  * Returns: (transfer full): a newly created parameter specification
    2466                 :            :  */
    2467                 :            : GParamSpec*
    2468                 :          2 : g_param_spec_param (const gchar *name,
    2469                 :            :                     const gchar *nick,
    2470                 :            :                     const gchar *blurb,
    2471                 :            :                     GType        param_type,
    2472                 :            :                     GParamFlags  flags)
    2473                 :            : {
    2474                 :            :   GParamSpecParam *pspec;
    2475                 :            :   
    2476                 :          2 :   g_return_val_if_fail (G_TYPE_IS_PARAM (param_type), NULL);
    2477                 :            :   
    2478                 :          2 :   pspec = g_param_spec_internal (G_TYPE_PARAM_PARAM,
    2479                 :            :                                  name,
    2480                 :            :                                  nick,
    2481                 :            :                                  blurb,
    2482                 :            :                                  flags);
    2483                 :            : 
    2484                 :          2 :   G_PARAM_SPEC (pspec)->value_type = param_type;
    2485                 :            :   
    2486                 :          2 :   return G_PARAM_SPEC (pspec);
    2487                 :            : }
    2488                 :            : 
    2489                 :            : /**
    2490                 :            :  * g_param_spec_boxed:
    2491                 :            :  * @name: canonical name of the property specified
    2492                 :            :  * @nick: (nullable): nick name for the property specified
    2493                 :            :  * @blurb: (nullable): description of the property specified
    2494                 :            :  * @boxed_type: %G_TYPE_BOXED derived type of this property
    2495                 :            :  * @flags: flags for the property specified
    2496                 :            :  *
    2497                 :            :  * Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_BOXED
    2498                 :            :  * derived property.
    2499                 :            :  *
    2500                 :            :  * See g_param_spec_internal() for details on property names.
    2501                 :            :  *
    2502                 :            :  * Returns: (transfer full): a newly created parameter specification
    2503                 :            :  */
    2504                 :            : GParamSpec*
    2505                 :        363 : g_param_spec_boxed (const gchar *name,
    2506                 :            :                     const gchar *nick,
    2507                 :            :                     const gchar *blurb,
    2508                 :            :                     GType        boxed_type,
    2509                 :            :                     GParamFlags  flags)
    2510                 :            : {
    2511                 :            :   GParamSpecBoxed *bspec;
    2512                 :            :   
    2513                 :        363 :   g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
    2514                 :        363 :   g_return_val_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type), NULL);
    2515                 :            :   
    2516                 :        363 :   bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
    2517                 :            :                                  name,
    2518                 :            :                                  nick,
    2519                 :            :                                  blurb,
    2520                 :            :                                  flags);
    2521                 :            : 
    2522                 :        363 :   G_PARAM_SPEC (bspec)->value_type = boxed_type;
    2523                 :            :   
    2524                 :        363 :   return G_PARAM_SPEC (bspec);
    2525                 :            : }
    2526                 :            : 
    2527                 :            : /**
    2528                 :            :  * g_param_spec_pointer:
    2529                 :            :  * @name: canonical name of the property specified
    2530                 :            :  * @nick: (nullable): nick name for the property specified
    2531                 :            :  * @blurb: (nullable): description of the property specified
    2532                 :            :  * @flags: flags for the property specified
    2533                 :            :  *
    2534                 :            :  * Creates a new #GParamSpecPointer instance specifying a pointer property.
    2535                 :            :  * Where possible, it is better to use g_param_spec_object() or
    2536                 :            :  * g_param_spec_boxed() to expose memory management information.
    2537                 :            :  *
    2538                 :            :  * See g_param_spec_internal() for details on property names.
    2539                 :            :  *
    2540                 :            :  * Returns: (transfer full): a newly created parameter specification
    2541                 :            :  */
    2542                 :            : GParamSpec*
    2543                 :         94 : g_param_spec_pointer (const gchar *name,
    2544                 :            :                       const gchar *nick,
    2545                 :            :                       const gchar *blurb,
    2546                 :            :                       GParamFlags  flags)
    2547                 :            : {
    2548                 :            :   GParamSpecPointer *pspec;
    2549                 :            :   
    2550                 :         94 :   pspec = g_param_spec_internal (G_TYPE_PARAM_POINTER,
    2551                 :            :                                  name,
    2552                 :            :                                  nick,
    2553                 :            :                                  blurb,
    2554                 :            :                                  flags);
    2555                 :            : 
    2556                 :         94 :   return G_PARAM_SPEC (pspec);
    2557                 :            : }
    2558                 :            : 
    2559                 :            : /**
    2560                 :            :  * g_param_spec_gtype:
    2561                 :            :  * @name: canonical name of the property specified
    2562                 :            :  * @nick: (nullable): nick name for the property specified
    2563                 :            :  * @blurb: (nullable): description of the property specified
    2564                 :            :  * @is_a_type: a #GType whose subtypes are allowed as values
    2565                 :            :  *  of the property (use %G_TYPE_NONE for any type)
    2566                 :            :  * @flags: flags for the property specified
    2567                 :            :  *
    2568                 :            :  * Creates a new #GParamSpecGType instance specifying a
    2569                 :            :  * %G_TYPE_GTYPE property.
    2570                 :            :  *
    2571                 :            :  * See g_param_spec_internal() for details on property names.
    2572                 :            :  *
    2573                 :            :  * Since: 2.10
    2574                 :            :  *
    2575                 :            :  * Returns: (transfer full): a newly created parameter specification
    2576                 :            :  */
    2577                 :            : GParamSpec*
    2578                 :          8 : g_param_spec_gtype (const gchar *name,
    2579                 :            :                     const gchar *nick,
    2580                 :            :                     const gchar *blurb,
    2581                 :            :                     GType        is_a_type,
    2582                 :            :                     GParamFlags  flags)
    2583                 :            : {
    2584                 :            :   GParamSpecGType *tspec;
    2585                 :            :   
    2586                 :          8 :   tspec = g_param_spec_internal (G_TYPE_PARAM_GTYPE,
    2587                 :            :                                  name,
    2588                 :            :                                  nick,
    2589                 :            :                                  blurb,
    2590                 :            :                                  flags);
    2591                 :            : 
    2592                 :          8 :   tspec->is_a_type = is_a_type;
    2593                 :            : 
    2594                 :          8 :   return G_PARAM_SPEC (tspec);
    2595                 :            : }
    2596                 :            : 
    2597                 :            : /**
    2598                 :            :  * g_param_spec_value_array: (skip)
    2599                 :            :  * @name: canonical name of the property specified
    2600                 :            :  * @nick: (nullable): nick name for the property specified
    2601                 :            :  * @blurb: (nullable): description of the property specified
    2602                 :            :  * @element_spec: a #GParamSpec describing the elements contained in
    2603                 :            :  *  arrays of this property, may be %NULL
    2604                 :            :  * @flags: flags for the property specified
    2605                 :            :  *
    2606                 :            :  * Creates a new #GParamSpecValueArray instance specifying a
    2607                 :            :  * %G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
    2608                 :            :  * %G_TYPE_BOXED type, as such, #GValue structures for this property
    2609                 :            :  * can be accessed with g_value_set_boxed() and g_value_get_boxed().
    2610                 :            :  *
    2611                 :            :  * See g_param_spec_internal() for details on property names.
    2612                 :            :  *
    2613                 :            :  * Returns: a newly created parameter specification
    2614                 :            :  */
    2615                 :            : GParamSpec*
    2616                 :          0 : g_param_spec_value_array (const gchar *name,
    2617                 :            :                           const gchar *nick,
    2618                 :            :                           const gchar *blurb,
    2619                 :            :                           GParamSpec  *element_spec,
    2620                 :            :                           GParamFlags  flags)
    2621                 :            : {
    2622                 :            :   GParamSpecValueArray *aspec;
    2623                 :            :   
    2624                 :          0 :   g_return_val_if_fail (element_spec == NULL || G_IS_PARAM_SPEC (element_spec), NULL);
    2625                 :            :   
    2626                 :          0 :   aspec = g_param_spec_internal (G_TYPE_PARAM_VALUE_ARRAY,
    2627                 :            :                                  name,
    2628                 :            :                                  nick,
    2629                 :            :                                  blurb,
    2630                 :            :                                  flags);
    2631                 :            : 
    2632         [ #  # ]:          0 :   if (element_spec)
    2633                 :            :     {
    2634                 :          0 :       aspec->element_spec = g_param_spec_ref (element_spec);
    2635                 :          0 :       g_param_spec_sink (element_spec);
    2636                 :            :     }
    2637                 :            : 
    2638                 :          0 :   return G_PARAM_SPEC (aspec);
    2639                 :            : }
    2640                 :            : 
    2641                 :            : /**
    2642                 :            :  * g_param_spec_object:
    2643                 :            :  * @name: canonical name of the property specified
    2644                 :            :  * @nick: (nullable): nick name for the property specified
    2645                 :            :  * @blurb: (nullable): description of the property specified
    2646                 :            :  * @object_type: %G_TYPE_OBJECT derived type of this property
    2647                 :            :  * @flags: flags for the property specified
    2648                 :            :  *
    2649                 :            :  * Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_OBJECT
    2650                 :            :  * derived property.
    2651                 :            :  *
    2652                 :            :  * See g_param_spec_internal() for details on property names.
    2653                 :            :  *
    2654                 :            :  * Returns: (transfer full): a newly created parameter specification
    2655                 :            :  */
    2656                 :            : GParamSpec*
    2657                 :       2315 : g_param_spec_object (const gchar *name,
    2658                 :            :                      const gchar *nick,
    2659                 :            :                      const gchar *blurb,
    2660                 :            :                      GType        object_type,
    2661                 :            :                      GParamFlags  flags)
    2662                 :            : {
    2663                 :            :   GParamSpecObject *ospec;
    2664                 :            :   
    2665                 :       2315 :   g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_OBJECT), NULL);
    2666                 :            :   
    2667                 :       2315 :   ospec = g_param_spec_internal (G_TYPE_PARAM_OBJECT,
    2668                 :            :                                  name,
    2669                 :            :                                  nick,
    2670                 :            :                                  blurb,
    2671                 :            :                                  flags);
    2672                 :            : 
    2673                 :       2315 :   G_PARAM_SPEC (ospec)->value_type = object_type;
    2674                 :            :   
    2675                 :       2315 :   return G_PARAM_SPEC (ospec);
    2676                 :            : }
    2677                 :            : 
    2678                 :            : /**
    2679                 :            :  * g_param_spec_override: (skip)
    2680                 :            :  * @name: the name of the property.
    2681                 :            :  * @overridden: The property that is being overridden
    2682                 :            :  *
    2683                 :            :  * Creates a new property of type #GParamSpecOverride. This is used
    2684                 :            :  * to direct operations to another paramspec, and will not be directly
    2685                 :            :  * useful unless you are implementing a new base type similar to GObject.
    2686                 :            :  *
    2687                 :            :  * Since: 2.4
    2688                 :            :  *
    2689                 :            :  * Returns: the newly created #GParamSpec
    2690                 :            :  */
    2691                 :            : GParamSpec*
    2692                 :        645 : g_param_spec_override (const gchar *name,
    2693                 :            :                        GParamSpec  *overridden)
    2694                 :            : {
    2695                 :            :   GParamSpec *pspec;
    2696                 :            :   
    2697                 :        645 :   g_return_val_if_fail (name != NULL, NULL);
    2698                 :        645 :   g_return_val_if_fail (G_IS_PARAM_SPEC (overridden), NULL);
    2699                 :            :   
    2700                 :            :   /* Dereference further redirections for property that was passed in
    2701                 :            :    */
    2702                 :            :   while (TRUE)
    2703                 :        127 :     {
    2704                 :        772 :       GParamSpec *indirect = g_param_spec_get_redirect_target (overridden);
    2705         [ +  + ]:        772 :       if (indirect)
    2706                 :        127 :         overridden = indirect;
    2707                 :            :       else
    2708                 :        645 :         break;
    2709                 :            :     }
    2710                 :            : 
    2711                 :        645 :   pspec = g_param_spec_internal (G_TYPE_PARAM_OVERRIDE,
    2712                 :            :                                  name, NULL, NULL,
    2713                 :            :                                  overridden->flags);
    2714                 :            :   
    2715                 :        645 :   pspec->value_type = G_PARAM_SPEC_VALUE_TYPE (overridden);
    2716                 :        645 :   G_PARAM_SPEC_OVERRIDE (pspec)->overridden = g_param_spec_ref (overridden);
    2717                 :            : 
    2718                 :        645 :   return pspec;
    2719                 :            : }
    2720                 :            : 
    2721                 :            : /**
    2722                 :            :  * g_param_spec_variant:
    2723                 :            :  * @name: canonical name of the property specified
    2724                 :            :  * @nick: (nullable): nick name for the property specified
    2725                 :            :  * @blurb: (nullable): description of the property specified
    2726                 :            :  * @type: a #GVariantType
    2727                 :            :  * @default_value: (nullable) (transfer full): a #GVariant of type @type to
    2728                 :            :  *                 use as the default value, or %NULL
    2729                 :            :  * @flags: flags for the property specified
    2730                 :            :  *
    2731                 :            :  * Creates a new #GParamSpecVariant instance specifying a #GVariant
    2732                 :            :  * property.
    2733                 :            :  *
    2734                 :            :  * If @default_value is floating, it is consumed.
    2735                 :            :  *
    2736                 :            :  * See g_param_spec_internal() for details on property names.
    2737                 :            :  *
    2738                 :            :  * Returns: (transfer full): the newly created #GParamSpec
    2739                 :            :  *
    2740                 :            :  * Since: 2.26
    2741                 :            :  */
    2742                 :            : GParamSpec*
    2743                 :         63 : g_param_spec_variant (const gchar        *name,
    2744                 :            :                       const gchar        *nick,
    2745                 :            :                       const gchar        *blurb,
    2746                 :            :                       const GVariantType *type,
    2747                 :            :                       GVariant           *default_value,
    2748                 :            :                       GParamFlags         flags)
    2749                 :            : {
    2750                 :            :   GParamSpecVariant *vspec;
    2751                 :            : 
    2752                 :         63 :   g_return_val_if_fail (type != NULL, NULL);
    2753                 :         63 :   g_return_val_if_fail (default_value == NULL ||
    2754                 :            :                         g_variant_is_of_type (default_value, type), NULL);
    2755                 :            : 
    2756                 :         63 :   vspec = g_param_spec_internal (G_TYPE_PARAM_VARIANT,
    2757                 :            :                                  name,
    2758                 :            :                                  nick,
    2759                 :            :                                  blurb,
    2760                 :            :                                  flags);
    2761                 :            : 
    2762                 :         63 :   vspec->type = g_variant_type_copy (type);
    2763         [ +  + ]:         63 :   if (default_value)
    2764                 :          1 :     vspec->default_value = g_variant_ref_sink (default_value);
    2765                 :            : 
    2766                 :         63 :   return G_PARAM_SPEC (vspec);
    2767                 :            : }

Generated by: LCOV version 1.14