Revert strcat_s/strcpy_s to strcat/strcpy.

This commit is contained in:
Maxim Poliakovski 2020-02-04 13:05:22 +01:00
parent 37078ddfe1
commit 5d5c568714

View File

@ -34,7 +34,7 @@ const char* bx_mnem[4] = {
const char* bclrx_mnem[2] = {
"bclr", "bclrl"
};
};
const char* bcctrx_mnem[2] = {
"bcctr", "bcctrl"
@ -46,7 +46,7 @@ const char* br_cond[8] = { /* simplified branch conditions */
const char* bclrx_cond[8] = { /* simplified branch conditions */
"gelr", "lelr", "nelr", "nslr", "ltlr", "gtlr", "eqlr", "solr"
};
};
const char* bcctrx_cond[8] = { /* simplified branch conditions */
"gectr", "lectr", "nectr", "nsctr", "ltctr", "gtctr", "eqctr", "soctr"
@ -245,10 +245,10 @@ void generic_bcx(PPCDisasmContext* ctx, uint32_t bo, uint32_t bi, uint32_t dst)
char opcode[10] = "bc";
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
if (ctx->instr_code & 2) {
strcat_s(opcode, "a"); /* add suffix "a" if the AA bit is set */
strcat(opcode, "a"); /* add suffix "a" if the AA bit is set */
}
ctx->instr_str = my_sprintf("%-8s%d, %d, 0x%08X", opcode, bo, bi, dst);
}
@ -258,7 +258,7 @@ void generic_bcctrx(PPCDisasmContext* ctx, uint32_t bo, uint32_t bi)
char opcode[10] = "bcctr";
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
ctx->instr_str = my_sprintf("%-8s%d, %d, 0x%08X", opcode, bo, bi);
@ -269,7 +269,7 @@ void generic_bclrx(PPCDisasmContext* ctx, uint32_t bo, uint32_t bi)
char opcode[10] = "bclr";
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
ctx->instr_str = my_sprintf("%-8s%d, %d, 0x%08X", opcode, bo, bi);
@ -299,34 +299,34 @@ void opc_bcx(PPCDisasmContext* ctx)
}
if (!(bo & 4)) {
strcat_s(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz");
strcat(opcode, "d");
strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f");
strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) {
strcat_s(operands, "4*cr0+");
strcat(operands, "4*cr0+");
operands[4] = cr + '0';
}
strcat_s(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", ");
strcat(operands, br_cond[4 + (bi & 3)]);
strcat(operands, ", ");
}
}
else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) {
strcat_s(operands, "cr0, ");
strcat(operands, "cr0, ");
operands[2] = cr + '0';
}
}
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
if (ctx->instr_code & 2) {
strcat_s(opcode, "a"); /* add suffix "a" if the AA bit is set */
strcat(opcode, "a"); /* add suffix "a" if the AA bit is set */
}
if (bo & 1) { /* incorporate prediction bit if set */
strcat_s(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
strcat(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
}
ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands, dst);
@ -354,31 +354,31 @@ void opc_bcctrx(PPCDisasmContext* ctx)
}
if (!(bo & 4)) {
strcat_s(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz");
strcat(opcode, "d");
strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f");
strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) {
strcat_s(operands, "4*cr0+");
strcat(operands, "4*cr0+");
operands[4] = cr + '0';
}
strcat_s(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", ");
strcat(operands, br_cond[4 + (bi & 3)]);
strcat(operands, ", ");
}
}
else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) {
strcat_s(operands, "cr0, ");
strcat(operands, "cr0, ");
operands[2] = cr + '0';
}
}
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
if (bo & 1) { /* incorporate prediction bit if set */
strcat_s(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
strcat(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
}
ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands);
@ -406,31 +406,31 @@ void opc_bclrx(PPCDisasmContext* ctx)
}
if (!(bo & 4)) {
strcat_s(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz");
strcat(opcode, "d");
strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f");
strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) {
strcat_s(operands, "4*cr0+");
strcat(operands, "4*cr0+");
operands[4] = cr + '0';
}
strcat_s(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", ");
strcat(operands, br_cond[4 + (bi & 3)]);
strcat(operands, ", ");
}
}
else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) {
strcat_s(operands, "cr0, ");
strcat(operands, "cr0, ");
operands[2] = cr + '0';
}
}
if (ctx->instr_code & 1) {
strcat_s(opcode, "l"); /* add suffix "l" if the LK bit is set */
strcat(opcode, "l"); /* add suffix "l" if the LK bit is set */
}
if (bo & 1) { /* incorporate prediction bit if set */
strcat_s(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
strcat(opcode, (ctx->instr_code & 0x8000) ? "-" : "+");
}
ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands);
@ -582,11 +582,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx);
}
else {
strcpy_s(opcode, opc_subs[index]);
strcpy(opcode, opc_subs[index]);
if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o");
strcat(opcode, "o");
if (rc_set)
strcat_s(opcode, ".");
strcat(opcode, ".");
if (index == 3 || index == 6 || index == 7 || index == 11 ||
index == 15) { /* ugly check for two-operands instructions */
if (rb != 0)
@ -605,11 +605,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx);
}
else {
strcpy_s(opcode, opc_adds[index]);
strcpy(opcode, opc_adds[index]);
if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o");
strcat(opcode, "o");
if (rc_set)
strcat_s(opcode, ".");
strcat(opcode, ".");
if (index == 6 || index == 7) {
if (rb != 0)
opc_illegal(ctx);
@ -627,11 +627,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx);
}
else {
strcpy_s(opcode, opc_muldivs[index]);
strcpy(opcode, opc_muldivs[index]);
if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o");
strcat(opcode, "o");
if (rc_set)
strcat_s(opcode, ".");
strcat(opcode, ".");
if ((!index || index == 2) && (ext_opc & 0x200))
opc_illegal(ctx);
else
@ -644,13 +644,13 @@ void opc_group31(PPCDisasmContext* ctx)
fmt_twoop(ctx->instr_str, rc_set ? "mr." : "mr", ra, rs);
}
else {
strcpy_s(opcode, opc_logic[index]);
strcpy(opcode, opc_logic[index]);
if (!strlen(opcode)) {
opc_illegal(ctx);
}
else {
if (rc_set)
strcat_s(opcode, ".");
strcat(opcode, ".");
fmt_threeop(ctx->instr_str, opcode, ra, rs, rb);
}
}
@ -785,4 +785,4 @@ string disassemble_single(PPCDisasmContext* ctx)
ctx->instr_addr += 4;
return ctx->instr_str;
}
}