LCD LIB
Fork of RA8875 by
Revision 141:2ec78a50dc98, committed 2016-12-29
- Comitter:
- WiredHome
- Date:
- Thu Dec 29 20:06:00 2016 +0000
- Parent:
- 140:33ca352755a2
- Child:
- 142:6e9bff59878a
- Child:
- 145:5eb2492acdda
- Commit message:
- Minor change from sprintf to snprintf in a couple of locations.
Changed in this revision
RA8875.cpp | Show annotated file Show diff for this revision Revisions of this file |
TextDisplay.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/RA8875.cpp Tue Dec 27 15:46:18 2016 +0000 +++ b/RA8875.cpp Thu Dec 29 20:06:00 2016 +0000 @@ -2505,7 +2505,7 @@ display.puts("RA8875 Backlight Test - Ramp up."); wait_ms(delay); for (int i=0; i <= 255; i++) { - sprintf(buf, "%3d, %4d", i, w); + snprintf(buf, sizeof(buf), "%3d, %4d", i, w); display.puts(100,100,buf); display.Backlight_u8(i); wait_ms(w);
--- a/TextDisplay.cpp Tue Dec 27 15:46:18 2016 +0000 +++ b/TextDisplay.cpp Thu Dec 29 20:06:00 2016 +0000 @@ -26,8 +26,9 @@ if (name == NULL) { _path = NULL; } else { - _path = new char[strlen(name) + 2]; - sprintf(_path, "/%s", name); + int len = strlen(name) + 2; + _path = new char[len]; + snprintf(_path, len, "/%s", name); } }