Re: Valid character for TxtCharAttr?
Forgive my ignorance but I don't see what type of casting I could do to prevent this sign extension. I tried: WChar w; Char c; w = ( WChar ) c; to no avail, 0xEC became 0xFFEC. So in the end I added: w = 0x00FF; Char is a 'signed char' - so, naturally, it'll think about the sign bit if you try to put it elsewhere, for example: w = (WChar) -1; will put 0x into w :) what you really wanted to do is: WChar w; w = (unsigned short)c; maybe that'll help :) --- Aaron Ardiri[EMAIL PROTECTED] CEO - CTO +46 70 656 1143 Mobile Wizardry http://www.mobilewizardry.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Valid character for TxtCharAttr?
Ken Krugler a écrit : Running the Gremlins on my application, I get a TextMgr.cpp, Line:727, Sign-extended char passed to TxtCharAttr warning because the Gremlin wrote a 236 (EC) character into a field onto which I later perform, for each character, a TxtGlueCharIsAlNum call, which in turn, calls TxtCharAttr. The OS reference about TxtCharAttr says The character passed to this function must be a valid character given the system encoding.. Yet, in the Latin character set, this 236 character is simply an accented lowercase a. Isn't this a valid character? I'm guessing that you're grabbing the characters from the text field using a Char variable (or Char*). When you pass a Char to a routine that expects a WChar, the 8-bit Char gets sign-extended, and thus the character code 236 (0xEC) becomes 0xFFEC. So either you want to use TxtGetNextChar to pull WChar values out of a string (bonus - this will also help your code work correctly with Japanese, Chinese, and the UTF-8 Unicode encoding), or you need to do proper type-casting to prevent the sign extension from occurring. Forgive my ignorance but I don't see what type of casting I could do to prevent this sign extension. I tried: WCharw; Charc; w = ( WChar ) c; to no avail, 0xEC became 0xFFEC. So in the end I added: w = 0x00FF; -- Luc Le Blanc -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Valid character for TxtCharAttr?
Forgive my ignorance but I don't see what type of casting I could do to prevent this sign extension. I tried: WCharw; Charc; w = ( WChar ) c; to no avail, 0xEC became 0xFFEC. So in the end I added: w = 0x00FF; w = (WChar)(unsigned char)c; will do it nicely. -- Ben Combee [EMAIL PROTECTED] CodeWarrior for Palm OS technical lead Palm OS programming help @ www.palmoswerks.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Valid character for TxtCharAttr?
Running the Gremlins on my application, I get a TextMgr.cpp, Line:727, Sign-extended char passed to TxtCharAttr warning because the Gremlin wrote a 236 (EC) character into a field onto which I later perform, for each character, a TxtGlueCharIsAlNum call, which in turn, calls TxtCharAttr. The OS reference about TxtCharAttr says The character passed to this function must be a valid character given the system encoding.. Yet, in the Latin character set, this 236 character is simply an accented lowercase a. Isn't this a valid character? Yes. What kind of preventive filtering must I perform before calling TxtGlueCharIsAlNum to prevent this? I already call this API to know whether the char is a letter... I'm guessing that you're grabbing the characters from the text field using a Char variable (or Char*). When you pass a Char to a routine that expects a WChar, the 8-bit Char gets sign-extended, and thus the character code 236 (0xEC) becomes 0xFFEC. So either you want to use TxtGetNextChar to pull WChar values out of a string (bonus - this will also help your code work correctly with Japanese, Chinese, and the UTF-8 Unicode encoding), or you need to do proper type-casting to prevent the sign extension from occurring. -- Ken -- Ken Krugler TransPac Software, Inc. http://www.transpac.com +1 530-470-9200 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Valid character for TxtCharAttr?
Running the Gremlins on my application, I get a TextMgr.cpp, Line:727, Sign-extended char passed to TxtCharAttr warning because the Gremlin wrote a 236 (EC) character into a field onto which I later perform, for each character, a TxtGlueCharIsAlNum call, which in turn, calls TxtCharAttr. The OS reference about TxtCharAttr says The character passed to this function must be a valid character given the system encoding.. Yet, in the Latin character set, this 236 character is simply an accented lowercase a. Isn't this a valid character? What kind of preventive filtering must I perform before calling TxtGlueCharIsAlNum to prevent this? I already call this API to know whether the char is a letter... Some may suggest reading the TextMgr.cpp file form the OS source code, but this is currently unavailable from PalmSource. The Source code link leads to an error page :( -- Luc Le Blanc -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/