mirror of https://github.com/KLayout/klayout.git
parent
225d3ab32d
commit
93e789a861
|
|
@ -208,10 +208,13 @@ GDS2Reader::get_string (std::string &s) const
|
|||
{
|
||||
if (m_reclen == 0) {
|
||||
s.clear ();
|
||||
} else if (mp_rec_buf [m_reclen - 1] != 0) {
|
||||
s.assign ((const char *) mp_rec_buf, m_reclen);
|
||||
} else {
|
||||
s.assign ((const char *) mp_rec_buf, m_reclen - 1);
|
||||
// strip padding 0 characters
|
||||
unsigned long n = m_reclen;
|
||||
while (n > 0 && mp_rec_buf [n - 1] == 0) {
|
||||
--n;
|
||||
}
|
||||
s.assign ((const char *) mp_rec_buf, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -685,3 +685,22 @@ TEST(4_CollectModeAdd)
|
|||
db::compare_layouts (_this, layout, fn_au, db::WriteGDS2, 1);
|
||||
}
|
||||
|
||||
// border case with multiple padding 0 for SNAME and STRING records
|
||||
TEST(5_issue893)
|
||||
{
|
||||
db::Manager m (false);
|
||||
db::Layout layout (&m);
|
||||
|
||||
db::LoadLayoutOptions options;
|
||||
options.get_options<db::CommonReaderOptions> ().cell_conflict_resolution = db::AddToCell;
|
||||
|
||||
{
|
||||
tl::InputStream file (tl::testdata () + "/gds/issue_893.gds");
|
||||
db::Reader reader (file);
|
||||
reader.read (layout, options);
|
||||
}
|
||||
|
||||
std::string fn_au (tl::testdata () + "/gds/issue_893_au.gds");
|
||||
db::compare_layouts (_this, layout, fn_au, db::WriteGDS2, 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue