]> granicus.if.org Git - graphviz/commitdiff
Quartz plugin: squash -Wundef warnings
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 6 Apr 2022 14:50:54 +0000 (07:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 10 Apr 2022 15:31:25 +0000 (08:31 -0700)
plugin/quartz/gvrender_quartz.c
plugin/quartz/gvtextlayout_quartz.c

index 1081a8b0cfdb5d2a8e97d3319987a58b0a1d444e..26f20e7ad31e5c5fa7d791b3b02c658287d26a59 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
 #include <mach/mach_host.h>
 #include <sys/mman.h>
@@ -21,6 +22,7 @@
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000
 #include <ImageIO/ImageIO.h>
 #endif
+#endif
 
 #include <gvc/gvplugin_device.h>
 #include <gvc/gvplugin_render.h>
@@ -47,6 +49,7 @@ static void quartzgen_end_job(GVJ_t * job)
 {
     CGContextRef context = (CGContextRef) job->context;
        
+#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
        void* context_data;
        size_t context_datalen;
@@ -63,6 +66,7 @@ static void quartzgen_end_job(GVJ_t * job)
                        context_datalen = CGBitmapContextGetBytesPerRow(context) * CGBitmapContextGetHeight(context);
                        break;
        }
+#endif
 #endif
 
        switch (job->device.id) {
@@ -77,7 +81,10 @@ static void quartzgen_end_job(GVJ_t * job)
                *((CGImageRef *) job->window) = CGBitmapContextCreateImage(context);
            break;
 
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000
+#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                 \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040) ||                 \
+    (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&                \
+     __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000)
        default:                /* bitmap formats */
            {
                /* create an image destination */
@@ -105,10 +112,12 @@ static void quartzgen_end_job(GVJ_t * job)
        
        CGContextRelease(context);
 
+#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
        if (context_data && context_datalen)
                munmap(context_data, context_datalen);
 #endif
+#endif
 }
 
 static void quartzgen_begin_page(GVJ_t * job)
@@ -178,6 +187,7 @@ static void quartzgen_begin_page(GVJ_t * job)
 
                void *buffer = NULL;
 
+#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
 
                /* iPhoneOS has no swap files for memory, so if we're short of memory we need to make our own temp scratch file to back it */
@@ -214,6 +224,7 @@ static void quartzgen_begin_page(GVJ_t * job)
                                  buffer_size,
                                  PROT_READ | PROT_WRITE,
                                  MAP_ANON | MAP_SHARED, -1, 0);
+#endif
 #endif
 
                /* create a true color bitmap for drawing into */
@@ -465,7 +476,10 @@ static gvrender_features_t render_features_quartz = {
     RGBA_DOUBLE                        /* color_type */
 };
 
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
+#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                 \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040) ||                 \
+    (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&                \
+     __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000)
 static gvdevice_features_t device_features_quartz = {
     GVDEVICE_BINARY_FORMAT | GVDEVICE_DOES_TRUECOLOR,  /* flags */
     {0., 0.},                  /* default margin - points */
@@ -488,10 +502,16 @@ gvplugin_installed_t gvrender_quartz_types[] = {
 
 gvplugin_installed_t gvdevice_quartz_types[] = {
     {FORMAT_PDF, "pdf:quartz", 8, NULL, &device_features_quartz_paged},
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
+#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                 \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040) ||                 \
+    (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&                \
+     __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000)
     {FORMAT_CGIMAGE, "cgimage:quartz", 8, NULL, &device_features_quartz},
 #endif
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000
+#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                 \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040) ||                 \
+    (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&                \
+     __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000)
     {FORMAT_BMP, "bmp:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_GIF, "gif:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_ICO, "ico:quartz", 8, NULL, &device_features_quartz},
@@ -504,6 +524,7 @@ gvplugin_installed_t gvdevice_quartz_types[] = {
     {FORMAT_TIFF, "tiff:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_TGA, "tga:quartz", 8, NULL, &device_features_quartz},
 #endif
+#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040
     {FORMAT_EXR, "exr:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_ICNS, "icns:quartz", 8, NULL, &device_features_quartz},
@@ -511,6 +532,7 @@ gvplugin_installed_t gvdevice_quartz_types[] = {
     {FORMAT_PICT, "pict:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_PSD, "psd:quartz", 8, NULL, &device_features_quartz},
     {FORMAT_SGI, "sgi:quartz", 8, NULL, &device_features_quartz},
+#endif
 #endif
     {0, NULL, 0, NULL, NULL}
 };
index b9a2e65471b5607cd43ec490cd72fd3982a5cc57..76025bb23f56d3297f3ef244fea7a2fab52b3222 100644 (file)
 #include <gvc/gvplugin_textlayout.h>
 #include "gvplugin_quartz.h"
 
+#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30200
 #include <CoreText/CoreText.h>
 #endif
+#endif
 
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30200
+#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                 \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050) ||                 \
+    (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&                \
+     __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30200)
 
+#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060
 /* symbol defined in 10.5.x dylib but not in headers */
 extern const CFStringRef kCTForegroundColorFromContextAttributeName;
 #endif
+#endif
 
 void *quartz_new_layout(char* fontname, double fontsize, char* text)
 {