Browse Source

Android: Fix numeric conversion warnings

tags/2021-05-28
reuk 5 years ago
parent
commit
837ab64dbd
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
6 changed files with 15 additions and 15 deletions
  1. +5
    -5
      modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp
  2. +1
    -1
      modules/juce_core/memory/juce_AllocationHooks.cpp
  3. +1
    -1
      modules/juce_core/native/juce_android_SystemStats.cpp
  4. +1
    -1
      modules/juce_graphics/native/juce_android_Fonts.cpp
  5. +2
    -2
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  6. +5
    -5
      modules/juce_video/native/juce_android_Video.h

+ 5
- 5
modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp View File

@@ -228,24 +228,24 @@ private:
const float xmargin = 3.0f;
const float ymargin = 3.0f;
const float fontHeight = 0.4f * height;
const float deviceNameWidth = 0.6f * width;
const float fontHeight = 0.4f * (float) height;
const float deviceNameWidth = 0.6f * (float) width;
g.setFont (fontHeight);
g.setColour (getDeviceNameFontColour (device.connectionStatus));
g.drawText (device.name,
Rectangle<float> (xmargin, ymargin, deviceNameWidth - (2.0f * xmargin), height - (2.0f * ymargin)),
Rectangle<float> (xmargin, ymargin, deviceNameWidth - (2.0f * xmargin), (float) height - (2.0f * ymargin)),
Justification::topLeft, true);
g.setColour (getDeviceStatusFontColour (device.connectionStatus));
g.drawText (statusString,
Rectangle<float> (deviceNameWidth + xmargin, ymargin,
width - deviceNameWidth - (2.0f * xmargin), height - (2.0f * ymargin)),
(float) width - deviceNameWidth - (2.0f * xmargin), (float) height - (2.0f * ymargin)),
Justification::topRight, true);
g.setColour (Colours::grey);
g.drawHorizontalLine (height - 1, xmargin, width);
g.drawHorizontalLine (height - 1, xmargin, (float) width);
}
}


+ 1
- 1
modules/juce_core/memory/juce_AllocationHooks.cpp View File

@@ -94,7 +94,7 @@ UnitTestAllocationChecker::UnitTestAllocationChecker (UnitTest& test)
UnitTestAllocationChecker::~UnitTestAllocationChecker() noexcept
{
getAllocationHooksForThread().removeListener (this);
unitTest.expectEquals (calls, (size_t) 0, "new or delete was incorrectly called while allocation checker was active");
unitTest.expectEquals ((int) calls, 0, "new or delete was incorrectly called while allocation checker was active");
}
void UnitTestAllocationChecker::newOrDeleteCalled() noexcept { ++calls; }


+ 1
- 1
modules/juce_core/native/juce_android_SystemStats.cpp View File

@@ -229,7 +229,7 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept
double Time::getMillisecondCounterHiRes() noexcept
{
return getHighResolutionTicks() * 0.001;
return (double) getHighResolutionTicks() * 0.001;
}
bool Time::setSystemTimeToThisTime() const


+ 1
- 1
modules/juce_graphics/native/juce_android_Fonts.cpp View File

@@ -352,7 +352,7 @@ public:
LocalRef<jobject> bitmap (env->CallStaticObjectMethod (AndroidBitmap, AndroidBitmap.createBitmap, w, h, bitmapConfig.get()));
LocalRef<jobject> canvas (env->NewObject (AndroidCanvas, AndroidCanvas.create, bitmap.get()));
env->CallBooleanMethod (matrix.get(), AndroidMatrix.postTranslate, bounds.getX() * -1.0f, bounds.getY() * -1.0f);
env->CallBooleanMethod (matrix.get(), AndroidMatrix.postTranslate, (float) -bounds.getX(), (float) -bounds.getY());
env->CallVoidMethod (canvas.get(), AndroidCanvas.setMatrix, matrix.get());
env->CallVoidMethod (canvas.get(), AndroidCanvas.drawPath, path.get(), paint.get());


+ 2
- 2
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -581,8 +581,8 @@ public:
return isPositiveAndBelow (localPos.x, component.getWidth())
&& isPositiveAndBelow (localPos.y, component.getHeight())
&& ((! trueIfInAChildWindow) || view.callBooleanMethod (ComponentPeerView.containsPoint,
localPos.x * scale,
localPos.y * scale));
(float) localPos.x * scale,
(float) localPos.y * scale));
}
BorderSize<int> getFrameSize() const override


+ 5
- 5
modules/juce_video/native/juce_android_Video.h View File

@@ -544,7 +544,7 @@ private:
double getSpeed() const { return controller.getPlaySpeed(); }
Rectangle<int> getNativeSize() const { return player.getVideoNativeSize(); }
double getDuration() const { return player.getVideoDuration() / 1000.0; }
double getDuration() const { return (double) player.getVideoDuration() / 1000.0; }
void setVolume (float newVolume)
{
@@ -578,7 +578,7 @@ private:
auto* env = getEnv();
auto pos = env->CallLongMethod (storedPlaybackState, AndroidPlaybackState.getPosition);
setPosition (pos / 1000.0);
setPosition ((double) pos / 1000.0);
setSpeed (playSpeedMult);
@@ -680,7 +680,7 @@ private:
auto playbackState = LocalRef<jobject> (env->CallObjectMethod (nativeController, AndroidMediaController.getPlaybackState));
if (playbackState != nullptr)
return env->CallLongMethod (playbackState, AndroidPlaybackState.getPosition) / 1000.0;
return (double) env->CallLongMethod (playbackState, AndroidPlaybackState.getPosition) / 1000.0;
return 0.0;
}
@@ -705,7 +705,7 @@ private:
auto maxVolume = env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getMaxVolume);
auto targetVolume = jmin (jint (maxVolume * newVolume), maxVolume);
auto targetVolume = jmin (jint ((float) maxVolume * newVolume), maxVolume);
static constexpr jint flagShowUI = 1;
env->CallVoidMethod (nativeController, AndroidMediaController.setVolumeTo, targetVolume, flagShowUI);
@@ -720,7 +720,7 @@ private:
auto maxVolume = (int) (env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getMaxVolume));
auto curVolume = (int) (env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getCurrentVolume));
return static_cast<float> (curVolume) / maxVolume;
return static_cast<float> (curVolume) / (float) maxVolume;
}
private:


Loading…
Cancel
Save