[libgda] Use memmove instead of deprecated g_memmove().



commit e2e6f209295a7246353abab73c2068aebdae4991
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 27 11:09:01 2015 +0100

    Use memmove instead of deprecated g_memmove().
    
    See
    https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-memmove

 libgda-ui/data-entries/gdaui-entry.c           |    2 +-
 libgda-ui/data-entries/gdaui-formatted-entry.c |    2 +-
 libgda-ui/data-entries/gdaui-numeric-entry.c   |    6 +++---
 libgda/gda-util.c                              |   10 +++++-----
 libgda/sql-parser/gda-statement-struct-util.c  |   12 ++++++------
 libgda/sqlite/gda-sqlite-provider.c            |    2 +-
 libgda/sqlite/gda-sqlite-util.c                |   12 ++++++------
 providers/mdb/libmdb-src/kkd.c                 |    2 +-
 providers/mysql/gda-mysql-provider.c           |   10 +++++-----
 providers/mysql/gda-mysql-recordset.c          |   18 +++++++++---------
 providers/oracle/gda-oracle-provider.c         |   10 +++++-----
 providers/postgres/gda-postgres-provider.c     |   12 ++++++------
 12 files changed, 49 insertions(+), 49 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry.c b/libgda-ui/data-entries/gdaui-entry.c
index 1a04705..ccd9abb 100644
--- a/libgda-ui/data-entries/gdaui-entry.c
+++ b/libgda-ui/data-entries/gdaui-entry.c
@@ -397,7 +397,7 @@ gdaui_entry_get_text (GdauiEntry *entry)
                        text = g_strdup (ctext);
                        if (entry->priv->prefix) {
                                len -= entry->priv->prefix_len;
-                               g_memmove (text, text + entry->priv->prefix_len, len+1);
+                               memmove (text, text + entry->priv->prefix_len, len+1);
                        }
                        if (entry->priv->suffix) {
                                len -= entry->priv->suffix_len;
diff --git a/libgda-ui/data-entries/gdaui-formatted-entry.c b/libgda-ui/data-entries/gdaui-formatted-entry.c
index 548df47..14e9ce1 100644
--- a/libgda-ui/data-entries/gdaui-formatted-entry.c
+++ b/libgda-ui/data-entries/gdaui-formatted-entry.c
@@ -506,7 +506,7 @@ gdaui_formatted_entry_get_text (GdauiFormattedEntry *entry)
                     mptr++) {
                        if ((*mptr == '-') && (*tptr == '_')) {
                                /* remove that char */
-                               g_memmove (tptr, tptr+1, len - (tptr - text));
+                               memmove (tptr, tptr+1, len - (tptr - text));
                        }
                        else
                                tptr = g_utf8_next_char (tptr);
diff --git a/libgda-ui/data-entries/gdaui-numeric-entry.c b/libgda-ui/data-entries/gdaui-numeric-entry.c
index d60aeea..77ecaa7 100644
--- a/libgda-ui/data-entries/gdaui-numeric-entry.c
+++ b/libgda-ui/data-entries/gdaui-numeric-entry.c
@@ -353,14 +353,14 @@ text_unformat (GdauiNumericEntry *entry, gchar *str, gint *pos)
             *ptr;
             i++) {
                if (*ptr == entry->priv->thousands_sep) {
-                       g_memmove (ptr, ptr+1, len - (ptr - str));
+                       memmove (ptr, ptr+1, len - (ptr - str));
                        len--;
                        if (*pos >= i)
                                *pos = *pos - 1;
                }
                else if ((*ptr == entry->priv->decimal_sep) &&
                         (ptr[1] == entry->priv->decimal_sep)) {
-                       g_memmove (ptr, ptr+1, len - (ptr - str));
+                       memmove (ptr, ptr+1, len - (ptr - str));
                        len--;
                        /*if (*pos > i)
                         *pos = *pos - 1;*/
@@ -705,7 +705,7 @@ gdaui_numeric_entry_get_value (GdauiNumericEntry *entry)
                len = strlen (text);
                for (ptr = text; *ptr; ) {
                        if (*ptr == entry->priv->thousands_sep)
-                               g_memmove (ptr, ptr+1, len - (ptr - text));
+                               memmove (ptr, ptr+1, len - (ptr - text));
                        else {
                                if (*ptr == entry->priv->decimal_sep)
                                        *ptr = '.';
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index 30011f9..25d666a 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -264,7 +264,7 @@ gda_default_unescape_string (const gchar *string)
                /* we accept the "''" as a synonym of "\'" */
                if (*ptr == '\'') {
                        if (*(ptr+1) == '\'') {
-                               g_memmove (ptr+1, ptr+2, total - offset);
+                               memmove (ptr+1, ptr+2, total - offset);
                                offset += 2;
                        }
                        else {
@@ -274,13 +274,13 @@ gda_default_unescape_string (const gchar *string)
                }
                if (*ptr == '\\') {
                        if (*(ptr+1) == '\\') {
-                               g_memmove (ptr+1, ptr+2, total - offset);
+                               memmove (ptr+1, ptr+2, total - offset);
                                offset += 2;
                        }
                        else {
                                if (*(ptr+1) == '\'') {
                                        *ptr = '\'';
-                                       g_memmove (ptr+1, ptr+2, total - offset);
+                                       memmove (ptr+1, ptr+2, total - offset);
                                        offset += 2;
                                }
                                else {
@@ -2970,7 +2970,7 @@ gda_connection_string_split (const gchar *string, gchar **out_cnc_params, gchar
                                        *out_username = g_strndup (pos + 9, ptr - (pos + 9));
                                
                                if (*ptr)
-                                       g_memmove (pos, ptr + 1, strlen (ptr));
+                                       memmove (pos, ptr + 1, strlen (ptr));
                                else
                                        *pos = 0;
                                gchar *tmp;
@@ -2995,7 +2995,7 @@ gda_connection_string_split (const gchar *string, gchar **out_cnc_params, gchar
                                }
                                
                                if (*ptr)
-                                       g_memmove (pos, ptr + 1, strlen (ptr));
+                                       memmove (pos, ptr + 1, strlen (ptr));
                                else
                                        *pos = 0;
                                gchar *tmp;
diff --git a/libgda/sql-parser/gda-statement-struct-util.c b/libgda/sql-parser/gda-statement-struct-util.c
index ddd349e..c7bfd5b 100644
--- a/libgda/sql-parser/gda-statement-struct-util.c
+++ b/libgda/sql-parser/gda-statement-struct-util.c
@@ -88,12 +88,12 @@ _remove_quotes (gchar *str)
         total = strlen (str);
         if (str[total-1] == delim) {
                /* string is correctly terminated by a double quote */
-               g_memmove (str, str+1, total-2);
+               memmove (str, str+1, total-2);
                total -=2;
        }
        else {
                /* string is _not_ correctly terminated by a double quote */
-               g_memmove (str, str+1, total-1);
+               memmove (str, str+1, total-1);
                total -=1;
        }
         str[total] = 0;
@@ -103,7 +103,7 @@ _remove_quotes (gchar *str)
                 /* we accept the "''" as a synonym of "\'" */
                 if (*ptr == delim) {
                         if (*(ptr+1) == delim) {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -113,7 +113,7 @@ _remove_quotes (gchar *str)
                 }
                 else if (*ptr == '"') {
                         if (*(ptr+1) == '"') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -123,13 +123,13 @@ _remove_quotes (gchar *str)
                 }
                else if (*ptr == '\\') {
                         if (*(ptr+1) == '\\') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
                                 if (*(ptr+1) == delim) {
                                         *ptr = delim;
-                                        g_memmove (ptr+1, ptr+2, total - offset);
+                                        memmove (ptr+1, ptr+2, total - offset);
                                         offset += 2;
                                 }
                                 else {
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 71aefcc..931909d 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -3973,7 +3973,7 @@ gda_sqlite_provider_unescape_string (G_GNUC_UNUSED GdaServerProvider *provider,
        while (offset < total) {
                if (*ptr == '\'') {
                        if (*(ptr+1) == '\'') {
-                               g_memmove (ptr+1, ptr+2, total - offset);
+                               memmove (ptr+1, ptr+2, total - offset);
                                offset += 2;
                        }
                        else {
diff --git a/libgda/sqlite/gda-sqlite-util.c b/libgda/sqlite/gda-sqlite-util.c
index 22b58ed..ccae2c6 100644
--- a/libgda/sqlite/gda-sqlite-util.c
+++ b/libgda/sqlite/gda-sqlite-util.c
@@ -248,12 +248,12 @@ sqlite_remove_quotes (gchar *str)
         total = strlen (str);
         if ((str[total-1] == delim) || ((delim == '[') && (str[total-1] == ']'))) {
                /* string is correctly terminated */
-               g_memmove (str, str+1, total-2);
+               memmove (str, str+1, total-2);
                total -=2;
        }
        else {
                /* string is _not_ correctly terminated */
-               g_memmove (str, str+1, total-1);
+               memmove (str, str+1, total-1);
                total -=1;
        }
         str[total] = 0;
@@ -264,7 +264,7 @@ sqlite_remove_quotes (gchar *str)
                        /* we accept the "''" as a synonym of "\'" */
                        if (*ptr == delim) {
                                if (*(ptr+1) == delim) {
-                                       g_memmove (ptr+1, ptr+2, total - offset);
+                                       memmove (ptr+1, ptr+2, total - offset);
                                        offset += 2;
                                }
                                else {
@@ -274,7 +274,7 @@ sqlite_remove_quotes (gchar *str)
                        }
                        else if (*ptr == '"') {
                                if (*(ptr+1) == '"') {
-                                       g_memmove (ptr+1, ptr+2, total - offset);
+                                       memmove (ptr+1, ptr+2, total - offset);
                                        offset += 2;
                                }
                                else {
@@ -284,13 +284,13 @@ sqlite_remove_quotes (gchar *str)
                        }
                        else if (*ptr == '\\') {
                                if (*(ptr+1) == '\\') {
-                                       g_memmove (ptr+1, ptr+2, total - offset);
+                                       memmove (ptr+1, ptr+2, total - offset);
                                        offset += 2;
                                }
                                else {
                                        if (*(ptr+1) == delim) {
                                                *ptr = delim;
-                                               g_memmove (ptr+1, ptr+2, total - offset);
+                                               memmove (ptr+1, ptr+2, total - offset);
                                                offset += 2;
                                        }
                                        else {
diff --git a/providers/mdb/libmdb-src/kkd.c b/providers/mdb/libmdb-src/kkd.c
index e8f753d..72527cd 100644
--- a/providers/mdb/libmdb-src/kkd.c
+++ b/providers/mdb/libmdb-src/kkd.c
@@ -43,7 +43,7 @@ MdbHandle *mdb = entry->mdb;
                tmp = mdb_pg_get_int16(mdb,pos); /* length of string */
                pos += 2;
                cplen = tmp > MDB_MAX_OBJ_NAME ? MDB_MAX_OBJ_NAME : tmp;
-               g_memmove(prop.name,&mdb->pg_buf[pos],cplen);
+               memmove(prop.name,&mdb->pg_buf[pos],cplen);
                prop.name[cplen]='\0';
                pos += tmp; 
                g_array_append_val(entry->props, prop.name);
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index f6d21f9..aa7fcd5 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -2992,12 +2992,12 @@ my_remove_quotes (gchar *str)
         total = strlen (str);
         if (str[total-1] == delim) {
                /* string is correctly terminated */
-               g_memmove (str, str+1, total-2);
+               memmove (str, str+1, total-2);
                total -=2;
        }
        else {
                /* string is _not_ correctly terminated */
-               g_memmove (str, str+1, total-1);
+               memmove (str, str+1, total-1);
                total -=1;
        }
         str[total] = 0;
@@ -3007,7 +3007,7 @@ my_remove_quotes (gchar *str)
                 /* we accept the "''" as a synonym of "\'" */
                 if (*ptr == delim) {
                         if (*(ptr+1) == delim) {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -3017,13 +3017,13 @@ my_remove_quotes (gchar *str)
                 }
                 if (*ptr == '\\') {
                         if (*(ptr+1) == '\\') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
                                 if (*(ptr+1) == delim) {
                                         *ptr = delim;
-                                        g_memmove (ptr+1, ptr+2, total - offset);
+                                        memmove (ptr+1, ptr+2, total - offset);
                                         offset += 2;
                                 }
                                 else {
diff --git a/providers/mysql/gda-mysql-recordset.c b/providers/mysql/gda-mysql-recordset.c
index ebeb292..403a048 100644
--- a/providers/mysql/gda-mysql-recordset.c
+++ b/providers/mysql/gda-mysql-recordset.c
@@ -787,7 +787,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                my_bool is_null = FALSE;
                unsigned long length;
                
-               g_memmove (&is_null, mysql_bind_result[i].is_null, sizeof (my_bool));
+               memmove (&is_null, mysql_bind_result[i].is_null, sizeof (my_bool));
                if (is_null) {
                        gda_value_set_null (value);
                        continue;
@@ -798,13 +798,13 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                switch (mysql_bind_result[i].buffer_type) {
                case MYSQL_TYPE_SHORT: {
                        short int bvalue = 0;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
                        g_value_set_int (value, bvalue);
                        break;
                }
                case MYSQL_TYPE_TINY: {
                        signed char bvalue = 0;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
                        g_value_set_int (value, bvalue);
                        break;
                }
@@ -812,7 +812,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                case MYSQL_TYPE_LONG:
                case MYSQL_TYPE_YEAR: {
                        int bvalue = 0;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
                        
                        if (type == G_TYPE_INT)
                                g_value_set_int (value, bvalue);
@@ -831,7 +831,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                }
                case MYSQL_TYPE_LONGLONG: {
                        long long bvalue = 0;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
 
                        if (type == G_TYPE_BOOLEAN)
                                g_value_set_boolean (value, bvalue ? TRUE : FALSE);
@@ -856,7 +856,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                case MYSQL_TYPE_DATETIME:
                case MYSQL_TYPE_TIMESTAMP: {
                        MYSQL_TIME bvalue = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
 
                        if (type == GDA_TYPE_TIME) {
                                GdaTime time = {
@@ -901,7 +901,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                }
                case MYSQL_TYPE_FLOAT: {
                        float bvalue = 0.;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
                        
                        if (type == G_TYPE_FLOAT)
                                g_value_set_float (value, (float) bvalue);
@@ -916,7 +916,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                }
                case MYSQL_TYPE_DOUBLE: {
                        double bvalue = 0.0;
-                       g_memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
+                       memmove (&bvalue, mysql_bind_result[i].buffer, sizeof (bvalue));
                        
                        if (type == G_TYPE_DOUBLE)
                                g_value_set_double (value, bvalue);
@@ -939,7 +939,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                case MYSQL_TYPE_DECIMAL:
                case MYSQL_TYPE_BIT: {
                        char *bvalue = NULL;
-                       g_memmove (&length, mysql_bind_result[i].length, sizeof (unsigned long));
+                       memmove (&length, mysql_bind_result[i].length, sizeof (unsigned long));
                        if (length > 0) {
                                bvalue = g_malloc (length + 1);
                                memcpy (bvalue, mysql_bind_result[i].buffer, length);
diff --git a/providers/oracle/gda-oracle-provider.c b/providers/oracle/gda-oracle-provider.c
index ef74e90..a1cdb36 100644
--- a/providers/oracle/gda-oracle-provider.c
+++ b/providers/oracle/gda-oracle-provider.c
@@ -2500,12 +2500,12 @@ ora_remove_quotes (gchar *str)
         total = strlen (str);
         if (str[total-1] == delim) {
                /* string is correctly terminated */
-               g_memmove (str, str+1, total-2);
+               memmove (str, str+1, total-2);
                total -=2;
        }
        else {
                /* string is _not_ correctly terminated */
-               g_memmove (str, str+1, total-1);
+               memmove (str, str+1, total-1);
                total -=1;
        }
         str[total] = 0;
@@ -2515,7 +2515,7 @@ ora_remove_quotes (gchar *str)
                 /* we accept the "''" as a synonym of "\'" */
                 if (*ptr == delim) {
                         if (*(ptr+1) == delim) {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -2525,13 +2525,13 @@ ora_remove_quotes (gchar *str)
                 }
                 if (*ptr == '\\') {
                         if (*(ptr+1) == '\\') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
                                 if (*(ptr+1) == delim) {
                                         *ptr = delim;
-                                        g_memmove (ptr+1, ptr+2, total - offset);
+                                        memmove (ptr+1, ptr+2, total - offset);
                                         offset += 2;
                                 }
                                 else {
diff --git a/providers/postgres/gda-postgres-provider.c b/providers/postgres/gda-postgres-provider.c
index 3b84b59..fde3d04 100644
--- a/providers/postgres/gda-postgres-provider.c
+++ b/providers/postgres/gda-postgres-provider.c
@@ -2635,12 +2635,12 @@ pg_remove_quotes (gchar *str)
         total = strlen (str);
         if (str[total-1] == delim) {
                /* string is correctly terminated */
-               g_memmove (str, str+1, total-2);
+               memmove (str, str+1, total-2);
                total -=2;
        }
        else {
                /* string is _not_ correctly terminated */
-               g_memmove (str, str+1, total-1);
+               memmove (str, str+1, total-1);
                total -=1;
        }
         str[total] = 0;
@@ -2650,7 +2650,7 @@ pg_remove_quotes (gchar *str)
                 /* we accept the "''" as a synonym of "\'" */
                 if (*ptr == delim) {
                         if (*(ptr+1) == delim) {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -2660,7 +2660,7 @@ pg_remove_quotes (gchar *str)
                 }
                 else if (*ptr == '"') {
                         if (*(ptr+1) == '"') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
@@ -2670,13 +2670,13 @@ pg_remove_quotes (gchar *str)
                 }
                else if (*ptr == '\\') {
                         if (*(ptr+1) == '\\') {
-                                g_memmove (ptr+1, ptr+2, total - offset);
+                                memmove (ptr+1, ptr+2, total - offset);
                                 offset += 2;
                         }
                         else {
                                 if (*(ptr+1) == delim) {
                                         *ptr = delim;
-                                        g_memmove (ptr+1, ptr+2, total - offset);
+                                        memmove (ptr+1, ptr+2, total - offset);
                                         offset += 2;
                                 }
                                 else {


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