- Timestamp:
- Jul 12, 2020 12:36:21 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139248
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r83794 r85271 69 69 } 70 70 71 inline static void detachVectorOfString(const std::vector<std::string>& v, 72 std::vector<com::Utf8Str> &aArray) 71 DECLINLINE(void) detachVectorOfString(const std::vector<std::string>& v, std::vector<com::Utf8Str> &aArray) 73 72 { 74 73 aArray.resize(v.size()); 75 74 size_t i = 0; 76 75 for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++it, ++i) 77 aArray[i] = Utf8Str(it->c_str()); 76 aArray[i] = Utf8Str(it->c_str()); /** @todo r=bird: *it isn't necessarily UTF-8 clean!! 77 * On darwin we do silly shit like using CFStringGetSystemEncoding() 78 * that may be UTF-8 but doesn't need to be. 79 * 80 * Why on earth are we using std::string here anyway? 81 */ 78 82 } 79 83 -
trunk/src/VBox/Main/src-server/HostDnsService.h
r84425 r85271 38 38 class HostDnsInformation 39 39 { 40 40 public: 41 41 static const uint32_t IGNORE_SERVER_ORDER = RT_BIT_32(0); 42 42 static const uint32_t IGNORE_SUFFIXES = RT_BIT_32(1); 43 43 44 public: 44 public: 45 /** @todo r=bird: Why on earth are we using std::string and not Utf8Str? */ 45 46 std::vector<std::string> servers; 46 47 std::string domain; -
trunk/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp
r83794 r85271 140 140 } 141 141 142 if (SCDynamicStoreSetNotificationKeys(m->m_store, watchingArrayRef, NULL))142 if (SCDynamicStoreSetNotificationKeys(m->m_store, watchingArrayRef, NULL)) 143 143 CFRunLoopAddSource(CFRunLoopGetCurrent(), m->m_DnsWatcher, kCFRunLoopCommonModes); 144 144 … … 149 149 /* Trigger initial update. */ 150 150 int rc = updateInfo(); 151 AssertRC(rc); /* Not fatal in release builds. */ 151 AssertRC(rc); /* Not fatal in release builds. */ /** @todo r=bird: The function always returns VINF_SUCCESS. */ 152 152 153 153 while (!ASMAtomicReadBool(&m->m_fStop)) … … 189 189 190 190 HostDnsInformation info; 191 CFStringRef domainNameRef = (CFStringRef)CFDictionaryGetValue( 192 static_cast<CFDictionaryRef>(propertyRef), CFSTR("DomainName")); 193 191 CFStringRef domainNameRef = (CFStringRef)CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyRef), CFSTR("DomainName")); 194 192 if (domainNameRef) 195 193 { … … 199 197 } 200 198 201 int i, arrayCount; 202 203 CFArrayRef serverArrayRef = (CFArrayRef)CFDictionaryGetValue( 204 static_cast<CFDictionaryRef>(propertyRef), CFSTR("ServerAddresses")); 199 CFArrayRef serverArrayRef = (CFArrayRef)CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyRef), 200 CFSTR("ServerAddresses")); 205 201 if (serverArrayRef) 206 202 { 207 arrayCount= CFArrayGetCount(serverArrayRef);208 for ( i = 0; i < arrayCount; ++i)203 CFIndex const cItems = CFArrayGetCount(serverArrayRef); 204 for (CFIndex i = 0; i < cItems; ++i) 209 205 { 210 206 CFStringRef serverAddressRef = (CFStringRef)CFArrayGetValueAtIndex(serverArrayRef, i); … … 212 208 continue; 213 209 210 /** @todo r=bird: This code is messed up as CFStringGetCStringPtr is documented 211 * to return NULL even if the string is valid. Furthermore, we must have 212 * UTF-8 - some joker might decide latin-1 is better here for all we know 213 * and we'll end up with evil invalid UTF-8 sequences. */ 214 214 const char *pszServerAddress = CFStringGetCStringPtr(serverAddressRef, CFStringGetSystemEncoding()); 215 215 if (!pszServerAddress) 216 216 continue; 217 217 218 /** @todo r=bird: Why on earth are we using std::string and not Utf8Str? */ 218 219 info.servers.push_back(std::string(pszServerAddress)); 219 220 } 220 221 } 221 222 222 CFArrayRef searchArrayRef = (CFArrayRef)CFDictionaryGetValue( 223 static_cast<CFDictionaryRef>(propertyRef), CFSTR("SearchDomains")); 224 223 CFArrayRef searchArrayRef = (CFArrayRef)CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyRef), 224 CFSTR("SearchDomains")); 225 225 if (searchArrayRef) 226 226 { 227 arrayCount = CFArrayGetCount(searchArrayRef); 228 229 for (i = 0; i < arrayCount; ++i) 227 CFIndex const cItems = CFArrayGetCount(searchArrayRef); 228 for (CFIndex i = 0; i < cItems; ++i) 230 229 { 231 230 CFStringRef searchStringRef = (CFStringRef)CFArrayGetValueAtIndex(searchArrayRef, i); … … 233 232 continue; 234 233 234 /** @todo r=bird: This code is messed up as CFStringGetCStringPtr is documented 235 * to return NULL even if the string is valid. Furthermore, we must have 236 * UTF-8 - some joker might decide latin-1 is better here for all we know 237 * and we'll end up with evil invalid UTF-8 sequences. */ 235 238 const char *pszSearchString = CFStringGetCStringPtr(searchStringRef, CFStringGetSystemEncoding()); 236 239 if (!pszSearchString) 237 240 continue; 238 241 242 /** @todo r=bird: Why on earth are we using std::string and not Utf8Str? */ 239 243 info.searchList.push_back(std::string(pszSearchString)); 240 244 }
Note:
See TracChangeset
for help on using the changeset viewer.