processone / xmpp

Erlang/Elixir XMPP parsing and serialization library on top of Fast XML
http://process-one.net
Apache License 2.0
137 stars 88 forks source link

Fix build on archs where char is unsigned #75

Closed m-hennecke closed 1 year ago

m-hennecke commented 1 year ago

For architectures that have char defined as unsigned char comparing char with negative numbers will always be false. Use explicit signed char to fix this.

When building xmpp on a system running OpenBSD/aarch64 a lot of compiler errors show up like these:

jid.c:84:8: warning: overflow converting case value to switch condition type (-12 to 244) [-Wswitch]        
                case -12: goto tr7;

or

jid.c:94:12: warning: result of comparison of constant -15 with expression of type 'char' is always false [-
Wtautological-constant-out-of-range-compare]                                                                        if ( (*p) < -15 ) {                                                                                 
             ~~~~ ^ ~~~

Which makes sense, because the char type on OpenBSD/aarch64 architecture defaults to unsigned char. For architectures having char defined as signed this changes nothing function wise.

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 95

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 93: 0.0%
Covered Lines: 0
Relevant Lines: 18707

💛 - Coveralls
prefiks commented 1 year ago

Thank you