Merge pull request #1835 from unknownbrackets/warnings

Warning fixes
This commit is contained in:
Henrik Rydgård committed 2013-05-18 11:51:18 -07:00
commit 5237b77c2f
10 files changed
+78 -48

No files matched your search

+2 -1
View File
@@ -20,6 +20,7 @@
#include <string>
#include <vector>
#include <map>
#include "CommonTypes.h"
extern const char *PPSSPP_GIT_VERSION;
@@ -78,7 +79,7 @@ public:
int iTexScalingType; // 0 = xBRZ, 1 = Hybrid
bool bTexDeposterize;
int iFpsLimit;
int iMaxRecent;
u32 iMaxRecent;
// Sound
bool bEnableSound;
+13 -13
View File
@@ -371,7 +371,7 @@ void Atrac::Analyze()
if (chunkSize < 36)
break;
int checkNumLoops = Memory::Read_U32(first.addr + offset + 28);
if (chunkSize >= 36 + checkNumLoops * 24) {
if (chunkSize >= 36 + (u32)checkNumLoops * 24) {
loopinfoNum = checkNumLoops;
loopinfo.resize(loopinfoNum);
u32 loopinfoAddr = first.addr + offset + 36;
@@ -479,13 +479,13 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
atrac->SeekToSample(forceseekSample);
atrac->SeekToSample(atrac->currentSample);
AVPacket packet;
int got_frame, ret;
int got_frame, avret;
while (av_read_frame(atrac->pFormatCtx, &packet) >= 0) {
if (packet.stream_index == atrac->audio_stream_index) {
got_frame = 0;
ret = avcodec_decode_audio4(atrac->pCodecCtx, atrac->pFrame, &got_frame, &packet);
if (ret < 0) {
ERROR_LOG(HLE, "avcodec_decode_audio4: Error decoding audio %d", ret);
avret = avcodec_decode_audio4(atrac->pCodecCtx, atrac->pFrame, &got_frame, &packet);
if (avret < 0) {
ERROR_LOG(HLE, "avcodec_decode_audio4: Error decoding audio %d", avret);
av_free_packet(&packet);
break;
}
@@ -496,10 +496,10 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
atrac->pFrame->nb_samples, (AVSampleFormat)atrac->pFrame->format, 1);
u8* out = Memory::GetPointer(outAddr);
numSamples = atrac->pFrame->nb_samples;
ret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
avret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
(const u8**)atrac->pFrame->extended_data, atrac->pFrame->nb_samples);
if (ret < 0) {
ERROR_LOG(HLE, "swr_convert: Error while converting %d", ret);
if (avret < 0) {
ERROR_LOG(HLE, "swr_convert: Error while converting %d", avret);
}
}
@@ -720,9 +720,9 @@ u32 sceAtracGetSecondBufferInfo(int atracID, u32 outposAddr, u32 outBytesAddr)
if (!atrac) {
//return -1;
}
if (Memory::IsValidAddress(outposAddr))
if (Memory::IsValidAddress(outposAddr) && atrac)
Memory::Write_U32(atrac->second.fileoffset, outposAddr);
if (Memory::IsValidAddress(outBytesAddr))
if (Memory::IsValidAddress(outBytesAddr) && atrac)
Memory::Write_U32(atrac->second.writableBytes, outBytesAddr);
// TODO: Maybe don't write the above?
return ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED;
@@ -813,13 +813,13 @@ int64_t _AtracSeekbuffer(void *opaque, int64_t offset, int whence)
Atrac *atrac = (Atrac*)opaque;
switch (whence) {
case SEEK_SET:
atrac->decodePos = offset;
atrac->decodePos = (u32)offset;
break;
case SEEK_CUR:
atrac->decodePos += offset;
atrac->decodePos += (u32)offset;
break;
case SEEK_END:
atrac->decodePos = atrac->first.filesize - offset;
atrac->decodePos = atrac->first.filesize - (u32)offset;
break;
}
return offset;
+7 -7
View File
@@ -494,8 +494,8 @@ u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync)
return 0;
}
bool __DisplayGetFramebuf(u8 **topaddr, u32 *linesize, u32 *pixelFormat, int mode) {
const FrameBufferState &fbState = mode == 1 ? latchedFramebuf : framebuf;
bool __DisplayGetFramebuf(u8 **topaddr, u32 *linesize, u32 *pixelFormat, int latchedMode) {
const FrameBufferState &fbState = latchedMode == 1 ? latchedFramebuf : framebuf;
if (topaddr != NULL)
*topaddr = Memory::GetPointer(fbState.topaddr);
if (linesize != NULL)
@@ -506,8 +506,8 @@ bool __DisplayGetFramebuf(u8 **topaddr, u32 *linesize, u32 *pixelFormat, int mod
return true;
}
u32 sceDisplayGetFramebuf(u32 topaddrPtr, u32 linesizePtr, u32 pixelFormatPtr, int mode) {
const FrameBufferState &fbState = mode == 1 ? latchedFramebuf : framebuf;
u32 sceDisplayGetFramebuf(u32 topaddrPtr, u32 linesizePtr, u32 pixelFormatPtr, int latchedMode) {
const FrameBufferState &fbState = latchedMode == 1 ? latchedFramebuf : framebuf;
DEBUG_LOG(HLE,"sceDisplayGetFramebuf(*%08x = %08x, *%08x = %08x, *%08x = %08x, %i)", topaddrPtr, fbState.topaddr, linesizePtr, fbState.pspFramebufLinesize, pixelFormatPtr, fbState.pspFramebufFormat, mode);
if (Memory::IsValidAddress(topaddrPtr))
@@ -602,9 +602,9 @@ u32 sceDisplayGetAccumulatedHcount() {
}
float sceDisplayGetFramePerSec() {
float fps = 59.9400599f;
DEBUG_LOG(HLE,"%f=sceDisplayGetFramePerSec()", fps);
return fps; // (9MHz * 1)/(525 * 286)
const static float framePerSec = 59.9400599f;
DEBUG_LOG(HLE,"%f=sceDisplayGetFramePerSec()", framePerSec);
return framePerSec; // (9MHz * 1)/(525 * 286)
}
u32 sceDisplayIsForeground() {
+2
View File
@@ -431,6 +431,8 @@ SubIntrHandler *__RegisterSubIntrHandler(u32 intrNumber, u32 subIntrNumber, u32
int __ReleaseSubIntrHandler(int intrNumber, int subIntrNumber)
{
if (intrNumber >= PSP_NUMBER_INTERRUPTS)
return -1;
if (!intrHandlers[intrNumber]->has(subIntrNumber))
return -1;
+8 -4
View File
@@ -651,8 +651,12 @@ private:
int size = cur->end - cur->first;
if (size >= cur->capacity - 2)
{
cur->capacity *= 2;
cur->data = (SceUID *)realloc(cur->data, cur->capacity * sizeof(SceUID));
SceUID *new_data = (SceUID *)realloc(cur->data, cur->capacity * sizeof(SceUID));
if (new_data != NULL)
{
cur->capacity *= 2;
cur->data = new_data;
}
}
int newFirst = (cur->capacity - size) / 2;
@@ -2735,6 +2739,8 @@ void __KernelSwitchContext(Thread *target, const char *reason)
hleCurrentThreadName = target->nt.name;
__KernelChangeReadyState(target, currentThread, false);
target->nt.status = (target->nt.status | THREADSTATUS_RUNNING) & ~THREADSTATUS_READY;
__KernelLoadContext(&target->context, (target->nt.attr & PSP_THREAD_ATTR_VFPU) != 0);
}
else
{
@@ -2742,8 +2748,6 @@ void __KernelSwitchContext(Thread *target, const char *reason)
hleCurrentThreadName = NULL;
}
__KernelLoadContext(&target->context, (target->nt.attr & PSP_THREAD_ATTR_VFPU) != 0);
bool fromIdle = oldUID == threadIdleID[0] || oldUID == threadIdleID[1];
bool toIdle = currentThread == threadIdleID[0] || currentThread == threadIdleID[1];
if (!(fromIdle && toIdle))
+1 -1
View File
@@ -23,7 +23,7 @@ static const int modeBpp[4] = { 2, 2, 2, 4 };
void MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMode)
{
if (videoPixelMode > (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0)
if (videoPixelMode >= (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0)
{
ERROR_LOG(ME, "Unexpected videoPixelMode %d, using 0 instead.", videoPixelMode);
videoPixelMode = 0;
+2 -2
View File
@@ -47,7 +47,7 @@ void VagDecoder::DecodeBlock(u8 *&readp) {
int predict_nr = *readp++;
int shift_factor = predict_nr & 0xf;
predict_nr >>= 4;
if (predict_nr >= sizeof(f) / sizeof(s8)) {
if (predict_nr >= sizeof(f) / sizeof(f[0])) {
predict_nr = 0;
}
int flags = *readp++;
@@ -311,7 +311,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
break;
case VOICETYPE_PCM:
{
int size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16)));
u32 size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16)));
Memory::Memcpy(resampleBuffer + 2, voice.pcmAddr, size);
if (numSamples * sizeof(s16) > size)
memset(resampleBuffer + 2 + voice.pcmSize, 0, numSamples * sizeof(s16) - size);
+40 -18
View File
@@ -623,18 +623,17 @@ namespace MIPSInt
continue;
}
double sv = s[i] * mult; // (float)0x7fffffff == (float)0x80000000
int dsv;
// Cap/floor it to 0x7fffffff / 0x80000000
if (sv > 0x7fffffff) sv = 0x7fffffff;
if (sv < (int)0x80000000) sv = (int)0x80000000;
switch ((op >> 21) & 0x1f)
{
case 16: dsv = (int)rint(sv); break; //n
case 17: dsv = s[i]>=0 ? (int)floor(sv) : (int)ceil(sv); break; //z
case 18: dsv = (int)ceil(sv); break; //u
case 19: dsv = (int)floor(sv); break; //d
case 16: d[i] = (int)rint(sv); break; //n
case 17: d[i] = s[i]>=0 ? (int)floor(sv) : (int)ceil(sv); break; //z
case 18: d[i] = (int)ceil(sv); break; //u
case 19: d[i] = (int)floor(sv); break; //d
default: d[i] = 0x7FFFFFFF; break;
}
d[i] = (int) dsv;
}
ApplyPrefixD((float*)d, sz, true);
WriteVector((float*)d, sz, vd);
@@ -837,24 +836,47 @@ namespace MIPSInt
break;
case 2: // vus2i
for (int i = 0; i < GetNumVectorElements(sz); i++) {
u32 value = s[i];
d[i * 2] = (value & 0xFFFF) << 15;
d[i * 2 + 1] = (value & 0xFFFF0000) >> 1;
}
oz = V_Pair;
if (sz == V_Pair) oz = V_Quad;
switch (sz)
{
case V_Pair:
oz = V_Quad;
// Intentional fallthrough.
case V_Single:
for (int i = 0; i < GetNumVectorElements(sz); i++) {
u32 value = s[i];
d[i * 2] = (value & 0xFFFF) << 15;
d[i * 2 + 1] = (value & 0xFFFF0000) >> 1;
}
break;
default:
ERROR_LOG_REPORT(CPU, "vus2i with more than 2 elements.");
break;
}
break;
case 3: // vs2i
for (int i = 0; i < GetNumVectorElements(sz); i++) {
u32 value = s[i];
d[i * 2] = (value & 0xFFFF) << 16;
d[i * 2 + 1] = value & 0xFFFF0000;
}
oz = V_Pair;
if (sz == V_Pair) oz = V_Quad;
switch (sz)
{
case V_Pair:
oz = V_Quad;
// Intentional fallthrough.
case V_Single:
for (int i = 0; i < GetNumVectorElements(sz); i++) {
u32 value = s[i];
d[i * 2] = (value & 0xFFFF) << 16;
d[i * 2 + 1] = value & 0xFFFF0000;
}
break;
default:
ERROR_LOG_REPORT(CPU, "vs2i with more than 2 elements.");
break;
}
break;
default:
_dbg_assert_msg_(CPU,0,"Trying to interpret instruction that can't be interpreted");
break;
+2 -1
View File
@@ -243,7 +243,8 @@ namespace Reporting
Payload &payload = payloadBuffer[pos];
std::string gpuPrimary, gpuFull;
gpu->GetReportingInfo(gpuPrimary, gpuFull);
if (gpu)
gpu->GetReportingInfo(gpuPrimary, gpuFull);
UrlEncoder postdata;
postdata.Add("version", PPSSPP_GIT_VERSION);
+1 -1
View File
@@ -141,7 +141,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>