[webkit-dev] DeprecatedChar and UChar32

Artem Ananiev Artem.Ananiev at Sun.COM
Thu Aug 16 05:08:49 PDT 2007


Hi, all,

DeprecatedChar::lower() method contain the following statement:

     return c <= 0x7F ? tolower(c) : u_tolower(c);

'c' is a private field of DeprecatedChar of type unsigned short, return 
type of the method is DeprecatedChar.

The problem here is that u_tolower(c) return type is UChar32 which is 
32bit on Windows platform, so conversion from UChar32 to DeprecatedChar 
is not trivial. The corresponding compiler error is:

In file included from ../../../WebCore/dom/Node.h:29,
                  from ../../../WebCore/dom/EventTargetNode.h:28,
                  from ../../../WebCore/dom/ContainerNode.h:29,
                  from ../../../WebCore/dom/Attr.h:28,
                  from ../../../WebCore/bindings/js/JSAttrCustom.cpp:32:

../../../WebCore/platform/DeprecatedString.h: In member function 
`WebCore::DeprecatedChar WebCore::DeprecatedChar::lower() const':

../../../WebCore/platform/DeprecatedString.h:136: error: conversion from 
`long int' to `WebCore::DeprecatedChar' is ambiguous

../../../WebCore/platform/DeprecatedString.h:108: note: candidates are: 
WebCore::DeprecatedChar::DeprecatedChar(unsigned int)

../../../WebCore/platform/DeprecatedString.h:112: note: 
WebCore::DeprecatedChar::DeprecatedChar(int)

../../../WebCore/platform/DeprecatedString.h:104: note: 
WebCore::DeprecatedChar::DeprecatedChar(short unsigned int)

../../../WebCore/platform/DeprecatedString.h:100: note: 
WebCore::DeprecatedChar::DeprecatedChar(short int)

../../../WebCore/platform/DeprecatedString.h:96: note: 
WebCore::DeprecatedChar::DeprecatedChar(unsigned char)

../../../WebCore/platform/DeprecatedString.h:92: note: 
WebCore::DeprecatedChar::DeprecatedChar(char)

-

The same problem is with DeprecatedChar::upper() method. Is it a bug in 
WebKit code? Should an explicit cast be added to the methods?

Thanks,

Artem



More information about the webkit-dev mailing list