fixed a bug due to QSE_FIO_MBSPATH

added more watcom targets
This commit is contained in:
2012-12-09 01:31:55 +00:00
parent 828de9af20
commit 1d947c202f
30 changed files with 2382 additions and 148 deletions

View File

@ -403,7 +403,7 @@ int qse_fio_init (
if (flags & QSE_FIO_MBSPATH)
{
handle = CreateFileA (
path, desired_access, share_mode,
(const qse_mchar_t*)path, desired_access, share_mode,
QSE_NULL, /* set noinherit by setting no secattr */
creation_disposition, flag_and_attr, 0
);
@ -892,7 +892,10 @@ int qse_fio_init (
#if defined(QSE_CHAR_IS_MCHAR)
/* nothing to do */
#else
if (path_mb != path_mb_buf) QSE_MMGR_FREE (mmgr, path_mb);
if (path_mb != path_mb_buf && path_mb != path)
{
QSE_MMGR_FREE (mmgr, path_mb);
}
#endif
if (handle == -1)
{
@ -1361,7 +1364,7 @@ static int get_devname_from_handle (
}
getmappedfilename = (getmappedfilename_t)
GetProcAddress (psapi, QSE_T("GetMappedFileName"));
GetProcAddress (psapi, QSE_MT("GetMappedFileName"));
if (!getmappedfilename)
{
fio->errnum = syserr_to_errnum (GetLastError());

View File

@ -354,6 +354,7 @@ struct del_op_t
{
#if defined(_WIN32)
/* nothing */
int __dummy; /* just a placeholder */
#elif defined(__OS2__)
qse_mchar_t* path;
#elif defined(__DOS__)

View File

@ -143,7 +143,7 @@ static int task_init_file (
QSE_MEMCPY (file, arg, QSE_SIZEOF(*file));
file->path.ptr = (qse_mchar_t*)(file + 1);
qse_mbscpy ((qse_mchar_t*)file->path.ptr, arg->path.ptr);
qse_mbscpy ((qse_mchar_t*)file->path.ptr, arg->path.ptr);
if (arg->mime.ptr)
{
file->mime.ptr = file->path.ptr + file->path.len + 1;

View File

@ -253,7 +253,7 @@ static qse_ssize_t __send_file (
qse_ubi_t infd = qse_fio_gethandleasubi (in_fd.ptr);
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_SENDFILE64)
return sendfile64 (out_f_fdd, infd.i, offset, count);
return sendfile64 (out_fd, infd.i, offset, count);
#else
return sendfile (out_fd, infd.i, offset, count);
#endif
@ -1060,7 +1060,7 @@ static int stat_file (
qse_btime_t bt;
qse_ntime_t nt;
#if 0
#if 0
HDIR h;
ULONG count;
@ -1078,7 +1078,8 @@ static int stat_file (
if (rc != NO_ERROR) return -1;
DosFindClose (h);
#endif
#endif
rc = DosQueryPathInfo (path, FIL_STANDARDL, &ffb, QSE_SIZEOF(ffb));
if (rc != NO_ERROR) return -1;
@ -1120,6 +1121,7 @@ static int stat_file (
qse_stat_t st;
/* TODO: lstat? or stat? */
if (QSE_STAT (path, &st) <= -1)
{
qse_httpd_seterrnum (httpd, syserr_to_errnum(errno));
@ -1160,6 +1162,10 @@ static int stat_file (
static int file_stat (
qse_httpd_t* httpd, const qse_mchar_t* path, qse_httpd_stat_t* hst)
{
/* this callback is not required to be a general stat function
* for a file. it is mainly used to get a file size and timestamps
* of a regular file. so it should fail for a non-regular file.
* note that 1 passes 1 to stat_file for it */
return stat_file (httpd, path, hst, 1);
}
@ -1610,7 +1616,8 @@ if (qse_htre_getcontentlen(req) > 0)
else
{
task = qse_httpd_entaskrsrc (httpd, client, QSE_NULL, &rsrc, req);
if (server_xtn->cfg2.s.cbstd->freersrc) server_xtn->cfg2.s.cbstd->freersrc (httpd, client, req, &rsrc);
if (server_xtn->cfg2.s.cbstd->freersrc)
server_xtn->cfg2.s.cbstd->freersrc (httpd, client, req, &rsrc);
}
if (task == QSE_NULL) goto oops;
}
@ -2016,7 +2023,7 @@ auth_ok:
if (xpath == QSE_NULL) return -1;
qse_printf (QSE_T(">>> check if [%hs] is a directory\n"), xpath);
if (httpd->scb->file.stat (httpd, xpath, &st) >= 0 && st.isdir)
if (stat_file (httpd, xpath, &st, 0) >= 0 && st.isdir)
{
qse_printf (QSE_T(">>> [%hs] is a directory\n"), xpath);
/* it is a directory */