[libgda] Many small corrections and annotations reported by and for FlawFinder
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Many small corrections and annotations reported by and for FlawFinder
- Date: Wed, 20 Oct 2010 20:17:25 +0000 (UTC)
commit 8b19f90804ad3aaddbb06fa7920d96ad384fbd19
Author: Vivien Malerba <malerba gnome-db org>
Date: Wed Oct 20 22:16:29 2010 +0200
Many small corrections and annotations reported by and for FlawFinder
doc/C/tmpl/gda-xa-transaction.sgml | 1 +
libgda/binreloc/binreloc.c | 16 ++--
libgda/binreloc/gda-binreloc.c | 4 +-
libgda/dir-blob-op.c | 4 +-
libgda/gda-config.c | 4 +-
libgda/gda-connection.c | 22 ++--
libgda/gda-data-comparator.c | 4 +-
libgda/gda-data-handler.c | 46 ++++----
libgda/gda-data-meta-wrapper.c | 7 +-
libgda/gda-data-model-bdb.c | 2 +-
libgda/gda-data-model-dir.c | 4 +-
libgda/gda-data-model-import.c | 18 +++-
libgda/gda-data-model.c | 24 +++--
libgda/gda-data-proxy.c | 2 +-
libgda/gda-data-select.c | 12 ++-
libgda/gda-init.c | 2 +-
libgda/gda-meta-store.c | 10 +-
libgda/gda-server-operation.c | 8 +-
libgda/gda-tree.c | 4 +-
libgda/gda-util.c | 123 ++++++++++++++++------
libgda/gda-value.c | 57 ++++------
libgda/gda-xa-transaction.c | 57 +++++++----
libgda/gda-xa-transaction.h | 4 +-
libgda/handlers/gda-handler-numerical.c | 96 +++++++++++++----
libgda/handlers/gda-handler-time.c | 59 ++++++++---
libgda/providers-support/gda-pstmt.c | 2 +-
libgda/sqlite/gda-sqlite-recordset.c | 4 +-
libgda/sqlite/virtual/gda-vprovider-data-model.c | 2 +-
tools/browser/browser-window.c | 2 +-
tools/browser/data-manager/data-console.c | 2 +-
tools/browser/main.c | 2 +-
tools/browser/schema-browser/table-info.c | 2 +-
32 files changed, 384 insertions(+), 222 deletions(-)
---
diff --git a/doc/C/tmpl/gda-xa-transaction.sgml b/doc/C/tmpl/gda-xa-transaction.sgml
index 67f4cae..ea75a39 100644
--- a/doc/C/tmpl/gda-xa-transaction.sgml
+++ b/doc/C/tmpl/gda-xa-transaction.sgml
@@ -59,6 +59,7 @@ Distributed transaction manager
@GDA_XA_TRANSACTION_ALREADY_REGISTERED_ERROR:
@GDA_XA_TRANSACTION_DTP_NOT_SUPPORTED_ERROR:
+ GDA_XA_TRANSACTION_CONNECTION_BRANCH_LENGTH_ERROR:
<!-- ##### STRUCT GdaXaTransactionId ##### -->
<para>
diff --git a/libgda/binreloc/binreloc.c b/libgda/binreloc/binreloc.c
index f8a37d1..0151246 100644
--- a/libgda/binreloc/binreloc.c
+++ b/libgda/binreloc/binreloc.c
@@ -72,7 +72,7 @@ _br_find_exe (GbrInitError *error)
while (1) {
int i;
- size = readlink (path2, path, buf_size - 1);
+ size = readlink (path2, path, buf_size - 1); /* Flawfinder: ignore */
if (size == -1) {
/* Error. */
g_free (path2);
@@ -116,7 +116,7 @@ _br_find_exe (GbrInitError *error)
return NULL;
}
- f = fopen ("/proc/self/maps", "r");
+ f = fopen ("/proc/self/maps", "r"); /* Flawfinder: ignore */
if (f == NULL) {
g_free (line);
if (error)
@@ -187,12 +187,12 @@ _br_find_exe_for_symbol (
#define SIZE PATH_MAX + 100
FILE *f;
size_t address_string_len;
- char *address_string, line[SIZE], *found;
+ char *address_string, line[SIZE], *found; /* Flawfinder: ignore */
if (symbol == NULL)
return (char *) NULL;
- f = fopen ("/proc/self/maps", "r");
+ f = fopen ("/proc/self/maps", "r"); /* Flawfinder: ignore */
if (f == NULL)
return (char *) NULL;
@@ -252,13 +252,13 @@ _br_find_exe_for_symbol (
address_string = (char *) g_realloc (address_string, address_string_len);
}
- memcpy (address_string, "0x", 2);
- memcpy (address_string + 2, start_addr, len);
+ memcpy (address_string, "0x", 2); /* Flawfinder: ignore */
+ memcpy (address_string + 2, start_addr, len); /* Flawfinder: ignore */
address_string[2 + len] = '\0';
sscanf (address_string, "%p", &start_addr_p);
- memcpy (address_string, "0x", 2);
- memcpy (address_string + 2, end_addr, len);
+ memcpy (address_string, "0x", 2); /* Flawfinder: ignore */
+ memcpy (address_string + 2, end_addr, len); /* Flawfinder: ignore */
address_string[2 + len] = '\0';
sscanf (address_string, "%p", &end_addr_p);
diff --git a/libgda/binreloc/gda-binreloc.c b/libgda/binreloc/gda-binreloc.c
index 055746e..a64c43f 100644
--- a/libgda/binreloc/gda-binreloc.c
+++ b/libgda/binreloc/gda-binreloc.c
@@ -86,7 +86,7 @@ gda_gbr_get_file_path (GdaPrefixDir where, ...)
*/
#ifdef G_OS_WIN32
- wchar_t path[MAX_PATH];
+ wchar_t path[MAX_PATH]; /* Flawfinder: ignore */
gchar* p;
#endif
@@ -197,7 +197,7 @@ gda_gbr_get_file_path (GdaPrefixDir where, ...)
#define MAXLEN 500
ProcessSerialNumber myProcess;
FSRef bundleLocation;
- unsigned char bundlePath[MAXLEN];
+ unsigned char bundlePath[MAXLEN]; /* Flawfinder: ignore */
if ((GetCurrentProcess (&myProcess) == noErr) &&
(GetProcessBundleLocation (&myProcess, &bundleLocation) == noErr) &&
diff --git a/libgda/dir-blob-op.c b/libgda/dir-blob-op.c
index b8da5b0..6a67bf4 100644
--- a/libgda/dir-blob-op.c
+++ b/libgda/dir-blob-op.c
@@ -190,7 +190,7 @@ gda_dir_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset, glong size)
g_return_val_if_fail (blob, -1);
/* open file */
- file = fopen (dirop->priv->complete_filename, "r");
+ file = fopen (dirop->priv->complete_filename, "r"); /* Flawfinder: ignore */
if (!file)
return -1;
@@ -229,7 +229,7 @@ gda_dir_blob_op_write (GdaBlobOp *op, GdaBlob *blob, glong offset)
g_return_val_if_fail (blob, -1);
/* open file */
- file = fopen (dirop->priv->complete_filename, "w+");
+ file = fopen (dirop->priv->complete_filename, "w+"); /* Flawfinder: ignore */
if (!file)
return -1;
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index bd0b4d0..161417c 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -527,7 +527,7 @@ gda_config_constructor (GType type,
if (!g_file_test (confdir, G_FILE_TEST_EXISTS)) {
gchar *old_path;
- old_path = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".libgda", NULL);
+ old_path = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".libgda", NULL); /* Flawfinder: ignore */
if (g_file_test (old_path, G_FILE_TEST_EXISTS)) {
/* using $HOME/.libgda because it exists */
g_free (confdir);
@@ -616,7 +616,7 @@ gda_config_constructor (GType type,
unique_instance->priv->system_config_allowed = FALSE;
if (unique_instance->priv->system_file) {
FILE *file;
- file = fopen (unique_instance->priv->system_file, "a");
+ file = fopen (unique_instance->priv->system_file, "a"); /* Flawfinder: ignore */
if (file) {
unique_instance->priv->system_config_allowed = TRUE;
fclose (file);
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index ce16dab..ab2c05e 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -380,7 +380,7 @@ gda_connection_class_init (GdaConnectionClass *klass)
if (debug_level == -1) {
const gchar *str;
debug_level = 0;
- str = getenv ("GDA_CONNECTION_EVENTS_SHOW");
+ str = getenv ("GDA_CONNECTION_EVENTS_SHOW"); /* Flawfinder: ignore */
if (str) {
gchar **array;
guint i;
@@ -853,12 +853,13 @@ cnc_task_new (guint id, GdaStatement *stmt, GdaStatementModelUsage model_usage,
task->model_usage = model_usage;
if (col_types) {
gint i;
- for (i = 0; ; i++) {
+ for (i = 0; i < 32768; i++) {
if (col_types [i] == G_TYPE_NONE)
break;
}
- task->col_types = g_new (GType, i+1);
- memcpy (task->col_types, col_types, (i+1) * sizeof (GType));
+ i++;
+ task->col_types = g_new (GType, i);
+ memcpy (task->col_types, col_types, i * sizeof (GType)); /* Flawfinder: ignore */
}
if (params)
task->params = gda_set_copy (params);
@@ -1286,7 +1287,7 @@ gda_connection_open_sqlite (const gchar *directory, const gchar *filename, gbool
gint fd;
if (!directory)
- directory = g_get_tmp_dir();
+ directory = g_get_tmp_dir(); /* Flawfinder: ignore */
else
g_return_val_if_fail (*directory, NULL);
g_return_val_if_fail (filename && *filename, NULL);
@@ -1898,7 +1899,7 @@ gda_connection_add_event_string (GdaConnection *cnc, const gchar *str, ...)
/* build the message string */
va_start (args, str);
- vsprintf (sz, str, args);
+ g_vsnprintf (sz, 2048, str, args);
va_end (args);
error = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
@@ -4108,6 +4109,8 @@ suggest_update_cb_downstream (G_GNUC_UNUSED GdaMetaStore *store, GdaMetaContext
GdaMetaContext *templ_context;
GdaMetaContext loc_suggest;
+ gchar *column_names[MAX_CONTEXT_SIZE];
+ GValue *column_values[MAX_CONTEXT_SIZE];
/* if there is no context with the same table name in the templates, then exit right now */
templ_context = g_hash_table_lookup (data->context_templates_hash, suggest->table_name);
@@ -4116,9 +4119,6 @@ suggest_update_cb_downstream (G_GNUC_UNUSED GdaMetaStore *store, GdaMetaContext
if (templ_context->size > 0) {
/* setup @loc_suggest */
-
- gchar *column_names[MAX_CONTEXT_SIZE];
- GValue *column_values[MAX_CONTEXT_SIZE];
gint i, j;
if (suggest->size > MAX_CONTEXT_SIZE) {
@@ -4130,8 +4130,8 @@ suggest_update_cb_downstream (G_GNUC_UNUSED GdaMetaStore *store, GdaMetaContext
loc_suggest.table_name = suggest->table_name;
loc_suggest.column_names = column_names;
loc_suggest.column_values = column_values;
- memcpy (loc_suggest.column_names, suggest->column_names, sizeof (gchar *) * suggest->size);
- memcpy (loc_suggest.column_values, suggest->column_values, sizeof (GValue *) * suggest->size);
+ memcpy (loc_suggest.column_names, suggest->column_names, sizeof (gchar *) * suggest->size); /* Flawfinder: ignore */
+ memcpy (loc_suggest.column_values, suggest->column_values, sizeof (GValue *) * suggest->size); /* Flawfinder: ignore */
/* check that any @suggest's columns which is in @templ_context's has the same values */
for (j = 0; j < suggest->size; j++) {
diff --git a/libgda/gda-data-comparator.c b/libgda/gda-data-comparator.c
index 1c88cdb..7d3dc03 100644
--- a/libgda/gda-data-comparator.c
+++ b/libgda/gda-data-comparator.c
@@ -352,8 +352,8 @@ gda_data_comparator_set_key_columns (GdaDataComparator *comp, const gint *col_nu
comp->priv->key_columns = NULL;
if (nb_cols > 0) {
comp->priv->nb_key_columns = nb_cols;
- comp->priv->key_columns = g_new0 (gint, nb_cols);
- memcpy (comp->priv->key_columns, col_numbers, sizeof (gint) * nb_cols);
+ comp->priv->key_columns = g_new (gint, nb_cols);
+ memcpy (comp->priv->key_columns, col_numbers, sizeof (gint) * nb_cols); /* Flawfinder: ignore */
}
}
diff --git a/libgda/gda-data-handler.c b/libgda/gda-data-handler.c
index e68c013..585392e 100644
--- a/libgda/gda-data-handler.c
+++ b/libgda/gda-data-handler.c
@@ -1,6 +1,6 @@
/* gda-data-handler.c
*
- * Copyright (C) 2003 - 2006 Vivien Malerba
+ * Copyright (C) 2003 - 2010 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -66,7 +66,7 @@ gda_data_handler_iface_init (G_GNUC_UNUSED gpointer g_class)
}
/**
- * gda_data_handler_get_sql_from_value
+ * gda_data_handler_get_sql_from_value:
* @dh: an object which implements the #GdaDataHandler interface
* @value: the value to be converted to a string
*
@@ -78,7 +78,7 @@ gda_data_handler_iface_init (G_GNUC_UNUSED gpointer g_class)
*
* If the value is NULL or is of type GDA_TYPE_NULL, the returned string is "NULL".
*
- * Returns: the new string, or %NULL if an error occurred
+ * Returns: (transfer full): the new string, or %NULL if an error occurred
*/
gchar *
gda_data_handler_get_sql_from_value (GdaDataHandler *dh, const GValue *value)
@@ -96,7 +96,7 @@ gda_data_handler_get_sql_from_value (GdaDataHandler *dh, const GValue *value)
}
/**
- * gda_data_handler_get_str_from_value
+ * gda_data_handler_get_str_from_value:
* @dh: an object which implements the #GdaDataHandler interface
* @value: the value to be converted to a string
*
@@ -104,7 +104,7 @@ gda_data_handler_get_sql_from_value (GdaDataHandler *dh, const GValue *value)
* (in the user's locale, specially for the dates). If the value is
* NULL or is of type GDA_TYPE_NULL, the returned string is a copy of "" (empty string).
*
- * Returns: the new string, or %NULL if an error occurred
+ * Returns: (transfer full): the new string, or %NULL if an error occurred
*/
gchar *
gda_data_handler_get_str_from_value (GdaDataHandler *dh, const GValue *value)
@@ -122,7 +122,7 @@ gda_data_handler_get_str_from_value (GdaDataHandler *dh, const GValue *value)
}
/**
- * gda_data_handler_get_value_from_sql
+ * gda_data_handler_get_value_from_sql:
* @dh: an object which implements the #GdaDataHandler interface
* @sql: an SQL string
* @type: a GType
@@ -131,11 +131,11 @@ gda_data_handler_get_str_from_value (GdaDataHandler *dh, const GValue *value)
* the opposite of the function gda_data_handler_get_sql_from_value(). The type argument
* is used to determine the real data type requested for the returned value.
*
- * If the sql string is NULL, then the returned GValue is of type GDA_TYPE_NULL;
- * if the sql string does not correspond to a valid SQL string for the requested type, then
- * the "NULL" string is returned.
+ * If the @sql string is %NULL, then the returned GValue is of type GDA_TYPE_NULL;
+ * if the @sql string does not correspond to a valid SQL string for the requested type, then
+ * the %NULL is returned.
*
- * Returns: the new GValue or NULL on error
+ * Returns: (transfer full): the new #GValue or %NULL on error
*/
GValue *
gda_data_handler_get_value_from_sql (GdaDataHandler *dh, const gchar *sql, GType type)
@@ -154,20 +154,20 @@ gda_data_handler_get_value_from_sql (GdaDataHandler *dh, const gchar *sql, GType
/**
- * gda_data_handler_get_value_from_str
+ * gda_data_handler_get_value_from_str:
* @dh: an object which implements the #GdaDataHandler interface
* @str: a string
* @type: a GType
*
- * Creates a new GValue which represents the STR value given as argument. This is
+ * Creates a new GValue which represents the @str value given as argument. This is
* the opposite of the function gda_data_handler_get_str_from_value(). The type argument
* is used to determine the real data type requested for the returned value.
*
- * If the str string is NULL, then the returned GValue is of type GDA_TYPE_NULL;
- * if the str string does not correspond to a valid STR string for the requested type, then
- * NULL is returned.
+ * If the @str string is %NULL, then the returned GValue is of type GDA_TYPE_NULL;
+ * if the @str string does not correspond to a valid string for the requested type, then
+ * %NULL is returned.
*
- * Returns: the new GValue or NULL on error
+ * Returns: (transfer full): the new #GValue or %NULL on error
*/
GValue *
gda_data_handler_get_value_from_str (GdaDataHandler *dh, const gchar *str, GType type)
@@ -192,14 +192,14 @@ gda_data_handler_get_value_from_str (GdaDataHandler *dh, const gchar *str, GType
/**
- * gda_data_handler_get_sane_init_value
+ * gda_data_handler_get_sane_init_value:
* @dh: an object which implements the #GdaDataHandler interface
- * @type: a GTYpe
+ * @type: a #GType
*
* Creates a new GValue which holds a sane initial value to be used if no value is specifically
* provided. For example for a simple string, this would return a new value containing the "" string.
*
- * Returns: the new GValue, or %NULL if no such value can be created.
+ * Returns: (transfer full): the new #GValue, or %NULL if no such value can be created.
*/
GValue *
gda_data_handler_get_sane_init_value (GdaDataHandler *dh, GType type)
@@ -214,13 +214,13 @@ gda_data_handler_get_sane_init_value (GdaDataHandler *dh, GType type)
}
/**
- * gda_data_handler_accepts_g_type
+ * gda_data_handler_accepts_g_type:
* @dh: an object which implements the #GdaDataHandler interface
* @type: a #GType
*
* Checks wether the GdaDataHandler is able to handle the gda type given as argument.
*
- * Returns: TRUE if the gda type can be handled
+ * Returns: %TRUE if the gda type can be handled
*/
gboolean
gda_data_handler_accepts_g_type (GdaDataHandler *dh, GType type)
@@ -234,12 +234,12 @@ gda_data_handler_accepts_g_type (GdaDataHandler *dh, GType type)
}
/**
- * gda_data_handler_get_descr
+ * gda_data_handler_get_descr:
* @dh: an object which implements the #GdaDataHandler interface
*
* Get a short description of the GdaDataHandler
*
- * Returns: the description
+ * Returns: (transfer none): the description
*/
const gchar *
gda_data_handler_get_descr (GdaDataHandler *dh)
diff --git a/libgda/gda-data-meta-wrapper.c b/libgda/gda-data-meta-wrapper.c
index 7b55afb..02b9894 100644
--- a/libgda/gda-data-meta-wrapper.c
+++ b/libgda/gda-data-meta-wrapper.c
@@ -338,7 +338,8 @@ gda_data_meta_wrapper_get_property (GObject *object,
* Returns: a pointer to the newly created #GdaDataModel.
*/
GdaDataModel *
-_gda_data_meta_wrapper_new (GdaDataModel *model, gboolean reusable, gint *cols, gint size, GdaSqlIdentifierStyle mode,
+_gda_data_meta_wrapper_new (GdaDataModel *model, gboolean reusable, gint *cols,
+ gint size, GdaSqlIdentifierStyle mode,
GdaSqlReservedKeywordsFunc reserved_keyword_func)
{
GdaDataMetaWrapper *retmodel;
@@ -348,8 +349,8 @@ _gda_data_meta_wrapper_new (GdaDataModel *model, gboolean reusable, gint *cols,
retmodel = g_object_new (GDA_TYPE_DATA_META_WRAPPER,
"model", model, NULL);
- retmodel->priv->cols_to_wrap = g_new0 (gint, size);
- memcpy (retmodel->priv->cols_to_wrap, cols, sizeof (gint) * size);
+ retmodel->priv->cols_to_wrap = g_new (gint, size);
+ memcpy (retmodel->priv->cols_to_wrap, cols, sizeof (gint) * size); /* Flawfinder: ignore */
retmodel->priv->cols_to_wrap_size = size;
retmodel->priv->mode = mode;
retmodel->priv->reserved_keyword_func = reserved_keyword_func;
diff --git a/libgda/gda-data-model-bdb.c b/libgda/gda-data-model-bdb.c
index 3dd690d..4d8da52 100644
--- a/libgda/gda-data-model-bdb.c
+++ b/libgda/gda-data-model-bdb.c
@@ -373,7 +373,7 @@ gda_data_model_bdb_set_property (GObject *object,
}
model->priv->dbp = dbp;
- ret = dbp->open (dbp,
+ ret = dbp->open (dbp, /* Flawfinder: ignore */
#if BDB_VERSION >= 40124
NULL,
#endif
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index 309e237..6dd9f4b 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -504,7 +504,7 @@ update_file_md5sum (FileRow *row, const gchar *complete_filename)
length = g_value_get_uint (row->size_value);
if (length == 0)
goto md5end;
- fd = open (complete_filename, O_RDONLY);
+ fd = open (complete_filename, O_RDONLY); /* Flawfinder: ignore */
if (fd < 0)
goto md5end;
#ifndef G_OS_WIN32
@@ -529,7 +529,7 @@ update_file_md5sum (FileRow *row, const gchar *complete_filename)
/* MD5 computation */
MD5_CTX context;
- unsigned char digest[16];
+ unsigned char digest[16]; /* Flawfinder: ignore */
GString *md5str;
gint i;
diff --git a/libgda/gda-data-model-import.c b/libgda/gda-data-model-import.c
index acd875f..b913c22 100644
--- a/libgda/gda-data-model-import.c
+++ b/libgda/gda-data-model-import.c
@@ -500,7 +500,7 @@ gda_data_model_import_set_property (GObject *object,
model->priv->src.mapped.filename = g_strdup (g_value_get_string (value));
/* file opening */
- model->priv->src.mapped.fd = open (model->priv->src.mapped.filename, O_RDONLY);
+ model->priv->src.mapped.fd = open (model->priv->src.mapped.filename, O_RDONLY); /* Flawfinder: ignore */
if (model->priv->src.mapped.fd < 0) {
/* error */
add_error (model, strerror(errno));
@@ -1170,12 +1170,16 @@ init_xml_import (GdaDataModelImport *model)
}
str = (gchar*)xmlTextReaderGetAttribute (reader, (xmlChar*)"size");
if (str) {
- spec->size = atoi (str);
+ spec->size = atoi (str); /* Flawfinder: ignore */
+ if (spec->size < 0)
+ spec->size = 0;
xmlFree (str);
}
str = (gchar*)xmlTextReaderGetAttribute (reader, (xmlChar*)"scale");
if (str) {
- spec->scale = atoi (str);
+ spec->scale = atoi (str); /* Flawfinder: ignore */
+ if (spec->scale < 0)
+ spec->scale = 0;
xmlFree (str);
}
str = (gchar*)xmlTextReaderGetAttribute (reader, (xmlChar*)"pkey");
@@ -1488,12 +1492,16 @@ init_node_import (GdaDataModelImport *model)
}
str = (gchar*)xmlGetProp (cur, (xmlChar*)"size");
if (str) {
- spec->size = atoi (str);
+ spec->size = atoi (str); /* Flawfinder: ignore */
+ if (spec->size < 0)
+ spec->size = 0;
xmlFree (str);
}
str = (gchar*)xmlGetProp (cur, (xmlChar*)"scale");
if (str) {
- spec->scale = atoi (str);
+ spec->scale = atoi (str); /* Flawfinder: ignore */
+ if (spec->scale < 0)
+ spec->scale = 0;
xmlFree (str);
}
str = (gchar*)xmlGetProp (cur, (xmlChar*)"pkey");
diff --git a/libgda/gda-data-model.c b/libgda/gda-data-model.c
index 43b5b94..4e37536 100644
--- a/libgda/gda-data-model.c
+++ b/libgda/gda-data-model.c
@@ -1482,9 +1482,13 @@ find_column_from_id (GdaDataModel *model, const gchar *colid, gint *pos)
/* if no column has been found, assumr @colid is like "_%d" where %d is a column number */
if (!column && (*colid == '_')) {
- column = gda_data_model_describe_column (model, atoi (colid + 1));
- if (column)
- *pos = atoi (colid + 1);
+ gint i;
+ i = atoi (colid + 1); /* Flawfinder: ignore */
+ if (i >= 0) {
+ column = gda_data_model_describe_column (model, i);
+ if (column)
+ *pos = i;
+ }
}
return column;
@@ -2010,13 +2014,13 @@ gda_data_model_dump (GdaDataModel *model, FILE *to_stream)
if (!to_stream)
to_stream = stdout;
- if (getenv ("GDA_DATA_MODEL_DUMP_ATTRIBUTES"))
+ if (getenv ("GDA_DATA_MODEL_DUMP_ATTRIBUTES")) /* Flawfinder: ignore */
dump_attrs = TRUE;
- if (getenv ("GDA_DATA_MODEL_DUMP_ROW_NUMBERS"))
+ if (getenv ("GDA_DATA_MODEL_DUMP_ROW_NUMBERS")) /* Flawfinder: ignore */
dump_rows = TRUE;
- if (getenv ("GDA_DATA_MODEL_DUMP_TITLE"))
+ if (getenv ("GDA_DATA_MODEL_DUMP_TITLE")) /* Flawfinder: ignore */
dump_title = TRUE;
- if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY"))
+ if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY")) /* Flawfinder: ignore */
null_as_empty = TRUE;
str = real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty, &error);
@@ -2068,11 +2072,11 @@ gda_data_model_dump_as_string (GdaDataModel *model)
g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
- if (getenv ("GDA_DATA_MODEL_DUMP_ROW_NUMBERS"))
+ if (getenv ("GDA_DATA_MODEL_DUMP_ROW_NUMBERS")) /* Flawfinder: ignore */
dump_rows = TRUE;
- if (getenv ("GDA_DATA_MODEL_DUMP_TITLE"))
+ if (getenv ("GDA_DATA_MODEL_DUMP_TITLE")) /* Flawfinder: ignore */
dump_title = TRUE;
- if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY"))
+ if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY")) /* Flawfinder: ignore */
null_as_empty = TRUE;
return real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty, NULL);
diff --git a/libgda/gda-data-proxy.c b/libgda/gda-data-proxy.c
index d6a1a85..4b2b6ac 100644
--- a/libgda/gda-data-proxy.c
+++ b/libgda/gda-data-proxy.c
@@ -2883,7 +2883,7 @@ sql_where_foreach (GdaSqlAnyPart *part, GdaDataProxy *proxy, G_GNUC_UNUSED GErro
if (!*ptr) {
/* column name is "_<number>", use column: <number> - 1 */
gint colnum;
- colnum = atoi (cstr+1) - 1;
+ colnum = atoi (cstr+1) - 1; /* Flawfinder: ignore */
if (colnum >= 0) {
GdaColumn *col = gda_data_model_describe_column ((GdaDataModel*) proxy,
colnum);
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 2c591a3..2e7f7b9 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -1728,7 +1728,8 @@ gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **
GType *types = NULL;
if (imodel->prep_stmt && imodel->prep_stmt->types) {
types = g_new (GType, imodel->prep_stmt->ncols + 1);
- memcpy (types, imodel->prep_stmt->types, sizeof (GType) * imodel->prep_stmt->ncols);
+ memcpy (types, imodel->prep_stmt->types, /* Flawfinder: ignore */
+ sizeof (GType) * imodel->prep_stmt->ncols);
types [imodel->prep_stmt->ncols] = G_TYPE_NONE;
}
tmpmodel = gda_connection_statement_execute_select_full (imodel->priv->cnc,
@@ -3359,7 +3360,8 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
GType *types = NULL;
if (model->prep_stmt->types) {
types = g_new (GType, model->prep_stmt->ncols + 1);
- memcpy (types, model->prep_stmt->types, sizeof (GType) * model->prep_stmt->ncols);
+ memcpy (types, model->prep_stmt->types, /* Flawfinder: ignore */
+ sizeof (GType) * model->prep_stmt->ncols);
types [model->prep_stmt->ncols] = G_TYPE_NONE;
}
new_model = (GdaDataSelect*) gda_connection_statement_execute_select_full (model->priv->cnc, select,
@@ -3395,9 +3397,9 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
g_type_query (G_OBJECT_TYPE (model), &tq);
size = tq.instance_size - offset;
copy = g_malloc (size);
- memcpy (copy, (gint8*) new_model + offset, size);
- memcpy ((gint8*) new_model + offset, (gint8*) model + offset, size);
- memcpy ((gint8*) model + offset, copy, size);
+ memcpy (copy, (gint8*) new_model + offset, size); /* Flawfinder: ignore */
+ memcpy ((gint8*) new_model + offset, (gint8*) model + offset, size); /* Flawfinder: ignore */
+ memcpy ((gint8*) model + offset, copy, size); /* Flawfinder: ignore */
/* we need to keep some data from the old model */
GdaDataSelectInternals *mi;
diff --git a/libgda/gda-init.c b/libgda/gda-init.c
index 4f72c68..7c0516e 100644
--- a/libgda/gda-init.c
+++ b/libgda/gda-init.c
@@ -80,7 +80,7 @@ gda_init (void)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
/* Threading support if possible */
- if (!getenv ("LIBGDA_NO_THREADS")) {
+ if (!getenv ("LIBGDA_NO_THREADS")) { /* Flawfinder: ignore */
#ifdef G_THREADS_ENABLED
#ifndef G_THREADS_IMPL_NONE
if (! g_thread_supported ())
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 92a7c9b..3098463 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -2045,7 +2045,7 @@ update_schema_version (GdaMetaStore *store, G_GNUC_UNUSED const gchar *version,
/* update version */
- store->priv->version = atoi (CURRENT_SCHEMA_VERSION);
+ store->priv->version = atoi (CURRENT_SCHEMA_VERSION); /* Flawfinder: ignore */
return TRUE;
}
@@ -2162,8 +2162,10 @@ handle_schema_version (GdaMetaStore *store, gboolean *schema_present, GError **e
g_object_unref (model);
return FALSE;
}
- store->priv->version = atoi (g_value_get_string (version));
- if (store->priv->version != atoi (CURRENT_SCHEMA_VERSION)) {
+ store->priv->version = atoi (g_value_get_string (version)); /* Flawfinder: ignore */
+ if (store->priv->version < 1)
+ store->priv->version = 1;
+ if (store->priv->version != atoi (CURRENT_SCHEMA_VERSION)) { /* Flawfinder: ignore */
switch (store->priv->version) {
case 1:
migrate_schema_from_v1_to_v2 (store, error);
@@ -2177,7 +2179,7 @@ handle_schema_version (GdaMetaStore *store, gboolean *schema_present, GError **e
break;
}
- if (store->priv->version != atoi (CURRENT_SCHEMA_VERSION)) {
+ if (store->priv->version != atoi (CURRENT_SCHEMA_VERSION)) { /* Flawfinder: ignore */
/* it's an error */
g_object_unref (model);
return FALSE;
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index 4877641..93da4ba 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -896,13 +896,17 @@ load_xml_spec (GdaServerOperation *op, xmlNodePtr specnode, const gchar *root, G
prop = xmlGetProp(node, (xmlChar*)"minitems");
if (prop) {
- opnode->d.seq.min_items = atoi ((gchar*)prop);
+ opnode->d.seq.min_items = atoi ((gchar*)prop); /* Flawfinder: ignore */
+ if (opnode->d.seq.min_items < 0)
+ opnode->d.seq.min_items = 0;
xmlFree (prop);
}
prop = xmlGetProp(node, (xmlChar*)"maxitems");
if (prop) {
- opnode->d.seq.max_items = atoi ((gchar*)prop);
+ opnode->d.seq.max_items = atoi ((gchar*)prop); /* Flawfinder: ignore */
+ if (opnode->d.seq.max_items < opnode->d.seq.min_items)
+ opnode->d.seq.max_items = opnode->d.seq.min_items;
xmlFree (prop);
}
diff --git a/libgda/gda-tree.c b/libgda/gda-tree.c
index 6c11a8a..7f957c5 100644
--- a/libgda/gda-tree.c
+++ b/libgda/gda-tree.c
@@ -548,7 +548,7 @@ real_gda_tree_get_nodes_in_path (GdaTree *tree, GSList *segments, gboolean use_n
if (use_names)
node = gda_tree_node_get_child_name (parent, (gchar *) seglist->data);
else
- node = gda_tree_node_get_child_index (parent, atoi ((gchar *) seglist->data));
+ node = gda_tree_node_get_child_index (parent, atoi ((gchar *) seglist->data)); /* Flawfinder: ignore */
if (!node && tree->priv->update_on_searching) {
/* update level if necessary */
mgrlist = _gda_tree_node_get_managers_for_children (parent);
@@ -562,7 +562,7 @@ real_gda_tree_get_nodes_in_path (GdaTree *tree, GSList *segments, gboolean use_n
if (use_names)
node = gda_tree_node_get_child_name (parent, (gchar *) seglist->data);
else
- node = gda_tree_node_get_child_index (parent, atoi ((gchar *) seglist->data));
+ node = gda_tree_node_get_child_index (parent, atoi ((gchar *) seglist->data)); /* Flawfinder: ignore */
}
if (!node)
return NULL;
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index 114d75c..941c641 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -590,7 +590,7 @@ gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *
if (model) {
gint fno;
- fno = atoi (ptr2);
+ fno = atoi (ptr2); /* Flawfinder: ignore */
if ((fno < 0) ||
(fno >= gda_data_model_get_n_columns (model)))
g_warning (_("Field number %d not found in source named '%s'"), fno, ptr1);
@@ -1600,8 +1600,8 @@ gda_completion_list_get (GdaConnection *cnc, const gchar *sql, gint start, gint
/* init */
compl = g_array_new (TRUE, TRUE, sizeof (gchar *));
- text = g_new0 (gchar, end - start + 2);
- memcpy (text, sql + start, end - start + 1);
+ text = g_new (gchar, end - start + 2);
+ memcpy (text, sql + start, end - start + 1); /* Flawfinder: ignore */
text [end - start + 1] = 0;
if (start == 0) {
@@ -1824,12 +1824,12 @@ concat_ident (const char *prefix, const gchar *ident)
str = malloc (sizeof (char) * (plen + tlen + 1));
if (prefix) {
- strcpy (str, prefix);
+ strcpy (str, prefix); /* Flawfinder: ignore */
str [plen - 1] = '.';
- strcpy (str + plen, ident);
+ strcpy (str + plen, ident); /* Flawfinder: ignore */
}
else
- strcpy (str, ident);
+ strcpy (str, ident); /* Flawfinder: ignore */
return str;
}
@@ -2253,7 +2253,7 @@ gda_rfc1738_encode (const gchar *string)
}
if (enc) {
- sprintf (wptr, "%%%02x", (unsigned char) *rptr);
+ sprintf (wptr, "%%%02x", (unsigned char) *rptr); /* Flawfinder: ignore */
wptr += 3;
}
else {
@@ -2533,20 +2533,26 @@ gda_parse_iso8601_date (GDate *gdate, const gchar *value)
GDateYear year;
GDateMonth month;
GDateDay day;
+ gint tmp;
- year = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ year = tmp > 0 ? tmp : 0;
value += 5;
- month = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ month = tmp > 0 ? (tmp <= G_DATE_DECEMBER ? tmp : G_DATE_BAD_MONTH) : G_DATE_BAD_MONTH;
value += 3;
- day = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ day = tmp > 0 ? (tmp <= G_MAXUINT8 ? tmp : G_DATE_BAD_DAY) : G_DATE_BAD_DAY;
g_date_clear (gdate, 1);
if (g_date_valid_dmy (day, month, year)) {
g_date_set_dmy (gdate, day, month, year);
return TRUE;
}
- else
+ else {
+ memset (gdate, 0, sizeof (GDate));
return FALSE;
+ }
}
/**
@@ -2563,11 +2569,24 @@ gda_parse_iso8601_date (GDate *gdate, const gchar *value)
gboolean
gda_parse_iso8601_time (GdaTime *timegda, const gchar *value)
{
- timegda->hour = atoi (value);
+ gint tmp;
+
+ memset (timegda, 0, sizeof (GdaTime));
+
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 24))
+ return FALSE;
+ timegda->hour = tmp;
value += 3;
- timegda->minute = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 60))
+ return FALSE;
+ timegda->minute = tmp;
value += 3;
- timegda->second = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 60))
+ return FALSE;
+ timegda->second = tmp;
value += 2;
if (*value != '.') {
timegda->fraction = 0;
@@ -2576,8 +2595,11 @@ gda_parse_iso8601_time (GdaTime *timegda, const gchar *value)
gint64 fraction;
value++;
- fraction = atol (value);
- while (*value && *value != '+') {
+ fraction = atol (value); /* Flawfinder: ignore */
+ if (fraction < 0)
+ return FALSE;
+
+ while (*value && (*value != '+') && (*value != '-')) {
value++;
ndigits++;
}
@@ -2590,10 +2612,12 @@ gda_parse_iso8601_time (GdaTime *timegda, const gchar *value)
timegda->fraction = fraction;
}
- if (*value)
- timegda->timezone = atol (value) * 60 * 60;
- else
- timegda->timezone = 0;
+ if (*value) {
+ tmp = atol (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp >= 24))
+ return FALSE;
+ timegda->timezone = tmp * 60 * 60;
+ }
return TRUE;
}
@@ -2612,17 +2636,47 @@ gda_parse_iso8601_time (GdaTime *timegda, const gchar *value)
gboolean
gda_parse_iso8601_timestamp (GdaTimestamp *timestamp, const gchar *value)
{
- timestamp->year = atoi (value);
+ GDateYear year;
+ GDateMonth month;
+ GDateDay day;
+ gint tmp;
+
+ memset (timestamp, 0, sizeof (GdaTimestamp));
+
+ /* date part */
+ tmp = atoi (value); /* Flawfinder: ignore */
+ year = tmp > 0 ? tmp : 0;
value += 5;
- timestamp->month = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ month = tmp > 0 ? (tmp <= G_DATE_DECEMBER ? tmp : G_DATE_BAD_MONTH) : G_DATE_BAD_MONTH;
value += 3;
- timestamp->day = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ day = tmp > 0 ? (tmp <= G_MAXUINT8 ? tmp : G_DATE_BAD_DAY) : G_DATE_BAD_DAY;
value += 3;
- timestamp->hour = atoi (value);
+
+ if (g_date_valid_dmy (day, month, year)) {
+ timestamp->year = year;
+ timestamp->month = month;
+ timestamp->day = day;
+ }
+ else
+ return FALSE;
+
+ /* time part */
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 24))
+ return FALSE;
+ timestamp->hour = tmp;
value += 3;
- timestamp->minute = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 60))
+ return FALSE;
+ timestamp->minute = tmp;
value += 3;
- timestamp->second = atoi (value);
+ tmp = atoi (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > 60))
+ return FALSE;
+ timestamp->second = tmp;
value += 2;
if (*value != '.') {
timestamp->fraction = 0;
@@ -2631,8 +2685,11 @@ gda_parse_iso8601_timestamp (GdaTimestamp *timestamp, const gchar *value)
gint64 fraction;
value++;
- fraction = atol (value);
- while (*value && *value != '+') {
+ fraction = atol (value); /* Flawfinder: ignore */
+ if (fraction < 0)
+ return FALSE;
+
+ while (*value && (*value != '+') && (*value != '-')) {
value++;
ndigits++;
}
@@ -2645,10 +2702,12 @@ gda_parse_iso8601_timestamp (GdaTimestamp *timestamp, const gchar *value)
timestamp->fraction = fraction;
}
- if (*value)
- timestamp->timezone = atol (value) * 60 * 60;
- else
- timestamp->timezone = 0;
+ if (*value) {
+ tmp = atol (value); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp >= 24))
+ return FALSE;
+ timestamp->timezone = tmp * 60 * 60;
+ }
return TRUE;
}
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index 116ed97..24c0fa2 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -73,7 +73,7 @@ set_from_string (GValue *value, const gchar *as_string)
}
else {
gint i;
- i = atoi (as_string);
+ i = atoi (as_string); /* Flawfinder: ignore */
g_value_set_boolean (value, i ? TRUE : FALSE);
retval = TRUE;
}
@@ -687,8 +687,13 @@ numeric_to_int (const GValue *src, GValue *dest)
GDA_VALUE_HOLDS_NUMERIC (src));
numeric = gda_value_get_numeric (src);
- if (numeric)
- g_value_set_int (dest, atol (numeric->number));
+ if (numeric) {
+ glong tmp;
+ tmp = atol (numeric->number); /* Flawfinder: ignore */
+ if ((tmp < G_MININT) || (tmp > G_MAXINT))
+ g_warning ("Integer overflow for value %ld", tmp);
+ g_value_set_int (dest, tmp);
+ }
else
g_value_set_int (dest, 0);
}
@@ -702,8 +707,13 @@ numeric_to_uint (const GValue *src, GValue *dest)
GDA_VALUE_HOLDS_NUMERIC (src));
numeric = gda_value_get_numeric (src);
- if (numeric)
- g_value_set_uint (dest, atol (numeric->number));
+ if (numeric) {
+ glong tmp;
+ tmp = atol (numeric->number); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp > G_MAXUINT))
+ g_warning ("Unsigned integer overflow for value %ld", tmp);
+ g_value_set_uint (dest, tmp);
+ }
else
g_value_set_uint (dest, 0);
}
@@ -718,7 +728,7 @@ numeric_to_boolean (const GValue *src, GValue *dest)
numeric = gda_value_get_numeric (src);
if (numeric)
- g_value_set_boolean (dest, atoi (numeric->number));
+ g_value_set_boolean (dest, atoi (numeric->number)); /* Flawfinder: ignore */
else
g_value_set_boolean (dest, 0);
}
@@ -991,37 +1001,14 @@ static void
string_to_timestamp (const GValue *src, GValue *dest)
{
/* FIXME: add more checks*/
- GdaTimestamp *timestamp;
- const gchar *as_string;
+ GdaTimestamp timestamp;
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_TIMESTAMP (dest));
-
- timestamp = g_new0 (GdaTimestamp, 1);
-
- as_string = g_value_get_string (src);
-
- timestamp->year = atoi (as_string);
- as_string += 5;
- timestamp->month = atoi (as_string);
- as_string += 3;
- timestamp->day = atoi (as_string);
- as_string += 3;
- timestamp->hour = atoi (as_string);
- as_string += 3;
- timestamp->minute = atoi (as_string);
- as_string += 3;
- timestamp->second = atoi (as_string);
- if (strlen(as_string)>=3) {
- as_string += 3;
- timestamp->fraction = atol (as_string) * 10; /* I have only hundredths of second */
- if (strlen(as_string)>=3) {
- as_string += 3;
- timestamp->timezone = atol (as_string) * 60 * 60;
- }
- }
- gda_value_set_timestamp (dest, timestamp);
- g_free (timestamp);
+
+ if (! gda_parse_iso8601_timestamp (×tamp, g_value_get_string (src)))
+ g_warning ("Can't convert '%s' to a timestamp", g_value_get_string (src));
+ gda_value_set_timestamp (dest, ×tamp);
}
static void
@@ -1207,7 +1194,7 @@ gda_value_new_blob (const guchar *val, glong size)
blob = g_new0 (GdaBlob, 1);
bin = (GdaBinary*)(blob);
bin->data = g_new (guchar, size);
- memcpy ((gpointer) bin->data, (gpointer) val, size);
+ memcpy ((gpointer) bin->data, (gpointer) val, size); /* Flawfinder: ignore */
bin->binary_length = size;
blob->op = NULL;
diff --git a/libgda/gda-xa-transaction.c b/libgda/gda-xa-transaction.c
index 2d3705b..42ca710 100644
--- a/libgda/gda-xa-transaction.c
+++ b/libgda/gda-xa-transaction.c
@@ -149,8 +149,9 @@ gda_xa_transaction_set_property (GObject *object,
gchar *dtmp;
dtmp = g_strdup_printf ("gda_global_transaction_%p", xa_trans);
len = strlen (dtmp);
+ g_assert (len <= 64);
xa_trans->priv->xid.gtrid_length = len;
- memcpy (xa_trans->priv->xid.data, dtmp, len);
+ memcpy (xa_trans->priv->xid.data, dtmp, len); /* Flawfinder: ignore */
g_free (dtmp);
}
else {
@@ -159,7 +160,7 @@ gda_xa_transaction_set_property (GObject *object,
g_warning (_("Global transaction ID can not have more than 64 bytes"));
else {
xa_trans->priv->xid.gtrid_length = len;
- memcpy (xa_trans->priv->xid.data, tmp, len);
+ memcpy (xa_trans->priv->xid.data, tmp, len); /* Flawfinder: ignore */
}
}
break;
@@ -188,8 +189,9 @@ gda_xa_transaction_get_property (GObject *object,
case PROP_TRANSACT_ID: {
gchar *tmp;
- tmp = g_new0 (gchar, xa_trans->priv->xid.gtrid_length + 1);
- memcpy (tmp, xa_trans->priv->xid.data, xa_trans->priv->xid.gtrid_length);
+ tmp = g_new (gchar, xa_trans->priv->xid.gtrid_length + 1);
+ memcpy (tmp, xa_trans->priv->xid.data, xa_trans->priv->xid.gtrid_length); /* Flawfinder: ignore */
+ tmp [xa_trans->priv->xid.gtrid_length] = 0;
g_value_take_string (value, tmp);
break;
}
@@ -279,6 +281,12 @@ gda_xa_transaction_register_connection (GdaXaTransaction *xa_trans, GdaConnecti
g_return_val_if_fail (GDA_IS_XA_TRANSACTION (xa_trans), FALSE);
g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
g_return_val_if_fail (branch && *branch, FALSE);
+ if (strlen (branch) >= 64) {
+ g_set_error (error, GDA_XA_TRANSACTION_ERROR,
+ GDA_XA_TRANSACTION_CONNECTION_BRANCH_LENGTH_ERROR,
+ "%s", _("Connection branch cannot exceed 63 bytes"));
+ return FALSE;
+ }
const GdaBinary *ebranch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
if (ebranch) {
@@ -374,7 +382,6 @@ gda_xa_transaction_begin (GdaXaTransaction *xa_trans, GError **error)
cnc = GDA_CONNECTION (list->data);
prov = gda_connection_get_provider (cnc);
if (cnc != xa_trans->priv->non_xa_cnc) {
-
if (!PROV_CLASS (prov)->xa_funcs->xa_start) {
g_warning (_("Provider error: %s method not implemented for provider %s"),
"xa_start()", gda_server_provider_get_name (prov));
@@ -383,7 +390,7 @@ gda_xa_transaction_begin (GdaXaTransaction *xa_trans, GError **error)
else {
const GdaBinary *branch;
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
if (!PROV_CLASS (prov)->xa_funcs->xa_start (prov, cnc, &(xa_trans->priv->xid), error))
break;
@@ -412,7 +419,7 @@ gda_xa_transaction_begin (GdaXaTransaction *xa_trans, GError **error)
else {
const GdaBinary *branch;
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
PROV_CLASS (prov)->xa_funcs->xa_rollback (prov, cnc, &(xa_trans->priv->xid), NULL);
}
@@ -470,7 +477,7 @@ gda_xa_transaction_commit (GdaXaTransaction *xa_trans, GSList **cnc_to_recover,
prov = gda_connection_get_provider (cnc);
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
if (PROV_CLASS (prov)->xa_funcs->xa_end &&
@@ -504,7 +511,7 @@ gda_xa_transaction_commit (GdaXaTransaction *xa_trans, GSList **cnc_to_recover,
cnc = GDA_CONNECTION (list->data);
prov = gda_connection_get_provider (cnc);
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
if (PROV_CLASS (prov)->xa_funcs->xa_rollback)
@@ -534,7 +541,7 @@ gda_xa_transaction_commit (GdaXaTransaction *xa_trans, GSList **cnc_to_recover,
cnc = GDA_CONNECTION (list->data);
prov = gda_connection_get_provider (cnc);
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
if (PROV_CLASS (prov)->xa_funcs->xa_rollback)
@@ -558,7 +565,7 @@ gda_xa_transaction_commit (GdaXaTransaction *xa_trans, GSList **cnc_to_recover,
cnc = GDA_CONNECTION (list->data);
prov = gda_connection_get_provider (cnc);
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
if (!PROV_CLASS (prov)->xa_funcs->xa_commit (prov, cnc, &(xa_trans->priv->xid), error) &&
cnc_to_recover)
@@ -595,8 +602,8 @@ gda_xa_transaction_rollback (GdaXaTransaction *xa_trans, GError **error)
else {
const GdaBinary *branch;
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
- branch->data, branch->binary_length);
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
+ branch->data, branch->binary_length);
if (!PROV_CLASS (prov)->xa_funcs->xa_rollback)
g_warning (_("Provider error: %s method not implemented for provider %s"),
"xa_prepare()", gda_server_provider_get_name (prov));
@@ -655,7 +662,7 @@ gda_xa_transaction_commit_recovered (GdaXaTransaction *xa_trans, GSList **cnc_to
continue;
branch = g_hash_table_lookup (xa_trans->priv->cnc_hash, cnc);
- memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length,
+ memcpy (xa_trans->priv->xid.data + xa_trans->priv->xid.gtrid_length, /* Flawfinder: ignore */
branch->data, branch->binary_length);
for (xlist = recov_xid_list; xlist; xlist = xlist->next) {
GdaXaTransactionId *xid = (GdaXaTransactionId*) xlist->data;
@@ -722,7 +729,7 @@ gda_xa_transaction_id_to_string (const GdaXaTransactionId *xid)
index++;
}
else
- index += sprintf (str+index, "%%%02x", xid->data[i]);
+ index += sprintf (str+index, "%%%02x", xid->data[i]); /* Flawfinder: ignore */
}
/* branch qualifier */
@@ -733,12 +740,12 @@ gda_xa_transaction_id_to_string (const GdaXaTransactionId *xid)
index++;
}
else
- index += sprintf (str+index, "%%%02x", xid->data[xid->gtrid_length + i]);
+ index += sprintf (str+index, "%%%02x", xid->data[xid->gtrid_length + i]); /* Flawfinder: ignore */
}
/* Format ID */
str [index++] = ',';
- sprintf (str, "%d", xid->format);
+ sprintf (str, "%d", xid->format); /* Flawfinder: ignore */
return str;
}
@@ -767,6 +774,9 @@ gda_xa_transaction_string_to_id (const gchar *str)
/* global transaction ID */
for (ptr = str; *ptr && (*ptr != ','); ptr++, index++) {
+ if (index >= 64)
+ goto onerror;
+
if (*ptr == '%') {
ptr++;
if (*ptr && (((*ptr >= 'a') && (*ptr <= 'f')) ||
@@ -792,8 +802,7 @@ gda_xa_transaction_string_to_id (const gchar *str)
else if (g_ascii_isalnum (*ptr))
xid->data [index] = *ptr;
else
- goto onerror;
-
+ goto onerror;
}
xid->gtrid_length = index;
@@ -801,6 +810,9 @@ gda_xa_transaction_string_to_id (const gchar *str)
if (*ptr != ',')
goto onerror;
for (ptr++; *ptr && (*ptr != ','); ptr++, index++) {
+ if (index >= 128)
+ goto onerror;
+
if (*ptr == '%') {
ptr++;
if (*ptr && (((*ptr >= 'a') && (*ptr <= 'f')) ||
@@ -827,7 +839,6 @@ gda_xa_transaction_string_to_id (const gchar *str)
xid->data [index] = *ptr;
else
goto onerror;
-
}
xid->bqual_length = index - xid->gtrid_length;
@@ -835,7 +846,11 @@ gda_xa_transaction_string_to_id (const gchar *str)
if (*ptr != ',')
goto onerror;
ptr++;
- xid->format = atoi (ptr);
+ gint tmp = atoi (ptr); /* Flawfinder: ignore */
+ if ((tmp < 0) || (tmp >= G_MAXUINT32))
+ goto onerror;
+
+ xid->format = tmp;
return xid;
diff --git a/libgda/gda-xa-transaction.h b/libgda/gda-xa-transaction.h
index 87cc348..8ba5698 100644
--- a/libgda/gda-xa-transaction.h
+++ b/libgda/gda-xa-transaction.h
@@ -47,7 +47,8 @@ extern GQuark gda_xa_transaction_error_quark (void);
typedef enum
{
GDA_XA_TRANSACTION_ALREADY_REGISTERED_ERROR,
- GDA_XA_TRANSACTION_DTP_NOT_SUPPORTED_ERROR
+ GDA_XA_TRANSACTION_DTP_NOT_SUPPORTED_ERROR,
+ GDA_XA_TRANSACTION_CONNECTION_BRANCH_LENGTH_ERROR
} GdaXaTransactionError;
struct _GdaXaTransaction {
@@ -58,6 +59,7 @@ struct _GdaXaTransaction {
struct _GdaXaTransactionClass {
GObjectClass parent_class;
+ /*< private >*/
/* Padding for future expansion */
void (*_gda_reserved1) (void);
void (*_gda_reserved2) (void);
diff --git a/libgda/handlers/gda-handler-numerical.c b/libgda/handlers/gda-handler-numerical.c
index 2b30286..625aa68 100644
--- a/libgda/handlers/gda-handler-numerical.c
+++ b/libgda/handlers/gda-handler-numerical.c
@@ -228,22 +228,34 @@ gda_handler_numerical_get_value_from_str (GdaDataHandler *iface, const gchar *st
{
GdaHandlerNumerical *hdl;
GValue *value = NULL;
+ long long int llint;
+ char *endptr = NULL;
g_return_val_if_fail (iface && GDA_IS_HANDLER_NUMERICAL (iface), NULL);
hdl = GDA_HANDLER_NUMERICAL (iface);
g_return_val_if_fail (hdl->priv, NULL);
+ llint = strtoll (str, &endptr, 10);
+
if (type == G_TYPE_INT64) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_INT64);
- g_value_set_int64 (value, atoll (str));
+ if (!*endptr && (llint >= G_MININT64) && (llint <= G_MAXINT64)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_INT64);
+ g_value_set_int64 (value, (gint64) llint);
+ }
}
else if (type == G_TYPE_DOUBLE) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_DOUBLE);
- g_value_set_double (value, atof (str));
+ gdouble dble;
+ dble = g_strtod (str, &endptr);
+ if (!*endptr) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_DOUBLE);
+ g_value_set_double (value, dble);
+ }
}
else if (type == G_TYPE_INT) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_INT);
- g_value_set_int (value, atoi (str));
+ if (!*endptr && (llint >= G_MININT) && (llint <= G_MAXINT)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_INT);
+ g_value_set_int (value, (gint) llint);
+ }
}
else if (type == GDA_TYPE_NUMERIC) {
GdaNumeric numeric;
@@ -278,40 +290,76 @@ gda_handler_numerical_get_value_from_str (GdaDataHandler *iface, const gchar *st
}
}
else if (type == G_TYPE_FLOAT) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_FLOAT);
- g_value_set_float (value, atof (str));
+ gfloat flt;
+ flt = strtof (str, &endptr);
+ if (!*endptr) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_FLOAT);
+ g_value_set_float (value, flt);
+ }
}
else if (type == GDA_TYPE_SHORT) {
- value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_SHORT);
- gda_value_set_short (value, atoi (str));
+ if (!*endptr && (llint >= G_MINSHORT) && (llint <= G_MAXSHORT)) {
+ value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_SHORT);
+ gda_value_set_short (value, (gshort) llint);
+ }
}
else if (type == G_TYPE_CHAR) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_CHAR);
- g_value_set_char (value, atoi (str));
+ if (!*endptr && (llint >= G_MININT8) && (llint <= G_MAXINT8)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_CHAR);
+ g_value_set_char (value, (gchar) llint);
+ }
}
else if (type == G_TYPE_UINT64) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT64);
- g_value_set_uint64 (value, strtoull (str, NULL, 10));
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXUINT64)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT64);
+ g_value_set_uint64 (value, (guint64) llint);
+ }
+ else {
+ unsigned long long int lluint;
+ lluint = strtoull (str, &endptr, 10);
+ if (!*endptr && (lluint <= G_MAXUINT64)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT64);
+ g_value_set_uint64 (value, (guint64) lluint);
+ }
+ }
}
else if (type == GDA_TYPE_USHORT) {
- value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_USHORT);
- gda_value_set_ushort (value, atoi (str));
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXUSHORT)) {
+ value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_USHORT);
+ gda_value_set_ushort (value, (gushort) llint);
+ }
}
else if (type == G_TYPE_UCHAR) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_UCHAR);
- g_value_set_uchar (value, atoi (str));
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXUINT8)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_UCHAR);
+ g_value_set_uchar (value, (guchar) llint);
+ }
}
else if (type == G_TYPE_UINT) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT);
- g_value_set_uint (value, strtoul (str, NULL, 10));
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXUINT)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT);
+ g_value_set_uint (value, (guint) llint);
+ }
}
else if (type == G_TYPE_ULONG) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_ULONG);
- g_value_set_ulong (value, strtoul (str, NULL, 10));
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXULONG)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_ULONG);
+ g_value_set_ulong (value, (gulong) llint);
+ }
+ else {
+ unsigned long long int lluint;
+ lluint = strtoull (str, &endptr, 10);
+ if (!*endptr && (lluint <= G_MAXULONG)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_ULONG);
+ g_value_set_ulong (value, (gulong) lluint);
+ }
+ }
}
else if (type == G_TYPE_LONG) {
- value = g_value_init (g_new0 (GValue, 1), G_TYPE_LONG);
- g_value_set_long (value, strtol (str, NULL, 10));
+ if (!*endptr && (llint >= G_MINLONG) && (llint <= G_MAXLONG)) {
+ value = g_value_init (g_new0 (GValue, 1), G_TYPE_LONG);
+ g_value_set_long (value, (glong) llint);
+ }
}
else
g_assert_not_reached ();
diff --git a/libgda/handlers/gda-handler-time.c b/libgda/handlers/gda-handler-time.c
index 47eb371..6f2286d 100644
--- a/libgda/handlers/gda-handler-time.c
+++ b/libgda/handlers/gda-handler-time.c
@@ -1,6 +1,6 @@
/* gda-handler-time.c
*
- * Copyright (C) 2003 - 2009 Vivien Malerba
+ * Copyright (C) 2003 - 2010 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -284,9 +284,10 @@ handler_compute_locale (GdaHandlerTime *hdl)
if (*ptr) {
hdl->priv->str_locale->separator = *ptr;
*ptr = 0;
- nums[0] = atoi (numstart);
+ nums[0] = atoi (numstart); /* Flawfinder: ignore */
}
- else error = TRUE;
+ else
+ error = TRUE;
/* 2nd number */
if (!error) {
@@ -296,9 +297,10 @@ handler_compute_locale (GdaHandlerTime *hdl)
ptr++;
if (*ptr) {
*ptr = 0;
- nums[1] = atoi (numstart);
+ nums[1] = atoi (numstart); /* Flawfinder: ignore */
}
- else error = TRUE;
+ else
+ error = TRUE;
}
/* 3rd number */
@@ -308,7 +310,7 @@ handler_compute_locale (GdaHandlerTime *hdl)
while (*ptr && g_ascii_isdigit (*ptr))
ptr++;
*ptr = 0;
- nums[2] = atoi (numstart);
+ nums[2] = atoi (numstart); /* Flawfinder: ignore */
}
/* computations */
@@ -821,13 +823,28 @@ make_timestamp (GdaHandlerTime *hdl, GdaTimestamp *timestamp, const gchar *value
return retval;
}
+static gboolean
+get_uint_from_string (const gchar *str, guint16 *out_int)
+{
+ long int li;
+ char *endptr = NULL;
+ li = strtol (str, &endptr, 10);
+ if (!*endptr && (li >= 0) && (li < G_MAXUINT16)) {
+ *out_int = (guint16) li;
+ return TRUE;
+ }
+ else {
+ *out_int = 0;
+ return FALSE;
+ }
+}
/* Makes a GDate from a string like "24-12-2003" */
static gboolean
make_date (G_GNUC_UNUSED GdaHandlerTime *hdl, GDate *date, const gchar *value, LocaleSetting *locale)
{
gboolean retval = TRUE;
- gushort nums[3];
+ guint16 nums[3];
gboolean error = FALSE;
gchar *ptr, *numstart, *tofree;
gint i;
@@ -846,9 +863,11 @@ make_date (G_GNUC_UNUSED GdaHandlerTime *hdl, GDate *date, const gchar *value, L
ptr++;
if ((ptr != numstart) && *ptr) {
*ptr = 0;
- nums[0] = atoi (numstart);
+ if (! get_uint_from_string (numstart, &(nums[0])))
+ error = TRUE;
}
- else error = TRUE;
+ else
+ error = TRUE;
/* 2nd number */
if (!error) {
@@ -858,9 +877,11 @@ make_date (G_GNUC_UNUSED GdaHandlerTime *hdl, GDate *date, const gchar *value, L
ptr++;
if ((ptr != numstart) && *ptr) {
*ptr = 0;
- nums[1] = atoi (numstart);
+ if (! get_uint_from_string (numstart, &(nums[1])))
+ error = TRUE;
}
- else error = TRUE;
+ else
+ error = TRUE;
}
/* 3rd number */
@@ -870,23 +891,31 @@ make_date (G_GNUC_UNUSED GdaHandlerTime *hdl, GDate *date, const gchar *value, L
while (*ptr && g_ascii_isdigit (*ptr))
ptr++;
*ptr = 0;
- if (ptr != numstart)
- nums[2] = atoi (numstart);
+ if (ptr != numstart) {
+ if (! get_uint_from_string (numstart, &(nums[2])))
+ error = TRUE;
+ }
else
error = TRUE;
}
if (!error) {
+ ptr++;
+ if (*ptr)
+ error = TRUE;
+ }
+
+ if (!error) {
for (i=0; i<3; i++) {
switch (locale->dmy_order[i]) {
case G_DATE_DAY:
- if (g_date_valid_day (nums[i]))
+ if ((nums[i] <= G_MAXUINT8) && g_date_valid_day ((GDateDay) nums[i]))
g_date_set_day (date, nums[i]);
else
retval = FALSE;
break;
case G_DATE_MONTH:
- if (g_date_valid_month (nums[i]))
+ if ((nums[i] <= 12) && g_date_valid_month ((GDateMonth) nums[i]))
g_date_set_month (date, nums[i]);
else
retval = FALSE;
diff --git a/libgda/providers-support/gda-pstmt.c b/libgda/providers-support/gda-pstmt.c
index 9f41046..de28add 100644
--- a/libgda/providers-support/gda-pstmt.c
+++ b/libgda/providers-support/gda-pstmt.c
@@ -200,7 +200,7 @@ gda_pstmt_copy_contents (GdaPStmt *src, GdaPStmt *dest)
dest->types = NULL;
if (src->types) {
dest->types = g_new (GType, dest->ncols);
- memcpy (dest->types, src->types, sizeof (GType) * dest->ncols);
+ memcpy (dest->types, src->types, sizeof (GType) * dest->ncols); /* Flawfinder: ignore */
}
if (src->tmpl_columns) {
GSList *list;
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index 6f596fd..9f06d47 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -419,8 +419,8 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
bin->binary_length = SQLITE3_CALL (sqlite3_column_bytes) (ps->sqlite_stmt, real_col);
if (bin->binary_length > 0) {
bin->data = g_new (guchar, bin->binary_length);
- memcpy (bin->data, SQLITE3_CALL (sqlite3_column_blob) (ps->sqlite_stmt,
- real_col),
+ memcpy (bin->data, SQLITE3_CALL (sqlite3_column_blob) (ps->sqlite_stmt, /* Flawfinder: ignore */
+ real_col),
bin->binary_length);
}
else
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 137abe9..116dfc3 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -399,7 +399,7 @@ virtualCreate (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlit
if (error && error->message) {
int len = strlen (error->message) + 1;
*pzErr = SQLITE3_CALL (sqlite3_malloc) (sizeof (gchar) * len);
- memcpy (*pzErr, error->message, len);
+ memcpy (*pzErr, error->message, len); /* Flawfinder: ignore */
}
else
*pzErr = SQLITE3_CALL (sqlite3_mprintf) (_("Could not compute virtual table's columns"));
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index c3f1577..1e06b94 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -997,7 +997,7 @@ window_fullscreen_cb (GtkToggleAction *action, BrowserWindow *bwin)
gtk_window_fullscreen (GTK_WINDOW (bwin));
browser_window_show_notice_printf (bwin, GTK_MESSAGE_INFO,
"fullscreen-esc",
- _("Hit the Escape key to leave the fullscreen mode"));
+ "%s", _("Hit the Escape key to leave the fullscreen mode"));
gtk_widget_hide (bwin->priv->toolbar);
gtk_widget_hide (bwin->priv->menubar);
bwin->priv->toolbar_shown = FALSE;
diff --git a/tools/browser/data-manager/data-console.c b/tools/browser/data-manager/data-console.c
index c495620..1f00e54 100644
--- a/tools/browser/data-manager/data-console.c
+++ b/tools/browser/data-manager/data-console.c
@@ -891,7 +891,7 @@ compose_mode_toggled_cb (G_GNUC_UNUSED GtkToggleAction *action, DataConsole *dco
browser_window_show_notice_printf (BROWSER_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) dconsole)),
GTK_MESSAGE_INFO,
"data-manager-exec-mode-switched",
- _("Switching to execution mode. Hit the Escape key "
+ "%s", _("Switching to execution mode. Hit the Escape key "
"to return to the compose mode"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (dconsole->priv->main_notebook), pagenb);
}
diff --git a/tools/browser/main.c b/tools/browser/main.c
index e1f62c1..321a45d 100644
--- a/tools/browser/main.c
+++ b/tools/browser/main.c
@@ -142,7 +142,7 @@ main (int argc, char *argv[])
}
}
- g_print ("Main THREAD is %p\n", g_thread_self ());
+ /*g_print ("Main THREAD is %p\n", g_thread_self ());*/
if (have_loop)
/* application loop */
gtk_main ();
diff --git a/tools/browser/schema-browser/table-info.c b/tools/browser/schema-browser/table-info.c
index 67c7a7d..8e66078 100644
--- a/tools/browser/schema-browser/table-info.c
+++ b/tools/browser/schema-browser/table-info.c
@@ -531,7 +531,7 @@ static void statement_executed_cb (G_GNUC_UNUSED BrowserConnection *bcnc,
browser_window_show_notice_printf (BROWSER_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) tinfo)),
GTK_MESSAGE_INFO,
"DataInsertQuery",
- _("Data successfully inserted"));
+ "%s", _("Data successfully inserted"));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]