Commit fc9a3a96 authored by Over_score's avatar Over_score

Fixed array bound warning

parent fe81cb1c
...@@ -155,7 +155,7 @@ uint64_t shortIntegerMask; ...@@ -155,7 +155,7 @@ uint64_t shortIntegerMask;
uint64_t shortIntegerSignBit; uint64_t shortIntegerSignBit;
glyph_t glyphNotFound = {.charCode = 0x0000, .colsBeforeGlyph = 0, .colsGlyph = 13, .colsAfterGlyph = 0, .rowsGlyph = 19}; glyph_t glyphNotFound = {.charCode = 0x0000, .colsBeforeGlyph = 0, .colsGlyph = 13, .colsAfterGlyph = 0, .rowsGlyph = 19};
char transitionSystemOperation[4]; char transitionSystemOperation[4];
char displayValueX[80]; char displayValueX[DISPLAY_VALUE_LEN];
int16_t exponentSignLocation; int16_t exponentSignLocation;
int16_t denominatorLocation; int16_t denominatorLocation;
int16_t imaginaryExponentSignLocation; int16_t imaginaryExponentSignLocation;
......
...@@ -161,7 +161,7 @@ void roundCo16(void) { ...@@ -161,7 +161,7 @@ void roundCo16(void) {
refreshRegisterLine(REGISTER_X); refreshRegisterLine(REGISTER_X);
updateDisplayValueX = false; updateDisplayValueX = false;
posI = -1; posI = DISPLAY_VALUE_LEN - 1;
pos = 0; pos = 0;
while(displayValueX[pos] != 0) { while(displayValueX[pos] != 0) {
if(displayValueX[pos] == 'i') { if(displayValueX[pos] == 'i') {
...@@ -171,7 +171,7 @@ void roundCo16(void) { ...@@ -171,7 +171,7 @@ void roundCo16(void) {
pos++; pos++;
} }
if(posI == -1) { if(posI == DISPLAY_VALUE_LEN - 1) {
pos = 0; pos = 0;
while(displayValueX[pos] != 0) { while(displayValueX[pos] != 0) {
if(displayValueX[pos] == 'j') { if(displayValueX[pos] == 'j') {
...@@ -188,7 +188,7 @@ void roundCo16(void) { ...@@ -188,7 +188,7 @@ void roundCo16(void) {
real39_t magnitude, theta; real39_t magnitude, theta;
stringToReal(displayValueX, &magnitude, &ctxtReal39); stringToReal(displayValueX, &magnitude, &ctxtReal39);
stringToReal(displayValueX + posI, &theta, &ctxtReal39); stringToReal(displayValueX + posI, &theta, &ctxtReal39);
real39PolarToRectangular(&magnitude, &theta, &magnitude, &theta); real39PolarToRectangular(&magnitude, &theta, &magnitude, &theta);
realToReal16(&magnitude, REGISTER_REAL16_DATA(REGISTER_X)); realToReal16(&magnitude, REGISTER_REAL16_DATA(REGISTER_X));
realToReal16(&theta, REGISTER_IMAG16_DATA(REGISTER_X)); realToReal16(&theta, REGISTER_IMAG16_DATA(REGISTER_X));
...@@ -274,7 +274,7 @@ void roundCo34(void) { ...@@ -274,7 +274,7 @@ void roundCo34(void) {
refreshRegisterLine(REGISTER_X); refreshRegisterLine(REGISTER_X);
updateDisplayValueX = false; updateDisplayValueX = false;
posI = -1; posI = DISPLAY_VALUE_LEN - 1;
pos = 0; pos = 0;
while(displayValueX[pos] != 0) { while(displayValueX[pos] != 0) {
if(displayValueX[pos] == 'i') { if(displayValueX[pos] == 'i') {
...@@ -284,7 +284,7 @@ void roundCo34(void) { ...@@ -284,7 +284,7 @@ void roundCo34(void) {
pos++; pos++;
} }
if(posI == -1) { if(posI == DISPLAY_VALUE_LEN - 1) {
pos = 0; pos = 0;
while(displayValueX[pos] != 0) { while(displayValueX[pos] != 0) {
if(displayValueX[pos] == 'j') { if(displayValueX[pos] == 'j') {
...@@ -296,13 +296,12 @@ void roundCo34(void) { ...@@ -296,13 +296,12 @@ void roundCo34(void) {
} }
} }
displayValueX[posI++] = 0; displayValueX[posI++] = 0;
if(polar) { if(polar) {
real39_t magnitude, theta; real39_t magnitude, theta;
stringToReal(displayValueX, &magnitude, &ctxtReal39); stringToReal(displayValueX, &magnitude, &ctxtReal39);
stringToReal(displayValueX + posI, &theta, &ctxtReal39); stringToReal(displayValueX + posI, &theta, &ctxtReal39);
real39PolarToRectangular(&magnitude, &theta, &magnitude, &theta); real39PolarToRectangular(&magnitude, &theta, &magnitude, &theta);
realToReal34(&magnitude, REGISTER_REAL34_DATA(REGISTER_X)); realToReal34(&magnitude, REGISTER_REAL34_DATA(REGISTER_X));
realToReal34(&theta, REGISTER_IMAG34_DATA(REGISTER_X)); realToReal34(&theta, REGISTER_IMAG34_DATA(REGISTER_X));
......
...@@ -160,7 +160,7 @@ uint64_t shortIntegerMask; ...@@ -160,7 +160,7 @@ uint64_t shortIntegerMask;
uint64_t shortIntegerSignBit; uint64_t shortIntegerSignBit;
glyph_t glyphNotFound = {.charCode = 0x0000, .colsBeforeGlyph = 0, .colsGlyph = 13, .colsAfterGlyph = 0, .rowsGlyph = 19}; glyph_t glyphNotFound = {.charCode = 0x0000, .colsBeforeGlyph = 0, .colsGlyph = 13, .colsAfterGlyph = 0, .rowsGlyph = 19};
char transitionSystemOperation[4]; char transitionSystemOperation[4];
char displayValueX[80]; char displayValueX[DISPLAY_VALUE_LEN];
int16_t exponentSignLocation; int16_t exponentSignLocation;
int16_t denominatorLocation; int16_t denominatorLocation;
int16_t imaginaryExponentSignLocation; int16_t imaginaryExponentSignLocation;
......
...@@ -496,8 +496,9 @@ extern realContext_t ctxtReal75; // 75 digits: used in SLVQ ...@@ -496,8 +496,9 @@ extern realContext_t ctxtReal75; // 75 digits: used in SLVQ
extern realContext_t ctxtReal459; // 459 digits: used in radian angle reduction extern realContext_t ctxtReal459; // 459 digits: used in radian angle reduction
extern realContext_t ctxtReal855; // 855 digits: used for really big modulo extern realContext_t ctxtReal855; // 855 digits: used for really big modulo
extern uint16_t flags[7]; extern uint16_t flags[7];
#define TMP_STR_LENGTH 3000 #define TMP_STR_LENGTH 3000
#define ERROR_MESSAGE_LENGTH 512 #define ERROR_MESSAGE_LENGTH 512
#define DISPLAY_VALUE_LEN 80
extern char tmpStr3000[TMP_STR_LENGTH]; extern char tmpStr3000[TMP_STR_LENGTH];
extern char errorMessage[ERROR_MESSAGE_LENGTH]; extern char errorMessage[ERROR_MESSAGE_LENGTH];
extern char aimBuffer[AIM_BUFFER_LENGTH]; extern char aimBuffer[AIM_BUFFER_LENGTH];
...@@ -604,7 +605,7 @@ extern uint64_t shortIntegerMask; ...@@ -604,7 +605,7 @@ extern uint64_t shortIntegerMask;
extern uint64_t shortIntegerSignBit; extern uint64_t shortIntegerSignBit;
extern glyph_t glyphNotFound; extern glyph_t glyphNotFound;
extern char transitionSystemOperation[4]; extern char transitionSystemOperation[4];
extern char displayValueX[80]; extern char displayValueX[DISPLAY_VALUE_LEN];
extern int16_t exponentSignLocation; extern int16_t exponentSignLocation;
extern int16_t denominatorLocation; extern int16_t denominatorLocation;
extern int16_t imaginaryExponentSignLocation; extern int16_t imaginaryExponentSignLocation;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment