3-byte int breaks if not enough bytes at end of file

Hello!

I currently have this block structure for the ZSTD file type.

typedef struct {
  BitfieldDisablePadding();
  int Last_Block : 1;
  int Block_Type : 2;
  int Block_Size : 21 <format=hex>;
  BitfieldEnablePadding();
} Block_Header;

It works well most of the time, but recently I had a sample that ended with this structure, and the size was 0. So the file ends with 3 bytes, which causes the template to fail, because it needs 4 bytes for the int.

Is there something I am missing in the manual? I don’t see a way to limit the structure to 3 bytes so that a file that ends with an empty block doesn’t break.

Thanks!
Nordgaren

We took a look and there is no easy workaround besides us fixing the end of file test for this case. Could you check if this update fixes the problem:

   http://download.sweetscape.com/010EditorWin64Installer15.0beta2a.exe 

Note this is a beta version and the full version should be released at the end of the month. Cheers!

Graeme
SweetScape Software

1 Like

Hey! Sorry for the late reply! That seemed to do the trick!

New version looks nice! Did y’all redo the syntax highlighting in the editor? It looks really good!

Thanks for the update! Is this beta good to use, and report bugs on beta version?

I can provide the template in question, in case you all wanted to do in-house testing. I will see if I can provide a binary, soon, since it’s not really normal zstd behavior I am dealing with. For some reason, this particular sample adds this block to the end of the file before closing it. I can make a sample shortly that isn’t copy written data.

Unfortunately, cannot upload files, yet, as I am a new user, but, if you guys do want the template to test this on, let me know and I will make that sample and upload it here, or wherever you would like!

Cheers
Nordgaren

Version 15 does have updated syntax highlighting. The beta should be ok to use but let us know if you run into any bugs. You should be able to upload the files now but if you can’t let us know or you can also email the files to ‘support@sweetscape.com’. Cheers!

Graeme
SweetScape Software

Sorry it took so long to respond! Been a busy week.

Here is a sample zst (It’s the installer you sent me zstd compressed) and the bt file.

Thanks again!

Looks good! We tried it out and it appears to run well on the attached file. Would you consent to us adding this to our online repository? Other people may be interested in the template as well. Cheers!

Graeme
SweetScape Software

1 Like

It’s technically only partially done, but yea! You can put it in there. Is there a way for me to update it in the future?

I also have a template from a while back that I was going to submit for the tabstate file in windows 11 (used for windows 11 notepad buffers that get saved to disk). What is the best way to submit and update said templates?

Great. We’ll upload the Zstd template. Would you like us to upload the tabstate template too? We can do that for you if the template is ready. By the way, is there a standard file extension for tabstate files? If you want to submit a template in the future you can always email it to ‘support@sweetscape.com’ or right-click on the template in 010 Editor and choose ‘Repository > Submit to Repository’.

After the file has been uploaded you can click ‘Templates > Template Repository’ within 010 Editor and then search for the file and install it. You can apply changes and then use ‘Repository > Submit to Repository’ to submit an update. All the different versions should show up in the Repository dialog. Let us know if you have any questions on this. Cheers!

Graeme
SweetScape Software

Yea, go ahead and upload it, and I will update it asap.

The tabstate files are all just .bin files, so no real special extension.

The zstd template is now available:

https://www.sweetscape.com/010editor/repository/files/ZSTD.bt

Note that we checked and there is already a template in the repository for parsing TabState files called ‘Notepad-WindowState.bt’. Cheers!

Graeme
SweetScape Software

1 Like