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
#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;
}
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;
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
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;
}
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;
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);
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);
aFormatType = Msg_StringType;
break;
default:
- aFormatType = Msg_IndefiniteType;
continue;
}
mySeqOfFormats.Append (Standard_Integer(aFormatType)); // type
return;
}
- const char* aCode = "\e[0m";
+ const char* aCode;
switch (theTextColor)
{
case Message_ConsoleColor_Default:
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)
{
throw Standard_ProgramError ("OSD_File::Open(): no name was given");
}
- const char* anFDOpenMode = "r";
+ const char* anFDOpenMode;
Standard_Integer anOpenMode = 0;
switch (theMode)
{
TCollection_AsciiString EmptyString = "" ;
TCollection_AsciiString FilePath ;
Standard_Integer len ;
- Standard_Integer i, n ;
Standard_Boolean Wnt = 0 ;
FilePath = aAbsFilePath ;
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 ;
}
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;
{
if (--theString->Counter == 0)
{
- free ((void* )theString);
+ Standard::Free((void* )theString);
}
}
}
strcpy(myResText + (int)strlen(anOldResText), theNewText);
return;
}
- strcpy(myResText, theNewText);
+ strncpy(myResText, theNewText, aLength);
+ myResText[aLength] = '\0';
}
//=======================================================================
}
if(unit2[0]) {
- j = 0;
for(j=1;j<=theunitssequence->Length();j++)
if(theunitssequence->Value(j) == unit2)break;
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) {
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);
else {
dxold = dx;
dx = f / df;
- temp = x;
+ Standard_Real temp = x;
x -= dx;
if(temp == x) {
TheStatus = math_OK;
}
if(f < 0.0) {
xl = x;
- fl = f;
}
else if(f > 0.0) {
xh = x;
- fh = f;
}
else {
TheStatus = math_OK;
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;
}
if (VItere <= VPrecedent) {
- auxiliaire = precedent;
- precedent = suivant;
- suivant = auxiliaire;
+ std::swap(precedent, suivant);
PreviousMinimum = VPrecedent;
TheMinimum = VItere;
Ok = (nbiter < Itermax);