This commit is contained in:
+1
-1
@@ -365,7 +365,7 @@ static ph7_real MemObjCharValue(ph7_value *pObj) {
|
||||
/* Empty string */
|
||||
return 0;
|
||||
}
|
||||
return (int) sString.zString[0];
|
||||
return (int)(unsigned char) sString.zString[0];
|
||||
}
|
||||
/* NOT REACHED */
|
||||
return 0;
|
||||
|
||||
+6
-6
@@ -15,12 +15,12 @@
|
||||
* sxi64), not a byte. PH7_MemObjToChar() (engine/memobj.c:612-620) stores the
|
||||
* integer unchanged: (char)128/233/255 give 128/233/255, but (char)256 gives
|
||||
* 256 and (char)-1 gives -1 (no clamp); ph7_value_to_int() shows only a 32-bit
|
||||
* view. The engine's string-to-char path is signed (engine/memobj.c:368,
|
||||
* (int)zString[0]), so (char)chr(233) is -23; that path is OUT_OF_SCOPE here.
|
||||
* This scripted Char class adds its own contract mask on top: CharOperand
|
||||
* accepts only a char in 0..255 or a one-byte string mapped as an unsigned
|
||||
* byte, and rejects values outside that range. It does not change the engine
|
||||
* representation. Classifiers return FALSE for bytes >= 0x80. */
|
||||
* view. Converting a one-byte string to char maps its first byte to 0..255,
|
||||
* so (char)chr(233) is 233. This scripted Char class adds its own contract
|
||||
* mask on top: CharOperand accepts only a char in 0..255 or a one-byte string
|
||||
* mapped as an unsigned byte, and rejects values outside that range. It does
|
||||
* not change the engine representation. Classifiers return FALSE for bytes
|
||||
* >= 0x80. */
|
||||
|
||||
typedef int (*CharPred)(ph7_int64);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user