Include C89 fallback code
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call round() and/or rint(), which was only available in C99 compilers. This adds the inclusion of the fallback implementation (gtk/fallback-c89.c) to define these functions if they are not initially made available by the compiler. Also remove the rint() implementation in gtk/gtklabel.c as it is now in the fallback implmentation.
This commit is contained in:
parent
db3fecc5b9
commit
ad73ed298d
@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
#include "gtkborderimageprivate.h"
|
#include "gtkborderimageprivate.h"
|
||||||
|
|
||||||
|
/* this is in case round() is not provided by the compiler,
|
||||||
|
* such as in the case of C89 compilers, like MSVC
|
||||||
|
*/
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
G_DEFINE_BOXED_TYPE (GtkBorderImage, _gtk_border_image,
|
G_DEFINE_BOXED_TYPE (GtkBorderImage, _gtk_border_image,
|
||||||
_gtk_border_image_ref, _gtk_border_image_unref)
|
_gtk_border_image_ref, _gtk_border_image_unref)
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@
|
|||||||
|
|
||||||
#include "a11y/gtklabelaccessible.h"
|
#include "a11y/gtklabelaccessible.h"
|
||||||
|
|
||||||
|
/* this is in case rint() is not provided by the compiler,
|
||||||
|
* such as in the case of C89 compilers, like MSVC
|
||||||
|
*/
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gtklabel
|
* SECTION:gtklabel
|
||||||
* @Short_description: A widget that displays a small to medium amount of text
|
* @Short_description: A widget that displays a small to medium amount of text
|
||||||
@ -230,26 +235,6 @@
|
|||||||
* </refsect2>
|
* </refsect2>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*rint() is only available in GCC and/or C99*/
|
|
||||||
#if (__STDC_VERSION__ < 199901L && !defined __GNUC__)
|
|
||||||
double rint(double x)
|
|
||||||
{
|
|
||||||
if (ceil(x+0.5) == floor(x+0.5))
|
|
||||||
{
|
|
||||||
int a = (int)ceil(x);
|
|
||||||
if (a%2 == 0)
|
|
||||||
return ceil(x);
|
|
||||||
else
|
|
||||||
return floor(x);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return floor(x+0.5);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct _GtkLabelPrivate
|
struct _GtkLabelPrivate
|
||||||
{
|
{
|
||||||
GtkLabelSelectionInfo *select_info;
|
GtkLabelSelectionInfo *select_info;
|
||||||
|
@ -42,6 +42,11 @@
|
|||||||
#include "gtkthemingengine.h"
|
#include "gtkthemingengine.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
|
|
||||||
|
/* this is in case round() is not provided by the compiler,
|
||||||
|
* such as in the case of C89 compilers, like MSVC
|
||||||
|
*/
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
static GHashTable *parse_funcs = NULL;
|
static GHashTable *parse_funcs = NULL;
|
||||||
static GHashTable *print_funcs = NULL;
|
static GHashTable *print_funcs = NULL;
|
||||||
static GHashTable *properties = NULL;
|
static GHashTable *properties = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user