diff --git a/source/paint/image.cpp b/source/paint/image.cpp index 868f925f..857c31f7 100644 --- a/source/paint/image.cpp +++ b/source/paint/image.cpp @@ -1,7 +1,7 @@ /* * Paint Image Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -225,11 +225,16 @@ namespace paint else { #if defined(NANA_ENABLE_JPEG) - //JFIF - if (bytes > 11 && (0xe0ffd8ff == *reinterpret_cast(data)) && 0x4649464A == *reinterpret_cast(reinterpret_cast(data)+6)) - ptr = std::make_shared(); - else if (bytes > 9 && (0x66697845 == *reinterpret_cast(reinterpret_cast(data)+6))) //Exif - ptr = std::make_shared(); + if ((bytes > 11) && (0xd8ff == *reinterpret_cast(data))) + { + switch(*reinterpret_cast(reinterpret_cast(data)+6)) + { + case 0x4649464A: //JFIF + case 0x66697845: //Exif + ptr = std::make_shared(); + } + } + else #endif if ((!ptr) && (bytes > 40)) {