Skip to content

Commit

Permalink
replace old-style cast with static_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and nyalldawson committed Apr 10, 2023
1 parent f5843f0 commit d9a5783
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/plugins/grass/qtermwidget/ColorScheme.cpp
Expand Up @@ -417,9 +417,9 @@ void ColorScheme::writeColorEntry(KConfig& config , const QString& colorName, co
// if one of the keys already exists
if ( !random.isNull() || configGroup.hasKey("MaxRandomHue") )
{
configGroup.writeEntry("MaxRandomHue",(int)random.hue);
configGroup.writeEntry("MaxRandomValue",(int)random.value);
configGroup.writeEntry("MaxRandomSaturation",(int)random.saturation);
configGroup.writeEntry("MaxRandomHue",static_cast<int>(random.hue));
configGroup.writeEntry("MaxRandomValue",static_cast<int>(random.value));
configGroup.writeEntry("MaxRandomSaturation",static_cast<int>(random.saturation));
}
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/grass/qtermwidget/History.cpp
Expand Up @@ -385,12 +385,12 @@ void HistoryScrollBuffer::setMaxNbLines(unsigned int lineCount)
HistoryLine* oldBuffer = _historyBuffer;
HistoryLine* newBuffer = new HistoryLine[lineCount];

for ( int i = 0 ; i < qMin(_usedLines,(int)lineCount) ; i++ )
for ( int i = 0 ; i < qMin(_usedLines,static_cast<int>(lineCount)) ; i++ )
{
newBuffer[i] = oldBuffer[bufferIndex(i)];
}

_usedLines = qMin(_usedLines,(int)lineCount);
_usedLines = qMin(_usedLines,static_cast<int>(lineCount));
_maxLineCount = lineCount;
_head = ( _usedLines == _maxLineCount ) ? 0 : _usedLines-1;

Expand Down Expand Up @@ -770,7 +770,7 @@ void CompactHistoryScroll::setMaxNbLines ( unsigned int lineCount )
{
_maxLineCount = lineCount;

while (lines.size() > (int) lineCount) {
while (lines.size() > static_cast<int>(lineCount)) {
delete lines.takeAt(0);
}
//kDebug() << "set max lines to: " << _maxLineCount;
Expand Down Expand Up @@ -872,7 +872,7 @@ HistoryScroll* HistoryTypeBuffer::scroll(HistoryScroll *old) const
HistoryScroll *newScroll = new HistoryScrollBuffer(m_nbLines);
int lines = old->getLines();
int startLine = 0;
if (lines > (int) m_nbLines)
if (lines > static_cast<int>(m_nbLines))
startLine = lines - m_nbLines;

Character line[LINE_SIZE];
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/TerminalDisplay.cpp
Expand Up @@ -226,7 +226,7 @@ void TerminalDisplay::fontChange(const QFont&)
// "Base character width on widest ASCII character. This prevents too wide
// characters in the presence of double wide (e.g. Japanese) characters."
// Get the width from representative normal width characters
_fontWidth = qRound((double)fm.horizontalAdvance(QLatin1String(REPCHAR))/(double)qstrlen(REPCHAR));
_fontWidth = qRound(static_cast<double>(fm.horizontalAdvance(QLatin1String(REPCHAR)))/static_cast<double>(qstrlen(REPCHAR)));

_fixedFont = true;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/Vt102Emulation.cpp
Expand Up @@ -154,7 +154,7 @@ void Vt102Emulation::reset()
*/

#define TY_CONSTRUCT(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) )
#define TY_CONSTRUCT(T,A,N) ( (((static_cast<int>(N)) & 0xffff) << 16) | (((static_cast<int>(A)) & 0xff) << 8) | ((static_cast<int>(T)) & 0xff) )

#define TY_CHR( ) TY_CONSTRUCT(0,0,0)
#define TY_CTL(A ) TY_CONSTRUCT(1,A,0)
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qtermwidget/kprocess.cpp
Expand Up @@ -88,7 +88,7 @@ void KProcessPrivate::_k_forwardStdout()
#ifndef _WIN32_WCE
forwardStd(KProcess::StandardOutput, STD_OUTPUT_HANDLE);
#else
forwardStd(KProcess::StandardOutput, (int)stdout);
forwardStd(KProcess::StandardOutput, static_cast<int>(stdout));
#endif
}

Expand All @@ -97,7 +97,7 @@ void KProcessPrivate::_k_forwardStderr()
#ifndef _WIN32_WCE
forwardStd(KProcess::StandardError, STD_ERROR_HANDLE);
#else
forwardStd(KProcess::StandardError, (int)stderr);
forwardStd(KProcess::StandardError, static_cast<int>(stderr));
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qtermwidget/kptydevice.cpp
Expand Up @@ -400,14 +400,14 @@ bool KPtyDevice::isSuspended() const
qint64 KPtyDevice::readData(char *data, qint64 maxlen)
{
Q_D(KPtyDevice);
return d->readBuffer.read(data, (int)qMin<qint64>(maxlen, KMAXINT));
return d->readBuffer.read(data, static_cast<int>(qMin<qint64>(maxlen, KMAXINT)));
}

// protected
qint64 KPtyDevice::readLineData(char *data, qint64 maxlen)
{
Q_D(KPtyDevice);
return d->readBuffer.readLine(data, (int)qMin<qint64>(maxlen, KMAXINT));
return d->readBuffer.readLine(data, static_cast<int>(qMin<qint64>(maxlen, KMAXINT)));
}

// protected
Expand Down

0 comments on commit d9a5783

Please sign in to comment.