Re: urmaslt - r29620 - abiword/trunk/plugins/mswrite/xp

From: Hubert Figuiere <hfiguiere_at_teaser.fr>
Date: Thu Mar 03 2011 - 07:50:01 CET

On 11-03-02 10:30 PM, cvs@abisource.com wrote:
> @@ -215,6 +218,8 @@
>
> font_count = 0;
> wri_fonts = NULL;
> +
> + std::set<char*> raw_fonts;
>

In the code below, where are the pointer stored in the set freeed ?

Also are you sure the that the comparator use strcmp() to compare the
set values and does not compare just pointers?

> while (true) {
> if (!gsf_input_read (mFile, 2, byt)) {
> @@ -256,9 +261,23 @@
> perror ("wri_file");
> return 1;
> }
> + char *trname;
> + wri_fonts[font_count].codepage=get_codepage(ffn,&trname);
> + if (wri_fonts[font_count].codepage) {
> + strcpy(ffn,trname);
> + raw_fonts.insert(strdup(trname));
> + }
> wri_fonts[font_count].name = ffn;
> font_count++;
> }
> + for (int i=0; i<font_count; i++) {
> + std::set<char*>::iterator pos;
> + if (!wri_fonts[i].codepage) {
> + pos = raw_fonts.find(wri_fonts[i].name);
> + if (pos != raw_fonts.end())
> + wri_fonts[i].codepage="CP1252";
> + }
> + }
> if (static_cast<unsigned>(font_count) != wri_fonts_count) {
> wri_fonts_count = font_count;
> UT_DEBUGMSG(("write file lied about number of fonts\n"));
> @@ -266,9 +285,18 @@
> return 0;
> }

Answers: nowhere it is freed and it compares the pointers

Hub
Received on Thu Mar 3 07:50:10 2011

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2011 - 07:50:10 CET