[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
gramps
gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:48:28 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 69a9c7933c11dc617de1c0254317e526f9257502
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 2 23:13:15 2001 +0000
Implemented fromLatin1, utf8, and local8Bit functions
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 8e8dfcf..19f2ae7 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -46,10 +46,9 @@ QString QString::number(int n)
return qs;
}
-QString QString::fromLatin1(const char *, int)
+QString QString::fromLatin1(const char *chs)
{
- // FIXME: not yet implemented
- return QString();
+ return QString(chs);
}
#ifdef USING_BORROWED_KURL
@@ -277,13 +276,38 @@ const char *QString::ascii() const
QCString QString::utf8() const
{
- // FIXME: not yet implemented
+ uint len = length();
+ if (len) {
+ char *chs = CFAllocatorAllocate(kCFAllocatorDefault, len + 1, 0);
+ if (chs) {
+ if (!CFStringGetCString(s, chs, len + 1, kCFStringEncodingUTF8)) {
+ *reinterpret_cast<char *>(chs) = '\0';
+ }
+ QCString qcs = QCString(chs);
+ CFAllocatorDeallocate(kCFAllocatorDefault, chs);
+ return qcs;
+ }
+ }
return QCString();
}
QCString QString::local8Bit() const
{
// FIXME: not yet implemented
+ uint len = length();
+ if (len) {
+ char *chs = CFAllocatorAllocate(kCFAllocatorDefault, len + 1, 0);
+ if (chs) {
+ // FIXME: is MacRoman the correct encoding?
+ if (!CFStringGetCString(s, chs, len + 1,
+ kCFStringEncodingMacRoman)) {
+ *reinterpret_cast<char *>(chs) = '\0';
+ }
+ QCString qcs = QCString(chs);
+ CFAllocatorDeallocate(kCFAllocatorDefault, chs);
+ return qcs;
+ }
+ }
return QCString();
}
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 8e8dfcf..19f2ae7 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -46,10 +46,9 @@ QString QString::number(int n)
return qs;
}
-QString QString::fromLatin1(const char *, int)
+QString QString::fromLatin1(const char *chs)
{
- // FIXME: not yet implemented
- return QString();
+ return QString(chs);
}
#ifdef USING_BORROWED_KURL
@@ -277,13 +276,38 @@ const char *QString::ascii() const
QCString QString::utf8() const
{
- // FIXME: not yet implemented
+ uint len = length();
+ if (len) {
+ char *chs = CFAllocatorAllocate(kCFAllocatorDefault, len + 1, 0);
+ if (chs) {
+ if (!CFStringGetCString(s, chs, len + 1, kCFStringEncodingUTF8)) {
+ *reinterpret_cast<char *>(chs) = '\0';
+ }
+ QCString qcs = QCString(chs);
+ CFAllocatorDeallocate(kCFAllocatorDefault, chs);
+ return qcs;
+ }
+ }
return QCString();
}
QCString QString::local8Bit() const
{
// FIXME: not yet implemented
+ uint len = length();
+ if (len) {
+ char *chs = CFAllocatorAllocate(kCFAllocatorDefault, len + 1, 0);
+ if (chs) {
+ // FIXME: is MacRoman the correct encoding?
+ if (!CFStringGetCString(s, chs, len + 1,
+ kCFStringEncodingMacRoman)) {
+ *reinterpret_cast<char *>(chs) = '\0';
+ }
+ QCString qcs = QCString(chs);
+ CFAllocatorDeallocate(kCFAllocatorDefault, chs);
+ return qcs;
+ }
+ }
return QCString();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list