#include <HLRBRep_PolyHLRToShape.hxx>
#include <HLRBRep_PolyAlgo.hxx>
+#include <Standard_Failure.hxx>
+
#include <limits>
//=======================================================================
return 0;
}
+//=======================================================================
+//function : OCC29925
+//purpose : check safety of functions like IsSpace(), LowerCase(), etc. for all chars
+//=======================================================================
+static Standard_Integer OCC29925 (Draw_Interpretor& theDI, Standard_Integer, const char**)
+{
+ // iterate by all valid ASCII chars (including extended)
+ for (int i = 0; i < 256; i++)
+ {
+ Standard_Character c = (char)(unsigned char)i;
+// if (c != i) theDI << c << " != " << i << "\n";
+ const char* anOp = "";
+ try {
+ anOp = "IsAlphabetic";
+ IsAlphabetic (c);
+ anOp = "IsDigit";
+ IsDigit (c);
+ anOp = "IsXDigit";
+ IsXDigit (c);
+ anOp = "IsAlphanumeric";
+ IsAlphanumeric (c);
+ anOp = "IsControl";
+ IsControl (c);
+ anOp = "IsGraphic";
+ IsGraphic (c);
+ anOp = "IsLowerCase";
+ IsLowerCase (c);
+ anOp = "IsPrintable";
+ IsPrintable (c);
+ anOp = "IsPunctuation";
+ IsPunctuation (c);
+ anOp = "IsSpace";
+ IsSpace (c);
+ anOp = "IsUpperCase";
+ IsUpperCase (c);
+ anOp = "LowerCase";
+ LowerCase (c);
+ anOp = "UpperCase";
+ UpperCase (c);
+ }
+ catch (const Handle(Standard_Failure)& e)
+ {
+ theDI << anOp << "() fails for " << c << " (" << e->DynamicType()->Name() << ")\n";
+ }
+ }
+
+ return 0;
+}
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add("OCC29531", "OCC29531 <step file name>", __FILE__, OCC29531, group);
theCommands.Add ("OCC29064", "OCC29064: test memory usage by copying empty maps", __FILE__, OCC29064, group);
+ theCommands.Add ("OCC29925", "OCC29925: check safety of character classification functions", __FILE__, OCC29925, group);
return;
}
// LowerCase : Returns a lowercase character
// ==================================================================
inline Standard_Character LowerCase(const Standard_Character me)
-{ return (Standard_Character)(unsigned char)std::tolower(me); }
+{ return (Standard_Character)(unsigned char)std::tolower((unsigned char)me); }
// ==================================================================
// UpperCase : Returns a uppercase character
// ==================================================================
inline Standard_Character UpperCase(const Standard_Character me)
-{ return (Standard_Character)(unsigned char)std::toupper(me); }
+{ return (Standard_Character)(unsigned char)std::toupper((unsigned char)me); }
#endif
--- /dev/null
+puts "# ======================================================================"
+puts "# 0029925: Foundation Classes - add missing cast to LowerCase() and UpperCase() arguments"
+puts "# ======================================================================"
+puts ""
+
+pload QAcommands
+
+puts "Check safety of character classification functions for all valid chars"
+OCC29925