Skip to content

Commit be4c731

Browse files
committed
replace sizeof(unsigned long) by size_of(size_t)
1 parent a2da75e commit be4c731

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void CParaviewXMLFileWriter::Write_Data(){
7171
char str_buf[255];
7272

7373
OpenMPIFile();
74-
74+
7575
dataOffset = 0;
7676

7777
/*--- Communicate the number of total points that will be
@@ -295,7 +295,7 @@ void CParaviewXMLFileWriter::Write_Data(){
295295
}
296296
}
297297

298-
WriteDataArray(dataBufferFloat.data(), VTKDatatype::FLOAT32, myPoint*NCOORDS, GlobalPoint*NCOORDS,
298+
WriteDataArray(dataBufferFloat.data(), VTKDatatype::FLOAT32, myPoint*NCOORDS, GlobalPoint*NCOORDS,
299299
dataSorter->GetnPointCumulative(rank)*NCOORDS);
300300

301301
VarCounter++;
@@ -336,23 +336,21 @@ void CParaviewXMLFileWriter::WriteDataArray(void* data, VTKDatatype type, unsign
336336

337337
/*--- Compute the size of the data to write in bytes ---*/
338338

339-
int byteSize;
340-
byteSize = arraySize*typeSize;
339+
size_t byteSize = arraySize*typeSize;
341340

342341
/*--- The total data size ---*/
343-
unsigned long totalByteSize;
344-
totalByteSize = globalSize*typeSize;
342+
size_t totalByteSize = globalSize*typeSize;
345343

346344
/*--- Only the master node writes the total size in bytes as unsigned long in front of the array data ---*/
347-
348-
if (!WriteMPIBinaryData(&totalByteSize, sizeof(unsigned long), MASTER_NODE)){
345+
346+
if (!WriteMPIBinaryData(&totalByteSize, sizeof(size_t), MASTER_NODE)){
349347
SU2_MPI::Error("Writing array size failed", CURRENT_FUNCTION);
350348
}
351-
349+
352350
/*--- Collectively write all the data ---*/
353-
351+
354352
if (!WriteMPIBinaryDataAll(data, byteSize, totalByteSize, offset*typeSize)){
355-
SU2_MPI::Error("Writing data array failed", CURRENT_FUNCTION);
353+
SU2_MPI::Error("Writing data array failed", CURRENT_FUNCTION);
356354
}
357355
}
358356

@@ -373,13 +371,13 @@ void CParaviewXMLFileWriter::AddDataArray(VTKDatatype type, string name,
373371
string offsetStr = ss.str();
374372

375373
std::string typeStr;
376-
unsigned long typeSize = 0, totalByteSize;
374+
unsigned long typeSize = 0;
377375

378376
GetTypeInfo(type, typeStr, typeSize);
379377

380378
/*--- Total data size ---*/
381379

382-
totalByteSize = globalSize*typeSize;
380+
size_t totalByteSize = globalSize*typeSize;
383381

384382
/*--- Write the ASCII XML header information for this array ---*/
385383

@@ -389,6 +387,6 @@ void CParaviewXMLFileWriter::AddDataArray(VTKDatatype type, string name,
389387
string(" offset=") + offsetStr +
390388
string(" format=\"appended\"/>\n"), MASTER_NODE);
391389

392-
dataOffset += totalByteSize + sizeof(unsigned long);
390+
dataOffset += totalByteSize + sizeof(size_t);
393391

394392
}

0 commit comments

Comments
 (0)