mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -14,7 +14,7 @@
|
||||
#include "wpi/util/SmallString.hpp"
|
||||
#include "wpi/util/StringExtras.hpp"
|
||||
|
||||
using namespace cs;
|
||||
using namespace wpi::cs;
|
||||
|
||||
static int GetIntCtrlIoctl(int fd, unsigned id, int type, int64_t* value) {
|
||||
unsigned ctrl_class = V4L2_CTRL_ID2CLASS(id);
|
||||
@@ -98,7 +98,7 @@ static int GetStringCtrlIoctl(int fd, int id, int maximum, std::string* value) {
|
||||
|
||||
static int SetStringCtrlIoctl(int fd, int id, int maximum,
|
||||
std::string_view value) {
|
||||
wpi::SmallString<64> str{wpi::substr(value, 0, maximum)};
|
||||
wpi::util::SmallString<64> str{wpi::util::substr(value, 0, maximum)};
|
||||
|
||||
struct v4l2_ext_control ctrl;
|
||||
struct v4l2_ext_controls ctrls;
|
||||
@@ -116,7 +116,7 @@ static int SetStringCtrlIoctl(int fd, int id, int maximum,
|
||||
// Removes non-alphanumeric characters and replaces spaces with underscores.
|
||||
// e.g. "Zoom, Absolute" -> "zoom_absolute", "Pan (Absolute)" -> "pan_absolute"
|
||||
static std::string_view NormalizeName(std::string_view name,
|
||||
wpi::SmallVectorImpl<char>& buf) {
|
||||
wpi::util::SmallVectorImpl<char>& buf) {
|
||||
bool newWord = false;
|
||||
for (auto ch : name) {
|
||||
if (std::isalnum(ch)) {
|
||||
@@ -170,7 +170,7 @@ UsbCameraProperty::UsbCameraProperty(const struct v4l2_query_ext_ctrl& ctrl)
|
||||
while (len < sizeof(ctrl.name) && ctrl.name[len] != '\0') {
|
||||
++len;
|
||||
}
|
||||
wpi::SmallString<64> name_buf;
|
||||
wpi::util::SmallString<64> name_buf;
|
||||
name = NormalizeName({ctrl.name, len}, name_buf);
|
||||
}
|
||||
#endif
|
||||
@@ -209,7 +209,7 @@ UsbCameraProperty::UsbCameraProperty(const struct v4l2_queryctrl& ctrl)
|
||||
while (len < sizeof(ctrl.name) && ctrl.name[len] != '\0') {
|
||||
++len;
|
||||
}
|
||||
wpi::SmallString<64> name_buf;
|
||||
wpi::util::SmallString<64> name_buf;
|
||||
name =
|
||||
NormalizeName({reinterpret_cast<const char*>(ctrl.name), len}, name_buf);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ std::unique_ptr<UsbCameraProperty> UsbCameraProperty::DeviceQuery(int fd,
|
||||
return prop;
|
||||
}
|
||||
|
||||
bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::mutex>& lock, int fd) {
|
||||
bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::util::mutex>& lock, int fd) {
|
||||
if (fd < 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -306,14 +306,14 @@ bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::mutex>& lock, int fd) {
|
||||
return rv >= 0;
|
||||
}
|
||||
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::util::mutex>& lock,
|
||||
int fd) const {
|
||||
// Make a copy of the string as we're about to release the lock
|
||||
wpi::SmallString<128> valueStrCopy{valueStr};
|
||||
wpi::util::SmallString<128> valueStrCopy{valueStr};
|
||||
return DeviceSet(lock, fd, value, valueStrCopy.str());
|
||||
}
|
||||
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock, int fd,
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::util::mutex>& lock, int fd,
|
||||
int newValue,
|
||||
std::string_view newValueStr) const {
|
||||
if (!device || fd < 0) {
|
||||
|
||||
Reference in New Issue
Block a user