Skip to content

Commit

Permalink
Merge pull request #402 from schnepe2/fix_deprecated_strstream
Browse files Browse the repository at this point in the history
Fix deprecated <strstream> (depricated since C++98)
  • Loading branch information
jarmonik authored Jan 7, 2024
2 parents 9d750f4 + e9fd305 commit 0e5b7f8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Src/Orbiter/MfdUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Psys.h"
#include "Nav.h"
#include <stdio.h>
#include <strstream>
#include <sstream>
#include <iomanip>
#include "Log.h"
#include "Util.h"
Expand Down Expand Up @@ -397,11 +397,11 @@ void GraphMFD::Plot (HDC hDC, int g, int h0, int h1, const char *title)
}
}
if (gf.absc_title[0]) {
ostrstream oss(cbuf, 64);
ostringstream oss(cbuf, 64);
oss << gf.absc_title;
if (gf.absc_tickscale != 1.0f) oss << " x " << 1.0/gf.absc_tickscale;
oss << '\0';
TextOut (hDC, (x0+x1)/2, y0+(3*ch)/4, oss.str(), strlen(oss.str()));
TextOut (hDC, (x0+x1)/2, y0+(3*ch)/4, oss.str().c_str(), strlen(oss.str().c_str()));
}

// ordinate ticks/labels
Expand Down Expand Up @@ -430,11 +430,11 @@ void GraphMFD::Plot (HDC hDC, int g, int h0, int h1, const char *title)
SetTextAlign (hDC, TA_CENTER);
if (gf.data_title[0]) {
SelectDefaultFont (hDC, 2);
ostrstream oss(cbuf, 64);
ostringstream oss(cbuf, 64);
oss << gf.data_title;
if (gf.data_tickscale != 1.0f) oss << " x " << 1.0/gf.data_tickscale;
oss << '\0';
TextOut (hDC, 0, (y0+y1)/2, oss.str(), strlen(oss.str()));
TextOut (hDC, 0, (y0+y1)/2, oss.str().c_str(), strlen(oss.str().c_str()));
}

// plot frame
Expand Down
1 change: 0 additions & 1 deletion Src/Orbiter/Orbiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <strstream>
#include <iomanip>
#include <io.h>
#include "cmdline.h"
Expand Down
10 changes: 5 additions & 5 deletions Src/Orbiter/Vessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5554,10 +5554,10 @@ bool Vessel::VCRedrawEvent (int id, int event, SURFHANDLE surf) const

bool Vessel::VCMouseEvent (int id, int event, Vector &p) const
{
if (modIntf.v && modIntf.v->Version() >= 1) {
VECTOR3 v = _V(p.x,p.y,p.z);
return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, v);
}
if (modIntf.v && modIntf.v->Version() >= 1) {
VECTOR3 v = _V(p.x,p.y,p.z);
return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, v);
}
else
return false;
}
Expand Down Expand Up @@ -8851,4 +8851,4 @@ bool VESSEL4::UnregisterMFDMode (int mode)
int VESSEL4::clbkNavProcess (int mode)
{
return mode;
}
}
6 changes: 3 additions & 3 deletions Src/Plugin/Common/Dialog/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Graph.h"
#include <stdio.h>
#include <math.h>
#include <strstream>
#include <sstream>
#include "orbitersdk.h"

static COLORREF plotcol[MAXPLOT] = { 0x0000ff, 0xff0000, 0x00ff00 };
Expand Down Expand Up @@ -232,12 +232,12 @@ void Graph::Refresh (HDC hDC, int w, int h)
}

SelectObject (hDC, gdi.font[1]);
std::ostrstream oss(cbuf,64);
std::ostringstream oss(cbuf,64);
if (m_ylabel.size()) {
oss << m_ylabel;
if (m_tickscale && m_tickscale != 1.0f) oss << " x " << 1.0/m_tickscale;
oss << '\0';
TextOut (hDC, 0, (y0+y1)/2, oss.str(), strlen(oss.str()));
TextOut (hDC, 0, (y0+y1)/2, oss.str().c_str(), strlen(oss.str().c_str()));
}

SelectObject (hDC, pfont);
Expand Down

0 comments on commit 0e5b7f8

Please sign in to comment.