* App: Sanitize all paths for null characters
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
"Professional CMake" book suggest the following:
"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."
Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
The Python version of this class is entirely static: no instance is
required. Internally it accesses th pre-constructed instance of the C++
ApplicationDirectories class that is instantiated at program startup by
the Application class.
only 4 of these warnings are still relevant, CMake shall be used to disable them
Compiler definitions:
NOMINMAX:
* is already globally defined in SetGlobalCompilerAndLinkerSettings.cmake
WIN32_LEAN_AND_MEAN:
* use CMake target_compile_options on relevant targets
Warnings that still occur:
C4251, C4273, C4275: all related to dllimport / export
* use CMake target_compile_options on relevant targets
C4661: no suitable definition provied for explicit template instantiation request
* triggered in Mesh because of Vector3D in Base - not all functions are defined in header
* use CMake target_compile_options on relevant targets
Warnings that are Currently not triggered (fix code if they appear again):
C4005: macro redefinition
C4244: argument conversion, possible loss of data
C4267: conversion from size_t to type, possible loss of data
C4305: truncation from type1 to type2
* only occurrence disabled in Reader.cpp
C4522: multiple assignment operator specified
C5208: unnamed class in typedef name
Obsolete Compiler warnings:
C4181: not mentioned in Microsoft docs anymore
C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
* throw(optional_type_list) deprecated in C++17
C4482: nonstandard extension used: enum 'enumeration' used in qualified name
* not generated for compilers that support C++11
C4503: 'identifier': decorated name length exceeded, name was truncated
* obsolete since Visual Studio 2017
C4786: not mentioned in Microsoft docs anymore
* missing includes in Base, App and Gui headers
header should be self contained
* use cstddef header instead of stddef.h
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
---------
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
* Add test causing crash and fix map sorting function.
When opening a model from FreeCAD 0.7, the model would crash when I
changed some of the parameters. This turned out to be due to the
ElementNameComparator::operator() not correctly sorting the items going
into the map, which caused the map to be invalid.
This change adds a test that represented the exact names causing the
crash as well as a fix for the problem. Names are now sorted:
1. Empty names first
2. Identifier based names second.
3. Hex based names last.
Identifiers are sorted lexicographically for the name portion and
numerically for the number portion, smallest to largest.
Hex based names are sorted by the value of the hex number, smallest to
largest.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix lint issues.
* Add another test form to the mix.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Defaults for both precision (number of digits after decimal point)
and denominator (number of fractions) are defined on various places
making difficult to find which default is used for various tasks.
Store these values at one central place: UnitsApi. Unless overriden
by user, default values are defined by unitSchemasDataPack.
Not all unicode characters are allowed as XML output. When writing disallowed characters the SAX parser throws an exception
when loading a project file that results into a broken document and thus to a possible loss of data.
This PR replaces all disallowed characters with an underscore and prints a warning.
This fixes https://github.com/FreeCAD/FreeCAD/issues/22123
Note: It does not fix an already corrupted project file.
At the application level, support the existence of subdirectories inside
the original config and data paths for a specific version of the
software. For a new installation, create them, but for an existing
installation use the most recent available version, even if it's not the
current one (and even if it's not versioned at all). Any migration must
be done at the GUI level due to the amount of data that is potentially
being copied during that process.
Use std::filesystem wherever possible, replacing most uses of
std::string when the object is actually a path. This is the first stage
of refactoring, and does not make any changes to Application that affect
client code. Access to the new directory-handling class is implemented,
but is unused by any external code.
Within code often it is required to temporarly override value of some
object properties. To properly restore old values they must be stored
somewhere and the developer must remember to manualy restore them.
This commit introduces utilities that can be used to make it easier
using RAII idiom to guard the overrides.
* [Core] Fix#15558: Direct expression in ternary operator
* [Core] Added tests for Non-Numeric conditions in ternary op.
* [Core] prevent relational operator chains at grammar level.
* [Core] Rewrite expressions grammar as a layered grammar.
* [Core] Revert to left associative relops (like C/C++) plus tests.
Made several fixes to TaskMeasure:
* Move to correct namespace
* Handle possible exception in update() method
* Add null pointer checks for buttonBox
* Cannot use 'Measure::MeasurePython' as template argument in addObject<>
because the macro PROPERTY_HEADER_WITH_OVERRIDE determines the invalid
string 'App::FeaturePythonT<FeatureT>' so that an exception is raised
Note: The changes might fix issue 20304