mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-27 07:20:33 +00:00
fix more MSVC warnings
This commit is contained in:
parent
07c92ec20a
commit
4b6b15fcb1
@ -1576,7 +1576,7 @@ static void printTypedVectorList(MCInst *MI, unsigned OpNum, SStream *O, unsigne
|
||||
arm64_vess vess = 0;
|
||||
|
||||
if (NumLanes) {
|
||||
snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, LaneKind);
|
||||
cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, LaneKind);
|
||||
switch(LaneKind) {
|
||||
default: break;
|
||||
case 'b':
|
||||
@ -1633,7 +1633,7 @@ static void printTypedVectorList(MCInst *MI, unsigned OpNum, SStream *O, unsigne
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
snprintf(Suffix, sizeof(Suffix), ".%c", LaneKind);
|
||||
cs_snprintf(Suffix, sizeof(Suffix), ".%c", LaneKind);
|
||||
switch(LaneKind) {
|
||||
default: break;
|
||||
case 'b':
|
||||
|
@ -14959,7 +14959,7 @@ void arm64_op_addImm(MCInst *MI, int64_t imm)
|
||||
{
|
||||
if (MI->csh->detail) {
|
||||
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM;
|
||||
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = imm;
|
||||
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = (int)imm;
|
||||
MI->flat_insn->detail->arm64.op_count++;
|
||||
}
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ static DecodeStatus DecodeAddiGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
bool HasRs = false;
|
||||
|
||||
if (Rs >= Rt) {
|
||||
@ -532,7 +532,7 @@ static DecodeStatus DecodeDaddiGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
bool HasRs = false;
|
||||
|
||||
if (Rs >= Rt) {
|
||||
@ -569,7 +569,7 @@ static DecodeStatus DecodeBlezlGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
bool HasRs = false;
|
||||
|
||||
if (Rt == 0)
|
||||
@ -611,7 +611,7 @@ static DecodeStatus DecodeBgtzlGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
|
||||
if (Rt == 0)
|
||||
return MCDisassembler_Fail;
|
||||
@ -649,7 +649,7 @@ static DecodeStatus DecodeBgtzGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
bool HasRs = false;
|
||||
bool HasRt = false;
|
||||
|
||||
@ -695,7 +695,7 @@ static DecodeStatus DecodeBlezGroupBranch_4(MCInst *MI, uint32_t insn,
|
||||
|
||||
uint32_t Rs = fieldFromInstruction(insn, 21, 5);
|
||||
uint32_t Rt = fieldFromInstruction(insn, 16, 5);
|
||||
uint32_t Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
uint32_t Imm = (uint32_t)SignExtend64(fieldFromInstruction(insn, 0, 16), 16) << 2;
|
||||
bool HasRs = false;
|
||||
|
||||
if (Rt == 0)
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
#ifdef CAPSTONE_HAS_SPARC
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
2
cs.c
2
cs.c
@ -517,7 +517,7 @@ size_t cs_disasm_ex(csh ud, const uint8_t *buffer, size_t size, uint64_t offset,
|
||||
|
||||
if (handle->skipdata_setup.callback) {
|
||||
skipdata_bytes = handle->skipdata_setup.callback(buffer_org, size_org,
|
||||
offset - offset_org, handle->skipdata_setup.user_data);
|
||||
(size_t)(offset - offset_org), handle->skipdata_setup.user_data);
|
||||
if (skipdata_bytes > size)
|
||||
// remaining data is not enough
|
||||
break;
|
||||
|
13
utils.c
13
utils.c
@ -69,3 +69,16 @@ char *cs_strdup(const char *str)
|
||||
|
||||
return (char *)memmove(new, str, len);
|
||||
}
|
||||
|
||||
// we need this since Windows doesnt have snprintf()
|
||||
int cs_snprintf(char *buffer, size_t size, const char *fmt, ...)
|
||||
{
|
||||
int ret;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
ret = cs_vsnprintf(buffer, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user