Merge pull request #1233 from dosuperuser/improvement/optimizations

Minor C++ optimizations
This commit is contained in:
Adam Ierymenko 2020-11-24 19:24:36 -05:00 committed by GitHub
commit d64c5a92c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 33 deletions

View file

@ -161,7 +161,7 @@ void SoftwareUpdater::handleSoftwareUpdateUserMessage(uint64_t origin,const void
if (v == VERB_GET_LATEST) {
if (_dist.size() > 0) {
if (!_dist.empty()) {
const nlohmann::json *latest = (const nlohmann::json *)0;
const std::string expectedSigner = OSUtils::jsonString(req[ZT_SOFTWARE_UPDATE_JSON_EXPECT_SIGNED_BY],"");
unsigned int bestVMaj = rvMaj;
@ -241,7 +241,7 @@ void SoftwareUpdater::handleSoftwareUpdateUserMessage(uint64_t origin,const void
} break;
case VERB_GET_DATA:
if ((len >= 21)&&(_dist.size() > 0)) {
if ((len >= 21)&&(!_dist.empty())) {
unsigned long idx = (unsigned long)*(reinterpret_cast<const uint8_t *>(data) + 17) << 24;
idx |= (unsigned long)*(reinterpret_cast<const uint8_t *>(data) + 18) << 16;
idx |= (unsigned long)*(reinterpret_cast<const uint8_t *>(data) + 19) << 8;