Hint: parameter definitions like "int" and "size_t"

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Post Reply
User avatar
AmigoJack
Posts: 33
Joined: Tue Mar 09, 2010 6:40 pm
Contact:

Hint: parameter definitions like "int" and "size_t"

Post by AmigoJack » Thu Mar 18, 2010 2:29 pm

I want to highlight 5 functions with inconsistent definitions:
  • gflGetExtraInfos(): parameter "int idx"
  • gflJPEGGetComment(): parameter "int maxsize"
  • gflJPEGGetCommentW(): parameter "int maxsize"
  • gflPNGGetComment(): parameter "int maxsize"
  • gflPNGGetCommentW(): parameter "int maxsize"
Those parameters are all defined as int - wouldn't it be better and more bulletproof to define those as GFL_INT32?


Furthermore these 2 defintions also have a rather unknown parameter:
  • typedef void* (GFLAPI *GFL_ALLOC_CALLBACK)( size_t size, void* user_parms );
  • typedef void* (GFLAPI *GFL_REALLOC_CALLBACK)( void* ptr, size_t new_size, void* user_parms );
Both have a parameter from type size_t - here I also suggest to change it into a well-known definition, like GFL_UINT32.

User avatar
xnview
Author of XnView
Posts: 31598
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Hint: parameter definitions like "int" and "size_t"

Post by xnview » Fri Mar 19, 2010 7:35 am

Yes GFL_INT32 is better!
Pierre.

Post Reply