Skip to content

Commit

Permalink
AVRO-2955: Fix C++ compliance for VS2010.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyolee committed Sep 20, 2024
1 parent f3b9b85 commit eede6b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lang/c/src/schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "st.h"
#include "schema.h"

#if defined(_MSC_VER) && _MSC_VER < 1700 && defined(__cplusplus)
#define namespace _Namespace
#endif

#define DEFAULT_TABLE_SIZE 32

/* forward declaration */
Expand Down
6 changes: 3 additions & 3 deletions lang/c/tests/test_interop_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int should_test(char *d_name)
}

ptrdiff_t diff = d_name + strlen(d_name) - ext_pos;
char *substr = malloc(sizeof(char) * diff);
char *substr = (char *) malloc(sizeof(char) * diff);
strncpy(substr, ext_pos + 1, diff - 1);
*(substr + diff - 1) = '\0';
if (strcmp(substr, "avro") != 0)
Expand All @@ -57,7 +57,7 @@ int should_test(char *d_name)
}

diff = ext_pos - codec_pos;
substr = malloc(sizeof(char) * diff);
substr = (char *) malloc(sizeof(char) * diff);
strncpy(substr, codec_pos + 1, diff - 1);
*(substr + diff - 1) = '\0';
if (strcmp(substr, "deflate") == 0 || strcmp(substr, "snappy") == 0)
Expand Down Expand Up @@ -96,7 +96,7 @@ int main(int argc, char *argv[])
char *d_name = ent->d_name;
size_t d_name_len = strlen(d_name);
size_t size = strlen(argv[1]) + d_name_len + 2;
char* path = malloc(sizeof(char) * size);
char* path = (char *) malloc(sizeof(char) * size);
sprintf(path, "%s/%s", argv[1], d_name);

if (!should_test(d_name))
Expand Down

0 comments on commit eede6b1

Please sign in to comment.