Patch level : 10.0

Files correlati     : ba8 lv3
Ricompilazione Demo : [ ]
Commento            :
Migliorato supporto per percorsi dati lunghi (> 30)


git-svn-id: svn://10.65.10.50/trunk@17811 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-12-04 16:37:47 +00:00
parent b5f5be5f06
commit 583a229d2b
6 changed files with 47 additions and 108 deletions

View File

@ -119,7 +119,8 @@ TInfo_mask::TInfo_mask()
add_row(TR("Sistema Operativo"), stros);
add_row(TR("Utente"), user());
add_row(TR("Computer"), strcpu);
add_row(TR("Studio"), firm2dir(-1));
const TString study = firm2dir(-1);
add_row(TR("Studio"), study, study.find(' ') > 0 || study.len() > 30);
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
if (prefix_valid())
{
@ -133,7 +134,7 @@ TInfo_mask::TInfo_mask()
add_row(TR("Config utente"), userini.name(), userini.name().find(' ') >= 0);
add_row(TR("File temporanei"), temp, temp.find(' ') >= 0);
const long mbfree = xvt_fsys_get_disk_free_space(firm2dir(-1), 'M');
const long mbfree = xvt_fsys_get_disk_free_space(study, 'M');
TString16 strmb; strmb.format("%ld Mb", mbfree);
add_row(TR("Spazio su disco"), strmb, mbfree < 512);

View File

@ -35,7 +35,7 @@ void COpenDir(lockmode, dirflg)
PathSt name;
if (dirfl[dirflg]++) return;
strcpy(name, CInsPref(directory, dirflg)) ;
strncpy(name, CInsPref(directory, dirflg), sizeof(name)) ;
COpen(&fdir[dirflg], name, sizeof(FileDes), 0, lockmode) ;
if (fdir[dirflg].IOR != NoErr)
{
@ -285,7 +285,7 @@ void COpenRecDir(lockmode,dirflg)
PathSt name;
if (recfl[dirflg]++) return;
strcpy(name, CInsPref(ntrrec, dirflg)) ;
strncpy(name, CInsPref(ntrrec, dirflg), sizeof(name)) ;
COpen(&rdir[dirflg], name, sizeof(RecDes), 0, lockmode) ;
if (rdir[dirflg].IOR != NoErr)
{
@ -488,35 +488,22 @@ void CPutPref(const char* pref) /* stringa contenente il nuovo prefisso */
@(FN)
*/
char *CAddPref(name)
char *name; /* nome file */
static char __s[_MAX_PATH];
char* CAddPref(const char* name) /* nome file */
{
static char* s = NULL;
if (*name == '$')
{
name++;
return(CInsPref(name, NORDIR)) ;
}
else
{
if (*name == '%')
{
name++;
return(CInsPref(name, COMDIR)) ;
}
else
{
if (s == NULL)
s = malloc(_MAX_PATH);
if (strncmp(__ptprf, name, strlen(__ptprf)) != 0)
sprintf(s, "%s%s", __ptprf, name);
else
strcpy(s, name);
return s;
}
}
return(CInsPref(name+1, NORDIR)) ;
if (*name == '%')
return CInsPref(name+1, COMDIR);
if (strncmp(__ptprf, name, strlen(__ptprf)) != 0)
sprintf(__s, "%s%s", __ptprf, name);
else
strcpy(__s, name);
return __s;
}
/*
@ -537,24 +524,17 @@ char *CAddPref(name)
@(FN)
*/
char *CInsPref(name,dirflg)
char *name; /* nome del file cui aggiungere il prefisso */
int dirflg; /* flag per file comuni */
char* CInsPref(const char* name, int dirflg)
{
static char* s = NULL;
if (s == NULL)
s = malloc(_MAX_PATH);
if (dirflg == NORDIR)
{
if (*cprefix == '\0')
strcpy(s, name);
strcpy(__s, name);
else
xvt_fsys_build_pathname(s, NULL, cprefix, name, NULL, NULL);
xvt_fsys_build_pathname(__s, NULL, cprefix, name, NULL, NULL);
}
else
sprintf(s,"%scom%c%s", __ptprf, DIRSEP, name);
return s;
sprintf(__s,"%scom%c%s", __ptprf, DIRSEP, name);
return __s;
}

View File

@ -102,9 +102,9 @@ extern "C" {
// word setrdes(RecDes *);
const char* CGetPref(void);
void CPutPref(const char *);
char *CAddPref(char *);
char* CAddPref(const char *);
/* @(!) 2.3.01.144 */
char *CInsPref(char *, int);
char* CInsPref(const char *, int);
int CGetCampoStpValue(const char* name, char* value, int valsize);
const char* CGetCampoIni(void);

View File

@ -389,13 +389,11 @@ void get_idx_names(
// @comm Ritorna il nome con il prefisso corrente
{
long c = DB_getconf();
TDir d;
TTrec r;
d.get(logicnum);
r.get(logicnum);
TFilename f(d.name());
const long c = DB_getconf();
CHECKD(c & 1, "Bad index file format ", c);
TFilename f = prefix().get_filename(logicnum);
/*
if (c & 1) f.ext("cdx");
if (c & 4) f.ext("mdx");
i_names.cut(0);
@ -403,6 +401,9 @@ void get_idx_names(
f.ext("");
f.rtrim(1);
if ((c & 2) || (c & 8)) // DBIII or CLIPPER format, returns f_name + .cgp, f_nameX + .n{d|t}x
{
TTrec r;
r.get(logicnum);
for (int j=1; j<=r.keys();j++)
{
TString xx=f.name();
@ -416,7 +417,11 @@ void get_idx_names(
f.ext("ntx");
i_names.add(f);
}
}
i_names.restart();
*/
f.ext("cdx");
i_names = f;
}
// Converte un errore di codebase in un errore isam
@ -1560,40 +1565,6 @@ TIsamfile::~TIsamfile()
close();
}
/*
//A cosa cavolo serve?
// @doc EXTERNAL
// @mfunc Aggiorna i flags associati al file
//
// @rdesc Ritorna NOERR se e' riuscita ad eseguire l'operazione, altrimenti ritorna il numero
// di errore generato (vedi <t TIsamerr>).
int TIsamfile::flags(
bool updateeod) // @parm Indica se aggiornare anche l'EOD del file
{
if (num() <= 0)
return NOERR ;
TDir d;
const TDirtype dirtype = prefix().get_dirtype(_filename);
d.get(num(), _lock, dirtype);
int err = d.status(dirtype);
if (err == NOERR)
{
const FileDes& fd = prefix().get_filedes(_filename);
d.flags() = fd.Flags;
if (updateeod)
d.eod() = fd.EOD;
d.put(num(), dirtype);
}
setstatus(err);
return err;
}
*/
///////////////////////////////////////////////////////////
// TIsamtempfile
///////////////////////////////////////////////////////////
@ -1622,20 +1593,13 @@ TIsamtempfile::TIsamtempfile(int logicnum, const char* radix, bool create, bool
if (!create)
{
TDir dir; dir.get(logicnum);
const word& len = dir.len();
TDir dir; dir.get(logicnum,_nolock,_nordir,_sysdirop);
const long len = dir.len();
const long sz = fsize(n);
if (sz == 0)
fatal_box("Impossibile aprire il file %s: %s",(const char*) n,(const char*)_strerror(NULL));
FILE* f = fopen(n, "rb");
if (f == NULL)
#ifdef WIN32
fatal_box("Impossibile aprire il file temporaneo %s: %s",(const char*) n,(const char*)_strerror(NULL));
#else
fatal_box("Impossibile aprire il file temporaneo %s: %s",(const char*) n,(const char*)strerror(errno));
#endif
fseek(f, 0, SEEK_END);
eod = eox = ftell(f) / len;
fclose(f);
eod = eox = sz / len;
}
CHECK(create == FALSE || create == TRUE, "Il flag di autodel ora si setta con il terzo parametro del costruttore");

View File

@ -3262,8 +3262,8 @@ bool TEdit_field::parse_item(TScanner& scanner)
const int logicnum = table2logic(tablename);
if (logicnum > 0)
{
TDir d; d.get(logicnum);
if (fexist(d.filename())) // Controlla l'esistenza del file
TFilename f = prefix().get_filename(logicnum); f.ext("dbf");
if (f.exist()) // Controlla l'esistenza del file
{
switch (logicnum)
{

View File

@ -490,11 +490,6 @@ const TFilename& TFile_info::load_filedes()
_dir = _comdir;
else
_dir = _nordir;
/* COpenFile(num(), &_filedes, _nolock, _dir);
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des));
_name = _filedes.SysName;
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des));
*/
_name = CAddPref(_filedes.SysName);
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
}
@ -1331,7 +1326,7 @@ bool TPrefix::build_firm_data(long codditta, bool flagcom)
dir1.put(LF_DIR, _nordir, _sysdirop);
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
}
const long maxeod1 = dir.eod();
const long maxeod1 = dir.eod();
if (maxeod0 > maxeod1)
{
@ -1410,8 +1405,7 @@ public:
void TTable_names::add_file(int logic, const TString& table)
{
TString8* id = new TString8;
id->format("%d", logic);
TString8 id; id << logic;
_names.add(table, id);
_ids.add(table, logic);
}