One example is
Yes, that function is deprecated, so maybe not the best example, but I think there are some more functions of this type, and I can not really forbid users to use deprecated functions if they desire…
For this function first parameter is datalength, and second parameter is the data array. But for most functions the parameters are exchanged, first the array, then the length.
I wonder if there is a secure way using gobject-introspection to detect the order? Currently I assume order first array, followed by length. (Of course only for the cases when we need and expect a length parameter, zero terminated arrays and cstring-arrays are handled separately, that works fine.) For a few rare cases like the one mentioned above this fails. First question is, why some functions uses length first – my guess is that author just ignored conventions? Next question is how to detect and automatically fix this case. Maybe just check parameter type after array – when there is none or it is not an integer type, then try parameter before array? Unfortunately coding this exchange for the bindings generator script is not that easy, maybe if these cases are really rare, I will just skip it and code these exceptions manually.
(I have also detected a few cases where two arrays are involved, followed by length parameter – I will see if I can handle this case automatically…)