Fixes bug 589930.
if (ellipsis) {
/* ensure variable argument list ends with NULL
* except when using printf-style arguments */
- if (!m.printf_format && m.sentinel != "") {
+ if (!m.printf_format && !m.scanf_format && m.sentinel != "") {
creation_call.add_argument (new CCodeConstant (m.sentinel));
}
}
if (ellipsis) {
/* ensure variable argument list ends with NULL
* except when using printf-style arguments */
- if (!m.printf_format && m.sentinel != "") {
+ if (!m.printf_format && !m.scanf_format && m.sentinel != "") {
in_arg_map.set (get_param_pos (-1, true), new CCodeConstant (m.sentinel));
}
} else if (itype is DelegateType) {
write_indent ();
write_string ("[PrintfFormat]");
}
+ if (m.scanf_format) {
+ write_indent ();
+ write_string ("[ScanfFormat]");
+ }
var ccode_params = new StringBuilder ();
var separator = "";
*/
public bool printf_format { get; set; }
+ /**
+ * Specifies whether this method expects scanf-style format arguments.
+ */
+ public bool scanf_format { get; set; }
+
/**
* Specifies whether a construct function with a GType parameter is
* available. This is only applicable to creation methods.
return_type.floating_reference = true;
} else if (a.name == "PrintfFormat") {
printf_format = true;
+ } else if (a.name == "ScanfFormat") {
+ scanf_format = true;
}
}
}
public bool has_suffix (string suffix);
[CCode (cname = "g_strdup_printf"), PrintfFormat]
public string printf (...);
- [CCode (cname = "sscanf", cheader_filename = "stdio.h")]
+ [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
public int scanf (...);
[CCode (cname = "g_strconcat")]
public string concat (string string2, ...);
public weak string gets (char[] s);
[CCode (cname = "feof")]
public bool eof ();
- [CCode (cname = "fscanf")]
+ [CCode (cname = "fscanf"), ScanfFormat]
public int scanf (string format, ...);
[CCode (cname = "fflush")]
public int flush ();