summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/jedparse.cpp
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2023-06-03 20:27:30 -0400
committer arbee <rb6502@users.noreply.github.com>2023-06-03 20:27:30 -0400
commite711951979fb9e105de8ef2ed8eb1987aac702f8 (patch)
tree5dc34da6b0bfe48d600d48184aae857b5335056f /src/lib/util/jedparse.cpp
parent982d9385b988835072c4fb000eca61b026fc1d6f (diff)
Some more sprintf() deprecation warning fixes. [R. Belmont]
Diffstat (limited to 'src/lib/util/jedparse.cpp')
-rw-r--r--src/lib/util/jedparse.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/util/jedparse.cpp b/src/lib/util/jedparse.cpp
index 3b77c4abe35..5915886b1a6 100644
--- a/src/lib/util/jedparse.cpp
+++ b/src/lib/util/jedparse.cpp
@@ -355,13 +355,13 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
/* always start the DST with a standard header and an STX */
tempbuf[0] = 0x02;
- sprintf(&tempbuf[1], "JEDEC file generated by jedutil*\n");
+ snprintf(&tempbuf[1], 255, "JEDEC file generated by jedutil*\n");
if (curdst + strlen(tempbuf) <= dstend)
memcpy(curdst, tempbuf, strlen(tempbuf));
curdst += strlen(tempbuf);
/* append the package information */
- sprintf(tempbuf, "QF%d*\n", data->numfuses);
+ snprintf(tempbuf, 256, "QF%d*\n", data->numfuses);
if (curdst + strlen(tempbuf) <= dstend)
memcpy(curdst, tempbuf, strlen(tempbuf));
curdst += strlen(tempbuf);
@@ -382,7 +382,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
defbyte = (ones > zeros) ? 0xff : 0x00;
/* output the default fuse state */
- sprintf(tempbuf, "F%d*\n", defbyte & 1);
+ snprintf(tempbuf, 256, "F%d*\n", defbyte & 1);
if (curdst + strlen(tempbuf) <= dstend)
memcpy(curdst, tempbuf, strlen(tempbuf));
curdst += strlen(tempbuf);
@@ -398,10 +398,10 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
int j;
/* build up a string of 32 fuses */
- stroffs = sprintf(tempbuf, "L%05d ", i);
+ stroffs = snprintf(tempbuf, 256, "L%05d ", i);
for (j = 0; j < 32 && i+j < data->numfuses; j++)
tempbuf[stroffs++] = '0' + jed_get_fuse(data, i + j);
- stroffs += sprintf(&tempbuf[stroffs], "*\n");
+ stroffs += snprintf(&tempbuf[stroffs], 256-stroffs, "*\n");
/* append to the buffer */
if (curdst + strlen(tempbuf) <= dstend)
@@ -410,7 +410,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
}
/* write the checksum */
- sprintf(tempbuf, "C%04X*\n", checksum);
+ snprintf(tempbuf, 256, "C%04X*\n", checksum);
if (curdst + strlen(tempbuf) <= dstend)
memcpy(curdst, tempbuf, strlen(tempbuf));
curdst += strlen(tempbuf);
@@ -423,7 +423,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
/* append the ETX and the transmission checksum */
tempbuf[0] = 0x03;
- sprintf(&tempbuf[1], "%04X", checksum);
+ snprintf(&tempbuf[1], 255, "%04X", checksum);
if (curdst + strlen(tempbuf) <= dstend)
memcpy(curdst, tempbuf, strlen(tempbuf));
curdst += strlen(tempbuf);