开发者

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 pass开发者_StackOverflowing 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜