mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
Minor code modernisations.
This commit is contained in:
parent
f3b46c9a2f
commit
b2e5ef2bd6
17 changed files with 104 additions and 96 deletions
|
|
@ -4446,7 +4446,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead)
|
|||
ProcessContext context;
|
||||
|
||||
if (numBytesToRead < 0)
|
||||
numBytesToRead = INT_MAX;
|
||||
numBytesToRead = std::numeric_limits<int64>::max();
|
||||
|
||||
while (numBytesToRead > 0)
|
||||
{
|
||||
|
|
@ -9943,7 +9943,7 @@ double juce_atof (const CharType* const original) throw()
|
|||
}
|
||||
else
|
||||
{
|
||||
const double maxAccumulatorValue = (double) ((UINT_MAX - 9) / 10);
|
||||
const double maxAccumulatorValue = (double) ((std::numeric_limits<unsigned int>::max() - 9) / 10);
|
||||
if (accumulator [decPointIndex] > maxAccumulatorValue)
|
||||
{
|
||||
result [decPointIndex] = juce_mulexp10 (result [decPointIndex], exponentAccumulator [decPointIndex])
|
||||
|
|
@ -12497,7 +12497,7 @@ const String String::fromUTF8 (const uint8* const buffer, int bufferSizeBytes) t
|
|||
return empty;
|
||||
|
||||
if (bufferSizeBytes < 0)
|
||||
bufferSizeBytes = INT_MAX;
|
||||
bufferSizeBytes = std::numeric_limits<int>::max();
|
||||
|
||||
size_t numBytes;
|
||||
for (numBytes = 0; numBytes < (size_t) bufferSizeBytes; ++numBytes)
|
||||
|
|
@ -14829,7 +14829,7 @@ void XmlElement::insertChildElement (XmlElement* const newNode,
|
|||
else
|
||||
{
|
||||
if (indexToInsertAt < 0)
|
||||
indexToInsertAt = INT_MAX;
|
||||
indexToInsertAt = std::numeric_limits<int>::max();
|
||||
|
||||
XmlElement* child = firstChildElement;
|
||||
|
||||
|
|
@ -20058,10 +20058,10 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
}
|
||||
else
|
||||
{
|
||||
int lmax = INT_MIN;
|
||||
int lmin = INT_MAX;
|
||||
int rmax = INT_MIN;
|
||||
int rmin = INT_MAX;
|
||||
int lmax = std::numeric_limits<int>::min();
|
||||
int lmin = std::numeric_limits<int>::max();
|
||||
int rmax = std::numeric_limits<int>::min();
|
||||
int rmin = std::numeric_limits<int>::max();
|
||||
|
||||
while (numSamples > 0)
|
||||
{
|
||||
|
|
@ -20073,8 +20073,8 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
|
||||
for (int j = numChannels; --j >= 0;)
|
||||
{
|
||||
int bufMax = INT_MIN;
|
||||
int bufMin = INT_MAX;
|
||||
int bufMax = std::numeric_limits<int>::min();
|
||||
int bufMin = std::numeric_limits<int>::max();
|
||||
|
||||
const int* const b = tempBuffer[j];
|
||||
|
||||
|
|
@ -20108,10 +20108,10 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
rmin = lmin;
|
||||
}
|
||||
|
||||
lowestLeft = lmin / (float)INT_MAX;
|
||||
highestLeft = lmax / (float)INT_MAX;
|
||||
lowestRight = rmin / (float)INT_MAX;
|
||||
highestRight = rmax / (float)INT_MAX;
|
||||
lowestLeft = lmin / (float) std::numeric_limits<int>::max();
|
||||
highestLeft = lmax / (float) std::numeric_limits<int>::max();
|
||||
lowestRight = rmin / (float) std::numeric_limits<int>::max();
|
||||
highestRight = rmax / (float) std::numeric_limits<int>::max();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20137,8 +20137,8 @@ int64 AudioFormatReader::searchForLevel (int64 startSample,
|
|||
|
||||
jassert (magnitudeRangeMaximum > magnitudeRangeMinimum);
|
||||
|
||||
const double doubleMin = jlimit (0.0, (double) INT_MAX, magnitudeRangeMinimum * INT_MAX);
|
||||
const double doubleMax = jlimit (doubleMin, (double) INT_MAX, magnitudeRangeMaximum * INT_MAX);
|
||||
const double doubleMin = jlimit (0.0, (double) std::numeric_limits<int>::max(), magnitudeRangeMinimum * std::numeric_limits<int>::max());
|
||||
const double doubleMax = jlimit (doubleMin, (double) std::numeric_limits<int>::max(), magnitudeRangeMaximum * std::numeric_limits<int>::max());
|
||||
const int intMagnitudeRangeMinimum = roundToInt (doubleMin);
|
||||
const int intMagnitudeRangeMaximum = roundToInt (doubleMax);
|
||||
|
||||
|
|
@ -20286,10 +20286,10 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
|
|||
if (isFloatingPoint())
|
||||
{
|
||||
// int -> float
|
||||
const double factor = 1.0 / INT_MAX;
|
||||
const double factor = 1.0 / std::numeric_limits<int>::max();
|
||||
|
||||
for (int i = 0; i < numToDo; ++i)
|
||||
((float*)b)[i] = (float) (factor * b[i]);
|
||||
((float*) b)[i] = (float) (factor * b[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -20299,11 +20299,11 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
|
|||
const double samp = *(const float*) b;
|
||||
|
||||
if (samp <= -1.0)
|
||||
*b++ = INT_MIN;
|
||||
*b++ = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
*b++ = INT_MAX;
|
||||
*b++ = std::numeric_limits<int>::max();
|
||||
else
|
||||
*b++ = roundToInt (INT_MAX * samp);
|
||||
*b++ = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20360,11 +20360,11 @@ bool AudioFormatWriter::writeFromAudioSource (AudioSource& source,
|
|||
const double samp = *(const float*) b;
|
||||
|
||||
if (samp <= -1.0)
|
||||
*b++ = INT_MIN;
|
||||
*b++ = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
*b++ = INT_MAX;
|
||||
*b++ = std::numeric_limits<int>::max();
|
||||
else
|
||||
*b++ = roundToInt (INT_MAX * samp);
|
||||
*b++ = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26251,11 +26251,11 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer,
|
|||
const double samp = src[i];
|
||||
|
||||
if (samp <= -1.0)
|
||||
dest[i] = INT_MIN;
|
||||
dest[i] = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
dest[i] = INT_MAX;
|
||||
dest[i] = std::numeric_limits<int>::max();
|
||||
else
|
||||
dest[i] = roundToInt (INT_MAX * samp);
|
||||
dest[i] = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44171,7 +44171,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) thr
|
|||
}
|
||||
|
||||
CodeDocument::CodeDocument()
|
||||
: undoManager (INT_MAX, 10000),
|
||||
: undoManager (std::numeric_limits<int>::max(), 10000),
|
||||
currentActionIndex (0),
|
||||
indexOfSavedState (-1),
|
||||
maximumLineLength (-1),
|
||||
|
|
@ -44755,7 +44755,7 @@ public:
|
|||
roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight);
|
||||
}
|
||||
|
||||
int lastType = INT_MIN;
|
||||
int lastType = std::numeric_limits<int>::min();
|
||||
|
||||
for (int i = 0; i < tokens.size(); ++i)
|
||||
{
|
||||
|
|
@ -45290,7 +45290,7 @@ void CodeEditorComponent::cursorDown (const bool selecting)
|
|||
newTransaction();
|
||||
|
||||
if (caretPos.getLineNumber() == document.getNumLines() - 1)
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), selecting);
|
||||
else
|
||||
moveCaretTo (caretPos.movedByLines (1), selecting);
|
||||
}
|
||||
|
|
@ -45371,13 +45371,13 @@ void CodeEditorComponent::goToStartOfLine (const bool selecting)
|
|||
void CodeEditorComponent::goToEndOfDocument (const bool selecting)
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), selecting);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::goToEndOfLine (const bool selecting)
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, caretPos.getLineNumber(), INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, caretPos.getLineNumber(), std::numeric_limits<int>::max()), selecting);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::backspace (const bool moveInWholeWordSteps)
|
||||
|
|
@ -45417,7 +45417,7 @@ void CodeEditorComponent::deleteForward (const bool moveInWholeWordSteps)
|
|||
void CodeEditorComponent::selectAll()
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), false);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), false);
|
||||
moveCaretTo (CodeDocument::Position (&document, 0, 0), true);
|
||||
}
|
||||
|
||||
|
|
@ -47760,7 +47760,7 @@ void ListBox::updateContent()
|
|||
|
||||
if (selected [selected.size() - 1] >= totalItems)
|
||||
{
|
||||
selected.removeRange (totalItems, INT_MAX - totalItems);
|
||||
selected.removeRange (totalItems, std::numeric_limits<int>::max() - totalItems);
|
||||
lastRowSelected = getSelectedRow (0);
|
||||
selectionChanged = true;
|
||||
}
|
||||
|
|
@ -47858,7 +47858,7 @@ void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
|
|||
const bool sendNotificationEventToModel)
|
||||
{
|
||||
selected = setOfRowsToBeSelected;
|
||||
selected.removeRange (totalItems, INT_MAX - totalItems);
|
||||
selected.removeRange (totalItems, std::numeric_limits<int>::max() - totalItems);
|
||||
|
||||
if (! isRowSelected (lastRowSelected))
|
||||
lastRowSelected = getSelectedRow (0);
|
||||
|
|
@ -48100,7 +48100,7 @@ bool ListBox::keyPressed (const KeyPress& key)
|
|||
}
|
||||
else if (multiple && key == KeyPress (T('a'), ModifierKeys::commandModifier, 0))
|
||||
{
|
||||
selectRangeOfRows (0, INT_MAX);
|
||||
selectRangeOfRows (0, std::numeric_limits<int>::max());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -49931,7 +49931,7 @@ void TableHeaderComponent::addColumn (const String& columnName,
|
|||
ci->minimumWidth = minimumWidth;
|
||||
ci->maximumWidth = maximumWidth;
|
||||
if (ci->maximumWidth < 0)
|
||||
ci->maximumWidth = INT_MAX;
|
||||
ci->maximumWidth = std::numeric_limits<int>::max();
|
||||
jassert (ci->maximumWidth >= ci->minimumWidth);
|
||||
ci->propertyFlags = propertyFlags;
|
||||
|
||||
|
|
@ -59082,11 +59082,11 @@ public:
|
|||
{
|
||||
int explicitOrder1 = first->getExplicitFocusOrder();
|
||||
if (explicitOrder1 <= 0)
|
||||
explicitOrder1 = INT_MAX / 2;
|
||||
explicitOrder1 = std::numeric_limits<int>::max() / 2;
|
||||
|
||||
int explicitOrder2 = second->getExplicitFocusOrder();
|
||||
if (explicitOrder2 <= 0)
|
||||
explicitOrder2 = INT_MAX / 2;
|
||||
explicitOrder2 = std::numeric_limits<int>::max() / 2;
|
||||
|
||||
if (explicitOrder1 != explicitOrder2)
|
||||
return explicitOrder1 - explicitOrder2;
|
||||
|
|
@ -62685,7 +62685,8 @@ void StretchableObjectResizer::addItem (const double size,
|
|||
const double minSize, const double maxSize,
|
||||
const int order)
|
||||
{
|
||||
jassert (order >= 0 && order < INT_MAX); // the order must be >= 0 and less than INT_MAX
|
||||
// the order must be >= 0 but less than the maximum integer value.
|
||||
jassert (order >= 0 && order < std::numeric_limits<int>::max());
|
||||
|
||||
Item* const item = new Item();
|
||||
item->size = size;
|
||||
|
|
@ -62711,7 +62712,7 @@ void StretchableObjectResizer::resizeToFit (const double targetSize)
|
|||
double minSize = 0;
|
||||
double maxSize = 0;
|
||||
|
||||
int nextHighestOrder = INT_MAX;
|
||||
int nextHighestOrder = std::numeric_limits<int>::max();
|
||||
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
{
|
||||
|
|
@ -62762,7 +62763,7 @@ void StretchableObjectResizer::resizeToFit (const double targetSize)
|
|||
}
|
||||
}
|
||||
|
||||
if (nextHighestOrder < INT_MAX)
|
||||
if (nextHighestOrder < std::numeric_limits<int>::max())
|
||||
order = nextHighestOrder;
|
||||
else
|
||||
break;
|
||||
|
|
@ -77870,7 +77871,7 @@ void SplashScreen::show (const String& title,
|
|||
|
||||
originalClickCounter = removeOnMouseClick
|
||||
? Desktop::getMouseButtonClickCounter()
|
||||
: INT_MAX;
|
||||
: std::numeric_limits<int>::max();
|
||||
|
||||
earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor);
|
||||
|
||||
|
|
@ -79866,7 +79867,7 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t
|
|||
|
||||
int destIndex = 0, destTotal = 0;
|
||||
int level1 = 0, level2 = 0;
|
||||
int lastX = INT_MIN, lastLevel = 0;
|
||||
int lastX = std::numeric_limits<int>::min(), lastLevel = 0;
|
||||
|
||||
while (srcNum1 > 0 && srcNum2 > 0)
|
||||
{
|
||||
|
|
@ -79941,7 +79942,7 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t
|
|||
dest[0] = destTotal;
|
||||
|
||||
#if JUCE_DEBUG
|
||||
int last = INT_MIN;
|
||||
int last = std::numeric_limits<int>::min();
|
||||
for (int i = 0; i < dest[0]; ++i)
|
||||
{
|
||||
jassert (dest[i * 2 + 1] > last);
|
||||
|
|
@ -80044,7 +80045,10 @@ void EdgeTable::excludeRectangle (const Rectangle& r) throw()
|
|||
|
||||
//XXX optimise here by shortening the table if it fills top or bottom
|
||||
|
||||
const int rectLine[] = { 4, INT_MIN, 255, clipped.getX() << 8, 0, clipped.getRight() << 8, 255, INT_MAX, 0 };
|
||||
const int rectLine[] = { 4, std::numeric_limits<int>::min(), 255,
|
||||
clipped.getX() << 8, 0,
|
||||
clipped.getRight() << 8, 255,
|
||||
std::numeric_limits<int>::max(), 0 };
|
||||
|
||||
for (int i = top; i < bottom; ++i)
|
||||
intersectWithEdgeTableLine (i, rectLine);
|
||||
|
|
@ -83001,7 +83005,7 @@ public:
|
|||
void drawGlyph (LLGCSavedState& state, Image& image, const Font& font, const int glyphNumber, float x, float y) throw()
|
||||
{
|
||||
++accessCounter;
|
||||
int oldestCounter = INT_MAX;
|
||||
int oldestCounter = std::numeric_limits<int>::max();
|
||||
CachedGlyph* oldest = 0;
|
||||
|
||||
for (int i = glyphs.size(); --i >= 0;)
|
||||
|
|
@ -85815,7 +85819,7 @@ public:
|
|||
}
|
||||
|
||||
int replaceIndex = 0;
|
||||
int bestLastUsageCount = INT_MAX;
|
||||
int bestLastUsageCount = std::numeric_limits<int>::max();
|
||||
|
||||
for (i = faces.size(); --i >= 0;)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,10 +192,10 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
}
|
||||
else
|
||||
{
|
||||
int lmax = INT_MIN;
|
||||
int lmin = INT_MAX;
|
||||
int rmax = INT_MIN;
|
||||
int rmin = INT_MAX;
|
||||
int lmax = std::numeric_limits<int>::min();
|
||||
int lmin = std::numeric_limits<int>::max();
|
||||
int rmax = std::numeric_limits<int>::min();
|
||||
int rmin = std::numeric_limits<int>::max();
|
||||
|
||||
while (numSamples > 0)
|
||||
{
|
||||
|
|
@ -207,8 +207,8 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
|
||||
for (int j = numChannels; --j >= 0;)
|
||||
{
|
||||
int bufMax = INT_MIN;
|
||||
int bufMin = INT_MAX;
|
||||
int bufMax = std::numeric_limits<int>::min();
|
||||
int bufMin = std::numeric_limits<int>::max();
|
||||
|
||||
const int* const b = tempBuffer[j];
|
||||
|
||||
|
|
@ -242,10 +242,10 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
|
|||
rmin = lmin;
|
||||
}
|
||||
|
||||
lowestLeft = lmin / (float)INT_MAX;
|
||||
highestLeft = lmax / (float)INT_MAX;
|
||||
lowestRight = rmin / (float)INT_MAX;
|
||||
highestRight = rmax / (float)INT_MAX;
|
||||
lowestLeft = lmin / (float) std::numeric_limits<int>::max();
|
||||
highestLeft = lmax / (float) std::numeric_limits<int>::max();
|
||||
lowestRight = rmin / (float) std::numeric_limits<int>::max();
|
||||
highestRight = rmax / (float) std::numeric_limits<int>::max();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,8 +271,8 @@ int64 AudioFormatReader::searchForLevel (int64 startSample,
|
|||
|
||||
jassert (magnitudeRangeMaximum > magnitudeRangeMinimum);
|
||||
|
||||
const double doubleMin = jlimit (0.0, (double) INT_MAX, magnitudeRangeMinimum * INT_MAX);
|
||||
const double doubleMax = jlimit (doubleMin, (double) INT_MAX, magnitudeRangeMaximum * INT_MAX);
|
||||
const double doubleMin = jlimit (0.0, (double) std::numeric_limits<int>::max(), magnitudeRangeMinimum * std::numeric_limits<int>::max());
|
||||
const double doubleMax = jlimit (doubleMin, (double) std::numeric_limits<int>::max(), magnitudeRangeMaximum * std::numeric_limits<int>::max());
|
||||
const int intMagnitudeRangeMinimum = roundToInt (doubleMin);
|
||||
const int intMagnitudeRangeMaximum = roundToInt (doubleMax);
|
||||
|
||||
|
|
@ -421,10 +421,10 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
|
|||
if (isFloatingPoint())
|
||||
{
|
||||
// int -> float
|
||||
const double factor = 1.0 / INT_MAX;
|
||||
const double factor = 1.0 / std::numeric_limits<int>::max();
|
||||
|
||||
for (int i = 0; i < numToDo; ++i)
|
||||
((float*)b)[i] = (float) (factor * b[i]);
|
||||
((float*) b)[i] = (float) (factor * b[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -434,11 +434,11 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
|
|||
const double samp = *(const float*) b;
|
||||
|
||||
if (samp <= -1.0)
|
||||
*b++ = INT_MIN;
|
||||
*b++ = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
*b++ = INT_MAX;
|
||||
*b++ = std::numeric_limits<int>::max();
|
||||
else
|
||||
*b++ = roundToInt (INT_MAX * samp);
|
||||
*b++ = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -495,11 +495,11 @@ bool AudioFormatWriter::writeFromAudioSource (AudioSource& source,
|
|||
const double samp = *(const float*) b;
|
||||
|
||||
if (samp <= -1.0)
|
||||
*b++ = INT_MIN;
|
||||
*b++ = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
*b++ = INT_MAX;
|
||||
*b++ = std::numeric_limits<int>::max();
|
||||
else
|
||||
*b++ = roundToInt (INT_MAX * samp);
|
||||
*b++ = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -676,11 +676,11 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer,
|
|||
const double samp = src[i];
|
||||
|
||||
if (samp <= -1.0)
|
||||
dest[i] = INT_MIN;
|
||||
dest[i] = std::numeric_limits<int>::min();
|
||||
else if (samp >= 1.0)
|
||||
dest[i] = INT_MAX;
|
||||
dest[i] = std::numeric_limits<int>::max();
|
||||
else
|
||||
dest[i] = roundToInt (INT_MAX * samp);
|
||||
dest[i] = roundToInt (std::numeric_limits<int>::max() * samp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead)
|
|||
ProcessContext context;
|
||||
|
||||
if (numBytesToRead < 0)
|
||||
numBytesToRead = INT_MAX;
|
||||
numBytesToRead = std::numeric_limits<int64>::max();
|
||||
|
||||
while (numBytesToRead > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) thr
|
|||
|
||||
//==============================================================================
|
||||
CodeDocument::CodeDocument()
|
||||
: undoManager (INT_MAX, 10000),
|
||||
: undoManager (std::numeric_limits<int>::max(), 10000),
|
||||
currentActionIndex (0),
|
||||
indexOfSavedState (-1),
|
||||
maximumLineLength (-1),
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public:
|
|||
roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight);
|
||||
}
|
||||
|
||||
int lastType = INT_MIN;
|
||||
int lastType = std::numeric_limits<int>::min();
|
||||
|
||||
for (int i = 0; i < tokens.size(); ++i)
|
||||
{
|
||||
|
|
@ -695,7 +695,7 @@ void CodeEditorComponent::cursorDown (const bool selecting)
|
|||
newTransaction();
|
||||
|
||||
if (caretPos.getLineNumber() == document.getNumLines() - 1)
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), selecting);
|
||||
else
|
||||
moveCaretTo (caretPos.movedByLines (1), selecting);
|
||||
}
|
||||
|
|
@ -776,13 +776,13 @@ void CodeEditorComponent::goToStartOfLine (const bool selecting)
|
|||
void CodeEditorComponent::goToEndOfDocument (const bool selecting)
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), selecting);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::goToEndOfLine (const bool selecting)
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, caretPos.getLineNumber(), INT_MAX), selecting);
|
||||
moveCaretTo (CodeDocument::Position (&document, caretPos.getLineNumber(), std::numeric_limits<int>::max()), selecting);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::backspace (const bool moveInWholeWordSteps)
|
||||
|
|
@ -822,7 +822,7 @@ void CodeEditorComponent::deleteForward (const bool moveInWholeWordSteps)
|
|||
void CodeEditorComponent::selectAll()
|
||||
{
|
||||
newTransaction();
|
||||
moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), false);
|
||||
moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), false);
|
||||
moveCaretTo (CodeDocument::Position (&document, 0, 0), true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ void ListBox::updateContent()
|
|||
|
||||
if (selected [selected.size() - 1] >= totalItems)
|
||||
{
|
||||
selected.removeRange (totalItems, INT_MAX - totalItems);
|
||||
selected.removeRange (totalItems, std::numeric_limits<int>::max() - totalItems);
|
||||
lastRowSelected = getSelectedRow (0);
|
||||
selectionChanged = true;
|
||||
}
|
||||
|
|
@ -525,7 +525,7 @@ void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
|
|||
const bool sendNotificationEventToModel)
|
||||
{
|
||||
selected = setOfRowsToBeSelected;
|
||||
selected.removeRange (totalItems, INT_MAX - totalItems);
|
||||
selected.removeRange (totalItems, std::numeric_limits<int>::max() - totalItems);
|
||||
|
||||
if (! isRowSelected (lastRowSelected))
|
||||
lastRowSelected = getSelectedRow (0);
|
||||
|
|
@ -769,7 +769,7 @@ bool ListBox::keyPressed (const KeyPress& key)
|
|||
}
|
||||
else if (multiple && key == KeyPress (T('a'), ModifierKeys::commandModifier, 0))
|
||||
{
|
||||
selectRangeOfRows (0, INT_MAX);
|
||||
selectRangeOfRows (0, std::numeric_limits<int>::max());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void TableHeaderComponent::addColumn (const String& columnName,
|
|||
ci->minimumWidth = minimumWidth;
|
||||
ci->maximumWidth = maximumWidth;
|
||||
if (ci->maximumWidth < 0)
|
||||
ci->maximumWidth = INT_MAX;
|
||||
ci->maximumWidth = std::numeric_limits<int>::max();
|
||||
jassert (ci->maximumWidth >= ci->minimumWidth);
|
||||
ci->propertyFlags = propertyFlags;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ public:
|
|||
{
|
||||
int explicitOrder1 = first->getExplicitFocusOrder();
|
||||
if (explicitOrder1 <= 0)
|
||||
explicitOrder1 = INT_MAX / 2;
|
||||
explicitOrder1 = std::numeric_limits<int>::max() / 2;
|
||||
|
||||
int explicitOrder2 = second->getExplicitFocusOrder();
|
||||
if (explicitOrder2 <= 0)
|
||||
explicitOrder2 = INT_MAX / 2;
|
||||
explicitOrder2 = std::numeric_limits<int>::max() / 2;
|
||||
|
||||
if (explicitOrder1 != explicitOrder2)
|
||||
return explicitOrder1 - explicitOrder2;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ void StretchableObjectResizer::addItem (const double size,
|
|||
const double minSize, const double maxSize,
|
||||
const int order)
|
||||
{
|
||||
jassert (order >= 0 && order < INT_MAX); // the order must be >= 0 and less than INT_MAX
|
||||
// the order must be >= 0 but less than the maximum integer value.
|
||||
jassert (order >= 0 && order < std::numeric_limits<int>::max());
|
||||
|
||||
Item* const item = new Item();
|
||||
item->size = size;
|
||||
|
|
@ -69,7 +70,7 @@ void StretchableObjectResizer::resizeToFit (const double targetSize)
|
|||
double minSize = 0;
|
||||
double maxSize = 0;
|
||||
|
||||
int nextHighestOrder = INT_MAX;
|
||||
int nextHighestOrder = std::numeric_limits<int>::max();
|
||||
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
{
|
||||
|
|
@ -120,7 +121,7 @@ void StretchableObjectResizer::resizeToFit (const double targetSize)
|
|||
}
|
||||
}
|
||||
|
||||
if (nextHighestOrder < INT_MAX)
|
||||
if (nextHighestOrder < std::numeric_limits<int>::max())
|
||||
order = nextHighestOrder;
|
||||
else
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void SplashScreen::show (const String& title,
|
|||
|
||||
originalClickCounter = removeOnMouseClick
|
||||
? Desktop::getMouseButtonClickCounter()
|
||||
: INT_MAX;
|
||||
: std::numeric_limits<int>::max();
|
||||
|
||||
earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor);
|
||||
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t
|
|||
|
||||
int destIndex = 0, destTotal = 0;
|
||||
int level1 = 0, level2 = 0;
|
||||
int lastX = INT_MIN, lastLevel = 0;
|
||||
int lastX = std::numeric_limits<int>::min(), lastLevel = 0;
|
||||
|
||||
while (srcNum1 > 0 && srcNum2 > 0)
|
||||
{
|
||||
|
|
@ -535,7 +535,7 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t
|
|||
dest[0] = destTotal;
|
||||
|
||||
#if JUCE_DEBUG
|
||||
int last = INT_MIN;
|
||||
int last = std::numeric_limits<int>::min();
|
||||
for (int i = 0; i < dest[0]; ++i)
|
||||
{
|
||||
jassert (dest[i * 2 + 1] > last);
|
||||
|
|
@ -640,7 +640,10 @@ void EdgeTable::excludeRectangle (const Rectangle& r) throw()
|
|||
|
||||
//XXX optimise here by shortening the table if it fills top or bottom
|
||||
|
||||
const int rectLine[] = { 4, INT_MIN, 255, clipped.getX() << 8, 0, clipped.getRight() << 8, 255, INT_MAX, 0 };
|
||||
const int rectLine[] = { 4, std::numeric_limits<int>::min(), 255,
|
||||
clipped.getX() << 8, 0,
|
||||
clipped.getRight() << 8, 255,
|
||||
std::numeric_limits<int>::max(), 0 };
|
||||
|
||||
for (int i = top; i < bottom; ++i)
|
||||
intersectWithEdgeTableLine (i, rectLine);
|
||||
|
|
|
|||
|
|
@ -1521,7 +1521,7 @@ public:
|
|||
void drawGlyph (LLGCSavedState& state, Image& image, const Font& font, const int glyphNumber, float x, float y) throw()
|
||||
{
|
||||
++accessCounter;
|
||||
int oldestCounter = INT_MAX;
|
||||
int oldestCounter = std::numeric_limits<int>::max();
|
||||
CachedGlyph* oldest = 0;
|
||||
|
||||
for (int i = glyphs.size(); --i >= 0;)
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ public:
|
|||
}
|
||||
|
||||
int replaceIndex = 0;
|
||||
int bestLastUsageCount = INT_MAX;
|
||||
int bestLastUsageCount = std::numeric_limits<int>::max();
|
||||
|
||||
for (i = faces.size(); --i >= 0;)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ double juce_atof (const CharType* const original) throw()
|
|||
}
|
||||
else
|
||||
{
|
||||
const double maxAccumulatorValue = (double) ((UINT_MAX - 9) / 10);
|
||||
const double maxAccumulatorValue = (double) ((std::numeric_limits<unsigned int>::max() - 9) / 10);
|
||||
if (accumulator [decPointIndex] > maxAccumulatorValue)
|
||||
{
|
||||
result [decPointIndex] = juce_mulexp10 (result [decPointIndex], exponentAccumulator [decPointIndex])
|
||||
|
|
|
|||
|
|
@ -2222,7 +2222,7 @@ const String String::fromUTF8 (const uint8* const buffer, int bufferSizeBytes) t
|
|||
return empty;
|
||||
|
||||
if (bufferSizeBytes < 0)
|
||||
bufferSizeBytes = INT_MAX;
|
||||
bufferSizeBytes = std::numeric_limits<int>::max();
|
||||
|
||||
size_t numBytes;
|
||||
for (numBytes = 0; numBytes < (size_t) bufferSizeBytes; ++numBytes)
|
||||
|
|
|
|||
|
|
@ -806,7 +806,7 @@ void XmlElement::insertChildElement (XmlElement* const newNode,
|
|||
else
|
||||
{
|
||||
if (indexToInsertAt < 0)
|
||||
indexToInsertAt = INT_MAX;
|
||||
indexToInsertAt = std::numeric_limits<int>::max();
|
||||
|
||||
XmlElement* child = firstChildElement;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue