Skip to content

Commit

Permalink
bulk-fix out of bounds fencepost error
Browse files Browse the repository at this point in the history
  • Loading branch information
squeakyneb authored and G6EJD committed Mar 23, 2023
1 parent f8015c5 commit 1529a89
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions examples/M5_CoreInk/M5_CoreInk.ino
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ void DisplayForecastSection(int x, int y) {
DisplayForecastWeather(x + offset * 1, y, offset, 1);
DisplayForecastWeather(x + offset * 2, y, offset, 2);
DisplayForecastWeather(x + offset * 3, y, offset, 3);
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953;
else pressure_readings[r] = WxForecast[r].Pressure;
temperature_readings[r] = WxForecast[r].Temperature;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701;
else rain_readings[r] = WxForecast[r].Rainfall;
r++;
} while (r <= max_readings);
} while (r < max_readings);
}
//#########################################################################################
void DisplayForecastWeather(int x, int y, int offset, int index) {
Expand Down
4 changes: 2 additions & 2 deletions examples/OWM_75_epaper_v16_7/OWM_75_epaper_v16_7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -391,15 +391,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 120, gheight = 58;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 300;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_1_54/Waveshare_1_54.ino
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ void DisplayForecastSection(int x, int y) {
DisplayForecastWeather(x + offset * 1, y, offset, 1);
DisplayForecastWeather(x + offset * 2, y, offset, 2);
DisplayForecastWeather(x + offset * 3, y, offset, 3);
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953;
else pressure_readings[r] = WxForecast[r].Pressure;
temperature_readings[r] = WxForecast[r].Temperature;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701;
else rain_readings[r] = WxForecast[r].Rainfall;
r++;
} while (r <= max_readings);
} while (r < max_readings);
}
//#########################################################################################
void DisplayForecastWeather(int x, int y, int offset, int index) {
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_3_7/Waveshare_3_7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void DrawForecastSection(int x, int y) {
DrawForecastWeather(x + 80*5, y, 5);

//Long range 3day trend graphs
for (int r = 1; r < max_readings; r++) {
for (int r = 0; r < max_readings; r++) {
if (Units == "I") {
pressure_readings[r] = WxForecast[r].Pressure * 0.02953;
rain_readings[r] = WxForecast[r].Rainfall * 0.0393701;
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_4_2/Waveshare_4_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void DrawForecastSection(int x, int y) {
DrawForecastWeather(x + 56, y, 1);
DrawForecastWeather(x + 112, y, 2);
// (x,y,width,height,MinValue, MaxValue, Title, Data Array, AutoScale, ChartMode)
for (int r = 1; r <= max_readings; r++) {
for (int r = 0; r < max_readings; r++) {
if (Units == "I") {
pressure_readings[r] = WxForecast[r].Pressure * 0.02953;
rain_readings[r] = WxForecast[r].Rainfall * 0.0393701;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_7_5/Waveshare_7_5.ino
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 120, gheight = 58;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 300;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_7_5_3C.ino
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 150, gheight = 72;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 375;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_7_5_3C/Waveshare_7_5_3C.ino
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 150, gheight = 72;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 375;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_7_5_News/Waveshare_7_5_News.ino
Original file line number Diff line number Diff line change
Expand Up @@ -413,15 +413,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 120, gheight = 58;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 300;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_7_5_T7/Waveshare_7_5_T7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);
int gwidth = 150, gheight = 72;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 5;
int gy = 375;
Expand Down
4 changes: 2 additions & 2 deletions examples/Waveshare_9_7/Waveshare_9_7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,15 @@ void DisplayForecastSection(int x, int y) {
f++;
} while (f <= 7);
// Pre-load temporary arrays with with data - because C parses by reference
int r = 1;
int r = 0;
do {
if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953; else pressure_readings[r] = WxForecast[r].Pressure;
if (Units == "I") rain_readings[r] = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r] = WxForecast[r].Rainfall;
if (Units == "I") snow_readings[r] = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r] = WxForecast[r].Snowfall;
temperature_readings[r] = WxForecast[r].Temperature;
humidity_readings[r] = WxForecast[r].Humidity;
r++;
} while (r <= max_readings);
} while (r < max_readings);

int gwidth = 230, gheight = 150;
int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 7;
Expand Down

0 comments on commit 1529a89

Please sign in to comment.