Hi,
Viktor Szakáts wrote:
I had to create workaround for this warning by passing " " string instead
of zero length one, IMO we should support empty values and simply always
return it as is in hb_i18n_gettext().
Compiling this code:
---
? hb_i18n_gettext( "" )
---
results in this:
---
Warning W0017 Incompatible parameter 'String', expected 'String'
---
I understand there is no point in passing empty string to
hb_i18n_gettext(),
but the warning text seems misleading and bogus.
The warning is not related to behaviour of hb_i18n_gettext() function
itself, it's a question of compiler. Current compiler i18n logic does
not write empty string to .pot file. The question is, that we have to do
in this case:
1) write empty strings to .pot file
Change include/hbexprb.c line #1899:
if( pArg->ExprType == HB_ET_STRING && pArg->ulLength > 0 )
to:
if( pArg->ExprType == HB_ET_STRING )
2) do not write empty string to .pot file and do not show any warning:
Change:
if( pArg->ExprType == HB_ET_STRING && pArg->ulLength > 0 )
{
if( HB_COMP_PARAM->fI18n )
to:
if( pArg->ExprType == HB_ET_STRING )
{
if( HB_COMP_PARAM->fI18n && pArg->ulLength > 0 )
3) remain current logic, but change warning text. This is perhaps the
best choice.
Change:
if( pArg->ExprType == HB_ET_STRING && pArg->ulLength > 0 )
{
if( HB_COMP_PARAM->fI18n )
{
...
}
to:
if( pArg->ExprType == HB_ET_STRING )
{
if( pArg->ulLength > 0 )
{
if( HB_COMP_PARAM->fI18n )
{
...
}
}
else
{
iWarning = HB_COMP_WARN_PARAM_TYPE;
pBadParam = pArg;
szExpect = "not empty string";
}
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour