diff --git a/blifexplorer/src/container.cpp b/blifexplorer/src/container.cpp index f245254a441..fdd0f78f078 100644 --- a/blifexplorer/src/container.cpp +++ b/blifexplorer/src/container.cpp @@ -929,25 +929,23 @@ void Container::showActivity() void Container::getActivityInformation() { - //right now it is a dummy function. the activity values are - //generated randomly + // Right now, it is a dummy function. The activity values are + // generated randomly. QHash::const_iterator blockIterator = odinTable.constBegin(); while(blockIterator != odinTable.constEnd()){ - QString name = blockIterator.key(); - LogicUnit* visNode = unithashtable[name]; - //get all connections outgoing and advise them to - //represent the activity by color - QList outgoingWires = visNode->getOutCons(); - foreach(Wire* wire, outgoingWires){ - int act = qrand() % 255; - wire->setActivity(act); - - } + QString name = blockIterator.key(); + LogicUnit* visNode = unithashtable[name]; + // Get all connections outgoing and advise them to + // represent the activity by color. + QList outgoingWires = visNode->getOutCons(); + foreach(Wire* wire, outgoingWires){ + int act = QRandomGenerator::global()->bounded(255); // Use QRandomGenerator + wire->setActivity(act); + } ++blockIterator; } } - /*--------------------------------------------------------------------------------------------- * (function: showSimulationStep) *-------------------------------------------------------------------------------------------*/ diff --git a/blifexplorer/src/mainwindow.cpp b/blifexplorer/src/mainwindow.cpp index 49f8c51972b..2b0e5c2e38b 100644 --- a/blifexplorer/src/mainwindow.cpp +++ b/blifexplorer/src/mainwindow.cpp @@ -271,10 +271,10 @@ void MainWindow::fontSizeChanged(const QString &) *-------------------------------------------------------------------------------------------*/ void MainWindow::sceneScaleChanged(int scale) { - double newScale = scale/100.0; - QMatrix oldMatrix = view->matrix(); - view->resetMatrix(); - view->translate(oldMatrix.dx(), oldMatrix.dy()); + double newScale = scale / 100.0; + QTransform oldTransform = view->transform(); // Use transform() instead of matrix() + view->resetTransform(); // Changed from resetMatrix() to resetTransform() + view->translate(oldTransform.dx(), oldTransform.dy()); // Use dx() and dy() from QTransform view->scale(newScale, newScale); } @@ -915,7 +915,7 @@ void MainWindow::openFileWithOdin(){ tr("Open BLIF"), QDir::homePath(), tr("BLIF files (*.blif);;All files (*.*)"), - 0, + nullptr, // No parent, QFileDialog::DontUseNativeDialog); myContainer->setFilename(actBlifFilename); @@ -925,10 +925,10 @@ void MainWindow::openFileWithOdin(){ //An error occured QMessageBox msgBox(QMessageBox::Warning, tr("No Structure Found in File"), "The file you tried to explore does not contain any structures or could not be opened. Please select another file." - , 0, this); - msgBox.addButton(tr("Open &Again"), QMessageBox::AcceptRole); - msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole); - if (msgBox.exec() == QMessageBox::AcceptRole) + + , QMessageBox::Open | QMessageBox::Cancel, this); + msgBox.setDefaultButton(QMessageBox::Open); + if (msgBox.exec() == QMessageBox::Open) openFileWithOdin(); }else{ diff --git a/libs/libvqm/vqm_dll.cpp b/libs/libvqm/vqm_dll.cpp index b55a5c5658d..acf4dec34bd 100644 --- a/libs/libvqm/vqm_dll.cpp +++ b/libs/libvqm/vqm_dll.cpp @@ -112,13 +112,13 @@ VQM_DLL_API t_module *vqm_parse_file(char *filename) VQM_DLL_API int vqm_get_error_message(char *message_buffer, int length) { - int result = -1; - int temp = strlen(most_recent_error); + int result = -1; + int temp = strlen(most_recent_error); - if (temp <= length) - { - strcpy(message_buffer, message_buffer); - result = temp; - } - return result; + if (temp < length) // Note: Changed to '<' to avoid buffer overflow + { + strcpy(message_buffer, most_recent_error); // Copy 'most_recent_error' to 'message_buffer' + result = temp; + } + return result; } diff --git a/libs/libvqm/vqm_parser.y b/libs/libvqm/vqm_parser.y index 79695fc5657..743cbe63527 100644 --- a/libs/libvqm/vqm_parser.y +++ b/libs/libvqm/vqm_parser.y @@ -38,11 +38,11 @@ extern int yylex(void); %union { - uintptr_t value; - char *string; + uintptr_t value; + char *string; } %parse-param {t_parse_info* parse_info} -%error-verbose +%define parse.error verbose /********************************************************/ /**** DEFINE TOKENS *************************************/ /********************************************************/ diff --git a/odin_ii/src/ast/ast_loop_unroll.cpp b/odin_ii/src/ast/ast_loop_unroll.cpp index 27b70d84733..ff522f56e0c 100644 --- a/odin_ii/src/ast/ast_loop_unroll.cpp +++ b/odin_ii/src/ast/ast_loop_unroll.cpp @@ -312,19 +312,18 @@ bool is_unsupported_post(ast_node_t* node, ast_node_t* symbol) { post_condition_function resolve_binary_operation(ast_node_t* node) { if (node->type == NUMBERS) { - return [=](long value) { - /* - * this lambda triggers a warning for unused variable unless - * we use value to generate a 0 - */ - return node->types.vnumber->get_value() + (value - value); + return [=](long value) noexcept { + (void)value; // Indicate that value is unused + return node->types.vnumber->get_value(); }; } else if (node->type == IDENTIFIERS) { - return [=](long value) { + return [=](long value) noexcept { + (void)value; // Indicate that value is unused return value; }; } else { - return [=](long value) { + return [=](long value) noexcept { + (void)value; // Indicate that value is unused post_condition_function left_func = resolve_binary_operation(node->children[0]); post_condition_function right_func = resolve_binary_operation(node->children[1]); switch (node->types.operation.op) { @@ -343,6 +342,7 @@ post_condition_function resolve_binary_operation(ast_node_t* node) { } } + /* * (function: resolve_post_condition) * return a lambda which gives the next value