Jump to content
Temtaime

Fastest grf library [C++], GRF pack/unpack tool!

Recommended Posts

Hello for all. :3

I'm release my fastest grf library, written in C++. It supports grf files with version 0x1** or 0x200. For more info see docs/html/index.html.

It goes with my custom common library, which i will release sooner at sf.net. So i'm sorry for documentation misses in some places.

Grf lib also have example. Example - useful program to pack/unpack grf files.

For more info about example just run help.bat.

If you like it, u can support me to future releases:

WMZ: Z866169295097.

Yandex: 41001310943642.

And sorry for my Eng, i'm Ru. :)

P.S. also looking for remote job as C/C++ programmer. Write to pm. :)

AVE Patch coming soon!

archive.7z

Edited by Temtaime
Link to comment
Share on other sites

Thanks for sharing your code. I do however have one concern, you're using 'goto' in your code. You should ideally not use goto statements. In your case, you use goto to exit a conditional block, which is bad practice. You should ideally be throwing an exception, catching it and doing whatever is required if a bad_grf exception happens. That's just one of the problems I find with your code. I'll have a better look later and report if I find more.

Don't take this critisim in a bad way. Take it as points to improve your programming skills /no1

Link to comment
Share on other sites

Thanks for answer!

Yes, i clear. There only 1 goto, without it i would have to duplicate code. I try to avoid gotos everywhere where i can. :) But okay, i try to rewrite this.

Also, it's throws exception where it's needed. :)

Edited by Temtaime
Link to comment
Share on other sites

Actually there are 9 'goto' statements in grf.cpp alone. I haven't taken the time to hunt for other goto statements. I had trouble compiling it in VS2010 due to the variable template argument functions. Rewriting those functions to use va_list, va_start to get variable arguments to send it to your custom printf and aprintf functions works for me.

I should mention though that it's really fast to open and list contents in a GRF file. I'm trying to find out how fast it would be to find and read contents of a file. I see that you're using boost. Good choice! I'm still studying the code. Will let you know of my comments soon.

As an example of what you should've done instead of goto statement, you could've created a function called:

mark_dirty();

The code that you jump to should be the body of that function. Does that make sense?

Link to comment
Share on other sites

I review my code and found no problem with goto. All goto calls go to one place, so there no problem with goto, i think.

Sorry, VS 2010 doesn't supported. Use GCC or ICC instead. I'd like to use C++11 features.

http://sourceforge.net/projects/mingwbuilds/

Here you can get latest GCC builds for windows.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.