Migrate static data class members into static data namespace members
MSVC linker can't merge former, but can the later ones. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
5c9d716409
commit
c49ea10055
@ -111,10 +111,10 @@ namespace winstd
|
|||||||
template<class _Elem, class _Traits, class _Ax>
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out)
|
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out)
|
||||||
{
|
{
|
||||||
out += lookup[ buf[0] >> 2 ];
|
out += base64_enc_lookup[ buf[0] >> 2 ];
|
||||||
out += lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f];
|
out += base64_enc_lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f];
|
||||||
out += lookup[((buf[1] << 2) | (buf[2] >> 6)) & 0x3f];
|
out += base64_enc_lookup[((buf[1] << 2) | (buf[2] >> 6)) & 0x3f];
|
||||||
out += lookup[ buf[2] & 0x3f];
|
out += base64_enc_lookup[ buf[2] & 0x3f];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,18 +125,18 @@ namespace winstd
|
|||||||
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_ size_t size)
|
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_ size_t size)
|
||||||
{
|
{
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
out += lookup[buf[0] >> 2];
|
out += base64_enc_lookup[buf[0] >> 2];
|
||||||
if (size > 1) {
|
if (size > 1) {
|
||||||
out += lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f];
|
out += base64_enc_lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f];
|
||||||
if (size > 2) {
|
if (size > 2) {
|
||||||
out += lookup[((buf[1] << 2) | (buf[2] >> 6)) & 0x3f];
|
out += base64_enc_lookup[((buf[1] << 2) | (buf[2] >> 6)) & 0x3f];
|
||||||
out += lookup[buf[2] & 0x3f];
|
out += base64_enc_lookup[buf[2] & 0x3f];
|
||||||
} else {
|
} else {
|
||||||
out += lookup[(buf[1] << 2) & 0x3f];
|
out += base64_enc_lookup[(buf[1] << 2) & 0x3f];
|
||||||
out += '=';
|
out += '=';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out += lookup[(buf[0] << 4) & 0x3f];
|
out += base64_enc_lookup[(buf[0] << 4) & 0x3f];
|
||||||
out += '=';
|
out += '=';
|
||||||
out += '=';
|
out += '=';
|
||||||
}
|
}
|
||||||
@ -152,15 +152,11 @@ namespace winstd
|
|||||||
protected:
|
protected:
|
||||||
unsigned char buf[3]; ///< Internal buffer
|
unsigned char buf[3]; ///< Internal buffer
|
||||||
size_t num; ///< Number of bytes used in `buf`
|
size_t num; ///< Number of bytes used in `buf`
|
||||||
|
|
||||||
/// \cond internal
|
|
||||||
static const char lookup[64];
|
|
||||||
/// \endcond
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// \cond internal
|
/// \cond internal
|
||||||
const char base64_enc::lookup[64] = {
|
static const char base64_enc_lookup[64] = {
|
||||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||||
@ -222,7 +218,7 @@ namespace winstd
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
int x = data[i];
|
int x = data[i];
|
||||||
if ((buf[num] = x < _countof(lookup) ? lookup[x] : 255) != 255)
|
if ((buf[num] = x < _countof(base64_dec_lookup) ? base64_dec_lookup[x] : 255) != 255)
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,15 +269,11 @@ namespace winstd
|
|||||||
protected:
|
protected:
|
||||||
unsigned char buf[4]; ///< Internal buffer
|
unsigned char buf[4]; ///< Internal buffer
|
||||||
size_t num; ///< Number of bytes used in `buf`
|
size_t num; ///< Number of bytes used in `buf`
|
||||||
|
|
||||||
/// \cond internal
|
|
||||||
static const unsigned char lookup[256];
|
|
||||||
/// \endcond
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// \cond internal
|
/// \cond internal
|
||||||
const unsigned char base64_dec::lookup[256] = {
|
static const unsigned char base64_dec_lookup[256] = {
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
|
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
|
||||||
/* 0 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
/* 0 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||||
/* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
/* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||||
|
@ -363,13 +363,13 @@ namespace winstd
|
|||||||
dwLength = dwLengthNew;
|
dwLength = dwLengthNew;
|
||||||
pValue = p;
|
pValue = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
static const EAP_ATTRIBUTE blank; ///< Blank EAP attribute
|
|
||||||
};
|
};
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
const EAP_ATTRIBUTE eap_attr::blank = {};
|
///
|
||||||
|
/// Blank EAP attribute
|
||||||
|
///
|
||||||
|
static const EAP_ATTRIBUTE blank_eap_attr = {};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -250,15 +250,12 @@ namespace winstd
|
|||||||
{
|
{
|
||||||
EventDataDescCreate(this, data, size);
|
EventDataDescCreate(this, data, size);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Blank event data used as terminator.
|
/// Blank event data used as terminator.
|
||||||
///
|
///
|
||||||
static const event_data blank;
|
static const event_data blank_event_data;
|
||||||
};
|
|
||||||
|
|
||||||
const event_data event_data::blank;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -540,7 +537,7 @@ namespace winstd
|
|||||||
///
|
///
|
||||||
/// Writes an event with one or more parameter.
|
/// Writes an event with one or more parameter.
|
||||||
///
|
///
|
||||||
/// \note The list must be terminated with `winstd::event_data::blank`.
|
/// \note The list must be terminated with `winstd::blank_event_data`.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// - `ERROR_SUCCESS` when write succeeds;
|
/// - `ERROR_SUCCESS` when write succeeds;
|
||||||
@ -553,9 +550,9 @@ namespace winstd
|
|||||||
assert(m_h != invalid);
|
assert(m_h != invalid);
|
||||||
|
|
||||||
// The first argument (param1) is outside of varadic argument list.
|
// The first argument (param1) is outside of varadic argument list.
|
||||||
if (param1.Ptr == winstd::event_data::blank.Ptr &&
|
if (param1.Ptr == winstd::blank_event_data.Ptr &&
|
||||||
param1.Size == winstd::event_data::blank.Size &&
|
param1.Size == winstd::blank_event_data.Size &&
|
||||||
param1.Reserved == winstd::event_data::blank.Reserved)
|
param1.Reserved == winstd::blank_event_data.Reserved)
|
||||||
return EventWrite(m_h, EventDescriptor, 0, NULL);
|
return EventWrite(m_h, EventDescriptor, 0, NULL);
|
||||||
|
|
||||||
va_list arg;
|
va_list arg;
|
||||||
@ -567,9 +564,9 @@ namespace winstd
|
|||||||
// Preallocate array.
|
// Preallocate array.
|
||||||
for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
||||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
if (p.Ptr == winstd::blank_event_data.Ptr &&
|
||||||
p.Size == winstd::event_data::blank.Size &&
|
p.Size == winstd::blank_event_data.Size &&
|
||||||
p.Reserved == winstd::event_data::blank.Reserved) break;
|
p.Reserved == winstd::blank_event_data.Reserved) break;
|
||||||
}
|
}
|
||||||
params.reserve(param_count);
|
params.reserve(param_count);
|
||||||
|
|
||||||
@ -578,9 +575,9 @@ namespace winstd
|
|||||||
params.push_back(param1);
|
params.push_back(param1);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
if (p.Ptr == winstd::blank_event_data.Ptr &&
|
||||||
p.Size == winstd::event_data::blank.Size &&
|
p.Size == winstd::blank_event_data.Size &&
|
||||||
p.Reserved == winstd::event_data::blank.Reserved) break;
|
p.Reserved == winstd::blank_event_data.Reserved) break;
|
||||||
params.push_back(p);
|
params.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +592,7 @@ namespace winstd
|
|||||||
///
|
///
|
||||||
/// Writes an event with variable number of parameters.
|
/// Writes an event with variable number of parameters.
|
||||||
///
|
///
|
||||||
/// \note The list must be terminated with `winstd::event_data::blank`.
|
/// \note The list must be terminated with `winstd::blank_event_data`.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// - `ERROR_SUCCESS` when write succeeds;
|
/// - `ERROR_SUCCESS` when write succeeds;
|
||||||
@ -614,9 +611,9 @@ namespace winstd
|
|||||||
// Preallocate array.
|
// Preallocate array.
|
||||||
for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
||||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
if (p.Ptr == winstd::blank_event_data.Ptr &&
|
||||||
p.Size == winstd::event_data::blank.Size &&
|
p.Size == winstd::blank_event_data.Size &&
|
||||||
p.Reserved == winstd::event_data::blank.Reserved) break;
|
p.Reserved == winstd::blank_event_data.Reserved) break;
|
||||||
}
|
}
|
||||||
params.reserve(param_count);
|
params.reserve(param_count);
|
||||||
|
|
||||||
@ -624,9 +621,9 @@ namespace winstd
|
|||||||
arg = arg_start;
|
arg = arg_start;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
if (p.Ptr == winstd::blank_event_data.Ptr &&
|
||||||
p.Size == winstd::event_data::blank.Size &&
|
p.Size == winstd::blank_event_data.Size &&
|
||||||
p.Reserved == winstd::event_data::blank.Reserved) break;
|
p.Reserved == winstd::blank_event_data.Reserved) break;
|
||||||
params.push_back(p);
|
params.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user