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

Unsigned char narrowing conversion #66

Closed
ValdikSS opened this issue Jul 24, 2018 · 7 comments
Closed

Unsigned char narrowing conversion #66

ValdikSS opened this issue Jul 24, 2018 · 7 comments

Comments

@ValdikSS
Copy link

adclib/base64.cpp contains BASE32_table[] defined as const char, filled with -1 values.

At least on my compiler, char is unsigned char and I get an error:
base32.cpp:20:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing].

Changing char to signed char solves the issue but I didn't test if base32 still works correctly after this modification.

@Wiikend92
Copy link

I am also getting this problem when doing make. Not being able to compile this correctly, leads to me missing adclib, which makes it impossible to start the server. Do you think it is safe to make this modification and run it anyway?

@ValdikSS
Copy link
Author

Do you think it is safe to make this modification and run it anyway?

Can't say, I haven't tested it.

@Wiikend92
Copy link

Let me be your test bunny. I'll try and get back to you if the server runs or not.

@ValdikSS
Copy link
Author

It does run, but I'm not sure if base32 still works as intended, and I haven't checked where base32 is used.

@Sopor
Copy link
Contributor

Sopor commented Jun 10, 2019

Could someone tell me where in base32.cpp i should change char to signed char?

@ValdikSS
Copy link
Author

Line 20.

@Sopor
Copy link
Contributor

Sopor commented Jun 11, 2019

Yes, i have tried several combinations but i get the same error what ever i change. Should i change the whole line, should i only add signed before char and leave the rest, should i delete the whole line and only add signed char? Line 20 contained more than one word and when i still get the same error i assumed i did something wrong.

base32.cpp:20:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
const char ADCLIB::BASE32::BASE32_table[] = {
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1,
};

@blasti blasti closed this as completed in d024265 Jun 17, 2019
blasti pushed a commit that referenced this issue Jun 18, 2019
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

No branches or pull requests

3 participants