Setting all non transparent pixels in a surface or texture to white?

Basically any non black or transparent pixel should be set to white.

To be clear, is this really what you wanted? If so, my avatar…

… would look like this…

Which is kind of a cool effect, but did you instead want to make it grayscale (which is what a “black and white” movie is more like)? So it looks like this instead…

The algorithm changes a little, but both are simple bits of processing on an SDL_Surface.