Skip to content

Commit 8e9fd4d

Browse files
committed
Change sprintf to snprintf (fixes clang compiler warnings). Update copyright.
1 parent c3e6e3f commit 8e9fd4d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/tbprobe.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Copyright (c) 2013-2018 Ronald de Man
33
Copyright (c) 2015 basil00
4-
Modifications Copyright (c) 2016-2020 by Jon Dart
4+
Modifications Copyright (c) 2016-2022 by Jon Dart
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -892,33 +892,33 @@ bool tb_init(const char *path)
892892
int i, j, k, l, m;
893893

894894
for (i = 0; i < 5; i++) {
895-
sprintf(str, "K%cvK", pchr(i));
895+
snprintf(str, 16, "K%cvK", pchr(i));
896896
init_tb(str);
897897
}
898898

899899
for (i = 0; i < 5; i++)
900900
for (j = i; j < 5; j++) {
901-
sprintf(str, "K%cvK%c", pchr(i), pchr(j));
901+
snprintf(str, 16, "K%cvK%c", pchr(i), pchr(j));
902902
init_tb(str);
903903
}
904904

905905
for (i = 0; i < 5; i++)
906906
for (j = i; j < 5; j++) {
907-
sprintf(str, "K%c%cvK", pchr(i), pchr(j));
907+
snprintf(str, 16, "K%c%cvK", pchr(i), pchr(j));
908908
init_tb(str);
909909
}
910910

911911
for (i = 0; i < 5; i++)
912912
for (j = i; j < 5; j++)
913913
for (k = 0; k < 5; k++) {
914-
sprintf(str, "K%c%cvK%c", pchr(i), pchr(j), pchr(k));
914+
snprintf(str, 16, "K%c%cvK%c", pchr(i), pchr(j), pchr(k));
915915
init_tb(str);
916916
}
917917

918918
for (i = 0; i < 5; i++)
919919
for (j = i; j < 5; j++)
920920
for (k = j; k < 5; k++) {
921-
sprintf(str, "K%c%c%cvK", pchr(i), pchr(j), pchr(k));
921+
snprintf(str, 16, "K%c%c%cvK", pchr(i), pchr(j), pchr(k));
922922
init_tb(str);
923923
}
924924

@@ -930,23 +930,23 @@ bool tb_init(const char *path)
930930
for (j = i; j < 5; j++)
931931
for (k = i; k < 5; k++)
932932
for (l = (i == k) ? j : k; l < 5; l++) {
933-
sprintf(str, "K%c%cvK%c%c", pchr(i), pchr(j), pchr(k), pchr(l));
933+
snprintf(str, 16, "K%c%cvK%c%c", pchr(i), pchr(j), pchr(k), pchr(l));
934934
init_tb(str);
935935
}
936936

937937
for (i = 0; i < 5; i++)
938938
for (j = i; j < 5; j++)
939939
for (k = j; k < 5; k++)
940940
for (l = 0; l < 5; l++) {
941-
sprintf(str, "K%c%c%cvK%c", pchr(i), pchr(j), pchr(k), pchr(l));
941+
snprintf(str, 16, "K%c%c%cvK%c", pchr(i), pchr(j), pchr(k), pchr(l));
942942
init_tb(str);
943943
}
944944

945945
for (i = 0; i < 5; i++)
946946
for (j = i; j < 5; j++)
947947
for (k = j; k < 5; k++)
948948
for (l = k; l < 5; l++) {
949-
sprintf(str, "K%c%c%c%cvK", pchr(i), pchr(j), pchr(k), pchr(l));
949+
snprintf(str, 16, "K%c%c%c%cvK", pchr(i), pchr(j), pchr(k), pchr(l));
950950
init_tb(str);
951951
}
952952

@@ -958,7 +958,7 @@ bool tb_init(const char *path)
958958
for (k = j; k < 5; k++)
959959
for (l = k; l < 5; l++)
960960
for (m = l; m < 5; m++) {
961-
sprintf(str, "K%c%c%c%c%cvK", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
961+
snprintf(str, 16, "K%c%c%c%c%cvK", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
962962
init_tb(str);
963963
}
964964

@@ -967,7 +967,7 @@ bool tb_init(const char *path)
967967
for (k = j; k < 5; k++)
968968
for (l = k; l < 5; l++)
969969
for (m = 0; m < 5; m++) {
970-
sprintf(str, "K%c%c%c%cvK%c", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
970+
snprintf(str, 16, "K%c%c%c%cvK%c", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
971971
init_tb(str);
972972
}
973973

@@ -976,7 +976,7 @@ bool tb_init(const char *path)
976976
for (k = j; k < 5; k++)
977977
for (l = 0; l < 5; l++)
978978
for (m = l; m < 5; m++) {
979-
sprintf(str, "K%c%c%cvK%c%c", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
979+
snprintf(str, 16, "K%c%c%cvK%c%c", pchr(i), pchr(j), pchr(k), pchr(l), pchr(m));
980980
init_tb(str);
981981
}
982982

0 commit comments

Comments
 (0)