Skip to content

Commit 594e96b

Browse files
authored
Merge pull request #2549 from verilog-to-routing/fix_odin_warnings
Fixing ODIN II and blifexplorer Compiler Warnings.
2 parents 9cc02c3 + 668ea9a commit 594e96b

File tree

5 files changed

+39
-41
lines changed

5 files changed

+39
-41
lines changed

blifexplorer/src/container.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -929,25 +929,23 @@ void Container::showActivity()
929929

930930
void Container::getActivityInformation()
931931
{
932-
//right now it is a dummy function. the activity values are
933-
//generated randomly
932+
// Right now, it is a dummy function. The activity values are
933+
// generated randomly.
934934
QHash<QString, nnode_t *>::const_iterator blockIterator = odinTable.constBegin();
935935

936936
while(blockIterator != odinTable.constEnd()){
937-
QString name = blockIterator.key();
938-
LogicUnit* visNode = unithashtable[name];
939-
//get all connections outgoing and advise them to
940-
//represent the activity by color
941-
QList<Wire*> outgoingWires = visNode->getOutCons();
942-
foreach(Wire* wire, outgoingWires){
943-
int act = qrand() % 255;
944-
wire->setActivity(act);
945-
946-
}
937+
QString name = blockIterator.key();
938+
LogicUnit* visNode = unithashtable[name];
939+
// Get all connections outgoing and advise them to
940+
// represent the activity by color.
941+
QList<Wire*> outgoingWires = visNode->getOutCons();
942+
foreach(Wire* wire, outgoingWires){
943+
int act = QRandomGenerator::global()->bounded(255); // Use QRandomGenerator
944+
wire->setActivity(act);
945+
}
947946
++blockIterator;
948947
}
949948
}
950-
951949
/*---------------------------------------------------------------------------------------------
952950
* (function: showSimulationStep)
953951
*-------------------------------------------------------------------------------------------*/

blifexplorer/src/mainwindow.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ void MainWindow::fontSizeChanged(const QString &)
271271
*-------------------------------------------------------------------------------------------*/
272272
void MainWindow::sceneScaleChanged(int scale)
273273
{
274-
double newScale = scale/100.0;
275-
QMatrix oldMatrix = view->matrix();
276-
view->resetMatrix();
277-
view->translate(oldMatrix.dx(), oldMatrix.dy());
274+
double newScale = scale / 100.0;
275+
QTransform oldTransform = view->transform(); // Use transform() instead of matrix()
276+
view->resetTransform(); // Changed from resetMatrix() to resetTransform()
277+
view->translate(oldTransform.dx(), oldTransform.dy()); // Use dx() and dy() from QTransform
278278
view->scale(newScale, newScale);
279279
}
280280

@@ -915,7 +915,7 @@ void MainWindow::openFileWithOdin(){
915915
tr("Open BLIF"),
916916
QDir::homePath(),
917917
tr("BLIF files (*.blif);;All files (*.*)"),
918-
0,
918+
nullptr, // No parent,
919919
QFileDialog::DontUseNativeDialog);
920920

921921
myContainer->setFilename(actBlifFilename);
@@ -925,10 +925,10 @@ void MainWindow::openFileWithOdin(){
925925
//An error occured
926926
QMessageBox msgBox(QMessageBox::Warning, tr("No Structure Found in File"),
927927
"The file you tried to explore does not contain any structures or could not be opened. Please select another file."
928-
, 0, this);
929-
msgBox.addButton(tr("Open &Again"), QMessageBox::AcceptRole);
930-
msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
931-
if (msgBox.exec() == QMessageBox::AcceptRole)
928+
929+
, QMessageBox::Open | QMessageBox::Cancel, this);
930+
msgBox.setDefaultButton(QMessageBox::Open);
931+
if (msgBox.exec() == QMessageBox::Open)
932932
openFileWithOdin();
933933

934934
}else{

libs/libvqm/vqm_dll.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ VQM_DLL_API t_module *vqm_parse_file(char *filename)
112112

113113
VQM_DLL_API int vqm_get_error_message(char *message_buffer, int length)
114114
{
115-
int result = -1;
116-
int temp = strlen(most_recent_error);
115+
int result = -1;
116+
int temp = strlen(most_recent_error);
117117

118-
if (temp <= length)
119-
{
120-
strcpy(message_buffer, message_buffer);
121-
result = temp;
122-
}
123-
return result;
118+
if (temp < length) // Note: Changed to '<' to avoid buffer overflow
119+
{
120+
strcpy(message_buffer, most_recent_error); // Copy 'most_recent_error' to 'message_buffer'
121+
result = temp;
122+
}
123+
return result;
124124
}

libs/libvqm/vqm_parser.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ extern int yylex(void);
3838

3939
%union
4040
{
41-
uintptr_t value;
42-
char *string;
41+
uintptr_t value;
42+
char *string;
4343
}
4444
%parse-param {t_parse_info* parse_info}
45-
%error-verbose
45+
%define parse.error verbose
4646
/********************************************************/
4747
/**** DEFINE TOKENS *************************************/
4848
/********************************************************/

odin_ii/src/ast/ast_loop_unroll.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,18 @@ bool is_unsupported_post(ast_node_t* node, ast_node_t* symbol) {
312312

313313
post_condition_function resolve_binary_operation(ast_node_t* node) {
314314
if (node->type == NUMBERS) {
315-
return [=](long value) {
316-
/*
317-
* this lambda triggers a warning for unused variable unless
318-
* we use value to generate a 0
319-
*/
320-
return node->types.vnumber->get_value() + (value - value);
315+
return [=](long value) noexcept {
316+
(void)value; // Indicate that value is unused
317+
return node->types.vnumber->get_value();
321318
};
322319
} else if (node->type == IDENTIFIERS) {
323-
return [=](long value) {
320+
return [=](long value) noexcept {
321+
(void)value; // Indicate that value is unused
324322
return value;
325323
};
326324
} else {
327-
return [=](long value) {
325+
return [=](long value) noexcept {
326+
(void)value; // Indicate that value is unused
328327
post_condition_function left_func = resolve_binary_operation(node->children[0]);
329328
post_condition_function right_func = resolve_binary_operation(node->children[1]);
330329
switch (node->types.operation.op) {
@@ -343,6 +342,7 @@ post_condition_function resolve_binary_operation(ast_node_t* node) {
343342
}
344343
}
345344

345+
346346
/*
347347
* (function: resolve_post_condition)
348348
* return a lambda which gives the next value

0 commit comments

Comments
 (0)