Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
libaec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mathis Rosenhauer
libaec
Commits
8a6aeb58
Commit
8a6aeb58
authored
Oct 13, 2017
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows: support snprintf for older MSVC
parent
e3d026ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
CMakeLists.txt
CMakeLists.txt
+7
-0
cmake/config.h.in
cmake/config.h.in
+3
-0
configure.ac
configure.ac
+1
-1
tests/check_aec.h
tests/check_aec.h
+14
-0
No files found.
CMakeLists.txt
View file @
8a6aeb58
...
...
@@ -3,6 +3,7 @@ set(CMAKE_C_STANDARD 99)
include
(
CheckIncludeFiles
)
include
(
TestBigEndian
)
include
(
CheckCSourceCompiles
)
include
(
CheckSymbolExists
)
include
(
cmake/macros.cmake
)
project
(
libaec
)
set
(
libaec_VERSION_MAJOR 1
)
...
...
@@ -21,6 +22,12 @@ endif(NOT HAVE_DECL___BUILTIN_CLZLL)
find_inline_keyword
()
find_restrict_keyword
()
check_symbol_exists
(
snprintf
"stdio.h"
HAVE_SNPRINTF
)
if
(
NOT HAVE_SNPRINTF
)
check_symbol_exists
(
_snprintf
"stdio.h"
HAVE__SNPRINTF
)
check_symbol_exists
(
_snprintf_s
"stdio.h"
HAVE__SNPRINTF_S
)
endif
(
NOT HAVE_SNPRINTF
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h
)
...
...
cmake/config.h.in
View file @
8a6aeb58
...
...
@@ -3,3 +3,6 @@
#cmakedefine WORDS_BIGENDIAN 1
#cmakedefine HAVE_DECL___BUILTIN_CLZLL 1
#cmakedefine HAVE_BSR64 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE__SNPRINTF 1
#cmakedefine HAVE__SNPRINTF_S 1
configure.ac
View file @
8a6aeb58
...
...
@@ -25,7 +25,7 @@ AC_TYPE_UINT8_T
AC_C_INLINE
AC_C_RESTRICT
AC_CHECK_FUNCS([memset strstr])
AC_CHECK_FUNCS([memset strstr
snprintf
])
AC_CHECK_DECLS(__builtin_clzll)
AM_EXTRA_RECURSIVE_TARGETS([bench benc bdec])
...
...
tests/check_aec.h
View file @
8a6aeb58
#ifndef CHECK_AEC_H
#define CHECK_AEC_H 1
#include <config.h>
#include "libaec.h"
struct
test_state
{
...
...
@@ -24,6 +26,18 @@ int update_state(struct test_state *state);
int
encode_decode_small
(
struct
test_state
*
state
);
int
encode_decode_large
(
struct
test_state
*
state
);
#ifndef HAVE_SNPRINTF
#ifdef HAVE__SNPRINTF_S
#define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
#else
#ifdef HAVE__SNPRINTF
#define snprintf _snprintf
#else
#error "no snprintf compatible function found"
#endif
/* HAVE__SNPRINTF */
#endif
/* HAVE__SNPRINTF_S */
#endif
/* HAVE_SNPRINTF */
#ifdef _WIN32
#define CHECK_PASS "PASS"
#define CHECK_FAIL "FAIL"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment