Remove Q_C_CALLBACKS
This is useless. The C++ language does require callbacks passed to C functions to also be extern "C". That's what this macro was doing. But #ifdef'ing for the macro only made the code uglier. Just let the extern "C" be there for all compilers. PS: C++ classes can't be extern "C"... Change-Id: Ic5d393bfd36e48a193fcffff13b9c9b3923443dd Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
2f010390ad
commit
9d46189a64
@ -136,7 +136,6 @@
|
|||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
|
# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||||
# define Q_C_CALLBACKS
|
|
||||||
# if defined(__MINGW32__)
|
# if defined(__MINGW32__)
|
||||||
# define Q_CC_MINGW
|
# define Q_CC_MINGW
|
||||||
# endif
|
# endif
|
||||||
@ -312,7 +311,6 @@
|
|||||||
/* The Comeau compiler is based on EDG and does define __EDG__ */
|
/* The Comeau compiler is based on EDG and does define __EDG__ */
|
||||||
# if defined(__COMO__)
|
# if defined(__COMO__)
|
||||||
# define Q_CC_COMEAU
|
# define Q_CC_COMEAU
|
||||||
# define Q_C_CALLBACKS
|
|
||||||
|
|
||||||
/* The `using' keyword was introduced to avoid KAI C++ warnings
|
/* The `using' keyword was introduced to avoid KAI C++ warnings
|
||||||
but it's now causing KAI C++ errors instead. The standard is
|
but it's now causing KAI C++ errors instead. The standard is
|
||||||
@ -396,7 +394,6 @@
|
|||||||
# if !defined(_BOOL)
|
# if !defined(_BOOL)
|
||||||
# error "Compiler not supported"
|
# error "Compiler not supported"
|
||||||
# endif
|
# endif
|
||||||
# define Q_C_CALLBACKS
|
|
||||||
/* 4.2 compiler or older */
|
/* 4.2 compiler or older */
|
||||||
# else
|
# else
|
||||||
# error "Compiler not supported"
|
# error "Compiler not supported"
|
||||||
|
@ -241,15 +241,9 @@ void QAdoptedThread::init()
|
|||||||
QThreadPrivate
|
QThreadPrivate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef void*(*QtThreadCallback)(void*);
|
typedef void*(*QtThreadCallback)(void*);
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // QT_NO_THREAD
|
#endif // QT_NO_THREAD
|
||||||
|
|
||||||
|
@ -86,9 +86,7 @@ struct my_error_mgr : public jpeg_error_mgr {
|
|||||||
jmp_buf setjmp_buffer;
|
jmp_buf setjmp_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
|
|
||||||
static void my_error_exit (j_common_ptr cinfo)
|
static void my_error_exit (j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
@ -106,9 +104,7 @@ static void my_output_message(j_common_ptr cinfo)
|
|||||||
qWarning("%s", buffer);
|
qWarning("%s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static const int max_buf = 4096;
|
static const int max_buf = 4096;
|
||||||
@ -123,9 +119,7 @@ public:
|
|||||||
my_jpeg_source_mgr(QIODevice *device);
|
my_jpeg_source_mgr(QIODevice *device);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
|
|
||||||
static void qt_init_source(j_decompress_ptr)
|
static void qt_init_source(j_decompress_ptr)
|
||||||
{
|
{
|
||||||
@ -185,9 +179,7 @@ static void qt_term_source(j_decompress_ptr cinfo)
|
|||||||
src->device->seek(src->device->pos() - src->bytes_in_buffer);
|
src->device->seek(src->device->pos() - src->bytes_in_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device)
|
inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device)
|
||||||
{
|
{
|
||||||
@ -458,9 +450,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
|
|
||||||
static void qt_init_destination(j_compress_ptr)
|
static void qt_init_destination(j_compress_ptr)
|
||||||
{
|
{
|
||||||
@ -490,9 +480,7 @@ static void qt_term_destination(j_compress_ptr cinfo)
|
|||||||
(*cinfo->err->error_exit)((j_common_ptr)cinfo);
|
(*cinfo->err->error_exit)((j_common_ptr)cinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
|
inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
|
||||||
{
|
{
|
||||||
|
@ -157,10 +157,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class QPNGImageWriter {
|
class QPNGImageWriter {
|
||||||
public:
|
public:
|
||||||
explicit QPNGImageWriter(QIODevice*);
|
explicit QPNGImageWriter(QIODevice*);
|
||||||
@ -190,6 +186,7 @@ private:
|
|||||||
float gamma;
|
float gamma;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
static
|
static
|
||||||
void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
|
void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
@ -234,9 +231,7 @@ void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead, float screen_gamma=0.0)
|
void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead, float screen_gamma=0.0)
|
||||||
@ -492,17 +487,13 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
|
static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
|
||||||
{
|
{
|
||||||
qWarning("libpng warning: %s", message);
|
qWarning("libpng warning: %s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_C_CALLBACKS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
|
void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user