[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    [PATCH] Fix CSV import for non-number text (#66047)
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-11-02 22:28:38
[Download RAW message or body]

The attached patch is for koffice/filters/kspread/cvsimport.cc .

It fixes the crash when the first cell is declared as number but when the 
content is not a number.

The reason was an uninitialized variable (gcc has warned!)

Have a nice day!

["patch_csv.diif" (text/x-diff)]

Index: csvimport.cc
===================================================================
RCS file: /home/kde/koffice/filters/kspread/csv/csvimport.cc,v
retrieving revision 1.25
diff -u -r1.25 csvimport.cc
--- csvimport.cc	16 Aug 2003 12:22:47 -0000	1.25
+++ csvimport.cc	2 Nov 2003 22:18:01 -0000
@@ -158,9 +158,10 @@
               // If not, try with the '.' as decimal separator
               if ( !ok )
                 d = text.toDouble( &ok );
-              if ( !ok ) 
+              if ( !ok )
               {
-                table->setText( row + 1, col + 1, text, false );
+                cell = table->nonDefaultCell( col + 1, row + 1, false, s );
+                cell->setCellText( text, false, true );
                 cell->setFormatType( KSpreadCell::Number );
               }
               else
@@ -182,7 +183,7 @@
               cell->setPrecision( 2 );
               break;
             }
-        }        
+        }
     }
 
     emit sigProgress( 98 );


_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic