Skip to content

Commit

Permalink
win: suppress C4996; use snprintf() instead of sprintf()
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Apr 22, 2024
1 parent da4224b commit eb3a51e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/cglm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ glm_mat4_print(mat4 matrix,
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
else
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% g", (double)matrix[i][j]);
cw[i] = GLM_MAX(cw[i], cwi);
}
}
Expand Down Expand Up @@ -175,9 +175,9 @@ glm_mat3_print(mat3 matrix,
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
else
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% g", (double)matrix[i][j]);
cw[i] = GLM_MAX(cw[i], cwi);
}
}
Expand Down Expand Up @@ -217,9 +217,9 @@ glm_mat2_print(mat2 matrix,
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
else
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
cwi = snprintf(buff, sizeof(buff), "% g", (double)matrix[i][j]);
cw[i] = GLM_MAX(cw[i], cwi);
}
}
Expand Down

0 comments on commit eb3a51e

Please sign in to comment.