Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lvandeve/lodepng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobsayshilol <bobsayshilol@live.co.uk>2019-07-28 20:42:04 +0300
committerbobsayshilol <bobsayshilol@live.co.uk>2019-07-28 21:26:59 +0300
commit0326898e9081e6d92fa8a752df768c1452f0bcb0 (patch)
treeedfc8f84a46d5b5abf82087d491d7f28b157fef3 /lodepng.h
parentf6155a4206046a31a9532d70caf517845af64c83 (diff)
Fix ABI incompatibility when calling a C++ compiled lodepng.cpp from C code or vice versa.
The addition of a virtual destructor to LodePNGState when compiled as C++ causes a vptr to be added at the start of the struct. This results in the members of the struct changing their offset depending on whether they're seen from C or C++ code. Internally the LodePNGState struct is never deleted (as to invoke the virtual destructor) and has no virtual methods called on it so it doesn't need to be virtual. Hence fix the ABI incompatibility by removing the virtual destructor.
Diffstat (limited to 'lodepng.h')
-rw-r--r--lodepng.h4
1 files changed, 0 insertions, 4 deletions
diff --git a/lodepng.h b/lodepng.h
index e8e240e..fcabf76 100644
--- a/lodepng.h
+++ b/lodepng.h
@@ -743,10 +743,6 @@ typedef struct LodePNGState {
LodePNGColorMode info_raw; /*specifies the format in which you would like to get the raw pixel buffer*/
LodePNGInfo info_png; /*info of the PNG image obtained after decoding*/
unsigned error;
-#ifdef LODEPNG_COMPILE_CPP
- /* For the lodepng::State subclass. */
- virtual ~LodePNGState(){}
-#endif
} LodePNGState;
/*init, cleanup and copy functions to use with this struct*/