fix more sprintf warnings

This commit is contained in:
Joachim Schoeberl 2022-12-08 15:26:27 +01:00
parent c622f39897
commit 1338cff45d
3 changed files with 14 additions and 14 deletions

View File

@ -349,7 +349,7 @@ namespace netgen
for (j = 0; j < nprim->GetNSurfaces(); j++)
{
sprintf (sname, "%s,%d", name, j);
snprintf (sname, size(sname), "%s,%d", name, j);
AddSurface (sname, &nprim->GetSurface(j));
nprim -> SetSurfaceId (j, GetNSurf());
}
@ -633,7 +633,7 @@ namespace netgen
static int cntsurfs = 0;
cntsurfs++;
char name[20];
sprintf (name, "nnsurf%d", cntsurfs);
snprintf (name, size(name), "nnsurf%d", cntsurfs);
AddSurface (name, surf);
}

View File

@ -42,11 +42,11 @@ void WriteFluentFormat (const Mesh & mesh,
outfile << "(0 \"Nodes:\")" << endl;
//number of nodes:
sprintf(str,"(10 (0 1 %x 1))",np); //hexadecimal!!!
snprintf (str, size(str), "(10 (0 1 %x 1))",np); //hexadecimal!!!
outfile << str << endl;
//nodes of zone 1:
sprintf(str,"(10 (7 1 %x 1)(",np); //hexadecimal!!!
snprintf (str, size(str), "(10 (7 1 %x 1)(",np); //hexadecimal!!!
outfile << str << endl;
for (i = 1; i <= np; i++)
{
@ -74,10 +74,10 @@ void WriteFluentFormat (const Mesh & mesh,
int noverbface = 2*ne-nse/2;
sprintf(str,"(13 (0 1 %x 0))",(noverbface+nse)); //hexadecimal!!!
snprintf (str, size(str), "(13 (0 1 %x 0))",(noverbface+nse)); //hexadecimal!!!
outfile << str << endl;
sprintf(str,"(13 (4 1 %x 2 3)(",noverbface); //hexadecimal!!!
snprintf (str, size(str), "(13 (4 1 %x 2 3)(",noverbface); //hexadecimal!!!
outfile << str << endl;
const_cast<Mesh&> (mesh).BuildElementSearchTree();
@ -156,7 +156,7 @@ void WriteFluentFormat (const Mesh & mesh,
}
outfile << "))" << endl;
sprintf(str,"(13 (2 %x %x 3 3)(",(noverbface+1),noverbface+nse); //hexadecimal!!!
snprintf (str, size(str), "(13 (2 %x %x 3 3)(",(noverbface+1),noverbface+nse); //hexadecimal!!!
outfile << str << endl;
for (i = 1; i <= surfaceelp.Size(); i++)
@ -171,10 +171,10 @@ void WriteFluentFormat (const Mesh & mesh,
outfile << "(0 \"Cells:\")" << endl;
sprintf(str,"(12 (0 1 %x 0))",ne); //hexadecimal!!!
snprintf (str, size(str), "(12 (0 1 %x 0))",ne); //hexadecimal!!!
outfile << str << endl;
sprintf(str,"(12 (1 1 %x 1 2))",ne); //hexadecimal!!!
snprintf (str, size(str), "(12 (1 1 %x 1 2))",ne); //hexadecimal!!!
outfile << str << endl << endl;

View File

@ -416,7 +416,7 @@ namespace netgen
const Point3d & p = mesh->Point(pi);
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", int(pi));
snprintf (buf, size(buf), "%d", int(pi));
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);
@ -434,7 +434,7 @@ namespace netgen
const Point3d p = Center (p1, p2);
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", seg.edgenr);
snprintf (buf, size(buf), "%d", seg.edgenr);
glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
}
*/
@ -449,7 +449,7 @@ namespace netgen
const Point3d p = Center (p1, p2);
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", i);
snprintf (buf, size(buf), "%d", i);
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);
@ -482,7 +482,7 @@ namespace netgen
}
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", i);
snprintf (buf, size(buf), "%d", i);
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);
}
@ -567,7 +567,7 @@ namespace netgen
}
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", i);
snprintf (buf, size(buf), "%d", i);
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);