mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-05 23:05:10 +08:00
Merge pull request #2630 from lordofhyphens/fix-admesh-warning
Fix a warning about unused return value when using freopen in admesh.
This commit is contained in:
commit
6413d5dcba
@ -135,7 +135,21 @@ stl_count_facets(stl_file *stl, char *file) {
|
|||||||
/* Otherwise, if the .STL file is ASCII, then do the following */
|
/* Otherwise, if the .STL file is ASCII, then do the following */
|
||||||
else {
|
else {
|
||||||
/* Reopen the file in text mode (for getting correct newlines on Windows) */
|
/* Reopen the file in text mode (for getting correct newlines on Windows) */
|
||||||
freopen(file, "r", stl->fp);
|
// fix to silence a warning about unused return value.
|
||||||
|
// obviously if it fails we have problems....
|
||||||
|
stl->fp = freopen(file, "r", stl->fp);
|
||||||
|
|
||||||
|
// do another null check to be safe
|
||||||
|
if(stl->fp == NULL) {
|
||||||
|
error_msg = (char*)
|
||||||
|
malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
|
||||||
|
sprintf(error_msg, "stl_initialize: Couldn't open %s for reading",
|
||||||
|
file);
|
||||||
|
perror(error_msg);
|
||||||
|
free(error_msg);
|
||||||
|
stl->error = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the number of facets */
|
/* Find the number of facets */
|
||||||
j = 0;
|
j = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user