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
This commit is contained in:
wmayer
2022-05-17 11:43:40 +02:00
parent bed5bc053a
commit 72e464b1cc
4 changed files with 9 additions and 9 deletions

View File

@@ -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<ssize_t>(tokens.size()) - 1;
long i = static_cast<long>(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<ssize_t>(tokens.size()) - 1;
i = static_cast<long>(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<ssize_t>(tokens.size()))
if (i == static_cast<long>(tokens.size()))
prefixStart = prefixEnd;
else
prefixStart = start + get<1>(tokens[i]);
// Build prefix from tokens
while (i < static_cast<ssize_t>(tokens.size())) {
while (i < static_cast<long>(tokens.size())) {
completionPrefix += get<2>(tokens[i]);
++i;
}

View File

@@ -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<int>(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<int>(refs.size())) {
refs[iActiveRef] = selObj;
refnames[iActiveRef] = subname;
} else {

View File

@@ -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<int>(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");

View File

@@ -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<int>(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<int>(fcolors.size()))
fcolors[idx] = App::Color(1.0, 0.0, 1.0); // magenta
}
}