Comment 2 for bug 408441

Revision history for this message
John A Meinel (jameinel) wrote :

Well, it wouldn't help with *this* because this is just a small bug in some raw C code. Namely we originally had the function as:

int function(const unsigned char **, const unsigned char*)

but we had troubles because C doesn't actually allow:

unsigned char **mypointer

function(mypointer, ...)

Because it claims it can't pass an "unsigned char **" to "const unsigned char **".

So we changed the api to:
int function(unsigned char **, const unsigned char*)

and then update some callers, but apparently missed this one. I'm not really sure why gcc wouldn't always fail with:

const unsigned char *buffer;
function(&buffer, ...)

Certainly 'const' and ** don't play nicely together. (Versus 'const char *' which can be auto consted if a 'char *' is passed.)

Part of the problem is that pyrex doesn't natively have any idea what "const" means, and the designer has explicitly rejected the idea of supporting it. (He feels it is a mis-feature of the C language.) I'm pretty sure cython doesn't yet support it either anyway.

(So the change in the api was necessitated by pyrex/cython, and we just forgot to update some C code that was still using it in the old fashion.)

I'm attaching a branch which just does a cast, since we know it is safe to do.