Trying to fix builds on MacOS

This commit is contained in:
Matthias Koefferlein 2025-06-27 17:56:45 +02:00
parent 6ce61c8654
commit a42e639d83
3 changed files with 34 additions and 29 deletions

View File

@ -204,7 +204,7 @@ void
OASISReader::get_str (std::string &s)
{
size_t l = 0;
get (l);
get_size (l);
char *b = (char *) m_stream.get (l);
if (b) {
@ -535,31 +535,31 @@ OASISReader::read_offset_table ()
uint64_t of = 0;
of = get_uint64 ();
get (m_table_cellname);
get_size (m_table_cellname);
if (m_table_cellname != 0 && m_expect_strict_mode >= 0 && ((of == 0) != (m_expect_strict_mode == 0))) {
warn (tl::to_string (tr ("CELLNAME offset table has unexpected strict mode")));
}
of = get_uint64 ();
get (m_table_textstring);
get_size (m_table_textstring);
if (m_table_textstring != 0 && m_expect_strict_mode >= 0 && ((of == 0) != (m_expect_strict_mode == 0))) {
warn (tl::to_string (tr ("TEXTSTRING offset table has unexpected strict mode")));
}
of = get_uint64 ();
get (m_table_propname);
get_size (m_table_propname);
if (m_table_propname != 0 && m_expect_strict_mode >= 0 && ((of == 0) != (m_expect_strict_mode == 0))) {
warn (tl::to_string (tr ("PROPNAME offset table has unexpected strict mode")));
}
of = get_uint64 ();
get (m_table_propstring);
get_size (m_table_propstring);
if (m_table_propstring != 0 && m_expect_strict_mode >= 0 && ((of == 0) != (m_expect_strict_mode == 0))) {
warn (tl::to_string (tr ("PROPSTRING offset table has unexpected strict mode")));
}
of = get_uint64 ();
get (m_table_layername);
get_size (m_table_layername);
if (m_table_layername != 0 && m_expect_strict_mode >= 0 && ((of == 0) != (m_expect_strict_mode == 0))) {
warn (tl::to_string (tr ("LAYERNAME offset table has unexpected strict mode")));
}
@ -567,7 +567,7 @@ OASISReader::read_offset_table ()
// XNAME table ignored currently
get_uint64 ();
size_t dummy = 0;
get (dummy);
get_size (dummy);
}
static const char magic_bytes[] = { "%SEMI-OASIS\015\012" };
@ -1003,7 +1003,7 @@ OASISReader::do_read (db::Layout &layout)
error (tl::sprintf (tl::to_string (tr ("Invalid CBLOCK compression type %d")), type));
}
size_t dummy = 0;
uint64_t dummy = 0;
get (dummy); // uncomp-byte-count - not needed
get (dummy); // comp-byte-count - not needed
@ -1452,7 +1452,7 @@ OASISReader::read_element_properties (bool ignore_special)
error (tl::sprintf (tl::to_string (tr ("Invalid CBLOCK compression type %d")), type));
}
size_t dummy = 0;
uint64_t dummy = 0;
get (dummy); // uncomp-byte-count - not needed
get (dummy); // comp-byte-count - not needed
@ -3557,7 +3557,7 @@ OASISReader::do_read_cell (db::cell_index_type cell_index, db::Layout &layout)
error (tl::sprintf (tl::to_string (tr ("Invalid CBLOCK compression type %d")), type));
}
size_t dummy = 0;
uint64_t dummy = 0;
get (dummy); // uncomp-byte-count - not needed
get (dummy); // comp-byte-count - not needed

View File

@ -245,6 +245,11 @@ private:
l = get_int64 ();
}
void get_size (size_t &l)
{
l = get_uint64 ();
}
void get (uint64_t &l)
{
l = get_uint64 ();

View File

@ -820,7 +820,7 @@ void
OASISWriter::write_bstring (const char *s)
{
size_t l = strlen (s);
write (l);
write ((uint64_t) l);
write_bytes (s, l);
}
@ -839,7 +839,7 @@ void
OASISWriter::write_astring (const char *s)
{
std::string nstr = make_astring (s);
write (nstr.size ());
write ((uint64_t) nstr.size ());
write_bytes (nstr.c_str (), nstr.size ());
}
@ -858,7 +858,7 @@ void
OASISWriter::write_nstring (const char *s)
{
std::string nstr = make_nstring (s);
write (nstr.size ());
write ((uint64_t) nstr.size ());
write_bytes (nstr.c_str (), nstr.size ());
}
@ -1062,8 +1062,8 @@ OASISWriter::end_cblock ()
// RFC1951 compression:
write_byte (0);
write (m_cblock_buffer.size ());
write (m_cblock_compressed.size ());
write ((uint64_t) m_cblock_buffer.size ());
write ((uint64_t) m_cblock_compressed.size ());
write_bytes (m_cblock_compressed.data (), m_cblock_compressed.size ());
@ -1767,23 +1767,23 @@ OASISWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::Save
// cellnames
write_byte (1);
write (cellnames_table_pos);
write ((uint64_t) cellnames_table_pos);
// textstrings
write_byte (1);
write (textstrings_table_pos);
write ((uint64_t) textstrings_table_pos);
// propnames
write_byte (1);
write (propnames_table_pos);
write ((uint64_t) propnames_table_pos);
// propstrings
write_byte (1);
write (propstrings_table_pos);
write ((uint64_t) propstrings_table_pos);
// layernames
write_byte (1);
write (layernames_table_pos);
write ((uint64_t) layernames_table_pos);
// xnames (not used)
write_byte (1);
@ -1847,11 +1847,11 @@ OASISWriter::write (const Repetition &rep)
if (g <= 1) {
write_byte (10);
write (iterated->size () - 1);
write ((uint64_t) iterated->size () - 1);
g = 1;
} else {
write_byte (11);
write (iterated->size () - 1);
write ((uint64_t) iterated->size () - 1);
write_ucoord (g, 1.0);
}
@ -1881,31 +1881,31 @@ OASISWriter::write (const Repetition &rep)
if (b.x () == 0 && b.y () >= 0) {
write_byte (3);
write (bmax - 2);
write ((uint64_t) bmax - 2);
write_ucoord (b.y ());
} else if (b.y () == 0 && b.x () >= 0) {
write_byte (2);
write (bmax - 2);
write ((uint64_t) bmax - 2);
write_ucoord (b.x ());
} else {
write_byte (9);
write (bmax - 2);
write ((uint64_t) bmax - 2);
write_gdelta (b);
}
} else if (b.x () == 0 && b.y () >= 0 && a.y () == 0 && a.x () >= 0) {
write_byte (1);
write (amax - 2);
write (bmax - 2);
write ((uint64_t) amax - 2);
write ((uint64_t) bmax - 2);
write_ucoord (a.x ());
write_ucoord (b.y ());
} else if (b.y () == 0 && b.x () >= 0 && a.x () == 0 && a.y () >= 0) {
write_byte (1);
write (bmax - 2);
write (amax - 2);
write ((uint64_t) bmax - 2);
write ((uint64_t) amax - 2);
write_ucoord (b.x ());
write_ucoord (a.y ());