fixed a wrong cmgr bug in moo_openstd().
This commit is contained in:
parent
8d19c60359
commit
f60512696d
@ -449,6 +449,11 @@ int main (int argc, char* argv[])
|
|||||||
memset (&cfg, 0, MOO_SIZEOF(cfg));
|
memset (&cfg, 0, MOO_SIZEOF(cfg));
|
||||||
cfg.type = MOO_CFGSTD_OPTB;
|
cfg.type = MOO_CFGSTD_OPTB;
|
||||||
cfg.memsize = MIN_MEMSIZE;
|
cfg.memsize = MIN_MEMSIZE;
|
||||||
|
#if defined(_WIN32) && (MOO_UCH_SIZE >= 4)
|
||||||
|
cfg.cmgr = moo_get_utf16_cmgr();
|
||||||
|
#else
|
||||||
|
cfg.cmgr = moo_get_utf8_cmgr();
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((c = moo_getbopt(argc, argv, &opt)) != MOO_BCI_EOF)
|
while ((c = moo_getbopt(argc, argv, &opt)) != MOO_BCI_EOF)
|
||||||
{
|
{
|
||||||
@ -560,7 +565,6 @@ int main (int argc, char* argv[])
|
|||||||
#else
|
#else
|
||||||
moo_uch_t tmp[1000];
|
moo_uch_t tmp[1000];
|
||||||
moo_oow_t bcslen, ucslen;
|
moo_oow_t bcslen, ucslen;
|
||||||
|
|
||||||
ucslen = MOO_COUNTOF(tmp);
|
ucslen = MOO_COUNTOF(tmp);
|
||||||
moo_conv_utf8_to_ucstr(argv[i], &bcslen, tmp, &ucslen);
|
moo_conv_utf8_to_ucstr(argv[i], &bcslen, tmp, &ucslen);
|
||||||
in.type = MOO_IOSTD_FILEU;
|
in.type = MOO_IOSTD_FILEU;
|
||||||
|
@ -42,6 +42,9 @@ _M_X64 x64 platform
|
|||||||
/*#define MOO_ENABLE_STATIC_MODULE*/
|
/*#define MOO_ENABLE_STATIC_MODULE*/
|
||||||
#define MOO_ENABLE_DYNAMIC_MODULE
|
#define MOO_ENABLE_DYNAMIC_MODULE
|
||||||
|
|
||||||
|
/* use UCS4 for uch_t */
|
||||||
|
/*#define MOO_UNICODE_SIZE 4*/
|
||||||
|
|
||||||
/* windows for most of non-x86 platforms dropped.
|
/* windows for most of non-x86 platforms dropped.
|
||||||
* make it selective to support old non-x86 windows platforms. */
|
* make it selective to support old non-x86 windows platforms. */
|
||||||
#define MOO_ENDIAN_LITTLE
|
#define MOO_ENDIAN_LITTLE
|
||||||
|
@ -119,10 +119,8 @@ typedef enum moo_option_dflval_t moo_option_dflval_t;
|
|||||||
|
|
||||||
enum moo_trait_t
|
enum moo_trait_t
|
||||||
{
|
{
|
||||||
#if defined(MOO_BUILD_DEBUG)
|
|
||||||
MOO_DEBUG_GC = (1u << 0),
|
MOO_DEBUG_GC = (1u << 0),
|
||||||
MOO_DEBUG_BIGINT = (1u << 1),
|
MOO_DEBUG_BIGINT = (1u << 1),
|
||||||
#endif
|
|
||||||
|
|
||||||
/* perform no garbage collection when the heap is full.
|
/* perform no garbage collection when the heap is full.
|
||||||
* you still can use moo_gc() explicitly. */
|
* you still can use moo_gc() explicitly. */
|
||||||
|
@ -95,7 +95,7 @@ typedef struct _IO_STATUS_BLOCK
|
|||||||
|
|
||||||
typedef enum _FILE_INFORMATION_CLASS
|
typedef enum _FILE_INFORMATION_CLASS
|
||||||
{
|
{
|
||||||
FilePipeLocalInformation = 24
|
FilePipeLocalInformation = 24
|
||||||
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
||||||
|
|
||||||
typedef DWORD (WINAPI *PNtQueryInformationFile) (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
|
typedef DWORD (WINAPI *PNtQueryInformationFile) (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
|
||||||
@ -124,8 +124,7 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
|||||||
if (!once_only)
|
if (!once_only)
|
||||||
{
|
{
|
||||||
NtQueryInformationFile = (PNtQueryInformationFile)
|
NtQueryInformationFile = (PNtQueryInformationFile)
|
||||||
GetProcAddress (GetModuleHandle ("ntdll.dll"),
|
GetProcAddress (GetModuleHandle(TEXT("ntdll.dll")), "NtQueryInformationFile");
|
||||||
"NtQueryInformationFile");
|
|
||||||
once_only = TRUE;
|
once_only = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,12 +151,12 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
|||||||
memset (&fpli, 0, sizeof (fpli));
|
memset (&fpli, 0, sizeof (fpli));
|
||||||
|
|
||||||
if (!NtQueryInformationFile
|
if (!NtQueryInformationFile
|
||||||
|| NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
|
|| NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), FilePipeLocalInformation)
|
||||||
FilePipeLocalInformation)
|
|| fpli.WriteQuotaAvailable >= PIPE_BUF
|
||||||
|| fpli.WriteQuotaAvailable >= PIPE_BUF
|
|| (fpli.OutboundQuota < PIPE_BUF && fpli.WriteQuotaAvailable == fpli.OutboundQuota))
|
||||||
|| (fpli.OutboundQuota < PIPE_BUF &&
|
{
|
||||||
fpli.WriteQuotaAvailable == fpli.OutboundQuota))
|
|
||||||
happened |= *p_sought & (POLLOUT | POLLWRNORM | POLLWRBAND);
|
happened |= *p_sought & (POLLOUT | POLLWRNORM | POLLWRBAND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return happened;
|
return happened;
|
||||||
|
|
||||||
@ -177,8 +176,8 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
|||||||
if (!*p_sought)
|
if (!*p_sought)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
|
irbuffer = (INPUT_RECORD *)_alloca(nbuffer * sizeof (INPUT_RECORD));
|
||||||
bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
|
bRet = PeekConsoleInput(h, irbuffer, nbuffer, &avail);
|
||||||
if (!bRet || avail == 0)
|
if (!bRet || avail == 0)
|
||||||
return POLLHUP;
|
return POLLHUP;
|
||||||
|
|
||||||
|
@ -3204,7 +3204,7 @@ moo_t* moo_openstd (moo_oow_t xtnsize, const moo_cfgstd_t* cfg, moo_errinf_t* er
|
|||||||
vmprim.vm_sleep = vm_sleep;
|
vmprim.vm_sleep = vm_sleep;
|
||||||
|
|
||||||
moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, cfg->memsize,
|
moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, cfg->memsize,
|
||||||
(cfg->cmgr? cfg->cmgr: moo_get_utf8_cmgr), &vmprim, errinfo);
|
(cfg->cmgr? cfg->cmgr: moo_get_utf8_cmgr()), &vmprim, errinfo);
|
||||||
if (!moo) return MOO_NULL;
|
if (!moo) return MOO_NULL;
|
||||||
|
|
||||||
xtn = GET_XTN(moo);
|
xtn = GET_XTN(moo);
|
||||||
|
@ -632,7 +632,7 @@ MOO_INLINE int moo_conv_ucs_to_bcs_with_cmgr (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = cmgr->uctobc (*p, bcs, rem);
|
n = cmgr->uctobc(*p, bcs, rem);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -670,7 +670,7 @@ MOO_INLINE int moo_conv_ucs_to_bcs_with_cmgr (
|
|||||||
{
|
{
|
||||||
moo_oow_t n;
|
moo_oow_t n;
|
||||||
|
|
||||||
n = cmgr->uctobc (*p, bcsbuf, MOO_COUNTOF(bcsbuf));
|
n = cmgr->uctobc(*p, bcsbuf, MOO_COUNTOF(bcsbuf));
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user