Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Boeckel
VTK
Commits
8f0b7aac
Commit
8f0b7aac
authored
5 years ago
by
Ben Boeckel
Browse files
Options
Downloads
Patches
Plain Diff
vtkFreeTypeTools: avoid finding '\n' in a vtkUnicodeString
parent
3b1ebe65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Rendering/FreeType/vtkFreeTypeTools.cxx
+16
-4
16 additions, 4 deletions
Rendering/FreeType/vtkFreeTypeTools.cxx
with
16 additions
and
4 deletions
Rendering/FreeType/vtkFreeTypeTools.cxx
+
16
−
4
View file @
8f0b7aac
...
@@ -1421,6 +1421,17 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const vtkStdString& str, MetaData& m
...
@@ -1421,6 +1421,17 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const vtkStdString& str, MetaData& m
return
CalculateBoundingBox
(
str
,
metaData
,
vtkStdString
(
DEFAULT_HEIGHT_STRING
));
return
CalculateBoundingBox
(
str
,
metaData
,
vtkStdString
(
DEFAULT_HEIGHT_STRING
));
}
}
namespace
{
template
<
typename
T
>
constexpr
typename
T
::
value_type
newline
()
{
return
static_cast
<
typename
T
::
value_type
>
(
'\n'
);
}
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
template
<
typename
T
>
template
<
typename
T
>
bool
vtkFreeTypeTools
::
CalculateBoundingBox
(
bool
vtkFreeTypeTools
::
CalculateBoundingBox
(
...
@@ -1434,7 +1445,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(
...
@@ -1434,7 +1445,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(
// Go through the string, line by line, and build the metrics data.
// Go through the string, line by line, and build the metrics data.
typename
T
::
const_iterator
beginLine
=
str
.
begin
();
typename
T
::
const_iterator
beginLine
=
str
.
begin
();
typename
T
::
const_iterator
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
'\n'
);
typename
T
::
const_iterator
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
newline
<
T
>
()
);
while
(
endLine
!=
str
.
end
())
while
(
endLine
!=
str
.
end
())
{
{
metaData
.
lineMetrics
.
push_back
(
MetaData
::
LineMetrics
());
metaData
.
lineMetrics
.
push_back
(
MetaData
::
LineMetrics
());
...
@@ -1443,7 +1454,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(
...
@@ -1443,7 +1454,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(
metaData
.
maxLineWidth
=
std
::
max
(
metaData
.
maxLineWidth
,
metaData
.
lineMetrics
.
back
().
width
);
metaData
.
maxLineWidth
=
std
::
max
(
metaData
.
maxLineWidth
,
metaData
.
lineMetrics
.
back
().
width
);
beginLine
=
endLine
;
beginLine
=
endLine
;
++
beginLine
;
++
beginLine
;
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
'\n'
);
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
newline
<
T
>
()
);
}
}
// Last line...
// Last line...
metaData
.
lineMetrics
.
push_back
(
MetaData
::
LineMetrics
());
metaData
.
lineMetrics
.
push_back
(
MetaData
::
LineMetrics
());
...
@@ -1903,7 +1914,8 @@ bool vtkFreeTypeTools::PopulateData(const StringType& str, DataType data, MetaDa
...
@@ -1903,7 +1914,8 @@ bool vtkFreeTypeTools::PopulateData(const StringType& str, DataType data, MetaDa
{
{
// Go through the string, line by line
// Go through the string, line by line
typename
StringType
::
const_iterator
beginLine
=
str
.
begin
();
typename
StringType
::
const_iterator
beginLine
=
str
.
begin
();
typename
StringType
::
const_iterator
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
'\n'
);
typename
StringType
::
const_iterator
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
newline
<
StringType
>
());
int
lineIndex
=
0
;
int
lineIndex
=
0
;
while
(
endLine
!=
str
.
end
())
while
(
endLine
!=
str
.
end
())
...
@@ -1915,7 +1927,7 @@ bool vtkFreeTypeTools::PopulateData(const StringType& str, DataType data, MetaDa
...
@@ -1915,7 +1927,7 @@ bool vtkFreeTypeTools::PopulateData(const StringType& str, DataType data, MetaDa
beginLine
=
endLine
;
beginLine
=
endLine
;
++
beginLine
;
++
beginLine
;
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
'\n'
);
endLine
=
std
::
find
(
beginLine
,
str
.
end
(),
newline
<
StringType
>
()
);
++
lineIndex
;
++
lineIndex
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment