--- parser3/src/classes/image.C 2003/02/20 14:53:33 1.90.2.10 +++ parser3/src/classes/image.C 2003/03/04 15:05:28 1.90.2.14 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_IMAGE_C="$Date: 2003/02/20 14:53:33 $"; +static const char* IDENT_IMAGE_C="$Date: 2003/03/04 15:05:28 $"; /* jpegsize: gets the width and height (in pixels) of a jpeg file @@ -45,7 +45,7 @@ public: // Methoded // globals -MethodedPtr image_class(new MImage); +DECLARE_CLASS_VAR(image, new MImage, 0); // helpers @@ -514,12 +514,12 @@ static void parse_IFD_entry(Pool& pool, } if(ValuePtr value=parse_IFD_entry_value(pool, is_big, reader, tiff_base, entry)) { - char *key_cstr=new(pool) char[MAX_NUMBER]; - StringPtr skey(new String(key_cstr, snprintf(key_cstr, MAX_NUMBER, "%u", tag))); - if(const char* name=exif_tag_value2name.get(skey)) + if(const char* name=exif_tag_value2name.get(tag)) hash.put(StringPtr(new String(name)), value); - else + else { + StringPtr skey(new String(pool.format_integer(tag))); hash.put(skey, value); + } } } @@ -804,7 +804,7 @@ static gdImagePtr load(Request& r, Strin } else { throw Exception("file.missing", method_name, - "can not open '%s'", file_name_cstr); + "can not open '%s'", file_name_cstr.get()); return gdImagePtr(0); } } @@ -849,7 +849,7 @@ static void _gif(Request& r, StringPtr m VFilePtr vfile(new VFile); ValuePtr content_type(new VString(StringPtr(new String("image/gif")))); vfile->set(pool, false/*not tainted*/, - out.cstr(), out.size(), 0, content_type); + out.cstr(pool), out.size(), 0, content_type); r.write_no_lang(vfile); } @@ -1073,17 +1073,17 @@ public: // counts trailing letter_spacing, consider this OK. useful for contiuations int string_width(StringPtr s){ - const char* cstr=s->cstr(); + CharPtr cstr=s->cstr(); int result=0; - for(; *cstr; cstr++) - result+=step_width(index_of(*cstr)); + for(const char* current=cstr; *current; current++) + result+=step_width(index_of(*current)); return result; } void string_display(gdImagePtr image, int x, int y, StringPtr s){ - const char* cstr=s->cstr(); - if(cstr) for(; *cstr; cstr++) { - int index=index_of(*cstr); + CharPtr cstr=s->cstr(); + for(const char* current=cstr; *current; current++) { + int index=index_of(*current); index_display(image, x, y, index); x+=step_width(index); }