]> sigrok.org Git - sigrok-util.git/blame - cross-compile/android/pulseview-cpp.patch
sigrok-cross-android: Fix brokenness in mbstowcs/wcstombs in Python patch
[sigrok-util.git] / cross-compile / android / pulseview-cpp.patch
CommitLineData
aef0361e
MC
1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index 11767a6..b8eed96 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -317,12 +317,21 @@ if(WIN32)
6 list(APPEND PULSEVIEW_LINK_LIBS "-lqsvg")
7 endif()
8
9+if(ANDROID)
10+add_library(${PROJECT_NAME} SHARED
11+ ${pulseview_SOURCES}
12+ ${pulseview_HEADERS_MOC}
13+ ${pulseview_FORMS_HEADERS}
14+ ${pulseview_RESOURCES_RCC}
15+)
16+else()
17 add_executable(${PROJECT_NAME}
18 ${pulseview_SOURCES}
19 ${pulseview_HEADERS_MOC}
20 ${pulseview_FORMS_HEADERS}
21 ${pulseview_RESOURCES_RCC}
22 )
23+endif()
24
25 target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})
26
27diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp
28index e4f0276..861d25b 100644
29--- a/pv/view/decodetrace.cpp
30+++ b/pv/view/decodetrace.cpp
31@@ -373,7 +373,7 @@ void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &
32 {
33 const QString text = a.annotations().empty() ?
34 QString() : a.annotations().back();
35- const double w = min(p.boundingRect(QRectF(), 0, text).width(),
36+ const double w = min((double)p.boundingRect(QRectF(), 0, text).width(),
37 0.0) + h;
38 const QRectF rect(x - w / 2, y - h / 2, w, h);
39