summaryrefslogtreecommitdiff
path: root/win32/win32.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-07 11:47:06 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-07 11:47:06 +0000
commite9ff6d2717dce18093d60b3839463976bb523752 (patch)
tree1b03b6eb50d2bcd033f78a080d297c1a24ecffee /win32/win32.h
parentdd689578422c77934c796f47b23feb428d7fecd5 (diff)
downloadperl-e9ff6d2717dce18093d60b3839463976bb523752.tar.gz
various Windows tweaks: make $^E a little less buggy by saving
and restoring system error across TLS fetch; avoid needless copying of buffers p4raw-id: //depot/perl@5024
Diffstat (limited to 'win32/win32.h')
-rw-r--r--win32/win32.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/win32/win32.h b/win32/win32.h
index f8e8dc7d79..924ce8ae03 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -422,13 +422,15 @@ struct interp_intern {
/* Use CP_ACP when mode is ANSI */
/* Use CP_UTF8 when mode is UTF8 */
-#define A2WHELPER(lpa, lpw, nBytes)\
- lpw[0] = 0, MultiByteToWideChar((IN_BYTE) ? CP_ACP : CP_UTF8, 0, \
- lpa, -1, lpw, (nBytes/sizeof(WCHAR)))
-
-#define W2AHELPER(lpw, lpa, nChars)\
- lpa[0] = '\0', WideCharToMultiByte((IN_BYTE) ? CP_ACP : CP_UTF8, 0, \
- lpw, -1, (LPSTR)lpa, nChars, NULL, NULL)
+#define A2WHELPER_LEN(lpa, alen, lpw, nBytes)\
+ (lpw[0] = 0, MultiByteToWideChar((IN_BYTE) ? CP_ACP : CP_UTF8, 0, \
+ lpa, alen, lpw, (nBytes/sizeof(WCHAR))))
+#define A2WHELPER(lpa, lpw, nBytes) A2WHELPER_LEN(lpa, -1, lpw, nBytes)
+
+#define W2AHELPER_LEN(lpw, wlen, lpa, nChars)\
+ (lpa[0] = '\0', WideCharToMultiByte((IN_BYTE) ? CP_ACP : CP_UTF8, 0, \
+ lpw, wlen, (LPSTR)lpa, nChars,NULL,NULL))
+#define W2AHELPER(lpw, lpa, nChars) W2AHELPER_LEN(lpw, -1, lpa, nChars)
#define USING_WIDE() (PL_bigchar && PerlEnv_os_id() == VER_PLATFORM_WIN32_NT)