Made cc65 not warn us when we change character code 0x00 back to itself.
This commit is contained in:
@@ -452,15 +452,9 @@ static void CharMapPragma (StrBuf* B)
|
|||||||
if (!GetNumber (B, &Index)) {
|
if (!GetNumber (B, &Index)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Index < 1 || Index > 255) {
|
if (Index < 0 || Index > 255) {
|
||||||
if (Index != 0) {
|
Error ("Character index out of range");
|
||||||
Error ("Character index out of range");
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* For groepaz and Christian */
|
|
||||||
if (IS_Get (&WarnRemapZero)) {
|
|
||||||
Warning ("Remapping from 0 is dangerous with string functions");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Comma follows */
|
/* Comma follows */
|
||||||
@@ -472,13 +466,19 @@ static void CharMapPragma (StrBuf* B)
|
|||||||
if (!GetNumber (B, &C)) {
|
if (!GetNumber (B, &C)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (C < 1 || C > 255) {
|
if (C < 0 || C > 255) {
|
||||||
if (C != 0) {
|
Error ("Character code out of range");
|
||||||
Error ("Character code out of range");
|
return;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
/* Warn about remapping character code 0x00
|
||||||
|
** (except when remapping it back to itself).
|
||||||
|
*/
|
||||||
|
if (Index + C != 0 && IS_Get (&WarnRemapZero)) {
|
||||||
|
if (Index == 0) {
|
||||||
|
Warning ("Remapping from 0 is dangerous with string functions");
|
||||||
}
|
}
|
||||||
/* For groepaz and Christian */
|
else if (C == 0) {
|
||||||
if (IS_Get (&WarnRemapZero)) {
|
|
||||||
Warning ("Remapping to 0 can make string functions stop unexpectedly");
|
Warning ("Remapping to 0 can make string functions stop unexpectedly");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user