[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. grisbi_gtk3_1_3_0-12-gc38d056

Pierre Biava nobody at users.sourceforge.net
Sun Jan 8 10:27:19 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, grisbi-gtk3 has been updated
       via  c38d05611a3eb429ca0524c162daec614d95de57 (commit)
      from  ae45f690bd8fc413706bc5e20cdf4fb5caaf368f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c38d05611a3eb429ca0524c162daec614d95de57
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Jan 8 10:15:02 2012 +0100

    csv_parse.c: Fixed a bug when importing a CSV file with 'CR' characters

-----------------------------------------------------------------------

Changes:
diff --git a/src/csv_parse.c b/src/csv_parse.c
index e582cfc..8ba15e8 100644
--- a/src/csv_parse.c
+++ b/src/csv_parse.c
@@ -1,7 +1,7 @@
 /* ************************************************************************** */
 /*                                                                            */
 /*     Copyright (C)    2005-2006 Benjamin Drieu (bdrieu at april.org)           */
-/*          2008-2009 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          2008-2011 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -43,7 +43,7 @@
 /*END_EXTERN*/
 
 /*START_STATIC*/
-static gchar * sanitize_field ( gchar *begin, gchar *end  );
+static gchar *sanitize_field ( gchar *begin, gchar *end  );
 /*END_STATIC*/
 
 
@@ -54,13 +54,15 @@ static gchar * sanitize_field ( gchar *begin, gchar *end  );
  */
 GSList * csv_parse_line ( gchar **contents, gchar *separator )
 {
-    gchar *tmp = (*contents);
-    gchar *begin = tmp;
+    gchar *tmp;
+    gchar *begin;
     gint is_unquoted = FALSE;
     gint len;
     GSList *list = NULL;
 
     len = strlen ( separator );
+    tmp = (*contents);
+    begin = tmp;
 
     if ( *tmp == '\n' )
     {
@@ -124,7 +126,6 @@ GSList * csv_parse_line ( gchar **contents, gchar *separator )
 }
 
 
-
 /**
  * TODO
  *
@@ -164,7 +165,7 @@ gchar *sanitize_field ( gchar *begin, gchar *end  )
     }
 
     /* Strip out remaining white spaces. */
-    while ( *(iter-1) == ' ' || *(iter-1) == '\n' )
+    while ( *(iter-1) == ' ' || *(iter-1) == '\r' || *(iter-1) == '\n' )
         iter--;
 
     *iter = '\0';
@@ -424,7 +425,8 @@ gboolean csv_import_parse_sub_budget ( struct struct_ope_importation * ope, gcha
  */
 gboolean csv_import_parse_balance ( struct struct_ope_importation * ope, gchar * string )
 {
-    g_return_val_if_fail ( string, FALSE );
+    if ( !string )
+        return FALSE;
 
     if ( strlen ( string ) > 0 )
     {
@@ -441,12 +443,15 @@ gboolean csv_import_parse_balance ( struct struct_ope_importation * ope, gchar *
  */
 gboolean csv_import_parse_credit ( struct struct_ope_importation * ope, gchar * string )
 {
-    g_return_val_if_fail ( string, FALSE );
+    if ( !string )
+        return FALSE;
+
     if ( strlen ( string ) > 0 )
     {
         ope -> montant = gsb_real_add ( ope -> montant,
                         utils_real_get_from_string (string));
     }
+
     return TRUE;
 }
 
@@ -457,13 +462,15 @@ gboolean csv_import_parse_credit ( struct struct_ope_importation * ope, gchar *
  */
 gboolean csv_import_parse_debit ( struct struct_ope_importation * ope, gchar * string )
 {
-    g_return_val_if_fail ( string, FALSE );
+    if ( !string )
+        return FALSE;
 
     if ( strlen ( string ) > 0 )
     {
         ope -> montant = gsb_real_sub ( ope -> montant,
-                        utils_real_get_from_string (string));
+                        utils_real_get_from_string ( string ) );
     }
+
     return TRUE;
 }
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list