Skip to content

Commit 3d5a3b2

Browse files
committed
Update
1 parent 70d1502 commit 3d5a3b2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

examples/command-line/main.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ bool GetImagePath(char *pImagePath)
109109
// Copy input to pImagePath ensuring not to exceed buffer size
110110
if (input.length() < 512)
111111
{
112-
strcpy_s(pImagePath, 512, input.c_str());
112+
strncpy(pImagePath, input.c_str(), 511);
113+
pImagePath[input.length()] = '\0';
113114
}
114115
else
115116
{
116117
input = input.substr(0, 511); // Truncate if too long
117-
strcpy_s(pImagePath, 512, input.c_str());
118+
strncpy(pImagePath, input.c_str(), 511);
119+
pImagePath[511] = '\0';
118120
}
119121

120122
// Check if file or directory exists
@@ -242,7 +244,8 @@ void displayDetailedResults(CCaptureVisionRouter *cvr, const string &filePath)
242244
cout << "Barcode Format: " << barcodeResultItem->GetFormatString() << endl;
243245
cout << "Barcode Text: " << barcodeResultItem->GetText() << endl;
244246

245-
CPoint *points = barcodeResultItem->GetLocation().points;
247+
CQuadrilateral location = barcodeResultItem->GetLocation();
248+
CPoint *points = location.points;
246249
for (int k = 0; k < 4; k++)
247250
{
248251
cout << "Point " << k + 1 << ": (" << points[k][0] << ", " << points[k][1] << ")" << endl;
@@ -487,6 +490,9 @@ int main(int argc, char *argv[])
487490
}
488491
}
489492

490-
delete cvr, cvr = NULL, listener, capturedReceiver, fileFetcher;
493+
delete cvr;
494+
delete listener;
495+
delete capturedReceiver;
496+
delete fileFetcher;
491497
return 0;
492498
}

0 commit comments

Comments
 (0)