This is an old C function but it's used in a 3rd party lib so I can't
use HB's standard one.
When I build it with 2.0.0beta3 gcc warnings. How can I fix it?

#include <extend.h>

#ifdef __HARBOUR__
HB_FUNC( BIT )
#else
CLIPPER bit( void )
#endif
{
   char            *ptr;
   unsigned char   mask;
   unsigned int    loc,
                   offset = _parni( 2 ) - 1,
                   res    = 0;

   loc = offset / 8;
   if ( loc < _parclen( 1 ) )
   {
      ptr = _parc( 1 ) + loc;  <---- warning here
      loc = offset % 8;
      res = *ptr << loc & 0x80;

      if ( PCOUNT > 2 )
      {
         mask = (unsigned char ) 0x80 >> loc;
         if ( _parl( 3 ) )
            *ptr = *ptr | mask;
         else
            *ptr = *ptr & ~mask;
      }
   }
   _retl( res );
}

best regards,
Lorenzo
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to