mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 12:39:11 +00:00
Codefix: [macos] variable length array warnings with clang-17 (#14521)
This commit is contained in:
@@ -235,22 +235,22 @@ CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font
|
|||||||
this->glyphs.resize(CTRunGetGlyphCount(run));
|
this->glyphs.resize(CTRunGetGlyphCount(run));
|
||||||
|
|
||||||
/* Query map of glyphs to source string index. */
|
/* Query map of glyphs to source string index. */
|
||||||
CFIndex map[this->glyphs.size()];
|
auto map = std::make_unique<CFIndex[]>(this->glyphs.size());
|
||||||
CTRunGetStringIndices(run, CFRangeMake(0, 0), map);
|
CTRunGetStringIndices(run, CFRangeMake(0, 0), map.get());
|
||||||
|
|
||||||
this->glyph_to_char.resize(this->glyphs.size());
|
this->glyph_to_char.resize(this->glyphs.size());
|
||||||
for (size_t i = 0; i < this->glyph_to_char.size(); i++) this->glyph_to_char[i] = (int)map[i];
|
for (size_t i = 0; i < this->glyph_to_char.size(); i++) this->glyph_to_char[i] = (int)map[i];
|
||||||
|
|
||||||
CGPoint pts[this->glyphs.size()];
|
auto pts = std::make_unique<CGPoint[]>(this->glyphs.size());
|
||||||
CTRunGetPositions(run, CFRangeMake(0, 0), pts);
|
CTRunGetPositions(run, CFRangeMake(0, 0), pts.get());
|
||||||
CGSize advs[this->glyphs.size()];
|
auto advs = std::make_unique<CGSize[]>(this->glyphs.size());
|
||||||
CTRunGetAdvances(run, CFRangeMake(0, 0), advs);
|
CTRunGetAdvances(run, CFRangeMake(0, 0), advs.get());
|
||||||
this->positions.reserve(this->glyphs.size());
|
this->positions.reserve(this->glyphs.size());
|
||||||
|
|
||||||
/* Convert glyph array to our data type. At the same time, substitute
|
/* Convert glyph array to our data type. At the same time, substitute
|
||||||
* the proper glyphs for our private sprite glyphs. */
|
* the proper glyphs for our private sprite glyphs. */
|
||||||
CGGlyph gl[this->glyphs.size()];
|
auto gl = std::make_unique<CGGlyph[]>(this->glyphs.size());
|
||||||
CTRunGetGlyphs(run, CFRangeMake(0, 0), gl);
|
CTRunGetGlyphs(run, CFRangeMake(0, 0), gl.get());
|
||||||
for (size_t i = 0; i < this->glyphs.size(); i++) {
|
for (size_t i = 0; i < this->glyphs.size(); i++) {
|
||||||
if (buff[this->glyph_to_char[i]] >= SCC_SPRITE_START && buff[this->glyph_to_char[i]] <= SCC_SPRITE_END && (gl[i] == 0 || gl[i] == 3)) {
|
if (buff[this->glyph_to_char[i]] >= SCC_SPRITE_START && buff[this->glyph_to_char[i]] <= SCC_SPRITE_END && (gl[i] == 0 || gl[i] == 3)) {
|
||||||
/* A glyph of 0 indidicates not found, while apparently 3 is what char 0xFFFC maps to. */
|
/* A glyph of 0 indidicates not found, while apparently 3 is what char 0xFFFC maps to. */
|
||||||
|
Reference in New Issue
Block a user