From: abv Date: Tue, 3 Jul 2018 21:54:46 +0000 (+0300) Subject: 0029834: Coding Rules - eliminate GCC compiler warnings -Wformat-overflow in IGESData... X-Git-Tag: OCCT_VC2017_73~84 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=5efab28a44f3b237335cf5261261487979508378;p=occt-copy.git 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. --- 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 ! :