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
=== modified file 'miral-shell/decoration_provider.cpp'
--- miral-shell/decoration_provider.cpp 2017-03-15 12:36:17 +0000
+++ miral-shell/decoration_provider.cpp 2017-03-30 14:13:04 +0000
@@ -42,6 +42,12 @@
4242
43void null_window_callback(MirWindow*, void*) {}43void null_window_callback(MirWindow*, void*) {}
4444
45struct preferred_codecvt : std::codecvt_byname<wchar_t, char, std::mbstate_t>
46{
47 preferred_codecvt() : std::codecvt_byname<wchar_t, char, std::mbstate_t>("") {}
48 ~preferred_codecvt() = default;
49};
50
45struct Printer51struct Printer
46{52{
47 Printer();53 Printer();
@@ -53,7 +59,7 @@
53 void printhelp(MirGraphicsRegion const& region);59 void printhelp(MirGraphicsRegion const& region);
5460
55private:61private:
56 std::wstring_convert<std::codecvt_utf16<wchar_t>> converter;62 std::wstring_convert<preferred_codecvt> converter;
5763
58 bool working = false;64 bool working = false;
59 FT_Library lib;65 FT_Library lib;
@@ -112,6 +118,7 @@
112}118}
113119
114void Printer::print(MirGraphicsRegion const& region, std::string const& title_, int const intensity)120void Printer::print(MirGraphicsRegion const& region, std::string const& title_, int const intensity)
121try
115{122{
116 if (!working)123 if (!working)
117 return;124 return;
@@ -151,6 +158,10 @@
151 base_y += glyph->advance.y >> 6;158 base_y += glyph->advance.y >> 6;
152 }159 }
153}160}
161catch (...)
162{
163 std::cerr << "WARNING: failed render title: \"" << title_ << "\"\n";
164}
154165
155void Printer::printhelp(MirGraphicsRegion const& region)166void Printer::printhelp(MirGraphicsRegion const& region)
156{167{

Subscribers

People subscribed via source and target branches