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

@ -245,10 +245,10 @@ void generic_bcx(PPCDisasmContext* ctx, uint32_t bo, uint32_t bi, uint32_t dst)
char opcode[10] = "bc"; char opcode[10] = "bc";
if (ctx->instr_code & 1) { 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) { 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); 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"; char opcode[10] = "bcctr";
if (ctx->instr_code & 1) { 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); 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"; char opcode[10] = "bclr";
if (ctx->instr_code & 1) { 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); 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)) { if (!(bo & 4)) {
strcat_s(opcode, "d"); strcat(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz"); strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) { if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f"); strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) { if (cr) {
strcat_s(operands, "4*cr0+"); strcat(operands, "4*cr0+");
operands[4] = cr + '0'; operands[4] = cr + '0';
} }
strcat_s(operands, br_cond[4 + (bi & 3)]); strcat(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", "); strcat(operands, ", ");
} }
} }
else { /* CTR ignored */ else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]); strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) { if (cr) {
strcat_s(operands, "cr0, "); strcat(operands, "cr0, ");
operands[2] = cr + '0'; operands[2] = cr + '0';
} }
} }
if (ctx->instr_code & 1) { 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) { 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 */ 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); ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands, dst);
@ -354,31 +354,31 @@ void opc_bcctrx(PPCDisasmContext* ctx)
} }
if (!(bo & 4)) { if (!(bo & 4)) {
strcat_s(opcode, "d"); strcat(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz"); strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) { if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f"); strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) { if (cr) {
strcat_s(operands, "4*cr0+"); strcat(operands, "4*cr0+");
operands[4] = cr + '0'; operands[4] = cr + '0';
} }
strcat_s(operands, br_cond[4 + (bi & 3)]); strcat(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", "); strcat(operands, ", ");
} }
} }
else { /* CTR ignored */ else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]); strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) { if (cr) {
strcat_s(operands, "cr0, "); strcat(operands, "cr0, ");
operands[2] = cr + '0'; operands[2] = cr + '0';
} }
} }
if (ctx->instr_code & 1) { 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 */ 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); ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands);
@ -406,31 +406,31 @@ void opc_bclrx(PPCDisasmContext* ctx)
} }
if (!(bo & 4)) { if (!(bo & 4)) {
strcat_s(opcode, "d"); strcat(opcode, "d");
strcat_s(opcode, (bo & 2) ? "z" : "nz"); strcat(opcode, (bo & 2) ? "z" : "nz");
if (!(bo & 0x10)) { if (!(bo & 0x10)) {
strcat_s(opcode, (bo & 8) ? "t" : "f"); strcat(opcode, (bo & 8) ? "t" : "f");
if (cr) { if (cr) {
strcat_s(operands, "4*cr0+"); strcat(operands, "4*cr0+");
operands[4] = cr + '0'; operands[4] = cr + '0';
} }
strcat_s(operands, br_cond[4 + (bi & 3)]); strcat(operands, br_cond[4 + (bi & 3)]);
strcat_s(operands, ", "); strcat(operands, ", ");
} }
} }
else { /* CTR ignored */ else { /* CTR ignored */
strcat_s(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]); strcat(opcode, br_cond[((bo >> 1) & 4) | (bi & 3)]);
if (cr) { if (cr) {
strcat_s(operands, "cr0, "); strcat(operands, "cr0, ");
operands[2] = cr + '0'; operands[2] = cr + '0';
} }
} }
if (ctx->instr_code & 1) { 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 */ 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); ctx->instr_str = my_sprintf("%-8s%s0x%08X", opcode, operands);
@ -582,11 +582,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx); opc_illegal(ctx);
} }
else { else {
strcpy_s(opcode, opc_subs[index]); strcpy(opcode, opc_subs[index]);
if (ext_opc & 0x200) /* check OE bit */ if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o"); strcat(opcode, "o");
if (rc_set) if (rc_set)
strcat_s(opcode, "."); strcat(opcode, ".");
if (index == 3 || index == 6 || index == 7 || index == 11 || if (index == 3 || index == 6 || index == 7 || index == 11 ||
index == 15) { /* ugly check for two-operands instructions */ index == 15) { /* ugly check for two-operands instructions */
if (rb != 0) if (rb != 0)
@ -605,11 +605,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx); opc_illegal(ctx);
} }
else { else {
strcpy_s(opcode, opc_adds[index]); strcpy(opcode, opc_adds[index]);
if (ext_opc & 0x200) /* check OE bit */ if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o"); strcat(opcode, "o");
if (rc_set) if (rc_set)
strcat_s(opcode, "."); strcat(opcode, ".");
if (index == 6 || index == 7) { if (index == 6 || index == 7) {
if (rb != 0) if (rb != 0)
opc_illegal(ctx); opc_illegal(ctx);
@ -627,11 +627,11 @@ void opc_group31(PPCDisasmContext* ctx)
opc_illegal(ctx); opc_illegal(ctx);
} }
else { else {
strcpy_s(opcode, opc_muldivs[index]); strcpy(opcode, opc_muldivs[index]);
if (ext_opc & 0x200) /* check OE bit */ if (ext_opc & 0x200) /* check OE bit */
strcat_s(opcode, "o"); strcat(opcode, "o");
if (rc_set) if (rc_set)
strcat_s(opcode, "."); strcat(opcode, ".");
if ((!index || index == 2) && (ext_opc & 0x200)) if ((!index || index == 2) && (ext_opc & 0x200))
opc_illegal(ctx); opc_illegal(ctx);
else else
@ -644,13 +644,13 @@ void opc_group31(PPCDisasmContext* ctx)
fmt_twoop(ctx->instr_str, rc_set ? "mr." : "mr", ra, rs); fmt_twoop(ctx->instr_str, rc_set ? "mr." : "mr", ra, rs);
} }
else { else {
strcpy_s(opcode, opc_logic[index]); strcpy(opcode, opc_logic[index]);
if (!strlen(opcode)) { if (!strlen(opcode)) {
opc_illegal(ctx); opc_illegal(ctx);
} }
else { else {
if (rc_set) if (rc_set)
strcat_s(opcode, "."); strcat(opcode, ".");
fmt_threeop(ctx->instr_str, opcode, ra, rs, rb); fmt_threeop(ctx->instr_str, opcode, ra, rs, rb);
} }
} }