@@ -298,9 +298,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
if (config_.empty())
return Invalid;
- /* Cap the number of entries to the available streams. */
+ /*
+ * Cap the number of entries to the available streams.
+ * Use erase() instead of resize() because resize() uses default constructor
+ * when it increases config_'s size, which we wish to avoid.
+ */
if (config_.size() > 2) {
- config_.resize(2);
+ config_.erase(config_.begin() + 2, config_.end());
status = Adjusted;
}
@@ -447,9 +447,13 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
if (config_.empty())
return Invalid;
- /* Cap the number of entries to the available streams. */
+ /*
+ * Cap the number of entries to the available streams.
+ * Use erase() instead of resize() because resize() uses default constructor
+ * when it increases config_'s size, which we wish to avoid.
+ */
if (config_.size() > 1) {
- config_.resize(1);
+ config_.erase(config_.begin() + 1, config_.end());
status = Adjusted;
}
@@ -97,9 +97,13 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()
if (config_.empty())
return Invalid;
- /* Cap the number of entries to the available streams. */
+ /*
+ * Cap the number of entries to the available streams.
+ * Use erase() instead of resize() because resize() uses default constructor
+ * when it increases config_'s size, which we wish to avoid.
+ */
if (config_.size() > 1) {
- config_.resize(1);
+ config_.erase(config_.begin() + 1, config_.end());
status = Adjusted;
}
@@ -123,9 +123,13 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()
if (config_.empty())
return Invalid;
- /* Cap the number of entries to the available streams. */
+ /*
+ * Cap the number of entries to the available streams.
+ * Use erase() instead of resize() because resize() uses default constructor
+ * when it increases config_'s size, which we wish to avoid.
+ */
if (config_.size() > 1) {
- config_.resize(1);
+ config_.erase(config_.begin() + 1, config_.end());
status = Adjusted;
}