[Dlfcn] Enable nullability and fix code accordingly. (#13282)
This commit is contained in:
Родитель
8216ee6665
Коммит
0c6b3a7f77
|
@ -170,7 +170,7 @@ namespace AddressBook {
|
|||
|
||||
static ABAddressBook ()
|
||||
{
|
||||
ErrorDomain = Dlfcn.GetStringConstant (Libraries.AddressBook.Handle, "ABAddressBookErrorDomain");
|
||||
ErrorDomain = Dlfcn.GetStringConstant (Libraries.AddressBook.Handle, "ABAddressBookErrorDomain")!;
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace CoreText {
|
|||
|
||||
static CTFontCollectionOptionKey ()
|
||||
{
|
||||
RemoveDuplicates = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTFontCollectionRemoveDuplicatesOption");
|
||||
RemoveDuplicates = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTFontCollectionRemoveDuplicatesOption")!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,28 +110,28 @@ namespace CoreText {
|
|||
static CTFontDescriptorAttributeKey ()
|
||||
{
|
||||
var handle = Libraries.CoreText.Handle;
|
||||
Url = Dlfcn.GetStringConstant (handle, "kCTFontURLAttribute");
|
||||
Name = Dlfcn.GetStringConstant (handle, "kCTFontNameAttribute");
|
||||
DisplayName = Dlfcn.GetStringConstant (handle, "kCTFontDisplayNameAttribute");
|
||||
FamilyName = Dlfcn.GetStringConstant (handle, "kCTFontFamilyNameAttribute");
|
||||
StyleName = Dlfcn.GetStringConstant (handle, "kCTFontStyleNameAttribute");
|
||||
Traits = Dlfcn.GetStringConstant (handle, "kCTFontTraitsAttribute");
|
||||
Variation = Dlfcn.GetStringConstant (handle, "kCTFontVariationAttribute");
|
||||
Size = Dlfcn.GetStringConstant (handle, "kCTFontSizeAttribute");
|
||||
Matrix = Dlfcn.GetStringConstant (handle, "kCTFontMatrixAttribute");
|
||||
CascadeList = Dlfcn.GetStringConstant (handle, "kCTFontCascadeListAttribute");
|
||||
CharacterSet = Dlfcn.GetStringConstant (handle, "kCTFontCharacterSetAttribute");
|
||||
Languages = Dlfcn.GetStringConstant (handle, "kCTFontLanguagesAttribute");
|
||||
BaselineAdjust = Dlfcn.GetStringConstant (handle, "kCTFontBaselineAdjustAttribute");
|
||||
MacintoshEncodings = Dlfcn.GetStringConstant (handle, "kCTFontMacintoshEncodingsAttribute");
|
||||
Features = Dlfcn.GetStringConstant (handle, "kCTFontFeaturesAttribute");
|
||||
FeatureSettings = Dlfcn.GetStringConstant (handle, "kCTFontFeatureSettingsAttribute");
|
||||
FixedAdvance = Dlfcn.GetStringConstant (handle, "kCTFontFixedAdvanceAttribute");
|
||||
FontOrientation = Dlfcn.GetStringConstant (handle, "kCTFontOrientationAttribute");
|
||||
FontFormat = Dlfcn.GetStringConstant (handle, "kCTFontFormatAttribute");
|
||||
RegistrationScope = Dlfcn.GetStringConstant (handle, "kCTFontRegistrationScopeAttribute");
|
||||
Priority = Dlfcn.GetStringConstant (handle, "kCTFontPriorityAttribute");
|
||||
Enabled = Dlfcn.GetStringConstant (handle, "kCTFontEnabledAttribute");
|
||||
Url = Dlfcn.GetStringConstant (handle, "kCTFontURLAttribute")!;
|
||||
Name = Dlfcn.GetStringConstant (handle, "kCTFontNameAttribute")!;
|
||||
DisplayName = Dlfcn.GetStringConstant (handle, "kCTFontDisplayNameAttribute")!;
|
||||
FamilyName = Dlfcn.GetStringConstant (handle, "kCTFontFamilyNameAttribute")!;
|
||||
StyleName = Dlfcn.GetStringConstant (handle, "kCTFontStyleNameAttribute")!;
|
||||
Traits = Dlfcn.GetStringConstant (handle, "kCTFontTraitsAttribute")!;
|
||||
Variation = Dlfcn.GetStringConstant (handle, "kCTFontVariationAttribute")!;
|
||||
Size = Dlfcn.GetStringConstant (handle, "kCTFontSizeAttribute")!;
|
||||
Matrix = Dlfcn.GetStringConstant (handle, "kCTFontMatrixAttribute")!;
|
||||
CascadeList = Dlfcn.GetStringConstant (handle, "kCTFontCascadeListAttribute")!;
|
||||
CharacterSet = Dlfcn.GetStringConstant (handle, "kCTFontCharacterSetAttribute")!;
|
||||
Languages = Dlfcn.GetStringConstant (handle, "kCTFontLanguagesAttribute")!;
|
||||
BaselineAdjust = Dlfcn.GetStringConstant (handle, "kCTFontBaselineAdjustAttribute")!;
|
||||
MacintoshEncodings = Dlfcn.GetStringConstant (handle, "kCTFontMacintoshEncodingsAttribute")!;
|
||||
Features = Dlfcn.GetStringConstant (handle, "kCTFontFeaturesAttribute")!;
|
||||
FeatureSettings = Dlfcn.GetStringConstant (handle, "kCTFontFeatureSettingsAttribute")!;
|
||||
FixedAdvance = Dlfcn.GetStringConstant (handle, "kCTFontFixedAdvanceAttribute")!;
|
||||
FontOrientation = Dlfcn.GetStringConstant (handle, "kCTFontOrientationAttribute")!;
|
||||
FontFormat = Dlfcn.GetStringConstant (handle, "kCTFontFormatAttribute")!;
|
||||
RegistrationScope = Dlfcn.GetStringConstant (handle, "kCTFontRegistrationScopeAttribute")!;
|
||||
Priority = Dlfcn.GetStringConstant (handle, "kCTFontPriorityAttribute")!;
|
||||
Enabled = Dlfcn.GetStringConstant (handle, "kCTFontEnabledAttribute")!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,11 +62,11 @@ namespace CoreText {
|
|||
static CTFrameAttributeKey ()
|
||||
{
|
||||
var handle = Libraries.CoreText.Handle;
|
||||
Progression = Dlfcn.GetStringConstant (handle, "kCTFrameProgressionAttributeName");
|
||||
PathFillRule = Dlfcn.GetStringConstant (handle, "kCTFramePathFillRuleAttributeName");
|
||||
PathWidth = Dlfcn.GetStringConstant (handle, "kCTFramePathWidthAttributeName");
|
||||
ClippingPaths = Dlfcn.GetStringConstant (handle, "kCTFrameClippingPathsAttributeName");
|
||||
PathClippingPath = Dlfcn.GetStringConstant (handle, "kCTFramePathClippingPathAttributeName");
|
||||
Progression = Dlfcn.GetStringConstant (handle, "kCTFrameProgressionAttributeName")!;
|
||||
PathFillRule = Dlfcn.GetStringConstant (handle, "kCTFramePathFillRuleAttributeName")!;
|
||||
PathWidth = Dlfcn.GetStringConstant (handle, "kCTFramePathWidthAttributeName")!;
|
||||
ClippingPaths = Dlfcn.GetStringConstant (handle, "kCTFrameClippingPathsAttributeName")!;
|
||||
PathClippingPath = Dlfcn.GetStringConstant (handle, "kCTFramePathClippingPathAttributeName")!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace CoreText {
|
|||
|
||||
static CTTextTabOptionKey ()
|
||||
{
|
||||
ColumnTerminators = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTTabColumnTerminatorsAttributeName");
|
||||
ColumnTerminators = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTTabColumnTerminatorsAttributeName")!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,41 +105,41 @@ namespace CoreVideo {
|
|||
static CVPixelFormatDescription ()
|
||||
{
|
||||
var handle = Libraries.CoreVideo.Handle;
|
||||
NameKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatName");
|
||||
ConstantKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatConstant");
|
||||
CodecTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCodecType");
|
||||
FourCCKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFourCC");
|
||||
PlanesKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatPlanes");
|
||||
BlockWidthKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockWidth");
|
||||
BlockHeightKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHeight");
|
||||
BitsPerBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBitsPerBlock");
|
||||
BlockHorizontalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHorizontalAlignment");
|
||||
BlockVerticalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockVerticalAlignment");
|
||||
BlackBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlackBlock");
|
||||
HorizontalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatHorizontalSubsampling");
|
||||
VerticalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatVerticalSubsampling");
|
||||
OpenGLFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLFormat");
|
||||
OpenGLTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLType");
|
||||
OpenGLInternalFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLInternalFormat");
|
||||
CGBitmapInfoKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapInfo");
|
||||
QDCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatQDCompatibility");
|
||||
CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapContextCompatibility");
|
||||
CGImageCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGImageCompatibility");
|
||||
OpenGLCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLCompatibility");
|
||||
FillExtendedPixelsCallbackKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFillExtendedPixelsCallback");
|
||||
NameKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatName")!;
|
||||
ConstantKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatConstant")!;
|
||||
CodecTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCodecType")!;
|
||||
FourCCKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFourCC")!;
|
||||
PlanesKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatPlanes")!;
|
||||
BlockWidthKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockWidth")!;
|
||||
BlockHeightKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHeight")!;
|
||||
BitsPerBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBitsPerBlock")!;
|
||||
BlockHorizontalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHorizontalAlignment")!;
|
||||
BlockVerticalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockVerticalAlignment")!;
|
||||
BlackBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlackBlock")!;
|
||||
HorizontalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatHorizontalSubsampling")!;
|
||||
VerticalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatVerticalSubsampling")!;
|
||||
OpenGLFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLFormat")!;
|
||||
OpenGLTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLType")!;
|
||||
OpenGLInternalFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLInternalFormat")!;
|
||||
CGBitmapInfoKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapInfo")!;
|
||||
QDCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatQDCompatibility")!;
|
||||
CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapContextCompatibility")!;
|
||||
CGImageCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGImageCompatibility")!;
|
||||
OpenGLCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLCompatibility")!;
|
||||
FillExtendedPixelsCallbackKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFillExtendedPixelsCallback")!;
|
||||
|
||||
//iOS8 only
|
||||
ContainsRgb = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsRGB");
|
||||
ContainsYCbCr = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsYCbCr");
|
||||
ContainsRgb = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsRGB")!;
|
||||
ContainsYCbCr = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsYCbCr")!;
|
||||
|
||||
//iOS9 only
|
||||
ComponentRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange");
|
||||
ComponentRangeFullRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_FullRange");
|
||||
ComponentRangeVideoRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_VideoRange");
|
||||
ComponentRangeWideRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_WideRange");
|
||||
ComponentRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange")!;
|
||||
ComponentRangeFullRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_FullRange")!;
|
||||
ComponentRangeVideoRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_VideoRange")!;
|
||||
ComponentRangeWideRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_WideRange")!;
|
||||
|
||||
// Xcode 10
|
||||
ContainsGrayscaleKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsGrayscale");
|
||||
ContainsGrayscaleKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsGrayscale")!;
|
||||
}
|
||||
|
||||
// note: bad documentation, ref: https://bugzilla.xamarin.com/show_bug.cgi?id=13917
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -94,9 +97,9 @@ namespace ObjCRuntime {
|
|||
public static extern int dlclose (IntPtr handle);
|
||||
|
||||
[DllImport (Constants.libSystemLibrary, EntryPoint="dlopen")]
|
||||
internal static extern IntPtr _dlopen (string path, int mode /* this is int32, not nint */);
|
||||
internal static extern IntPtr _dlopen (string? path, int mode /* this is int32, not nint */);
|
||||
|
||||
public static IntPtr dlopen (string path, int mode)
|
||||
public static IntPtr dlopen (string? path, int mode)
|
||||
{
|
||||
return dlopen (path, mode, showWarning: true);
|
||||
}
|
||||
|
@ -110,7 +113,7 @@ namespace ObjCRuntime {
|
|||
warningShown = true;
|
||||
}
|
||||
|
||||
internal static IntPtr dlopen (string path, int mode, bool showWarning)
|
||||
internal static IntPtr dlopen (string? path, int mode, bool showWarning)
|
||||
{
|
||||
var x = _dlopen (path, mode);
|
||||
if (x != IntPtr.Zero)
|
||||
|
@ -119,7 +122,7 @@ namespace ObjCRuntime {
|
|||
// In iOS < 9, you could dlopen ("libc") and that would work.
|
||||
// In iOS >= 9, this fails with:
|
||||
// "no cache image with name (<top>)"
|
||||
if (path.IndexOf ('/') == -1){
|
||||
if (path?.IndexOf ('/') == -1){
|
||||
if (showWarning)
|
||||
WarnOnce ();
|
||||
return dlopen ("/usr/lib/" + path, mode, false);
|
||||
|
@ -138,13 +141,13 @@ namespace ObjCRuntime {
|
|||
[DllImport (Constants.libSystemLibrary, EntryPoint="dlerror")]
|
||||
internal static extern IntPtr dlerror_ ();
|
||||
|
||||
public static string dlerror ()
|
||||
public static string? dlerror ()
|
||||
{
|
||||
// we can't free the string returned from dlerror
|
||||
return Marshal.PtrToStringAnsi (dlerror_ ());
|
||||
}
|
||||
|
||||
public static NSString GetStringConstant (IntPtr handle, string symbol)
|
||||
public static NSString? GetStringConstant (IntPtr handle, string symbol)
|
||||
{
|
||||
var indirect = dlsym (handle, symbol);
|
||||
if (indirect == IntPtr.Zero)
|
||||
|
@ -152,7 +155,7 @@ namespace ObjCRuntime {
|
|||
var actual = Marshal.ReadIntPtr (indirect);
|
||||
if (actual == IntPtr.Zero)
|
||||
return null;
|
||||
return (NSString) Runtime.GetNSObject (actual);
|
||||
return Runtime.GetNSObject<NSString> (actual);
|
||||
}
|
||||
|
||||
public static IntPtr GetIndirect (IntPtr handle, string symbol)
|
||||
|
@ -160,7 +163,7 @@ namespace ObjCRuntime {
|
|||
return dlsym (handle, symbol);
|
||||
}
|
||||
|
||||
public static NSNumber GetNSNumber (IntPtr handle, string symbol)
|
||||
public static NSNumber? GetNSNumber (IntPtr handle, string symbol)
|
||||
{
|
||||
var indirect = dlsym (handle, symbol);
|
||||
if (indirect == IntPtr.Zero)
|
||||
|
@ -168,7 +171,7 @@ namespace ObjCRuntime {
|
|||
var actual = Marshal.ReadIntPtr (indirect);
|
||||
if (actual == IntPtr.Zero)
|
||||
return null;
|
||||
return (NSNumber) Runtime.GetNSObject (actual);
|
||||
return Runtime.GetNSObject<NSNumber> (actual);
|
||||
}
|
||||
|
||||
public static int GetInt32 (IntPtr handle, string symbol)
|
||||
|
@ -228,7 +231,7 @@ namespace ObjCRuntime {
|
|||
return (ulong) Marshal.ReadInt64 (indirect);
|
||||
}
|
||||
|
||||
#if !XAMCORE_4_0
|
||||
#if !NET
|
||||
[Obsolete ("Use 'SetInt64' for long values instead.")]
|
||||
public static void SetUInt64 (IntPtr handle, string symbol, long value)
|
||||
{
|
||||
|
@ -249,31 +252,31 @@ namespace ObjCRuntime {
|
|||
Marshal.WriteInt64 (indirect, (long) value);
|
||||
}
|
||||
|
||||
public static void SetString (IntPtr handle, string symbol, string value)
|
||||
public static void SetString (IntPtr handle, string symbol, string? value)
|
||||
{
|
||||
var indirect = dlsym (handle, symbol);
|
||||
if (indirect == IntPtr.Zero)
|
||||
return;
|
||||
Marshal.WriteIntPtr (indirect, value == null ? IntPtr.Zero : NSString.CreateNative (value));
|
||||
Marshal.WriteIntPtr (indirect, CFString.CreateNative (value));
|
||||
}
|
||||
|
||||
public static void SetString (IntPtr handle, string symbol, NSString value)
|
||||
public static void SetString (IntPtr handle, string symbol, NSString? value)
|
||||
{
|
||||
var indirect = dlsym (handle, symbol);
|
||||
if (indirect == IntPtr.Zero)
|
||||
return;
|
||||
var strHandle = value == null ? IntPtr.Zero : value.Handle;
|
||||
var strHandle = value.GetHandle ();
|
||||
if (strHandle != IntPtr.Zero)
|
||||
CFObject.CFRetain (strHandle);
|
||||
Marshal.WriteIntPtr (indirect, strHandle);
|
||||
}
|
||||
|
||||
public static void SetArray (IntPtr handle, string symbol, NSArray array)
|
||||
public static void SetArray (IntPtr handle, string symbol, NSArray? array)
|
||||
{
|
||||
var indirect = dlsym (handle, symbol);
|
||||
if (indirect == IntPtr.Zero)
|
||||
return;
|
||||
var arrayHandle = array == null ? IntPtr.Zero : array.Handle;
|
||||
var arrayHandle = array.GetHandle ();
|
||||
if (arrayHandle != IntPtr.Zero)
|
||||
CFObject.CFRetain (arrayHandle);
|
||||
Marshal.WriteIntPtr (indirect, arrayHandle);
|
||||
|
@ -435,7 +438,7 @@ namespace ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
internal static int SlowGetInt32 (string lib, string symbol)
|
||||
internal static int SlowGetInt32 (string? lib, string symbol)
|
||||
{
|
||||
var handle = dlopen (lib, 0);
|
||||
if (handle == IntPtr.Zero)
|
||||
|
@ -447,7 +450,7 @@ namespace ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
internal static long SlowGetInt64 (string lib, string symbol)
|
||||
internal static long SlowGetInt64 (string? lib, string symbol)
|
||||
{
|
||||
var handle = dlopen (lib, 0);
|
||||
if (handle == IntPtr.Zero)
|
||||
|
@ -459,7 +462,7 @@ namespace ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
internal static IntPtr SlowGetIntPtr (string lib, string symbol)
|
||||
internal static IntPtr SlowGetIntPtr (string? lib, string symbol)
|
||||
{
|
||||
var handle = dlopen (lib, 0);
|
||||
if (handle == IntPtr.Zero)
|
||||
|
@ -471,7 +474,7 @@ namespace ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
internal static double SlowGetDouble (string lib, string symbol)
|
||||
internal static double SlowGetDouble (string? lib, string symbol)
|
||||
{
|
||||
var handle = dlopen (lib, 0);
|
||||
if (handle == IntPtr.Zero)
|
||||
|
@ -483,7 +486,7 @@ namespace ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
internal static NSString SlowGetStringConstant (string lib, string symbol)
|
||||
internal static NSString? SlowGetStringConstant (string? lib, string symbol)
|
||||
{
|
||||
var handle = dlopen (lib, 0);
|
||||
if (handle == IntPtr.Zero)
|
||||
|
|
|
@ -6972,7 +6972,7 @@ public partial class Generator : IMemberGatherer {
|
|||
if (field_pi.PropertyType == TypeManager.NSString){
|
||||
print ("if (_{0} is null)", field_pi.Name);
|
||||
indent++;
|
||||
print ("_{0} = Dlfcn.GetStringConstant (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name);
|
||||
print ("_{0} = Dlfcn.GetStringConstant (Libraries.{2}.Handle, \"{1}\")!;", field_pi.Name, fieldAttr.SymbolName, library_name);
|
||||
indent--;
|
||||
print ("return _{0};", field_pi.Name);
|
||||
} else if (field_pi.PropertyType.Name == "NSArray"){
|
||||
|
@ -7024,7 +7024,7 @@ public partial class Generator : IMemberGatherer {
|
|||
if (smartEnumTypeName != null) {
|
||||
print ("if (_{0} is null)", field_pi.Name);
|
||||
indent++;
|
||||
print ("_{0} = Dlfcn.GetStringConstant (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name);
|
||||
print ("_{0} = Dlfcn.GetStringConstant (Libraries.{2}.Handle, \"{1}\")!;", field_pi.Name, fieldAttr.SymbolName, library_name);
|
||||
indent--;
|
||||
print ($"return {smartEnumTypeName}Extensions.GetValue (_{field_pi.Name});");
|
||||
} else if (GetNativeEnumToManagedExpression (field_pi.PropertyType, out var preExpression, out var postExpression, out var _)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче