Changeset 104748 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- May 22, 2024 8:51:56 AM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r104747 r104748 59 59 // defines 60 60 ///////////////////////////////////////////////////////////////////////////// 61 62 /** @def MY_VECTOR_ASSIGN_ARRAY 63 * Safe way to copy an array (static + const) into a vector w/ minimal typing. 64 * 65 * @param a_rVector The destination vector reference. 66 * @param a_aSrcArray The source array to assign to the vector. 67 */ 68 #if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER) 69 /* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds. 70 This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle 71 and will be fixed by the time 14 is done. If 14 doesn't fix it, extend the range 72 version by version till it is fixed. */ 73 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \ 74 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \ 75 (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \ 76 _Pragma("GCC diagnostic pop"); \ 77 } while (0) 78 #else 79 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \ 80 (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \ 81 } while (0) 82 #endif 83 61 84 62 85 // constructor / destructor … … 1023 1046 HRESULT SystemProperties::getSupportedPlatformArchitectures(std::vector<PlatformArchitecture_T> &aSupportedPlatformArchitectures) 1024 1047 { 1025 static const PlatformArchitecture_T aPlatformArchitectures[] =1048 static const PlatformArchitecture_T s_aPlatformArchitectures[] = 1026 1049 { 1027 1050 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) … … 1039 1062 #endif 1040 1063 }; 1041 aSupportedPlatformArchitectures.assign(aPlatformArchitectures, 1042 aPlatformArchitectures + RT_ELEMENTS(aPlatformArchitectures)); 1064 MY_VECTOR_ASSIGN_ARRAY(aSupportedPlatformArchitectures, s_aPlatformArchitectures); 1043 1065 return S_OK; 1044 1066 } … … 1046 1068 HRESULT SystemProperties::getSupportedClipboardModes(std::vector<ClipboardMode_T> &aSupportedClipboardModes) 1047 1069 { 1048 static const ClipboardMode_T aClipboardModes[] =1070 static const ClipboardMode_T s_aClipboardModes[] = 1049 1071 { 1050 1072 ClipboardMode_Disabled, … … 1053 1075 ClipboardMode_Bidirectional, 1054 1076 }; 1055 aSupportedClipboardModes.assign(aClipboardModes, 1056 aClipboardModes + RT_ELEMENTS(aClipboardModes)); 1077 MY_VECTOR_ASSIGN_ARRAY(aSupportedClipboardModes, s_aClipboardModes); 1057 1078 return S_OK; 1058 1079 } … … 1060 1081 HRESULT SystemProperties::getSupportedDnDModes(std::vector<DnDMode_T> &aSupportedDnDModes) 1061 1082 { 1062 static const DnDMode_T aDnDModes[] =1083 static const DnDMode_T s_aDnDModes[] = 1063 1084 { 1064 1085 DnDMode_Disabled, … … 1067 1088 DnDMode_Bidirectional, 1068 1089 }; 1069 aSupportedDnDModes.assign(aDnDModes, 1070 aDnDModes + RT_ELEMENTS(aDnDModes)); 1090 MY_VECTOR_ASSIGN_ARRAY(aSupportedDnDModes, s_aDnDModes); 1071 1091 return S_OK; 1072 1092 } … … 1074 1094 HRESULT SystemProperties::getSupportedPointingHIDTypes(std::vector<PointingHIDType_T> &aSupportedPointingHIDTypes) 1075 1095 { 1076 static const PointingHIDType_T aPointingHIDTypes[] =1096 static const PointingHIDType_T s_aPointingHIDTypes[] = 1077 1097 { 1078 1098 PointingHIDType_PS2Mouse, … … 1087 1107 PointingHIDType_USBMultiTouchScreenPlusPad, 1088 1108 }; 1089 aSupportedPointingHIDTypes.assign(aPointingHIDTypes, 1090 aPointingHIDTypes + RT_ELEMENTS(aPointingHIDTypes)); 1109 MY_VECTOR_ASSIGN_ARRAY(aSupportedPointingHIDTypes, s_aPointingHIDTypes); 1091 1110 return S_OK; 1092 1111 } … … 1094 1113 HRESULT SystemProperties::getSupportedKeyboardHIDTypes(std::vector<KeyboardHIDType_T> &aSupportedKeyboardHIDTypes) 1095 1114 { 1096 static const KeyboardHIDType_T aKeyboardHIDTypes[] =1115 static const KeyboardHIDType_T s_aKeyboardHIDTypes[] = 1097 1116 { 1098 1117 KeyboardHIDType_PS2Keyboard, … … 1102 1121 #endif 1103 1122 }; 1104 aSupportedKeyboardHIDTypes.assign(aKeyboardHIDTypes, 1105 aKeyboardHIDTypes + RT_ELEMENTS(aKeyboardHIDTypes)); 1123 MY_VECTOR_ASSIGN_ARRAY(aSupportedKeyboardHIDTypes, s_aKeyboardHIDTypes); 1106 1124 return S_OK; 1107 1125 } … … 1109 1127 HRESULT SystemProperties::getSupportedVFSTypes(std::vector<VFSType_T> &aSupportedVFSTypes) 1110 1128 { 1111 static const VFSType_T aVFSTypes[] =1129 static const VFSType_T s_aVFSTypes[] = 1112 1130 { 1113 1131 VFSType_File, … … 1118 1136 #endif 1119 1137 }; 1120 aSupportedVFSTypes.assign(aVFSTypes, 1121 aVFSTypes + RT_ELEMENTS(aVFSTypes)); 1138 MY_VECTOR_ASSIGN_ARRAY(aSupportedVFSTypes, s_aVFSTypes); 1122 1139 return S_OK; 1123 1140 } … … 1125 1142 HRESULT SystemProperties::getSupportedImportOptions(std::vector<ImportOptions_T> &aSupportedImportOptions) 1126 1143 { 1127 static const ImportOptions_T aImportOptions[] =1144 static const ImportOptions_T s_aImportOptions[] = 1128 1145 { 1129 1146 ImportOptions_KeepAllMACs, … … 1131 1148 ImportOptions_ImportToVDI, 1132 1149 }; 1133 aSupportedImportOptions.assign(aImportOptions, 1134 aImportOptions + RT_ELEMENTS(aImportOptions)); 1150 MY_VECTOR_ASSIGN_ARRAY(aSupportedImportOptions, s_aImportOptions); 1135 1151 return S_OK; 1136 1152 } … … 1138 1154 HRESULT SystemProperties::getSupportedExportOptions(std::vector<ExportOptions_T> &aSupportedExportOptions) 1139 1155 { 1140 static const ExportOptions_T aExportOptions[] =1156 static const ExportOptions_T s_aExportOptions[] = 1141 1157 { 1142 1158 ExportOptions_CreateManifest, … … 1145 1161 ExportOptions_StripAllNonNATMACs, 1146 1162 }; 1147 aSupportedExportOptions.assign(aExportOptions, 1148 aExportOptions + RT_ELEMENTS(aExportOptions)); 1163 MY_VECTOR_ASSIGN_ARRAY(aSupportedExportOptions, s_aExportOptions); 1149 1164 return S_OK; 1150 1165 } … … 1153 1168 { 1154 1169 #ifdef VBOX_WITH_RECORDING 1155 static const RecordingFeature_T aRecordingFeatures[] =1170 static const RecordingFeature_T s_aRecordingFeatures[] = 1156 1171 { 1157 1172 # ifdef VBOX_WITH_AUDIO_RECORDING … … 1160 1175 RecordingFeature_Video, 1161 1176 }; 1162 aSupportedRecordingFeatures.assign(aRecordingFeatures, 1163 aRecordingFeatures + RT_ELEMENTS(aRecordingFeatures)); 1177 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingFeatures, s_aRecordingFeatures); 1164 1178 #else /* !VBOX_WITH_RECORDING */ 1165 1179 aSupportedRecordingFeatures.clear(); … … 1170 1184 HRESULT SystemProperties::getSupportedRecordingAudioCodecs(std::vector<RecordingAudioCodec_T> &aSupportedRecordingAudioCodecs) 1171 1185 { 1172 static const RecordingAudioCodec_T aRecordingAudioCodecs[] =1186 static const RecordingAudioCodec_T s_aRecordingAudioCodecs[] = 1173 1187 { 1174 1188 RecordingAudioCodec_None, … … 1180 1194 #endif 1181 1195 }; 1182 aSupportedRecordingAudioCodecs.assign(aRecordingAudioCodecs, 1183 aRecordingAudioCodecs + RT_ELEMENTS(aRecordingAudioCodecs)); 1196 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioCodecs, s_aRecordingAudioCodecs); 1184 1197 return S_OK; 1185 1198 } … … 1187 1200 HRESULT SystemProperties::getSupportedRecordingVideoCodecs(std::vector<RecordingVideoCodec_T> &aSupportedRecordingVideoCodecs) 1188 1201 { 1189 static const RecordingVideoCodec_T aRecordingVideoCodecs[] =1202 static const RecordingVideoCodec_T s_aRecordingVideoCodecs[] = 1190 1203 { 1191 1204 RecordingVideoCodec_None, … … 1198 1211 #endif 1199 1212 }; 1200 aSupportedRecordingVideoCodecs.assign(aRecordingVideoCodecs, 1201 aRecordingVideoCodecs + RT_ELEMENTS(aRecordingVideoCodecs)); 1213 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoCodecs, s_aRecordingVideoCodecs); 1202 1214 return S_OK; 1203 1215 } … … 1205 1217 HRESULT SystemProperties::getSupportedRecordingVSModes(std::vector<RecordingVideoScalingMode_T> &aSupportedRecordingVideoScalingModes) 1206 1218 { 1207 static const RecordingVideoScalingMode_T aRecordingVideoScalingModes[] =1219 static const RecordingVideoScalingMode_T s_aRecordingVideoScalingModes[] = 1208 1220 { 1209 1221 RecordingVideoScalingMode_None, … … 1214 1226 #endif 1215 1227 }; 1216 aSupportedRecordingVideoScalingModes.assign(aRecordingVideoScalingModes, 1217 aRecordingVideoScalingModes + RT_ELEMENTS(aRecordingVideoScalingModes)); 1228 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoScalingModes, s_aRecordingVideoScalingModes); 1218 1229 return S_OK; 1219 1230 } … … 1221 1232 HRESULT SystemProperties::getSupportedRecordingARCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingAudioRateControlModes) 1222 1233 { 1223 static const RecordingRateControlMode_T aRecordingAudioRateControlModes[] =1234 static const RecordingRateControlMode_T s_aRecordingAudioRateControlModes[] = 1224 1235 { 1225 1236 #ifdef DEBUG … … 1229 1240 RecordingRateControlMode_VBR 1230 1241 }; 1231 aSupportedRecordingAudioRateControlModes.assign(aRecordingAudioRateControlModes, 1232 aRecordingAudioRateControlModes + RT_ELEMENTS(aRecordingAudioRateControlModes)); 1242 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioRateControlModes, s_aRecordingAudioRateControlModes); 1233 1243 return S_OK; 1234 1244 } … … 1236 1246 HRESULT SystemProperties::getSupportedRecordingVRCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingVideoRateControlModes) 1237 1247 { 1238 static const RecordingRateControlMode_T aRecordingVideoRateControlModes[] =1248 static const RecordingRateControlMode_T s_aRecordingVideoRateControlModes[] = 1239 1249 { 1240 1250 #ifdef DEBUG … … 1244 1254 RecordingRateControlMode_VBR 1245 1255 }; 1246 aSupportedRecordingVideoRateControlModes.assign(aRecordingVideoRateControlModes, 1247 aRecordingVideoRateControlModes + RT_ELEMENTS(aRecordingVideoRateControlModes)); 1256 MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoRateControlModes, s_aRecordingVideoRateControlModes); 1248 1257 return S_OK; 1249 1258 } … … 1251 1260 HRESULT SystemProperties::getSupportedCloneOptions(std::vector<CloneOptions_T> &aSupportedCloneOptions) 1252 1261 { 1253 static const CloneOptions_T aCloneOptions[] =1262 static const CloneOptions_T s_aCloneOptions[] = 1254 1263 { 1255 1264 CloneOptions_Link, … … 1259 1268 CloneOptions_KeepHwUUIDs, 1260 1269 }; 1261 aSupportedCloneOptions.assign(aCloneOptions, 1262 aCloneOptions + RT_ELEMENTS(aCloneOptions)); 1270 MY_VECTOR_ASSIGN_ARRAY(aSupportedCloneOptions, s_aCloneOptions); 1263 1271 return S_OK; 1264 1272 } … … 1266 1274 HRESULT SystemProperties::getSupportedAutostopTypes(std::vector<AutostopType_T> &aSupportedAutostopTypes) 1267 1275 { 1268 static const AutostopType_T aAutostopTypes[] =1276 static const AutostopType_T s_aAutostopTypes[] = 1269 1277 { 1270 1278 AutostopType_Disabled, … … 1273 1281 AutostopType_AcpiShutdown, 1274 1282 }; 1275 aSupportedAutostopTypes.assign(aAutostopTypes, 1276 aAutostopTypes + RT_ELEMENTS(aAutostopTypes)); 1283 MY_VECTOR_ASSIGN_ARRAY(aSupportedAutostopTypes, s_aAutostopTypes); 1277 1284 return S_OK; 1278 1285 } … … 1280 1287 HRESULT SystemProperties::getSupportedVMProcPriorities(std::vector<VMProcPriority_T> &aSupportedVMProcPriorities) 1281 1288 { 1282 static const VMProcPriority_T aVMProcPriorities[] =1289 static const VMProcPriority_T s_aVMProcPriorities[] = 1283 1290 { 1284 1291 VMProcPriority_Default, … … 1288 1295 VMProcPriority_High, 1289 1296 }; 1290 aSupportedVMProcPriorities.assign(aVMProcPriorities, 1291 aVMProcPriorities + RT_ELEMENTS(aVMProcPriorities)); 1297 MY_VECTOR_ASSIGN_ARRAY(aSupportedVMProcPriorities, s_aVMProcPriorities); 1292 1298 return S_OK; 1293 1299 } … … 1295 1301 HRESULT SystemProperties::getSupportedNetworkAttachmentTypes(std::vector<NetworkAttachmentType_T> &aSupportedNetworkAttachmentTypes) 1296 1302 { 1297 static const NetworkAttachmentType_T aNetworkAttachmentTypes[] =1303 static const NetworkAttachmentType_T s_aNetworkAttachmentTypes[] = 1298 1304 { 1299 1305 NetworkAttachmentType_NAT, … … 1311 1317 NetworkAttachmentType_Null, 1312 1318 }; 1313 aSupportedNetworkAttachmentTypes.assign(aNetworkAttachmentTypes, 1314 aNetworkAttachmentTypes + RT_ELEMENTS(aNetworkAttachmentTypes)); 1319 MY_VECTOR_ASSIGN_ARRAY(aSupportedNetworkAttachmentTypes, s_aNetworkAttachmentTypes); 1315 1320 return S_OK; 1316 1321 } … … 1318 1323 HRESULT SystemProperties::getSupportedPortModes(std::vector<PortMode_T> &aSupportedPortModes) 1319 1324 { 1320 static const PortMode_T aPortModes[] =1325 static const PortMode_T s_aPortModes[] = 1321 1326 { 1322 1327 PortMode_Disconnected, … … 1326 1331 PortMode_TCP, 1327 1332 }; 1328 aSupportedPortModes.assign(aPortModes, 1329 aPortModes + RT_ELEMENTS(aPortModes)); 1333 MY_VECTOR_ASSIGN_ARRAY(aSupportedPortModes, s_aPortModes); 1330 1334 return S_OK; 1331 1335 } … … 1333 1337 HRESULT SystemProperties::getSupportedAudioDriverTypes(std::vector<AudioDriverType_T> &aSupportedAudioDriverTypes) 1334 1338 { 1335 static const AudioDriverType_T aAudioDriverTypes[] =1339 static const AudioDriverType_T s_aAudioDriverTypes[] = 1336 1340 { 1337 1341 AudioDriverType_Default, … … 1365 1369 AudioDriverType_Null, 1366 1370 }; 1367 aSupportedAudioDriverTypes.assign(aAudioDriverTypes, 1368 aAudioDriverTypes + RT_ELEMENTS(aAudioDriverTypes)); 1371 MY_VECTOR_ASSIGN_ARRAY(aSupportedAudioDriverTypes, s_aAudioDriverTypes); 1369 1372 return S_OK; 1370 1373 } … … 1378 1381 case CPUArchitecture_AMD64: 1379 1382 { 1380 static const VMExecutionEngine_T aExecEngines[] =1383 static const VMExecutionEngine_T s_aExecEngines[] = 1381 1384 { 1382 1385 VMExecutionEngine_Default, … … 1394 1397 #endif 1395 1398 }; 1396 aExecutionEngines.assign(aExecEngines, 1397 aExecEngines + RT_ELEMENTS(aExecEngines)); 1399 MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines); 1398 1400 break; 1399 1401 } … … 1413 1415 # endif 1414 1416 }; 1415 aExecutionEngines.assign(aExecEngines, 1416 aExecEngines + RT_ELEMENTS(aExecEngines)); 1417 MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines); 1417 1418 #else 1418 1419 aExecutionEngines.clear();
Note:
See TracChangeset
for help on using the changeset viewer.