Re: [gnome-db] [PATCH] general patch for reduce compiler warning and some more



On Sun, 2004-08-22 at 17:32 +0200, Szalai Ferenc wrote:
> Hi,
> 
> Here is may patch which try reduce compiler warnings mainly and fix some 
> typo and add some new feature to code.
> (Yes I know that the compiler warnings are just warnings but not errors 
> but sometimes they can point to some mistake as well)
> 
> The patch containes append_row function implementation in postgres 
> provider and related functions as well.
> The patch containes my previous patch which fix missing clear of 
> GDA_VALUE_TYPE_TYPE case at clear_value function.
> 
> I hope it can help. Any comment are wellcome.
> 
sorry for the delay, but here are some comments:

> @@ -1084,11 +1084,11 @@
>  		}
>  
>  		g_module_symbol (handle, "plugin_get_name",
> -				 (gpointer *) &plugin_get_name);
> +				 (gpointer) &plugin_get_name);
>  		g_module_symbol (handle, "plugin_get_description",
> -				 (gpointer *) &plugin_get_description);
> +				 (gpointer) &plugin_get_description);
>  		g_module_symbol (handle, "plugin_get_connection_params",
> -				 (gpointer *) &plugin_get_cnc_params);
> +				 (gpointer) &plugin_get_cnc_params);
> 
this is wrong, the prototype for g_module_symbol is:
	gboolean    g_module_symbol                 (GModule *module,
                                             const gchar *symbol_name,
                                             gpointer *symbol);


> @@ -171,6 +171,8 @@
>  {
>         g_return_val_if_fail (GDA_IS_DATA_MODEL_ARRAY (model), FALSE);
>         g_return_val_if_fail (attrs != NULL, FALSE);
> +
> +       return TRUE;
>  }
>                                                                                
>  static gboolean
> @@ -178,12 +180,16 @@
>  {
>         g_return_val_if_fail (GDA_IS_DATA_MODEL_ARRAY (model), FALSE);
>         g_return_val_if_fail (attrs != NULL, FALSE);
> +
> +       return TRUE;
>  }
>                                                                                
>  static gboolean
>  gda_data_model_array_remove_column (GdaDataModel *model, gint col)
>  {
>         g_return_val_if_fail (GDA_IS_DATA_MODEL_ARRAY (model), FALSE);
> +
> +       return TRUE;
>  }
I changed these 3 to return FALSE instead, until they are implemented.

The changes in gda-row.c are incorrect, we shouldn't be using const there for the
arguments, but use as the rest of the GLib, GTK, libgda functions, which is
non-const.

> @@ -233,7 +233,7 @@
>   * and get the required data from the source data models.
>   */
>  void
> -gda_select_add_source (GdaSelect *sel, const gchar *name, GdaDataModel *source)
> +gda_select_add_source (GdaSelect *sel, const gchar *name, const GdaDataModel *source)
>  {
>         gpointer key, value;
>                                                                                
this is also wrong, no need to use const, since the data model is ref'ed in that
function.

> @@ -569,7 +573,7 @@
>   * information in @src.
>   */
>  GdaMoney*
> -gda_money_copy (GdaMoney *src)
> +gda_money_copy (const GdaMoney *src)
> ...
all this is again incorrect, we shouldn't be using const there, only in places where
it's strictly necessary.

The rest looks ok, and will be committed to CVS HEAD in a few minutes
-- 
Rodrigo Moya <rodrigo gnome-db org>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]