Alcaro / Flips

Floating IPS is a patcher for IPS and BPS files.
Other
309 stars 45 forks source link

De-inline `bps_create_delta_inmem` and make it `extern "C"` #30

Closed althonos closed 4 years ago

althonos commented 4 years ago

Hi again !

This PR is here to fix an issue I encountered while binding to libbps: because bps_create_delta_inmem is declared as inline, you cannot link to it as extern "C" code.

However, bps_create_delta takes file* as arguments, which are C++ classes, therefore you cannot link to it from C code as the C++ ABI is not standard, so you cannot use it from C code. mem, however, is a proper struct so it's C compatible.

Therefore, by de-inlining bps_create_delta_inmem you make it possible to create BPS patches from C code, where is was not feasible before.

(also, sorry about the big diff, my code editor removes trailing whitespaces on save).

Alcaro commented 4 years ago

Yeah I'm not merging a patch that rewrites hundreds of lines of whitespace. Not only do I want the whitespace this way, but it also means a lot of irrelevant changes to wade through to review it.

But moving that function to a .cpp is a quite valid request. Also those file* functions should be in #ifdef __cplusplus. I'll just do that myself.