From d866f480813169208efba0e4f32ecde4a5b54ebc Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 20 Dec 2021 14:41:44 -0500 Subject: Change names of qpdf_object_type_e enumerations They have to be ot_* rather than qpdf_ot_* for compatibility. * Different enumerated types are not assignment-compatible in C++, at least with strict compiler settings * While you can do `constexpr ot_xyz = ::qpdf_ot_xyz` in QPDFObject.hh to make QPDFObject::ot_xyz work, QPDFObject::object_type_e::ot_xyz will only work if the enumerated type names are the same. --- qpdf/qpdf-ctest.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'qpdf') diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c index 953b24d0..af743b01 100644 --- a/qpdf/qpdf-ctest.c +++ b/qpdf/qpdf-ctest.c @@ -537,12 +537,12 @@ static void test24(char const* infile, /* Go to the first page and look at all the keys */ qpdf_oh pages = qpdf_oh_get_key(qpdf, root, "/Pages"); assert(qpdf_oh_is_dictionary(qpdf, pages)); - assert(qpdf_oh_get_type_code(qpdf, pages) == qpdf_ot_dictionary); + assert(qpdf_oh_get_type_code(qpdf, pages) == ot_dictionary); assert(strcmp(qpdf_oh_get_type_name(qpdf, pages), "dictionary") == 0); assert(qpdf_oh_is_initialized(qpdf, pages)); qpdf_oh kids = qpdf_oh_get_key(qpdf, pages, "/Kids"); assert(qpdf_oh_is_array(qpdf, kids)); - assert(qpdf_oh_get_type_code(qpdf, kids) == qpdf_ot_array); + assert(qpdf_oh_get_type_code(qpdf, kids) == ot_array); assert(strcmp(qpdf_oh_get_type_name(qpdf, kids), "array") == 0); assert(qpdf_oh_get_array_n_items(qpdf, kids) == 1); qpdf_oh page1 = qpdf_oh_get_array_item(qpdf, kids, 0); @@ -555,7 +555,7 @@ static void test24(char const* infile, /* Inspect the first page */ qpdf_oh type = qpdf_oh_get_key(qpdf, page1, "/Type"); assert(qpdf_oh_is_name(qpdf, type)); - assert(qpdf_oh_get_type_code(qpdf, type) == qpdf_ot_name); + assert(qpdf_oh_get_type_code(qpdf, type) == ot_name); assert(strcmp(qpdf_oh_get_type_name(qpdf, type), "name") == 0); assert(strcmp(qpdf_oh_get_name(qpdf, type), "/Page") == 0); qpdf_oh parent = qpdf_oh_get_key(qpdf, page1, "/Parent"); @@ -595,14 +595,14 @@ static void test24(char const* infile, /* Look at page contents to exercise stream functions */ qpdf_oh contents = qpdf_oh_get_key(qpdf, page1, "/Contents"); assert(qpdf_oh_is_stream(qpdf, contents)); - assert(qpdf_oh_get_type_code(qpdf, contents) == qpdf_ot_stream); + assert(qpdf_oh_get_type_code(qpdf, contents) == ot_stream); assert(strcmp(qpdf_oh_get_type_name(qpdf, contents), "stream") == 0); qpdf_oh contents_dict = qpdf_oh_get_dict(qpdf, contents); assert(! qpdf_oh_is_scalar(qpdf, contents)); assert(! qpdf_oh_is_scalar(qpdf, contents_dict)); qpdf_oh contents_length = qpdf_oh_get_key(qpdf, contents_dict, "/Length"); assert(qpdf_oh_is_integer(qpdf, contents_length)); - assert(qpdf_oh_get_type_code(qpdf, contents_length) == qpdf_ot_integer); + assert(qpdf_oh_get_type_code(qpdf, contents_length) == ot_integer); assert(strcmp(qpdf_oh_get_type_name(qpdf, contents_length), "integer") == 0); assert(qpdf_oh_is_scalar(qpdf, contents_length)); assert(qpdf_oh_is_number(qpdf, contents_length)); @@ -643,7 +643,7 @@ static void test24(char const* infile, qpdf_oh_release(qpdf, page1); contents = qpdf_oh_get_key(qpdf, page1, "/Contents"); assert(qpdf_oh_is_null(qpdf, contents)); - assert(qpdf_oh_get_type_code(qpdf, contents) == qpdf_ot_null); + assert(qpdf_oh_get_type_code(qpdf, contents) == ot_null); assert(strcmp(qpdf_oh_get_type_name(qpdf, contents), "null") == 0); assert(qpdf_oh_is_array(qpdf, mediabox)); qpdf_oh_release_all(qpdf); @@ -682,18 +682,18 @@ static void test25(char const* infile, qpdf_oh p_bool = qpdf_oh_get_array_item(qpdf, parsed, 5); assert(qpdf_oh_is_integer(qpdf, p_int) && qpdf_oh_get_int_value_as_int(qpdf, p_int) == 1); - assert(qpdf_oh_get_type_code(qpdf, p_int) == qpdf_ot_integer); + assert(qpdf_oh_get_type_code(qpdf, p_int) == ot_integer); assert(strcmp(qpdf_oh_get_type_name(qpdf, p_int), "integer") == 0); assert(qpdf_oh_is_real(qpdf, p_real) && (strcmp(qpdf_oh_get_real_value(qpdf, p_real), "2.0") == 0) && qpdf_oh_get_numeric_value(qpdf, p_real) == 2.0); - assert(qpdf_oh_get_type_code(qpdf, p_real) == qpdf_ot_real); + assert(qpdf_oh_get_type_code(qpdf, p_real) == ot_real); assert(strcmp(qpdf_oh_get_type_name(qpdf, p_real), "real") == 0); assert(qpdf_oh_is_string(qpdf, p_string) && (strcmp(qpdf_oh_get_string_value(qpdf, p_string), "3\xf7") == 0) && (strcmp(qpdf_oh_get_utf8_value(qpdf, p_string), "3\xc3\xb7") == 0) && (strcmp(qpdf_oh_unparse_binary(qpdf, p_string), "<33f7>") == 0)); - assert(qpdf_oh_get_type_code(qpdf, p_string) == qpdf_ot_string); + assert(qpdf_oh_get_type_code(qpdf, p_string) == ot_string); assert(strcmp(qpdf_oh_get_type_name(qpdf, p_string), "string") == 0); assert(qpdf_oh_is_dictionary(qpdf, p_dict)); qpdf_oh p_five = qpdf_oh_get_key(qpdf, p_dict, "/Four"); @@ -701,11 +701,11 @@ static void test25(char const* infile, assert(qpdf_oh_is_or_has_name( qpdf, qpdf_oh_get_array_item(qpdf, p_five, 0), "/Five")); assert(qpdf_oh_is_null(qpdf, p_null)); - assert(qpdf_oh_get_type_code(qpdf, p_null) == qpdf_ot_null); + assert(qpdf_oh_get_type_code(qpdf, p_null) == ot_null); assert(strcmp(qpdf_oh_get_type_name(qpdf, p_null), "null") == 0); assert(qpdf_oh_is_bool(qpdf, p_bool) && (qpdf_oh_get_bool_value(qpdf, p_bool) == QPDF_TRUE)); - assert(qpdf_oh_get_type_code(qpdf, p_bool) == qpdf_ot_boolean); + assert(qpdf_oh_get_type_code(qpdf, p_bool) == ot_boolean); assert(strcmp(qpdf_oh_get_type_name(qpdf, p_bool), "boolean") == 0); qpdf_oh_erase_item(qpdf, parsed, 4); qpdf_oh_insert_item( @@ -763,7 +763,7 @@ static void test26(char const* infile, qpdf_data qpdf2 = qpdf_init(); qpdf_oh trailer = qpdf_get_trailer(qpdf2); assert(! qpdf_oh_is_initialized(qpdf2, trailer)); - assert(qpdf_oh_get_type_code(qpdf, trailer) == qpdf_ot_uninitialized); + assert(qpdf_oh_get_type_code(qpdf, trailer) == ot_uninitialized); qpdf_cleanup(&qpdf2); } -- cgit v1.2.3-70-g09d2