Changeset 85779 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Aug 14, 2020 9:04:40 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139935
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r85769 r85779 115 115 Utf8Str newPrefix; 116 116 if (details == VMINFO_MACHINEREADABLE) 117 newPrefix = Utf8StrFmt("%s-%d", prefix.c_str(), index + 1);117 newPrefix.printf("%s-%d", prefix.c_str(), index + 1); 118 118 else 119 { 120 newPrefix = Utf8StrFmt("%s ", prefix.c_str()); 121 } 119 newPrefix.printf("%s ", prefix.c_str()); 122 120 123 121 /* recursive call */ … … 1217 1215 nic->COMGETTER(MACAddress)(strMACAddress.asOutParam()); 1218 1216 Utf8Str strAttachment; 1219 Utf8Str strNatSettings = "";1220 Utf8Str strNatForwardings = "";1217 Utf8Str strNatSettings; 1218 Utf8Str strNatForwardings; 1221 1219 NetworkAttachmentType_T attachment; 1222 1220 nic->COMGETTER(AttachmentType)(&attachment); … … 1252 1250 size_t pos, ppos; 1253 1251 pos = ppos = 0; 1254 1252 #define ITERATE_TO_NEXT_TERM(res, str, pos, ppos) \ 1255 1253 do { \ 1256 1254 pos = str.find(",", ppos); \ … … 1275 1273 if (fSkip) continue; 1276 1274 strGuestPort = utf.substr(ppos, utf.length() - ppos); 1277 1275 #undef ITERATE_TO_NEXT_TERM 1278 1276 switch (strProto.toUInt32()) 1279 1277 { … … 1289 1287 } 1290 1288 if (details == VMINFO_MACHINEREADABLE) 1291 { 1292 strNatForwardings = Utf8StrFmt("%sForwarding(%d)=\"%s,%s,%s,%s,%s,%s\"\n", 1293 strNatForwardings.c_str(), i, strName.c_str(), strProto.c_str(), 1294 strHostIP.c_str(), strHostPort.c_str(), 1295 strGuestIP.c_str(), strGuestPort.c_str()); 1296 } 1289 /** @todo r=bird: This probably isn't good enough wrt escaping. */ 1290 strNatForwardings.printf("%sForwarding(%d)=\"%s,%s,%s,%s,%s,%s\"\n", 1291 strNatForwardings.c_str(), i, strName.c_str(), strProto.c_str(), 1292 strHostIP.c_str(), strHostPort.c_str(), 1293 strGuestIP.c_str(), strGuestPort.c_str()); 1297 1294 else 1298 { 1299 strNatForwardings = Utf8StrFmt("%sNIC %d Rule(%d): name = %s, protocol = %s," 1300 " host ip = %s, host port = %s, guest ip = %s, guest port = %s\n", 1301 strNatForwardings.c_str(), currentNIC + 1, i, strName.c_str(), strProto.c_str(), 1302 strHostIP.c_str(), strHostPort.c_str(), 1303 strGuestIP.c_str(), strGuestPort.c_str()); 1304 } 1295 strNatForwardings.printf("%sNIC %d Rule(%d): name = %s, protocol = %s, host ip = %s, host port = %s, guest ip = %s, guest port = %s\n", 1296 strNatForwardings.c_str(), currentNIC + 1, i, strName.c_str(), 1297 strProto.c_str(), strHostIP.c_str(), strHostPort.c_str(), 1298 strGuestIP.c_str(), strGuestPort.c_str()); 1305 1299 } 1306 1300 ULONG mtu = 0; … … 1316 1310 RTPrintf("natnet%d=\"%ls\"\n", currentNIC + 1, strNetwork.length() ? strNetwork.raw(): Bstr("nat").raw()); 1317 1311 strAttachment = "nat"; 1318 strNatSettings = Utf8StrFmt("mtu=\"%d\"\nsockSnd=\"%d\"\nsockRcv=\"%d\"\ntcpWndSnd=\"%d\"\ntcpWndRcv=\"%d\"\n",1319 mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64);1312 strNatSettings.printf("mtu=\"%d\"\nsockSnd=\"%d\"\nsockRcv=\"%d\"\ntcpWndSnd=\"%d\"\ntcpWndRcv=\"%d\"\n", 1313 mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64); 1320 1314 } 1321 1315 else 1322 1316 { 1323 1317 strAttachment = "NAT"; 1324 strNatSettings = Utf8StrFmt("NIC %d Settings: MTU: %d, Socket (send: %d, receive: %d), TCP Window (send:%d, receive: %d)\n",1325 currentNIC + 1, mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64);1318 strNatSettings.printf("NIC %d Settings: MTU: %d, Socket (send: %d, receive: %d), TCP Window (send:%d, receive: %d)\n", 1319 currentNIC + 1, mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64); 1326 1320 } 1327 1321 break; … … 1338 1332 } 1339 1333 else 1340 strAttachment = Utf8StrFmt("Bridged Interface '%ls'", strBridgeAdp.raw());1334 strAttachment.printf("Bridged Interface '%ls'", strBridgeAdp.raw()); 1341 1335 break; 1342 1336 } … … 1352 1346 } 1353 1347 else 1354 strAttachment = Utf8StrFmt("Internal Network '%s'", Utf8Str(strNetwork).c_str());1348 strAttachment.printf("Internal Network '%s'", Utf8Str(strNetwork).c_str()); 1355 1349 break; 1356 1350 } … … 1366 1360 } 1367 1361 else 1368 strAttachment = Utf8StrFmt("Host-only Interface '%ls'", strHostonlyAdp.raw());1362 strAttachment.printf("Host-only Interface '%ls'", strHostonlyAdp.raw()); 1369 1363 break; 1370 1364 } … … 1381 1375 else 1382 1376 { 1383 strAttachment = Utf8StrFmt("Generic '%ls'", strGenericDriver.raw());1377 strAttachment.printf("Generic '%ls'", strGenericDriver.raw()); 1384 1378 1385 1379 // show the generic properties … … 1393 1387 strAttachment += " { "; 1394 1388 for (unsigned i = 0; i < aProperties.size(); ++i) 1395 strAttachment += Utf8StrFmt(!i ? "%ls='%ls'" : ", %ls='%ls'", 1396 aProperties[i], aValues[i]); 1389 strAttachment.appendPrintf(!i ? "%ls='%ls'" : ", %ls='%ls'", aProperties[i], aValues[i]); 1397 1390 strAttachment += " }"; 1398 1391 } … … 1411 1404 } 1412 1405 else 1413 strAttachment = Utf8StrFmt("NAT Network '%s'", Utf8Str(strNetwork).c_str());1406 strAttachment.printf("NAT Network '%s'", Utf8Str(strNetwork).c_str()); 1414 1407 break; 1415 1408 } … … 1426 1419 } 1427 1420 else 1428 strAttachment = Utf8StrFmt("Cloud Network '%s'", Utf8Str(strNetwork).c_str());1421 strAttachment.printf("Cloud Network '%s'", Utf8Str(strNetwork).c_str()); 1429 1422 break; 1430 1423 }
Note:
See TracChangeset
for help on using the changeset viewer.