Additional fixes.

svn path=/trunk/; revision=1661
This commit is contained in:
Carl Nettelblad 2001-03-06 06:20:36 +00:00
parent 2ec9eaf736
commit de10767975
4 changed files with 27 additions and 13 deletions

View file

@ -4,7 +4,7 @@
void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext ) void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
{ {
int dir_len; int dir_len;
if ( drive != NULL ) { if ( drive != NULL && (*drive)) {
strcpy(path,drive); strcpy(path,drive);
strcat(path,":"); strcat(path,":");
} }
@ -27,6 +27,4 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
strcat(path,ext); strcat(path,ext);
} }
} }
} }

View file

@ -30,13 +30,18 @@ void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ex
strcpy(ext,tmp_ext); strcpy(ext,tmp_ext);
} }
else else
{
*ext = 0; *ext = 0;
tmp_ext = path+strlen(path);
}
if ( tmp_dir != NULL ) { if ( tmp_dir != NULL ) {
strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1); strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0; *(fname + (tmp_ext - tmp_dir -1)) = 0;
} }
else else
{
strncpy(fname,path,tmp_ext - path); strncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
} }

View file

@ -4,7 +4,7 @@
void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext ) void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
{ {
int dir_len; int dir_len;
if ( drive != NULL ) { if ( drive != NULL && (*drive)) {
strcpy(path,drive); strcpy(path,drive);
strcat(path,":"); strcat(path,":");
} }
@ -32,7 +32,7 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
void _wmakepath( wchar_t *path, const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext ) void _wmakepath( wchar_t *path, const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext )
{ {
int dir_len; int dir_len;
if ( drive != NULL ) { if ( drive != NULL && (*drive)) {
wcscpy(path,drive); wcscpy(path,drive);
wcscat(path,L":"); wcscat(path,L":");
} }

View file

@ -30,14 +30,19 @@ void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ex
strcpy(ext,tmp_ext); strcpy(ext,tmp_ext);
} }
else else
{
*ext = 0; *ext = 0;
tmp_ext = path+strlen(path);
}
if ( tmp_dir != NULL ) { if ( tmp_dir != NULL ) {
strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1); strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0; *(fname + (tmp_ext - tmp_dir -1)) = 0;
} }
else else
{
strncpy(fname,path,tmp_ext - path); strncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
} }
void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fname, wchar_t *ext ) void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fname, wchar_t *ext )
@ -69,12 +74,18 @@ void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fn
wcscpy(ext,tmp_ext); wcscpy(ext,tmp_ext);
} }
else else
{
*ext = 0; *ext = 0;
tmp_ext = path+wcslen(path);
}
if ( tmp_dir != NULL ) { if ( tmp_dir != NULL ) {
wcsncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1); wcsncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0; *(fname + (tmp_ext - tmp_dir -1)) = 0;
} }
else else
{
wcsncpy(fname,path,tmp_ext - path); wcsncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
} }