Skip to content

Commit

Permalink
Remove Utf8String
Browse files Browse the repository at this point in the history
  • Loading branch information
lygstate committed May 5, 2021
1 parent f061000 commit 7fec3a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
5 changes: 2 additions & 3 deletions lib/ffi.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ Object.keys(bindings.FFI_TYPES).forEach(name => {
// make `size_t` use the "ffi_type_pointer"
ref.types.size_t.ffi_type = bindings.FFI_TYPES.pointer;

// make `Utf8String` use "ffi_type_pointer"
const CString = ref.types.CString || ref.types.Utf8String;
CString.ffi_type = bindings.FFI_TYPES.pointer;
// make `CString` use "ffi_type_pointer"
ref.types.CString.ffi_type = bindings.FFI_TYPES.pointer;

// make `Object` use the "ffi_type_pointer"
ref.types.Object.ffi_type = bindings.FFI_TYPES.pointer;
Expand Down
16 changes: 1 addition & 15 deletions lib/ref/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,20 +877,6 @@ types.CString = {
}
}

// alias Utf8String
var utfstringwarned = false;
Object.defineProperty(types, 'Utf8String', {
enumerable: false,
configurable: true,
get: function() {
if (!utfstringwarned) {
utfstringwarned = true;
console.error('"Utf8String" type is deprecated, use "CString" instead');
}
return types.CString;
}
});

/**
* The `bool` type.
*
Expand Down Expand Up @@ -974,7 +960,7 @@ Object.defineProperty(types, 'Utf8String', {
*/

// "typedef"s for the variable-sized types
[ 'bool', 'byte', 'char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long',
;[ 'bool', 'byte', 'char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long',
'ulong', 'longlong', 'ulonglong', 'size_t' ].forEach(name => {
const unsigned = name === 'bool'
|| name === 'byte'
Expand Down

0 comments on commit 7fec3a7

Please sign in to comment.