Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arm-none-eabi build (fixes #451) #496

Merged
merged 3 commits into from Jun 19, 2017
Merged

Conversation

ebraminio
Copy link
Collaborator

This Is a part of porting harfbuz to vitasdk, I guess "src/hb-ot-layout.cc" change part, specially, needs more careful reviewing.

@ebraminio
Copy link
Collaborator Author

This makes vitasdk package builder CI work also: vitasdk/packages#28

@@ -279,10 +279,9 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */)
hb_position_t *caret_array /* OUT */)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it matches with its actual signature on src/hb-ot-layout.h

@@ -44,7 +44,7 @@
struct hb_ot_face_metrics_accelerator_t
{
unsigned int num_metrics;
unsigned int num_advances;
uint32_t num_advances;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be safe I'd guess AFAIK but have a careful look please

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed as https://github.com/behdad/harfbuzz/blob/79e8e27ffd3da29ca27d3aebd2ef425bf1cb7f9d/src/hb-ot-font.cc#L141 glyph is uint32_t so this should be also (or I should cast there instead)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh. This case, cast would have been nice. But doesn't matter. Maybe change num_metrics to uint32_t as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np, went for cast

@@ -671,6 +671,30 @@ parse_uint (const char **pp, const char *end, unsigned int *pv)
}

static bool
parse_uint32 (const char **pp, const char *end, uint32_t *pv)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplication of parse_uint, no template please as it opens another can of worms on different platforms I'd think :)

@@ -139,28 +139,28 @@ joining_type (hb_codepoint_t u)
switch (u >> 12)
{
case 0x0u:
if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
if (hb_in_range<hb_codepoint_t> (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
Copy link
Collaborator Author

@ebraminio ebraminio Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I change 0x0600u to 0x0600uL it works on arm-none-eabi but not on my default build system, so best way here would be disambiguating it I'd guess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option would be to define a macro U:

#define U(v) ((hb_codepoint_t) (v))

and then use `U(0x0600)` etc.  Or even further, dropping the 0x, so we can say eg. `u(0600)`.  But we can do that in the future.

Copy link
Collaborator Author

@ebraminio ebraminio Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was doing this but found out U already has a conflicting use.

Not in favor of u() personally as it will obfuscating things more on my view, lets defer it if is possible.

Template disambiguating had before use on the project so they are not that unusual I'd guess

src/hb-common.cc Outdated
bool had_value = parse_uint (pp, end, &feature->value) ||
parse_bool (pp, end, &feature->value);
bool had_value = parse_uint (pp, end, (unsigned int*) &feature->value) ||
parse_bool (pp, end, (unsigned int*) &feature->value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option would be to define a local variable of appropriate type, and assign that to feature->value later. Then you wouldn't need duplicating parse_uint and parse_bool etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that case I should interfere more with the logic as putting result on the OUT parameter is not happening always so I should check one first then the other ... let defer that.

@behdad
Copy link
Member

behdad commented Jun 19, 2017

As we discussed yesterday, the (unsigned int*) &feature->value is not correct. Feel free to merge after addressing that one. I left a few other comments as well, feel free to address.

@@ -138,7 +138,7 @@ struct hb_ot_face_metrics_accelerator_t
return this->default_advance;
}

return this->table->longMetric[MIN (glyph, this->num_advances - 1)].advance
return this->table->longMetric[MIN (glyph, (uint32_t) this->num_advances - 1)].advance
Copy link
Collaborator Author

@ebraminio ebraminio Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As requested instead interfering with "num_advances" type

@ebraminio ebraminio merged commit 3b0e47c into harfbuzz:master Jun 19, 2017
@ebraminio ebraminio deleted the armfix branch June 19, 2017 10:17
@@ -128,7 +128,7 @@ set(HB_VERSION_MICRO ${CMAKE_MATCH_4})

## Define ragel tasks
if (NOT IN_HB_DIST)
find_program(RAGEL "ragel")
find_program(RAGEL "ragel" CMAKE_FIND_ROOT_PATH_BOTH)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it can find ragel on vitasdk environment.

@@ -71,7 +71,7 @@ endif ()

## Detect if we are running inside a distribution or regular repository folder
set(IN_HB_DIST FALSE)
if (EXISTS "${PROJECT_SOURCE_DIR}/src/hb-version.h")
if (EXISTS "${PROJECT_SOURCE_DIR}/ChangeLog")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better is-in-distribution check

@behdad
Copy link
Member

behdad commented Jun 21, 2017

Thanks. Please merge as you see fit (and if the bots are green).

@ebraminio ebraminio mentioned this pull request Oct 31, 2017
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants