table: fix the detection of separator in a small files (fix issue #61)
git-svn-id: svn://kolibrios.org@7897 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4f7d0a63ed
commit
00f9e8a85f
@ -20,6 +20,7 @@ extern DWORD *cell_x, *cell_y;
|
||||
extern char ***buffer;
|
||||
extern DWORD buf_col, buf_row;
|
||||
extern DWORD buf_old_x, buf_old_y;
|
||||
DWORD filesize;
|
||||
|
||||
extern bool sel_moved;
|
||||
|
||||
@ -576,15 +577,22 @@ char *Kos_FileRead(kosFileInfo &fileInfo, int &code)
|
||||
|
||||
char GetCsvSeparator(char *fname)
|
||||
{
|
||||
char buffer[512];
|
||||
char buffer[4096];
|
||||
kosFileInfo fileInfo;
|
||||
DWORD load_size;
|
||||
|
||||
if (filesize < 4096) {
|
||||
load_size = filesize;
|
||||
} else {
|
||||
load_size = 4096;
|
||||
}
|
||||
|
||||
rtlDebugOutString(fname);
|
||||
|
||||
strcpy(fileInfo.fileURL, fname);
|
||||
fileInfo.OffsetLow = 0;
|
||||
fileInfo.OffsetHigh = 0;
|
||||
fileInfo.dataCount = 512;
|
||||
fileInfo.dataCount = load_size;
|
||||
fileInfo.rwMode = 0;
|
||||
fileInfo.bufferPtr = (Byte *)buffer;
|
||||
|
||||
@ -714,7 +722,7 @@ int LoadFile(char *fname)
|
||||
kosFileInfo fileInfo;
|
||||
kosBDVK bdvk;
|
||||
int filePointer = 0, i, j;
|
||||
Dword res, filesize;
|
||||
Dword res;
|
||||
char buffer[512 + 1];
|
||||
char *d, *s, *k;
|
||||
int step = 0, items;
|
||||
@ -733,6 +741,8 @@ int LoadFile(char *fname)
|
||||
return -1;
|
||||
}
|
||||
|
||||
filesize = bdvk.size_low;
|
||||
|
||||
if (str_is_csv(fname))
|
||||
return LoadCSV(fname);
|
||||
|
||||
@ -740,8 +750,6 @@ int LoadFile(char *fname)
|
||||
// clear the table
|
||||
reinit();
|
||||
|
||||
filesize = bdvk.size_low;
|
||||
|
||||
fileInfo.rwMode = 0;
|
||||
fileInfo.dataCount = strlen(sFileSign);
|
||||
fileInfo.bufferPtr = (Byte*)buffer;
|
||||
|
@ -23,7 +23,7 @@ const char sNew[] = "New";
|
||||
const char er_file_not_found[] = "'Cannot open file' -E";
|
||||
const char er_format[] = "'Error: bad format' -E";
|
||||
const char msg_save[] = "'File saved' -O";
|
||||
const char msg_load[] = "'File loaded' -O";
|
||||
//const char msg_load[] = "'File loaded' -O";
|
||||
const char msg_save_error[] = "'Error saving file' -E";
|
||||
const char msg_new[] = "'Memory cleared' -I";
|
||||
|
||||
@ -1058,16 +1058,17 @@ void EventLoadFile()
|
||||
{
|
||||
stop_edit();
|
||||
int r = LoadFile(fname);
|
||||
char *result;
|
||||
if (r > 0) {
|
||||
calculate_values();
|
||||
sel_moved = 0;
|
||||
draw_grid();
|
||||
result = (char*)msg_load;
|
||||
}
|
||||
else if (r == -1) result = (char*)er_file_not_found;
|
||||
//result = (char*)msg_load;
|
||||
} else {
|
||||
char *result;
|
||||
if (r == -1) result = (char*)er_file_not_found;
|
||||
else if (r == -2) result = (char*)er_format;
|
||||
kos_AppRun("/sys/@notify", result);
|
||||
}
|
||||
}
|
||||
|
||||
void EventGridSelectAll()
|
||||
|
Loading…
Reference in New Issue
Block a user