From 5efab28a44f3b237335cf5261261487979508378 Mon Sep 17 00:00:00 2001 From: abv Date: Wed, 4 Jul 2018 00:54:46 +0300 Subject: [PATCH] 0029834: Coding Rules - eliminate GCC compiler warnings -Wformat-overflow in IGESData_IGESWriter String buffers have been increased to be sufficient to accommodate result of sprintf() for any possible printed integer values. --- src/IFSelect/IFSelect_ShareOut.cxx | 2 +- src/IGESData/IGESData_IGESWriter.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/IFSelect/IFSelect_ShareOut.cxx b/src/IFSelect/IFSelect_ShareOut.cxx index 8bca2b4cc5..396bffe3b5 100644 --- a/src/IFSelect/IFSelect_ShareOut.cxx +++ b/src/IFSelect/IFSelect_ShareOut.cxx @@ -333,7 +333,7 @@ IFSelect_ShareOut::IFSelect_ShareOut () // Si nbpack = 0 ou 1, num = 1 pas de suffixe, sinon suffixe "_num" tel quel // MODIF du 3-NOV-1995 -> pour eviter toute confusion, num = 1 donne aussi _1 Standard_Integer nbch = 0; - char format[10],suffixe[30]; format[1] = ' '; + char format[30],suffixe[30]; format[1] = ' '; if (npac >= num) { Standard_Integer nbpa = 1; while (nbpa <= npac) { nbpa *= 10; nbch ++; } diff --git a/src/IGESData/IGESData_IGESWriter.cxx b/src/IGESData/IGESData_IGESWriter.cxx index 36c12c5fa6..609568ec42 100644 --- a/src/IGESData/IGESData_IGESWriter.cxx +++ b/src/IGESData/IGESData_IGESWriter.cxx @@ -482,7 +482,7 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const Standard_Boolean fnes = (themodew >= 10); if(!isGood) return isGood; - char ligne[81]; + char ligne[256]; #ifdef PATIENCELOG Standard_Integer lignespatience = 1000; #endif @@ -590,7 +590,7 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const blancs[MaxcarsP] = '\0'; for (i = 1; i <= nbd && isGood; i ++) { for (Standard_Integer j = thepnum.Value(i); j < thepnum.Value(i+1); j ++) { - char finlin[20]; + char finlin[32]; sprintf(finlin," %7.7dP%7.7d",2*i-1,j); line = thepars->Value(j); // line->LeftJustify(MaxcarsP,' '); remplace par plus economique ! :