~alan-griffiths/miral/remove-legacy-support

« back to all changes in this revision

Viewing changes to miral-shell/decoration_provider.cpp

  • Committer: Alan Griffiths
  • Date: 2017-03-30 14:57:42 UTC
  • mfrom: (544.1.3 miral1)
  • Revision ID: alan@octopull.co.uk-20170330145742-3f56qcqqhksfpak5
std::wstring_convert<> is now range checking input strictly - stop lying to it. (LP: #1677550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
void null_window_callback(MirWindow*, void*) {}
44
44
 
 
45
struct 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
 
45
51
struct Printer
46
52
{
47
53
    Printer();
53
59
    void printhelp(MirGraphicsRegion const& region);
54
60
 
55
61
private:
56
 
    std::wstring_convert<std::codecvt_utf16<wchar_t>> converter;
 
62
    std::wstring_convert<preferred_codecvt> converter;
57
63
 
58
64
    bool working = false;
59
65
    FT_Library lib;
112
118
}
113
119
 
114
120
void Printer::print(MirGraphicsRegion const& region, std::string const& title_, int const intensity)
 
121
try
115
122
{
116
123
    if (!working)
117
124
        return;
151
158
        base_y += glyph->advance.y >> 6;
152
159
    }
153
160
}
 
161
catch (...)
 
162
{
 
163
    std::cerr << "WARNING: failed render title: \"" <<  title_ << "\"\n";
 
164
}
154
165
 
155
166
void Printer::printhelp(MirGraphicsRegion const& region)
156
167
{