Changeset 87578 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Feb 3, 2021 3:43:22 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142606
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r85271 r87578 36 36 37 37 38 static void dumpHostDnsInformation(const HostDnsInformation&); 39 static void dumpHostDnsStrVector(const std::string &prefix, const std::vector<std::string> &v); 40 38 39 static void dumpHostDnsStrVector(const std::string &prefix, const std::vector<std::string> &v) 40 { 41 int i = 1; 42 for (std::vector<std::string>::const_iterator it = v.begin(); 43 it != v.end(); 44 ++it, ++i) 45 LogRel((" %s %d: %s\n", prefix.c_str(), i, it->c_str())); 46 if (v.empty()) 47 LogRel((" no %s entries\n", prefix.c_str())); 48 } 49 50 static void dumpHostDnsInformation(const HostDnsInformation &info) 51 { 52 dumpHostDnsStrVector("server", info.servers); 53 54 if (!info.domain.empty()) 55 LogRel((" domain: %s\n", info.domain.c_str())); 56 else 57 LogRel((" no domain set\n")); 58 59 dumpHostDnsStrVector("search string", info.searchList); 60 } 41 61 42 62 bool HostDnsInformation::equals(const HostDnsInformation &info, uint32_t fLaxComparison) const … … 44 64 bool fSameServers; 45 65 if ((fLaxComparison & IGNORE_SERVER_ORDER) == 0) 46 {47 66 fSameServers = (servers == info.servers); 48 }49 67 else 50 68 { … … 62 80 } 63 81 else 64 {65 82 fSameDomain = fSameSearchList = true; 66 }67 83 68 84 return fSameServers && fSameDomain && fSameSearchList; … … 413 429 } 414 430 415 static void dumpHostDnsInformation(const HostDnsInformation &info)416 {417 dumpHostDnsStrVector("server", info.servers);418 419 if (!info.domain.empty())420 LogRel((" domain: %s\n", info.domain.c_str()));421 else422 LogRel((" no domain set\n"));423 424 dumpHostDnsStrVector("search string", info.searchList);425 }426 427 428 static void dumpHostDnsStrVector(const std::string &prefix, const std::vector<std::string> &v)429 {430 int i = 1;431 for (std::vector<std::string>::const_iterator it = v.begin();432 it != v.end();433 ++it, ++i)434 LogRel((" %s %d: %s\n", prefix.c_str(), i, it->c_str()));435 if (v.empty())436 LogRel((" no %s entries\n", prefix.c_str()));437 } -
trunk/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
r83794 r87578 42 42 #include <vector> 43 43 44 static inline int registerNotification(const HKEY& hKey, HANDLE& hEvent); 45 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim = ' '); 44 45 DECLINLINE(int) registerNotification(const HKEY &hKey, HANDLE &hEvent) 46 { 47 LONG lrc = RegNotifyChangeKeyValue(hKey, 48 TRUE, 49 REG_NOTIFY_CHANGE_LAST_SET, 50 hEvent, 51 TRUE); 52 AssertMsgReturn(lrc == ERROR_SUCCESS, 53 ("Failed to register event on the key. Please debug me!"), 54 VERR_INTERNAL_ERROR); 55 56 return VINF_SUCCESS; 57 } 58 59 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim /* = ' ' */) 60 { 61 if (strToAppend.empty()) 62 return; 63 64 std::istringstream stream(strToAppend); 65 std::string substr; 66 67 while (std::getline(stream, substr, chDelim)) 68 { 69 if (substr.empty()) 70 continue; 71 72 if (std::find(vecStrings.cbegin(), vecStrings.cend(), substr) != vecStrings.cend()) 73 continue; 74 75 vecStrings.push_back(substr); 76 } 77 } 78 46 79 47 80 struct HostDnsServiceWin::Data … … 444 477 } 445 478 446 static inline int registerNotification(const HKEY& hKey, HANDLE& hEvent)447 {448 LONG lrc = RegNotifyChangeKeyValue(hKey,449 TRUE,450 REG_NOTIFY_CHANGE_LAST_SET,451 hEvent,452 TRUE);453 AssertMsgReturn(lrc == ERROR_SUCCESS,454 ("Failed to register event on the key. Please debug me!"),455 VERR_INTERNAL_ERROR);456 457 return VINF_SUCCESS;458 }459 460 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim /* = ' ' */)461 {462 if (strToAppend.empty())463 return;464 465 std::istringstream stream(strToAppend);466 std::string substr;467 468 while (std::getline(stream, substr, chDelim))469 {470 if (substr.empty())471 continue;472 473 if (std::find(vecStrings.cbegin(), vecStrings.cend(), substr) != vecStrings.cend())474 continue;475 476 vecStrings.push_back(substr);477 }478 }479
Note:
See TracChangeset
for help on using the changeset viewer.