[libgda] Fix some signedness warnings
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Fix some signedness warnings
- Date: Sat, 2 Oct 2010 12:12:09 +0000 (UTC)
commit ede2ff4621f12eaca358ceb7447f70fbd0dc86b6
Author: David King <davidk openismus com>
Date: Fri Oct 1 16:08:20 2010 +0200
Fix some signedness warnings
Fix comparisons between signed and unsigned integers, which appeared
with -Wsign-compare (or -Wextra).
libgda-report/engine/gda-report-engine.c | 2 +-
.../data-entries/gdaui-data-cell-renderer-combo.c | 2 +-
.../gdaui-data-cell-renderer-textual.c | 2 +-
libgda-ui/data-entries/gdaui-entry-string.c | 2 +-
libgda-ui/data-entries/plugins/gdaui-entry-cidr.c | 2 +-
libgda-ui/demos/cloud.c | 2 +-
libgda-ui/demos/combo.c | 2 +-
libgda-ui/demos/main.c | 6 ++--
libgda-ui/gdaui-basic-form.c | 2 +-
libgda-ui/gdaui-combo.c | 2 +-
libgda-ui/gdaui-raw-grid.c | 2 +-
libgda-ui/gdaui-tree-store.c | 6 ++--
libgda/dir-blob-op.c | 2 +-
libgda/gda-config.c | 2 +-
libgda/gda-connection.c | 18 ++++++-----
libgda/gda-data-comparator.c | 2 +-
libgda/gda-data-model-array.c | 13 +++++---
libgda/gda-data-model-dir.c | 11 ++++--
libgda/gda-data-model-import.c | 2 +-
libgda/gda-data-model.c | 6 ++--
libgda/gda-data-proxy.c | 31 +++++++++++--------
libgda/gda-data-select.c | 7 ++--
libgda/gda-meta-store.c | 2 +-
libgda/gda-server-provider.c | 2 +-
libgda/gda-set.c | 4 ++-
libgda/gda-tree.c | 2 +-
libgda/gda-util.c | 16 +++++-----
libgda/gda-value.c | 14 ++++----
libgda/sql-parser/gda-statement-struct-insert.c | 10 ++++--
libgda/sqlite/gda-sqlite-meta.c | 2 +-
libgda/sqlite/gda-sqlite-provider.c | 6 ++--
libgda/sqlite/virtual/gda-vprovider-data-model.c | 2 +-
libgda/thread-wrapper/gda-thread-provider.c | 2 +-
libgda/thread-wrapper/gda-thread-wrapper.c | 8 ++--
providers/bdb/gda-bdb-test.c | 3 +-
providers/jdbc/GdaJBlobOp.c | 2 +-
providers/jdbc/GdaJColumnInfos.c | 2 +-
providers/jdbc/GdaJConnection.c | 2 +-
providers/jdbc/GdaJMeta.c | 2 +-
providers/jdbc/GdaJPStmt.c | 2 +-
providers/jdbc/GdaJProvider.c | 2 +-
providers/jdbc/GdaJResultSet.c | 2 +-
providers/jdbc/GdaJResultSetInfos.c | 2 +-
providers/jdbc/GdaJValue.c | 2 +-
providers/jdbc/libmain.c | 2 +-
providers/reuseable/mysql/gda-mysql-meta.c | 2 +-
testing/gda-provider-status.c | 2 +-
testing/gdaui-test-data-entries.c | 13 +++++---
testing/gdaui-test-widget-entry.c | 10 +++---
tests/data-model-errors.c | 4 +-
tools/browser/browser-favorites.c | 2 +-
tools/browser/data-manager/data-source-editor.c | 2 +-
tools/browser/data-manager/data-source-manager.c | 10 +++---
tools/browser/data-manager/data-source.c | 2 +-
tools/browser/data-manager/data-widget.c | 8 ++--
tools/browser/query-exec/query-editor.c | 2 +-
tools/browser/schema-browser/table-preferences.c | 2 +-
tools/gda-sql.c | 10 +++---
tools/web-server.c | 10 +++---
59 files changed, 160 insertions(+), 138 deletions(-)
---
diff --git a/libgda-report/engine/gda-report-engine.c b/libgda-report/engine/gda-report-engine.c
index dca9ecf..5887ce0 100644
--- a/libgda-report/engine/gda-report-engine.c
+++ b/libgda-report/engine/gda-report-engine.c
@@ -482,7 +482,7 @@ real_run_at_node (GdaReportEngine *engine, xmlNodePtr topnode, RunContext *conte
if (!strncmp ((gchar *) node->name, "gda_report", 10)) {
GSList *created_nodes = NULL;
gboolean cmd_res = TRUE;
- gint i;
+ gsize i;
gboolean command_found = FALSE;
for (i = 0; i < sizeof (commands) / sizeof (EngineCommand); i++) {
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
index 7f08a25..1bb04b2 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
@@ -350,7 +350,7 @@ gdaui_data_cell_renderer_combo_set_property (GObject *object,
GList *gvalues = g_value_get_pointer (value);
gchar *str;
- g_assert (g_list_length (gvalues) == datacell->priv->source->shown_n_cols);
+ g_assert (g_list_length (gvalues) == (guint)datacell->priv->source->shown_n_cols);
str = render_text_to_display_from_values (gvalues);
g_object_set (G_OBJECT (object), "text", str, NULL);
g_free (str);
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
index 182c0d0..a7805e2 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
@@ -37,7 +37,7 @@
#include "marshallers/gdaui-custom-marshal.h"
#include "gdaui-data-cell-renderer-util.h"
-#define MAX_ACCEPTED_STRING_LENGTH 500
+#define MAX_ACCEPTED_STRING_LENGTH 500U
static void gdaui_data_cell_renderer_textual_init (GdauiDataCellRendererTextual *celltext);
static void gdaui_data_cell_renderer_textual_class_init (GdauiDataCellRendererTextualClass *class);
diff --git a/libgda-ui/data-entries/gdaui-entry-string.c b/libgda-ui/data-entries/gdaui-entry-string.c
index 93d65f9..d8e1bae 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -25,7 +25,7 @@
#include <libgda/gda-data-handler.h>
#include "gdk/gdkkeysyms.h"
-#define MAX_ACCEPTED_STRING_LENGTH 500
+#define MAX_ACCEPTED_STRING_LENGTH 500U
/*
* Main static functions
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c b/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
index db4c8d0..5da3b2b 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
@@ -376,7 +376,7 @@ real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value)
static void truncate_entries_to_mask_length (GdauiEntryCidr *mgcidr, gboolean target_mask, guint mask_nb_bits)
{
- gint i, j;
+ guint i, j;
gchar *val;
guint mask, maskiter;
gint oldval, newval;
diff --git a/libgda-ui/demos/cloud.c b/libgda-ui/demos/cloud.c
index 0f8b2dc..1101780 100644
--- a/libgda-ui/demos/cloud.c
+++ b/libgda-ui/demos/cloud.c
@@ -25,7 +25,7 @@ selection_changed_cb (GdauiDataSelector *selector, G_GNUC_UNUSED gpointer data)
{
GString *string = NULL;
GArray *sel;
- gint i;
+ gsize i;
sel = gdaui_data_selector_get_selected_rows (selector);
if (sel) {
diff --git a/libgda-ui/demos/combo.c b/libgda-ui/demos/combo.c
index 774ffd3..efa0ac8 100644
--- a/libgda-ui/demos/combo.c
+++ b/libgda-ui/demos/combo.c
@@ -38,7 +38,7 @@ selection_changed_cb (GdauiDataSelector *selector, G_GNUC_UNUSED gpointer data)
{
GString *string = NULL;
GArray *sel;
- gint i;
+ gsize i;
sel = gdaui_data_selector_get_selected_rows (selector);
if (sel) {
diff --git a/libgda-ui/demos/main.c b/libgda-ui/demos/main.c
index dc25d20..0e67927 100644
--- a/libgda-ui/demos/main.c
+++ b/libgda-ui/demos/main.c
@@ -453,11 +453,11 @@ load_file (const gchar *filename)
q--;
if (q > p) {
- int len_chars = g_utf8_pointer_to_offset (p, q);
+ glong len_chars = g_utf8_pointer_to_offset (p, q);
end = start;
- g_assert (strlen (p) >= q - p);
+ g_assert (strlen (p) >= (gsize)(q - p));
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
start = end;
@@ -479,7 +479,7 @@ load_file (const gchar *filename)
state++;
}
else {
- int len;
+ gsize len;
while (*p == '*' || g_ascii_isspace (*p))
p++;
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 032ffcd..a98637c 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -640,7 +640,7 @@ disconnect_single_entry_signals (SingleEntry *sentry)
sd->holder = NULL;
}
if (sentry->group_signals) {
- gint i;
+ gsize i;
for (i = 0; i < sentry->group_signals->len; i++) {
SignalData sd = g_array_index (sentry->group_signals, SignalData,
i);
diff --git a/libgda-ui/gdaui-combo.c b/libgda-ui/gdaui-combo.c
index 4e4bad1..7dffeac 100644
--- a/libgda-ui/gdaui-combo.c
+++ b/libgda-ui/gdaui-combo.c
@@ -511,7 +511,7 @@ _gdaui_combo_set_selected (GdauiCombo *combo, const GSList *values)
{
g_return_val_if_fail (GDAUI_IS_COMBO (combo), FALSE);
g_return_val_if_fail (combo->priv->cols_index, FALSE);
- g_return_val_if_fail (g_slist_length ((GSList *) values) == combo->priv->n_cols, FALSE);
+ g_return_val_if_fail (g_slist_length ((GSList *) values) == (guint)combo->priv->n_cols, FALSE);
return _gdaui_combo_set_selected_ext (combo, values, combo->priv->cols_index);
}
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index e37ad42..f874501 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -315,7 +315,7 @@ gdaui_raw_grid_query_tooltip (GtkWidget *widget,
return FALSE;
gint position = 0;
- guint col_x = 0;
+ gint col_x = 0;
GList *list, *columns = gtk_tree_view_get_columns (tree_view);
for (list = columns; list; list = list->next) {
GtkTreeViewColumn *column = list->data;
diff --git a/libgda-ui/gdaui-tree-store.c b/libgda-ui/gdaui-tree-store.c
index 7c2ff3e..a289fd6 100644
--- a/libgda-ui/gdaui-tree-store.c
+++ b/libgda-ui/gdaui-tree-store.c
@@ -294,7 +294,7 @@ gdaui_tree_store_dispose (GObject *object)
if (store->priv) {
if (store->priv->column_specs) {
- gint i;
+ gsize i;
for (i = 0; i < store->priv->column_specs->len; i++) {
ColumnSpec *cs;
cs = g_array_index (store->priv->column_specs, ColumnSpec*, i);
@@ -403,7 +403,7 @@ gdaui_tree_store_new (GdaTree *tree, guint n_columns, ...)
{
GObject *obj;
va_list args;
- gint i;
+ guint i;
GdauiTreeStore *store;
g_return_val_if_fail (GDA_IS_TREE (tree), NULL);
@@ -450,7 +450,7 @@ GtkTreeModel *
gdaui_tree_store_newv (GdaTree *tree, guint n_columns, GType *types, const gchar **attribute_names)
{
GObject *obj;
- gint i;
+ guint i;
GdauiTreeStore *store;
g_return_val_if_fail (GDA_IS_TREE (tree), NULL);
diff --git a/libgda/dir-blob-op.c b/libgda/dir-blob-op.c
index f04220e..b8da5b0 100644
--- a/libgda/dir-blob-op.c
+++ b/libgda/dir-blob-op.c
@@ -207,7 +207,7 @@ gda_dir_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset, glong size)
}
bin->data = g_new0 (guchar, size);
nread = fread ((char *) (bin->data), 1, size, file);
- bin->binary_length = (nread >= 0) ? nread : 0;
+ bin->binary_length = nread;
fclose (file);
return nread;
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index 7f88f32..ed2524b 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -497,7 +497,7 @@ gda_config_constructor (GType type,
sync_keyring = TRUE;
#endif
- gint i;
+ guint i;
gboolean user_file_set = FALSE, system_file_set = FALSE;
object = G_OBJECT_CLASS (parent_class)->constructor (type,
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 794a9b4..7b0ec34 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -383,9 +383,11 @@ gda_connection_class_init (GdaConnectionClass *klass)
str = getenv ("GDA_CONNECTION_EVENTS_SHOW");
if (str) {
gchar **array;
- gint i;
+ guint i;
+ guint array_len;
array = g_strsplit_set (str, " ,/;:", 0);
- for (i = 0; i < g_strv_length (array); i++) {
+ array_len = g_strv_length (array);
+ for (i = 0; i < array_len; i++) {
if (!g_ascii_strcasecmp (array[i], "notice"))
debug_level += 1;
else if (!g_ascii_strcasecmp (array[i], "warning"))
@@ -504,7 +506,7 @@ gda_connection_dispose (GObject *object)
}
if (cnc->priv->completed_tasks) {
- gint i, len = cnc->priv->completed_tasks->len;
+ gssize i, len = cnc->priv->completed_tasks->len;
for (i = 0; i < len; i++)
cnc_task_free (CNC_TASK (g_array_index (cnc->priv->completed_tasks, gpointer, i)));
g_array_free (cnc->priv->completed_tasks, TRUE);
@@ -512,7 +514,7 @@ gda_connection_dispose (GObject *object)
}
if (cnc->priv->trans_meta_context) {
- gint i;
+ gsize i;
for (i = 0; i < cnc->priv->trans_meta_context->len; i++) {
GdaMetaContext *context;
context = g_array_index (cnc->priv->trans_meta_context, GdaMetaContext*, i);
@@ -767,7 +769,7 @@ gda_connection_set_property (GObject *object,
(GSourceFunc) monitor_wrapped_cnc,
cdata->wrapper);
/* steal signals for current thread */
- gint i;
+ gsize i;
for (i = 0; i < cdata->handlers_ids->len; i++) {
gulong id;
id = g_array_index (cdata->handlers_ids, gulong, i);
@@ -1566,7 +1568,7 @@ gda_connection_close_no_warning (GdaConnection *cnc)
GdaConnection *mscnc;
mscnc = gda_meta_store_get_internal_connection (cnc->priv->meta_store);
if (cnc != mscnc) {
- gint i;
+ gsize i;
for (i = 0; i < cnc->priv->trans_meta_context->len; i++) {
GdaMetaContext *context;
GError *lerror = NULL;
@@ -5680,7 +5682,7 @@ update_meta_store_after_statement_exec (GdaConnection *cnc, GdaStatement *stmt,
GdaConnection *mscnc;
mscnc = gda_meta_store_get_internal_connection (cnc->priv->meta_store);
if (cnc != mscnc) {
- gint i;
+ gsize i;
g_assert (cnc->priv->trans_meta_context);
for (i = 0; i < cnc->priv->trans_meta_context->len; i++) {
GdaMetaContext *context;
@@ -5700,7 +5702,7 @@ update_meta_store_after_statement_exec (GdaConnection *cnc, GdaStatement *stmt,
GdaConnection *mscnc;
mscnc = gda_meta_store_get_internal_connection (cnc->priv->meta_store);
if (cnc != mscnc) {
- gint i;
+ gsize i;
g_assert (cnc->priv->trans_meta_context);
for (i = 0; i < cnc->priv->trans_meta_context->len; i++) {
GdaMetaContext *context;
diff --git a/libgda/gda-data-comparator.c b/libgda/gda-data-comparator.c
index 71be08f..03cbd2c 100644
--- a/libgda/gda-data-comparator.c
+++ b/libgda/gda-data-comparator.c
@@ -202,7 +202,7 @@ static void
clean_diff (GdaDataComparator *comparator)
{
if (comparator->priv->diffs) {
- gint i;
+ gsize i;
for (i = 0; i < comparator->priv->diffs->len; i++) {
GdaDiff *diff = g_array_index (comparator->priv->diffs, GdaDiff *, i);
gda_diff_free (diff);
diff --git a/libgda/gda-data-model-array.c b/libgda/gda-data-model-array.c
index 4f28983..f505396 100644
--- a/libgda/gda-data-model-array.c
+++ b/libgda/gda-data-model-array.c
@@ -382,8 +382,9 @@ GdaRow *
gda_data_model_array_get_row (GdaDataModelArray *model, gint row, GError **error)
{
g_return_val_if_fail (GDA_IS_DATA_MODEL_ARRAY (model), NULL);
+ g_return_val_if_fail (row >= 0, NULL);
- if (row >= model->priv->rows->len) {
+ if ((guint)row >= model->priv->rows->len) {
if (model->priv->rows->len > 0)
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
_("Row %d out of range (0-%d)"), row,
@@ -524,13 +525,15 @@ gda_data_model_array_get_value_at (GdaDataModel *model, gint col, gint row, GErr
GdaRow *fields;
GdaDataModelArray *amodel = (GdaDataModelArray*) model;
+ g_return_val_if_fail(row >= 0, NULL);
+
if (amodel->priv->rows->len == 0) {
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
"%s", _("No row in data model"));
return NULL;
}
- if (row >= amodel->priv->rows->len) {
+ if ((guint)row >= amodel->priv->rows->len) {
if (amodel->priv->rows->len > 0)
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
_("Row %d out of range (0-%d)"), row, amodel->priv->rows->len - 1);
@@ -617,7 +620,7 @@ gda_data_model_array_set_value_at (GdaDataModel *model, gint col, gint row,
return FALSE;
}
- if (row > amodel->priv->rows->len) {
+ if ((guint)row > amodel->priv->rows->len) {
if (amodel->priv->rows->len > 0)
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUES_LIST_ERROR,
_("Row %d out of range (0-%d)"), row, amodel->priv->rows->len - 1);
@@ -661,7 +664,7 @@ gda_data_model_array_set_values (GdaDataModel *model, gint row, GList *values, G
return FALSE;
}
- if (g_list_length (values) > gda_data_model_get_n_columns (model)) {
+ if (g_list_length (values) > (guint)gda_data_model_get_n_columns (model)) {
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUES_LIST_ERROR,
"%s", _("Too many values in list"));
return FALSE;
@@ -700,7 +703,7 @@ gda_data_model_array_append_values (GdaDataModel *model, const GList *values, GE
return FALSE;
}
- if (g_list_length ((GList *) values) > amodel->priv->number_of_columns) {
+ if (g_list_length ((GList *) values) > (guint)amodel->priv->number_of_columns) {
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUES_LIST_ERROR,
"%s", _("Too many values in list"));
return FALSE;
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index 7c2ee4a..1687e11 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -627,7 +627,7 @@ update_data_model (GdaDataModelDir *model)
update_data_model_real (model, "");
/* clean extra rows */
- gint i;
+ gsize i;
for (i = model->priv->upd_row + 1; i < model->priv->rows->len; i++) {
FileRow *row = g_ptr_array_index (model->priv->rows, model->priv->rows->len - 1);
file_row_free (row);
@@ -769,6 +769,7 @@ gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row, GError
FileRow *frow;
g_return_val_if_fail (GDA_IS_DATA_MODEL_DIR (model), NULL);
+ g_return_val_if_fail (row >= 0, NULL);
imodel = GDA_DATA_MODEL_DIR (model);
g_return_val_if_fail (imodel->priv, NULL);
@@ -782,7 +783,7 @@ gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row, GError
return NULL;
}
- if (row >= imodel->priv->rows->len) {
+ if ((guint)row >= imodel->priv->rows->len) {
gchar *str;
if (imodel->priv->rows->len > 0)
str = g_strdup_printf (_("Row %d out of range (0-%d)"), row,
@@ -949,12 +950,13 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
gboolean has_changed = FALSE;
g_return_val_if_fail (GDA_IS_DATA_MODEL_DIR (model), FALSE);
+ g_return_val_if_fail (row >= 0, FALSE);
imodel = (GdaDataModelDir *) model;
g_return_val_if_fail (imodel->priv, FALSE);
if (!values)
return TRUE;
- if (row >= imodel->priv->rows->len) {
+ if ((guint)row >= imodel->priv->rows->len) {
gchar *str;
if (imodel->priv->rows->len > 0)
str = g_strdup_printf (_("Row %d out of range (0-%d)"), row,
@@ -1305,10 +1307,11 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
FileRow *frow;
g_return_val_if_fail (GDA_IS_DATA_MODEL_DIR (model), FALSE);
+ g_return_val_if_fail (row >=0, FALSE);
imodel = (GdaDataModelDir *) model;
g_return_val_if_fail (imodel->priv, FALSE);
- if (row >= imodel->priv->rows->len) {
+ if ((guint)row >= imodel->priv->rows->len) {
gchar *str;
if (imodel->priv->rows->len > 0)
str = g_strdup_printf (_("Row %d out of range (0-%d)"), row,
diff --git a/libgda/gda-data-model-import.c b/libgda/gda-data-model-import.c
index 8b7937a..1105be2 100644
--- a/libgda/gda-data-model-import.c
+++ b/libgda/gda-data-model-import.c
@@ -307,7 +307,7 @@ gda_data_model_import_init (GdaDataModelImport *model, G_GNUC_UNUSED GdaDataMode
static void
csv_free_stored_rows (GdaDataModelImport *model)
{
- gint i;
+ gsize i;
g_assert (model->priv->format == FORMAT_CSV);
for (i = 0; i < model->priv->extract.csv.rows_read->len; i++) {
GSList *list = g_array_index (model->priv->extract.csv.rows_read,
diff --git a/libgda/gda-data-model.c b/libgda/gda-data-model.c
index a43de87..0533888 100644
--- a/libgda/gda-data-model.c
+++ b/libgda/gda-data-model.c
@@ -1494,7 +1494,7 @@ add_xml_row (GdaDataModel *model, xmlNodePtr xml_row, GError **error)
xmlNodePtr xml_field;
GList *value_list = NULL;
GPtrArray *values;
- gint i;
+ gsize i;
gboolean retval = TRUE;
gint pos = 0;
@@ -2196,7 +2196,7 @@ real_gda_data_model_dump_as_string (GdaDataModel *model, gboolean dump_attribute
if (! dump_attributes) {
value = gda_data_model_get_value_at (model, i, j, NULL);
if (!value) {
- cols_size [i + col_offset] = MAX (cols_size [i + col_offset], strlen (ERROR_STRING));
+ cols_size [i + col_offset] = MAX ((guint)cols_size [i + col_offset], strlen (ERROR_STRING));
}
else {
str = NULL;
@@ -2231,7 +2231,7 @@ real_gda_data_model_dump_as_string (GdaDataModel *model, gboolean dump_attribute
const gchar *title;
title = g_object_get_data (G_OBJECT (model), "name");
if (title) {
- gint total_width = n_cols -1, i;
+ gsize total_width = n_cols -1;
for (i = 0; i < n_cols; i++)
total_width += cols_size [i];
diff --git a/libgda/gda-data-proxy.c b/libgda/gda-data-proxy.c
index ea0a1d2..40168cb 100644
--- a/libgda/gda-data-proxy.c
+++ b/libgda/gda-data-proxy.c
@@ -318,7 +318,7 @@ proxy_row_to_absolute_row (GdaDataProxy *proxy, gint proxy_row)
proxy_row--;
}
if (proxy->priv->chunk) {
- if (proxy_row < proxy->priv->chunk->mapping->len)
+ if ((guint)proxy_row < proxy->priv->chunk->mapping->len)
return g_array_index (proxy->priv->chunk->mapping, gint, proxy_row);
else
return -1;
@@ -327,7 +327,7 @@ proxy_row_to_absolute_row (GdaDataProxy *proxy, gint proxy_row)
if (proxy->priv->chunk_to &&
proxy->priv->chunk_to->mapping &&
(proxy_row < proxy->priv->chunk_sep) &&
- (proxy_row < proxy->priv->chunk_to->mapping->len))
+ ((guint)proxy_row < proxy->priv->chunk_to->mapping->len))
return g_array_index (proxy->priv->chunk_to->mapping, gint, proxy_row);
else
return proxy_row;
@@ -371,7 +371,7 @@ absolute_row_to_proxy_row (GdaDataProxy *proxy, gint abs_row)
}
if (proxy->priv->chunk) {
- gint i;
+ gsize i;
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
if (g_array_index (proxy->priv->chunk->mapping, gint, i) == abs_row) {
proxy_row = i;
@@ -1022,7 +1022,8 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
/* internal cleanups: update chunk and chunk_to arrays */
if (proxy->priv->chunk) {
- gint i, *v;
+ gsize i;
+ gint *v;
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
@@ -1031,7 +1032,8 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
}
}
if (proxy->priv->chunk_to && proxy->priv->chunk->mapping) {
- gint i, *v;
+ gsize i;
+ gint *v;
for (i = 0; i < proxy->priv->chunk_to->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk_to->mapping, gint, i);
@@ -1099,7 +1101,8 @@ proxied_model_row_removed_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDa
/* internal cleanups: update chunk and chunk_to arrays */
if (proxy->priv->chunk) {
- gint i, *v, remove_index = -1;
+ gsize i;
+ gint *v, remove_index = -1;
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
@@ -1116,7 +1119,8 @@ proxied_model_row_removed_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDa
proxy->priv->chunk_sep--;
}
if (proxy->priv->chunk_to && proxy->priv->chunk->mapping) {
- gint i, *v, remove_index = -1;
+ guint i;
+ gint *v, remove_index = -1;
for (i = 0; i < proxy->priv->chunk_to->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk_to->mapping, gint, i);
@@ -1559,7 +1563,8 @@ gda_data_proxy_delete (GdaDataProxy *proxy, gint proxy_row)
if (proxy->priv->chunk) {
/* Update chunk */
- gint i, *v;
+ gsize i;
+ gint *v;
gint row_cmp = proxy_row - (proxy->priv->add_null_entry ? 1 : 0);
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
@@ -1835,7 +1840,8 @@ gda_data_proxy_cancel_row_changes (GdaDataProxy *proxy, gint proxy_row, gint col
if (rm->model_row < 0) {
if (proxy->priv->chunk) {
/* Update chunk */
- gint i, *v, abs_row;
+ gsize i;
+ gint *v, abs_row;
gint row_cmp = proxy_row - (proxy->priv->add_null_entry ? 1 : 0);
abs_row = proxy_row_to_absolute_row (proxy, proxy_row);
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
@@ -2384,8 +2390,7 @@ chunk_sync_idle (GdaDataProxy *proxy)
gda_mutex_lock (proxy->priv->mutex);
gboolean finished = FALSE;
- gint index;
- gint step, max_steps;
+ guint index, max_steps, step;
GdaDataModelIter *iter = NULL;
gint signal_row_offset = proxy->priv->add_null_entry ? 1 : 0;
@@ -2691,7 +2696,7 @@ adjust_displayed_chunk (GdaDataProxy *proxy)
if (proxy->priv->chunk && proxy->priv->chunk_to->mapping) {
/* compare the 2 chunks */
if (proxy->priv->chunk->mapping->len == proxy->priv->chunk_to->mapping->len) {
- gint i;
+ gsize i;
equal = TRUE;
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
if (g_array_index (proxy->priv->chunk->mapping, gint, i) !=
@@ -3786,7 +3791,7 @@ gda_data_proxy_set_values (GdaDataModel *model, gint row, GList *values, GError
if (!values)
return TRUE;
- g_return_val_if_fail (g_list_length (values) <= gda_data_proxy_get_n_columns (model) , FALSE);
+ g_return_val_if_fail (g_list_length (values) <= gda_data_proxy_get_n_columns (model), FALSE);
/* check values */
col = 0;
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index b646ac4..32d2457 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -381,7 +381,7 @@ free_private_shared_data (GdaDataSelect *model)
model->priv->sh->ref_count --;
if (model->priv->sh->ref_count == 0) {
- gint i;
+ guint i;
if (model->priv->sh->sel_stmt) {
g_object_unref (model->priv->sh->sel_stmt);
@@ -1631,7 +1631,7 @@ external_to_internal_row (GdaDataSelect *model, gint ext_row, GError **error)
/* row number alteration: deleted rows */
if (model->priv->sh->del_rows) {
gint i;
- for (i = 0; i < model->priv->sh->del_rows->len; i++) {
+ for (i = 0; (guint)i < model->priv->sh->del_rows->len; i++) {
gint indexed = g_array_index (model->priv->sh->del_rows, gint, i);
if (indexed <= ext_row + i)
int_row += 1;
@@ -2993,7 +2993,8 @@ static gboolean
gda_data_select_remove_row (GdaDataModel *model, gint row, GError **error)
{
GdaDataSelect *imodel;
- gint int_row, i, ncols, index;
+ guint i, ncols;
+ gint int_row, index;
GdaHolder *holder;
gchar *str;
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 17b139e..1cea7e5 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -543,7 +543,7 @@ gda_meta_store_constructor (GType type,
GObjectConstructParam *construct_properties)
{
GObject *object;
- gint i;
+ guint i;
GdaMetaStore *store;
gboolean been_specified = FALSE;
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index 00a23d9..20ff1e1 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -796,7 +796,7 @@ gda_server_provider_string_to_value (GdaServerProvider *provider, GdaConnection
{
GValue *retval = NULL;
GdaDataHandler *dh;
- gint i;
+ gsize i;
g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
g_return_val_if_fail (!cnc || GDA_IS_CONNECTION (cnc), NULL);
diff --git a/libgda/gda-set.c b/libgda/gda-set.c
index 893db08..ad08ea1 100644
--- a/libgda/gda-set.c
+++ b/libgda/gda-set.c
@@ -1474,6 +1474,8 @@ GdaHolder *
gda_set_get_nth_holder (GdaSet *set, gint pos)
{
g_return_val_if_fail (GDA_IS_SET (set), NULL);
+ g_return_val_if_fail (pos >= 0, NULL);
+
if (! set->priv->holders_array) {
GSList *list;
set->priv->holders_array = g_array_sized_new (FALSE, FALSE, sizeof (GdaHolder*),
@@ -1481,7 +1483,7 @@ gda_set_get_nth_holder (GdaSet *set, gint pos)
for (list = set->holders; list; list = list->next)
g_array_append_val (set->priv->holders_array, list->data);
}
- if ((pos < 0) || (pos > set->priv->holders_array->len))
+ if ((guint)pos > set->priv->holders_array->len)
return NULL;
else
return g_array_index (set->priv->holders_array, GdaHolder*, pos);
diff --git a/libgda/gda-tree.c b/libgda/gda-tree.c
index f24b599..7952303 100644
--- a/libgda/gda-tree.c
+++ b/libgda/gda-tree.c
@@ -601,7 +601,7 @@ gda_tree_get_node_path (GdaTree *tree, GdaTreeNode *node)
if (build_node_path (tree, node, array))
str = g_strjoinv (":", (gchar **) array->data);
- gint i;
+ gsize i;
for (i = 0; i < array->len; i++)
g_free (g_array_index (array, gchar *, i));
g_array_free (array, TRUE);
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index 492721f..536dbd7 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -1610,11 +1610,11 @@ gda_completion_list_get (GdaConnection *cnc, const gchar *sql, gint start, gint
/*
* start of a statement => complete with SQL start of statement words
*/
- gint len;
- gint i;
+ gsize len;
+ gsize i;
len = strlen (text);
for (i = 0; i < (sizeof (sql_start_words) / sizeof (gchar*)); i++) {
- gint clen = strlen (sql_start_words[i]);
+ gsize clen = strlen (sql_start_words[i]);
if (!g_ascii_strncasecmp (sql_start_words[i], text, MIN (clen, len))) {
gchar *str;
str = g_strdup (sql_start_words[i]);
@@ -1766,11 +1766,11 @@ gda_completion_list_get (GdaConnection *cnc, const gchar *sql, gint start, gint
* middle of a statement and no completion yet => complete with SQL statement words
*/
{
- gint len;
- gint i;
+ gsize len;
+ gsize i;
len = strlen (text);
for (i = 0; i < (sizeof (sql_middle_words) / sizeof (gchar*)); i++) {
- gint clen = strlen (sql_middle_words[i]);
+ gsize clen = strlen (sql_middle_words[i]);
if (!g_ascii_strncasecmp (sql_middle_words[i], text, MIN (clen, len))) {
gchar *str;
str = g_strdup (sql_middle_words[i]);
@@ -1784,7 +1784,7 @@ gda_completion_list_get (GdaConnection *cnc, const gchar *sql, gint start, gint
if (compl) {
if (compl->len >= 1) {
/* sort */
- gint i;
+ gsize i;
g_array_sort (compl, cmp_func);
/* remove duplicates if any */
@@ -2212,7 +2212,7 @@ gda_rfc1738_encode (const gchar *string)
{
gchar *ret, *wptr;
const gchar *rptr;
- gint i;
+ gsize i;
if (!string)
return NULL;
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index c135f22..89d6ade 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -964,9 +964,9 @@ gda_time_valid (const GdaTime *time)
{
g_return_val_if_fail (time, FALSE);
- if (time->hour < 0 || time->hour > 24 ||
- time->minute < 0 || time->minute > 59 ||
- time->second < 0 || time->second > 59)
+ if (time->hour > 24 ||
+ time->minute > 59 ||
+ time->second > 59)
return FALSE;
else
return TRUE;
@@ -1113,9 +1113,9 @@ gda_timestamp_valid (const GdaTimestamp *timestamp)
g_date_free (gdate);
/* check the time part */
- if (timestamp->hour < 0 || timestamp->hour > 24 ||
- timestamp->minute < 0 || timestamp->minute > 59 ||
- timestamp->second < 0 || timestamp->second > 59)
+ if (timestamp->hour > 24 ||
+ timestamp->minute > 59 ||
+ timestamp->second > 59)
return FALSE;
else
return TRUE;
@@ -2593,7 +2593,7 @@ gda_binary_to_string (const GdaBinary *bin, guint maxlen)
gulong realsize = MYMIN (bin->binary_length, maxlen);
gchar *retval;
- glong offset = 0;
+ gulong offset = 0;
if (!bin->data || (bin->binary_length == 0))
return g_strdup ("");
diff --git a/libgda/sql-parser/gda-statement-struct-insert.c b/libgda/sql-parser/gda-statement-struct-insert.c
index 290b324..8635b81 100644
--- a/libgda/sql-parser/gda-statement-struct-insert.c
+++ b/libgda/sql-parser/gda-statement-struct-insert.c
@@ -345,7 +345,7 @@ static gboolean
gda_sql_statement_insert_check_structure (GdaSqlAnyPart *stmt, G_GNUC_UNUSED gpointer data, GError **error)
{
GdaSqlStatementInsert *insert = (GdaSqlStatementInsert *) stmt;
- gint nb_values;
+ guint nb_values;
GSList *list;
if (!stmt) return TRUE;
@@ -362,15 +362,17 @@ gda_sql_statement_insert_check_structure (GdaSqlAnyPart *stmt, G_GNUC_UNUSED gpo
return FALSE;
}
if (nb_values > 0) {
- gint len;
+ guint len;
if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_SELECT) {
GdaSqlStatementSelect *select = (GdaSqlStatementSelect*) insert->select;
len = g_slist_length (select->expr_list);
}
else if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_COMPOUND) {
+ gint compound_len;
GdaSqlStatementCompound *compound = (GdaSqlStatementCompound*) insert->select;
- len = _gda_sql_statement_compound_get_n_cols (compound, error);
- if (len < 0)
+ compound_len = _gda_sql_statement_compound_get_n_cols (compound, error);
+ len = compound_len;
+ if (compound_len < 0)
return FALSE;
}
else
diff --git a/libgda/sqlite/gda-sqlite-meta.c b/libgda/sqlite/gda-sqlite-meta.c
index 36cc47c..2911a7b 100644
--- a/libgda/sqlite/gda-sqlite-meta.c
+++ b/libgda/sqlite/gda-sqlite-meta.c
@@ -260,7 +260,7 @@ _gda_sqlite_meta__btypes (G_GNUC_UNUSED GdaServerProvider *prov, G_GNUC_UNUSED G
{
GdaDataModel *mod_model;
gboolean retval = TRUE;
- gint i;
+ gsize i;
typedef struct {
gchar *tname;
gchar *gtype;
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 9a0faa0..07db2d5 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -857,7 +857,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
}
if (use_extra_functions && ((*use_extra_functions == 't') || (*use_extra_functions == 'T'))) {
- int i;
+ gsize i;
for (i = 0; i < sizeof (scalars) / sizeof (ScalarFunction); i++) {
ScalarFunction *func = (ScalarFunction *) &(scalars [i]);
@@ -2677,7 +2677,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
else if (G_VALUE_TYPE (value) == G_TYPE_UCHAR)
SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, g_value_get_uchar (value));
else if (G_VALUE_TYPE (value) == GDA_TYPE_BLOB) {
- gulong blob_len;
+ glong blob_len;
GdaBlob *blob = (GdaBlob*) gda_value_get_blob (value);
const gchar *str = NULL;
@@ -3105,7 +3105,7 @@ scalar_gda_hex_func2 (sqlite3_context *context, int argc, sqlite3_value **argv)
gint length;
GString *string;
gint i;
- gint size;
+ guint size;
if (argc != 2) {
SQLITE3_CALL (sqlite3_result_error) (context, _("Function requires two arguments"), -1);
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 4ce0d84..222a158 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -544,7 +544,7 @@ virtual_table_manage_real_data_model (VirtualTable *vtable)
if (vtable->td->columns) {
/* columns */
GList *list;
- gint i, ncols;
+ guint i, ncols;
ncols = gda_data_model_get_n_columns (vtable->td->real_model);
g_assert (ncols == g_list_length (vtable->td->columns));
for (i = 0, list = vtable->td->columns;
diff --git a/libgda/thread-wrapper/gda-thread-provider.c b/libgda/thread-wrapper/gda-thread-provider.c
index 93f64af..8ef2b91 100644
--- a/libgda/thread-wrapper/gda-thread-provider.c
+++ b/libgda/thread-wrapper/gda-thread-provider.c
@@ -2093,7 +2093,7 @@ gda_thread_free_cnc_data (ThreadConnectionData *cdata)
return;
/* disconnect signals handlers */
- gint i;
+ gsize i;
for (i = 0; i < cdata->handlers_ids->len; i++) {
gulong hid = g_array_index (cdata->handlers_ids, gulong, i);
gda_thread_wrapper_disconnect (cdata->wrapper, hid);
diff --git a/libgda/thread-wrapper/gda-thread-wrapper.c b/libgda/thread-wrapper/gda-thread-wrapper.c
index 1e3053e..8c87e07 100644
--- a/libgda/thread-wrapper/gda-thread-wrapper.c
+++ b/libgda/thread-wrapper/gda-thread-wrapper.c
@@ -99,7 +99,7 @@ job_free (Job *job)
g_error_free (job->u.exe.error);
}
else if (job->type == JOB_TYPE_SIGNAL) {
- gint i;
+ guint i;
for (i = 0; i < job->u.signal.n_param_values; i++) {
GValue *value = job->u.signal.param_values + i;
if (G_VALUE_TYPE (value) != GDA_TYPE_NULL)
@@ -835,7 +835,7 @@ gda_thread_wrapper_fetch_result (GdaThreadWrapper *wrapper, gboolean may_lock, g
if (may_lock)
gda_thread_wrapper_iterate (wrapper, TRUE);
else {
- gint len;
+ gsize len;
len = g_slist_length (td->results);
gda_thread_wrapper_iterate (wrapper, FALSE);
if (g_slist_length (td->results) == len) {
@@ -922,7 +922,7 @@ worker_thread_closure_marshal (GClosure *closure,
g_static_private_get (&worker_thread_current_queue) != sigspec->reply_queue)
return;
- gint i;
+ gsize i;
/*
for (i = 1; i < n_param_values; i++) {
g_print ("\t%d => %s\n", i, gda_value_stringify (param_values + i));
@@ -964,7 +964,7 @@ worker_thread_closure_marshal_anythread (GClosure *closure,
{
SignalSpec *sigspec = (SignalSpec *) closure->data;
- gint i;
+ gsize i;
/*
for (i = 1; i < n_param_values; i++) {
g_print ("\t%d => %s\n", i, gda_value_stringify (param_values + i));
diff --git a/providers/bdb/gda-bdb-test.c b/providers/bdb/gda-bdb-test.c
index 660025c..74ec25c 100644
--- a/providers/bdb/gda-bdb-test.c
+++ b/providers/bdb/gda-bdb-test.c
@@ -30,7 +30,8 @@ static void
create_db (const gchar *filename)
{
DB *dbp;
- int ret, i;
+ gint ret;
+ gsize i;
g_print ("Creating BDB database in '%s'\n", filename);
g_assert (db_create (&dbp, NULL, 0) == 0);
diff --git a/providers/jdbc/GdaJBlobOp.c b/providers/jdbc/GdaJBlobOp.c
index 37e76a1..412f051 100644
--- a/providers/jdbc/GdaJBlobOp.c
+++ b/providers/jdbc/GdaJBlobOp.c
@@ -14,7 +14,7 @@ JniWrapperMethod *GdaJBlobOp__length = NULL;
JNIEXPORT void
JNICALL Java_GdaJBlobOp_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJColumnInfos.c b/providers/jdbc/GdaJColumnInfos.c
index bb90574..fa89c2d 100644
--- a/providers/jdbc/GdaJColumnInfos.c
+++ b/providers/jdbc/GdaJColumnInfos.c
@@ -14,7 +14,7 @@ JniWrapperField *GdaJColumnInfos__col_type = NULL;
JNIEXPORT void
JNICALL Java_GdaJColumnInfos_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJConnection.c b/providers/jdbc/GdaJConnection.c
index ce62e1a..5979e78 100644
--- a/providers/jdbc/GdaJConnection.c
+++ b/providers/jdbc/GdaJConnection.c
@@ -24,7 +24,7 @@ JniWrapperMethod *GdaJConnection__getJMeta = NULL;
JNIEXPORT void
JNICALL Java_GdaJConnection_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJMeta.c b/providers/jdbc/GdaJMeta.c
index eae5a5b..99a0eb1 100644
--- a/providers/jdbc/GdaJMeta.c
+++ b/providers/jdbc/GdaJMeta.c
@@ -16,7 +16,7 @@ JniWrapperMethod *GdaJMeta__getColumns = NULL;
JNIEXPORT void
JNICALL Java_GdaJMeta_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJPStmt.c b/providers/jdbc/GdaJPStmt.c
index 0c47528..ec6e824 100644
--- a/providers/jdbc/GdaJPStmt.c
+++ b/providers/jdbc/GdaJPStmt.c
@@ -17,7 +17,7 @@ JniWrapperMethod *GdaJPStmt__setParameterValue = NULL;
JNIEXPORT void
JNICALL Java_GdaJPStmt_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJProvider.c b/providers/jdbc/GdaJProvider.c
index fbb3d86..a2240cc 100644
--- a/providers/jdbc/GdaJProvider.c
+++ b/providers/jdbc/GdaJProvider.c
@@ -14,7 +14,7 @@ JniWrapperMethod *GdaJProvider__openConnection = NULL;
JNIEXPORT void
JNICALL Java_GdaJProvider_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJResultSet.c b/providers/jdbc/GdaJResultSet.c
index d2e6dfa..d3b86af 100644
--- a/providers/jdbc/GdaJResultSet.c
+++ b/providers/jdbc/GdaJResultSet.c
@@ -14,7 +14,7 @@ JniWrapperMethod *GdaJResultSet__fillNextRow = NULL;
JNIEXPORT void
JNICALL Java_GdaJResultSet_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJResultSetInfos.c b/providers/jdbc/GdaJResultSetInfos.c
index 304a669..689c069 100644
--- a/providers/jdbc/GdaJResultSetInfos.c
+++ b/providers/jdbc/GdaJResultSetInfos.c
@@ -13,7 +13,7 @@ JniWrapperMethod *GdaJResultSetInfos__describeColumn = NULL;
JNIEXPORT void
JNICALL Java_GdaJResultSetInfos_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/GdaJValue.c b/providers/jdbc/GdaJValue.c
index 9c38ea4..f6fee73 100644
--- a/providers/jdbc/GdaJValue.c
+++ b/providers/jdbc/GdaJValue.c
@@ -19,7 +19,7 @@ static JniWrapperMethod *GdaJValue__createTimestamp = NULL;
JNIEXPORT void
JNICALL Java_GdaJValue_initIDs (JNIEnv *env, jclass klass)
{
- gint i;
+ gsize i;
typedef struct {
const gchar *name;
const gchar *sig;
diff --git a/providers/jdbc/libmain.c b/providers/jdbc/libmain.c
index d5aa7bb..30a95af 100644
--- a/providers/jdbc/libmain.c
+++ b/providers/jdbc/libmain.c
@@ -561,7 +561,7 @@ get_database_name_from_driver_name (const gchar *driver_name)
{"com.mysql.jdbc.Driver", "MySQL"}
};
- gint i;
+ gsize i;
for (i = 0; i < sizeof (carray) / sizeof (Corresp); i++) {
if (!strcmp (carray[i].jdbc_name, driver_name))
return carray[i].db_name;
diff --git a/providers/reuseable/mysql/gda-mysql-meta.c b/providers/reuseable/mysql/gda-mysql-meta.c
index 97c0db0..6bf9fe8 100644
--- a/providers/reuseable/mysql/gda-mysql-meta.c
+++ b/providers/reuseable/mysql/gda-mysql-meta.c
@@ -374,7 +374,7 @@ _gda_mysql_meta__btypes (G_GNUC_UNUSED GdaServerProvider *prov,
if (model == NULL)
retval = FALSE;
else {
- gint i;
+ gsize i;
for (i = 0; i < sizeof(data_types) / sizeof(BuiltinDataType); ++i) {
BuiltinDataType *data_type = &(data_types[i]);
GList *values = NULL;
diff --git a/testing/gda-provider-status.c b/testing/gda-provider-status.c
index faf33d9..02f9ae8 100644
--- a/testing/gda-provider-status.c
+++ b/testing/gda-provider-status.c
@@ -336,7 +336,7 @@ report_provider_status (GdaServerProvider *prov, GdaConnection *cnc)
xmlNodePtr table, tr, td, span;
GdaSqlParser *parser;
GString *string;
- gint i;
+ gsize i;
GdaProviderInfo *pinfo;
pinfo = gda_config_get_provider_info (gda_server_provider_get_name (prov));
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index 403af2b..5ca9fa1 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -473,7 +473,7 @@ static void
create_plugin_nb (GtkWidget *table, GdauiPlugin *plugin)
{
GtkWidget *wid, *nb, *label;
- gint i;
+ gsize i;
GType type;
GdaDataHandler *dh;
@@ -487,7 +487,7 @@ create_plugin_nb (GtkWidget *table, GdauiPlugin *plugin)
g_object_set_data (G_OBJECT (table), "nb", nb);
g_object_set_data (G_OBJECT (table), "plugin", plugin);
- if (plugin->nb_g_types > 0)
+ if (plugin->nb_g_types > 0) {
for (i = 0; i < plugin->nb_g_types; i++) {
type = plugin->valid_g_types[i];
dh = get_handler (type);
@@ -510,9 +510,11 @@ create_plugin_nb (GtkWidget *table, GdauiPlugin *plugin)
G_CALLBACK (vbox_destroyed_cb), NULL);
}
}
- else
- for (i = 0; i < mainconf.nb_tested_gtypes; i++) {
- type = mainconf.tested_gtypes [i];
+ }
+ else {
+ gint j;
+ for (j = 0; j < mainconf.nb_tested_gtypes; j++) {
+ type = mainconf.tested_gtypes [j];
dh = get_handler (type);
if (dh) {
TestWidgetData *tdata;
@@ -533,6 +535,7 @@ create_plugin_nb (GtkWidget *table, GdauiPlugin *plugin)
G_CALLBACK (vbox_destroyed_cb), NULL);
}
}
+ }
}
static void
diff --git a/testing/gdaui-test-widget-entry.c b/testing/gdaui-test-widget-entry.c
index 1afab99..1f69db4 100644
--- a/testing/gdaui-test-widget-entry.c
+++ b/testing/gdaui-test-widget-entry.c
@@ -13,8 +13,7 @@ print_unicode (const gchar *ptr)
{
gunichar wc;
wc = g_utf8_get_char_validated (ptr, -1);
- g_assert (wc >= 0);
- g_print ("%s <=> %u, IS_print: %d\n", ptr, wc, g_unichar_isprint (wc));
+ g_print ("%s <=> %" G_GUINT32_FORMAT ", IS_print: %d\n", ptr, wc, g_unichar_isprint (wc));
}
static void
@@ -37,7 +36,8 @@ static void
prop_length_set_cb (G_GNUC_UNUSED GtkButton *button, GdauiEntry *entry)
{
gchar *tmp;
- gint max, i;
+ gint max;
+ gsize i;
tmp = gdaui_entry_get_text (entry);
max = atoi (tmp);
g_free (tmp);
@@ -52,7 +52,7 @@ static void
prop_text_set_cb (G_GNUC_UNUSED GtkButton *button, GdauiEntry *entry)
{
gchar *tmp;
- gint i;
+ gsize i;
tmp = gdaui_entry_get_text (entry);
g_print ("Setting entries' text to [%s]\n", tmp);
for (i = 0; i < NB_ENTRIES; i++)
@@ -64,7 +64,7 @@ prop_text_set_cb (G_GNUC_UNUSED GtkButton *button, GdauiEntry *entry)
static void
prop_text_null_cb (G_GNUC_UNUSED GtkButton *button, G_GNUC_UNUSED gpointer data)
{
- gint i;
+ gsize i;
g_print ("Setting entries' text to NULL\n");
for (i = 0; i < NB_ENTRIES; i++)
diff --git a/tests/data-model-errors.c b/tests/data-model-errors.c
index 6680d35..395caa5 100644
--- a/tests/data-model-errors.c
+++ b/tests/data-model-errors.c
@@ -103,7 +103,7 @@ static void
data_model_errors_init (DataModelErrors *model,
G_GNUC_UNUSED DataModelErrorsClass *klass)
{
- gint i;
+ gsize i;
g_return_if_fail (IS_DATA_MODEL_ERRORS (model));
model->priv = g_new0 (DataModelErrorsPrivate, 1);
@@ -115,7 +115,7 @@ data_model_errors_init (DataModelErrors *model,
gchar *str;
col = gda_column_new ();
gda_column_set_g_type (col, G_TYPE_STRING);
- str = g_strdup_printf ("col%d", i);
+ str = g_strdup_printf ("col%" G_GSIZE_FORMAT, i);
gda_column_set_name (col, str);
gda_column_set_description (col, str);
g_object_set (G_OBJECT (col), "id", str, NULL);
diff --git a/tools/browser/browser-favorites.c b/tools/browser/browser-favorites.c
index 7f1792f..ac3bc4b 100644
--- a/tools/browser/browser-favorites.c
+++ b/tools/browser/browser-favorites.c
@@ -1026,7 +1026,7 @@ browser_favorites_delete (BrowserFavorites *bfav, guint session_id,
gda_lockable_unlock (GDA_LOCKABLE (bfav->priv->store_cnc));
if (retval)
g_signal_emit (bfav, browser_favorites_signals [FAV_CHANGED],
- g_quark_from_string (favorite_type_to_string (efav.type >= 0 ? efav.type : fav->type)));
+ g_quark_from_string (favorite_type_to_string (efav.type)));
browser_favorites_reset_attributes (&efav);
if (params)
g_object_unref (G_OBJECT (params));
diff --git a/tools/browser/data-manager/data-source-editor.c b/tools/browser/data-manager/data-source-editor.c
index 4cc8ae5..85b8136 100644
--- a/tools/browser/data-manager/data-source-editor.c
+++ b/tools/browser/data-manager/data-source-editor.c
@@ -262,7 +262,7 @@ update_dependencies_display (DataSourceEditor *editor)
"section", NULL);
gtk_text_buffer_insert (tbuffer, &start, "\n", -1);
if (export) {
- gint i;
+ gsize i;
for (i = 0; i < export->len ; i++) {
gchar *tmp;
tmp = g_array_index (export, gchar *, i);
diff --git a/tools/browser/data-manager/data-source-manager.c b/tools/browser/data-manager/data-source-manager.c
index 46ccd0a..ad15da4 100644
--- a/tools/browser/data-manager/data-source-manager.c
+++ b/tools/browser/data-manager/data-source-manager.c
@@ -530,11 +530,11 @@ data_source_manager_get_sources_array (DataSourceManager *mgr, G_GNUC_UNUSED GEr
}
if (array) {
- gint i;
+ gssize i;
gboolean dep_found = FALSE;
for (i = array->len - 1; i >= 0 ; i--) {
GArray *subarray = g_array_index (array, GArray*, i);
- gint j;
+ gsize j;
for (j = 0; j < subarray->len; j++) {
DataSource *source2 = g_array_index (subarray, DataSource*, j);
if (source_depends_on (source, source2)) {
@@ -547,7 +547,7 @@ data_source_manager_get_sources_array (DataSourceManager *mgr, G_GNUC_UNUSED GEr
g_array_append_val (subarray, source);
}
else {
- gint k;
+ gsize k;
GArray *subarray = g_array_index (array, GArray*, i+1);
for (k = 0; k < subarray->len; k++) {
DataSource *source3 = g_array_index (subarray,
@@ -605,12 +605,12 @@ data_source_manager_get_sources_array (DataSourceManager *mgr, G_GNUC_UNUSED GEr
void
data_source_manager_destroy_sources_array (GArray *array)
{
- gint i;
+ gsize i;
g_return_if_fail (array);
for (i = 0; i < array->len; i++) {
GArray *subarray;
subarray = g_array_index (array, GArray *, i);
- gint j;
+ gsize j;
for (j = 0; j < subarray->len; j++) {
DataSource *source;
source = g_array_index (subarray, DataSource *, j);
diff --git a/tools/browser/data-manager/data-source.c b/tools/browser/data-manager/data-source.c
index 90483b4..3ff38d7 100644
--- a/tools/browser/data-manager/data-source.c
+++ b/tools/browser/data-manager/data-source.c
@@ -520,7 +520,7 @@ init_from_table_node (DataSource *source, xmlNodePtr node, GError **error)
if (id)
xmlFree (id);
if (cols_array) {
- gint i;
+ gsize i;
for (i = 0; i < cols_array->len; i++) {
xmlChar *colname;
colname = g_array_index (cols_array, xmlChar*, i);
diff --git a/tools/browser/data-manager/data-widget.c b/tools/browser/data-manager/data-widget.c
index 387364e..88e41ce 100644
--- a/tools/browser/data-manager/data-widget.c
+++ b/tools/browser/data-manager/data-widget.c
@@ -639,7 +639,7 @@ update_layout (DataWidget *dwid)
}
else {
GSList *paned_list;
- gint i;
+ gsize i;
paned_list = make_paned_list (subarray->len, FALSE);
gtk_box_pack_start (GTK_BOX (new_contents),
GTK_WIDGET (paned_list->data), TRUE, TRUE, 0);
@@ -662,7 +662,7 @@ update_layout (DataWidget *dwid)
}
else {
GSList *top_paned_list;
- gint j;
+ gsize j;
top_paned_list = make_paned_list (sources_array->len, TRUE);
gtk_box_pack_start (GTK_BOX (new_contents),
@@ -686,7 +686,7 @@ update_layout (DataWidget *dwid)
}
else {
GSList *paned_list;
- gint i;
+ gsize i;
paned_list = make_paned_list (subarray->len, FALSE);
pack_in_paned_list (top_paned_list, sources_array->len, j,
GTK_WIDGET (paned_list->data));
@@ -885,7 +885,7 @@ source_exec_finished_cb (G_GNUC_UNUSED DataSource *source, GError *error, DataPa
GSList *holders = NULL;
GdaDataModel *model;
GHashTable *export_columns;
- gint i;
+ gsize i;
GdaDataModelIter *iter;
iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (wid));
diff --git a/tools/browser/query-exec/query-editor.c b/tools/browser/query-exec/query-editor.c
index 5cf1b84..5bcc9ae 100644
--- a/tools/browser/query-exec/query-editor.c
+++ b/tools/browser/query-exec/query-editor.c
@@ -816,7 +816,7 @@ query_editor_finalize (GObject *object)
/* free memory */
hist_data_free_all (editor);
if (editor->priv->states) {
- gint i;
+ gsize i;
for (i = 0; i < editor->priv->states->len; i++) {
gchar *str;
str = g_array_index (editor->priv->states, gchar*, i);
diff --git a/tools/browser/schema-browser/table-preferences.c b/tools/browser/schema-browser/table-preferences.c
index 17786ad..f284b6a 100644
--- a/tools/browser/schema-browser/table-preferences.c
+++ b/tools/browser/schema-browser/table-preferences.c
@@ -503,7 +503,7 @@ plugin_hash_foreach_func (G_GNUC_UNUSED const gchar *plugin_name, GdauiPlugin *p
if (! fdata->type)
add_it = TRUE;
else {
- gint i;
+ gsize i;
for (i = 0; i < plugin->nb_g_types; i++) {
if (fdata->type == plugin->valid_g_types[i]) {
add_it = TRUE;
diff --git a/tools/gda-sql.c b/tools/gda-sql.c
index e8a4506..3faa058 100644
--- a/tools/gda-sql.c
+++ b/tools/gda-sql.c
@@ -825,7 +825,7 @@ find_command (GdaInternalCommandsList *commands_list, const gchar *command_str,
{
GdaInternalCommand *command = NULL;
GSList *list;
- gint length;
+ gsize length;
if (!command_str || ((*command_str != '\\') && (*command_str != '.')))
return NULL;
@@ -834,7 +834,7 @@ find_command (GdaInternalCommandsList *commands_list, const gchar *command_str,
for (list = commands_list->name_ordered; list; list = list->next) {
command = (GdaInternalCommand*) list->data;
if (!strncmp (command->name, command_str + 1, MIN (length, strlen (command->name)))) {
- gint l;
+ gsize l;
gchar *ptr;
for (ptr = command->name, l = 0; *ptr && (*ptr != ' '); ptr++, l++);
@@ -3357,7 +3357,7 @@ extra_command_cd (SqlConsole *console, G_GNUC_UNUSED GdaConnection *cnc, const g
if (!init_done) {
init_done = TRUE;
memset (start_dir, 0, DIR_LENGTH);
- if (getcwd (start_dir, DIR_LENGTH) <= 0) {
+ if (getcwd (start_dir, DIR_LENGTH) != NULL) {
/* default to $HOME */
#ifdef G_OS_WIN32
TO_IMPLEMENT;
@@ -3371,7 +3371,7 @@ extra_command_cd (SqlConsole *console, G_GNUC_UNUSED GdaConnection *cnc, const g
return NULL;
}
else {
- gint l = strlen (pw->pw_dir);
+ gsize l = strlen (pw->pw_dir);
if (l > DIR_LENGTH - 1)
strncpy (start_dir, "/", 2);
else
@@ -3440,7 +3440,7 @@ extra_command_edit_buffer (SqlConsole *console, G_GNUC_UNUSED GdaConnection *cnc
if (fd < 0)
goto end_of_command;
if (write (fd, main_data->current->query_buffer->str,
- main_data->current->query_buffer->len) != main_data->current->query_buffer->len) {
+ main_data->current->query_buffer->len) != (gint)main_data->current->query_buffer->len) {
g_set_error (error, 0, 0,
_("Could not write to temporary file '%s': %s"),
filename, strerror (errno));
diff --git a/tools/web-server.c b/tools/web-server.c
index 5851888..6bfa789 100644
--- a/tools/web-server.c
+++ b/tools/web-server.c
@@ -236,7 +236,7 @@ server_callback (G_GNUC_UNUSED SoupServer *server, SoupMessage *msg,
get_cookies (msg, "coa", &cookie, NULL);
if (cookie) {
- gint n;
+ gsize n;
for (n = 0; n < webserver->priv->cookies->len; n++) {
TimedString *ts = g_array_index (webserver->priv->cookies, TimedString *, n);
#ifdef DEBUG_SERVER
@@ -403,7 +403,7 @@ web_server_finalize (GObject * object)
server = WEB_SERVER (object);
if (server->priv) {
- gint i;
+ gsize i;
for (i = 0; i < server->priv->challenges->len; i++) {
TimedString *ts = g_array_index (server->priv->challenges, TimedString *, i);
timed_string_free (ts);
@@ -574,7 +574,7 @@ get_auth (WebServer *server, SoupMessage *msg, GHashTable *query)
get_variables (msg, query, "etoken", &token, NULL);
if (token) {
- gint n;
+ gsize n;
for (n = 0; n < server->priv->challenges->len; n++) {
TimedString *ts = g_array_index (server->priv->challenges, TimedString *, n);
uint8_t hmac[16];
@@ -2183,7 +2183,7 @@ challenge_add (WebServer *server)
static void
challenges_manage (WebServer *server)
{
- gint i;
+ gsize i;
GTimeVal current_ts;
if (server->priv->challenges->len > MAX_CHALLENGES) {
@@ -2224,7 +2224,7 @@ auth_cookie_add (WebServer *server)
static void
auth_cookies_manage (WebServer *server)
{
- gint i;
+ gsize i;
GTimeVal current_ts;
if (server->priv->cookies->len > MAX_AUTH_COOKIES) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]