long long support for kdDebug

Bernhard Rosenkraenzer bero at arklinux.org
Sun Dec 28 16:41:37 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 28 Dec 2003, Stephan Kulow wrote:

> Am Saturday 27 December 2003 10:40 schrieb Shaheed:
> > After all, "long long" is no more guaranteed to be 64 bit than "int" is
> > guaranteed to be 32. The Qt types are there for portability, and we may as
> > well use them.
> Who cares how many bits it has for the debug output?

kdebase fails to compile without the long long patch if Qt 3.3-ish 
largefile support is built in, because

kdDebug() << f.size();

is ambiguous if f.size() is 64 bit.

An alternative fix is, of course, to cast f.size() to uint32_t or the 
likes, but I'd rather do it right.

I forgot kndebugstream in the last patch btw, attaching an updated one.

LLaP
bero

- -- 
Ark Linux - Linux for the masses
http://www.arklinux.org/

Redistribution and processing of this message is subject to
http://www.arklinux.org/terms.php
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/7wfE0XW9mKfjQ1wRAru7AJ9pbjhAsme0z70l/WmYpaZGLRZsUwCeNve5
yFDlQF4Aq2TdeQMptgcU7bs=
=K+D+
-----END PGP SIGNATURE-----
-------------- next part --------------
--- kdelibs/kdecore/kdebug.h.64bit~	2003-10-14 07:50:52.000000000 +0200
+++ kdelibs/kdecore/kdebug.h	2003-12-27 02:56:37.000000000 +0100
@@ -172,6 +172,28 @@
         QString tmp; tmp.setNum(i); output += tmp;
         return *this;
     }
+#if QT_VERSION >= 0x030300
+    /**
+     * Prints the given value.
+     * @param i the long long to print
+     * @return this stream
+     */
+    kdbgstream &operator<<(long long i) {
+        if (!print) return *this;
+        QString tmp; tmp.setNum(i); output += tmp;
+        return *this;
+    }
+    /**
+     * Prints the given value.
+     * @param i the unsigned long long to print
+     * @return this stream
+     */
+    kdbgstream &operator<<(unsigned long long i) {
+        if (!print) return *this;
+        QString tmp; tmp.setNum(i); output += tmp;
+        return *this;
+    }
+#endif
     /**
      * Flushes the output.
      */
@@ -453,6 +475,18 @@
      * @return this stream
      */
     kndbgstream& operator<<(unsigned long) { return *this; }
+#if QT_VERSION >= 0x030300
+    /**
+     * Does nothing.
+     * @return this stream
+     */
+    kndbgstream& operator<<(long long) { return *this; }
+    /**
+     * Does nothing.
+     * @return this stream
+     */
+    kndbgstream& operator<<(unsigned long long) { return *this; }
+#endif
     /**
      * Does nothing.
      * @return this stream


More information about the kde-core-devel mailing list