From: Matthew Fernandez Date: Wed, 6 Apr 2022 14:50:54 +0000 (-0700) Subject: Quartz plugin: squash -Wundef warnings X-Git-Tag: 4.0.0~120^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34ac4d5c06e5ff561358caea465d11c7f2af186f;p=graphviz Quartz plugin: squash -Wundef warnings --- diff --git a/plugin/quartz/gvrender_quartz.c b/plugin/quartz/gvrender_quartz.c index 1081a8b0c..26f20e7ad 100644 --- a/plugin/quartz/gvrender_quartz.c +++ b/plugin/quartz/gvrender_quartz.c @@ -13,6 +13,7 @@ #include #include +#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000 #include #include @@ -21,6 +22,7 @@ #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000 #include #endif +#endif #include #include @@ -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} }; diff --git a/plugin/quartz/gvtextlayout_quartz.c b/plugin/quartz/gvtextlayout_quartz.c index b9a2e6547..76025bb23 100644 --- a/plugin/quartz/gvtextlayout_quartz.c +++ b/plugin/quartz/gvtextlayout_quartz.c @@ -17,16 +17,23 @@ #include #include "gvplugin_quartz.h" +#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30200 #include #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) {