Gary P
Active Member
Hi,
I'm making some enhancements on an existing business function that will parse tokens from a file and replace them with strings. But I'm getting some problems.
Here is the relevant code:
<font class="small">Code:</font><hr /><pre>
while ((tokenptr=myStrStr(curptr,"LABELTOKEN",bytesread-(tokenptr-buffer)))>'\0')
{
/* Once we find a token, we want to copy everything
to the left of the token to the output, if it has not yet been copied. */
memcpy(outptr, curptr, tokenptr-curptr);
outptr += (tokenptr-curptr);
memcpy(outptr,lpDS->szLabelToken,strlen(lpDS->szLabelToken));
curptr = tokenptr+strlen("LABELTOKEN");
outptr += strlen(lpDS->szLabelToken);
}
</pre><hr />
All the pointers are type char *, and here is the header to the custom function called:
<font class="small">Code:</font><hr /><pre>
static char * MyStrStr(const char *s1, const char *s2, const long bufferlen)
</pre><hr />
One more, here is a section of code that works just fine:
<font class="small">Code:</font><hr /><pre>
while ((tokenptr=MyStrStr(curptr,MyToken[x],bytesread-(tokenptr-buffer)))>'\0')
{
memcpy(outptr, curptr, tokenptr-curptr);
outptr += (tokenptr-curptr);
memcpy(outptr,JCHARToChar(UserReservedAlpha),jdeStrlen(UserReservedAlpha)); </pre><hr />
The above seems to work just fine. However, when I try to build the BSFN in JDE, here's what I get:
<font class="small">Code:</font><hr /><pre>
c:\e810\DV810\source\B550006.c(467) : warning C4133: 'function' : incompatible types - from 'char *' to 'unsigned short *'
c:\e810\DV810\source\B550006.c(467) : warning C4133: 'function' : incompatible types - from 'char [11]' to 'unsigned short *'
c:\e810\DV810\source\B550006.c(467) : warning C4133: '=' : incompatible types - from 'unsigned short *' to 'char *'
c:\e810\DV810\source\B550006.c(472) : warning C4133: 'function' : incompatible types - from 'unsigned short [33]' to 'const char *'
c:\e810\DV810\source\B550006.c(474) : warning C4133: 'function' : incompatible types - from 'unsigned short [33]' to 'const char *'
</pre><hr />
Line 467 is where my first block of code begins.
I'm really confused to this, as I don't know why it's considering unsigned short *, unless there was some implicit conversion that's messing it up.
Any help you can offer would be appreciated. Thanks!
I'm making some enhancements on an existing business function that will parse tokens from a file and replace them with strings. But I'm getting some problems.
Here is the relevant code:
<font class="small">Code:</font><hr /><pre>
while ((tokenptr=myStrStr(curptr,"LABELTOKEN",bytesread-(tokenptr-buffer)))>'\0')
{
/* Once we find a token, we want to copy everything
to the left of the token to the output, if it has not yet been copied. */
memcpy(outptr, curptr, tokenptr-curptr);
outptr += (tokenptr-curptr);
memcpy(outptr,lpDS->szLabelToken,strlen(lpDS->szLabelToken));
curptr = tokenptr+strlen("LABELTOKEN");
outptr += strlen(lpDS->szLabelToken);
}
</pre><hr />
All the pointers are type char *, and here is the header to the custom function called:
<font class="small">Code:</font><hr /><pre>
static char * MyStrStr(const char *s1, const char *s2, const long bufferlen)
</pre><hr />
One more, here is a section of code that works just fine:
<font class="small">Code:</font><hr /><pre>
while ((tokenptr=MyStrStr(curptr,MyToken[x],bytesread-(tokenptr-buffer)))>'\0')
{
memcpy(outptr, curptr, tokenptr-curptr);
outptr += (tokenptr-curptr);
memcpy(outptr,JCHARToChar(UserReservedAlpha),jdeStrlen(UserReservedAlpha)); </pre><hr />
The above seems to work just fine. However, when I try to build the BSFN in JDE, here's what I get:
<font class="small">Code:</font><hr /><pre>
c:\e810\DV810\source\B550006.c(467) : warning C4133: 'function' : incompatible types - from 'char *' to 'unsigned short *'
c:\e810\DV810\source\B550006.c(467) : warning C4133: 'function' : incompatible types - from 'char [11]' to 'unsigned short *'
c:\e810\DV810\source\B550006.c(467) : warning C4133: '=' : incompatible types - from 'unsigned short *' to 'char *'
c:\e810\DV810\source\B550006.c(472) : warning C4133: 'function' : incompatible types - from 'unsigned short [33]' to 'const char *'
c:\e810\DV810\source\B550006.c(474) : warning C4133: 'function' : incompatible types - from 'unsigned short [33]' to 'const char *'
</pre><hr />
Line 467 is where my first block of code begins.
I'm really confused to this, as I don't know why it's considering unsigned short *, unless there was some implicit conversion that's messing it up.
Any help you can offer would be appreciated. Thanks!