Commit 0071098c authored by deuce's avatar deuce
Browse files

Export CRC stuff as well.

parent 66d3b203
......@@ -38,7 +38,7 @@
#include <string.h> /* strlen */
#include "crc16.h"
uint16_t crc16tbl[] = {
CRCEXPORT uint16_t crc16tbl[] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
......@@ -73,7 +73,7 @@ uint16_t crc16tbl[] = {
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
};
uint16_t crc16(const char* data, unsigned long len)
uint16_t CRCCALL crc16(const char* data, unsigned long len)
{
uint16_t crc = 0;
unsigned long l;
......
......@@ -39,14 +39,15 @@
#define _CRC16_H_
#include "gen_defs.h"
#include "crc32.h" /* CRCEXPORT/CRCCALL */
#ifdef __cplusplus
extern "C" {
#endif
extern uint16_t crc16tbl[];
CRCEXPORT extern uint16_t crc16tbl[];
uint16_t crc16(const char* data, unsigned long len);
CRCEXPORT uint16_t CRCCALL crc16(const char* data, unsigned long len);
#ifdef __cplusplus
}
......
......@@ -38,7 +38,7 @@
#include <string.h> /* strlen */
#include "crc32.h"
int32_t crc32tbl[]={ /* CRC polynomial 0xedb88320 */
CRCEXPORT int32_t crc32tbl[]={ /* CRC polynomial 0xedb88320 */
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
......@@ -78,7 +78,7 @@ int32_t crc32tbl[]={ /* CRC polynomial 0xedb88320 */
/* Pass len of 0 to auto-determine ASCIIZ string length */
/* or non-zero for arbitrary binary data */
/****************************************************************************/
uint32_t crc32i(uint32_t crc, const char *buf, unsigned long len)
uint32_t CRCCALL crc32i(uint32_t crc, const char *buf, unsigned long len)
{
unsigned long l;
......@@ -89,7 +89,7 @@ uint32_t crc32i(uint32_t crc, const char *buf, unsigned long len)
return(~crc);
}
uint32_t fcrc32(FILE* fp, unsigned long len)
uint32_t CRCCALL fcrc32(FILE* fp, unsigned long len)
{
int ch;
uint32_t crc=0xffffffff;
......
......@@ -41,14 +41,30 @@
#include <stdio.h> /* FILE */
#include "gen_defs.h" /* uint32_t */
#if defined(_WIN32) && (defined(CRC_IMPORTS) || defined(CRC_EXPORTS))
#if defined(CRC_IMPORTS)
#define CRCEXPORT __declspec(dllimport)
#else
#define CRCEXPORT __declspec(dllexport)
#endif
#if defined(__BORLANDC__)
#define CRCCALL __stdcall
#else
#define CRCCALL
#endif
#else /* !_WIN32 */
#define CRCEXPORT
#define CRCCALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t crc32tbl[];
CRCEXPORT extern int32_t crc32tbl[];
uint32_t crc32i(uint32_t crc, const char* buf, unsigned long len);
uint32_t fcrc32(FILE* fp, unsigned long len);
CRCEXPORT uint32_t CRCCALL crc32i(uint32_t crc, const char* buf, unsigned long len);
CRCEXPORT uint32_t CRCCALL fcrc32(FILE* fp, unsigned long len);
#ifdef __cplusplus
}
......
......@@ -34,6 +34,8 @@ target_compile_definitions(smblib PRIVATE MD5_EXPORTS)
target_compile_definitions(smblib INTERFACE MD5_IMPORTS)
target_compile_definitions(smblib PRIVATE LZH_EXPORTS)
target_compile_definitions(smblib INTERFACE LZH_IMPORTS)
target_compile_definitions(smblib PRIVATE CRC_EXPORTS)
target_compile_definitions(smblib INTERFACE CRC_IMPORTS)
target_link_libraries(smblib ${CMAKE_DL_LIBS})
set(INSTALL_HEADERS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment