Skip to content

Commit

Permalink
Compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dxli committed May 5, 2024
1 parent 96c2ba0 commit 59270a7
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 72 deletions.
2 changes: 1 addition & 1 deletion libraries/libdxfrw/src/drw_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ bool DRW_Header::parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer *hBbuf
}

//temporary code to show header end sentinel
duint64 sz= buf->size()-1;
duint64 sz= 0; //buf->size()-1;
if (version < DRW::AC1018) {//pre 2004
sz= buf->size()-16;
buf->setPosition(sz);
Expand Down
8 changes: 4 additions & 4 deletions librecad/src/actions/lc_actionmodifylinejoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void LC_ActionModifyLineJoin::doPreparePreviewEntities(QMouseEvent *e, [[maybe_u
}
if (snappedLine != nullptr){
// here we do not relay on snap point, simply get coordinates from even
RS_Vector coord = graphicView->toGraph(e->x(), e->y());
RS_Vector coord = graphicView->toGraph(e->position());
LC_LineJoinData *lineJoinData = createLineJoinData(snappedLine, coord);
if (lineJoinData != nullptr){
RS_Polyline *polyline = lineJoinData->polyline;
Expand All @@ -93,7 +93,7 @@ void LC_ActionModifyLineJoin::doPreparePreviewEntities(QMouseEvent *e, [[maybe_u
if (snappedLine != nullptr){
// retrieve current mouse position and recalculate line join data considering that mose position denotes part of line 1 that
// will survive trim operation
RS_Vector coord = graphicView->toGraph(e->x(), e->y());
RS_Vector coord = graphicView->toGraph(e->position());
updateLine1TrimData(coord);

RS_Polyline *polyline = linesJoinData->polyline;
Expand Down Expand Up @@ -126,7 +126,7 @@ void LC_ActionModifyLineJoin::doOnLeftMouseButtonRelease(QMouseEvent *e, int sta
}
if (snappedLine != nullptr){
line2 = snappedLine;
RS_Vector snap = graphicView->toGraph(e->x(), e->y());
RS_Vector snap = graphicView->toGraph(e->position());
LC_LineJoinData *joinData = createLineJoinData(snappedLine, snap);
if (joinData != nullptr){
// check whether parallel lines were selected
Expand Down Expand Up @@ -173,7 +173,7 @@ void LC_ActionModifyLineJoin::doOnLeftMouseButtonRelease(QMouseEvent *e, int sta

case ResolveFirstLineTrim:
if (snappedLine == line1){ // we need trim hint on the first line
RS_Vector snap = graphicView->toGraph(e->x(), e->y());
RS_Vector snap = graphicView->toGraph(e->position());
// update trim data according to selected part of line 1
updateLine1TrimData(snap);
// check if polyline is built and if it so - trigger action
Expand Down
3 changes: 0 additions & 3 deletions librecad/src/actions/rs_actiondefault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ constexpr double minimumHoverTolerance = 3.0;
constexpr double hoverToleranceFactor1 = 1.0;
constexpr double hoverToleranceFactor2 = 10.0;

constexpr unsigned minHighLightDuplicates = 4;
constexpr unsigned maxHighLightDuplicates = 20;

// whether the entity supports glowing effects on mouse hovering
bool allowMouseOverGlowing(const RS_Entity* entity)
{
Expand Down
2 changes: 1 addition & 1 deletion librecad/src/lib/engine/rs_hatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void RS_Hatch::update() {
std::unique_ptr<RS_Pattern> pat = RS_PATTERNLIST->requestPattern(data.pattern);
if (pat == nullptr) {
updateRunning = false;
RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Hatch::update: requesting pattern: %s not found", data.pattern.toStdString().c_str());
RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Hatch::update: requesting pattern: %s not found", data.pattern.toUtf8().constData());
updateError = HATCH_PATTERN_NOT_FOUND;
return;
} else {
Expand Down
16 changes: 8 additions & 8 deletions librecad/src/lib/engine/rs_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void RS_System::init(const QString& appName,
// in AppImage QCoreApplication::applicationDirPath() directs to /lib64 of mounted AppImage
// thus use argv[0] to extract the correct path to librecad executable
appDir = QFileInfo( QFile::decodeName( arg0)).absoluteFilePath();
RS_DEBUG->print("%s\n", (QString("arg0:")+ QString(arg0)).toStdString().c_str());
RS_DEBUG->print("%s\n", (QString("appDir:")+ appDir).toStdString().c_str());
RS_DEBUG->print("%s\n", (QString("arg0:")+ QString(arg0)).toUtf8().constData());
RS_DEBUG->print("%s\n", (QString("appDir:")+ appDir).toUtf8().constData());
}
else {
// in regular application QCoreApplication::applicationDirPath() is preferred, see GitHub #1488
appDir = QCoreApplication::applicationDirPath();
RS_DEBUG->print("%s\n", (QString("appDir2:")+ appDir).toStdString().c_str());
RS_DEBUG->print("%s\n", (QString("appDir2:")+ appDir).toUtf8().constData());
}

// when appDir is not HOME or CURRENT dir, search appDir too in getDirectoryList()
Expand Down Expand Up @@ -529,7 +529,7 @@ QString RS_System::getAppDataDir() {
if (!dir.mkpath( appData))
return QString();
}
RS_DEBUG->print("%s\n", (QString("appData: ") + appData).toStdString().c_str());
RS_DEBUG->print("%s\n", (QString("appData: ") + appData).toUtf8().constData());
return appData;
}

Expand Down Expand Up @@ -599,7 +599,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
}
}

RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(appDir).toStdString().c_str());
RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(appDir).toUtf8().constData());

#if (defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_UNIX))
// for AppImage use relative paths from executable
Expand All @@ -620,7 +620,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
#endif
for (auto& dir: dirList) {

RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3\n").arg(__func__).arg(__LINE__).arg(dir).toStdString().c_str());
RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3\n").arg(__func__).arg(__LINE__).arg(dir).toUtf8().constData());
}

#ifdef Q_OS_MAC
Expand All @@ -645,7 +645,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
#endif
if (subDirectory == "fonts") {
QString savedFonts = RS_SETTINGS->readEntry( "/Fonts", "");
RS_DEBUG->print("saved fonts: %s\n", savedFonts.toStdString().c_str());
RS_DEBUG->print("saved fonts: %s\n", savedFonts.toUtf8().constData());
dirList += (RS_SETTINGS->readEntry( "/Fonts", "")).split( QRegularExpression("[;]"),
option);
}
Expand Down Expand Up @@ -682,7 +682,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
for (auto& dir: ret) {


RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(dir).toStdString().c_str());
RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(dir).toUtf8().constData());
}

return ret;
Expand Down
3 changes: 1 addition & 2 deletions librecad/src/ui/forms/lc_layertreeoptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ void LC_LayerTreeOptionsDialog::validate(){
if (layerListSeparator.isEmpty()){
QMessageBox::warning(this, QMessageBox::tr("Error"),
QMessageBox::tr("Layer list separator string is empty. It will not be possible to build layers tree.\n"
"Please specify a different value."),
QMessageBox::Ok);
"Please specify a different value."));
leLayerLevelSeparator -> setFocus();
doAccept = false;
}
Expand Down
2 changes: 1 addition & 1 deletion librecad/src/ui/lc_filedialogservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ QList<RS2::FormatType> filtersTypeList =
Number of values pertaining to the open file dialog mode,
as defined in one of the relevant lists below.
*/
const int numberOf_openFileModes = 0;
[[maybe_unused]] const int numberOf_openFileModes = 0;

const QStringList filterSettingsPaths =
{
Expand Down
18 changes: 8 additions & 10 deletions librecad/src/ui/lc_layertreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) {
return;
}

QModelIndex dropIndex = indexAt(event->pos());
auto* widget = (LC_LayerTreeWidget*)parentWidget();
QModelIndex dropIndex = indexAt(event->position().toPoint());
auto* widget = dynamic_cast<LC_LayerTreeWidget*>(parentWidget());
if( !dropIndex.isValid() )
return;
widget->onDragEnterEvent(dropIndex);
Expand All @@ -74,10 +74,8 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) {
}
event->accept();

QModelIndex dropIndex = indexAt(event->pos());

auto* widget = (LC_LayerTreeWidget*)parentWidget();

QModelIndex dropIndex = indexAt(event->position().toPoint());
auto* widget = dynamic_cast<LC_LayerTreeWidget*>(parentWidget());
if (!widget){
return;
}
Expand Down Expand Up @@ -130,11 +128,11 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) {
QStringList LC_LayerTreeView::saveTreeExpansionState(){
QStringList treeExpansionState;
LC_LayerTreeModel *layerTreeModel = getTreeModel();
foreach (QModelIndex index, layerTreeModel->getPersistentIndexList()) {
if (this->isExpanded(index)){
treeExpansionState << index.data(Qt::UserRole).toString();
}
foreach (QModelIndex index, layerTreeModel->getPersistentIndexList()) {
if (this->isExpanded(index)){
treeExpansionState << index.data(Qt::UserRole).toString();
}
}

return treeExpansionState;
}
Expand Down
Loading

0 comments on commit 59270a7

Please sign in to comment.