diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index db6f8defaf..57e8305d80 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -4446,7 +4446,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead) ProcessContext context; if (numBytesToRead < 0) - numBytesToRead = INT_MAX; + numBytesToRead = std::numeric_limits::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::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::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::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::min(); + int lmin = std::numeric_limits::max(); + int rmax = std::numeric_limits::min(); + int rmin = std::numeric_limits::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::min(); + int bufMin = std::numeric_limits::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::max(); + highestLeft = lmax / (float) std::numeric_limits::max(); + lowestRight = rmin / (float) std::numeric_limits::max(); + highestRight = rmax / (float) std::numeric_limits::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::max(), magnitudeRangeMinimum * std::numeric_limits::max()); + const double doubleMax = jlimit (doubleMin, (double) std::numeric_limits::max(), magnitudeRangeMaximum * std::numeric_limits::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::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::min(); else if (samp >= 1.0) - *b++ = INT_MAX; + *b++ = std::numeric_limits::max(); else - *b++ = roundToInt (INT_MAX * samp); + *b++ = roundToInt (std::numeric_limits::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::min(); else if (samp >= 1.0) - *b++ = INT_MAX; + *b++ = std::numeric_limits::max(); else - *b++ = roundToInt (INT_MAX * samp); + *b++ = roundToInt (std::numeric_limits::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::min(); else if (samp >= 1.0) - dest[i] = INT_MAX; + dest[i] = std::numeric_limits::max(); else - dest[i] = roundToInt (INT_MAX * samp); + dest[i] = roundToInt (std::numeric_limits::max() * samp); } } } @@ -44171,7 +44171,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) thr } CodeDocument::CodeDocument() - : undoManager (INT_MAX, 10000), + : undoManager (std::numeric_limits::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::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::max(), std::numeric_limits::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::max(), std::numeric_limits::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::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::max(), std::numeric_limits::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::max() - totalItems); lastRowSelected = getSelectedRow (0); selectionChanged = true; } @@ -47858,7 +47858,7 @@ void ListBox::setSelectedRows (const SparseSet& setOfRowsToBeSelected, const bool sendNotificationEventToModel) { selected = setOfRowsToBeSelected; - selected.removeRange (totalItems, INT_MAX - totalItems); + selected.removeRange (totalItems, std::numeric_limits::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::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::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::max() / 2; int explicitOrder2 = second->getExplicitFocusOrder(); if (explicitOrder2 <= 0) - explicitOrder2 = INT_MAX / 2; + explicitOrder2 = std::numeric_limits::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::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::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::max()) order = nextHighestOrder; else break; @@ -77870,7 +77871,7 @@ void SplashScreen::show (const String& title, originalClickCounter = removeOnMouseClick ? Desktop::getMouseButtonClickCounter() - : INT_MAX; + : std::numeric_limits::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::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::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::min(), 255, + clipped.getX() << 8, 0, + clipped.getRight() << 8, 255, + std::numeric_limits::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::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::max(); for (i = faces.size(); --i >= 0;) { diff --git a/src/audio/audio_file_formats/juce_AudioFormat.cpp b/src/audio/audio_file_formats/juce_AudioFormat.cpp index 1f94793661..dfd713bc54 100644 --- a/src/audio/audio_file_formats/juce_AudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_AudioFormat.cpp @@ -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::min(); + int lmin = std::numeric_limits::max(); + int rmax = std::numeric_limits::min(); + int rmin = std::numeric_limits::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::min(); + int bufMin = std::numeric_limits::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::max(); + highestLeft = lmax / (float) std::numeric_limits::max(); + lowestRight = rmin / (float) std::numeric_limits::max(); + highestRight = rmax / (float) std::numeric_limits::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::max(), magnitudeRangeMinimum * std::numeric_limits::max()); + const double doubleMax = jlimit (doubleMin, (double) std::numeric_limits::max(), magnitudeRangeMaximum * std::numeric_limits::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::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::min(); else if (samp >= 1.0) - *b++ = INT_MAX; + *b++ = std::numeric_limits::max(); else - *b++ = roundToInt (INT_MAX * samp); + *b++ = roundToInt (std::numeric_limits::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::min(); else if (samp >= 1.0) - *b++ = INT_MAX; + *b++ = std::numeric_limits::max(); else - *b++ = roundToInt (INT_MAX * samp); + *b++ = roundToInt (std::numeric_limits::max() * samp); } } } diff --git a/src/audio/dsp/juce_AudioSampleBuffer.cpp b/src/audio/dsp/juce_AudioSampleBuffer.cpp index dfaed15377..3941249fb4 100644 --- a/src/audio/dsp/juce_AudioSampleBuffer.cpp +++ b/src/audio/dsp/juce_AudioSampleBuffer.cpp @@ -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::min(); else if (samp >= 1.0) - dest[i] = INT_MAX; + dest[i] = std::numeric_limits::max(); else - dest[i] = roundToInt (INT_MAX * samp); + dest[i] = roundToInt (std::numeric_limits::max() * samp); } } } diff --git a/src/cryptography/juce_MD5.cpp b/src/cryptography/juce_MD5.cpp index e7995f0bc9..f80a3dcb45 100644 --- a/src/cryptography/juce_MD5.cpp +++ b/src/cryptography/juce_MD5.cpp @@ -91,7 +91,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead) ProcessContext context; if (numBytesToRead < 0) - numBytesToRead = INT_MAX; + numBytesToRead = std::numeric_limits::max(); while (numBytesToRead > 0) { diff --git a/src/gui/components/code_editor/juce_CodeDocument.cpp b/src/gui/components/code_editor/juce_CodeDocument.cpp index 3d3d892952..0d6a50b310 100644 --- a/src/gui/components/code_editor/juce_CodeDocument.cpp +++ b/src/gui/components/code_editor/juce_CodeDocument.cpp @@ -436,7 +436,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) thr //============================================================================== CodeDocument::CodeDocument() - : undoManager (INT_MAX, 10000), + : undoManager (std::numeric_limits::max(), 10000), currentActionIndex (0), indexOfSavedState (-1), maximumLineLength (-1), diff --git a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp index 6033a28bcb..24086f54dc 100644 --- a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp +++ b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp @@ -156,7 +156,7 @@ public: roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight); } - int lastType = INT_MIN; + int lastType = std::numeric_limits::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::max(), std::numeric_limits::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::max(), std::numeric_limits::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::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::max(), std::numeric_limits::max()), false); moveCaretTo (CodeDocument::Position (&document, 0, 0), true); } diff --git a/src/gui/components/controls/juce_ListBox.cpp b/src/gui/components/controls/juce_ListBox.cpp index ffb9dde90f..c60c533cc9 100644 --- a/src/gui/components/controls/juce_ListBox.cpp +++ b/src/gui/components/controls/juce_ListBox.cpp @@ -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::max() - totalItems); lastRowSelected = getSelectedRow (0); selectionChanged = true; } @@ -525,7 +525,7 @@ void ListBox::setSelectedRows (const SparseSet& setOfRowsToBeSelected, const bool sendNotificationEventToModel) { selected = setOfRowsToBeSelected; - selected.removeRange (totalItems, INT_MAX - totalItems); + selected.removeRange (totalItems, std::numeric_limits::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::max()); } else { diff --git a/src/gui/components/controls/juce_TableHeaderComponent.cpp b/src/gui/components/controls/juce_TableHeaderComponent.cpp index 4271d05b03..b46d412423 100644 --- a/src/gui/components/controls/juce_TableHeaderComponent.cpp +++ b/src/gui/components/controls/juce_TableHeaderComponent.cpp @@ -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::max(); jassert (ci->maximumWidth >= ci->minimumWidth); ci->propertyFlags = propertyFlags; diff --git a/src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp b/src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp index 49ccfab316..ca7873b726 100644 --- a/src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp +++ b/src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp @@ -52,11 +52,11 @@ public: { int explicitOrder1 = first->getExplicitFocusOrder(); if (explicitOrder1 <= 0) - explicitOrder1 = INT_MAX / 2; + explicitOrder1 = std::numeric_limits::max() / 2; int explicitOrder2 = second->getExplicitFocusOrder(); if (explicitOrder2 <= 0) - explicitOrder2 = INT_MAX / 2; + explicitOrder2 = std::numeric_limits::max() / 2; if (explicitOrder1 != explicitOrder2) return explicitOrder1 - explicitOrder2; diff --git a/src/gui/components/layout/juce_StretchableObjectResizer.cpp b/src/gui/components/layout/juce_StretchableObjectResizer.cpp index dd1340304d..6f8f962e16 100644 --- a/src/gui/components/layout/juce_StretchableObjectResizer.cpp +++ b/src/gui/components/layout/juce_StretchableObjectResizer.cpp @@ -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::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::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::max()) order = nextHighestOrder; else break; diff --git a/src/gui/components/windows/juce_SplashScreen.cpp b/src/gui/components/windows/juce_SplashScreen.cpp index 5f6feeea30..3e2eecb2a6 100644 --- a/src/gui/components/windows/juce_SplashScreen.cpp +++ b/src/gui/components/windows/juce_SplashScreen.cpp @@ -90,7 +90,7 @@ void SplashScreen::show (const String& title, originalClickCounter = removeOnMouseClick ? Desktop::getMouseButtonClickCounter() - : INT_MAX; + : std::numeric_limits::max(); earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor); diff --git a/src/gui/graphics/contexts/juce_EdgeTable.cpp b/src/gui/graphics/contexts/juce_EdgeTable.cpp index 18e351faf1..f6ddbe06fe 100644 --- a/src/gui/graphics/contexts/juce_EdgeTable.cpp +++ b/src/gui/graphics/contexts/juce_EdgeTable.cpp @@ -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::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::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::min(), 255, + clipped.getX() << 8, 0, + clipped.getRight() << 8, 255, + std::numeric_limits::max(), 0 }; for (int i = top; i < bottom; ++i) intersectWithEdgeTableLine (i, rectLine); diff --git a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp index f38c81e993..6cd7e8cc20 100644 --- a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp +++ b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp @@ -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::max(); CachedGlyph* oldest = 0; for (int i = glyphs.size(); --i >= 0;) diff --git a/src/gui/graphics/fonts/juce_Font.cpp b/src/gui/graphics/fonts/juce_Font.cpp index ec97dd0aa1..4ef4a5b06e 100644 --- a/src/gui/graphics/fonts/juce_Font.cpp +++ b/src/gui/graphics/fonts/juce_Font.cpp @@ -374,7 +374,7 @@ public: } int replaceIndex = 0; - int bestLastUsageCount = INT_MAX; + int bestLastUsageCount = std::numeric_limits::max(); for (i = faces.size(); --i >= 0;) { diff --git a/src/text/juce_CharacterFunctions.cpp b/src/text/juce_CharacterFunctions.cpp index 672df27ae4..960223098f 100644 --- a/src/text/juce_CharacterFunctions.cpp +++ b/src/text/juce_CharacterFunctions.cpp @@ -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::max() - 9) / 10); if (accumulator [decPointIndex] > maxAccumulatorValue) { result [decPointIndex] = juce_mulexp10 (result [decPointIndex], exponentAccumulator [decPointIndex]) diff --git a/src/text/juce_String.cpp b/src/text/juce_String.cpp index 64eb7cfa30..d991812953 100644 --- a/src/text/juce_String.cpp +++ b/src/text/juce_String.cpp @@ -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::max(); size_t numBytes; for (numBytes = 0; numBytes < (size_t) bufferSizeBytes; ++numBytes) diff --git a/src/text/juce_XmlElement.cpp b/src/text/juce_XmlElement.cpp index a20e044008..1b30ff640f 100644 --- a/src/text/juce_XmlElement.cpp +++ b/src/text/juce_XmlElement.cpp @@ -806,7 +806,7 @@ void XmlElement::insertChildElement (XmlElement* const newNode, else { if (indexToInsertAt < 0) - indexToInsertAt = INT_MAX; + indexToInsertAt = std::numeric_limits::max(); XmlElement* child = firstChildElement;