简体   繁体   中英

iOS and libxml compiler warning question

I'm loading some xml from a file... here's a snippet of the file:

<root>

    <person>
        <age>99</age>
        <name>bob</name>
    </person>

    <person>
        <age>199</age>
        <name>bill</name>
    </person>
    ...
</root>

I'm using libxml in an iOS app. This line of code:

if([[NSString stringWithUTF8String:cur_node->name] isEqualToString:@"name"]){

is giving me this compiler warning:

Pointer targets in passing argument 1 of 'stringWithUTF8String:' differ in signedness

What does this warning mean and how can I get rid of it?

Cheers!

Edit: casting cur_node->name as a (const char *) removed the warnings

According to this forum post , there are 3 kinds of C character types:

char
unsigned char
signed char

Basically, the libxml property you are accessing (cur_node->name) is likely unsigned char * or signed char * , whereas stringWithUTF8String: is expecting a different type ( const char * ).

A similar issue is here on iPhoneDevSDK Forums .

If your code works, casting may be an easy way to get rid of the warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM