mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 772187 - OS.Type refactoring (Windows-specific). r=froydnj
This commit is contained in:
parent
f91eddba9b
commit
c56ca54b3a
@ -73,70 +73,56 @@
|
||||
// Initialize types
|
||||
|
||||
Types.HANDLE =
|
||||
new Type("HANDLE",
|
||||
ctypes.voidptr_t);
|
||||
Types.voidptr_t.withName("HANDLE");
|
||||
|
||||
/**
|
||||
* A C integer holding INVALID_HANDLE_VALUE in case of error or
|
||||
* a file descriptor in case of success.
|
||||
*/
|
||||
Types.maybe_HANDLE =
|
||||
new Type("maybe_HANDLE",
|
||||
Types.HANDLE.implementation,
|
||||
function (maybe) {
|
||||
if (ctypes.cast(maybe, ctypes.int).value == invalid_handle) {
|
||||
// Ensure that API clients can effectively compare against
|
||||
// Const.INVALID_HANDLE_VALUE. Without this cast,
|
||||
// == would always return |false|.
|
||||
return invalid_handle;
|
||||
}
|
||||
return ctypes.CDataFinalizer(maybe, _CloseHandle);
|
||||
});
|
||||
Types.HANDLE.withName("maybe_HANDLE");
|
||||
Types.maybe_HANDLE.importFromC =
|
||||
function maybe_HANDLE_importFromC(maybe) {
|
||||
if (Types.int.cast(maybe).value == INVALID_HANDLE) {
|
||||
// Ensure that API clients can effectively compare against
|
||||
// Const.INVALID_HANDLE_VALUE. Without this cast,
|
||||
// == would always return |false|.
|
||||
return INVALID_HANDLE;
|
||||
}
|
||||
return ctypes.CDataFinalizer(maybe, _CloseHandle);
|
||||
};
|
||||
|
||||
/**
|
||||
* A C integer holding INVALID_HANDLE_VALUE in case of error or
|
||||
* a file descriptor in case of success.
|
||||
*/
|
||||
Types.maybe_find_HANDLE =
|
||||
new Type("maybe_find_HANDLE",
|
||||
Types.HANDLE.implementation,
|
||||
function (maybe) {
|
||||
if (ctypes.cast(maybe, ctypes.int).value == invalid_handle) {
|
||||
// Ensure that API clients can effectively compare against
|
||||
// Const.INVALID_HANDLE_VALUE. Without this cast,
|
||||
// == would always return |false|.
|
||||
return invalid_handle;
|
||||
}
|
||||
return ctypes.CDataFinalizer(maybe, _FindClose);
|
||||
});
|
||||
Types.maybe_HANDLE.withName("maybe_find_HANDLE");
|
||||
|
||||
let invalid_handle = exports.OS.Constants.Win.INVALID_HANDLE_VALUE;
|
||||
let INVALID_HANDLE = exports.OS.Constants.Win.INVALID_HANDLE_VALUE;
|
||||
|
||||
Types.DWORD = Types.int32_t;
|
||||
Types.DWORD = Types.int32_t.withName("DWORD");
|
||||
|
||||
/**
|
||||
* A C integer holding -1 in case of error or a positive integer
|
||||
* in case of success.
|
||||
*/
|
||||
Types.negative_or_DWORD =
|
||||
new Type("negative_or_DWORD",
|
||||
ctypes.int32_t);
|
||||
Types.DWORD.withName("negative_or_DWORD");
|
||||
|
||||
/**
|
||||
* A C integer holding 0 in case of error or a positive integer
|
||||
* in case of success.
|
||||
*/
|
||||
Types.zero_or_DWORD =
|
||||
new Type("zero_or_DWORD",
|
||||
ctypes.int32_t);
|
||||
Types.DWORD.withName("zero_or_DWORD");
|
||||
|
||||
/**
|
||||
* A C integer holding 0 in case of error, any other value in
|
||||
* case of success.
|
||||
*/
|
||||
Types.zero_or_nothing =
|
||||
new Type("zero_or_nothing",
|
||||
Types.bool.implementation);
|
||||
Types.int.withName("zero_or_nothing");
|
||||
|
||||
Types.FILETIME =
|
||||
new Type("FILETIME",
|
||||
|
Loading…
Reference in New Issue
Block a user