From: <ti...@li...> - 2004-04-22 17:39:28
|
Hi Adrian, thank you for your patch ! Given that I will not be able to test it (I=20 don't have TI85/86 anymore), I would like to know whether you have=20 tested it ? If yes, I will apply it. Else, I will have to take a look more thourougly= ... Thanks, Romain. Adrian Mettler a =E9crit : > This is sent from my primary (more or less spam-free... knock on wood)=20 > address. >=20 > Sorry about the mailer splitting some of the lines. > --Adrian >=20 >=20 > --- files8x.c.bak 2003-08-27 02:30:44.000000000 -0700 > +++ files8x.c 2003-11-27 10:38:33.000000000 -0800 > @@ -194,6 +194,8 @@ > int i; > int ti83p_flag =3D 0; > uint8_t name_length =3D 8; // ti85/86 only > + uint16_t data_size; > + uint8_t test_space; > char signature[9]; >=20 > if (!tifiles_is_a_ti_file(filename)) > @@ -213,18 +215,45 @@ > return ERR_INVALID_FILE; > fskip(f, 3); > fread_n_chars(f, 42, content->comment); > - fread_word(f, NULL); > + fread_word(f, &data_size); >=20 > // search for the number of entries by parsing the whole file > offset =3D ftell(f); > for (i =3D 0;; i++) { > + int current_offset =3D (int)ftell(f); > + /* We are done finding entries once we reach the end of the data=20 > segment > + * as defined in the header. This works better than magic numbers= , as > + * as there exist files in the wild with incorrect magic numbers t= hat > + * transmit correctly with TI's software and with this code. > + */ > + //printf("current_offset: %x, offset + data_size: %x\n", > + // current_offset, (uint16_t) offset + data_size); > + if (current_offset >=3D offset + data_size) > + break; > + > fread_word(f, &tmp); > if (tmp =3D=3D 0x0D) > ti83p_flag =3D !0; // true TI83+ file (2 extra bytes) > - if ((tmp !=3D 0x0B) && (tmp !=3D 0x0C) && (tmp !=3D 0x0D)) > - break; > + //if ((tmp !=3D 0x0B) && (tmp !=3D 0x0C) && (tmp !=3D 0x0D)) > + // break; > if (is_ti8586(content->calc_type)) > - fskip(f, 12); > + { > + /* name may follow one of three conventions: padded with zeroes > + * (most correct, generated by TI's software), padded with null=20 > bytes, > + * or unpadded. TI's software accepts all three, so we should t= oo. > + */ > + fskip(f, 3); > + fread_byte(f, &name_length); > + fskip(f, name_length); > + > + fread_byte(f, &test_space); > + fskip (f, -1); > + > + //printf("test_space: %x at %x\n", test_space, (int)ftell(f)); > + > + if (test_space =3D=3D '\0' || test_space =3D=3D ' ') // skip pa= dding if=20 > padded > + fskip(f, 8 - name_length); > + } > else if (content->calc_type =3D=3D CALC_TI83P) > fskip(f, 13); > else > @@ -254,7 +283,16 @@ > tixx_translate_varname(entry->name, entry->trans, > entry->type, content->calc_type); > if (is_ti8586(content->calc_type)) > - fskip(f, 8 - name_length); > + { > + /* Again, compatibility with padded and unpadded files > + */ > + fread_byte(f, &test_space); > + fskip (f, -1); > + > + if (test_space =3D=3D '\0' || test_space =3D=3D ' ') // skip pa= dding if=20 > padded > + fskip(f, 8 - name_length); > + } > + > if (ti83p_flag) { > entry->attr =3D (fgetc(f) =3D=3D 0x80 ? ATTRB_ARCHIVED : ATTRB_N= ONE); > fgetc(f); > @@ -639,7 +677,7 @@ > fwrite_word(f, content->data_length4); > fwrite(content->data_part4, 1, content->data_length4, f); > } > - // checksum =3D sum of all bytes in bachup headers and data num_entr= ies > + // checksum =3D sum of all bytes in backup headers and data num_entr= ies > sum =3D 0; > sum +=3D 9; > sum +=3D >=20 >=20 >=20 >=20 > --- Romain Li=E9vin <ro...@us...> wrote: > > > > Hi, > > > > > > > > could you send to me your patch in unified diff > > format (diff > > > > -Naur) ? > > > > > > > > You can mail me at <ro...@ti...> or > > til...@li.... > > > > > > > > It will be easier to communicate by this way rather > > than by > > > > the BugTracker. > > > > > > > > thx, roms. >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dclick > _______________________________________________ > TiLP-devel mailing list > TiL...@li... > https://lists.sourceforge.net/lists/listinfo/tilp-devel >=20 >=20 --=20 Romain Li=E9vin (roms): <ro...@ti...> Web site: http://www.lievin.net "Linux, y'a moins bien mais c'est plus cher !" |