Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
name: GCC DP 2D Profiling
runs-on: ubuntu-20.04
if: github.event.pull_request.draft == false
env:
# FIXME: -Wstringop-overflow
# https://github.com/AMReX-Codes/amrex/pull/2660
CXXFLAGS: "-Werror -Wno-error=stringop-overflow"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
Expand All @@ -26,4 +30,5 @@ jobs:
run: |
make -j 2 \
AMREX_HOME=./amrex \
USE_PROFPARSER=TRUE
USE_PROFPARSER=TRUE \
EXTRACXXFLAGS="${CXXFLAGS}"
13 changes: 8 additions & 5 deletions Dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const int MAXINDEXCHARS = 4;
#include <AMReX_DataServices.H>

#include <sstream>
#include <string>
#include <cfloat>
#include <cmath>
using std::ostringstream;
Expand Down Expand Up @@ -420,7 +421,7 @@ void Dataset::DatasetRender(const Box &alignedRegion, AmrPicture *apptr,
largestWidth = std::max(8, largestWidth); // for no data string
}

char levelInfo[Amrvis::LINELENGTH], maxInfo[Amrvis::LINELENGTH], minInfo[Amrvis::LINELENGTH];
char levelInfo[Amrvis::LINELENGTH];
char maxInfoV[Amrvis::LINELENGTH], minInfoV[Amrvis::LINELENGTH];
sprintf(levelInfo, "Level: %i", maxDrawnLevel);

Expand All @@ -431,14 +432,16 @@ void Dataset::DatasetRender(const Box &alignedRegion, AmrPicture *apptr,
XmStringFree(sNewLevel);

sprintf(minInfoV, fstring, rMin);
sprintf(minInfo, "Min:%s", minInfoV);
XmString sNewMin = XmStringCreateSimple(minInfo);
std::string minInfo("Min:");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not change this for compatibility, but we could add a space here:

Suggested change
std::string minInfo("Min:");
std::string minInfo("Min: ");

minInfo.append(minInfoV);
XmString sNewMin = XmStringCreateSimple(&minInfo[0]);
XtVaSetValues(wMinValue, XmNlabelString, sNewMin, NULL);
XmStringFree(sNewMin);

sprintf(maxInfoV, fstring, rMax);
sprintf(maxInfo, "Max:%s", maxInfoV);
XmString sNewMax = XmStringCreateSimple(maxInfo);
std::string maxInfo("Max:");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not change this for compatibility, but we could add a space here:

Suggested change
std::string maxInfo("Max:");
std::string maxInfo("Max: ");

maxInfo.append(maxInfoV);
XmString sNewMax = XmStringCreateSimple(&maxInfo[0]);
XtVaSetValues(wMaxValue, XmNlabelString, sNewMax, NULL);
XmStringFree(sNewMax);

Expand Down
40 changes: 23 additions & 17 deletions PltApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#include <cctype>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdlib>
using std::cout;
Expand Down Expand Up @@ -2815,7 +2816,6 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) {
return;
}

char range[Amrvis::LINELENGTH];
char saveRangeString[Amrvis::LINELENGTH];
char format[Amrvis::LINELENGTH];
char fMin[Amrvis::LINELENGTH];
Expand All @@ -2832,8 +2832,9 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) {
rtMin, rtMax);
sprintf(fMin, format, rtMin);
sprintf(fMax, format, rtMax);
sprintf(range, "Min: %s Max: %s", fMin, fMax);
strcpy(saveRangeString, range);
std::string range("Min: ");
range.append(fMin).append(" Max: ").append(fMax);
strcpy(saveRangeString, range.c_str());

XtVaGetValues(wAmrVisTopLevel,
XmNx, &xpos,
Expand Down Expand Up @@ -2964,21 +2965,25 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) {
pltAppState->CurrentDerivedNumber(), rtMin, rtMax);
sprintf(fMin, format, rtMin);
sprintf(fMax, format, rtMax);
sprintf(range, "Min: %s", fMin);
XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL);
range = "Min: ";
range.append(fMin);
XtVaCreateManagedWidget(range.c_str(), xmLabelGadgetClass, wRangeRC, NULL);
//XtVaSetValues(wid, XmNleftOffset, 20, NULL);
sprintf(range, "Max: %s", fMax);
XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL);
range = "Max: ";
range.append(fMax);
XtVaCreateManagedWidget(range.c_str(), xmLabelGadgetClass, wRangeRC, NULL);

pltAppState->GetMinMax(Amrvis::SUBREGIONMINMAX, currentFrame,
pltAppState->CurrentDerivedNumber(),
rtMin, rtMax);
sprintf(fMin, format, rtMin);
sprintf(fMax, format, rtMax);
sprintf(range, "Min: %s", fMin);
XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL);
sprintf(range, "Max: %s", fMax);
XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL);
range = "Min: ";
range.append(fMin);
XtVaCreateManagedWidget(range.c_str(), xmLabelGadgetClass, wRangeRC, NULL);
range = "Max: ";
range.append(fMax);
XtVaCreateManagedWidget(range.c_str(), xmLabelGadgetClass, wRangeRC, NULL);

pltAppState->GetMinMax(Amrvis::USERMINMAX, currentFrame,
pltAppState->CurrentDerivedNumber(),
Expand All @@ -2990,12 +2995,13 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) {
NULL);
XtVaCreateManagedWidget("Min:", xmLabelGadgetClass, wid, NULL);
//XtVaSetValues(wid, XmNmarginWidth, 0, NULL);
sprintf(range, format, rtMin);
char rangec[Amrvis::LINELENGTH];
sprintf(rangec, format, rtMin);
wUserMin = XtVaCreateManagedWidget("local range",
xmTextFieldWidgetClass, wid,
XmNvalue, range,
XmNvalue, rangec,
XmNeditable, true,
XmNcolumns, strlen(range)+2,
XmNcolumns, strlen(rangec)+2,
NULL);
AddStaticCallback(wUserMin, XmNactivateCallback, &PltApp::DoUserMin);

Expand All @@ -3005,12 +3011,12 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) {
//XmNborderWidth, 0,
NULL);
XtVaCreateManagedWidget("Max:", xmLabelGadgetClass, wid, NULL);
sprintf(range, format, rtMax);
sprintf(rangec, format, rtMax);
wUserMax = XtVaCreateManagedWidget("local range",
xmTextFieldWidgetClass, wid,
XmNvalue, range,
XmNvalue, rangec,
XmNeditable, true,
XmNcolumns, strlen(range)+2,
XmNcolumns, strlen(rangec)+2,
NULL);
AddStaticCallback(wUserMax, XmNactivateCallback, &PltApp::DoUserMax);

Expand Down
9 changes: 6 additions & 3 deletions PltAppOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <Output.H>
#include <XYPlotWin.H>

#include <string>

using std::cout;
using std::cerr;
using std::endl;
Expand Down Expand Up @@ -61,14 +63,15 @@ void PltApp::DoOutput(Widget w, XtPointer data, XtPointer) {
XtSetSensitive(XmSelectionBoxGetChild(wGetFileName,
XmDIALOG_HELP_BUTTON), false);

char tempstr[Amrvis::BUFSIZE], tempfilename[Amrvis::BUFSIZE];
char tempfilename[Amrvis::BUFSIZE];
if(animating2d) {
strcpy(tempfilename, AVGlobals::StripSlashes(fileNames[currentFrame]).c_str());
} else {
strcpy(tempfilename, AVGlobals::StripSlashes(fileNames[0]).c_str());
}
sprintf(tempstr, "%s_%s", pltAppState->CurrentDerived().c_str(), tempfilename);
XmTextSetString(XmSelectionBoxGetChild(wGetFileName, XmDIALOG_TEXT), tempstr);
std::string tempstr(pltAppState->CurrentDerived().c_str());
tempstr.append("_").append(tempfilename);
XmTextSetString(XmSelectionBoxGetChild(wGetFileName, XmDIALOG_TEXT), &tempstr[0]);
XtManageChild(wGetFileName);
XtPopup(XtParent(wGetFileName), XtGrabNone);
} // end DoOutput
Expand Down