Page 1 of 1

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

Posted: Thu Mar 18, 2010 2:29 pm
by AmigoJack
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.

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

Posted: Fri Mar 19, 2010 7:35 am
by xnview
Yes GFL_INT32 is better!