generator: IntPtr.Zero for optional IntPtr params

IntPtr.Zero should be passed for optional IntPtr params
instead of null
This commit is contained in:
Stephan Sundermann 2013-07-17 17:15:52 +02:00 committed by Andrés G. Aragoneses
parent 972e6257fc
commit 949c538fe3

View file

@ -148,8 +148,14 @@ namespace GtkSharp.Generation {
foreach (Parameter p in parms) {
result [i] = p.PassAs != "" ? p.PassAs + " " : "";
if (p.IsOptional && p.PassAs == String.Empty)
result [i++] += (p.Generatable is StructGen || p.Generatable is BoxedGen) ? (p.CSType + ".Zero") : "null";
if (p.IsOptional && p.PassAs == String.Empty) {
if (p.Generatable is StructGen || p.Generatable is BoxedGen)
result [i++] += " .Zero";
else if (p.CSType == "System.IntPtr")
result [i++] += "System.IntPtr.Zero";
else
result [i++] += "null";
}
else
result [i++] += p.Name;
}