Some side tracking fixing undefined behaviour and memory vulnurabilities
This commit is contained in:
@@ -90,7 +90,7 @@ int PtouchPrint::run() {
|
||||
"Found more than one device of the same printer on bus. Currently not supported");
|
||||
return -1;
|
||||
}
|
||||
printer->attachUsbDevice(devices[0]);
|
||||
printer->attachUsbDevice(std::move(devices[0]));
|
||||
auto status = printer->getPrinterStatus();
|
||||
spdlog::info("Detected tape width is {}mm", status.tapeWidthMm);
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(512, 128);
|
||||
@@ -116,10 +116,10 @@ int PtouchPrint::run() {
|
||||
unsigned int PtouchPrint::getCompatiblePrinters() {
|
||||
auto usbDevs = mUsbDeviceFactory.findAllDevices();
|
||||
|
||||
for (auto usbDev : usbDevs) {
|
||||
for (auto& usbDev : usbDevs) {
|
||||
auto foundPrinterIt =
|
||||
std::find_if(mCompatiblePrinters.begin(), mCompatiblePrinters.end(),
|
||||
[usbDev](const std::shared_ptr<ptprnt::IPrinterDriver>& printer) {
|
||||
[&usbDev](const std::shared_ptr<ptprnt::IPrinterDriver>& printer) {
|
||||
return printer->getPid() == usbDev->getPid() &&
|
||||
printer->getVid() == usbDev->getVid();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user