From d0f98bf45c5b42e8bcf340d26a15bf13b059aee6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 17 May 2022 11:43:40 +0200 Subject: [PATCH] Conda: ssize_t is a POSIX type and thus not necessarily defined on Windows. Currently this causes build failures with Conda + Py3.10. The solution is to get rid off all occurrences of ssize_t in FreeCAD code --- src/Gui/ExpressionCompleter.cpp | 8 ++++---- src/Mod/Part/Gui/TaskAttacher.cpp | 4 ++-- src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp | 2 +- src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Gui/ExpressionCompleter.cpp b/src/Gui/ExpressionCompleter.cpp index 6b46121597..e7d59e6944 100644 --- a/src/Gui/ExpressionCompleter.cpp +++ b/src/Gui/ExpressionCompleter.cpp @@ -488,7 +488,7 @@ void ExpressionCompleter::slotUpdate(const QString & prefix, int pos) trim = prefixEnd - pos; // Extract last tokens that can be rebuilt to a variable - ssize_t i = static_cast(tokens.size()) - 1; + long i = static_cast(tokens.size()) - 1; // First, check if we have unclosing string starting from the end bool stringing = false; @@ -515,7 +515,7 @@ void ExpressionCompleter::slotUpdate(const QString & prefix, int pos) } if(!stringing) { - i = static_cast(tokens.size()) - 1; + i = static_cast(tokens.size()) - 1; for(;i>=0;--i) { int token = get<0>(tokens[i]); if (token != '.' && token != '#' && @@ -529,13 +529,13 @@ void ExpressionCompleter::slotUpdate(const QString & prefix, int pos) } // Set prefix start for use when replacing later - if (i == static_cast(tokens.size())) + if (i == static_cast(tokens.size())) prefixStart = prefixEnd; else prefixStart = start + get<1>(tokens[i]); // Build prefix from tokens - while (i < static_cast(tokens.size())) { + while (i < static_cast(tokens.size())) { completionPrefix += get<2>(tokens[i]); ++i; } diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index bb946d2183..28ce2ac5ff 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -380,7 +380,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg) if ((refs[r] == selObj) && (refnames[r] == subname)) return; - if (autoNext && iActiveRef > 0 && iActiveRef == (ssize_t) refnames.size()){ + if (autoNext && iActiveRef > 0 && iActiveRef == static_cast(refnames.size())){ if (refs[iActiveRef-1] == selObj && refnames[iActiveRef-1].length() != 0 && subname.length() == 0){ //A whole object was selected by clicking it twice. Fill it @@ -390,7 +390,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg) iActiveRef--; } } - if (iActiveRef < (ssize_t) refs.size()) { + if (iActiveRef < static_cast(refs.size())) { refs[iActiveRef] = selObj; refnames[iActiveRef] = subname; } else { diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp index 7138a469f4..bbaa4d4cd4 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp @@ -527,7 +527,7 @@ void ComboLinks::clear() App::PropertyLinkSub &ComboLinks::getLink(int index) const { - if (index < 0 || index > (ssize_t) linksInList.size()-1) + if (index < 0 || index > static_cast(linksInList.size())-1) throw Base::IndexError("ComboLinks::getLink:Index out of range"); if (linksInList[index]->getValue() && doc && !(doc->isIn(linksInList[index]->getValue()))) throw Base::ValueError("Linked object is not in the document; it may have been deleted"); diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index 887ca2d3a6..c6c9dcfd2d 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -165,13 +165,13 @@ void ViewProviderShapeBinder::highlightReferences(const bool on, bool /*auxiliar if (e.compare(0, 4, "Edge") == 0) { int idx = std::stoi(e.substr(4)) - 1; assert(idx >= 0); - if (idx < (ssize_t)lcolors.size()) + if (idx < static_cast(lcolors.size())) lcolors[idx] = App::Color(1.0, 0.0, 1.0); // magenta } else if (e.compare(0, 4, "Face") == 0) { int idx = std::stoi(e.substr(4)) - 1; assert(idx >= 0); - if (idx < (ssize_t)fcolors.size()) + if (idx < static_cast(fcolors.size())) fcolors[idx] = App::Color(1.0, 0.0, 1.0); // magenta } }