8000 codeformat on tester.c · micropython/micropython@a444181 · GitHub
[go: up one dir, main page]

Skip to content

Commit a444181

Browse files
committed
codeformat on tester.c
1 parent 4b2d823 commit a444181

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/mbedtls_errors/tester.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@ int test_code(int code, char *str) {
1313

1414
// test zero-length buffer
1515
memset(buf, -3, 100);
16-
mbedtls_strerror(code, buf+4, 0);
17-
for (int i=0; i < 10; i++) {
16+
mbedtls_strerror(code, buf + 4, 0);
17+
for (int i = 0; i < 10; i++) {
1818
if (buf[i] != -3) {
1919
printf("Error: guard overwritten buflen=0 i=%d buf[i]=%d\n", i, buf[i]);
2020
ok = 0;
2121
}
2222
}
2323

2424
// test
25-
for(size_t buflen=1; buflen<90; buflen++) {
25+
for (size_t buflen = 1; buflen < 90; buflen++) {
2626
memset(buf, -3, 100);
27-
mbedtls_strerror(code, buf+4, buflen);
28-
for (int i=0; i < 4; i++) {
27+
mbedtls_strerror(code, buf + 4, buflen);
28+
for (int i = 0; i < 4; i++) {
2929
if (buf[i] != -3) {
3030
printf("Error: pre-guard overwritten buflen=%d i=%d buf[i]=%d\n", buflen, i, buf[i]);
3131
ok = 0;
3232
}
3333
}
34-
for (int i=4+buflen; i< 100; i++) {
34+
for (int i = 4 + buflen; i < 100; i++) {
3535
if (buf[i] != -3) {
3636
printf("Error: post-guard overwritten buflen=%d i=%d buf[i]=%d\n", buflen, i, buf[i]);
3737
ok = 0;
3838
}
3939
}
4040
char exp[100];
4141
strncpy(exp, str, buflen);
42-
exp[buflen-1] = 0;
43-
if (strcmp(buf+4, exp) != 0) {
42+
exp[buflen - 1] = 0;
43+
if (strcmp(buf + 4, exp) != 0) {
4444
printf("Error: expected %s, got %s\n", exp, buf);
4545
ok = 0;
4646
}
@@ -53,6 +53,6 @@ int main() {
5353
test_code(0x7200, "MBEDTLS_ERR_SSL_INVALID_RECORD");
5454
test_code(0x7780, "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE");
5555
test_code(0x0074, "MBEDTLS_ERR_SHA256_BAD_INPUT_DATA");
56-
test_code(0x6600|0x0074, "MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH+MBEDTLS_ERR_SHA256_BAD_INPUT_DATA");
56+
test_code(0x6600 | 0x0074, "MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH+MBEDTLS_ERR_SHA256_BAD_INPUT_DATA");
5757
test_code(103, "MBEDTLS_ERR_UNKNOWN (0x0067)");
5858
}

0 commit comments

Comments
 (0)
0