The only places in which a cast is done between int and pointer is where the pointer is a void*. The void* is being used simply as a generic bucket that is big enough to hold either a pointer or an int.
Since void* is larger than int, and since void* is used by this cast to transport an int, but an int is never used to transport a void*; this is completely alright. There is nothing that needs to be fixed. Once upon a time, it was accepted that if a programmer wrote an explicit cast between two otherwise incompatible types, he knew what he was doing.
