1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

move os2FullPathname() so that it can be used in os2Open() directly (CVS 5495)

FossilOrigin-Name: 2455e45484eff85bf9fd78dadd1e934f2bbe210a
This commit is contained in:
pweilbacher
2008-07-29 18:35:53 +00:00
parent 5f4bcf15d1
commit 6d2a4b057d
3 changed files with 34 additions and 33 deletions

View File

@@ -12,7 +12,7 @@
**
** This file contains code that is specific to OS/2.
**
** $Id: os_os2.c,v 1.52 2008/07/18 05:36:28 pweilbacher Exp $
** $Id: os_os2.c,v 1.53 2008/07/29 18:35:54 pweilbacher Exp $
*/
#include "sqliteInt.h"
@@ -711,6 +711,30 @@ static int getTempname(int nBuf, char *zBuf ){
}
/*
** Turn a relative pathname into a full pathname. Write the full
** pathname into zFull[]. zFull[] will be at least pVfs->mxPathname
** bytes in size.
*/
static int os2FullPathname(
sqlite3_vfs *pVfs, /* Pointer to vfs object */
const char *zRelative, /* Possibly relative input path */
int nFull, /* Size of output buffer in bytes */
char *zFull /* Output buffer */
){
char *zRelativeCp = convertUtf8PathToCp( zRelative );
char zFullCp[CCHMAXPATH] = "\0";
char *zFullUTF;
APIRET rc = DosQueryPathInfo( zRelativeCp, FIL_QUERYFULLNAME, zFullCp,
CCHMAXPATH );
free( zRelativeCp );
zFullUTF = convertCpPathToUtf8( zFullCp );
sqlite3_snprintf( nFull, zFull, zFullUTF );
free( zFullUTF );
return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}
/*
** Open a file.
*/
@@ -779,7 +803,7 @@ static int os2Open(
char pathUtf8[CCHMAXPATH];
/*ulFileAttribute = FILE_HIDDEN; //for debugging, we want to make sure it is deleted*/
ulFileAttribute = FILE_NORMAL;
sqlite3OsFullPathname( pVfs, zName, CCHMAXPATH, pathUtf8 );
os2FullPathname( pVfs, zName, CCHMAXPATH, pathUtf8 );
pFile->pathToDel = convertUtf8PathToCp( pathUtf8 );
OSTRACE1( "OPEN hidden/delete on close file attributes\n" );
}else{
@@ -884,29 +908,6 @@ static int os2Access(
}
/*
** Turn a relative pathname into a full pathname. Write the full
** pathname into zFull[]. zFull[] will be at least pVfs->mxPathname
** bytes in size.
*/
static int os2FullPathname(
sqlite3_vfs *pVfs, /* Pointer to vfs object */
const char *zRelative, /* Possibly relative input path */
int nFull, /* Size of output buffer in bytes */
char *zFull /* Output buffer */
){
char *zRelativeCp = convertUtf8PathToCp( zRelative );
char zFullCp[CCHMAXPATH] = "\0";
char *zFullUTF;
APIRET rc = DosQueryPathInfo( zRelativeCp, FIL_QUERYFULLNAME, zFullCp,
CCHMAXPATH );
free( zRelativeCp );
zFullUTF = convertCpPathToUtf8( zFullCp );
sqlite3_snprintf( nFull, zFull, zFullUTF );
free( zFullUTF );
return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}
#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points