1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

..

2 Commits

Author SHA1 Message Date
dpasukhi
e1b78718ca // fix a little more warnings 2024-04-06 18:09:10 +00:00
dpasukhi
323aa4abba 0033669: Coding - Processing Clang-19 warnings
Fixed issue with not-used variables
Fixed issue with function casting
2024-04-06 10:34:27 +00:00
23 changed files with 50 additions and 66 deletions

View File

@@ -36,14 +36,12 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
Abs(aRefR + aRangeV.second * Sin(aSAng)));
Standard_Real Dv, Du = GCPnts_TangentialDeflection::ArcAngularStep(
aRadius, GetDFace()->GetDeflection() * 0.5,
aRadius, GetDFace()->GetDeflection(),
theParameters.Angle, theParameters.MinSize);
const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
//compute subdivision factor acounting for the parameters minimum size
const Standard_Real aSubDivFactor = Max (theParameters.MinSize, 1.0);
const Standard_Real aScale = (Du * aRadius / aSubDivFactor);
const Standard_Real aScale = (Du * aRadius);
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);

View File

@@ -719,7 +719,7 @@ void Draw::Load (Draw_Interpretor& theDI,
}
void (*fp) (Draw_Interpretor&) = NULL;
fp = (void (*)(Draw_Interpretor&) )aFunc;
fp = (void (*)(Draw_Interpretor&) )(void*)aFunc;
(*fp) (theDI);
}

View File

@@ -69,13 +69,9 @@ Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName, const Stor
SetName(aName);
if (OpenMode() == Storage_VSNone) {
std::ios_base::openmode anOpenMode = std::ios_base::openmode(0);
std::ios_base::openmode anOpenMode;
switch (aMode)
{
case Storage_VSNone:
{
break;
}
case Storage_VSRead:
{
// std::ios::nocreate is not portable
@@ -104,11 +100,13 @@ Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName, const Stor
#endif
break;
}
}
if (anOpenMode != 0)
case Storage_VSNone:
default:
{
OSD_OpenStream(myStream, aName, anOpenMode);
return Storage_VSOpenError;
}
}
OSD_OpenStream(myStream, aName, anOpenMode);
if (myStream.fail()) {
result = Storage_VSOpenError;
}

View File

@@ -51,9 +51,7 @@ FSD_File::FSD_File()
Storage_Error FSD_File::IsGoodFileType(const TCollection_AsciiString& aName)
{
FSD_File f;
Storage_Error s;
s = f.Open(aName,Storage_VSRead);
Storage_Error s = f.Open(aName,Storage_VSRead);
if (s == Storage_VSOk) {
TCollection_AsciiString l;
@@ -84,13 +82,9 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
if (OpenMode() == Storage_VSNone)
{
std::ios_base::openmode anOpenMode = std::ios_base::openmode(0);
std::ios_base::openmode anOpenMode;
switch (aMode)
{
case Storage_VSNone:
{
break;
}
case Storage_VSRead:
{
// std::ios::nocreate is not portable
@@ -107,11 +101,13 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
anOpenMode = std::ios::in | std::ios::out;
break;
}
case Storage_VSNone:
default:
{
return Storage_VSOpenError;
}
}
if (anOpenMode != 0)
{
OSD_OpenStream (myStream, aName.ToCString(), anOpenMode);
}
OSD_OpenStream (myStream, aName.ToCString(), anOpenMode);
if (myStream.fail()) {
result = Storage_VSOpenError;
}
@@ -237,7 +233,7 @@ void FSD_File::WriteExtendedLine(const TCollection_ExtendedString& buffer)
void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
{
char c = '\0';
Standard_ExtCharacter i = 0,j,count = 0;
Standard_ExtCharacter i = 0,count = 0;
Standard_Boolean fin = Standard_False;
Standard_CString tg = ENDOFNORMALEXTENDEDSECTION;
@@ -249,7 +245,6 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
if (c == tg[count]) count++;
else count = 0;
if (count < SIZEOFNORMALEXTENDEDSECTION) {
j = 0;
i = (Standard_ExtCharacter)c;
if (c == '\0') fin = Standard_True;
i = (i << 8);
@@ -258,7 +253,7 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
if (c == tg[count]) count++;
else count = 0;
if (count < SIZEOFNORMALEXTENDEDSECTION) {
j = (Standard_ExtCharacter)c;
Standard_ExtCharacter j = (Standard_ExtCharacter)c;
if (c != '\n') {
fin = Standard_False;
i |= (0x00FF & j);

View File

@@ -1251,6 +1251,7 @@ bool Image_AlienPixMap::Save (Standard_Byte* theBuffer,
}
return true;
#else
(void)theLength;
if (theBuffer != NULL)
{
Message::SendFail ("Error: no image library available");
@@ -1450,6 +1451,8 @@ bool Image_AlienPixMap::Save (std::ostream& theStream, const TCollection_AsciiSt
}
return true;
#else
(void)theStream;
(void)theExtension;
Message::SendFail ("Error: no image library available");
return false;
#endif

View File

@@ -138,7 +138,6 @@ void Message_Msg::Set (const TCollection_ExtendedString& theMsg)
aFormatType = Msg_StringType;
break;
default:
aFormatType = Msg_IndefiniteType;
continue;
}
mySeqOfFormats.Append (Standard_Integer(aFormatType)); // type

View File

@@ -223,7 +223,7 @@ void Message_PrinterOStream::SetConsoleTextColor (Standard_OStream* theOStream,
return;
}
const char* aCode = "\e[0m";
const char* aCode;
switch (theTextColor)
{
case Message_ConsoleColor_Default:

View File

@@ -459,7 +459,7 @@ void OSD_File::Build (const OSD_OpenMode theMode,
throw Standard_ProgramError ("OSD_File::Build(): no name was given");
}
const char* anFDOpenMode = "r";
const char* anFDOpenMode;
Standard_Integer anOpenMode = O_CREAT | O_TRUNC;
switch (theMode)
{
@@ -622,7 +622,7 @@ void OSD_File::Open (const OSD_OpenMode theMode,
throw Standard_ProgramError ("OSD_File::Open(): no name was given");
}
const char* anFDOpenMode = "r";
const char* anFDOpenMode;
Standard_Integer anOpenMode = 0;
switch (theMode)
{

View File

@@ -1521,7 +1521,6 @@ TCollection_AsciiString OSD_Path::RelativePath(
TCollection_AsciiString EmptyString = "" ;
TCollection_AsciiString FilePath ;
Standard_Integer len ;
Standard_Integer i, n ;
Standard_Boolean Wnt = 0 ;
FilePath = aAbsFilePath ;
@@ -1554,14 +1553,14 @@ TCollection_AsciiString OSD_Path::RelativePath(
TCollection_AsciiString DirToken, FileToken ;
Standard_Boolean Sibling = 0 ;
for (i = n = 1 ;; n++) {
for (Standard_Integer n = 1 ;; n++) {
DirToken = aDirPath.Token("/\\",n) ;
if (DirToken.IsEmpty())
return FilePath ;
if (!Sibling) {
len = FilePath.Length() ;
i = FilePath.Search("/") ;
Standard_Integer i = FilePath.Search("/") ;
if (i > 0) {
if (i == len)
return EmptyString ;

View File

@@ -813,7 +813,7 @@ Standard_Boolean OpenGl_Context::SetSwapInterval (const Standard_Integer theInte
&& myFuncs->glXSwapIntervalEXT != NULL)
{
typedef int (*glXSwapIntervalEXT_t_x)(Display* theDisplay, GLXDrawable theDrawable, int theInterval);
glXSwapIntervalEXT_t_x aFuncPtr = (glXSwapIntervalEXT_t_x )myFuncs->glXSwapIntervalEXT;
glXSwapIntervalEXT_t_x aFuncPtr = (glXSwapIntervalEXT_t_x )(void*)myFuncs->glXSwapIntervalEXT;
aFuncPtr ((Display* )myDisplay, (GLXDrawable )myWindow, theInterval);
return Standard_True;
}

View File

@@ -94,9 +94,8 @@ Handle(Standard_Transient) Plugin::Load (const Standard_GUID& aGUID,
}
else
f = theMapOfFunctions(pid);
Standard_Transient* (*fp) (const Standard_GUID&) = NULL;
fp = (Standard_Transient* (*)(const Standard_GUID&)) f;
fp = (Standard_Transient* (*)(const Standard_GUID&))(void*)f;
Handle(Standard_Transient) theServiceFactory = (*fp) (aGUID);
return theServiceFactory;

View File

@@ -44,10 +44,11 @@ Standard_Failure::StringRef* Standard_Failure::StringRef::allocate_message (cons
}
const Standard_Size aLen = strlen (theString);
StringRef* aStrPtr = (StringRef* )malloc (aLen + sizeof(Standard_Integer) + 1);
StringRef* aStrPtr = (StringRef* )Standard::AllocateOptimal (aLen + sizeof(Standard_Integer) + 1);
if (aStrPtr != NULL)
{
strcpy ((char* )&aStrPtr->Message[0], theString);
strncpy ((char* )&aStrPtr->Message[0], theString, aLen);
((char* )&aStrPtr->Message[0])[aLen] = '\0';
aStrPtr->Counter = 1;
}
return aStrPtr;
@@ -78,7 +79,7 @@ void Standard_Failure::StringRef::deallocate_message (Standard_Failure::StringRe
{
if (--theString->Counter == 0)
{
free ((void* )theString);
Standard::Free((void* )theString);
}
}
}

View File

@@ -151,7 +151,8 @@ void StepFile_ReadData::CreateNewText(const char* theNewText, int theLenText)
strcpy(myResText + (int)strlen(anOldResText), theNewText);
return;
}
strcpy(myResText, theNewText);
strncpy(myResText, theNewText, aLength);
myResText[aLength] = '\0';
}
//=======================================================================

View File

@@ -298,7 +298,6 @@ void Units_UnitsDictionary::Creates()
}
if(unit2[0]) {
j = 0;
for(j=1;j<=theunitssequence->Length();j++)
if(theunitssequence->Value(j) == unit2)break;

View File

@@ -52,7 +52,7 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
Standard_Boolean GOOD;
Standard_Integer j;
Standard_Real dxold, fh, fl;
Standard_Real swap, temp, xh, xl;
Standard_Real xh, xl;
GOOD = F.Values(Bound1, fl, df);
if(!GOOD) {
@@ -83,9 +83,6 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
else {
xl = Bound2;
xh = Bound1;
swap = fl;
fl = fh;
fh = swap;
}
// Modified by Sergey KHROMOV - Wed Jan 22 12:06:49 2003 End
x = 0.5 * (Bound1 + Bound2);
@@ -112,7 +109,7 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
else {
dxold = dx;
dx = f / df;
temp = x;
Standard_Real temp = x;
x -= dx;
if(temp == x) {
TheStatus = math_OK;
@@ -133,11 +130,9 @@ void math_BissecNewton::Perform(math_FunctionWithDerivative& F,
}
if(f < 0.0) {
xl = x;
fl = f;
}
else if(f > 0.0) {
xh = x;
fh = f;
}
else {
TheStatus = math_OK;

View File

@@ -92,7 +92,6 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
math_Vector Point2(1, F.NbVariables());
math_Vector* precedent = &Point1;
math_Vector* suivant = &Point2;
math_Vector* auxiliaire = precedent;
Standard_Boolean Ok = Standard_True;
Standard_Integer NbConv = 0, ii, Nreduction;
@@ -234,9 +233,7 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
}
if (VItere <= VPrecedent) {
auxiliaire = precedent;
precedent = suivant;
suivant = auxiliaire;
std::swap(precedent, suivant);
PreviousMinimum = VPrecedent;
TheMinimum = VItere;
Ok = (nbiter < Itermax);

View File

@@ -11,7 +11,7 @@ renamevar a_1 result
incmesh result 0.0001 -a 30 -force_face_def -parallel
checktrinfo result -tri 14926 -nod 9726 -defl 0.00028360162213471898 -tol_abs_defl 1e-6
checktrinfo result -tri 14058 -nod 9292 -defl 0.00031502118964205414 -tol_abs_defl 1e-6
vinit
vsetdispmode 1

View File

@@ -15,6 +15,6 @@ vfit
vsetdispmode 1
XGetOneShape result Q
checktrinfo result -tri 9223 -nod 6699
checktrinfo result -tri 9097 -nod 6634
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -14,6 +14,6 @@ XGetOneShape result Q
incmesh result 0.00039624 -a 20 -min 0.0001 -parallel
checktrinfo result -tri 7743 -nod 5887
checktrinfo result -tri 7733 -nod 5882
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -9,6 +9,6 @@ scaleshape result a 0.1
vdisplay result -dispMode 1
vfit
checktrinfo result -tri 204 -nod 151
checktrinfo result -tri 168 -nod 133
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -6,4 +6,4 @@ puts ""
restore [locate_data_file bug32767.brep] s
tclean s
incmesh s 0.01
checktrinfo s -tri 2714 -nod 1512 -defl 0.022574056183562372 -tol_abs_defl 1e-6
checktrinfo s -tri 1512 -nod 909 -defl 0.035378595363471328 -tol_abs_defl 1e-6

View File

@@ -9,33 +9,33 @@ restore [locate_data_file bug33050.brep] result
tclean result
incmesh result 0.001
checktrinfo result -tri 28676 -nod 28530 -defl 0.0018679881605936205 -tol_abs_defl 1e-6
checktrinfo result -tri 27652 -nod 28016 -defl 0.0027132671526737435 -tol_abs_defl 1e-6
tclean result
incmesh result 0.001 -surf_def_all
checktrinfo result -tri 28682 -nod 28533 -defl 0.0010290003062228719 -tol_abs_defl 1e-6
checktrinfo result -tri 30102 -nod 29241 -defl 0.0010301984083541042 -tol_abs_defl 1e-6
################## Deflection: 0.0001 #################
tclean result
incmesh result 0.0001
checktrinfo result -tri 96006 -nod 88241 -defl 0.00043153032084638013 -tol_abs_defl 1e-6
checktrinfo result -tri 88140 -nod 84304 -defl 0.00073349807253346574 -tol_abs_defl 1e-6
tclean result
incmesh result 0.0001 -surf_def_all
checktrinfo result -tri 117766 -nod 99121 -defl 0.0002009725495247413 -tol_abs_defl 1e-6
checktrinfo result -tri 103376 -nod 91922 -defl 0.00012553867394267057 -tol_abs_defl 1e-6
################## Deflection: 0.00005 ################
tclean result
incmesh result 0.00005
checktrinfo result -tri 141582 -nod 126799 -defl 0.00030400570138159119 -tol_abs_defl 1e-6
checktrinfo result -tri 127538 -nod 119773 -defl 0.00043153032084638013 -tol_abs_defl 1e-6
tclean result
incmesh result 0.00005 -surf_def_all
checktrinfo result -tri 179002 -nod 145509 -defl 5.0570798687477583e-05 -tol_abs_defl 1e-6
checktrinfo result -tri 154246 -nod 133127 -defl 5.1157129731636775e-05 -tol_abs_defl 1e-6

View File

@@ -15,6 +15,6 @@ vclear
isos result 0
triangles result
checktrinfo result -tri 125 -nod 116
checktrinfo result -tri 103 -nod 105
checkprops result -s 150.283
checkview -display result -3d -path ${imagedir}/${test_image}.png