Simplify expression and remove the possibility of div by 0
authorStanislav Malyshev <stas@php.net>
Sun, 7 Jul 2019 23:16:05 +0000 (16:16 -0700)
committerStanislav Malyshev <stas@php.net>
Sun, 7 Jul 2019 23:16:05 +0000 (16:16 -0700)
Maybe should use exp2() but not sure about how supported it is.

ext/exif/exif.c

index e8b52bc83f62f1a902f5b018588821d3f04aaa83..de4468990277c4b208633ab36cc980c714bfeaaa 100644 (file)
@@ -2683,7 +2683,7 @@ PHP_FUNCTION(exif_tagname)
                RETURN_FALSE;
        }
 
-       RETURN_STRING(szTemp)
+       RETURN_STRING(szTemp);
 }
 /* }}} */
 
@@ -3369,7 +3369,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
                                   have appropriate aperture information yet. */
                                if (ImageInfo->ApertureFNumber == 0) {
                                        ImageInfo->ApertureFNumber
-                                               = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)*0.5);
+                                               = expf(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0)*0.5);
                                }
                                break;
 
@@ -3380,7 +3380,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
                                  */
                                if (ImageInfo->ExposureTime == 0) {
                                        ImageInfo->ExposureTime
-                                               = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)));
+                                               = expf(-exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0));
                                }
                                break;
                        case TAG_EXPOSURETIME: