Skip to content

Commit 8b39e5c

Browse files
committed
Fixes from CodeQL
1 parent f98a0d8 commit 8b39e5c

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

Common/src/geometry/meshreader/CCGNSMeshReaderFEM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ void CCGNSMeshReaderFEM::ReadCGNSSurfaceSection(const int val_section, const vec
318318

319319
case QUADRILATERAL:
320320
thisFace.nCornerPoints = 4;
321-
thisFace.cornerPoints[2] = nPolyGrid * nDOFEdgeGrid;
321+
thisFace.cornerPoints[2] = static_cast<unsigned long> (nPolyGrid)
322+
* nDOFEdgeGrid;
322323
thisFace.cornerPoints[3] = nDOFsGrid - 1;
323324
break;
324325

@@ -456,7 +457,7 @@ void CCGNSMeshReaderFEM::CommPointCoordinates(void) {
456457
/*--- Allocate the memory for a buffer to receive this message and also
457458
for the buffer to return to coordinates. ---*/
458459
vector<unsigned long> pointRecvBuf(sizeMess);
459-
coorReturnBuf[i].resize(dimension * sizeMess);
460+
coorReturnBuf[i].resize(static_cast<size_t>(dimension) * sizeMess);
460461

461462
/* Receive the message using a blocking receive. */
462463
SU2_MPI::Recv(pointRecvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, source, rank, SU2_MPI::GetComm(), &status);

Common/src/geometry/meshreader/CSU2ASCIIMeshReaderBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void CSU2ASCIIMeshReaderBase::ReadSurfaceElementConnectivity(const bool single_p
393393
if (text_line.find("NMARK=", 0) == string::npos) continue;
394394
}
395395

396-
for (unsigned short iMarker = 0; iMarker < numberOfMarkers; ++iMarker) {
396+
for (unsigned long iMarker = 0; iMarker < numberOfMarkers; ++iMarker) {
397397
getline(mesh_file, text_line);
398398
text_line.erase(0, 11);
399399
string::size_type position;

Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFEM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,9 @@ void CSU2ASCIIMeshReaderFEM::ReadSurfaceElementConnectivity() {
247247
/*--- Extract the marker name. Remove spaces returns and tabs
248248
and store the name in markerNames. ---*/
249249
text_line.erase(0, 11);
250-
string::size_type position;
251250

252251
for (unsigned short iChar = 0; iChar < 20; iChar++) {
253-
position = text_line.find(" ", 0);
252+
auto position = text_line.find(" ", 0);
254253
if (position != string::npos) text_line.erase(position, 1);
255254
position = text_line.find("\r", 0);
256255
if (position != string::npos) text_line.erase(position, 1);
@@ -262,7 +261,7 @@ void CSU2ASCIIMeshReaderFEM::ReadSurfaceElementConnectivity() {
262261
/*--- Find the section containing the number of surface elements
263262
for this marker and determine this number. ---*/
264263
while (getline(mesh_file, text_line)) {
265-
string::size_type position = text_line.find("MARKER_ELEMS=", 0);
264+
auto position = text_line.find("MARKER_ELEMS=", 0);
266265
if (position != string::npos) break;
267266
}
268267

@@ -307,7 +306,8 @@ void CSU2ASCIIMeshReaderFEM::ReadSurfaceElementConnectivity() {
307306
case QUADRILATERAL:
308307
nDOFsGrid = nDOFEdgeGrid * nDOFEdgeGrid;
309308
thisFace.nCornerPoints = 4;
310-
thisFace.cornerPoints[2] = nPolyGrid * nDOFEdgeGrid;
309+
thisFace.cornerPoints[2] = static_cast<unsigned long>(nPolyGrid)
310+
* nDOFEdgeGrid;
311311
thisFace.cornerPoints[3] = nDOFsGrid - 1;
312312
break;
313313

0 commit comments

Comments
 (0)