Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int
- utf8_wctomb (unsigned char *dest, wchar_t wc, int dest_size)
- {
- if (!dest)
- return 0;
- int count;
- if (wc < 0x80)
- count = 1;
- else if (wc < 0x800)
- count = 2;
- else if (wc < 0x10000)
- count = 3;
- else if (wc < 0x200000)
- count = 4;
- else if (wc < 0x4000000)
- count = 5;
- else if (wc <= 0x7fffffff)
- count = 6;
- else
- return RET_ILSEQ;
- ....
- }
- This suspicious code was found in MTASA project by PVS-Studio static code analyzer.
- Warning message is:
- V547 Expression 'wc < 0x10000' is always true. The value range of wchar_t type: [0, 65535]. utf8.h 121
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment