Merge lp:~alan-griffiths/miral/fix-1677550 into lp:miral

Proposed by Alan Griffiths
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: 547
Merged at revision: 545
Proposed branch: lp:~alan-griffiths/miral/fix-1677550
Merge into: lp:miral
Diff against target: 44 lines (+12/-1)
1 file modified
miral-shell/decoration_provider.cpp (+12/-1)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-1677550
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
Alan Griffiths Abstain
Cemil Azizoglu (community) Approve
Review via email: mp+321438@code.launchpad.net

Commit message

std::wstring_convert<> is now range checking input strictly - stop lying to it.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Checked manually on Zesty (current), Xenial, and Xenial+Overlay

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

But it doesn't work for the gnome-shell "New Profile" dialog title

review: Needs Fixing
lp:~alan-griffiths/miral/fix-1677550 updated
546. By Alan Griffiths

Rely on the fact that Latin1 has the same codepoints as UTF8

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> But it doesn't work for the gnome-shell "New Profile" dialog title

Fixed

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ok

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) :
review: Abstain
lp:~alan-griffiths/miral/fix-1677550 updated
547. By Alan Griffiths

Use the user's preferred locale

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good. Verified fix on zesty with Mir-on-X with both english and non-english text.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'miral-shell/decoration_provider.cpp'
2--- miral-shell/decoration_provider.cpp 2017-03-15 12:36:17 +0000
3+++ miral-shell/decoration_provider.cpp 2017-03-30 14:13:04 +0000
4@@ -42,6 +42,12 @@
5
6 void null_window_callback(MirWindow*, void*) {}
7
8+struct preferred_codecvt : std::codecvt_byname<wchar_t, char, std::mbstate_t>
9+{
10+ preferred_codecvt() : std::codecvt_byname<wchar_t, char, std::mbstate_t>("") {}
11+ ~preferred_codecvt() = default;
12+};
13+
14 struct Printer
15 {
16 Printer();
17@@ -53,7 +59,7 @@
18 void printhelp(MirGraphicsRegion const& region);
19
20 private:
21- std::wstring_convert<std::codecvt_utf16<wchar_t>> converter;
22+ std::wstring_convert<preferred_codecvt> converter;
23
24 bool working = false;
25 FT_Library lib;
26@@ -112,6 +118,7 @@
27 }
28
29 void Printer::print(MirGraphicsRegion const& region, std::string const& title_, int const intensity)
30+try
31 {
32 if (!working)
33 return;
34@@ -151,6 +158,10 @@
35 base_y += glyph->advance.y >> 6;
36 }
37 }
38+catch (...)
39+{
40+ std::cerr << "WARNING: failed render title: \"" << title_ << "\"\n";
41+}
42
43 void Printer::printhelp(MirGraphicsRegion const& region)
44 {

Subscribers

People subscribed via source and target branches