fix sscanf types

This commit is contained in:
latot 2016-12-02 22:46:52 -03:00
parent e049cceed7
commit 7047ad2271
9 changed files with 18 additions and 18 deletions

View File

@ -78,7 +78,7 @@ void ARMXEmitter::ARMABI_PopAllCalleeSavedRegsAndAdjustStack() {
const char *conditions[] = {"EQ", "NEQ", "CS", "CC", "MI", "PL", "VS", "VC", "HI", "LS", "GE", "LT", "GT", "LE", "AL" };
static void ShowCondition(u32 cond)
{
printf("Condition: %s[%d]\n", conditions[cond], cond);
printf("Condition: %s[%d]\n", conditions[cond], (int)cond);
}
void ARMXEmitter::ARMABI_ShowConditions()
{

View File

@ -3036,7 +3036,7 @@ void ARMXEmitter::VMOV_imm(u32 Size, ARMReg Vd, VIMMMode type, int imm) {
return;
error:
_dbg_assert_msg_(JIT, false, "Bad Size or type specified in %s: Size %i Type %i", __FUNCTION__, Size, type);
_dbg_assert_msg_(JIT, false, "Bad Size or type specified in %s: Size %i Type %i", __FUNCTION__, (int)Size, type);
}
void ARMXEmitter::VMOV_immf(ARMReg Vd, float value) { // This only works with a select few values. I've hardcoded 1.0f.

View File

@ -95,7 +95,7 @@ bool SymbolMap::LoadSymbolMap(const char *filename) {
}
}
if (strlen(line) < 4 || sscanf(line, "%s", temp) != 1)
if (strlen(line) < 4 || sscanf(line, "%255s", temp) != 1)
continue;
if (strcmp(temp,"UNUSED")==0) continue;
@ -123,7 +123,7 @@ bool SymbolMap::LoadSymbolMap(const char *filename) {
SymbolType type;
char name[128] = {0};
if (sscanf(line, ".module %x %08x %08x %127c", &moduleIndex, &address, &size, name) >= 3) {
if (sscanf(line, ".module %x %08x %08x %127c", (unsigned int *)&moduleIndex, &address, &size, name) >= 3) {
// Found a module definition.
ModuleEntry mod;
mod.index = moduleIndex;
@ -229,7 +229,7 @@ bool SymbolMap::LoadNocashSym(const char *filename) {
break;
u32 address;
if (sscanf(line, "%08X %s", &address, value) != 2)
if (sscanf(line, "%08X %255s", &address, value) != 2)
continue;
if (address == 0 && strcmp(value, "0") == 0)
continue;
@ -255,7 +255,7 @@ bool SymbolMap::LoadNocashSym(const char *filename) {
}
}
} else { // labels
int size = 1;
unsigned int size = 1;
char* seperator = strchr(value, ',');
if (seperator != NULL) {
*seperator = 0;

View File

@ -386,7 +386,7 @@ public:
(nt.status & THREADSTATUS_SUSPEND) ? "SUSPEND" : "",
(nt.status & THREADSTATUS_DORMANT) ? "DORMANT" : "",
(nt.status & THREADSTATUS_DEAD) ? "DEAD" : "",
nt.waitType,
(int)nt.waitType,
nt.waitID,
waitInfo.waitValue);
}

View File

@ -332,7 +332,7 @@ void CtrlDisAsmView::paintEvent(QPaintEvent *)
}
if (mojs)
{
int offs;
unsigned int offs;
sscanf(mojs+3,"%08x",&offs);
branches[numBranches].src=rowY1 + rowHeight/2;
branches[numBranches].srcAddr=address/align;

View File

@ -25,7 +25,7 @@ void populate_sources(const char *filter, std::vector<std::vector<char> > &sourc
}
}
printf("Loaded %d json files\n", sources.size());
printf("Loaded %d json files\n", (int)sources.size());
}
#define IDENT(n) for (int i = 0; i < n; ++i) printf(" ")
@ -91,13 +91,13 @@ int main(int argc, char **argv)
int passed = 0;
for (size_t i = 0; i < sources.size(); ++i)
{
printf("Parsing %d\n", i + 1);
printf("Parsing %d\n", (int)i + 1);
if (parse(&sources[i][0]))
{
++passed;
}
}
printf("Passed %d from %d tests\n", passed, sources.size());
printf("Passed %d from %d tests\n", passed, (int)sources.size());
// Pass
sources.clear();
@ -106,13 +106,13 @@ int main(int argc, char **argv)
passed = 0;
for (size_t i = 0; i < sources.size(); ++i)
{
printf("Parsing %d\n", i + 1);
printf("Parsing %d\n", (int)i + 1);
if (parse(&sources[i][0]))
{
++passed;
}
}
printf("Passed %d from %d tests\n", passed, sources.size());
printf("Passed %d from %d tests\n", passed, (int)sources.size());
return 0;
}

View File

@ -160,7 +160,7 @@ void DeChunk(Buffer *inbuffer, Buffer *outbuffer, int contentLength, float *prog
inbuffer->TakeLineCRLF(&line);
if (!line.size())
return;
int chunkSize;
unsigned int chunkSize;
sscanf(line.c_str(), "%x", &chunkSize);
if (chunkSize) {
std::string data;

View File

@ -833,7 +833,7 @@ int main(int argc, char **argv) {
char locales[256];
int pixheight;
float vertOffset = 0;
sscanf(rest, "%s %s %s %i %f", fontname, fontfile, locales, &pixheight, &vertOffset);
sscanf(rest, "%255s %255s %255s %i %f", fontname, fontfile, locales, &pixheight, &vertOffset);
printf("Font: %s (%s) in size %i. Locales: %s\n", fontname, fontfile, pixheight, locales);
std::vector<CharRange> ranges;
@ -846,7 +846,7 @@ int main(int argc, char **argv) {
char imagename[256];
char imagefile[256];
char effectname[256];
sscanf(rest, "%s %s %s", imagename, imagefile, effectname);
sscanf(rest, "%255s %255s %255s", imagename, imagefile, effectname);
Effect effect = GetEffect(effectname);
printf("Image %s with effect %s (%i)\n", imagefile, effectname, (int)effect);
ImageDesc desc;

View File

@ -28,7 +28,7 @@ int Version::ToInteger() const {
}
bool ParseMacAddress(std::string str, uint8_t macAddr[6]) {
int mac[6];
unsigned int mac[6];
if (6 != sscanf(str.c_str(), "%02x:%02x:%02x:%02x:%02x:%02x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) {
return false;
}