summaryrefslogtreecommitdiff
path: root/cffi/commontypes.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-01-07 22:15:07 +0100
committerArmin Rigo <arigo@tunes.org>2015-01-07 22:15:07 +0100
commitcab085261800b001208df051eb206f8326acf301 (patch)
treec43a00ffc6ac3c3cf3c2db9fb2d79095a58fdb13 /cffi/commontypes.py
parent531a3d95ed02c46ce873ac25afb6ce8c080ec57c (diff)
downloadcffi-cab085261800b001208df051eb206f8326acf301.tar.gz
Clarify the error we get if we try to use TCHAR & friends before calling
ffi.set_unicode().
Diffstat (limited to 'cffi/commontypes.py')
-rw-r--r--cffi/commontypes.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cffi/commontypes.py b/cffi/commontypes.py
index 1af24d6..600a2d6 100644
--- a/cffi/commontypes.py
+++ b/cffi/commontypes.py
@@ -29,6 +29,9 @@ def resolve_common_type(commontype):
result = model.PointerType(resolve_common_type(result[:-2]))
elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
result = model.PrimitiveType(result)
+ elif result == 'set-unicode-needed':
+ raise api.FFIError("The Windows type %r is only available after "
+ "you call ffi.set_unicode()" % (commontype,))
else:
if commontype == result:
raise api.FFIError("Unsupported type: %r. Please file a bug "
@@ -232,6 +235,15 @@ def win_common_types(maxsize):
"USN": "LONGLONG",
"VOID": model.void_type,
"WPARAM": "UINT_PTR",
+
+ "TBYTE": "set-unicode-needed",
+ "TCHAR": "set-unicode-needed",
+ "LPCTSTR": "set-unicode-needed",
+ "PCTSTR": "set-unicode-needed",
+ "LPTSTR": "set-unicode-needed",
+ "PTSTR": "set-unicode-needed",
+ "PTBYTE": "set-unicode-needed",
+ "PTCHAR;": "set-unicode-needed",
})
return result