From 65e12cf404d503c20bbbfeed390b7cdf26eee778 Mon Sep 17 00:00:00 2001 From: Simon Schmeisser Date: Sat, 10 Feb 2024 22:27:13 +0100 Subject: [PATCH] interpret CONTROL_ZOOM_RATIO locale independent --- droidmediacamera2.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/droidmediacamera2.cpp b/droidmediacamera2.cpp index dfe2608..87d722a 100644 --- a/droidmediacamera2.cpp +++ b/droidmediacamera2.cpp @@ -1515,11 +1515,17 @@ void update_request(DroidMediaCamera *camera, ACaptureRequest *request, std::uno ACaptureRequest_setEntry_u8(request, key, 1, &value); break; } - case ACAMERA_CONTROL_ZOOM_RATIO: - if (float value = std::stof(value_s)) { + case ACAMERA_CONTROL_ZOOM_RATIO: { + // convert from string using no locale + std::istringstream iss(value_s); + iss.imbue(std::locale::classic()); + float value = 0; + iss >> value; + if (value != 0) { ACaptureRequest_setEntry_float(request, key, 1, &value); } break; + } case ACAMERA_FLASH_MODE: { uint8_t mode; if (!strcmp(value_s.c_str(), android::CameraParameters::FLASH_MODE_TORCH)) {