Merge pull request #3686 from unknownbrackets/warnings

Warning fixes
This commit is contained in:
Henrik Rydgård 2013-09-08 00:33:46 -07:00
commit 2b2678beba
12 changed files with 47 additions and 29 deletions

View File

@ -230,8 +230,8 @@ void UpdateConfirmCancelKeys() {
};
// If they're not already bound, add them in.
for(int i = 0; i < ARRAY_SIZE(hardcodedConfirmKeys); i++) {
if(std::find(confirmKeys.begin(), confirmKeys.end(), hardcodedConfirmKeys[i]) == confirmKeys.end())
for (size_t i = 0; i < ARRAY_SIZE(hardcodedConfirmKeys); i++) {
if (std::find(confirmKeys.begin(), confirmKeys.end(), hardcodedConfirmKeys[i]) == confirmKeys.end())
confirmKeys.push_back(hardcodedConfirmKeys[i]);
}
@ -240,8 +240,8 @@ void UpdateConfirmCancelKeys() {
NKCODE_BACK,
};
for(int i = 0; i < ARRAY_SIZE(hardcodedCancelKeys); i++) {
if(std::find(cancelKeys.begin(), cancelKeys.end(), hardcodedCancelKeys[i]) == cancelKeys.end())
for (size_t i = 0; i < ARRAY_SIZE(hardcodedCancelKeys); i++) {
if (std::find(cancelKeys.begin(), cancelKeys.end(), hardcodedCancelKeys[i]) == cancelKeys.end())
cancelKeys.push_back(hardcodedCancelKeys[i]);
}
@ -700,7 +700,7 @@ void LoadFromIni(IniFile &file) {
}
IniFile::Section *controls = file.GetOrCreateSection("ControlMapping");
for (int i = 0; i < ARRAY_SIZE(psp_button_names); i++) {
for (size_t i = 0; i < ARRAY_SIZE(psp_button_names); i++) {
std::string value;
controls->Get(psp_button_names[i].name.c_str(), &value, "");
@ -728,7 +728,7 @@ void LoadFromIni(IniFile &file) {
void SaveToIni(IniFile &file) {
IniFile::Section *controls = file.GetOrCreateSection("ControlMapping");
for (int i = 0; i < ARRAY_SIZE(psp_button_names); i++) {
for (size_t i = 0; i < ARRAY_SIZE(psp_button_names); i++) {
std::vector<KeyDef> keys;
KeyFromPspButton(psp_button_names[i].key, &keys);

View File

@ -278,13 +278,12 @@ void Config::Save() {
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
recent->Set("MaxRecent", iMaxRecent);
for (int i = 0; i < iMaxRecent; i++) {
for (int i = 0; i < iMaxRecent; i++) {
char keyName[64];
sprintf(keyName,"FileName%d",i);
if (i < recentIsos.size()) {
if (i < (int)recentIsos.size()) {
recent->Set(keyName, recentIsos[i]);
}
else {
} else {
recent->Delete(keyName); // delete the nonexisting FileName
}
}

View File

@ -548,8 +548,13 @@ PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {
if (x.type != FILETYPE_DIRECTORY)
{
#ifdef _WIN32
struct _stat64i32 s;
_wstat64i32(ConvertUTF8ToWString(fullName).c_str(), &s);
#else
struct stat s;
stat(fullName.c_str(), &s);
#endif
x.size = File::GetSize(fullName);
x.access = s.st_mode & 0x1FF;

View File

@ -50,7 +50,7 @@ struct WaitVBlankInfo
{
WaitVBlankInfo(u32 tid) : threadID(tid), vcountUnblock(1) {}
WaitVBlankInfo(u32 tid, int vcount) : threadID(tid), vcountUnblock(vcount) {}
u32 threadID;
SceUID threadID;
// Number of vcounts to block for.
int vcountUnblock;

View File

@ -194,7 +194,7 @@ int sceNetAdhocSetSocketAlert(int id, int flag) {
}
int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonblock) {
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPollSocket(%08x, %i, %i, %i)", count, timeout, nonblock);
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPollSocket(%08x, %i, %i, %i)", socketStructAddr, count, timeout, nonblock);
return -1;
}
@ -345,7 +345,7 @@ int sceNetAdhocGetPtpStat(int structSize, u32 structAddr) {
}
int sceNetAdhocPtpOpen(const char *srcmac, int srcport, const char *dstmac, int dstport, int bufsize, int retryDelay, int retryCount, int unknown) {
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPtpOpen(%s : %i, %s : %i, %i, %i, %i)", srcmac, srcport, dstmac, dstport, bufsize, retryDelay, retryCount, unknown);
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPtpOpen(%s : %i, %s : %i, %i, %i, %i, %08x)", srcmac, srcport, dstmac, dstport, bufsize, retryDelay, retryCount, unknown);
return 0;
}
@ -444,7 +444,7 @@ int sceNetAdhocMatchingCreate(int mode, int maxPeers, int port, int bufSize, int
}
int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) {
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %i, %i, %08x)", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr);
ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x)", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr);
return -1;
}

View File

@ -156,7 +156,7 @@ void Jit::BranchRSRTComp(MIPSOpcode op, Gen::CCFlags cc, bool likely)
{
case CC_E: skipBranch = rsImm == rtImm; break;
case CC_NE: skipBranch = rsImm != rtImm; break;
default: _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSRTComp().");
default: skipBranch = false; _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSRTComp().");
}
if (skipBranch)
@ -256,7 +256,7 @@ void Jit::BranchRSZeroComp(MIPSOpcode op, Gen::CCFlags cc, bool andLink, bool li
case CC_GE: skipBranch = imm >= 0; break;
case CC_L: skipBranch = imm < 0; break;
case CC_LE: skipBranch = imm <= 0; break;
default: _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSZeroComp().");
default: skipBranch = false; _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSZeroComp().");
}
if (skipBranch)

View File

@ -271,7 +271,11 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
bool success = coreParameter.fileToStart != "";
*error_string = coreParameter.errorString;
if (success) {
GPU_Init();
success = GPU_Init();
if (!success) {
PSP_Shutdown();
*error_string = "Unable to initialize rendering engine.";
}
}
return success;
}

View File

@ -839,13 +839,8 @@ void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType pr
if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS)
Flush();
// TODO: Is this the right thing to do?
if (prim == GE_PRIM_KEEP_PREVIOUS) {
switch(prevPrim_) {
case GE_PRIM_LINE_STRIP:
case GE_PRIM_TRIANGLE_STRIP:
case GE_PRIM_TRIANGLE_FAN:
break;
}
prim = prevPrim_;
}
prevPrim_ = prim;

View File

@ -29,7 +29,7 @@ GPUStateCache gstate_c;
GPUInterface *gpu;
GPUStatistics gpuStats;
void GPU_Init() {
bool GPU_Init() {
switch (PSP_CoreParameter().gpuCore) {
case GPU_NULL:
gpu = new NullGPU();
@ -37,12 +37,17 @@ void GPU_Init() {
case GPU_GLES:
gpu = new GLES_GPU();
break;
#ifndef __SYMBIAN32__
case GPU_SOFTWARE:
#ifndef __SYMBIAN32__
gpu = new SoftGPU();
break;
#endif
break;
case GPU_DIRECTX9:
// TODO
break;
}
return gpu != NULL;
}
void GPU_Shutdown() {

View File

@ -490,7 +490,7 @@ struct GPUStatistics {
int numFBOs;
};
void GPU_Init();
bool GPU_Init();
void GPU_Shutdown();
void InitGfxState();

View File

@ -39,10 +39,10 @@ void Process(VertexData& vertex)
Vec3<float> L = Vec3<float>(getFloat24(gstate.lpos[3*light]&0xFFFFFF), getFloat24(gstate.lpos[3*light+1]&0xFFFFFF),getFloat24(gstate.lpos[3*light+2]&0xFFFFFF));
float diffuse_factor = Dot(L,vertex.worldnormal) / L.Length() / vertex.worldnormal.Length();
if (gstate.getUVLS0() == light)
if (gstate.getUVLS0() == (int)light)
vertex.texturecoords.s() = (diffuse_factor + 1.f) / 2.f;
if (gstate.getUVLS1() == light)
if (gstate.getUVLS1() == (int)light)
vertex.texturecoords.t() = (diffuse_factor + 1.f) / 2.f;
}
}

View File

@ -237,6 +237,9 @@ static inline u32 GetPixelColor(int x, int y)
case GE_FORMAT_8888:
return *(u32*)&fb[4*x + 4*y*gstate.FrameBufStride()];
case GE_FORMAT_INVALID:
_dbg_assert_msg_(G3D, false, "Software: invalid framebuf format.");
}
return 0;
}
@ -259,6 +262,9 @@ static inline void SetPixelColor(int x, int y, u32 value)
case GE_FORMAT_8888:
*(u32*)&fb[4*x + 4*y*gstate.FrameBufStride()] = value;
break;
case GE_FORMAT_INVALID:
_dbg_assert_msg_(G3D, false, "Software: invalid framebuf format.");
}
}
@ -481,6 +487,10 @@ static inline bool ColorTestPassed(Vec3<int> color)
case GE_COMP_NOTEQUAL:
return c != ref;
default:
ERROR_LOG_REPORT(G3D, "Software: Invalid colortest function: %d", gstate.getColorTestFunction());
break;
}
return true;
}