Added short aliases for algorithm names: cn, cn-lite and cn-heavy.

This commit is contained in:
XMRig 2018-04-08 02:44:31 +07:00
parent 89c095f79e
commit bb2faaddc0
2 changed files with 20 additions and 2 deletions

View file

@ -1,5 +1,6 @@
# v2.6.0-beta2
- [#499](https://github.com/xmrig/xmrig/issues/499) IPv6 disabled for internal HTTP API by default, was cause issues on some systems.
- Added short aliases for algorithm names: `cn`, `cn-lite` and `cn-heavy`.
- Fixed regressions (v2.6.0-beta1 affected)
- [#494](https://github.com/xmrig/xmrig/issues/494) Command line option `--donate-level` was broken.
- [#502](https://github.com/xmrig/xmrig/issues/502) Build without libmicrohttpd was broken.

View file

@ -22,6 +22,7 @@
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -45,6 +46,13 @@ static const char *algoNames[] = {
};
static const char *algoNamesShort[] = {
"cn",
"cn-lite",
"cn-heavy"
};
#if defined(_WIN32) && !defined(strcasecmp)
# define strcasecmp _stricmp
#endif
@ -375,12 +383,21 @@ void xmrig::CommonConfig::setAlgo(const char *algo)
return;
}
const size_t size = sizeof(algoNames) / sizeof((algoNames)[0]);
const size_t size = sizeof(algoNames) / sizeof(algoNames[0]);
assert(size == (sizeof(algoNamesShort) / sizeof(algoNamesShort[0])));
for (size_t i = 0; i < size; i++) {
if (algoNames[i] && strcasecmp(algo, algoNames[i]) == 0) {
m_algorithm = static_cast<Algo>(i);
break;
return;
}
}
for (size_t i = 0; i < size; i++) {
if (algoNamesShort[i] && strcasecmp(algo, algoNamesShort[i]) == 0) {
m_algorithm = static_cast<xmrig::Algo>(i);
return;
}
}
}