#ue5 - Fix type conversion warnings in modules: AutomationController, AutomationTest, AVEncoder, AVIWriter.

#jira UE-160830
#rb Andrew.Davidson
#preflight 630d2147556fc14dce527da5

[CL 21690862 by Zak Middleton in ue5-main branch]
This commit is contained in:
Zak Middleton
2022-08-29 18:32:03 -04:00
parent 41545ac5d0
commit 84fb0737e0
12 changed files with 20 additions and 20 deletions

View File

@@ -573,7 +573,7 @@ private:
/** The test runners message address */
FMessageAddress OwnerMessageAddress;
/** The time since we had a ping from the instance*/
float LastPingTime;
double LastPingTime;
};
/** A array of running tests. */

View File

@@ -109,8 +109,8 @@ public:
{
const bool AlphaSimilar = FMath::IsNearlyEqual((float)ColorA.A, ColorB.A, Tolerance.Alpha);
const float BrightnessA = FPixelOperations::GetLuminance(ColorA);
const float BrightnessB = FPixelOperations::GetLuminance(ColorB);
const double BrightnessA = FPixelOperations::GetLuminance(ColorA);
const double BrightnessB = FPixelOperations::GetLuminance(ColorB);
const bool BrightnessSimilar = FMath::IsNearlyEqual(BrightnessA, BrightnessB, Tolerance.MinBrightness);
return BrightnessSimilar && AlphaSimilar;
@@ -135,8 +135,8 @@ public:
static FORCEINLINE bool IsContrasting(const FColor& ColorA, const FColor& ColorB, const FImageTolerance& Tolerance)
{
const float BrightnessA = FPixelOperations::GetLuminance(ColorA);
const float BrightnessB = FPixelOperations::GetLuminance(ColorB);
const double BrightnessA = FPixelOperations::GetLuminance(ColorA);
const double BrightnessB = FPixelOperations::GetLuminance(ColorB);
return FMath::Abs(BrightnessA - BrightnessB) > Tolerance.MaxBrightness;
}

View File

@@ -201,7 +201,7 @@ FVideoDecoder::EDecodeResult FVideoDecoderH264_Dummy::Decode(const FVideoDecoder
int C = ++YOffset;
for(int32 y=0,yMax=Height; y<yMax; ++y)
{
FMemory::Memset(pY, C++, Width);
FMemory::Memset(pY, (uint8)C++, Width);
pY += Width;
}
OnDecodedFrame(pNew.Release());

View File

@@ -35,7 +35,7 @@ struct CLIPinitializer
iclp = iclip + 512;
for(int32 i= -512; i<512; i++)
{
iclp[i] = i < -256 ? -256 : i > 255 ? 255 : i;
iclp[i] = IntCastChecked<int16>(i < -256 ? -256 : i > 255 ? 255 : i);
}
}
};

View File

@@ -77,7 +77,7 @@ public:
*/
bool WaitTimeout(int64 InMicroSeconds)
{
return Event->Wait(FTimespan::FromMicroseconds(InMicroSeconds));
return Event->Wait(FTimespan::FromMicroseconds((double)InMicroSeconds));
}
/**
@@ -88,7 +88,7 @@ public:
bool WaitTimeoutAndReset(int64 InMicroSeconds)
{
check(InMicroSeconds > 0); // 0 is forbidden. either call Wait() without timeout, or check the signal using IsSignaled()
if (Event->Wait(FTimespan::FromMicroseconds(InMicroSeconds)))
if (Event->Wait(FTimespan::FromMicroseconds((double)InMicroSeconds)))
{
Event->Reset();
return true;

View File

@@ -377,7 +377,7 @@ public:
FString Directory = Options.OutputFilename;
FString Ext = FPaths::GetExtension(Directory, true);
int32 FPS = FMath::RoundToInt(double(Options.CaptureFramerateNumerator) / Options.CaptureFramerateDenominator);
int32 FPS = FMath::RoundToInt32(double(Options.CaptureFramerateNumerator) / Options.CaptureFramerateDenominator);
// Keep 3 seconds worth of frames in memory
CapturedFrames.Reset(new FCapturedFrames(Directory.LeftChop(Ext.Len()) + TEXT("_tmp"), FPS * 3));

View File

@@ -12,7 +12,7 @@ DEFINE_LOG_CATEGORY(LogMovieCapture);
FCapturePin::FCapturePin(HRESULT *phr, CSource *pFilter, const FAVIWriter& InWriter)
: CSourceStream(NAME("Push Source"), phr, pFilter, L"Capture")
, FrameLength(UNITS / (InWriter.Options.CaptureFramerateNumerator / (double)InWriter.Options.CaptureFramerateDenominator))
, FrameLength(FMath::TruncToInt64(UNITS / (InWriter.Options.CaptureFramerateNumerator / (double)InWriter.Options.CaptureFramerateDenominator)))
, Writer(InWriter)
{
ImageWidth = Writer.GetWidth();
@@ -260,8 +260,8 @@ HRESULT FCapturePin::FillBuffer(IMediaSample *pSample)
// The current time is the sample's start.
// Not strictly necessary since AVI is constant framerate
REFERENCE_TIME StartTime = UNITS*CurrentFrame->StartTimeSeconds;
REFERENCE_TIME StopTime = UNITS*CurrentFrame->EndTimeSeconds;
REFERENCE_TIME StartTime = FMath::TruncToInt64(UNITS * CurrentFrame->StartTimeSeconds);
REFERENCE_TIME StopTime = FMath::TruncToInt64(UNITS * CurrentFrame->EndTimeSeconds);
pSample->SetTime(&StartTime, &StopTime);
REFERENCE_TIME StartMediaTime = CurrentFrame->FrameIndex;

View File

@@ -73,7 +73,7 @@ struct FAutomationTestExcludelistEntry
int32 Num_Flags = Enum->NumEnums();
for (int32 i = 0; i < Num_Flags; i++)
{
int8 Flag = Enum->GetValueByIndex(i);
int8 Flag = IntCastChecked<int8>(Enum->GetValueByIndex(i));
if ((int8)ERHI_Flags::NUM == Flag)
break; // We reach the maximum value

View File

@@ -301,7 +301,7 @@ public:
*
* @Param InTestFlags - the child test flag to add.
*/
void AddTestFlags( const uint8 InTestFlags)
void AddTestFlags( const uint32 InTestFlags)
{
TestFlags |= InTestFlags;
}

View File

@@ -191,7 +191,7 @@ constexpr bool FloatFitsIn(InType In, InType Precision)
static_assert(std::is_floating_point_v<InType> && std::is_floating_point_v<OutType>, "Only floating point supported");
OutType Out = static_cast<OutType>(In);
return std::abs(static_cast<InType>(Out) - In) <= Precision;
return fabs(static_cast<InType>(Out) - In) <= Precision;
}
template<typename OutType, typename InType>

View File

@@ -659,10 +659,10 @@ public:
}
UE_DEPRECATED(5.0, "Use FCanvas::GetTime()")
float GetCurrentRealTime() const { return GetTime().GetRealTimeSeconds(); }
float GetCurrentRealTime() const { return FloatCastChecked<float>(GetTime().GetRealTimeSeconds(), UE_DOUBLE_SMALL_NUMBER); }
UE_DEPRECATED(5.0, "Use FCanvas::GetTime()")
float GetCurrentWorldTime() const { return GetTime().GetWorldTimeSeconds(); }
float GetCurrentWorldTime() const { return FloatCastChecked<float>(GetTime().GetWorldTimeSeconds(), UE_DOUBLE_SMALL_NUMBER); }
UE_DEPRECATED(5.0, "Use FCanvas::GetTime()")
float GetCurrentDeltaWorldTime() const { return GetTime().GetDeltaWorldTimeSeconds(); }
@@ -1310,7 +1310,7 @@ struct FScreenMessageWriter
void DrawLine(const FText& Message, int32 X = 10, const FLinearColor& Color = FLinearColor(1.0, 0.05, 0.05, 1.0))
{
Canvas.DrawShadowedText(X, Y, Message, GetStatsFont(), Color);
Canvas.DrawShadowedText((float)X, (float)Y, Message, GetStatsFont(), Color);
EmptyLine();
}

View File

@@ -179,7 +179,7 @@ namespace Audio
// Convert from int to float:
for (int32 SampleIndex = 0; SampleIndex < NumSamples; SampleIndex++)
{
RawPCMData[SampleIndex] = ((float)Other.RawPCMData[SampleIndex]) / 32767.0f;
RawPCMData[SampleIndex] = (float)((float)Other.RawPCMData[SampleIndex]) / 32767.0f;
}
}
else