| @@ -177,11 +177,11 @@ static bool parseFile (const File& rootFolder, | |||
| for (;;) | |||
| { | |||
| int end = line.indexOf (T("*/")); | |||
| if (end >= 0) | |||
| { | |||
| line = line.substring (end + 2); | |||
| // If our comment appeared just before an assertion, leave it in, as it | |||
| // might be useful.. | |||
| if (lines [i + 1].contains (T("assert")) | |||
| @@ -190,7 +190,7 @@ static bool parseFile (const File& rootFolder, | |||
| i = originalI; | |||
| line = originalLine; | |||
| } | |||
| break; | |||
| } | |||
| @@ -199,28 +199,28 @@ static bool parseFile (const File& rootFolder, | |||
| if (i >= lines.size()) | |||
| break; | |||
| } | |||
| line = line.trimEnd(); | |||
| if (line.isEmpty()) | |||
| continue; | |||
| } | |||
| line = line.trimEnd(); | |||
| { | |||
| // Turn initial spaces into tabs.. | |||
| int numIntialSpaces = 0; | |||
| int len = line.length(); | |||
| while (numIntialSpaces < len && line [numIntialSpaces] == ' ') | |||
| ++numIntialSpaces; | |||
| if (numIntialSpaces > 0) | |||
| { | |||
| int tabSize = 4; | |||
| int numTabs = numIntialSpaces / tabSize; | |||
| line = String::repeatedString (T("\t"), numTabs) + line.substring (numTabs * tabSize); | |||
| } | |||
| if (! line.containsChar (T('"'))) | |||
| { | |||
| // turn large areas of spaces into tabs - this will mess up alignment a bit, but | |||
| @@ -287,7 +287,7 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin | |||
| if (! targetFile.replaceWithData (newData.getData(), newData.getSize())) | |||
| { | |||
| std::cout << "\n!! ERROR - couldn't write to the target file: " | |||
| std::cout << "\n!! ERROR - couldn't write to the target file: " | |||
| << (const char*) targetFile.getFullPathName() << "\n\n"; | |||
| return false; | |||
| } | |||
| @@ -39,7 +39,7 @@ static const String timeToTimecodeString (const double seconds) | |||
| return String::formatted (T("%s%02d:%02d:%02d:%03d"), | |||
| sign, hours, mins, secs, | |||
| roundDoubleToInt (absSecs * 1000) % 1000); | |||
| roundToInt (absSecs * 1000) % 1000); | |||
| } | |||
| // quick-and-dirty function to format a bars/beats string | |||
| @@ -140,9 +140,9 @@ static float longToFloat (const long n) throw() | |||
| static long floatToLong (const float n) throw() | |||
| { | |||
| return roundDoubleToInt (jlimit (-(double) 0x80000000, | |||
| (double) 0x7fffffff, | |||
| n * (double) 0xffffffff - (double) 0x80000000)); | |||
| return roundToInt (jlimit (-(double) 0x80000000, | |||
| (double) 0x7fffffff, | |||
| n * (double) 0xffffffff - (double) 0x80000000)); | |||
| } | |||
| static int numInstances = 0; | |||
| @@ -67,7 +67,7 @@ public: | |||
| e->setAttribute (T("focusDiscardsChanges"), l->doesLossOfFocusDiscardChanges()); | |||
| e->setAttribute (T("fontname"), l->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont)); | |||
| e->setAttribute (T("fontsize"), roundDoubleToInt (l->getFont().getHeight() * 100.0) / 100.0); | |||
| e->setAttribute (T("fontsize"), roundToInt (l->getFont().getHeight() * 100.0) / 100.0); | |||
| e->setAttribute (T("bold"), l->getFont().isBold()); | |||
| e->setAttribute (T("italic"), l->getFont().isItalic()); | |||
| e->setAttribute (T("justification"), l->getJustificationType().getFlags()); | |||
| @@ -593,7 +593,7 @@ private: | |||
| { | |||
| document.getUndoManager().undoCurrentTransactionOnly(); | |||
| document.perform (new TabDepthChangeAction (component, *document.getComponentLayout(), roundDoubleToInt (newValue)), | |||
| document.perform (new TabDepthChangeAction (component, *document.getComponentLayout(), roundToInt (newValue)), | |||
| T("Change TabComponent tab depth")); | |||
| } | |||
| @@ -392,7 +392,7 @@ private: | |||
| { | |||
| document.getUndoManager().undoCurrentTransactionOnly(); | |||
| document.perform (new ViewportScrollbarSizeChangeAction (component, *document.getComponentLayout(), roundDoubleToInt (newValue)), | |||
| document.perform (new ViewportScrollbarSizeChangeAction (component, *document.getComponentLayout(), roundToInt (newValue)), | |||
| T("Change Viewport scrollbar size")); | |||
| } | |||
| @@ -163,12 +163,12 @@ public: | |||
| Rectangle pos (e->getCurrentBounds (parentArea)); | |||
| const int newX = roundDoubleToInt ((pos.getX() - scaleStartX) * scaleX + scaleStartX + dx); | |||
| const int newY = roundDoubleToInt ((pos.getY() - scaleStartY) * scaleY + scaleStartY + dy); | |||
| const int newX = roundToInt ((pos.getX() - scaleStartX) * scaleX + scaleStartX + dx); | |||
| const int newY = roundToInt ((pos.getY() - scaleStartY) * scaleY + scaleStartY + dy); | |||
| pos.setBounds (newX, newY, | |||
| roundDoubleToInt ((pos.getRight() - scaleStartX) * scaleX + scaleStartX + dx) - newX, | |||
| roundDoubleToInt ((pos.getBottom() - scaleStartY) * scaleY + scaleStartY + dy) - newY); | |||
| roundToInt ((pos.getRight() - scaleStartX) * scaleX + scaleStartX + dx) - newX, | |||
| roundToInt ((pos.getBottom() - scaleStartY) * scaleY + scaleStartY + dy) - newY); | |||
| e->setCurrentBounds (pos, parentArea, undoable); | |||
| } | |||
| @@ -1590,8 +1590,8 @@ void PathPointComponent::updatePosition() | |||
| double x, y; | |||
| path->getPoint (index, pointNumber, x, y, area); | |||
| setCentrePosition (roundDoubleToInt (x), | |||
| roundDoubleToInt (y)); | |||
| setCentrePosition (roundToInt (x), | |||
| roundToInt (y)); | |||
| } | |||
| void PathPointComponent::showPopupMenu() | |||
| @@ -70,7 +70,7 @@ public: | |||
| strokeType.fill.setFillType (g, getDocument(), parentArea); | |||
| g.drawRect (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| roundDoubleToInt (getStrokeType().stroke.getStrokeThickness())); | |||
| roundToInt (getStrokeType().stroke.getStrokeThickness())); | |||
| } | |||
| } | |||
| @@ -101,7 +101,7 @@ public: | |||
| strokeType.fill.fillInGeneratedCode (code, paintMethodCode); | |||
| s << "g.drawRect (" << x << ", " << y << ", " << w << ", " << h << ", " | |||
| << roundDoubleToInt (strokeType.stroke.getStrokeThickness()) << ");\n\n"; | |||
| << roundToInt (strokeType.stroke.getStrokeThickness()) << ");\n\n"; | |||
| paintMethodCode += s; | |||
| } | |||
| @@ -114,7 +114,7 @@ public: | |||
| addColourAttributes (e); | |||
| e->setAttribute (T("text"), text); | |||
| e->setAttribute (T("fontname"), typefaceName); | |||
| e->setAttribute (T("fontsize"), roundDoubleToInt (font.getHeight() * 100.0) / 100.0); | |||
| e->setAttribute (T("fontsize"), roundToInt (font.getHeight() * 100.0) / 100.0); | |||
| e->setAttribute (T("bold"), font.isBold()); | |||
| e->setAttribute (T("italic"), font.isItalic()); | |||
| e->setAttribute (T("justification"), justification.getFlags()); | |||
| @@ -118,7 +118,7 @@ public: | |||
| static const String valueToString (const double n) | |||
| { | |||
| return String (roundDoubleToInt (n * 1000.0) / 1000.0); | |||
| return String (roundToInt (n * 1000.0) / 1000.0); | |||
| } | |||
| void setText (const String& newText) | |||
| @@ -155,9 +155,9 @@ void EditingPanelBase::resized() | |||
| if (document.isFixedSize()) | |||
| editor->setSize (jmax (document.getInitialWidth(), | |||
| roundDoubleToInt ((viewport->getWidth() - viewport->getScrollBarThickness()) / getZoom())), | |||
| roundToInt ((viewport->getWidth() - viewport->getScrollBarThickness()) / getZoom())), | |||
| jmax (document.getInitialHeight(), | |||
| roundDoubleToInt ((viewport->getHeight() - viewport->getScrollBarThickness()) / getZoom()))); | |||
| roundToInt ((viewport->getHeight() - viewport->getScrollBarThickness()) / getZoom()))); | |||
| else | |||
| editor->setSize (viewport->getWidth(), | |||
| viewport->getHeight()); | |||
| @@ -378,16 +378,16 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else if (position.rect.getWidthMode() == PositionedRectangle::parentSizeMinusAbsolute) | |||
| { | |||
| if (wrw.isNotEmpty()) | |||
| w << "(" << wrw << ") - " << roundDoubleToInt (position.rect.getWidth()); | |||
| w << "(" << wrw << ") - " << roundToInt (position.rect.getWidth()); | |||
| else | |||
| w << "getWidth() - " << roundDoubleToInt (position.rect.getWidth()); | |||
| w << "getWidth() - " << roundToInt (position.rect.getWidth()); | |||
| } | |||
| else | |||
| { | |||
| if (wrw.isNotEmpty()) | |||
| w << "(" << wrw << ") + "; | |||
| w << roundDoubleToInt (position.rect.getWidth()); | |||
| w << roundToInt (position.rect.getWidth()); | |||
| } | |||
| // height | |||
| @@ -401,16 +401,16 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else if (position.rect.getHeightMode() == PositionedRectangle::parentSizeMinusAbsolute) | |||
| { | |||
| if (hrh.isNotEmpty()) | |||
| h << "(" << hrh << ") - " << roundDoubleToInt (position.rect.getHeight()); | |||
| h << "(" << hrh << ") - " << roundToInt (position.rect.getHeight()); | |||
| else | |||
| h << "getHeight() - " << roundDoubleToInt (position.rect.getHeight()); | |||
| h << "getHeight() - " << roundToInt (position.rect.getHeight()); | |||
| } | |||
| else | |||
| { | |||
| if (hrh.isNotEmpty()) | |||
| h << "(" << hrh << ") + "; | |||
| h << roundDoubleToInt (position.rect.getHeight()); | |||
| h << roundToInt (position.rect.getHeight()); | |||
| } | |||
| // x-pos | |||
| @@ -426,7 +426,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| if (xrx.isNotEmpty()) | |||
| x << "(" << xrx << ") + "; | |||
| x << roundDoubleToInt (position.rect.getX()); | |||
| x << roundToInt (position.rect.getX()); | |||
| } | |||
| else if (position.rect.getPositionModeX() == PositionedRectangle::absoluteFromParentBottomRight) | |||
| { | |||
| @@ -435,7 +435,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else | |||
| x << "getWidth()"; | |||
| const int d = roundDoubleToInt (position.rect.getX()); | |||
| const int d = roundToInt (position.rect.getX()); | |||
| if (d != 0) | |||
| x << " - " << d; | |||
| } | |||
| @@ -446,7 +446,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else | |||
| x << "(getWidth() / 2)"; | |||
| const int d = roundDoubleToInt (position.rect.getX()); | |||
| const int d = roundToInt (position.rect.getX()); | |||
| if (d != 0) | |||
| x << " + " << d; | |||
| } | |||
| @@ -472,7 +472,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| if (yry.isNotEmpty()) | |||
| y << "(" << yry << ") + "; | |||
| y << roundDoubleToInt (position.rect.getY()); | |||
| y << roundToInt (position.rect.getY()); | |||
| } | |||
| else if (position.rect.getPositionModeY() == PositionedRectangle::absoluteFromParentBottomRight) | |||
| { | |||
| @@ -481,7 +481,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else | |||
| y << "getHeight()"; | |||
| const int d = roundDoubleToInt (position.rect.getY()); | |||
| const int d = roundToInt (position.rect.getY()); | |||
| if (d != 0) | |||
| y << " - " << d; | |||
| } | |||
| @@ -492,7 +492,7 @@ void positionToCode (const RelativePositionedRectangle& position, | |||
| else | |||
| y << "(getHeight() / 2)"; | |||
| const int d = roundDoubleToInt (position.rect.getY()); | |||
| const int d = roundToInt (position.rect.getY()); | |||
| if (d != 0) | |||
| y << " + " << d; | |||
| } | |||
| @@ -88,9 +88,6 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 | |||
| FLAC__ASSERT(0 != aligned_pointer); | |||
| FLAC__ASSERT(unaligned_pointer != aligned_pointer); | |||
| if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ | |||
| return false; | |||
| pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv); | |||
| if(0 == pu) { | |||
| return false; | |||
| @@ -117,9 +114,6 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint | |||
| FLAC__ASSERT(0 != aligned_pointer); | |||
| FLAC__ASSERT(unaligned_pointer != aligned_pointer); | |||
| if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ | |||
| return false; | |||
| pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); | |||
| if(0 == pu) { | |||
| return false; | |||
| @@ -146,9 +140,6 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint | |||
| FLAC__ASSERT(0 != aligned_pointer); | |||
| FLAC__ASSERT(unaligned_pointer != aligned_pointer); | |||
| if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ | |||
| return false; | |||
| pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); | |||
| if(0 == pu) { | |||
| return false; | |||
| @@ -175,9 +166,6 @@ FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned | |||
| FLAC__ASSERT(0 != aligned_pointer); | |||
| FLAC__ASSERT(unaligned_pointer != aligned_pointer); | |||
| if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ | |||
| return false; | |||
| pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); | |||
| if(0 == pu) { | |||
| return false; | |||
| @@ -206,9 +194,6 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real * | |||
| FLAC__ASSERT(0 != aligned_pointer); | |||
| FLAC__ASSERT(unaligned_pointer != aligned_pointer); | |||
| if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ | |||
| return false; | |||
| pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); | |||
| if(0 == pu) { | |||
| return false; | |||
| @@ -75,7 +75,7 @@ bool AudioFormatReader::read (int** destSamples, | |||
| if (numSamplesToRead <= 0) | |||
| return true; | |||
| if (! readSamples (destSamples, jmin (numChannels, numDestChannels), startOffsetInDestBuffer, | |||
| if (! readSamples (destSamples, jmin ((int) numChannels, numDestChannels), startOffsetInDestBuffer, | |||
| startSampleInSource, numSamplesToRead)) | |||
| return false; | |||
| @@ -273,8 +273,8 @@ int64 AudioFormatReader::searchForLevel (int64 startSample, | |||
| const double doubleMin = jlimit (0.0, (double) INT_MAX, magnitudeRangeMinimum * INT_MAX); | |||
| const double doubleMax = jlimit (doubleMin, (double) INT_MAX, magnitudeRangeMaximum * INT_MAX); | |||
| const int intMagnitudeRangeMinimum = roundDoubleToInt (doubleMin); | |||
| const int intMagnitudeRangeMaximum = roundDoubleToInt (doubleMax); | |||
| const int intMagnitudeRangeMinimum = roundToInt (doubleMin); | |||
| const int intMagnitudeRangeMaximum = roundToInt (doubleMax); | |||
| while (numSamplesToSearch != 0) | |||
| { | |||
| @@ -438,7 +438,7 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, | |||
| else if (samp >= 1.0) | |||
| *b++ = INT_MAX; | |||
| else | |||
| *b++ = roundDoubleToInt (INT_MAX * samp); | |||
| *b++ = roundToInt (INT_MAX * samp); | |||
| } | |||
| } | |||
| } | |||
| @@ -499,7 +499,7 @@ bool AudioFormatWriter::writeFromAudioSource (AudioSource& source, | |||
| else if (samp >= 1.0) | |||
| *b++ = INT_MAX; | |||
| else | |||
| *b++ = roundDoubleToInt (INT_MAX * samp); | |||
| *b++ = roundToInt (INT_MAX * samp); | |||
| } | |||
| } | |||
| } | |||
| @@ -215,7 +215,7 @@ void AudioThumbnail::saveTo (OutputStream& output) const | |||
| { | |||
| AudioThumbnailDataFormat* const d = (AudioThumbnailDataFormat*) data.getData(); | |||
| swapEndiannessIfNeeded (d); | |||
| output.write (data.getData(), data.getSize()); | |||
| output.write (data.getData(), (int) data.getSize()); | |||
| swapEndiannessIfNeeded (d); | |||
| } | |||
| @@ -224,9 +224,9 @@ bool AudioThumbnail::initialiseFromAudioFile (AudioFormatReader& fileReader) | |||
| AudioThumbnailDataFormat* d = (AudioThumbnailDataFormat*) data.getData(); | |||
| d->totalSamples = fileReader.lengthInSamples; | |||
| d->numChannels = jmin (2, fileReader.numChannels); | |||
| d->numChannels = jmin ((uint32) 2, fileReader.numChannels); | |||
| d->numFinishedSamples = 0; | |||
| d->sampleRate = roundDoubleToInt (fileReader.sampleRate); | |||
| d->sampleRate = roundToInt (fileReader.sampleRate); | |||
| d->numThumbnailSamples = (int) (d->totalSamples / d->samplesPerThumbSample) + 1; | |||
| data.setSize (sizeof (AudioThumbnailDataFormat) + 3 + d->numThumbnailSamples * d->numChannels * 2); | |||
| @@ -384,11 +384,11 @@ void AudioThumbnail::refillCache (const int numSamples, | |||
| startTimer (timeBeforeDeletingReader); | |||
| char* cacheData = (char*) cachedLevels.getData(); | |||
| int sample = roundDoubleToInt (startTime * d->sampleRate); | |||
| int sample = roundToInt (startTime * d->sampleRate); | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| const int nextSample = roundDoubleToInt ((startTime + timePerPixel) * d->sampleRate); | |||
| const int nextSample = roundToInt ((startTime + timePerPixel) * d->sampleRate); | |||
| if (sample >= 0) | |||
| { | |||
| @@ -427,12 +427,12 @@ void AudioThumbnail::refillCache (const int numSamples, | |||
| const double timeToThumbSampleFactor = d->sampleRate / (double) d->samplesPerThumbSample; | |||
| startTime = cachedStart; | |||
| int sample = roundDoubleToInt (startTime * timeToThumbSampleFactor); | |||
| int sample = roundToInt (startTime * timeToThumbSampleFactor); | |||
| const int numFinished = (int) (d->numFinishedSamples / d->samplesPerThumbSample); | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| const int nextSample = roundDoubleToInt ((startTime + timePerPixel) * timeToThumbSampleFactor); | |||
| const int nextSample = roundToInt ((startTime + timePerPixel) * timeToThumbSampleFactor); | |||
| if (sample >= 0 && channelData != 0) | |||
| { | |||
| @@ -328,7 +328,7 @@ public: | |||
| FLAC__stream_encoder_set_do_mid_side_stereo (encoder, numChannels == 2); | |||
| FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, numChannels == 2); | |||
| FLAC__stream_encoder_set_channels (encoder, numChannels); | |||
| FLAC__stream_encoder_set_bits_per_sample (encoder, jmin (24, bitsPerSample)); | |||
| FLAC__stream_encoder_set_bits_per_sample (encoder, jmin ((unsigned int) 24, bitsPerSample)); | |||
| FLAC__stream_encoder_set_sample_rate (encoder, (unsigned int) sampleRate); | |||
| FLAC__stream_encoder_set_blocksize (encoder, 2048); | |||
| FLAC__stream_encoder_set_do_escape_coding (encoder, true); | |||
| @@ -184,7 +184,7 @@ public: | |||
| jassert (samps <= numToRead); | |||
| for (int i = jmin (numChannels, reservoir.getNumChannels()); --i >= 0;) | |||
| for (int i = jmin ((int) numChannels, reservoir.getNumChannels()); --i >= 0;) | |||
| { | |||
| memcpy (reservoir.getSampleData (i, offset), | |||
| dataIn[i], | |||
| @@ -171,7 +171,7 @@ public: | |||
| | kAudioFormatFlagIsPacked | |||
| | kAudioFormatFlagsNativeEndian; | |||
| inputStreamDesc.mBitsPerChannel = sizeof (SInt16) * 8; | |||
| inputStreamDesc.mChannelsPerFrame = jmin (2, inputStreamDesc.mChannelsPerFrame); | |||
| inputStreamDesc.mChannelsPerFrame = jmin ((UInt32) 2, inputStreamDesc.mChannelsPerFrame); | |||
| inputStreamDesc.mBytesPerFrame = sizeof (SInt16) * inputStreamDesc.mChannelsPerFrame; | |||
| inputStreamDesc.mBytesPerPacket = inputStreamDesc.mBytesPerFrame; | |||
| @@ -111,7 +111,7 @@ struct BWAVChunk | |||
| static MemoryBlock createFrom (const StringPairArray& values) | |||
| { | |||
| const int sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (0) - 1; | |||
| const size_t sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (0) - 1; | |||
| MemoryBlock data ((sizeNeeded + 3) & ~3); | |||
| data.fillWith (0); | |||
| @@ -277,14 +277,14 @@ public: | |||
| // Broadcast-wav extension chunk.. | |||
| HeapBlock <BWAVChunk> bwav; | |||
| bwav.calloc (jmax (length + 1, (int) sizeof (BWAVChunk)), 1); | |||
| bwav.calloc (jmax ((size_t) length + 1, sizeof (BWAVChunk)), 1); | |||
| input->read (bwav, length); | |||
| bwav->copyTo (metadataValues); | |||
| } | |||
| else if (chunkType == chunkName ("smpl")) | |||
| { | |||
| HeapBlock <SMPLChunk> smpl; | |||
| smpl.calloc (jmax (length + 1, (int) sizeof (SMPLChunk)), 1); | |||
| smpl.calloc (jmax ((size_t) length + 1, sizeof (SMPLChunk)), 1); | |||
| input->read (smpl, length); | |||
| smpl->copyTo (metadataValues, length); | |||
| } | |||
| @@ -550,8 +550,8 @@ class WavAudioFormatWriter : public AudioFormatWriter | |||
| const int bytesPerFrame = numChannels * bitsPerSample / 8; | |||
| output->writeInt (chunkName ("RIFF")); | |||
| output->writeInt (lengthInSamples * bytesPerFrame | |||
| + ((bwavChunk.getSize() > 0) ? (44 + bwavChunk.getSize()) : 36)); | |||
| output->writeInt ((int) (lengthInSamples * bytesPerFrame | |||
| + ((bwavChunk.getSize() > 0) ? (44 + bwavChunk.getSize()) : 36))); | |||
| output->writeInt (chunkName ("WAVE")); | |||
| output->writeInt (chunkName ("fmt ")); | |||
| @@ -567,8 +567,8 @@ class WavAudioFormatWriter : public AudioFormatWriter | |||
| if (bwavChunk.getSize() > 0) | |||
| { | |||
| output->writeInt (chunkName ("bext")); | |||
| output->writeInt (bwavChunk.getSize()); | |||
| output->write (bwavChunk.getData(), bwavChunk.getSize()); | |||
| output->writeInt ((int) bwavChunk.getSize()); | |||
| output->write (bwavChunk.getData(), (int) bwavChunk.getSize()); | |||
| } | |||
| output->writeInt (chunkName ("data")); | |||
| @@ -843,7 +843,7 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai | |||
| { | |||
| MemoryBlock chunk = BWAVChunk::createFrom (newMetadata); | |||
| if (chunk.getSize() <= bwavSize) | |||
| if (chunk.getSize() <= (size_t) bwavSize) | |||
| { | |||
| // the new one will fit in the space available, so write it directly.. | |||
| const int64 oldSize = wavFile.getSize(); | |||
| @@ -851,7 +851,7 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai | |||
| { | |||
| ScopedPointer <FileOutputStream> out (wavFile.createOutputStream()); | |||
| out->setPosition (bwavPos); | |||
| out->write (chunk.getData(), chunk.getSize()); | |||
| out->write (chunk.getData(), (int) chunk.getSize()); | |||
| out->setPosition (oldSize); | |||
| } | |||
| @@ -157,7 +157,7 @@ void AudioTransportSource::stop() | |||
| void AudioTransportSource::setPosition (double newPosition) | |||
| { | |||
| if (sampleRate > 0.0) | |||
| setNextReadPosition (roundDoubleToInt (newPosition * sampleRate)); | |||
| setNextReadPosition (roundToInt (newPosition * sampleRate)); | |||
| } | |||
| double AudioTransportSource::getCurrentPosition() const | |||
| @@ -173,7 +173,7 @@ void AudioTransportSource::setNextReadPosition (int newPosition) | |||
| if (positionableSource != 0) | |||
| { | |||
| if (sampleRate > 0 && sourceSampleRate > 0) | |||
| newPosition = roundDoubleToInt (newPosition * sourceSampleRate / sampleRate); | |||
| newPosition = roundToInt (newPosition * sourceSampleRate / sampleRate); | |||
| positionableSource->setNextReadPosition (newPosition); | |||
| } | |||
| @@ -185,7 +185,7 @@ int AudioTransportSource::getNextReadPosition() const | |||
| { | |||
| const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; | |||
| return roundDoubleToInt (positionableSource->getNextReadPosition() * ratio); | |||
| return roundToInt (positionableSource->getNextReadPosition() * ratio); | |||
| } | |||
| return 0; | |||
| @@ -199,7 +199,7 @@ int AudioTransportSource::getTotalLength() const | |||
| { | |||
| const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; | |||
| return roundDoubleToInt (positionableSource->getTotalLength() * ratio); | |||
| return roundToInt (positionableSource->getTotalLength() * ratio); | |||
| } | |||
| return 0; | |||
| @@ -65,7 +65,7 @@ void ResamplingAudioSource::prepareToPlay (int samplesPerBlockExpected, | |||
| input->prepareToPlay (samplesPerBlockExpected, sampleRate); | |||
| buffer.setSize (2, roundDoubleToInt (samplesPerBlockExpected * ratio) + 32); | |||
| buffer.setSize (2, roundToInt (samplesPerBlockExpected * ratio) + 32); | |||
| buffer.clear(); | |||
| sampsInBuffer = 0; | |||
| bufferPos = 0; | |||
| @@ -91,7 +91,7 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf | |||
| lastRatio = ratio; | |||
| } | |||
| const int sampsNeeded = roundDoubleToInt (info.numSamples * ratio) + 2; | |||
| const int sampsNeeded = roundToInt (info.numSamples * ratio) + 2; | |||
| int bufferSize = buffer.getNumSamples(); | |||
| @@ -128,11 +128,11 @@ void MidiOutput::run() | |||
| if (message != 0) | |||
| { | |||
| eventTime = roundDoubleToInt (message->message.getTimeStamp()); | |||
| eventTime = roundToInt (message->message.getTimeStamp()); | |||
| if (eventTime > now + 20) | |||
| { | |||
| timeToWait = jmax (10, eventTime - now - 100); | |||
| timeToWait = eventTime - (now + 20); | |||
| message = 0; | |||
| } | |||
| else | |||
| @@ -40,7 +40,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| *(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -51,7 +51,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| *(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| } | |||
| } | |||
| } | |||
| @@ -65,7 +65,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| *(uint16*) intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint16*) intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -76,7 +76,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| *(uint16*)intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint16*)intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| } | |||
| } | |||
| } | |||
| @@ -90,7 +90,7 @@ void AudioDataConverters::convertFloatToInt24LE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| ByteOrder::littleEndian24BitToChars ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| ByteOrder::littleEndian24BitToChars ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -101,7 +101,7 @@ void AudioDataConverters::convertFloatToInt24LE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| ByteOrder::littleEndian24BitToChars ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| ByteOrder::littleEndian24BitToChars ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| } | |||
| } | |||
| } | |||
| @@ -115,7 +115,7 @@ void AudioDataConverters::convertFloatToInt24BE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| ByteOrder::bigEndian24BitToChars ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| ByteOrder::bigEndian24BitToChars ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -126,7 +126,7 @@ void AudioDataConverters::convertFloatToInt24BE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| ByteOrder::bigEndian24BitToChars ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| ByteOrder::bigEndian24BitToChars ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])), intData); | |||
| } | |||
| } | |||
| } | |||
| @@ -140,7 +140,7 @@ void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| *(uint32*)intData = ByteOrder::swapIfBigEndian ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint32*)intData = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -151,7 +151,7 @@ void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| *(uint32*)intData = ByteOrder::swapIfBigEndian ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint32*)intData = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| } | |||
| } | |||
| } | |||
| @@ -165,7 +165,7 @@ void AudioDataConverters::convertFloatToInt32BE (const float* source, void* dest | |||
| { | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| *(uint32*)intData = ByteOrder::swapIfLittleEndian ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint32*)intData = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| intData += destBytesPerSample; | |||
| } | |||
| } | |||
| @@ -176,7 +176,7 @@ void AudioDataConverters::convertFloatToInt32BE (const float* source, void* dest | |||
| for (int i = numSamples; --i >= 0;) | |||
| { | |||
| intData -= destBytesPerSample; | |||
| *(uint32*)intData = ByteOrder::swapIfLittleEndian ((uint32) roundDoubleToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| *(uint32*)intData = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
| } | |||
| } | |||
| } | |||
| @@ -49,7 +49,7 @@ AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) throw() | |||
| size (other.size) | |||
| { | |||
| allocateData(); | |||
| const int numBytes = size * sizeof (float); | |||
| const size_t numBytes = size * sizeof (float); | |||
| for (int i = 0; i < numChannels; ++i) | |||
| memcpy (channels[i], other.channels[i], numBytes); | |||
| @@ -57,8 +57,8 @@ AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) throw() | |||
| void AudioSampleBuffer::allocateData() | |||
| { | |||
| const int channelListSize = (numChannels + 1) * sizeof (float*); | |||
| allocatedBytes = numChannels * size * sizeof (float) + channelListSize + 32; | |||
| const size_t channelListSize = (numChannels + 1) * sizeof (float*); | |||
| allocatedBytes = (int) (numChannels * size * sizeof (float) + channelListSize + 32); | |||
| allocatedData.malloc (allocatedBytes); | |||
| channels = (float**) allocatedData; | |||
| @@ -128,7 +128,7 @@ const AudioSampleBuffer& AudioSampleBuffer::operator= (const AudioSampleBuffer& | |||
| { | |||
| setSize (other.getNumChannels(), other.getNumSamples(), false, false, false); | |||
| const int numBytes = size * sizeof (float); | |||
| const size_t numBytes = size * sizeof (float); | |||
| for (int i = 0; i < numChannels; ++i) | |||
| memcpy (channels[i], other.channels[i], numBytes); | |||
| @@ -151,8 +151,8 @@ void AudioSampleBuffer::setSize (const int newNumChannels, | |||
| if (newNumSamples != size || newNumChannels != numChannels) | |||
| { | |||
| const int channelListSize = (newNumChannels + 1) * sizeof (float*); | |||
| const int newTotalBytes = (newNumChannels * newNumSamples * sizeof (float)) + channelListSize + 32; | |||
| const size_t channelListSize = (newNumChannels + 1) * sizeof (float*); | |||
| const size_t newTotalBytes = (newNumChannels * newNumSamples * sizeof (float)) + channelListSize + 32; | |||
| if (keepExistingContent) | |||
| { | |||
| @@ -160,7 +160,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels, | |||
| newData.allocate (newTotalBytes, clearExtraSpace); | |||
| const int numChansToCopy = jmin (numChannels, newNumChannels); | |||
| const int numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); | |||
| const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); | |||
| float** const newChannels = (float**) newData; | |||
| float* newChan = (float*) (newData + channelListSize); | |||
| @@ -172,7 +172,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels, | |||
| } | |||
| allocatedData.swapWith (newData); | |||
| allocatedBytes = newTotalBytes; | |||
| allocatedBytes = (int) newTotalBytes; | |||
| channels = (float**) allocatedData; | |||
| } | |||
| else | |||
| @@ -680,7 +680,7 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer, | |||
| else if (samp >= 1.0) | |||
| dest[i] = INT_MAX; | |||
| else | |||
| dest[i] = roundDoubleToInt (INT_MAX * samp); | |||
| dest[i] = roundToInt (INT_MAX * samp); | |||
| } | |||
| } | |||
| } | |||
| @@ -424,7 +424,8 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| int numChannels, size, allocatedBytes; | |||
| int numChannels, size; | |||
| size_t allocatedBytes; | |||
| float** channels; | |||
| HeapBlock <char> allocatedData; | |||
| float* preallocatedChannelSpace [32]; | |||
| @@ -43,8 +43,8 @@ MidiBuffer::MidiBuffer (const MidiMessage& message) throw() | |||
| } | |||
| MidiBuffer::MidiBuffer (const MidiBuffer& other) throw() | |||
| : bytesUsed (other.bytesUsed), | |||
| data (other.data) | |||
| : data (other.data), | |||
| bytesUsed (other.bytesUsed) | |||
| { | |||
| } | |||
| @@ -190,7 +190,7 @@ bool MidiFile::readFrom (InputStream& sourceStream) | |||
| // (put a sanity-check on the file size, as midi files are generally small) | |||
| if (sourceStream.readIntoMemoryBlock (data, maxSensibleMidiFileSize)) | |||
| { | |||
| int size = data.getSize(); | |||
| size_t size = data.getSize(); | |||
| const char* d = (char*) data.getData(); | |||
| short fileType, expectedTracks; | |||
| @@ -430,7 +430,7 @@ void MidiFile::writeTrack (OutputStream& mainOut, | |||
| { | |||
| const MidiMessage& mm = ms.getEventPointer(i)->message; | |||
| const int tick = roundDoubleToInt (mm.getTimeStamp()); | |||
| const int tick = roundToInt (mm.getTimeStamp()); | |||
| const int delta = jmax (0, tick - lastTick); | |||
| writeVariableLengthInt (out, delta); | |||
| lastTick = tick; | |||
| @@ -458,8 +458,8 @@ void MidiFile::writeTrack (OutputStream& mainOut, | |||
| m.getRawDataSize()); | |||
| mainOut.writeIntBigEndian ((int) ByteOrder::bigEndianInt ("MTrk")); | |||
| mainOut.writeIntBigEndian (out.getDataSize()); | |||
| mainOut.write (out.getData(), out.getDataSize()); | |||
| mainOut.writeIntBigEndian ((int) out.getDataSize()); | |||
| mainOut.write (out.getData(), (int) out.getDataSize()); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -173,7 +173,7 @@ void MidiKeyboardState::processNextMidiBuffer (MidiBuffer& buffer, | |||
| while (i2.getNextEvent (message, time)) | |||
| { | |||
| const int pos = jlimit (0, numSamples - 1, roundDoubleToInt ((time - firstEventToAdd) * scaleFactor)); | |||
| const int pos = jlimit (0, numSamples - 1, roundToInt ((time - firstEventToAdd) * scaleFactor)); | |||
| buffer.addEvent (message, startSample + pos); | |||
| } | |||
| } | |||
| @@ -353,13 +353,13 @@ float MidiMessage::getFloatVelocity() const throw() | |||
| void MidiMessage::setVelocity (const float newVelocity) throw() | |||
| { | |||
| if (isNoteOnOrOff()) | |||
| data[2] = (uint8) jlimit (0, 0x7f, roundFloatToInt (newVelocity * 127.0f)); | |||
| data[2] = (uint8) jlimit (0, 0x7f, roundToInt (newVelocity * 127.0f)); | |||
| } | |||
| void MidiMessage::multiplyVelocity (const float scaleFactor) throw() | |||
| { | |||
| if (isNoteOnOrOff()) | |||
| data[2] = (uint8) jlimit (0, 0x7f, roundFloatToInt (scaleFactor * data[2])); | |||
| data[2] = (uint8) jlimit (0, 0x7f, roundToInt (scaleFactor * data[2])); | |||
| } | |||
| bool MidiMessage::isAftertouch() const throw() | |||
| @@ -494,7 +494,7 @@ const MidiMessage MidiMessage::noteOn (const int channel, | |||
| return MidiMessage (0x90 | jlimit (0, 15, channel - 1), | |||
| noteNumber & 127, | |||
| jlimit (0, 127, roundFloatToInt (velocity))); | |||
| jlimit (0, 127, roundToInt (velocity))); | |||
| } | |||
| const MidiMessage MidiMessage::noteOff (const int channel, | |||
| @@ -537,7 +537,7 @@ const MidiMessage MidiMessage::allControllersOff (const int channel) throw() | |||
| const MidiMessage MidiMessage::masterVolume (const float volume) throw() | |||
| { | |||
| const int vol = jlimit (0, 0x3fff, roundFloatToInt (volume * 0x4000)); | |||
| const int vol = jlimit (0, 0x3fff, roundToInt (volume * 0x4000)); | |||
| uint8 buf[8]; | |||
| buf[0] = 0xf0; | |||
| @@ -90,7 +90,7 @@ void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | |||
| if (! incomingMessages.isEmpty()) | |||
| { | |||
| int numSourceSamples = jmax (1, roundDoubleToInt (msElapsed * 0.001 * sampleRate)); | |||
| int numSourceSamples = jmax (1, roundToInt (msElapsed * 0.001 * sampleRate)); | |||
| int startSample = 0; | |||
| int scale = 1 << 16; | |||
| @@ -570,7 +570,7 @@ void AudioUnitPluginInstance::prepareToPlay (double sampleRate_, | |||
| AudioUnitGetProperty (audioUnit, kAudioUnitProperty_Latency, kAudioUnitScope_Global, | |||
| 0, &latencySecs, &latencySize); | |||
| setLatencySamples (roundDoubleToInt (latencySecs * sampleRate_)); | |||
| setLatencySamples (roundToInt (latencySecs * sampleRate_)); | |||
| AudioUnitReset (audioUnit, kAudioUnitScope_Input, 0); | |||
| AudioUnitReset (audioUnit, kAudioUnitScope_Output, 0); | |||
| @@ -796,7 +796,7 @@ OSStatus AudioUnitPluginInstance::getTransportState (Boolean* outIsPlaying, | |||
| } | |||
| if (outCurrentSampleInTimeLine != 0) | |||
| *outCurrentSampleInTimeLine = roundDoubleToInt (result.timeInSeconds * getSampleRate()); | |||
| *outCurrentSampleInTimeLine = roundToInt (result.timeInSeconds * getSampleRate()); | |||
| if (outIsCycling != 0) | |||
| *outIsCycling = false; | |||
| @@ -267,7 +267,7 @@ XmlElement* AudioProcessor::getXmlFromBinary (const void* data, | |||
| if (sizeInBytes > 8 | |||
| && ByteOrder::littleEndianInt ((const char*) data) == magicXmlNumber) | |||
| { | |||
| const uint32 stringLength = ByteOrder::littleEndianInt (((const char*) data) + 4); | |||
| const int stringLength = (int) ByteOrder::littleEndianInt (((const char*) data) + 4); | |||
| if (stringLength > 0) | |||
| { | |||
| @@ -56,12 +56,12 @@ SamplerSound::SamplerSound (const String& name_, | |||
| length = jmin ((int) source.lengthInSamples, | |||
| (int) (maxSampleLengthSeconds * sourceSampleRate)); | |||
| data = new AudioSampleBuffer (jmin (2, source.numChannels), length + 4); | |||
| data = new AudioSampleBuffer (jmin (2, (int) source.numChannels), length + 4); | |||
| data->readFromAudioReader (&source, 0, length + 4, 0, true, true); | |||
| attackSamples = roundDoubleToInt (attackTimeSecs * sourceSampleRate); | |||
| releaseSamples = roundDoubleToInt (releaseTimeSecs * sourceSampleRate); | |||
| attackSamples = roundToInt (attackTimeSecs * sourceSampleRate); | |||
| releaseSamples = roundToInt (releaseTimeSecs * sourceSampleRate); | |||
| } | |||
| } | |||
| @@ -926,7 +926,7 @@ void BitArray::parseString (const String& text, | |||
| const MemoryBlock BitArray::toMemoryBlock() const throw() | |||
| { | |||
| const int numBytes = (getHighestBit() + 8) >> 3; | |||
| MemoryBlock mb (numBytes); | |||
| MemoryBlock mb ((size_t) numBytes); | |||
| for (int i = 0; i < numBytes; ++i) | |||
| mb[i] = (uint8) getBitRangeAsInt (i << 3, 8); | |||
| @@ -938,8 +938,8 @@ void BitArray::loadFromMemoryBlock (const MemoryBlock& data) throw() | |||
| { | |||
| clear(); | |||
| for (int i = data.getSize(); --i >= 0;) | |||
| this->setBitRangeAsInt (i << 3, 8, data [i]); | |||
| for (size_t i = data.getSize(); --i >= 0;) | |||
| this->setBitRangeAsInt ((int) (i << 3), 8, data [i]); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -89,7 +89,7 @@ public: | |||
| If you want an array of zero values, you can use the calloc() method instead. | |||
| */ | |||
| HeapBlock (const int numElements) | |||
| HeapBlock (const size_t numElements) | |||
| : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType))) | |||
| { | |||
| } | |||
| @@ -170,7 +170,7 @@ public: | |||
| The data that is allocated will be freed when this object is deleted, or when you | |||
| call free() or any of the allocation methods. | |||
| */ | |||
| void malloc (const int newNumElements, const unsigned int elementSize = sizeof (ElementType)) | |||
| void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = (ElementType*) ::juce_malloc (newNumElements * elementSize); | |||
| @@ -179,7 +179,7 @@ public: | |||
| /** Allocates a specified amount of memory and clears it. | |||
| This does the same job as the malloc() method, but clears the memory that it allocates. | |||
| */ | |||
| void calloc (const int newNumElements, const unsigned int elementSize = sizeof (ElementType)) | |||
| void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = (ElementType*) ::juce_calloc (newNumElements * elementSize); | |||
| @@ -189,7 +189,7 @@ public: | |||
| This does the same job as either malloc() or calloc(), depending on the | |||
| initialiseToZero parameter. | |||
| */ | |||
| void allocate (const int newNumElements, const bool initialiseToZero) | |||
| void allocate (const size_t newNumElements, const bool initialiseToZero) | |||
| { | |||
| ::juce_free (data); | |||
| @@ -204,7 +204,7 @@ public: | |||
| The semantics of this method are the same as malloc() and calloc(), but it | |||
| uses realloc() to keep as much of the existing data as possible. | |||
| */ | |||
| void realloc (const int newNumElements, const unsigned int elementSize = sizeof (ElementType)) | |||
| void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| if (data == 0) | |||
| data = (ElementType*) ::juce_malloc (newNumElements * elementSize); | |||
| @@ -36,7 +36,7 @@ MemoryBlock::MemoryBlock() throw() | |||
| { | |||
| } | |||
| MemoryBlock::MemoryBlock (const int initialSize, | |||
| MemoryBlock::MemoryBlock (const size_t initialSize, | |||
| const bool initialiseToZero) throw() | |||
| { | |||
| if (initialSize > 0) | |||
| @@ -62,8 +62,8 @@ MemoryBlock::MemoryBlock (const MemoryBlock& other) throw() | |||
| } | |||
| MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom, | |||
| const int sizeInBytes) throw() | |||
| : size (jmax (0, sizeInBytes)) | |||
| const size_t sizeInBytes) throw() | |||
| : size (jmax ((size_t) 0, sizeInBytes)) | |||
| { | |||
| jassert (sizeInBytes >= 0); | |||
| @@ -109,7 +109,7 @@ bool MemoryBlock::operator!= (const MemoryBlock& other) const throw() | |||
| //============================================================================== | |||
| // this will resize the block to this size | |||
| void MemoryBlock::setSize (const int newSize, | |||
| void MemoryBlock::setSize (const size_t newSize, | |||
| const bool initialiseToZero) throw() | |||
| { | |||
| if (size != newSize) | |||
| @@ -138,7 +138,7 @@ void MemoryBlock::setSize (const int newSize, | |||
| } | |||
| } | |||
| void MemoryBlock::ensureSize (const int minimumSize, | |||
| void MemoryBlock::ensureSize (const size_t minimumSize, | |||
| const bool initialiseToZero) throw() | |||
| { | |||
| if (size < minimumSize) | |||
| @@ -158,17 +158,17 @@ void MemoryBlock::fillWith (const uint8 value) throw() | |||
| } | |||
| void MemoryBlock::append (const void* const srcData, | |||
| const int numBytes) throw() | |||
| const size_t numBytes) throw() | |||
| { | |||
| if (numBytes > 0) | |||
| { | |||
| const int oldSize = size; | |||
| const size_t oldSize = size; | |||
| setSize (size + numBytes); | |||
| memcpy (data + oldSize, srcData, numBytes); | |||
| } | |||
| } | |||
| void MemoryBlock::copyFrom (const void* const src, int offset, int num) throw() | |||
| void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw() | |||
| { | |||
| const char* d = (const char*) src; | |||
| @@ -186,7 +186,7 @@ void MemoryBlock::copyFrom (const void* const src, int offset, int num) throw() | |||
| memcpy (data + offset, d, num); | |||
| } | |||
| void MemoryBlock::copyTo (void* const dst, int offset, int num) const throw() | |||
| void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw() | |||
| { | |||
| char* d = (char*) dst; | |||
| @@ -201,7 +201,7 @@ void MemoryBlock::copyTo (void* const dst, int offset, int num) const throw() | |||
| if (offset + num > size) | |||
| { | |||
| const int newNum = size - offset; | |||
| const size_t newNum = size - offset; | |||
| zeromem (d + newNum, num - newNum); | |||
| num = newNum; | |||
| } | |||
| @@ -210,7 +210,7 @@ void MemoryBlock::copyTo (void* const dst, int offset, int num) const throw() | |||
| memcpy (d, data + offset, num); | |||
| } | |||
| void MemoryBlock::removeSection (int startByte, int numBytesToRemove) throw() | |||
| void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove) throw() | |||
| { | |||
| if (startByte < 0) | |||
| { | |||
| @@ -238,17 +238,17 @@ const String MemoryBlock::toString() const throw() | |||
| } | |||
| //============================================================================== | |||
| int MemoryBlock::getBitRange (const int bitRangeStart, int numBits) const throw() | |||
| int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const throw() | |||
| { | |||
| int res = 0; | |||
| int byte = bitRangeStart >> 3; | |||
| int offsetInByte = bitRangeStart & 7; | |||
| int bitsSoFar = 0; | |||
| size_t byte = bitRangeStart >> 3; | |||
| size_t offsetInByte = bitRangeStart & 7; | |||
| size_t bitsSoFar = 0; | |||
| while (numBits > 0 && byte < size) | |||
| while (numBits > 0 && (size_t) byte < size) | |||
| { | |||
| const int bitsThisTime = jmin (numBits, 8 - offsetInByte); | |||
| const size_t bitsThisTime = jmin (numBits, 8 - offsetInByte); | |||
| const int mask = (0xff >> (8 - bitsThisTime)) << offsetInByte; | |||
| res |= (((data[byte] & mask) >> offsetInByte) << bitsSoFar); | |||
| @@ -262,15 +262,15 @@ int MemoryBlock::getBitRange (const int bitRangeStart, int numBits) const throw( | |||
| return res; | |||
| } | |||
| void MemoryBlock::setBitRange (const int bitRangeStart, int numBits, int bitsToSet) throw() | |||
| void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int bitsToSet) throw() | |||
| { | |||
| int byte = bitRangeStart >> 3; | |||
| int offsetInByte = bitRangeStart & 7; | |||
| size_t byte = bitRangeStart >> 3; | |||
| size_t offsetInByte = bitRangeStart & 7; | |||
| unsigned int mask = ~((((unsigned int)0xffffffff) << (32 - numBits)) >> (32 - numBits)); | |||
| while (numBits > 0 && byte < size) | |||
| while (numBits > 0 && (size_t) byte < size) | |||
| { | |||
| const int bitsThisTime = jmin (numBits, 8 - offsetInByte); | |||
| const size_t bitsThisTime = jmin (numBits, 8 - offsetInByte); | |||
| const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int)0xffffffff) >> offsetInByte) << offsetInByte); | |||
| const unsigned int tempBits = bitsToSet << offsetInByte; | |||
| @@ -337,16 +337,16 @@ static const char* const encodingTable | |||
| const String MemoryBlock::toBase64Encoding() const throw() | |||
| { | |||
| const int numChars = ((size << 3) + 5) / 6; | |||
| const size_t numChars = ((size << 3) + 5) / 6; | |||
| String destString (size); // store the length, followed by a '.', and then the data. | |||
| String destString ((unsigned int) size); // store the length, followed by a '.', and then the data. | |||
| const int initialLen = destString.length(); | |||
| destString.preallocateStorage (initialLen + 2 + numChars); | |||
| tchar* d = const_cast <tchar*> (((const tchar*) destString) + initialLen); | |||
| *d++ = T('.'); | |||
| for (int i = 0; i < numChars; ++i) | |||
| for (size_t i = 0; i < numChars; ++i) | |||
| *d++ = encodingTable [getBitRange (i * 6, 6)]; | |||
| *d++ = 0; | |||
| @@ -47,7 +47,7 @@ public: | |||
| @param initialSize the size of block to create | |||
| @param initialiseToZero whether to clear the memory or just leave it uninitialised | |||
| */ | |||
| MemoryBlock (const int initialSize, | |||
| MemoryBlock (const size_t initialSize, | |||
| const bool initialiseToZero = false) throw(); | |||
| /** Creates a copy of another memory block. */ | |||
| @@ -59,7 +59,7 @@ public: | |||
| @param sizeInBytes how much space to use | |||
| */ | |||
| MemoryBlock (const void* const dataToInitialiseFrom, | |||
| const int sizeInBytes) throw(); | |||
| const size_t sizeInBytes) throw(); | |||
| /** Destructor. */ | |||
| ~MemoryBlock() throw(); | |||
| @@ -103,12 +103,13 @@ public: | |||
| This returns a reference, so you can also use it to set a byte. | |||
| */ | |||
| char& operator[] (const int offset) const throw() { return data [offset]; } | |||
| template <typename Type> | |||
| char& operator[] (const Type offset) const throw() { return data [offset]; } | |||
| //============================================================================== | |||
| /** Returns the block's current allocated size, in bytes. */ | |||
| int getSize() const throw() { return size; } | |||
| size_t getSize() const throw() { return size; } | |||
| /** Resizes the memory block. | |||
| @@ -122,7 +123,7 @@ public: | |||
| uninitialised | |||
| @see ensureSize | |||
| */ | |||
| void setSize (const int newSize, | |||
| void setSize (const size_t newSize, | |||
| const bool initialiseNewSpaceToZero = false) throw(); | |||
| /** Increases the block's size only if it's smaller than a given size. | |||
| @@ -134,7 +135,7 @@ public: | |||
| uninitialised | |||
| @see setSize | |||
| */ | |||
| void ensureSize (const int minimumSize, | |||
| void ensureSize (const size_t minimumSize, | |||
| const bool initialiseNewSpaceToZero = false) throw(); | |||
| //============================================================================== | |||
| @@ -149,7 +150,7 @@ public: | |||
| This block's size will be increased accordingly. | |||
| */ | |||
| void append (const void* const data, | |||
| const int numBytes) throw(); | |||
| const size_t numBytes) throw(); | |||
| /** Exchanges the contents of this and another memory block. | |||
| No actual copying is required for this, so it's very fast. | |||
| @@ -166,7 +167,7 @@ public: | |||
| */ | |||
| void copyFrom (const void* srcData, | |||
| int destinationOffset, | |||
| int numBytes) throw(); | |||
| size_t numBytes) throw(); | |||
| /** Copies data from this MemoryBlock to a memory address. | |||
| @@ -177,7 +178,7 @@ public: | |||
| */ | |||
| void copyTo (void* destData, | |||
| int sourceOffset, | |||
| int numBytes) const throw(); | |||
| size_t numBytes) const throw(); | |||
| /** Chops out a section of the block. | |||
| @@ -186,7 +187,7 @@ public: | |||
| If the range specified goes beyond the size of the block, it will be clipped. | |||
| */ | |||
| void removeSection (int startByte, int numBytesToRemove) throw(); | |||
| void removeSection (size_t startByte, size_t numBytesToRemove) throw(); | |||
| //============================================================================== | |||
| /** Attempts to parse the contents of the block as a zero-terminated string of 8-bit | |||
| @@ -205,13 +206,13 @@ public: | |||
| //============================================================================== | |||
| /** Sets a number of bits in the memory block, treating it as a long binary sequence. */ | |||
| void setBitRange (int bitRangeStart, | |||
| int numBits, | |||
| void setBitRange (size_t bitRangeStart, | |||
| size_t numBits, | |||
| int binaryNumberToApply) throw(); | |||
| /** Reads a number of bits from the memory block, treating it as one long binary sequence */ | |||
| int getBitRange (int bitRangeStart, | |||
| int numBitsToRead) const throw(); | |||
| int getBitRange (size_t bitRangeStart, | |||
| size_t numBitsToRead) const throw(); | |||
| //============================================================================== | |||
| /** Returns a string of characters that represent the binary contents of this block. | |||
| @@ -239,7 +240,7 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| HeapBlock <char> data; | |||
| int size; | |||
| size_t size; | |||
| }; | |||
| @@ -378,7 +378,7 @@ const var var::readFromStream (InputStream& input) throw() | |||
| { | |||
| MemoryBlock mb; | |||
| input.readIntoMemoryBlock (mb, numBytes - 1); | |||
| return var (String::fromUTF8 ((const uint8*) mb.getData(), mb.getSize())); | |||
| return var (String::fromUTF8 ((const uint8*) mb.getData(), (int) mb.getSize())); | |||
| } | |||
| default: input.skipNextBytes (numBytes - 1); break; | |||
| @@ -99,58 +99,28 @@ typedef wchar_t juce_wchar; | |||
| // Some indispensible min/max functions | |||
| /** Returns the larger of two values. */ | |||
| forcedinline int jmax (const int a, const int b) throw() { return (a < b) ? b : a; } | |||
| /** Returns the larger of two values. */ | |||
| forcedinline int64 jmax (const int64 a, const int64 b) throw() { return (a < b) ? b : a; } | |||
| /** Returns the larger of two values. */ | |||
| forcedinline float jmax (const float a, const float b) throw() { return (a < b) ? b : a; } | |||
| /** Returns the larger of two values. */ | |||
| forcedinline double jmax (const double a, const double b) throw() { return (a < b) ? b : a; } | |||
| template <typename Type> | |||
| inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; } | |||
| /** Returns the larger of three values. */ | |||
| inline int jmax (const int a, const int b, const int c) throw() { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); } | |||
| /** Returns the larger of three values. */ | |||
| inline int64 jmax (const int64 a, const int64 b, const int64 c) throw() { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); } | |||
| /** Returns the larger of three values. */ | |||
| inline float jmax (const float a, const float b, const float c) throw() { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); } | |||
| /** Returns the larger of three values. */ | |||
| inline double jmax (const double a, const double b, const double c) throw() { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); } | |||
| template <typename Type> | |||
| inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); } | |||
| /** Returns the larger of four values. */ | |||
| inline int jmax (const int a, const int b, const int c, const int d) throw() { return jmax (a, jmax (b, c, d)); } | |||
| /** Returns the larger of four values. */ | |||
| inline int64 jmax (const int64 a, const int64 b, const int64 c, const int64 d) throw() { return jmax (a, jmax (b, c, d)); } | |||
| /** Returns the larger of four values. */ | |||
| inline float jmax (const float a, const float b, const float c, const float d) throw() { return jmax (a, jmax (b, c, d)); } | |||
| /** Returns the larger of four values. */ | |||
| inline double jmax (const double a, const double b, const double c, const double d) throw() { return jmax (a, jmax (b, c, d)); } | |||
| template <typename Type> | |||
| inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); } | |||
| /** Returns the smaller of two values. */ | |||
| inline int jmin (const int a, const int b) throw() { return (a > b) ? b : a; } | |||
| /** Returns the smaller of two values. */ | |||
| inline int64 jmin (const int64 a, const int64 b) throw() { return (a > b) ? b : a; } | |||
| /** Returns the smaller of two values. */ | |||
| inline float jmin (const float a, const float b) throw() { return (a > b) ? b : a; } | |||
| /** Returns the smaller of two values. */ | |||
| inline double jmin (const double a, const double b) throw() { return (a > b) ? b : a; } | |||
| template <typename Type> | |||
| inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; } | |||
| /** Returns the smaller of three values. */ | |||
| inline int jmin (const int a, const int b, const int c) throw() { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); } | |||
| /** Returns the smaller of three values. */ | |||
| inline int64 jmin (const int64 a, const int64 b, const int64 c) throw() { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); } | |||
| /** Returns the smaller of three values. */ | |||
| inline float jmin (const float a, const float b, const float c) throw() { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); } | |||
| /** Returns the smaller of three values. */ | |||
| inline double jmin (const double a, const double b, const double c) throw() { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); } | |||
| template <typename Type> | |||
| inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); } | |||
| /** Returns the smaller of four values. */ | |||
| inline int jmin (const int a, const int b, const int c, const int d) throw() { return jmin (a, jmin (b, c, d)); } | |||
| /** Returns the smaller of four values. */ | |||
| inline int64 jmin (const int64 a, const int64 b, const int64 c, const int64 d) throw() { return jmin (a, jmin (b, c, d)); } | |||
| /** Returns the smaller of four values. */ | |||
| inline float jmin (const float a, const float b, const float c, const float d) throw() { return jmin (a, jmin (b, c, d)); } | |||
| /** Returns the smaller of four values. */ | |||
| inline double jmin (const double a, const double b, const double c, const double d) throw() { return jmin (a, jmin (b, c, d)); } | |||
| template <typename Type> | |||
| inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); } | |||
| //============================================================================== | |||
| @@ -268,19 +238,19 @@ inline bool juce_isfinite (FloatingPointType value) | |||
| //============================================================================== | |||
| /** Fast floating-point-to-integer conversion. | |||
| This is faster than using the normal c++ cast to convert a double to an int, and | |||
| This is faster than using the normal c++ cast to convert a float to an int, and | |||
| it will round the value to the nearest integer, rather than rounding it down | |||
| like the normal cast does. | |||
| Note that this routine gets its speed at the expense of some accuracy, and when | |||
| rounding values whose floating point component is exactly 0.5, odd numbers and | |||
| even numbers will be rounded up or down differently. For a more accurate conversion, | |||
| see roundDoubleToIntAccurate(). | |||
| even numbers will be rounded up or down differently. | |||
| */ | |||
| inline int roundDoubleToInt (const double value) throw() | |||
| template <typename FloatType> | |||
| inline int roundToInt (const FloatType value) throw() | |||
| { | |||
| union { int asInt[2]; double asDouble; } n; | |||
| n.asDouble = value + 6755399441055744.0; | |||
| n.asDouble = ((double) value) + 6755399441055744.0; | |||
| #if JUCE_BIG_ENDIAN | |||
| return n.asInt [1]; | |||
| @@ -294,9 +264,25 @@ inline int roundDoubleToInt (const double value) throw() | |||
| This is a slightly slower and slightly more accurate version of roundDoubleToInt(). It works | |||
| fine for values above zero, but negative numbers are rounded the wrong way. | |||
| */ | |||
| inline int roundDoubleToIntAccurate (const double value) throw() | |||
| inline int roundToIntAccurate (const double value) throw() | |||
| { | |||
| return roundToInt (value + 1.5e-8); | |||
| } | |||
| /** Fast floating-point-to-integer conversion. | |||
| This is faster than using the normal c++ cast to convert a double to an int, and | |||
| it will round the value to the nearest integer, rather than rounding it down | |||
| like the normal cast does. | |||
| Note that this routine gets its speed at the expense of some accuracy, and when | |||
| rounding values whose floating point component is exactly 0.5, odd numbers and | |||
| even numbers will be rounded up or down differently. For a more accurate conversion, | |||
| see roundDoubleToIntAccurate(). | |||
| */ | |||
| inline int roundDoubleToInt (const double value) throw() | |||
| { | |||
| return roundDoubleToInt (value + 1.5e-8); | |||
| return roundToInt (value); | |||
| } | |||
| /** Fast floating-point-to-integer conversion. | |||
| @@ -311,16 +297,10 @@ inline int roundDoubleToIntAccurate (const double value) throw() | |||
| */ | |||
| inline int roundFloatToInt (const float value) throw() | |||
| { | |||
| union { int asInt[2]; double asDouble; } n; | |||
| n.asDouble = value + 6755399441055744.0; | |||
| #if JUCE_BIG_ENDIAN | |||
| return n.asInt [1]; | |||
| #else | |||
| return n.asInt [0]; | |||
| #endif | |||
| return roundToInt (value); | |||
| } | |||
| //============================================================================== | |||
| #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__ | |||
| @@ -200,7 +200,7 @@ | |||
| //============================================================================== | |||
| /** Clears a block of memory. */ | |||
| inline void zeromem (void* memory, int numBytes) { memset (memory, 0, numBytes); } | |||
| inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); } | |||
| /** Clears a reference to a local structure. */ | |||
| template <typename Type> | |||
| @@ -58,7 +58,7 @@ MD5::MD5 (const MemoryBlock& data) | |||
| context.finish (result); | |||
| } | |||
| MD5::MD5 (const char* data, const int numBytes) | |||
| MD5::MD5 (const char* data, const size_t numBytes) | |||
| { | |||
| ProcessContext context; | |||
| context.processBlock ((const uint8*) data, numBytes); | |||
| @@ -86,7 +86,7 @@ MD5::MD5 (const String& text) | |||
| context.finish (result); | |||
| } | |||
| void MD5::processStream (InputStream& input, int numBytesToRead) | |||
| void MD5::processStream (InputStream& input, int64 numBytesToRead) | |||
| { | |||
| ProcessContext context; | |||
| @@ -96,7 +96,7 @@ void MD5::processStream (InputStream& input, int numBytesToRead) | |||
| while (numBytesToRead > 0) | |||
| { | |||
| char tempBuffer [512]; | |||
| const int bytesRead = input.read (tempBuffer, jmin (numBytesToRead, sizeof (tempBuffer))); | |||
| const int bytesRead = input.read (tempBuffer, (int) jmin ((size_t) numBytesToRead, sizeof (tempBuffer))); | |||
| if (bytesRead <= 0) | |||
| break; | |||
| @@ -109,7 +109,7 @@ void MD5::processStream (InputStream& input, int numBytesToRead) | |||
| context.finish (result); | |||
| } | |||
| MD5::MD5 (InputStream& input, int numBytesToRead) | |||
| MD5::MD5 (InputStream& input, int64 numBytesToRead) | |||
| { | |||
| processStream (input, numBytesToRead); | |||
| } | |||
| @@ -140,20 +140,20 @@ MD5::ProcessContext::ProcessContext() | |||
| count[1] = 0; | |||
| } | |||
| void MD5::ProcessContext::processBlock (const uint8* const data, int dataSize) | |||
| void MD5::ProcessContext::processBlock (const uint8* const data, size_t dataSize) | |||
| { | |||
| int bufferPos = ((count[0] >> 3) & 0x3F); | |||
| count[0] += (dataSize << 3); | |||
| count[0] += (uint32) (dataSize << 3); | |||
| if (count[0] < ((uint32) dataSize << 3)) | |||
| count[1]++; | |||
| count[1] += (dataSize >> 29); | |||
| count[1] += (uint32) (dataSize >> 29); | |||
| const int spaceLeft = 64 - bufferPos; | |||
| const size_t spaceLeft = 64 - bufferPos; | |||
| int i = 0; | |||
| size_t i = 0; | |||
| if (dataSize >= spaceLeft) | |||
| { | |||
| @@ -58,7 +58,7 @@ public: | |||
| MD5 (const MemoryBlock& data); | |||
| /** Creates a checksum for a block of binary data. */ | |||
| MD5 (const char* data, const int numBytes); | |||
| MD5 (const char* data, const size_t numBytes); | |||
| /** Creates a checksum for a string. | |||
| @@ -76,7 +76,7 @@ public: | |||
| checksum of that. If the number of bytes to read is negative, it'll read | |||
| until the stream is exhausted. | |||
| */ | |||
| MD5 (InputStream& input, int numBytesToRead = -1); | |||
| MD5 (InputStream& input, int64 numBytesToRead = -1); | |||
| /** Creates a checksum for a file. */ | |||
| MD5 (const File& file); | |||
| @@ -114,12 +114,12 @@ private: | |||
| ProcessContext(); | |||
| void processBlock (const uint8* const data, int dataSize); | |||
| void processBlock (const uint8* const data, size_t dataSize); | |||
| void transform (const uint8* const buffer); | |||
| void finish (uint8* const result); | |||
| }; | |||
| void processStream (InputStream& input, int numBytesToRead); | |||
| void processStream (InputStream& input, int64 numBytesToRead); | |||
| }; | |||
| @@ -168,17 +168,17 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message) | |||
| messageData.copyFrom (messageHeader, 0, sizeof (messageHeader)); | |||
| messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize()); | |||
| int bytesWritten = 0; | |||
| size_t bytesWritten = 0; | |||
| const ScopedLock sl (pipeAndSocketLock); | |||
| if (socket != 0) | |||
| { | |||
| bytesWritten = socket->write (messageData.getData(), messageData.getSize()); | |||
| bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); | |||
| } | |||
| else if (pipe != 0) | |||
| { | |||
| bytesWritten = pipe->write (messageData.getData(), messageData.getSize()); | |||
| bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize()); | |||
| } | |||
| if (bytesWritten < 0) | |||
| @@ -680,7 +680,7 @@ void Button::repeatTimerCallback() throw() | |||
| const uint32 now = Time::getApproximateMillisecondCounter(); | |||
| const int numTimesToCallback | |||
| = (now > lastTimeCallbackTime) ? jmax (1, (now - lastTimeCallbackTime) / repeatSpeed) : 1; | |||
| = (now > lastTimeCallbackTime) ? jmax ((uint32) 1, (now - lastTimeCallbackTime) / repeatSpeed) : 1; | |||
| lastTimeCallbackTime = now; | |||
| @@ -98,7 +98,7 @@ void ImageButton::setImages (const bool resizeButtonNowToFitThisImage, | |||
| downOpacity = imageOpacityWhenDown; | |||
| downOverlay = overlayColourWhenDown; | |||
| alphaThreshold = (unsigned char) jlimit (0, 0xff, roundFloatToInt (255.0f * hitTestAlphaThreshold)); | |||
| alphaThreshold = (unsigned char) jlimit (0, 0xff, roundToInt (255.0f * hitTestAlphaThreshold)); | |||
| repaint(); | |||
| } | |||
| @@ -162,13 +162,13 @@ void ImageButton::paintButton (Graphics& g, | |||
| if (imRatio > destRatio) | |||
| { | |||
| newW = roundFloatToInt (imageH / imRatio); | |||
| newW = roundToInt (imageH / imRatio); | |||
| newH = imageH; | |||
| } | |||
| else | |||
| { | |||
| newW = imageW; | |||
| newH = roundFloatToInt (imageW * imRatio); | |||
| newH = roundToInt (imageW * imRatio); | |||
| } | |||
| imageX = (imageW - newW) / 2; | |||
| @@ -151,8 +151,8 @@ public: | |||
| if (highlightColumnStart < highlightColumnEnd) | |||
| { | |||
| g.setColour (highlightColour); | |||
| g.fillRect (roundFloatToInt (x + highlightColumnStart * owner.getCharWidth()), y, | |||
| roundFloatToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight); | |||
| g.fillRect (roundToInt (x + highlightColumnStart * owner.getCharWidth()), y, | |||
| roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight); | |||
| } | |||
| int lastType = INT_MIN; | |||
| @@ -167,7 +167,7 @@ public: | |||
| g.setColour (owner.getColourForTokenType (lastType)); | |||
| } | |||
| g.drawSingleLineText (token->text, roundFloatToInt (x), y + baselineOffset); | |||
| g.drawSingleLineText (token->text, roundToInt (x), y + baselineOffset); | |||
| if (i < tokens.size() - 1) | |||
| { | |||
| @@ -590,16 +590,16 @@ void CodeEditorComponent::scrollToKeepCaretOnScreen() | |||
| const Rectangle CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const throw() | |||
| { | |||
| return Rectangle (roundDoubleToInt ((gutter - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth), | |||
| return Rectangle (roundToInt ((gutter - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth), | |||
| (pos.getLineNumber() - firstLineOnScreen) * lineHeight, | |||
| roundFloatToInt (charWidth), | |||
| roundToInt (charWidth), | |||
| lineHeight); | |||
| } | |||
| const CodeDocument::Position CodeEditorComponent::getPositionAt (int x, int y) | |||
| { | |||
| const int line = y / lineHeight + firstLineOnScreen; | |||
| const int column = roundDoubleToInt ((x - (gutter - xOffset * charWidth)) / charWidth); | |||
| const int column = roundToInt ((x - (gutter - xOffset * charWidth)) / charWidth); | |||
| const int index = columnToIndex (line, column); | |||
| return CodeDocument::Position (&document, line, index); | |||
| @@ -1095,7 +1095,7 @@ void CodeEditorComponent::setFont (const Font& newFont) | |||
| { | |||
| font = newFont; | |||
| charWidth = font.getStringWidthFloat (T("0")); | |||
| lineHeight = roundFloatToInt (font.getHeight()); | |||
| lineHeight = roundToInt (font.getHeight()); | |||
| resized(); | |||
| } | |||
| @@ -672,7 +672,7 @@ void ListBox::setVerticalPosition (const double proportion) | |||
| const int offscreen = viewport->getViewedComponent()->getHeight() - viewport->getHeight(); | |||
| viewport->setViewPosition (viewport->getViewPositionX(), | |||
| jmax (0, roundDoubleToInt (proportion * offscreen))); | |||
| jmax (0, roundToInt (proportion * offscreen))); | |||
| } | |||
| double ListBox::getVerticalPosition() const | |||
| @@ -74,7 +74,7 @@ void ProgressBar::paint (Graphics& g) | |||
| if (displayPercentage) | |||
| { | |||
| if (currentValue >= 0 && currentValue <= 1.0) | |||
| text << roundDoubleToInt (currentValue * 100.0) << T("%"); | |||
| text << roundToInt (currentValue * 100.0) << T("%"); | |||
| } | |||
| else | |||
| { | |||
| @@ -641,7 +641,7 @@ const String Slider::getTextFromValue (double v) | |||
| if (numDecimalPlaces > 0) | |||
| return String (v, numDecimalPlaces) + textSuffix; | |||
| else | |||
| return String (roundDoubleToInt (v)) + textSuffix; | |||
| return String (roundToInt (v)) + textSuffix; | |||
| } | |||
| double Slider::getValueFromText (const String& text) | |||
| @@ -1157,14 +1157,14 @@ void Slider::restoreMouseIfHidden() | |||
| if (style == RotaryHorizontalDrag) | |||
| { | |||
| const double posDiff = valueToProportionOfLength (pos) - valueToProportionOfLength (valueOnMouseDown); | |||
| x = roundDoubleToInt (pixelsForFullDragExtent * posDiff + downX); | |||
| x = roundToInt (pixelsForFullDragExtent * posDiff + downX); | |||
| y = downY; | |||
| } | |||
| else | |||
| { | |||
| const double posDiff = valueToProportionOfLength (valueOnMouseDown) - valueToProportionOfLength (pos); | |||
| x = downX; | |||
| y = roundDoubleToInt (pixelsForFullDragExtent * posDiff + downY); | |||
| y = roundToInt (pixelsForFullDragExtent * posDiff + downY); | |||
| } | |||
| Desktop::setMousePosition (x, y); | |||
| @@ -228,7 +228,7 @@ public: | |||
| break; | |||
| const int start = jmax (0, startCharacter - index); | |||
| const int end = jmin (endCharacter - index, atom->numChars); | |||
| const int end = jmin (endCharacter - index, (int) atom->numChars); | |||
| if (start < end) | |||
| concatenator.append (atom->atomText.substring (start, end)); | |||
| @@ -603,7 +603,7 @@ public: | |||
| ga.addLineOfText (currentSection->font, | |||
| atom->getTrimmedText (passwordCharacter), | |||
| atomX, | |||
| (float) roundFloatToInt (lineY + lineHeight - maxDescent)); | |||
| (float) roundToInt (lineY + lineHeight - maxDescent)); | |||
| ga.draw (g); | |||
| } | |||
| } | |||
| @@ -612,11 +612,11 @@ public: | |||
| const int selectionStart, | |||
| const int selectionEnd) const | |||
| { | |||
| const int startX = roundFloatToInt (indexToX (selectionStart)); | |||
| const int endX = roundFloatToInt (indexToX (selectionEnd)); | |||
| const int startX = roundToInt (indexToX (selectionStart)); | |||
| const int endX = roundToInt (indexToX (selectionEnd)); | |||
| const int y = roundFloatToInt (lineY); | |||
| const int nextY = roundFloatToInt (lineY + lineHeight); | |||
| const int y = roundToInt (lineY); | |||
| const int nextY = roundToInt (lineY + lineHeight); | |||
| g.fillRect (startX, y, endX - startX, nextY - y); | |||
| } | |||
| @@ -632,7 +632,7 @@ public: | |||
| ga.addLineOfText (currentSection->font, | |||
| atom->getTrimmedText (passwordCharacter), | |||
| atomX, | |||
| (float) roundFloatToInt (lineY + lineHeight - maxDescent)); | |||
| (float) roundToInt (lineY + lineHeight - maxDescent)); | |||
| if (selectionEnd < indexInText + atom->numChars) | |||
| { | |||
| @@ -1299,10 +1299,10 @@ void TextEditor::timerCallbackInt() | |||
| void TextEditor::repaintCaret() | |||
| { | |||
| if (! findColour (caretColourId).isTransparent()) | |||
| repaint (borderSize.getLeft() + textHolder->getX() + leftIndent + roundFloatToInt (cursorX) - 1, | |||
| borderSize.getTop() + textHolder->getY() + topIndent + roundFloatToInt (cursorY) - 1, | |||
| repaint (borderSize.getLeft() + textHolder->getX() + leftIndent + roundToInt (cursorX) - 1, | |||
| borderSize.getTop() + textHolder->getY() + topIndent + roundToInt (cursorY) - 1, | |||
| 4, | |||
| roundFloatToInt (cursorHeight) + 2); | |||
| roundToInt (cursorHeight) + 2); | |||
| } | |||
| void TextEditor::repaintText (int textStartIndex, int textEndIndex) | |||
| @@ -1372,8 +1372,8 @@ void TextEditor::scrollEditorToPositionCaret (const int desiredCaretX, | |||
| { | |||
| updateCaretPosition(); | |||
| int vx = roundFloatToInt (cursorX) - desiredCaretX; | |||
| int vy = roundFloatToInt (cursorY) - desiredCaretY; | |||
| int vx = roundToInt (cursorX) - desiredCaretX; | |||
| int vy = roundToInt (cursorY) - desiredCaretY; | |||
| if (desiredCaretX < jmax (1, proportionOfWidth (0.05f))) | |||
| { | |||
| @@ -1394,7 +1394,7 @@ void TextEditor::scrollEditorToPositionCaret (const int desiredCaretX, | |||
| { | |||
| vy = jlimit (0, jmax (0, textHolder->getHeight() - viewport->getMaximumVisibleHeight()), vy); | |||
| const int curH = roundFloatToInt (cursorHeight); | |||
| const int curH = roundToInt (cursorHeight); | |||
| if (desiredCaretY < 0) | |||
| { | |||
| @@ -1413,9 +1413,9 @@ const Rectangle TextEditor::getCaretRectangle() | |||
| { | |||
| updateCaretPosition(); | |||
| return Rectangle (roundFloatToInt (cursorX) - viewport->getX(), | |||
| roundFloatToInt (cursorY) - viewport->getY(), | |||
| 1, roundFloatToInt (cursorHeight)); | |||
| return Rectangle (roundToInt (cursorX) - viewport->getX(), | |||
| roundToInt (cursorY) - viewport->getY(), | |||
| 1, roundToInt (cursorHeight)); | |||
| } | |||
| //============================================================================== | |||
| @@ -1438,9 +1438,9 @@ void TextEditor::updateTextHolderSize() | |||
| while (i.next()) | |||
| maxWidth = jmax (maxWidth, i.atomRight); | |||
| const int w = leftIndent + roundFloatToInt (maxWidth); | |||
| const int h = topIndent + roundFloatToInt (jmax (i.lineY + i.lineHeight, | |||
| currentFont.getHeight())); | |||
| const int w = leftIndent + roundToInt (maxWidth); | |||
| const int h = topIndent + roundToInt (jmax (i.lineY + i.lineHeight, | |||
| currentFont.getHeight())); | |||
| textHolder->setSize (w + 1, h + 1); | |||
| } | |||
| @@ -1494,8 +1494,8 @@ void TextEditor::scrollToMakeSureCursorIsVisible() | |||
| int x = viewport->getViewPositionX(); | |||
| int y = viewport->getViewPositionY(); | |||
| const int relativeCursorX = roundFloatToInt (cursorX) - x; | |||
| const int relativeCursorY = roundFloatToInt (cursorY) - y; | |||
| const int relativeCursorX = roundToInt (cursorX) - x; | |||
| const int relativeCursorY = roundToInt (cursorY) - y; | |||
| if (relativeCursorX < jmax (1, proportionOfWidth (0.05f))) | |||
| { | |||
| @@ -1514,7 +1514,7 @@ void TextEditor::scrollToMakeSureCursorIsVisible() | |||
| } | |||
| else | |||
| { | |||
| const int curH = roundFloatToInt (cursorHeight); | |||
| const int curH = roundToInt (cursorHeight); | |||
| if (relativeCursorY < 0) | |||
| { | |||
| @@ -2165,7 +2165,7 @@ void TextEditor::focusLost (FocusChangeType) | |||
| void TextEditor::resized() | |||
| { | |||
| viewport->setBoundsInset (borderSize); | |||
| viewport->setSingleStepSizes (16, roundFloatToInt (currentFont.getHeight())); | |||
| viewport->setSingleStepSizes (16, roundToInt (currentFont.getHeight())); | |||
| updateTextHolderSize(); | |||
| @@ -68,7 +68,7 @@ public: | |||
| } | |||
| else | |||
| { | |||
| maxSize = roundFloatToInt (toolbarThickness * fixedSize); | |||
| maxSize = roundToInt (toolbarThickness * fixedSize); | |||
| minSize = drawBar ? maxSize : jmin (4, maxSize); | |||
| preferredSize = maxSize; | |||
| @@ -167,7 +167,7 @@ void FileChooserDialogBox::ContentComponent::resized() | |||
| float left, top, right, bottom; | |||
| text.getBoundingBox (0, text.getNumGlyphs(), left, top, right, bottom, false); | |||
| const int y = roundFloatToInt (bottom) + 10; | |||
| const int y = roundToInt (bottom) + 10; | |||
| const int buttonHeight = 26; | |||
| const int buttonY = getHeight() - buttonHeight - 8; | |||
| @@ -51,8 +51,8 @@ void ImagePreviewComponent::getThumbSize (int& w, int& h) const | |||
| availableW / (double) w, | |||
| availableH / (double) h); | |||
| w = roundDoubleToInt (scale * w); | |||
| h = roundDoubleToInt (scale * h); | |||
| w = roundToInt (scale * w); | |||
| h = roundToInt (scale * h); | |||
| } | |||
| void ImagePreviewComponent::selectedFileChanged (const File& file) | |||
| @@ -361,11 +361,11 @@ public: | |||
| centreY += yChangePerMs * msPassed; | |||
| scale += scaleChangePerMs * msPassed; | |||
| const int w = roundFloatToInt (image->getWidth() * scale); | |||
| const int h = roundFloatToInt (image->getHeight() * scale); | |||
| const int w = roundToInt (image->getWidth() * scale); | |||
| const int h = roundToInt (image->getHeight() * scale); | |||
| setBounds (roundFloatToInt (centreX) - w / 2, | |||
| roundFloatToInt (centreY) - h / 2, | |||
| setBounds (roundToInt (centreX) - w / 2, | |||
| roundToInt (centreY) - h / 2, | |||
| w, h); | |||
| } | |||
| @@ -763,12 +763,12 @@ bool Component::isAlwaysOnTop() const throw() | |||
| //============================================================================== | |||
| int Component::proportionOfWidth (const float proportion) const throw() | |||
| { | |||
| return roundDoubleToInt (proportion * bounds_.getWidth()); | |||
| return roundToInt (proportion * bounds_.getWidth()); | |||
| } | |||
| int Component::proportionOfHeight (const float proportion) const throw() | |||
| { | |||
| return roundDoubleToInt (proportion * bounds_.getHeight()); | |||
| return roundToInt (proportion * bounds_.getHeight()); | |||
| } | |||
| int Component::getParentWidth() const throw() | |||
| @@ -984,10 +984,10 @@ void Component::setBoundsRelative (const float x, const float y, | |||
| const int pw = getParentWidth(); | |||
| const int ph = getParentHeight(); | |||
| setBounds (roundFloatToInt (x * pw), | |||
| roundFloatToInt (y * ph), | |||
| roundFloatToInt (w * pw), | |||
| roundFloatToInt (h * ph)); | |||
| setBounds (roundToInt (x * pw), | |||
| roundToInt (y * ph), | |||
| roundToInt (w * pw), | |||
| roundToInt (h * ph)); | |||
| } | |||
| void Component::setCentrePosition (const int x, const int y) | |||
| @@ -998,8 +998,8 @@ void Component::setCentrePosition (const int x, const int y) | |||
| void Component::setCentreRelative (const float x, const float y) | |||
| { | |||
| setCentrePosition (roundFloatToInt (getParentWidth() * x), | |||
| roundFloatToInt (getParentHeight() * y)); | |||
| setCentrePosition (roundToInt (getParentWidth() * x), | |||
| roundToInt (getParentHeight() * y)); | |||
| } | |||
| void Component::centreWithSize (const int width, const int height) | |||
| @@ -1044,12 +1044,12 @@ void Component::setBoundsToFit (int x, int y, int width, int height, | |||
| if (imageRatio <= targetRatio) | |||
| { | |||
| newW = width; | |||
| newH = jmin (height, roundDoubleToInt (newW * imageRatio)); | |||
| newH = jmin (height, roundToInt (newW * imageRatio)); | |||
| } | |||
| else | |||
| { | |||
| newH = height; | |||
| newW = jmin (width, roundDoubleToInt (newH / imageRatio)); | |||
| newW = jmin (width, roundToInt (newH / imageRatio)); | |||
| } | |||
| } | |||
| @@ -2014,7 +2014,7 @@ private: | |||
| Component* parentComponent_; | |||
| uint32 componentUID; | |||
| Rectangle bounds_; | |||
| unsigned short numDeepMouseListeners; | |||
| int numDeepMouseListeners; | |||
| Array <Component*> childComponentList_; | |||
| LookAndFeel* lookAndFeel_; | |||
| MouseCursor cursor_; | |||
| @@ -68,10 +68,10 @@ struct AnimationTask | |||
| if (delta < 1.0) | |||
| { | |||
| const Rectangle newBounds (roundDoubleToInt (left), | |||
| roundDoubleToInt (top), | |||
| roundDoubleToInt (right - left), | |||
| roundDoubleToInt (bottom - top)); | |||
| const Rectangle newBounds (roundToInt (left), | |||
| roundToInt (top), | |||
| roundToInt (right - left), | |||
| roundToInt (bottom - top)); | |||
| if (newBounds != destination) | |||
| { | |||
| @@ -259,22 +259,22 @@ void ComponentBoundsConstrainer::checkBounds (int& x, int& y, int& w, int& h, | |||
| if (adjustWidth) | |||
| { | |||
| w = roundDoubleToInt (h * aspectRatio); | |||
| w = roundToInt (h * aspectRatio); | |||
| if (w > maxW || w < minW) | |||
| { | |||
| w = jlimit (minW, maxW, w); | |||
| h = roundDoubleToInt (w / aspectRatio); | |||
| h = roundToInt (w / aspectRatio); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| h = roundDoubleToInt (w / aspectRatio); | |||
| h = roundToInt (w / aspectRatio); | |||
| if (h > maxH || h < minH) | |||
| { | |||
| h = jlimit (minH, maxH, h); | |||
| w = roundDoubleToInt (h * aspectRatio); | |||
| w = roundToInt (h * aspectRatio); | |||
| } | |||
| } | |||
| @@ -213,8 +213,8 @@ void ScrollBar::handleAsyncUpdate() | |||
| //============================================================================== | |||
| void ScrollBar::updateThumbPosition() throw() | |||
| { | |||
| int newThumbSize = roundDoubleToInt ((maximum > minimum) ? (rangeSize * thumbAreaSize) / (maximum - minimum) | |||
| : thumbAreaSize); | |||
| int newThumbSize = roundToInt ((maximum > minimum) ? (rangeSize * thumbAreaSize) / (maximum - minimum) | |||
| : thumbAreaSize); | |||
| if (newThumbSize < getLookAndFeel().getMinimumScrollbarThumbSize (*this)) | |||
| newThumbSize = jmin (getLookAndFeel().getMinimumScrollbarThumbSize (*this), thumbAreaSize - 1); | |||
| @@ -225,8 +225,8 @@ void ScrollBar::updateThumbPosition() throw() | |||
| int newThumbStart = thumbAreaStart; | |||
| if (maximum - minimum > rangeSize) | |||
| newThumbStart += roundDoubleToInt (((rangeStart - minimum) * (thumbAreaSize - newThumbSize)) | |||
| / ((maximum - minimum) - rangeSize)); | |||
| newThumbStart += roundToInt (((rangeStart - minimum) * (thumbAreaSize - newThumbSize)) | |||
| / ((maximum - minimum) - rangeSize)); | |||
| setVisible (alwaysVisible || (maximum - minimum > rangeSize && rangeSize > 0.0)); | |||
| @@ -275,7 +275,7 @@ int StretchableLayoutManager::fitComponentsIntoSpace (const int startIndex, | |||
| const int bestSize = jlimit (layout->currentSize, | |||
| jmax (layout->currentSize, | |||
| sizeToRealSize (layout->maxSize, totalSize)), | |||
| roundDoubleToInt (sizeWanted * availableSpace / totalIdealSize)); | |||
| roundToInt (sizeWanted * availableSpace / totalIdealSize)); | |||
| if (bestSize > layout->currentSize) | |||
| ++numWantingMoreSpace; | |||
| @@ -290,7 +290,7 @@ int StretchableLayoutManager::fitComponentsIntoSpace (const int startIndex, | |||
| int bestSize = jlimit (layout->currentSize, | |||
| jmax (layout->currentSize, sizeToRealSize (layout->maxSize, totalSize)), | |||
| roundDoubleToInt (sizeWanted * availableSpace / totalIdealSize)); | |||
| roundToInt (sizeWanted * availableSpace / totalIdealSize)); | |||
| const int extraWanted = bestSize - layout->currentSize; | |||
| @@ -362,7 +362,7 @@ int StretchableLayoutManager::sizeToRealSize (double size, int totalSpace) | |||
| if (size < 0) | |||
| size *= -totalSpace; | |||
| return roundDoubleToInt (size); | |||
| return roundToInt (size); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -458,7 +458,7 @@ void TabbedButtonBar::resized() | |||
| if (tb != 0) | |||
| { | |||
| const int bestLength = roundDoubleToInt (scale * tb->getBestTabLength (depth)); | |||
| const int bestLength = roundToInt (scale * tb->getBestTabLength (depth)); | |||
| if (i < numVisibleButtons) | |||
| { | |||
| @@ -120,8 +120,8 @@ void Viewport::setViewPositionProportionately (const double x, | |||
| const double y) | |||
| { | |||
| if (contentComp != 0) | |||
| setViewPosition (jmax (0, roundDoubleToInt (x * (contentComp->getWidth() - getWidth()))), | |||
| jmax (0, roundDoubleToInt (y * (contentComp->getHeight() - getHeight())))); | |||
| setViewPosition (jmax (0, roundToInt (x * (contentComp->getWidth() - getWidth()))), | |||
| jmax (0, roundToInt (y * (contentComp->getHeight() - getHeight())))); | |||
| } | |||
| bool Viewport::autoScroll (int mouseX, int mouseY, int activeBorderThickness, int maximumSpeed) | |||
| @@ -290,11 +290,11 @@ void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double ne | |||
| { | |||
| if (scrollBarThatHasMoved == horizontalScrollBar) | |||
| { | |||
| setViewPosition (roundDoubleToInt (newRangeStart), getViewPositionY()); | |||
| setViewPosition (roundToInt (newRangeStart), getViewPositionY()); | |||
| } | |||
| else if (scrollBarThatHasMoved == verticalScrollBar) | |||
| { | |||
| setViewPosition (getViewPositionX(), roundDoubleToInt (newRangeStart)); | |||
| setViewPosition (getViewPositionX(), roundToInt (newRangeStart)); | |||
| } | |||
| } | |||
| @@ -394,7 +394,7 @@ void LookAndFeel::drawButtonText (Graphics& g, TextButton& button, | |||
| const int yIndent = jmin (4, button.proportionOfHeight (0.3f)); | |||
| const int cornerSize = jmin (button.getHeight(), button.getWidth()) / 2; | |||
| const int fontHeight = roundFloatToInt (font.getHeight() * 0.6f); | |||
| const int fontHeight = roundToInt (font.getHeight() * 0.6f); | |||
| const int leftIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnLeft() ? 4 : 2)); | |||
| const int rightIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnRight() ? 4 : 2)); | |||
| @@ -976,7 +976,7 @@ void LookAndFeel::getIdealPopupMenuItemSize (const String& text, | |||
| if (standardMenuItemHeight > 0 && font.getHeight() > standardMenuItemHeight / 1.3f) | |||
| font.setHeight (standardMenuItemHeight / 1.3f); | |||
| idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundFloatToInt (font.getHeight() * 1.3f); | |||
| idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f); | |||
| idealWidth = font.getStringWidth (text) + idealHeight * 2; | |||
| } | |||
| } | |||
| @@ -2056,9 +2056,9 @@ void LookAndFeel::drawGroupComponentOutline (Graphics& g, int width, int height, | |||
| .withMultipliedAlpha (alpha)); | |||
| g.setFont (f); | |||
| g.drawText (text, | |||
| roundFloatToInt (x + textX), 0, | |||
| roundFloatToInt (textW), | |||
| roundFloatToInt (textH), | |||
| roundToInt (x + textX), 0, | |||
| roundToInt (textW), | |||
| roundToInt (textH), | |||
| Justification::centred, true); | |||
| } | |||
| @@ -2579,8 +2579,8 @@ void LookAndFeel::drawFileBrowserRow (Graphics& g, int width, int height, | |||
| if (width > 450 && ! isDirectory) | |||
| { | |||
| const int sizeX = roundFloatToInt (width * 0.7f); | |||
| const int dateX = roundFloatToInt (width * 0.8f); | |||
| const int sizeX = roundToInt (width * 0.7f); | |||
| const int dateX = roundToInt (width * 0.8f); | |||
| g.drawFittedText (filename, | |||
| x, 0, sizeX - x, height, | |||
| @@ -2755,7 +2755,7 @@ void LookAndFeel::drawLevelMeter (Graphics& g, int width, int height, float leve | |||
| g.drawRoundedRectangle (1.0f, 1.0f, width - 2.0f, height - 2.0f, 3.0f, 1.0f); | |||
| const int totalBlocks = 7; | |||
| const int numBlocks = roundDoubleToInt (totalBlocks * level); | |||
| const int numBlocks = roundToInt (totalBlocks * level); | |||
| const float w = (width - 6.0f) / (float) totalBlocks; | |||
| for (int i = 0; i < totalBlocks; ++i) | |||
| @@ -80,8 +80,8 @@ void OldSchoolLookAndFeel::drawButtonBackground (Graphics& g, | |||
| const int height = button.getHeight(); | |||
| const float indent = 2.0f; | |||
| const int cornerSize = jmin (roundFloatToInt (width * 0.4f), | |||
| roundFloatToInt (height * 0.4f)); | |||
| const int cornerSize = jmin (roundToInt (width * 0.4f), | |||
| roundToInt (height * 0.4f)); | |||
| Path p; | |||
| p.addRoundedRectangle (indent, indent, | |||
| @@ -193,7 +193,7 @@ void OldSchoolLookAndFeel::drawProgressBar (Graphics& g, ProgressBar& progressBa | |||
| g.setColour (foreground); | |||
| g.fillRect (1, 1, | |||
| jlimit (0, width - 2, roundDoubleToInt (progress * (width - 2))), | |||
| jlimit (0, width - 2, roundToInt (progress * (width - 2))), | |||
| height - 2); | |||
| if (textToShow.isNotEmpty()) | |||
| @@ -273,8 +273,8 @@ void OldSchoolLookAndFeel::drawScrollbar (Graphics& g, | |||
| if (isScrollbarVertical) | |||
| { | |||
| width -= 2; | |||
| g.fillRect (x + roundFloatToInt (width * 0.35f), y, | |||
| roundFloatToInt (width * 0.3f), height); | |||
| g.fillRect (x + roundToInt (width * 0.35f), y, | |||
| roundToInt (width * 0.3f), height); | |||
| thumb.setBounds (x + 1, thumbStartPosition, | |||
| width - 2, thumbSize); | |||
| @@ -282,8 +282,8 @@ void OldSchoolLookAndFeel::drawScrollbar (Graphics& g, | |||
| else | |||
| { | |||
| height -= 2; | |||
| g.fillRect (x, y + roundFloatToInt (height * 0.35f), | |||
| width, roundFloatToInt (height * 0.3f)); | |||
| g.fillRect (x, y + roundToInt (height * 0.35f), | |||
| width, roundToInt (height * 0.3f)); | |||
| thumb.setBounds (thumbStartPosition, y + 1, | |||
| thumbSize, height - 2); | |||
| @@ -434,13 +434,13 @@ void OldSchoolLookAndFeel::drawLinearSlider (Graphics& g, | |||
| if (slider.isHorizontal()) | |||
| { | |||
| g.fillRect (x, y + roundFloatToInt (h * 0.6f), | |||
| w, roundFloatToInt (h * 0.2f)); | |||
| g.fillRect (x, y + roundToInt (h * 0.6f), | |||
| w, roundToInt (h * 0.2f)); | |||
| } | |||
| else | |||
| { | |||
| g.fillRect (x + roundFloatToInt (w * 0.5f - jmin (3.0f, w * 0.1f)), y, | |||
| jmin (4, roundFloatToInt (w * 0.2f)), h); | |||
| g.fillRect (x + roundToInt (w * 0.5f - jmin (3.0f, w * 0.1f)), y, | |||
| jmin (4, roundToInt (w * 0.2f)), h); | |||
| } | |||
| float alpha = 0.35f; | |||
| @@ -505,7 +505,7 @@ public: | |||
| void mouseWheelMove (const MouseEvent&, float /*amountX*/, float amountY) | |||
| { | |||
| alterChildYPos (roundFloatToInt (-10.0f * amountY * scrollZone)); | |||
| alterChildYPos (roundToInt (-10.0f * amountY * scrollZone)); | |||
| lastMouseX = -1; | |||
| } | |||
| @@ -389,7 +389,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription, | |||
| for (int x = dragImage->getWidth(); --x >= 0;) | |||
| { | |||
| const int dx = x - cx; | |||
| const int distance = roundDoubleToInt (sqrt (dx * dx + dy)); | |||
| const int distance = roundToInt (sqrt (dx * dx + dy)); | |||
| if (distance > lo) | |||
| { | |||
| @@ -88,8 +88,8 @@ int MouseEvent::getDistanceFromDragStartY() const throw() | |||
| int MouseEvent::getDistanceFromDragStart() const throw() | |||
| { | |||
| return roundDoubleToInt (juce_hypot (getDistanceFromDragStartX(), | |||
| getDistanceFromDragStartY())); | |||
| return roundToInt (juce_hypot (getDistanceFromDragStartX(), | |||
| getDistanceFromDragStartY())); | |||
| } | |||
| int MouseEvent::getLengthOfMousePress() const throw() | |||
| @@ -555,11 +555,11 @@ public: | |||
| for (int i = 0; i < numRates; ++i) | |||
| { | |||
| const int rate = roundDoubleToInt (currentDevice->getSampleRate (i)); | |||
| const int rate = roundToInt (currentDevice->getSampleRate (i)); | |||
| sampleRateDropDown->addItem (String (rate) + T(" Hz"), rate); | |||
| } | |||
| sampleRateDropDown->setSelectedId (roundDoubleToInt (currentDevice->getCurrentSampleRate()), true); | |||
| sampleRateDropDown->setSelectedId (roundToInt (currentDevice->getCurrentSampleRate()), true); | |||
| sampleRateDropDown->addListener (this); | |||
| } | |||
| @@ -185,8 +185,8 @@ private: | |||
| void updateMarker() const throw() | |||
| { | |||
| marker->setBounds (roundFloatToInt ((getWidth() - edge * 2) * s), | |||
| roundFloatToInt ((getHeight() - edge * 2) * (1.0f - v)), | |||
| marker->setBounds (roundToInt ((getWidth() - edge * 2) * s), | |||
| roundToInt ((getHeight() - edge * 2) * (1.0f - v)), | |||
| edge * 2, edge * 2); | |||
| } | |||
| @@ -265,7 +265,7 @@ public: | |||
| void resized() | |||
| { | |||
| marker->setBounds (0, roundFloatToInt ((getHeight() - edge * 2) * h), | |||
| marker->setBounds (0, roundToInt ((getHeight() - edge * 2) * h), | |||
| getWidth(), edge * 2); | |||
| } | |||
| @@ -251,7 +251,7 @@ void DropShadower::updateShadows() | |||
| bigIm->getWidth() - (shadowEdge * 2), | |||
| bigIm->getHeight() - (shadowEdge * 2)); | |||
| ImageConvolutionKernel blurKernel (roundFloatToInt (blurRadius * 2.0f)); | |||
| ImageConvolutionKernel blurKernel (roundToInt (blurRadius * 2.0f)); | |||
| blurKernel.createGaussianBlur (blurRadius); | |||
| blurKernel.applyToImage (*bigIm, 0, | |||
| @@ -97,8 +97,8 @@ public: | |||
| void relativePositionToGlobal (int& x, int& y) | |||
| { | |||
| const double zoom = magnifierComp->getScaleFactor(); | |||
| x = roundDoubleToInt (x * zoom); | |||
| y = roundDoubleToInt (y * zoom); | |||
| x = roundToInt (x * zoom); | |||
| y = roundToInt (y * zoom); | |||
| magnifierComp->relativePositionToGlobal (x, y); | |||
| } | |||
| @@ -108,8 +108,8 @@ public: | |||
| magnifierComp->globalPositionToRelative (x, y); | |||
| const double zoom = magnifierComp->getScaleFactor(); | |||
| x = roundDoubleToInt (x / zoom); | |||
| y = roundDoubleToInt (y / zoom); | |||
| x = roundToInt (x / zoom); | |||
| y = roundToInt (y / zoom); | |||
| } | |||
| bool contains (int x, int y, bool) const | |||
| @@ -124,8 +124,8 @@ public: | |||
| magnifierComp->repaint ((int) (x * zoom), | |||
| (int) (y * zoom), | |||
| roundDoubleToInt (w * zoom) + 1, | |||
| roundDoubleToInt (h * zoom) + 1); | |||
| roundToInt (w * zoom) + 1, | |||
| roundToInt (h * zoom) + 1); | |||
| } | |||
| void performAnyPendingRepaintsNow() | |||
| @@ -256,8 +256,8 @@ void MagnifierComponent::paint (Graphics& g) | |||
| const int srcX = (int) (r.getX() / scaleFactor); | |||
| const int srcY = (int) (r.getY() / scaleFactor); | |||
| int srcW = roundDoubleToInt (r.getRight() / scaleFactor) - srcX; | |||
| int srcH = roundDoubleToInt (r.getBottom() / scaleFactor) - srcY; | |||
| int srcW = roundToInt (r.getRight() / scaleFactor) - srcX; | |||
| int srcH = roundToInt (r.getBottom() / scaleFactor) - srcY; | |||
| if (scaleFactor >= 1.0) | |||
| { | |||
| @@ -282,8 +282,8 @@ void MagnifierComponent::paint (Graphics& g) | |||
| void MagnifierComponent::childBoundsChanged (Component* c) | |||
| { | |||
| if (c != 0) | |||
| setSize (roundDoubleToInt (c->getWidth() * scaleFactor), | |||
| roundDoubleToInt (c->getHeight() * scaleFactor)); | |||
| setSize (roundToInt (c->getWidth() * scaleFactor), | |||
| roundToInt (c->getHeight() * scaleFactor)); | |||
| } | |||
| void MagnifierComponent::mouseDown (const MouseEvent& e) | |||
| @@ -325,8 +325,8 @@ void MagnifierComponent::mouseExit (const MouseEvent& e) | |||
| void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy) | |||
| { | |||
| if (peer != 0) | |||
| peer->handleMouseWheel (roundFloatToInt (ix * 256.0f), | |||
| roundFloatToInt (iy * 256.0f), | |||
| peer->handleMouseWheel (roundToInt (ix * 256.0f), | |||
| roundToInt (iy * 256.0f), | |||
| e.eventTime.toMilliseconds()); | |||
| else | |||
| Component::mouseWheelMove (e, ix, iy); | |||
| @@ -334,7 +334,7 @@ void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy | |||
| int MagnifierComponent::scaleInt (const int n) const | |||
| { | |||
| return roundDoubleToInt (n / scaleFactor); | |||
| return roundToInt (n / scaleFactor); | |||
| } | |||
| @@ -227,8 +227,8 @@ void MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, const float keyW | |||
| const int octave = midiNoteNumber / 12; | |||
| const int note = midiNoteNumber % 12; | |||
| x = roundFloatToInt (octave * 7.0f * keyWidth + notePos [note] * keyWidth); | |||
| w = roundFloatToInt (widths [note] * keyWidth); | |||
| x = roundToInt (octave * 7.0f * keyWidth + notePos [note] * keyWidth); | |||
| w = roundToInt (widths [note] * keyWidth); | |||
| } | |||
| void MidiKeyboardComponent::getKeyPos (int midiNoteNumber, int& x, int& w) const | |||
| @@ -589,7 +589,7 @@ void MidiKeyboardComponent::resized() | |||
| if (orientation != horizontalKeyboard) | |||
| swapVariables (w, h); | |||
| blackNoteLength = roundFloatToInt (h * 0.7f); | |||
| blackNoteLength = roundToInt (h * 0.7f); | |||
| int kx2, kw2; | |||
| getKeyPos (rangeEnd, kx2, kw2); | |||
| @@ -795,7 +795,7 @@ void MidiKeyboardComponent::mouseExit (const MouseEvent& e) | |||
| void MidiKeyboardComponent::mouseWheelMove (const MouseEvent&, float ix, float iy) | |||
| { | |||
| setLowestVisibleKey (getLowestVisibleKey() + roundFloatToInt ((ix != 0 ? ix : iy) * 5.0f)); | |||
| setLowestVisibleKey (getLowestVisibleKey() + roundToInt ((ix != 0 ? ix : iy) * 5.0f)); | |||
| } | |||
| void MidiKeyboardComponent::timerCallback() | |||
| @@ -33,7 +33,7 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| static forcedinline uint8 floatAlphaToInt (const float alpha) | |||
| { | |||
| return (uint8) jlimit (0, 0xff, roundFloatToInt (alpha * 255.0f)); | |||
| return (uint8) jlimit (0, 0xff, roundToInt (alpha * 255.0f)); | |||
| } | |||
| static const float oneOver255 = 1.0f / 255.0f; | |||
| @@ -124,7 +124,7 @@ static void convertHSBtoRGB (float h, float s, float v, | |||
| { | |||
| v = jlimit (0.0f, 1.0f, v); | |||
| v *= 255.0f; | |||
| const uint8 intV = (uint8) roundFloatToInt (v); | |||
| const uint8 intV = (uint8) roundToInt (v); | |||
| if (s <= 0) | |||
| { | |||
| @@ -139,19 +139,19 @@ static void convertHSBtoRGB (float h, float s, float v, | |||
| h = (h - floorf (h)) * 6.0f + 0.00001f; // need a small adjustment to compensate for rounding errors | |||
| const float f = h - floorf (h); | |||
| const uint8 x = (uint8) roundFloatToInt (v * (1.0f - s)); | |||
| const uint8 x = (uint8) roundToInt (v * (1.0f - s)); | |||
| const float y = v * (1.0f - s * f); | |||
| const float z = v * (1.0f - (s * (1.0f - f))); | |||
| if (h < 1.0f) | |||
| { | |||
| r = intV; | |||
| g = (uint8) roundFloatToInt (z); | |||
| g = (uint8) roundToInt (z); | |||
| b = x; | |||
| } | |||
| else if (h < 2.0f) | |||
| { | |||
| r = (uint8) roundFloatToInt (y); | |||
| r = (uint8) roundToInt (y); | |||
| g = intV; | |||
| b = x; | |||
| } | |||
| @@ -159,17 +159,17 @@ static void convertHSBtoRGB (float h, float s, float v, | |||
| { | |||
| r = x; | |||
| g = intV; | |||
| b = (uint8) roundFloatToInt (z); | |||
| b = (uint8) roundToInt (z); | |||
| } | |||
| else if (h < 4.0f) | |||
| { | |||
| r = x; | |||
| g = (uint8) roundFloatToInt (y); | |||
| g = (uint8) roundToInt (y); | |||
| b = intV; | |||
| } | |||
| else if (h < 5.0f) | |||
| { | |||
| r = (uint8) roundFloatToInt (z); | |||
| r = (uint8) roundToInt (z); | |||
| g = x; | |||
| b = intV; | |||
| } | |||
| @@ -177,7 +177,7 @@ static void convertHSBtoRGB (float h, float s, float v, | |||
| { | |||
| r = intV; | |||
| g = x; | |||
| b = (uint8) roundFloatToInt (y); | |||
| b = (uint8) roundToInt (y); | |||
| } | |||
| else | |||
| { | |||
| @@ -267,7 +267,7 @@ const Colour Colour::withMultipliedAlpha (const float alphaMultiplier) const thr | |||
| jassert (alphaMultiplier >= 0); | |||
| PixelARGB newCol (argb); | |||
| newCol.setAlpha ((uint8) jmin (0xff, roundFloatToInt (alphaMultiplier * newCol.getAlpha()))); | |||
| newCol.setAlpha ((uint8) jmin (0xff, roundToInt (alphaMultiplier * newCol.getAlpha()))); | |||
| return Colour (newCol.getARGB()); | |||
| } | |||
| @@ -309,7 +309,7 @@ const Colour Colour::interpolatedWith (const Colour& other, float proportionOfOt | |||
| PixelARGB c1 (getPixelARGB()); | |||
| const PixelARGB c2 (other.getPixelARGB()); | |||
| c1.tween (c2, roundFloatToInt (proportionOfOther * 255.0f)); | |||
| c1.tween (c2, roundToInt (proportionOfOther * 255.0f)); | |||
| c1.unpremultiply(); | |||
| return Colour (c1.getARGB()); | |||
| @@ -489,7 +489,7 @@ const Colour Colour::darker (float amount) const throw() | |||
| const Colour Colour::greyLevel (const float brightness) throw() | |||
| { | |||
| const uint8 level | |||
| = (uint8) jlimit (0x00, 0xff, roundFloatToInt (brightness * 255.0f)); | |||
| = (uint8) jlimit (0x00, 0xff, roundToInt (brightness * 255.0f)); | |||
| return Colour (level, level, level); | |||
| } | |||
| @@ -74,7 +74,7 @@ void ColourGradient::addColour (const double proportionAlongGradient, | |||
| // must be within the two end-points | |||
| jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0); | |||
| const uint32 pos = jlimit (0, 65535, roundDoubleToInt (proportionAlongGradient * 65536.0)); | |||
| const uint32 pos = jlimit (0, 65535, roundToInt (proportionAlongGradient * 65536.0)); | |||
| int i; | |||
| for (i = 0; i < colours.size(); i += 2) | |||
| @@ -114,7 +114,7 @@ const Colour ColourGradient::getColourAtPosition (const float position) const th | |||
| { | |||
| jassert (colours.getUnchecked (0) == 0); // the first colour specified has to go at position 0 | |||
| const int integerPos = jlimit (0, 65535, roundFloatToInt (position * 65536.0f)); | |||
| const int integerPos = jlimit (0, 65535, roundToInt (position * 65536.0f)); | |||
| if (integerPos <= 0 || colours.size() <= 2) | |||
| return getColour (0); | |||
| @@ -219,9 +219,9 @@ public: | |||
| } | |||
| else | |||
| { | |||
| components.b = (uint8) jmin (0xff, (components.b * 0xff) / alpha); | |||
| components.g = (uint8) jmin (0xff, (components.g * 0xff) / alpha); | |||
| components.r = (uint8) jmin (0xff, (components.r * 0xff) / alpha); | |||
| components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha); | |||
| components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha); | |||
| components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha); | |||
| } | |||
| } | |||
| } | |||
| @@ -71,8 +71,8 @@ EdgeTable::EdgeTable (const Rectangle& bounds_, | |||
| while (iter.next()) | |||
| { | |||
| int y1 = roundFloatToInt (iter.y1 * 256.0f); | |||
| int y2 = roundFloatToInt (iter.y2 * 256.0f); | |||
| int y1 = roundToInt (iter.y1 * 256.0f); | |||
| int y2 = roundToInt (iter.y2 * 256.0f); | |||
| if (y1 != y2) | |||
| { | |||
| @@ -103,7 +103,7 @@ EdgeTable::EdgeTable (const Rectangle& bounds_, | |||
| do | |||
| { | |||
| const int step = jmin (stepSize, y2 - y1, 256 - (y1 & 255)); | |||
| int x = roundDoubleToInt (startX + multiplier * ((y1 + (step >> 1)) - startY)); | |||
| int x = roundToInt (startX + multiplier * ((y1 + (step >> 1)) - startY)); | |||
| if (x < leftLimit) | |||
| x = leftLimit; | |||
| @@ -180,7 +180,7 @@ EdgeTable::EdgeTable (const RectangleList& rectanglesToAdd) throw() | |||
| } | |||
| EdgeTable::EdgeTable (const float x, const float y, const float w, const float h) throw() | |||
| : bounds (Rectangle ((int) floorf (x), roundFloatToInt (y * 256.0f) >> 8, 2 + (int) w, 2 + (int) h)), | |||
| : bounds (Rectangle ((int) floorf (x), roundToInt (y * 256.0f) >> 8, 2 + (int) w, 2 + (int) h)), | |||
| maxEdgesPerLine (juce_edgeTableDefaultEdgesPerLine), | |||
| lineStrideElements ((juce_edgeTableDefaultEdgesPerLine << 1) + 1), | |||
| needToCheckEmptinesss (true) | |||
| @@ -189,12 +189,12 @@ EdgeTable::EdgeTable (const float x, const float y, const float w, const float h | |||
| table.malloc (jmax (1, bounds.getHeight()) * lineStrideElements); | |||
| table[0] = 0; | |||
| const int x1 = roundFloatToInt (x * 256.0f); | |||
| const int x2 = roundFloatToInt ((x + w) * 256.0f); | |||
| const int x1 = roundToInt (x * 256.0f); | |||
| const int x2 = roundToInt ((x + w) * 256.0f); | |||
| int y1 = roundFloatToInt (y * 256.0f) - (bounds.getY() << 8); | |||
| int y1 = roundToInt (y * 256.0f) - (bounds.getY() << 8); | |||
| jassert (y1 < 256); | |||
| int y2 = roundFloatToInt ((y + h) * 256.0f) - (bounds.getY() << 8); | |||
| int y2 = roundToInt ((y + h) * 256.0f) - (bounds.getY() << 8); | |||
| if (x2 <= x1 || y2 <= y1) | |||
| { | |||
| @@ -436,7 +436,7 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| } | |||
| ++otherLine; | |||
| const int lineSizeBytes = (dest[0] * 2 + 1) * sizeof (int); | |||
| const size_t lineSizeBytes = (dest[0] * 2 + 1) * sizeof (int); | |||
| int* temp = (int*) alloca (lineSizeBytes); | |||
| memcpy (temp, dest, lineSizeBytes); | |||
| @@ -735,8 +735,8 @@ void Graphics::drawImageWithin (const Image* const imageToDraw, | |||
| if (newW > 0 && newH > 0) | |||
| { | |||
| drawImage (imageToDraw, | |||
| roundDoubleToInt (newX), roundDoubleToInt (newY), | |||
| roundDoubleToInt (newW), roundDoubleToInt (newH), | |||
| roundToInt (newX), roundToInt (newY), | |||
| roundToInt (newW), roundToInt (newH), | |||
| 0, 0, imageW, imageH, | |||
| fillAlphaChannelWithCurrentBrush); | |||
| } | |||
| @@ -205,19 +205,19 @@ public: | |||
| if (vertical) | |||
| { | |||
| scale = roundDoubleToInt ((numEntries << (int) numScaleBits) / (double) (y2 - y1)); | |||
| start = roundDoubleToInt (y1 * scale); | |||
| scale = roundToInt ((numEntries << (int) numScaleBits) / (double) (y2 - y1)); | |||
| start = roundToInt (y1 * scale); | |||
| } | |||
| else if (horizontal) | |||
| { | |||
| scale = roundDoubleToInt ((numEntries << (int) numScaleBits) / (double) (x2 - x1)); | |||
| start = roundDoubleToInt (x1 * scale); | |||
| scale = roundToInt ((numEntries << (int) numScaleBits) / (double) (x2 - x1)); | |||
| start = roundToInt (x1 * scale); | |||
| } | |||
| else | |||
| { | |||
| grad = (y2 - y1) / (double) (x1 - x2); | |||
| yTerm = y1 - x1 / grad; | |||
| scale = roundDoubleToInt ((numEntries << (int) numScaleBits) / (yTerm * grad - (y2 * grad - x2))); | |||
| scale = roundToInt ((numEntries << (int) numScaleBits) / (yTerm * grad - (y2 * grad - x2))); | |||
| grad *= scale; | |||
| } | |||
| } | |||
| @@ -227,7 +227,7 @@ public: | |||
| if (vertical) | |||
| linePix = lookupTable [jlimit (0, numEntries, (y * scale - start) >> (int) numScaleBits)]; | |||
| else if (! horizontal) | |||
| start = roundDoubleToInt ((y - yTerm) * grad); | |||
| start = roundToInt ((y - yTerm) * grad); | |||
| } | |||
| forcedinline const PixelARGB getPixel (const int x) const throw() | |||
| @@ -265,7 +265,7 @@ public: | |||
| const float gdy = gradient.y1 - gradient.y2; | |||
| maxDist = gdx * gdx + gdy * gdy; | |||
| invScale = numEntries / sqrt (maxDist); | |||
| jassert (roundDoubleToInt (sqrt (maxDist) * invScale) <= numEntries); | |||
| jassert (roundToInt (sqrt (maxDist) * invScale) <= numEntries); | |||
| } | |||
| forcedinline void setY (const int y) throw() | |||
| @@ -280,7 +280,7 @@ public: | |||
| x *= x; | |||
| x += dy; | |||
| return lookupTable [x >= maxDist ? numEntries : roundDoubleToInt (sqrt (x) * invScale)]; | |||
| return lookupTable [x >= maxDist ? numEntries : roundToInt (sqrt (x) * invScale)]; | |||
| } | |||
| protected: | |||
| @@ -323,7 +323,7 @@ public: | |||
| if (x >= maxDist) | |||
| return lookupTable [numEntries]; | |||
| else | |||
| return lookupTable [jmin (numEntries, roundDoubleToInt (sqrt (x) * invScale))]; | |||
| return lookupTable [jmin (numEntries, roundToInt (sqrt (x) * invScale))]; | |||
| } | |||
| private: | |||
| @@ -1573,7 +1573,7 @@ public: | |||
| if (edgeTable != 0) | |||
| { | |||
| EdgeTable et (*edgeTable); | |||
| et.translate (x, roundFloatToInt (y)); | |||
| et.translate (x, roundToInt (y)); | |||
| state.fillEdgeTable (image, et, false); | |||
| } | |||
| } | |||
| @@ -1596,7 +1596,7 @@ public: | |||
| glyphPath.getBoundsTransformed (transform.translated (0.0f, -0.5f), px, py, pw, ph); | |||
| Rectangle clip ((int) floorf (px), (int) floorf (py), | |||
| roundFloatToInt (pw) + 2, roundFloatToInt (ph) + 2); | |||
| roundToInt (pw) + 2, roundToInt (ph) + 2); | |||
| edgeTable = new EdgeTable (clip, glyphPath, transform); | |||
| } | |||
| @@ -87,11 +87,11 @@ void Drawable::drawWithin (Graphics& g, | |||
| } | |||
| //============================================================================== | |||
| Drawable* Drawable::createFromImageData (const void* data, const int numBytes) | |||
| Drawable* Drawable::createFromImageData (const void* data, const size_t numBytes) | |||
| { | |||
| Drawable* result = 0; | |||
| Image* const image = ImageFileFormat::loadFrom (data, numBytes); | |||
| Image* const image = ImageFileFormat::loadFrom (data, (int) numBytes); | |||
| if (image != 0) | |||
| { | |||
| @@ -101,7 +101,7 @@ Drawable* Drawable::createFromImageData (const void* data, const int numBytes) | |||
| } | |||
| else | |||
| { | |||
| const String asString (String::createStringFromData (data, numBytes)); | |||
| const String asString (String::createStringFromData (data, (int) numBytes)); | |||
| XmlDocument doc (asString); | |||
| ScopedPointer <XmlElement> outer (doc.getDocumentElement (true)); | |||
| @@ -153,7 +153,7 @@ public: | |||
| The data could be an image that the ImageFileFormat class understands, or it | |||
| could be SVG. | |||
| */ | |||
| static Drawable* createFromImageData (const void* data, const int numBytes); | |||
| static Drawable* createFromImageData (const void* data, const size_t numBytes); | |||
| /** Tries to turn a stream containing some kind of image data into a drawable. | |||
| @@ -123,7 +123,7 @@ bool DrawableImage::hitTest (float x, float y) const | |||
| && y >= 0.0f | |||
| && x < image->getWidth() | |||
| && y < image->getHeight() | |||
| && image->getPixelAt (roundFloatToInt (x), roundFloatToInt (y)).getAlpha() >= 127; | |||
| && image->getPixelAt (roundToInt (x), roundToInt (y)).getAlpha() >= 127; | |||
| } | |||
| Drawable* DrawableImage::createCopy() const | |||
| @@ -195,7 +195,7 @@ DrawableImage* DrawableImage::createFromValueTree (const ValueTree& tree) throw( | |||
| MemoryBlock imageData; | |||
| if (imageData.fromBase64Encoding (tree ["data"])) | |||
| { | |||
| Image* const im = ImageFileFormat::loadFrom (imageData.getData(), imageData.getSize()); | |||
| Image* const im = ImageFileFormat::loadFrom (imageData.getData(), (int) imageData.getSize()); | |||
| if (im == 0) | |||
| return false; | |||
| @@ -1108,9 +1108,9 @@ private: | |||
| tokens.removeEmptyStrings(); | |||
| if (tokens[0].containsChar (T('%'))) | |||
| return Colour ((uint8) roundDoubleToInt (2.55 * tokens[0].getDoubleValue()), | |||
| (uint8) roundDoubleToInt (2.55 * tokens[1].getDoubleValue()), | |||
| (uint8) roundDoubleToInt (2.55 * tokens[2].getDoubleValue())); | |||
| return Colour ((uint8) roundToInt (2.55 * tokens[0].getDoubleValue()), | |||
| (uint8) roundToInt (2.55 * tokens[1].getDoubleValue()), | |||
| (uint8) roundToInt (2.55 * tokens[2].getDoubleValue())); | |||
| else | |||
| return Colour ((uint8) tokens[0].getIntValue(), | |||
| (uint8) tokens[1].getIntValue(), | |||
| @@ -70,8 +70,8 @@ void DropShadowEffect::applyEffect (Image& image, Graphics& g) | |||
| const Image::BitmapData srcData (image, 0, 0, w, h); | |||
| const Image::BitmapData destData (shadowImage, 0, 0, w, h, true); | |||
| const int filter = roundFloatToInt (63.0f / radius); | |||
| const int radiusMinus1 = roundFloatToInt ((radius - 1.0f) * 63.0f); | |||
| const int filter = roundToInt (63.0f / radius); | |||
| const int radiusMinus1 = roundToInt ((radius - 1.0f) * 63.0f); | |||
| for (int x = w; --x >= 0;) | |||
| { | |||
| @@ -56,7 +56,7 @@ void GlowEffect::applyEffect (Image& image, Graphics& g) | |||
| Image temp (image.getFormat(), w, h, true); | |||
| ImageConvolutionKernel blurKernel (roundFloatToInt (radius * 2.0f)); | |||
| ImageConvolutionKernel blurKernel (roundToInt (radius * 2.0f)); | |||
| blurKernel.createGaussianBlur (radius); | |||
| blurKernel.rescaleAllValues (radius); | |||
| @@ -290,7 +290,7 @@ float Font::getDescent() const throw() | |||
| int Font::getStringWidth (const String& text) const throw() | |||
| { | |||
| return roundFloatToInt (getStringWidthFloat (text)); | |||
| return roundToInt (getStringWidthFloat (text)); | |||
| } | |||
| float Font::getStringWidthFloat (const String& text) const throw() | |||
| @@ -51,7 +51,7 @@ public: | |||
| isWhitespace (isWhitespace_) | |||
| { | |||
| w = font.getStringWidth (t); | |||
| h = roundFloatToInt (f.getHeight()); | |||
| h = roundToInt (f.getHeight()); | |||
| isNewLine = t.containsAnyOf (T("\r\n")); | |||
| } | |||
| @@ -83,7 +83,7 @@ public: | |||
| g.drawSingleLineText (text.trimEnd(), | |||
| xOffset + x, | |||
| yOffset + y + (lineHeight - h) | |||
| + roundFloatToInt (font.getAscent())); | |||
| + roundToInt (font.getAscent())); | |||
| } | |||
| } | |||
| @@ -1429,7 +1429,7 @@ const String Path::toString() const | |||
| } | |||
| const char* const result = (const char*) s.getData(); | |||
| int len = s.getDataSize(); | |||
| size_t len = s.getDataSize(); | |||
| while (len > 0 && CharacterFunctions::isWhitespace (result [len - 1])) | |||
| --len; | |||
| @@ -130,8 +130,8 @@ const Rectangle PositionedRectangle::getRectangle (const Rectangle& target) cons | |||
| applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth()); | |||
| applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight()); | |||
| return Rectangle (roundDoubleToInt (x_), roundDoubleToInt (y_), | |||
| roundDoubleToInt (w_), roundDoubleToInt (h_)); | |||
| return Rectangle (roundToInt (x_), roundToInt (y_), | |||
| roundToInt (w_), roundToInt (h_)); | |||
| } | |||
| void PositionedRectangle::getRectangleDouble (const Rectangle& target, | |||
| @@ -254,11 +254,11 @@ void PositionedRectangle::addPosDescription (String& s, const uint8 mode, const | |||
| { | |||
| if ((mode & proportionOfParentSize) != 0) | |||
| { | |||
| s << (roundDoubleToInt (value * 100000.0) / 1000.0) << T('%'); | |||
| s << (roundToInt (value * 100000.0) / 1000.0) << T('%'); | |||
| } | |||
| else | |||
| { | |||
| s << (roundDoubleToInt (value * 100.0) / 100.0); | |||
| s << (roundToInt (value * 100.0) / 100.0); | |||
| if ((mode & absoluteFromParentBottomRight) != 0) | |||
| s << T('R'); | |||
| @@ -275,11 +275,11 @@ void PositionedRectangle::addPosDescription (String& s, const uint8 mode, const | |||
| void PositionedRectangle::addSizeDescription (String& s, const uint8 mode, const double value) const throw() | |||
| { | |||
| if (mode == proportionalSize) | |||
| s << (roundDoubleToInt (value * 100000.0) / 1000.0) << T('%'); | |||
| s << (roundToInt (value * 100000.0) / 1000.0) << T('%'); | |||
| else if (mode == parentSizeMinusAbsolute) | |||
| s << (roundDoubleToInt (value * 100.0) / 100.0) << T('M'); | |||
| s << (roundToInt (value * 100.0) / 100.0) << T('M'); | |||
| else | |||
| s << (roundDoubleToInt (value * 100.0) / 100.0); | |||
| s << (roundToInt (value * 100.0) / 100.0); | |||
| } | |||
| void PositionedRectangle::decodePosString (const String& s, uint8& mode, double& value) throw() | |||
| @@ -335,11 +335,11 @@ void PositionedRectangle::applyPosAndSize (double& xOut, double& wOut, | |||
| const int parentSize) const throw() | |||
| { | |||
| if (wMode_ == proportionalSize) | |||
| wOut = roundDoubleToInt (w_ * parentSize); | |||
| wOut = roundToInt (w_ * parentSize); | |||
| else if (wMode_ == parentSizeMinusAbsolute) | |||
| wOut = jmax (0, parentSize - roundDoubleToInt (w_)); | |||
| wOut = jmax (0, parentSize - roundToInt (w_)); | |||
| else | |||
| wOut = roundDoubleToInt (w_); | |||
| wOut = roundToInt (w_); | |||
| if ((xMode_ & proportionOfParentSize) != 0) | |||
| xOut = parentPos + x_ * parentSize; | |||
| @@ -167,7 +167,7 @@ static void jpegSkip (j_decompress_ptr decompStruct, long num) | |||
| { | |||
| decompStruct->src->next_input_byte += num; | |||
| num = jmin (num, (int) decompStruct->src->bytes_in_buffer); | |||
| num = jmin (num, (long) decompStruct->src->bytes_in_buffer); | |||
| decompStruct->src->bytes_in_buffer -= num; | |||
| } | |||
| @@ -289,8 +289,8 @@ static void jpegWriteTerminate (j_compress_ptr cinfo) | |||
| { | |||
| JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest; | |||
| const int numToWrite = jpegBufferSize - dest->free_in_buffer; | |||
| dest->output->write (dest->buffer, numToWrite); | |||
| const size_t numToWrite = jpegBufferSize - dest->free_in_buffer; | |||
| dest->output->write (dest->buffer, (int) numToWrite); | |||
| } | |||
| static boolean jpegWriteFlush (j_compress_ptr cinfo) | |||
| @@ -355,7 +355,7 @@ bool juce_writeJPEGImageToStream (const Image& image, | |||
| if (quality < 0.0f) | |||
| quality = 0.85f; | |||
| jpeg_set_quality (&jpegCompStruct, jlimit (0, 100, roundFloatToInt (quality * 100.0f)), TRUE); | |||
| jpeg_set_quality (&jpegCompStruct, jlimit (0, 100, roundToInt (quality * 100.0f)), TRUE); | |||
| jpeg_start_compress (&jpegCompStruct, TRUE); | |||
| @@ -193,11 +193,11 @@ Image* juce_loadPNGImageFromStream (InputStream& in) | |||
| // now convert the data to a juce image format.. | |||
| image = Image::createNativeImage (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| width, height, hasAlphaChan); | |||
| (int) width, (int) height, hasAlphaChan); | |||
| hasAlphaChan = image->hasAlphaChannel(); // (the native image creator may not give back what we expect) | |||
| const Image::BitmapData destData (*image, 0, 0, width, height, true); | |||
| const Image::BitmapData destData (*image, 0, 0, (int) width, (int) height, true); | |||
| uint8* srcRow = tempBuffer; | |||
| uint8* destRow = destData.data; | |||
| @@ -210,7 +210,7 @@ Image* juce_loadPNGImageFromStream (InputStream& in) | |||
| if (hasAlphaChan) | |||
| { | |||
| for (int i = width; --i >= 0;) | |||
| for (int i = (int) width; --i >= 0;) | |||
| { | |||
| ((PixelARGB*) dest)->setARGB (src[3], src[0], src[1], src[2]); | |||
| ((PixelARGB*) dest)->premultiply(); | |||
| @@ -220,7 +220,7 @@ Image* juce_loadPNGImageFromStream (InputStream& in) | |||
| } | |||
| else | |||
| { | |||
| for (int i = width; --i >= 0;) | |||
| for (int i = (int) width; --i >= 0;) | |||
| { | |||
| ((PixelRGB*) dest)->setARGB (0, src[0], src[1], src[2]); | |||
| dest += destData.pixelStride; | |||
| @@ -238,7 +238,7 @@ static void pngWriteDataCallback (png_structp png_ptr, png_bytep data, png_size_ | |||
| { | |||
| OutputStream* const out = (OutputStream*) png_ptr->io_ptr; | |||
| const bool ok = out->write (data, length); | |||
| const bool ok = out->write (data, (int) length); | |||
| (void) ok; | |||
| jassert (ok); | |||
| @@ -369,7 +369,7 @@ void Image::createSolidAreaMask (RectangleList& result, const float alphaThresho | |||
| { | |||
| if (hasAlphaChannel()) | |||
| { | |||
| const uint8 threshold = (uint8) jlimit (0, 255, roundFloatToInt (alphaThreshold * 255.0f)); | |||
| const uint8 threshold = (uint8) jlimit (0, 255, roundToInt (alphaThreshold * 255.0f)); | |||
| SparseSet <int> pixelsOnRow; | |||
| const BitmapData srcData (*this, 0, 0, getWidth(), getHeight()); | |||
| @@ -195,10 +195,10 @@ void ImageConvolutionKernel::applyToImage (Image& destImage, | |||
| } | |||
| } | |||
| *dest++ = (uint8) jmin (0xff, roundFloatToInt (c1)); | |||
| *dest++ = (uint8) jmin (0xff, roundFloatToInt (c2)); | |||
| *dest++ = (uint8) jmin (0xff, roundFloatToInt (c3)); | |||
| *dest++ = (uint8) jmin (0xff, roundFloatToInt (c4)); | |||
| *dest++ = (uint8) jmin (0xff, roundToInt (c1)); | |||
| *dest++ = (uint8) jmin (0xff, roundToInt (c2)); | |||
| *dest++ = (uint8) jmin (0xff, roundToInt (c3)); | |||
| *dest++ = (uint8) jmin (0xff, roundToInt (c4)); | |||
| } | |||
| } | |||
| } | |||
| @@ -249,9 +249,9 @@ void ImageConvolutionKernel::applyToImage (Image& destImage, | |||
| } | |||
| } | |||
| *dest++ = (uint8) roundFloatToInt (c1); | |||
| *dest++ = (uint8) roundFloatToInt (c2); | |||
| *dest++ = (uint8) roundFloatToInt (c3); | |||
| *dest++ = (uint8) roundToInt (c1); | |||
| *dest++ = (uint8) roundToInt (c2); | |||
| *dest++ = (uint8) roundToInt (c3); | |||
| } | |||
| } | |||
| } | |||
| @@ -129,7 +129,7 @@ static int readSocket (const int handle, | |||
| #if JUCE_WINDOWS | |||
| bytesThisTime = recv (handle, ((char*) destBuffer) + bytesRead, maxBytesToRead - bytesRead, 0); | |||
| #else | |||
| while ((bytesThisTime = ::read (handle, ((char*) destBuffer) + bytesRead, maxBytesToRead - bytesRead)) < 0 | |||
| while ((bytesThisTime = (int) ::read (handle, ((char*) destBuffer) + bytesRead, maxBytesToRead - bytesRead)) < 0 | |||
| && errno == EINTR | |||
| && connected) | |||
| { | |||
| @@ -349,7 +349,7 @@ int StreamingSocket::write (const void* sourceBuffer, const int numBytesToWrite) | |||
| #else | |||
| int result; | |||
| while ((result = ::write (handle, sourceBuffer, numBytesToWrite)) < 0 | |||
| while ((result = (int) ::write (handle, sourceBuffer, numBytesToWrite)) < 0 | |||
| && errno == EINTR) | |||
| { | |||
| } | |||
| @@ -616,10 +616,10 @@ int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite) | |||
| // You need to call connect() first to set the server address.. | |||
| jassert (serverAddress != 0 && connected); | |||
| return connected ? sendto (handle, (const char*) sourceBuffer, | |||
| numBytesToWrite, 0, | |||
| (const struct sockaddr*) serverAddress, | |||
| sizeof (struct sockaddr_in)) | |||
| return connected ? (int) sendto (handle, (const char*) sourceBuffer, | |||
| numBytesToWrite, 0, | |||
| (const struct sockaddr*) serverAddress, | |||
| sizeof (struct sockaddr_in)) | |||
| : -1; | |||
| } | |||
| @@ -431,7 +431,7 @@ private: | |||
| // just a short text attachment, so use simple url encoding.. | |||
| headers = "Content-Type: application/x-www-form-urlencoded\r\nContent-length: " | |||
| + String (postData.getSize()) | |||
| + String ((unsigned int) postData.getSize()) | |||
| + "\r\n"; | |||
| } | |||
| } | |||
| @@ -158,7 +158,7 @@ const String InputStream::readString() | |||
| { | |||
| MemoryBlock buffer (256); | |||
| uint8* data = (uint8*) buffer.getData(); | |||
| int i = 0; | |||
| size_t i = 0; | |||
| while ((data[i] = readByte()) != 0) | |||
| { | |||
| @@ -169,14 +169,14 @@ const String InputStream::readString() | |||
| } | |||
| } | |||
| return String::fromUTF8 (data, i); | |||
| return String::fromUTF8 (data, (int) i); | |||
| } | |||
| const String InputStream::readNextLine() | |||
| { | |||
| MemoryBlock buffer (256); | |||
| uint8* data = (uint8*) buffer.getData(); | |||
| int i = 0; | |||
| size_t i = 0; | |||
| while ((data[i] = readByte()) != 0) | |||
| { | |||
| @@ -200,7 +200,7 @@ const String InputStream::readNextLine() | |||
| } | |||
| } | |||
| return String::fromUTF8 (data, i); | |||
| return String::fromUTF8 (data, (int) i); | |||
| } | |||
| int InputStream::readIntoMemoryBlock (MemoryBlock& block, | |||
| @@ -221,7 +221,7 @@ int InputStream::readIntoMemoryBlock (MemoryBlock& block, | |||
| return 0; | |||
| } | |||
| const int originalBlockSize = block.getSize(); | |||
| const size_t originalBlockSize = block.getSize(); | |||
| int totalBytesRead = 0; | |||
| if (numBytes > 0) | |||
| @@ -33,7 +33,7 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| MemoryInputStream::MemoryInputStream (const void* const sourceData, | |||
| const int sourceDataSize, | |||
| const size_t sourceDataSize, | |||
| const bool keepInternalCopy) | |||
| : data ((const char*) sourceData), | |||
| dataSize (sourceDataSize), | |||
| @@ -57,10 +57,10 @@ int64 MemoryInputStream::getTotalLength() | |||
| int MemoryInputStream::read (void* buffer, int howMany) | |||
| { | |||
| const int num = jmin (howMany, dataSize - position); | |||
| const size_t num = jmin ((size_t) howMany, dataSize - position); | |||
| memcpy (buffer, data + position, num); | |||
| position += num; | |||
| return num; | |||
| return (int) num; | |||
| } | |||
| bool MemoryInputStream::isExhausted() | |||
| @@ -51,7 +51,7 @@ public: | |||
| data and use that. | |||
| */ | |||
| MemoryInputStream (const void* const sourceData, | |||
| const int sourceDataSize, | |||
| const size_t sourceDataSize, | |||
| const bool keepInternalCopyOfData); | |||
| /** Destructor. */ | |||
| @@ -70,7 +70,7 @@ public: | |||
| private: | |||
| const char* data; | |||
| int dataSize, position; | |||
| size_t dataSize, position; | |||
| MemoryBlock internalCopy; | |||
| }; | |||
| @@ -32,13 +32,13 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| MemoryOutputStream::MemoryOutputStream (const int initialSize, | |||
| const int blockSizeToIncreaseBy, | |||
| MemoryOutputStream::MemoryOutputStream (const size_t initialSize, | |||
| const size_t blockSizeToIncreaseBy, | |||
| MemoryBlock* const memoryBlockToWriteTo) throw() | |||
| : data (memoryBlockToWriteTo), | |||
| position (0), | |||
| size (0), | |||
| blockSize (jmax (16, blockSizeToIncreaseBy)) | |||
| blockSize (jmax ((size_t) 16, blockSizeToIncreaseBy)) | |||
| { | |||
| if (data == 0) | |||
| dataToDelete = data = new MemoryBlock (initialSize); | |||
| @@ -67,7 +67,7 @@ bool MemoryOutputStream::write (const void* buffer, int howMany) | |||
| { | |||
| if (howMany > 0) | |||
| { | |||
| int storageNeeded = position + howMany; | |||
| size_t storageNeeded = position + howMany; | |||
| if (storageNeeded >= data->getSize()) | |||
| { | |||
| @@ -78,7 +78,7 @@ bool MemoryOutputStream::write (const void* buffer, int howMany) | |||
| data->ensureSize (storageNeeded); | |||
| } | |||
| data->copyFrom (buffer, position, howMany); | |||
| data->copyFrom (buffer, (int) position, howMany); | |||
| position += howMany; | |||
| size = jmax (size, position); | |||
| } | |||
| @@ -94,7 +94,7 @@ const char* MemoryOutputStream::getData() throw() | |||
| return (const char*) data->getData(); | |||
| } | |||
| int MemoryOutputStream::getDataSize() const throw() | |||
| size_t MemoryOutputStream::getDataSize() const throw() | |||
| { | |||
| return size; | |||
| } | |||
| @@ -106,10 +106,10 @@ int64 MemoryOutputStream::getPosition() | |||
| bool MemoryOutputStream::setPosition (int64 newPosition) | |||
| { | |||
| if (newPosition <= size) | |||
| if (newPosition <= (int64) size) | |||
| { | |||
| // ok to seek backwards | |||
| position = jlimit (0, size, (int) newPosition); | |||
| position = jlimit ((size_t) 0, size, (size_t) newPosition); | |||
| return true; | |||
| } | |||
| else | |||
| @@ -50,8 +50,8 @@ public: | |||
| will allocate its own storage internally, which you can | |||
| access using getData() and getDataSize() | |||
| */ | |||
| MemoryOutputStream (const int initialSize = 256, | |||
| const int granularity = 256, | |||
| MemoryOutputStream (const size_t initialSize = 256, | |||
| const size_t granularity = 256, | |||
| MemoryBlock* const memoryBlockToWriteTo = 0) throw(); | |||
| /** Destructor. | |||
| @@ -71,7 +71,7 @@ public: | |||
| @see getData | |||
| */ | |||
| int getDataSize() const throw(); | |||
| size_t getDataSize() const throw(); | |||
| /** Resets the stream, clearing any data that has been written to it so far. */ | |||
| void reset() throw(); | |||
| @@ -89,7 +89,7 @@ public: | |||
| private: | |||
| MemoryBlock* data; | |||
| ScopedPointer <MemoryBlock> dataToDelete; | |||
| int position, size, blockSize; | |||
| size_t position, size, blockSize; | |||
| }; | |||
| #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__ | |||
| @@ -312,7 +312,7 @@ int OutputStream::writeFromInputStream (InputStream& source, | |||
| { | |||
| char buffer [8192]; | |||
| const int num = source.read (buffer, jmin (numBytesToWrite, sizeof (buffer))); | |||
| const int num = source.read (buffer, (int) jmin ((size_t) numBytesToWrite, sizeof (buffer))); | |||
| if (num == 0) | |||
| break; | |||