mono: make public static field const or readonly

Summary: This patch will fix CA2211 compiler warnings.

Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true

Reviewers: lauromoura, Jaehyun_Cho

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10423
This commit is contained in:
Yeongjong Lee 2019-10-16 10:39:52 -03:00 committed by Lauro Moura
parent 50d318ab13
commit ee33f93743
9 changed files with 38 additions and 38 deletions

View File

@ -76,7 +76,7 @@ struct native_function_definition_generator
// Delegate holder (so it can't be collected).
if(!as_generator
(indent << "public static Efl.Eo.FunctionWrapper<" << string << "_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
(indent << "public static readonly Efl.Eo.FunctionWrapper<" << string << "_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
<< string << "_api_delegate>(Module, \"" << string << "\");\n\n")
.generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name, f.c_name), context))
return false;

View File

@ -21,18 +21,18 @@ public class Libs {
public const string Libdl = "libdl.so";
public const string Kernel32 = "kernel32.dll";
public static Efl.Eo.NativeModule EflModule = new Efl.Eo.NativeModule(Efl);
public static Efl.Eo.NativeModule CoreModule = new Efl.Eo.NativeModule(Ecore);
public static Efl.Eo.NativeModule EinaModule = new Efl.Eo.NativeModule(Eina);
public static Efl.Eo.NativeModule EoModule = new Efl.Eo.NativeModule(Eo);
public static Efl.Eo.NativeModule EvasModule = new Efl.Eo.NativeModule(Evas);
public static Efl.Eo.NativeModule EvilModule = new Efl.Eo.NativeModule(Evil);
public static Efl.Eo.NativeModule EdjeModule = new Efl.Eo.NativeModule(Edje);
public static Efl.Eo.NativeModule ElementaryModule = new Efl.Eo.NativeModule(Elementary);
public static Efl.Eo.NativeModule EldbusModule = new Efl.Eo.NativeModule(Eldbus);
public static Efl.Eo.NativeModule CustomExportsModule = new Efl.Eo.NativeModule(CustomExports);
public static Efl.Eo.NativeModule LibdlModule = new Efl.Eo.NativeModule(Libdl);
public static Efl.Eo.NativeModule Kernel32Module = new Efl.Eo.NativeModule(Kernel32);
public static readonly Efl.Eo.NativeModule EflModule = new Efl.Eo.NativeModule(Efl);
public static readonly Efl.Eo.NativeModule CoreModule = new Efl.Eo.NativeModule(Ecore);
public static readonly Efl.Eo.NativeModule EinaModule = new Efl.Eo.NativeModule(Eina);
public static readonly Efl.Eo.NativeModule EoModule = new Efl.Eo.NativeModule(Eo);
public static readonly Efl.Eo.NativeModule EvasModule = new Efl.Eo.NativeModule(Evas);
public static readonly Efl.Eo.NativeModule EvilModule = new Efl.Eo.NativeModule(Evil);
public static readonly Efl.Eo.NativeModule EdjeModule = new Efl.Eo.NativeModule(Edje);
public static readonly Efl.Eo.NativeModule ElementaryModule = new Efl.Eo.NativeModule(Elementary);
public static readonly Efl.Eo.NativeModule EldbusModule = new Efl.Eo.NativeModule(Eldbus);
public static readonly Efl.Eo.NativeModule CustomExportsModule = new Efl.Eo.NativeModule(CustomExports);
public static readonly Efl.Eo.NativeModule LibdlModule = new Efl.Eo.NativeModule(Libdl);
public static readonly Efl.Eo.NativeModule Kernel32Module = new Efl.Eo.NativeModule(Kernel32);
}
}

View File

@ -52,7 +52,7 @@ public static class ArrayNativeFunctions
/// </summary>
public class Array<T> : IEnumerable<T>, IDisposable
{
public static uint DefaultStep = 32;
public const uint DefaultStep = 32;
/// <summary>Pointer to the native buffer.</summary>
[EditorBrowsable(EditorBrowsableState.Never)]

View File

@ -26,28 +26,28 @@ public struct Error : IComparable<Error>
/// Unhandled Exception error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error UNHANDLED_EXCEPTION;
public static readonly Error UNHANDLED_EXCEPTION;
/// <summary>
/// No error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error NO_ERROR = new Error(0);
public static readonly Error NO_ERROR = new Error(0);
/// <summary>
/// Permission error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error EPERM = new Error(1);
public static readonly Error EPERM = new Error(1);
/// <summary>
/// No entity error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error ENOENT = new Error(2);
public static readonly Error ENOENT = new Error(2);
/// <summary>
/// Cancelled error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error ECANCELED = new Error(125);
public static readonly Error ECANCELED = new Error(125);
/// <summary>
/// Constructor.

View File

@ -74,7 +74,7 @@ public static class InarrayNativeFunctions
/// </summary>
public class Inarray<T> : IEnumerable<T>, IDisposable
{
public static uint DefaultStep = 0;
public const uint DefaultStep = 0;
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr Handle {get;set;} = IntPtr.Zero;
/// <summary>Whether this wrapper owns the native buffer.

View File

@ -69,51 +69,51 @@ public class Log
/// <summary>Light red
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTRED = "\033[31;1m";
public const string LIGHTRED = "\033[31;1m";
/// <summary>Red
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string RED = "\033[31m";
public const string RED = "\033[31m";
/// <summary>Light blue
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTBLUE = "\033[34;1m";
public const string LIGHTBLUE = "\033[34;1m";
/// <summary>Blue
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string BLUE = "\033[34m";
public const string BLUE = "\033[34m";
/// <summary>Green
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string GREEN = "\033[32;1m";
public const string GREEN = "\033[32;1m";
/// <summary>Yellow
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string YELLOW = "\033[33;1m";
public const string YELLOW = "\033[33;1m";
/// <summary>Orange
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string ORANGE = "\033[0;33m";
public const string ORANGE = "\033[0;33m";
/// <summary>White
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string WHITE = "\033[37;1m";
public const string WHITE = "\033[37;1m";
/// <summary>Light cyan
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTCYAN = "\033[36;1m";
public const string LIGHTCYAN = "\033[36;1m";
/// <summary>Cyan
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string CYAN = "\033[36m";
public const string CYAN = "\033[36m";
/// <summary>Reset
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string RESET = "\033[0m";
public const string RESET = "\033[0m";
/// <summary>Bold
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string HIGH = "\033[1m";
public const string HIGH = "\033[1m";
}
private static int domain = -1;

View File

@ -3591,7 +3591,7 @@ public class ValueTypeMarshaler : ICustomMarshaler
var r = ValueTypeBridge.GetManaged(pNativeData);
return new ValueTypeBox(r);
}
public static Eina.ValueType vtype;
public static readonly Eina.ValueType vtype;
/// <summary>Retrieves the C pointer from a given boxed enum value type.</summary>
public IntPtr MarshalManagedToNative(object managedObj)

View File

@ -10,7 +10,7 @@ namespace eldbus
public static class Timeout
{
public static int Infinite = 0x7fffffff;
public const int Infinite = 0x7fffffff;
}
[StructLayout(LayoutKind.Sequential)]

View File

@ -36,12 +36,12 @@ public class Globals
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool efl_object_init_delegate();
public static FunctionWrapper<efl_object_init_delegate> efl_object_init_ptr =
public static readonly FunctionWrapper<efl_object_init_delegate> efl_object_init_ptr =
new FunctionWrapper<efl_object_init_delegate>(efl.Libs.EoModule, "efl_object_init");
public static bool efl_object_init() => efl_object_init_ptr.Value.Delegate();
public delegate void efl_object_shutdown_delegate();
public static FunctionWrapper<efl_object_shutdown_delegate> efl_object_shutdown_ptr = new FunctionWrapper<efl_object_shutdown_delegate>(efl.Libs.EoModule, "efl_object_shutdown");
public static readonly FunctionWrapper<efl_object_shutdown_delegate> efl_object_shutdown_ptr = new FunctionWrapper<efl_object_shutdown_delegate>(efl.Libs.EoModule, "efl_object_shutdown");
public static void efl_object_shutdown() => efl_object_shutdown_ptr.Value.Delegate();
// [DllImport(efl.Libs.Eo)] public static extern void efl_object_shutdown();
@ -996,10 +996,10 @@ public static class ClassRegister
typeFromKlass[klassPtr] = objectType;
}
public static System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr> klassFromType
public static readonly System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr> klassFromType
= new System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr>();
public static System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type> typeFromKlass
public static readonly System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type> typeFromKlass
= new System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type>();
private static readonly object klassAllocLock = new object();