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

encoding.iconv: Fix iconv type cstrict, add LOCAL encoding #22398

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Oct 3, 2024

fix clang -cstrict error
add LOCAL encoding: this is ANSI under Windows, UTF-8 under Linux

/tmp/v_1000/xx.01J980Z12CW3YET5B6W4SNBXKN.tmp.c:42438:18: error: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Werror,-Wpointer-sign]
 42438 |         cd = iconv_open(dst_encoding.str, src_encoding.str);
       |                         ^~~~~~~~~~~~~~~~
/usr/include/iconv.h:43:40: note: passing argument to parameter '__tocode' here
   43 | extern iconv_t iconv_open (const char *__tocode, const char *__fromcode)
      |                                        ^
/tmp/v_1000/xx.01J980Z12CW3YET5B6W4SNBXKN.tmp.c:42438:36: error: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Werror,-Wpointer-sign]
 42438 |         cd = iconv_open(dst_encoding.str, src_encoding.str);
       |                                           ^~~~~~~~~~~~~~~~
/usr/include/iconv.h:43:62: note: passing argument to parameter '__fromcode' here
   43 | extern iconv_t iconv_open (const char *__tocode, const char *__fromcode)
      |                                                              ^
/tmp/v_1000/xx.01J980Z12CW3YET5B6W4SNBXKN.tmp.c:42448:24: error: incompatible pointer types passing 'u8 **' (aka 'unsigned char **') to parameter of type 'char **' [-Werror,-Wincompatible-pointer-types]
 42448 |         usize res = iconv(cd, &src_ptr, &src_left, &dst_ptr, &dst_left);
       |                               ^~~~~~~~
/usr/include/iconv.h:49:54: note: passing argument to parameter '__inbuf' here
   49 | extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
      |                                                      ^
/tmp/v_1000/xx.01J980Z12CW3YET5B6W4SNBXKN.tmp.c:42448:45: error: incompatible pointer types passing 'u8 **' (aka 'unsigned char **') to parameter of type 'char **' [-Werror,-Wincompatible-pointer-types]
 42448 |         usize res = iconv(cd, &src_ptr, &src_left, &dst_ptr, &dst_left);
       |                                                    ^~~~~~~~
/usr/include/iconv.h:51:26: note: passing argument to parameter '__outbuf' here
   51 |                      char **__restrict __outbuf,
      |                                        ^
4 errors generated.
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .```

@spytheman
Copy link
Member

Excellent work.

@spytheman spytheman merged commit e242584 into vlang:master Oct 3, 2024
67 checks passed
@kbkpbot kbkpbot deleted the fix-iconv-type-cstrict branch October 3, 2024 23:31
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.

2 participants