Fully fixed C library code to be compilable in C++ mode (polyglot).

This commit is contained in:
Project Nayuki 2017-07-04 06:18:14 +00:00
parent ce58036cb2
commit 88cc1c05fd
2 changed files with 9 additions and 11 deletions

View File

@ -27,10 +27,16 @@
#include <string.h> #include <string.h>
#include "qrcodegen.h" #include "qrcodegen.h"
#ifdef QRCODEGEN_TEST #ifndef QRCODEGEN_TEST
#define testable // Expose private functions
#else
#define testable static // Keep functions private #define testable static // Keep functions private
#else
// Expose private functions
#ifndef __cplusplus
#define testable
#else
// Needed for const variables because they are treated as implicitly 'static' in C++
#define testable extern
#endif
#endif #endif

View File

@ -77,10 +77,6 @@ enum qrcodegen_Mask {
/*---- Functions to generate QR Codes ----*/ /*---- Functions to generate QR Codes ----*/
#ifdef __cplusplus
extern "C" {
#endif
/* /*
* Encodes the given text string to a QR Code symbol, returning true if encoding succeeded. * Encodes the given text string to a QR Code symbol, returning true if encoding succeeded.
* If the data is too long to fit in any version in the given range * If the data is too long to fit in any version in the given range
@ -144,7 +140,3 @@ int qrcodegen_getSize(const uint8_t qrcode[]);
* If the given coordinates are out of bounds, then false (white) is returned. * If the given coordinates are out of bounds, then false (white) is returned.
*/ */
bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y); bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);
#ifdef __cplusplus
}
#endif