Skip to content
Snippets Groups Projects
Commit b4eb8b5f authored by Lev Walkin's avatar Lev Walkin
Browse files

thorough compilation

parent ba803ed3
No related branches found
No related tags found
No related merge requests found
AM_CFLAGS = @ADD_CFLAGS@
check_SCRIPTS = check-assembly.sh check_SCRIPTS = check-assembly.sh
TESTS_ENVIRONMENT= CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ./check-assembly.sh TESTS_ENVIRONMENT= CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ./check-assembly.sh
......
...@@ -158,6 +158,7 @@ target_alias = @target_alias@ ...@@ -158,6 +158,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@ target_cpu = @target_cpu@
target_os = @target_os@ target_os = @target_os@
target_vendor = @target_vendor@ target_vendor = @target_vendor@
AM_CFLAGS = @ADD_CFLAGS@
check_SCRIPTS = check-assembly.sh check_SCRIPTS = check-assembly.sh
TESTS_ENVIRONMENT = CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ./check-assembly.sh TESTS_ENVIRONMENT = CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ./check-assembly.sh
@CPLUSPLUS_FOUND_FALSE@TESTS = check-*.c @CPLUSPLUS_FOUND_FALSE@TESTS = check-*.c
......
...@@ -168,9 +168,9 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -168,9 +168,9 @@ partial_read(uint8_t *buf, size_t size) {
T_t t, *tp; T_t t, *tp;
ber_dec_rval_t rval; ber_dec_rval_t rval;
size_t i1, i2; size_t i1, i2;
uint8_t *buf1 = alloca(size); uint8_t *tbuf1 = alloca(size);
uint8_t *buf2 = alloca(size); uint8_t *tbuf2 = alloca(size);
uint8_t *buf3 = alloca(size); uint8_t *tbuf3 = alloca(size);
fprintf(stderr, "\nPartial read sequence...\n"); fprintf(stderr, "\nPartial read sequence...\n");
...@@ -190,44 +190,44 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -190,44 +190,44 @@ partial_read(uint8_t *buf, size_t size) {
size_t size3 = size - size1 - size2; size_t size3 = size - size1 - size2;
fprintf(stderr, "\n%d:{%d, %d, %d}...\n", fprintf(stderr, "\n%d:{%d, %d, %d}...\n",
size, size1, size2, size3); (int)size, (int)size1, (int)size2, (int)size3);
memset(buf1, 0, size); memset(tbuf1, 0, size);
memset(buf2, 0, size); memset(tbuf2, 0, size);
memset(buf3, 0, size); memset(tbuf3, 0, size);
memcpy(buf1, chunk1, size1); memcpy(tbuf1, chunk1, size1);
memcpy(buf2, chunk2, size2); memcpy(tbuf2, chunk2, size2);
memcpy(buf3, chunk3, size3); memcpy(tbuf3, chunk3, size3);
tp = memset(&t, 0, sizeof(t)); tp = memset(&t, 0, sizeof(t));
fprintf(stderr, "=> Chunk 1 (%d):\n", size1); fprintf(stderr, "=> Chunk 1 (%d):\n", (int)size1);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf1, size1); tbuf1, size1);
assert(rval.code == RC_WMORE); assert(rval.code == RC_WMORE);
assert(rval.consumed <= size1); assert(rval.consumed <= size1);
if(rval.consumed < size1) { if(rval.consumed < size1) {
int leftover = size1 - rval.consumed; int leftover = size1 - rval.consumed;
memcpy(buf2, buf1 + rval.consumed, leftover); memcpy(tbuf2, tbuf1 + rval.consumed, leftover);
memcpy(buf2 + leftover, chunk2, size2); memcpy(tbuf2 + leftover, chunk2, size2);
size2 += leftover; size2 += leftover;
} }
fprintf(stderr, "=> Chunk 2 (%d):\n", size2); fprintf(stderr, "=> Chunk 2 (%d):\n", (int)size2);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf2, size2); tbuf2, size2);
assert(rval.code == RC_WMORE); assert(rval.code == RC_WMORE);
assert(rval.consumed <= size2); assert(rval.consumed <= size2);
if(rval.consumed < size2) { if(rval.consumed < size2) {
int leftover = size2 - rval.consumed; int leftover = size2 - rval.consumed;
memcpy(buf3, buf2 + rval.consumed, leftover); memcpy(tbuf3, tbuf2 + rval.consumed, leftover);
memcpy(buf3 + leftover, chunk3, size3); memcpy(tbuf3 + leftover, chunk3, size3);
size3 += leftover; size3 += leftover;
} }
fprintf(stderr, "=> Chunk 3 (%d):\n", size3); fprintf(stderr, "=> Chunk 3 (%d):\n", (int)size3);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf3, size3); tbuf3, size3);
assert(rval.code == RC_OK); assert(rval.code == RC_OK);
assert(rval.consumed == size3); assert(rval.consumed == size3);
......
...@@ -70,7 +70,7 @@ uint8_t buf1_reconstr[] = { ...@@ -70,7 +70,7 @@ uint8_t buf1_reconstr[] = {
}; };
int buf_pos; int buf_pos;
int bytes_compare(const void *bufferp, size_t size, void *key) { static int bytes_compare(const void *bufferp, size_t size, void *key) {
const uint8_t *buffer = bufferp; const uint8_t *buffer = bufferp;
assert(buf_pos + size <= sizeof(buf1_reconstr)); assert(buf_pos + size <= sizeof(buf1_reconstr));
......
...@@ -120,7 +120,7 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) { ...@@ -120,7 +120,7 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
tp = memset(tp, 0, sizeof(*tp)); tp = memset(tp, 0, sizeof(*tp));
fprintf(stderr, "Buf %p (%d)\n", buf, size); fprintf(stderr, "Buf %p (%d)\n", buf, (int)size);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, buf, size); rval = ber_decode(&asn1_DEF_T, (void **)&tp, buf, size);
fprintf(stderr, "Returned code %d, consumed %d\n", fprintf(stderr, "Returned code %d, consumed %d\n",
(int)rval.code, (int)rval.consumed); (int)rval.code, (int)rval.consumed);
...@@ -143,13 +143,14 @@ buf_fill(const void *buffer, size_t size, void *app_key) { ...@@ -143,13 +143,14 @@ buf_fill(const void *buffer, size_t size, void *app_key) {
(void)app_key; (void)app_key;
if(buf_pos + size > buf_size) { if(buf_pos + size > buf_size) {
fprintf(stderr, "%d + %d > %d\n", buf_pos, (int)size, buf_size); fprintf(stderr, "%d + %d > %d\n",
(int)buf_pos, (int)size, (int)buf_size);
return -1; return -1;
} }
memcpy(buf + buf_pos, buffer, size); memcpy(buf + buf_pos, buffer, size);
buf_pos += size; buf_pos += size;
fprintf(stderr, " written %d (%d)\n", (int)size, buf_pos); fprintf(stderr, " written %d (%d)\n", (int)size, (int)buf_pos);
return 0; return 0;
} }
...@@ -212,7 +213,7 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -212,7 +213,7 @@ partial_read(uint8_t *buf, size_t size) {
size_t size3 = size - size1 - size2; size_t size3 = size - size1 - size2;
fprintf(stderr, "\n%d:{%d, %d, %d}...\n", fprintf(stderr, "\n%d:{%d, %d, %d}...\n",
size, size1, size2, size3); (int)size, (int)size1, (int)size2, (int)size3);
memset(buf1, 0, size); memset(buf1, 0, size);
memset(buf2, 0, size); memset(buf2, 0, size);
...@@ -223,7 +224,7 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -223,7 +224,7 @@ partial_read(uint8_t *buf, size_t size) {
tp = memset(&t, 0, sizeof(t)); tp = memset(&t, 0, sizeof(t));
fprintf(stderr, "=> Chunk 1 (%d):\n", size1); fprintf(stderr, "=> Chunk 1 (%d):\n", (int)size1);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf1, size1); buf1, size1);
assert(rval.code == RC_WMORE); assert(rval.code == RC_WMORE);
...@@ -235,7 +236,7 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -235,7 +236,7 @@ partial_read(uint8_t *buf, size_t size) {
size2 += leftover; size2 += leftover;
} }
fprintf(stderr, "=> Chunk 2 (%d):\n", size2); fprintf(stderr, "=> Chunk 2 (%d):\n", (int)size2);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf2, size2); buf2, size2);
assert(rval.code == RC_WMORE); assert(rval.code == RC_WMORE);
...@@ -247,7 +248,7 @@ partial_read(uint8_t *buf, size_t size) { ...@@ -247,7 +248,7 @@ partial_read(uint8_t *buf, size_t size) {
size3 += leftover; size3 += leftover;
} }
fprintf(stderr, "=> Chunk 3 (%d):\n", size3); fprintf(stderr, "=> Chunk 3 (%d):\n", (int)size3);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf3, size3); buf3, size3);
assert(rval.code == RC_OK); assert(rval.code == RC_OK);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment