Avoid constructs using while (--i >= 0 ..) - when i is an unsigned
integer (always true).
&display_buf, &display_len))
{
size_t i = res_len;
&display_buf, &display_len))
{
size_t i = res_len;
- while (--i >= 0 && res_buf[i] != '\x01')
+ while (i > 0 && res_buf[--i] != '\x01')
+ ;
+ while (i > 0 && res_buf[--i] != '\x01')
- if (i > 0)
- {
- while (--i >= 0 && res_buf[i] != '\x01')
- ;
- }
res_len = i; /* reduce res_len */
for (i = 0; i < res_len; i++)
{
res_len = i; /* reduce res_len */
for (i = 0; i < res_len; i++)
{
may give false hits due to accents not being used.
*/
i = res_len;
may give false hits due to accents not being used.
*/
i = res_len;
- while (--i >= 0 && res_buf[i] != '\x01')
+ while (i > 0 && res_buf[--i] != '\x01')
+ ;
+ while (i > 0 && res_buf[--i] != '\x01')
- if (i > 0)
- {
- while (--i >= 0 && res_buf[i] != '\x01')
- ;
- }
if (i == 0)
{ /* did not find base chars at all. Throw error */
return -1;
if (i == 0)
{ /* did not find base chars at all. Throw error */
return -1;