--- parser3/src/classes/image.C 2009/07/07 05:47:43 1.129 +++ parser3/src/classes/image.C 2009/10/03 02:15:02 1.131 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_IMAGE_C="$Date: 2009/07/07 05:47:43 $"; +static const char * const IDENT_IMAGE_C="$Date: 2009/10/03 02:15:02 $"; /* jpegsize: gets the width and height (in pixels) of a jpeg file @@ -39,7 +39,7 @@ static const String letter_spacing_name( class MImage: public Methoded { public: // VStateless_class - Value* create_new_value(Pool&, HashStringValue*) { return new VImage(); } + Value* create_new_value(Pool&) { return new VImage(); } public: MImage(); @@ -1095,7 +1095,8 @@ void Font::string_display(gdImage& image static void _font(Request& r, MethodParams& params) { const String& alphabet=params.as_string(0, "alphabet must not be code"); - if(!alphabet.length()) + size_t alphabet_length=alphabet.length(r.charsets.source()); + if(!alphabet_length) throw Exception(PARSER_RUNTIME, 0, "alphabet must not be empty"); @@ -1142,16 +1143,16 @@ static void _font(Request& r, MethodPara } } - if(int remainder=image->SY() % alphabet.length()) + if(int remainder=image->SY() % alphabet_length) throw Exception(PARSER_RUNTIME, 0, "font-file height(%d) not divisable by alphabet size(%d), remainder=%d", - image->SY(), alphabet.length(), remainder); + image->SY(), alphabet_length, remainder); GET_SELF(r, VImage).set_font(new Font( alphabet, image, - image->SY() / alphabet.length(), monospace_width, spacebar_width, letter_spacing)); + image->SY() / alphabet_length, monospace_width, spacebar_width, letter_spacing)); } static void _text(Request& r, MethodParams& params) { @@ -1213,7 +1214,7 @@ static void _circle(Request& r, MethodPa gdImage& as_image(MethodParams& params, int index, const char* msg) { Value& value=params.as_no_junction(index, msg); - if(Value* vimage=value.as(VIMAGE_TYPE, false)) { + if(Value* vimage=value.as(VIMAGE_TYPE)) { return static_cast(vimage)->image(); } else throw Exception(PARSER_RUNTIME,