summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--src/file.c29
-rwxr-xr-xsrc/gdb.gdb3
3 files changed, 23 insertions, 11 deletions
diff --git a/CHANGES b/CHANGES
index dbdef4e..79e4548 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,7 +15,7 @@ added new colors types SHEET, CURRENT_SHEET and FILENM
loading xlsx with multiple sheet
saving xlsx with multiple sheets
add :renamesheet command
-reference cells from different sheets in formulas: ={Sheet2}!A2
+reference cells from different sheets in formulas: ={"Sheet2"}!A2
removed --sheet and --filename_with_mode configuration variables
** fix in calc_mobile_cols()
created movetosheet command in gram.y, to be used when saving and loading files
diff --git a/src/file.c b/src/file.c
index be82555..bd9d230 100644
--- a/src/file.c
+++ b/src/file.c
@@ -745,7 +745,9 @@ void write_cells(FILE * f, struct roman * doc, struct sheet * sh, int r0, int c0
* \param[in] fname file name
* \param[in] eraseflg
*
- * \return SC_READFILE_SUCCESS if we loaded the file, SC_READFILE_ERROR if we failed,
+ * \return
+ * SC_READFILE_SUCCESS if we could load the file,
+ * SC_READFILE_ERROR if we failed,
* SC_READFILE_DOESNTEXIST if the file doesn't exist.
*/
sc_readfile_result readfile(char * fname, int eraseflg) {
@@ -815,7 +817,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
sc_error("XLSX import support not compiled in");
#else
open_xlsx(fname, "UTF-8");
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, fname);
roman->modflg = 0;
#endif
@@ -828,7 +831,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
sc_error("ODS import support not compiled in");
#else
open_ods(fname, "UTF-8");
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, fname);
roman->modflg = 0;
#endif
@@ -842,7 +846,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
#else
open_xls(fname, "UTF-8");
roman->modflg = 0;
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, fname);
#endif
roman->loading = 0;
@@ -854,7 +859,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
! strcasecmp( & fname[len-4], ".txt") )){
import_csv(fname, get_delim(&fname[len-3])); // csv tsv tab txt delim import
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, fname);
roman->modflg = 0;
roman->loading = 0;
@@ -865,7 +871,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
! strcasecmp( & fname[len-4], ".mkd"))){
import_markdown(fname);
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, fname);
roman->modflg = 0;
roman->loading = 0;
@@ -886,10 +893,13 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
f = fopen(save, "r");
if (f == NULL) {
roman->loading = 0;
- if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN);
- strcpy(roman->name, save);
+ if (strstr(save, "scimrc") == NULL) {
+ if (roman->name != NULL) free(roman->name);
+ roman->name = malloc(sizeof(char)*PATHLEN);
+ strcpy(roman->name, save);
+ }
return SC_READFILE_DOESNTEXIST;
- } /* */
+ }
if (eraseflg) erasedb(roman->cur_sh, 0); //TODO handle file
@@ -905,6 +915,7 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
cellassign = 0;
}
if (strstr(save, "scimrc") == NULL) {
+ if (roman->name != NULL) free(roman->name);
roman->name = malloc(sizeof(char)*PATHLEN);
strcpy(roman->name, save);
}
diff --git a/src/gdb.gdb b/src/gdb.gdb
index 1c8e0a4..912a7f8 100755
--- a/src/gdb.gdb
+++ b/src/gdb.gdb
@@ -1,2 +1,3 @@
target remote localhost:12345
-b graph.c:141
+b file.c:907
+b file.c:753