Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core]: Fix name conflict with md5 functions #2301

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions srtcore/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
#include "md5.h"
#include <string.h>

/*
* All symbols have been put under the srt namespace
* to avoid potential linkage conflicts.
*/
namespace srt {

#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#ifdef ARCH_IS_BIG_ENDIAN
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
Expand Down Expand Up @@ -379,3 +385,5 @@ md5_finish(md5_state_t *pms, md5_byte_t digest[16])
for (i = 0; i < 16; ++i)
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}

} // namespace srt
15 changes: 7 additions & 8 deletions srtcore/md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
#ifndef md5_INCLUDED
maxsharabayko marked this conversation as resolved.
Show resolved Hide resolved
# define md5_INCLUDED

/*
* All symbols have been put under the srt namespace
* to avoid potential linkage conflicts.
*/
namespace srt {

/*
* This package supports both compile-time and run-time determination of CPU
* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
Expand All @@ -70,11 +76,6 @@ typedef struct md5_state_s {
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;

#ifdef __cplusplus
extern "C"
{
#endif

/* Initialize the algorithm. */
void md5_init(md5_state_t *pms);

Expand All @@ -84,8 +85,6 @@ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
/* Finish the message and return the digest. */
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);

#ifdef __cplusplus
} /* end extern "C" */
#endif
} // namespace srt

#endif /* md5_INCLUDED */