--- parser3/src/classes/image.C 2025/05/26 01:56:54 1.197 +++ parser3/src/classes/image.C 2026/09/27 17:37:51 1.200 @@ -1,7 +1,7 @@ /** @file Parser: @b image parser class. - Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ @@ -26,7 +26,7 @@ #include "pa_table.h" #include "pa_charsets.h" -volatile const char * IDENT_IMAGE_C="$Id: image.C,v 1.197 2025/05/26 01:56:54 moko Exp $"; +volatile const char * IDENT_IMAGE_C="$Id: image.C,v 1.200 2026/09/27 17:37:51 moko Exp $"; // defines @@ -276,7 +276,7 @@ public: override void seek(uint64_t value) { if(pa_lseek(f, value, SEEK_SET)<0) - throw Exception(IMAGE_FORMAT, &file_name, "seek to %.15g failed: %s (%d)", (double)value, strerror(errno), errno); + throw Exception(IMAGE_FORMAT, &file_name, "seek to %s failed: %s (%d)", pa_uitoa(value), strerror(errno), errno); } override uint64_t tell() { return pa_lseek(f, 0, SEEK_CUR); } @@ -306,7 +306,7 @@ public: override void seek(uint64_t value) { if(value>(uint64_t)size) - throw Exception(IMAGE_FORMAT, &file_name, "seek to %.15g failed: out of buffer (%.15g)", value, size); + throw Exception(IMAGE_FORMAT, &file_name, "seek to %s failed: out of buffer (%s)", pa_uitoa(value), pa_uitoa(size)); offset=(size_t)value; } @@ -994,31 +994,22 @@ static void _measure(Request& r, MethodP if(params.count()>1) if(HashStringValue* options=params.as_hash(1, "methods options")) { - int valid_options=0; for(HashStringValue::Iterator i(*options); i; i.next() ){ String::Body key=i.key(); Value* value=i.value(); if(key == "exif") { if(r.process(*value).as_bool()) info.exif=&exif; - valid_options++; - } - if(key == "xmp") { + } else if(key == "xmp") { if(r.process(*value).as_bool()) info.xmp=&xmp; - valid_options++; - } - if(key == "xmp-charset") { + } else if(key == "xmp-charset") { info.xmp_charset=&pa_charsets.get(value->as_string()); - valid_options++; - } - if(key == "video") { + } else if(key == "video") { info.video=r.process(*value).as_bool(); - valid_options++; - } + } else + throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } - if(valid_options!=options->count()) - throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } const String* file_name;