File libharu-2.2.1-png15.patch of Package libharu
diff -up libharu-2.2.1/src/hpdf_image_png.c.png15 libharu-2.2.1/src/hpdf_image_png.c
--- libharu-2.2.1/src/hpdf_image_png.c.png15 2012-07-31 15:15:22.369386483 -0400
+++ libharu-2.2.1/src/hpdf_image_png.c 2012-07-31 15:54:23.645540431 -0400
@@ -110,13 +110,22 @@ ReadPngData_Interlaced (HPDF_Dict im
{
png_uint_32 len = png_get_rowbytes(png_ptr, info_ptr);
png_bytep* row_pointers = HPDF_GetMem (image->mmgr,
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ png_get_image_height(png_ptr, info_ptr) * sizeof (png_bytep));
+#else
info_ptr->height * sizeof (png_bytep));
+#endif
if (row_pointers) {
HPDF_UINT i;
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ HPDF_MemSet (row_pointers, 0, png_get_image_height(png_ptr, info_ptr) * sizeof (png_bytep));
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
HPDF_MemSet (row_pointers, 0, info_ptr->height * sizeof (png_bytep));
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
row_pointers[i] = HPDF_GetMem (image->mmgr, len);
if (image->error->error_no != HPDF_OK)
@@ -126,7 +135,11 @@ ReadPngData_Interlaced (HPDF_Dict im
if (image->error->error_no == HPDF_OK) {
png_read_image(png_ptr, row_pointers);
if (image->error->error_no == HPDF_OK) { /* add this line */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
if (HPDF_Stream_Write (image->stream, row_pointers[i], len) !=
HPDF_OK)
break;
@@ -135,7 +148,11 @@ ReadPngData_Interlaced (HPDF_Dict im
}
/* clean up */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
HPDF_FreeMem (image->mmgr, row_pointers[i]);
}
@@ -156,7 +173,11 @@ ReadPngData (HPDF_Dict image,
if (buf_ptr) {
HPDF_UINT i;
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
png_read_rows(png_ptr, (png_byte**)&buf_ptr, NULL, 1);
if (image->error->error_no != HPDF_OK)
break;
@@ -183,13 +204,21 @@ ReadTransparentPaletteData (HPDF_Dict
HPDF_UINT i, j;
png_bytep *row_ptr;
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ row_ptr = HPDF_GetMem (image->mmgr, png_get_image_height(png_ptr, info_ptr) * sizeof(png_bytep));
+#else
row_ptr = HPDF_GetMem (image->mmgr, info_ptr->height * sizeof(png_bytep));
+#endif
if (!row_ptr) {
return HPDF_FAILD_TO_ALLOC_MEM;
} else {
png_uint_32 len = png_get_rowbytes(png_ptr, info_ptr);
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
row_ptr[i] = HPDF_GetMem(image->mmgr, len);
if (!row_ptr[i]) {
for (; i >= 0; i--) {
@@ -207,19 +236,32 @@ ReadTransparentPaletteData (HPDF_Dict
goto Error;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (j = 0; j < png_get_image_height(png_ptr, info_ptr); j++) {
+ for (i = 0; i < png_get_image_width(png_ptr, info_ptr); i++) {
+ smask_data[png_get_image_width(png_ptr, info_ptr) * j + i] = (row_ptr[j][i] < num_trans) ? trans[row_ptr[j][i]] : 0xFF;
+ }
+
+ if (HPDF_Stream_Write (image->stream, row_ptr[j], png_get_image_width(png_ptr, info_ptr)) != HPDF_OK) {
+#else
for (j = 0; j < info_ptr->height; j++) {
for (i = 0; i < info_ptr->width; i++) {
smask_data[info_ptr->width * j + i] = (row_ptr[j][i] < num_trans) ? trans[row_ptr[j][i]] : 0xFF;
}
if (HPDF_Stream_Write (image->stream, row_ptr[j], info_ptr->width) != HPDF_OK) {
+#endif
ret = HPDF_FILE_IO_ERROR;
goto Error;
}
}
Error:
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
HPDF_FreeMem (image->mmgr, row_ptr[i]);
}
@@ -245,13 +287,21 @@ ReadTransparentPngData (HPDF_Dict im
return HPDF_INVALID_PNG_IMAGE;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ row_ptr = HPDF_GetMem (image->mmgr, png_get_image_height(png_ptr, info_ptr) * sizeof(png_bytep));
+#else
row_ptr = HPDF_GetMem (image->mmgr, info_ptr->height * sizeof(png_bytep));
+#endif
if (!row_ptr) {
return HPDF_FAILD_TO_ALLOC_MEM;
} else {
png_uint_32 len = png_get_rowbytes(png_ptr, info_ptr);
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
row_ptr[i] = HPDF_GetMem(image->mmgr, len);
if (!row_ptr[i]) {
for (; i >= 0; i--) {
@@ -271,12 +321,21 @@ ReadTransparentPngData (HPDF_Dict im
switch (color_type) {
case PNG_COLOR_TYPE_RGB_ALPHA:
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ row_len = 3 * png_get_image_width(png_ptr, info_ptr) * sizeof(png_byte);
+ for (j = 0; j < png_get_image_height(png_ptr, info_ptr); j++) {
+ for (i = 0; i < png_get_image_width(png_ptr, info_ptr); i++) {
+ row = row_ptr[j];
+ memmove(row + (3 * i), row + (4*i), 3);
+ smask_data[png_get_image_width(png_ptr, info_ptr) * j + i] = row[4 * i + 3];
+#else
row_len = 3 * info_ptr->width * sizeof(png_byte);
for (j = 0; j < info_ptr->height; j++) {
for (i = 0; i < info_ptr->width; i++) {
row = row_ptr[j];
memmove(row + (3 * i), row + (4*i), 3);
smask_data[info_ptr->width * j + i] = row[4 * i + 3];
+#endif
}
if (HPDF_Stream_Write (image->stream, row, row_len) != HPDF_OK) {
@@ -286,12 +345,21 @@ ReadTransparentPngData (HPDF_Dict im
}
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ row_len = png_get_image_width(png_ptr, info_ptr) * sizeof(png_byte);
+ for (j = 0; j < png_get_image_height(png_ptr, info_ptr); j++) {
+ for (i = 0; i < png_get_image_width(png_ptr, info_ptr); i++) {
+ row = row_ptr[j];
+ row[i] = row[2 * i];
+ smask_data[png_get_image_width(png_ptr, info_ptr) * j + i] = row[2 * i + 1];
+#else
row_len = info_ptr->width * sizeof(png_byte);
for (j = 0; j < info_ptr->height; j++) {
for (i = 0; i < info_ptr->width; i++) {
row = row_ptr[j];
row[i] = row[2 * i];
smask_data[info_ptr->width * j + i] = row[2 * i + 1];
+#endif
}
if (HPDF_Stream_Write (image->stream, row, row_len) != HPDF_OK) {
@@ -306,7 +374,11 @@ ReadTransparentPngData (HPDF_Dict im
}
Error:
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ for (i = 0; i < (HPDF_UINT)(png_get_image_height(png_ptr, info_ptr)); i++) {
+#else
for (i = 0; i < (HPDF_UINT)info_ptr->height; i++) {
+#endif
HPDF_FreeMem (image->mmgr, row_ptr[i]);
}
@@ -448,7 +520,11 @@ LoadPngData (HPDF_Dict image,
}
/* 16bit images are not supported. */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (png_get_bit_depth(png_ptr, info_ptr) == 16) {
+#else
if (info_ptr->bit_depth == 16) {
+#endif
png_set_strip_16(png_ptr);
}
@@ -458,7 +534,11 @@ LoadPngData (HPDF_Dict image,
}
/* check palette-based images for transparent areas and load them immediately if found */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (xref && PNG_COLOR_TYPE_PALETTE & png_get_color_type(png_ptr, info_ptr)) {
+#else
if (xref && PNG_COLOR_TYPE_PALETTE & info_ptr->color_type) {
+#endif
png_bytep trans;
int num_trans;
HPDF_Dict smask;
@@ -478,10 +558,20 @@ LoadPngData (HPDF_Dict image,
smask->header.obj_class |= HPDF_OSUBCLASS_XOBJECT;
ret = HPDF_Dict_AddName (smask, "Type", "XObject");
ret += HPDF_Dict_AddName (smask, "Subtype", "Image");
+
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ ret += HPDF_Dict_AddNumber (smask, "Width", (HPDF_UINT)png_get_image_width(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (smask, "Height", (HPDF_UINT)png_get_image_height(png_ptr, info_ptr));
+#else
ret += HPDF_Dict_AddNumber (smask, "Width", (HPDF_UINT)info_ptr->width);
ret += HPDF_Dict_AddNumber (smask, "Height", (HPDF_UINT)info_ptr->height);
+#endif
ret += HPDF_Dict_AddName (smask, "ColorSpace", "DeviceGray");
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ ret += HPDF_Dict_AddNumber (smask, "BitsPerComponent", (HPDF_UINT)png_get_bit_depth(png_ptr, info_ptr));
+#else
ret += HPDF_Dict_AddNumber (smask, "BitsPerComponent", (HPDF_UINT)info_ptr->bit_depth);
+#endif
if (ret != HPDF_OK) {
HPDF_Dict_Free(smask);
@@ -489,7 +579,11 @@ LoadPngData (HPDF_Dict image,
goto Exit;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ smask_data = HPDF_GetMem(image->mmgr, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr));
+#else
smask_data = HPDF_GetMem(image->mmgr, info_ptr->width * info_ptr->height);
+#endif
if (!smask_data) {
HPDF_Dict_Free(smask);
ret = HPDF_FAILD_TO_ALLOC_MEM;
@@ -503,7 +597,11 @@ LoadPngData (HPDF_Dict image,
goto Exit;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (HPDF_Stream_Write(smask->stream, smask_data, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr)) != HPDF_OK) {
+#else
if (HPDF_Stream_Write(smask->stream, smask_data, info_ptr->width * info_ptr->height) != HPDF_OK) {
+#endif
HPDF_FreeMem(image->mmgr, smask_data);
HPDF_Dict_Free(smask);
ret = HPDF_FILE_IO_ERROR;
@@ -513,9 +611,15 @@ LoadPngData (HPDF_Dict image,
ret += CreatePallet(image, png_ptr, info_ptr);
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ ret += HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)png_get_image_width(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (image, "Height", (HPDF_UINT)png_get_image_height(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (image, "BitsPerComponent", (HPDF_UINT)png_get_bit_depth(png_ptr, info_ptr));
+#else
ret += HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)info_ptr->width);
ret += HPDF_Dict_AddNumber (image, "Height", (HPDF_UINT)info_ptr->height);
ret += HPDF_Dict_AddNumber (image, "BitsPerComponent", (HPDF_UINT)info_ptr->bit_depth);
+#endif
ret += HPDF_Dict_Add (image, "SMask", smask);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@@ -526,7 +630,11 @@ no_transparent_color_in_palette:
/* read images with alpha channel right away
we have to do this because image transparent mask must be added to the Xref */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (xref && PNG_COLOR_MASK_ALPHA & png_get_color_type(png_ptr, info_ptr)) {
+#else
if (xref && PNG_COLOR_MASK_ALPHA & info_ptr->color_type) {
+#endif
HPDF_Dict smask;
png_bytep smask_data;
@@ -539,10 +647,17 @@ no_transparent_color_in_palette:
smask->header.obj_class |= HPDF_OSUBCLASS_XOBJECT;
ret = HPDF_Dict_AddName (smask, "Type", "XObject");
ret += HPDF_Dict_AddName (smask, "Subtype", "Image");
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ ret += HPDF_Dict_AddNumber (smask, "Width", (HPDF_UINT)png_get_image_width(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (smask, "Height", (HPDF_UINT)png_get_image_height(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddName (smask, "ColorSpace", "DeviceGray");
+ ret += HPDF_Dict_AddNumber (smask, "BitsPerComponent", (HPDF_UINT)png_get_bit_depth(png_ptr, info_ptr));
+#else
ret += HPDF_Dict_AddNumber (smask, "Width", (HPDF_UINT)info_ptr->width);
ret += HPDF_Dict_AddNumber (smask, "Height", (HPDF_UINT)info_ptr->height);
ret += HPDF_Dict_AddName (smask, "ColorSpace", "DeviceGray");
ret += HPDF_Dict_AddNumber (smask, "BitsPerComponent", (HPDF_UINT)info_ptr->bit_depth);
+#endif
if (ret != HPDF_OK) {
HPDF_Dict_Free(smask);
@@ -550,7 +665,11 @@ no_transparent_color_in_palette:
goto Exit;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ smask_data = HPDF_GetMem(image->mmgr, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr));
+#else
smask_data = HPDF_GetMem(image->mmgr, info_ptr->width * info_ptr->height);
+#endif
if (!smask_data) {
HPDF_Dict_Free(smask);
ret = HPDF_FAILD_TO_ALLOC_MEM;
@@ -564,7 +683,11 @@ no_transparent_color_in_palette:
goto Exit;
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (HPDF_Stream_Write(smask->stream, smask_data, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr)) != HPDF_OK) {
+#else
if (HPDF_Stream_Write(smask->stream, smask_data, info_ptr->width * info_ptr->height) != HPDF_OK) {
+#endif
HPDF_FreeMem(image->mmgr, smask_data);
HPDF_Dict_Free(smask);
ret = HPDF_FILE_IO_ERROR;
@@ -572,14 +695,24 @@ no_transparent_color_in_palette:
}
HPDF_FreeMem(image->mmgr, smask_data);
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA) {
+#else
if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+#endif
ret += HPDF_Dict_AddName (image, "ColorSpace", "DeviceGray");
} else {
ret += HPDF_Dict_AddName (image, "ColorSpace", "DeviceRGB");
}
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ ret += HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)png_get_image_width(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (image, "Height", (HPDF_UINT)png_get_image_height(png_ptr, info_ptr));
+ ret += HPDF_Dict_AddNumber (image, "BitsPerComponent", (HPDF_UINT)png_get_bit_depth(png_ptr, info_ptr));
+#else
ret += HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)info_ptr->width);
ret += HPDF_Dict_AddNumber (image, "Height", (HPDF_UINT)info_ptr->height);
ret += HPDF_Dict_AddNumber (image, "BitsPerComponent", (HPDF_UINT)info_ptr->bit_depth);
+#endif
ret += HPDF_Dict_Add (image, "SMask", smask);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@@ -589,9 +722,15 @@ no_transparent_color_in_palette:
/* if the image has color palette, copy the pallet of the image to
* create color map.
*/
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
+ ret = CreatePallet(image, png_ptr, info_ptr);
+ else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
+#else
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
- ret = CreatePallet(image, png_ptr, info_ptr);
+ ret = CreatePallet(image, png_ptr, info_ptr);
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+#endif
ret = HPDF_Dict_AddName (image, "ColorSpace", "DeviceGray");
else
ret = HPDF_Dict_AddName (image, "ColorSpace", "DeviceRGB");
@@ -617,6 +756,18 @@ no_transparent_color_in_palette:
}
/* setting the info of the image. */
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+ if (HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)png_get_image_width(png_ptr, info_ptr))
+ != HPDF_OK)
+ goto Exit;
+
+ if (HPDF_Dict_AddNumber (image, "Height", (HPDF_UINT)png_get_image_height(png_ptr, info_ptr))
+ != HPDF_OK)
+ goto Exit;
+
+ if (HPDF_Dict_AddNumber (image, "BitsPerComponent",
+ (HPDF_UINT)png_get_bit_depth(png_ptr, info_ptr)) != HPDF_OK)
+#else
if (HPDF_Dict_AddNumber (image, "Width", (HPDF_UINT)info_ptr->width)
!= HPDF_OK)
goto Exit;
@@ -627,6 +778,7 @@ no_transparent_color_in_palette:
if (HPDF_Dict_AddNumber (image, "BitsPerComponent",
(HPDF_UINT)info_ptr->bit_depth) != HPDF_OK)
+#endif
goto Exit;
/* clean up */