[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:49:42 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 4cd1201c3d88f19da43c868a82d06080e2783f0d
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 5 21:16:11 2001 +0000
Fixed padding bug in arg
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index 0c79ce3..e159b14 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -222,8 +222,8 @@ public:
long toLong(bool *ok=NULL, int base=10) const;
float toFloat(bool *ok=NULL) const;
- QString arg(const QString &, int padding=0) const;
- QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
+ QString arg(const QString &, int width=0) const;
+ QString arg(int, int width=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 19d05d0..a7f2123 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -689,7 +689,7 @@ float QString::toFloat(bool *ok) const
return n;
}
-QString QString::arg(const QString &replacement, int padding) const
+QString QString::arg(const QString &replacement, int width) const
{
QString qs;
if (s && CFStringGetLength(s)) {
@@ -717,31 +717,35 @@ QString QString::arg(const QString &replacement, int padding) const
}
}
}
- CFIndex rlen;
+ CFIndex mlen;
if (found) {
- rlen = 2;
+ mlen = 2;
} else {
// append space and then replacement text at end of string
CFStringAppend(qs.s, CFSTR(" "));
pos = len + 1;
- rlen = 0;
+ mlen = 0;
}
if (replacement.s) {
- CFStringReplace(qs.s, CFRangeMake(pos, rlen), replacement.s);
- if (padding) {
- CFMutableStringRef tmp =
- CFStringCreateMutable(kCFAllocatorDefault, 0);
- if (tmp) {
- CFIndex plen;
- if (padding < 0) {
- plen = -padding;
- pos += CFStringGetLength(replacement.s);
- } else {
- plen = padding;
+ CFStringReplace(qs.s, CFRangeMake(pos, mlen), replacement.s);
+ if (width) {
+ CFIndex rlen = CFStringGetLength(replacement.s);
+ CFIndex padding;
+ if (width < 0) {
+ padding = -width;
+ pos += rlen;
+ } else {
+ padding = width;
+ }
+ padding -= rlen;
+ if (padding > 0) {
+ CFMutableStringRef tmp =
+ CFStringCreateMutable(kCFAllocatorDefault, 0);
+ if (tmp) {
+ CFStringPad(tmp, CFSTR(" "), padding, 0);
+ CFStringInsert(qs.s, pos, tmp);
+ CFRelease(tmp);
}
- CFStringPad(tmp, CFSTR(" "), plen, 0);
- CFStringInsert(qs.s, pos, tmp);
- CFRelease(tmp);
}
}
}
@@ -749,9 +753,9 @@ QString QString::arg(const QString &replacement, int padding) const
return qs;
}
-QString QString::arg(int replacement, int padding) const
+QString QString::arg(int replacement, int width) const
{
- return arg(number(replacement), padding);
+ return arg(number(replacement), width);
}
QString QString::left(uint width) const
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index 0c79ce3..e159b14 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -222,8 +222,8 @@ public:
long toLong(bool *ok=NULL, int base=10) const;
float toFloat(bool *ok=NULL) const;
- QString arg(const QString &, int padding=0) const;
- QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
+ QString arg(const QString &, int width=0) const;
+ QString arg(int, int width=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 19d05d0..a7f2123 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -689,7 +689,7 @@ float QString::toFloat(bool *ok) const
return n;
}
-QString QString::arg(const QString &replacement, int padding) const
+QString QString::arg(const QString &replacement, int width) const
{
QString qs;
if (s && CFStringGetLength(s)) {
@@ -717,31 +717,35 @@ QString QString::arg(const QString &replacement, int padding) const
}
}
}
- CFIndex rlen;
+ CFIndex mlen;
if (found) {
- rlen = 2;
+ mlen = 2;
} else {
// append space and then replacement text at end of string
CFStringAppend(qs.s, CFSTR(" "));
pos = len + 1;
- rlen = 0;
+ mlen = 0;
}
if (replacement.s) {
- CFStringReplace(qs.s, CFRangeMake(pos, rlen), replacement.s);
- if (padding) {
- CFMutableStringRef tmp =
- CFStringCreateMutable(kCFAllocatorDefault, 0);
- if (tmp) {
- CFIndex plen;
- if (padding < 0) {
- plen = -padding;
- pos += CFStringGetLength(replacement.s);
- } else {
- plen = padding;
+ CFStringReplace(qs.s, CFRangeMake(pos, mlen), replacement.s);
+ if (width) {
+ CFIndex rlen = CFStringGetLength(replacement.s);
+ CFIndex padding;
+ if (width < 0) {
+ padding = -width;
+ pos += rlen;
+ } else {
+ padding = width;
+ }
+ padding -= rlen;
+ if (padding > 0) {
+ CFMutableStringRef tmp =
+ CFStringCreateMutable(kCFAllocatorDefault, 0);
+ if (tmp) {
+ CFStringPad(tmp, CFSTR(" "), padding, 0);
+ CFStringInsert(qs.s, pos, tmp);
+ CFRelease(tmp);
}
- CFStringPad(tmp, CFSTR(" "), plen, 0);
- CFStringInsert(qs.s, pos, tmp);
- CFRelease(tmp);
}
}
}
@@ -749,9 +753,9 @@ QString QString::arg(const QString &replacement, int padding) const
return qs;
}
-QString QString::arg(int replacement, int padding) const
+QString QString::arg(int replacement, int width) const
{
- return arg(number(replacement), padding);
+ return arg(number(replacement), width);
}
QString QString::left(uint width) const
diff --git a/WebCore/src/kwq/qt/qstring.h b/WebCore/src/kwq/qt/qstring.h
index 0c79ce3..e159b14 100644
--- a/WebCore/src/kwq/qt/qstring.h
+++ b/WebCore/src/kwq/qt/qstring.h
@@ -222,8 +222,8 @@ public:
long toLong(bool *ok=NULL, int base=10) const;
float toFloat(bool *ok=NULL) const;
- QString arg(const QString &, int padding=0) const;
- QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
+ QString arg(const QString &, int width=0) const;
+ QString arg(int, int width=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list