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));
|
||||
cfg.type = MOO_CFGSTD_OPTB;
|
||||
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)
|
||||
{
|
||||
@ -560,7 +565,6 @@ int main (int argc, char* argv[])
|
||||
#else
|
||||
moo_uch_t tmp[1000];
|
||||
moo_oow_t bcslen, ucslen;
|
||||
|
||||
ucslen = MOO_COUNTOF(tmp);
|
||||
moo_conv_utf8_to_ucstr(argv[i], &bcslen, tmp, &ucslen);
|
||||
in.type = MOO_IOSTD_FILEU;
|
||||
|
@ -42,6 +42,9 @@ _M_X64 x64 platform
|
||||
/*#define MOO_ENABLE_STATIC_MODULE*/
|
||||
#define MOO_ENABLE_DYNAMIC_MODULE
|
||||
|
||||
/* use UCS4 for uch_t */
|
||||
/*#define MOO_UNICODE_SIZE 4*/
|
||||
|
||||
/* windows for most of non-x86 platforms dropped.
|
||||
* make it selective to support old non-x86 windows platforms. */
|
||||
#define MOO_ENDIAN_LITTLE
|
||||
|
@ -119,10 +119,8 @@ typedef enum moo_option_dflval_t moo_option_dflval_t;
|
||||
|
||||
enum moo_trait_t
|
||||
{
|
||||
#if defined(MOO_BUILD_DEBUG)
|
||||
MOO_DEBUG_GC = (1u << 0),
|
||||
MOO_DEBUG_BIGINT = (1u << 1),
|
||||
#endif
|
||||
|
||||
/* perform no garbage collection when the heap is full.
|
||||
* you still can use moo_gc() explicitly. */
|
||||
|
@ -124,8 +124,7 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
||||
if (!once_only)
|
||||
{
|
||||
NtQueryInformationFile = (PNtQueryInformationFile)
|
||||
GetProcAddress (GetModuleHandle ("ntdll.dll"),
|
||||
"NtQueryInformationFile");
|
||||
GetProcAddress (GetModuleHandle(TEXT("ntdll.dll")), "NtQueryInformationFile");
|
||||
once_only = TRUE;
|
||||
}
|
||||
|
||||
@ -152,13 +151,13 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
||||
memset (&fpli, 0, sizeof (fpli));
|
||||
|
||||
if (!NtQueryInformationFile
|
||||
|| NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
|
||||
FilePipeLocalInformation)
|
||||
|| NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), FilePipeLocalInformation)
|
||||
|| 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);
|
||||
}
|
||||
}
|
||||
return happened;
|
||||
|
||||
case FILE_TYPE_CHAR:
|
||||
@ -177,8 +176,8 @@ static int windows_compute_revents (HANDLE h, int *p_sought)
|
||||
if (!*p_sought)
|
||||
return 0;
|
||||
|
||||
irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
|
||||
bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
|
||||
irbuffer = (INPUT_RECORD *)_alloca(nbuffer * sizeof (INPUT_RECORD));
|
||||
bRet = PeekConsoleInput(h, irbuffer, nbuffer, &avail);
|
||||
if (!bRet || avail == 0)
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
xtn = GET_XTN(moo);
|
||||
|
@ -632,7 +632,7 @@ MOO_INLINE int moo_conv_ucs_to_bcs_with_cmgr (
|
||||
break;
|
||||
}
|
||||
|
||||
n = cmgr->uctobc (*p, bcs, rem);
|
||||
n = cmgr->uctobc(*p, bcs, rem);
|
||||
if (n == 0)
|
||||
{
|
||||
ret = -1;
|
||||
@ -670,7 +670,7 @@ MOO_INLINE int moo_conv_ucs_to_bcs_with_cmgr (
|
||||
{
|
||||
moo_oow_t n;
|
||||
|
||||
n = cmgr->uctobc (*p, bcsbuf, MOO_COUNTOF(bcsbuf));
|
||||
n = cmgr->uctobc(*p, bcsbuf, MOO_COUNTOF(bcsbuf));
|
||||
if (n == 0)
|
||||
{
|
||||
ret = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user