php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26080 Comparisons always true in xml.c
Submitted: 2003-11-02 10:00 UTC Modified: 2003-11-03 14:09 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: AxelLuttgens at swing dot be Assigned:
Status: Wont fix Package: Compile Warning
PHP Version: 4.3.3 OS: Darwin 7.0.0 (Panther)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: AxelLuttgens at swing dot be
New email:
PHP Version: OS:

 

 [2003-11-02 10:00 UTC] AxelLuttgens at swing dot be
Description:
------------
Warnings while compiling xml.c with 4.3.3 as well as php4-STABLE-200311020830:

ext/xml/xml.c: In function `xml_utf8_encode':
ext/xml/xml.c:489: warning: comparison is always true due to limited range of data type
ext/xml/xml.c:493: warning: comparison is always true due to limited range of data type

Relevant lines in xml.c are:

0455: static XML_Char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding)
0459:   unsigned short c;
0484:     if (c < 0x80) {
0486:     } else if (c < 0x800) {
0489:     } else if (c < 0x10000) {
0493:     } else if (c < 0x200000) {

On Darwin, a short seems to be a 32 bit value; comparisons at lines 0489 and 0493 are thus, indeed, always true.

Now, function xml_utf8_encode seems to be used only for implementing utf8_encode(), thus for encoding iso-8559-1 into UTF-8.

So, one could be tempted to consider those warnings as "don't care" ones.

On the other hand, it seems that those warnings could be easily avoided and thus allow for easier code maintenance.

HTH,
Axel


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 10:01:29 2024 UTC