Skip to contentSkip to conversation

PATCH: uint32_t for pointer arithmetic?

Qemu-devel Pavel Janík 3 participants 7 messages Sep 18, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

oss.c is IMHO unnecessary retyping pointers to uint32_t and only after that to void *. This means that this will issue two warnings on 64bit platforms:

/home/pavel/QEMU/qemu-cvs/oss.c: In function `AUD_run':
/home/pavel/QEMU/qemu-cvs/oss.c:406: warning: cast from pointer to integer of different size /home/pavel/QEMU/qemu-cvs/oss.c:406: warning: cast to pointer from integer of different size

oss.c renamed from oss.c.~1.5.~ +1 -1
@@ -403,7 +403,7 @@
 
         left = oss.bufsize - oss.rpos;
         play = MIN (left, bytes);
-        written = write (oss.fd, (void *) ((uint32_t) oss.buf + oss.rpos), play);
+        written = write (oss.fd, (void *) (oss.buf + oss.rpos), play);
 
         if (-1 == written) {
             if (EAGAIN == errno || EINTR == errno) {
Signature · 5 lines
Pavel Janík

...... is one of the good guys, even though his user interface could stand
improvement.
                  -- Larry McVoy in linux-kernel
#1 lore raw
Quoted 12 lines · On Sat, 18 Sep 2004, [iso-8859-2] Pavel Jan?k wrote:

Hi,

oss.c is IMHO unnecessary retyping pointers to uint32_t and only after that to void *. This means that this will issue two warnings on 64bit platforms:

/home/pavel/QEMU/qemu-cvs/oss.c: In function `AUD_run':
/home/pavel/QEMU/qemu-cvs/oss.c:406: warning: cast from pointer to integer of different size /home/pavel/QEMU/qemu-cvs/oss.c:406: warning: cast to pointer from integer of different size

oss.c line 409

Quoted 8 lines
oss.c renamed from oss.c.~1.5.~ +1 -1
@@ -403,7 +403,7 @@
 
         left = oss.bufsize - oss.rpos;
         play = MIN (left, bytes);
-        written = write (oss.fd, (void *) ((uint32_t) oss.buf + oss.rpos), play);
+        written = write (oss.fd, (void *) (oss.buf + oss.rpos), play);
 
         if (-1 == written) {
             if (EAGAIN == errno || EINTR == errno) {

oss.c in CVS, is obsolete(from my point of view anyhow), i would apreciate if you check following though.

http://www.boblycat.org/~malc/code/patches/qemu/7b_aqemu.patch.gz

Signature · 1 line
mailto:[email protected]
#2 lore raw

From: malc <[email protected]>
Date: Sat, 18 Sep 2004 15:10:27 +0400 (MSD)

Hi,

Quoted 4 lines

oss.c in CVS, is obsolete(from my point of view anyhow), i would apreciate if you check following though.

http://www.boblycat.org/~malc/code/patches/qemu/7b_aqemu.patch.gz

/home/pavel/QEMU/qemu-cvs/oss.c:318: error: conflicting types for AUD_open' /home/pavel/QEMU/qemu-cvs/vl.h:562: error: previous declaration of AUD_open' /home/pavel/QEMU/qemu-cvs/oss.c:323: error: conflicting types for AUD_write' /home/pavel/QEMU/qemu-cvs/vl.h:563: error: previous declaration of AUD_write'
...

Signature · 6 lines
Pavel Janík

Well, after spending a lot of time hacking on Emacs you develop
a particular intimacy with point.  A sort of friendship which
doesn't allow for "the" to appear in front of "point" any more.
                  -- Stefan Monnier in comp.emacs
#3 lore raw
Quoted 8 lines · On Sat, 18 Sep 2004, [iso-8859-2] Pavel Jan?k wrote:

From: malc <[email protected]>
Date: Sat, 18 Sep 2004 15:10:27 +0400 (MSD)

Hi,

Quoted 3 lines

oss.c in CVS, is obsolete(from my point of view anyhow), i would apreciate if you check following though.

Quoted 7 lines
Quoted 1 line

http://www.boblycat.org/~malc/code/patches/qemu/7b_aqemu.patch.gz

/home/pavel/QEMU/qemu-cvs/oss.c:318: error: conflicting types for AUD_open' /home/pavel/QEMU/qemu-cvs/vl.h:562: error: previous declaration of AUD_open' /home/pavel/QEMU/qemu-cvs/oss.c:323: error: conflicting types for AUD_write' /home/pavel/QEMU/qemu-cvs/vl.h:563: error: previous declaration of AUD_write'
...

I just did cvs up on qemu, copied the tree to separate directory applied the patch (sucess with two hunks merged) did a ./configure --target-list=i386-softmmu followed by a make. Build was successful with some warnings (in mixeng.cpp). Sound is playing...

malc$ gcc -v
Reading specs from /net/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs Configured with: ../gcc-3.3.2/configure --prefix=/net --program-suffix=3.3.2 Thread model: posix
gcc version 3.3.2

0b7c85ab08d0b8ba93e98a7b4fc1e1d9 /mnt/big/npf/code/www/code/patches/qemu/7b_aqemu.patch.gz

Basically i can not reproduce errors you are seeing.

Signature · 1 line
mailto:[email protected]
#4 lore raw
Quoted 4 lines
Quoted 4 lines

/home/pavel/QEMU/qemu-cvs/oss.c:318: error: conflicting types for AUD_open' /home/pavel/QEMU/qemu-cvs/vl.h:562: error: previous declaration of AUD_open' /home/pavel/QEMU/qemu-cvs/oss.c:323: error: conflicting types for AUD_write' /home/pavel/QEMU/qemu-cvs/vl.h:563: error: previous declaration of AUD_write'

Pavel, were you compiling all targets ?
Im getting errors too if the ppc targets are enabled.
Using i386* targets only leads me to a successfull compilation. (as malc does)

Quoted 11 lines

I just did cvs up on qemu, copied the tree to separate directory applied the patch (sucess with two hunks merged) did a ./configure --target-list=i386-softmmu followed by a make. Build was successful with some warnings (in mixeng.cpp). Sound is playing...

malc$ gcc -v
Reading specs from /net/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs Configured with: ../gcc-3.3.2/configure --prefix=/net --program-suffix=3.3.2 Thread model: posix
gcc version 3.3.2

Quoted 13 lines

0b7c85ab08d0b8ba93e98a7b4fc1e1d9 /mnt/big/npf/code/www/code/patches/qemu/7b_aqemu.patch.gz

Basically i can not reproduce errors you are seeing.

Signature · 7 lines
mailto:[email protected]


_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

=====
Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) Say NO to software patents
Dites NON aux brevets logiciels

"You believe it's the year 1984, when in fact, its closer to 2184"1984 / Matrix

Vous manquez d’espace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

#5 lore raw

From: Sylvain Petreolle <[email protected]>
Date: Sat, 18 Sep 2004 20:03:47 +0200 (CEST)

Hi,

Quoted 3 lines

Pavel, were you compiling all targets ?
Im getting errors too if the ppc targets are enabled.
Using i386* targets only leads me to a successfull compilation. (as malc does)

yes, I also build PPC (ppc-softmmu).

Signature · 5 lines
Pavel Janík

Beware of bugs in the above code; I have only proved it correct, not
tried it.
                  -- Donald Knuth
#6 lore raw
Quoted 11 lines · On Sat, 18 Sep 2004, [iso-8859-2] Pavel Jan?k wrote:

From: Sylvain Petreolle <[email protected]>
Date: Sat, 18 Sep 2004 20:03:47 +0200 (CEST)

Hi,

Quoted 3 lines

Pavel, were you compiling all targets ?
Im getting errors too if the ppc targets are enabled.
Using i386* targets only leads me to a successfull compilation. (as malc does)

yes, I also build PPC (ppc-softmmu).

vl.h
void *AUD_open (void *opaque, const char *name, int freq, int nchannels, audfmt_e fmt);

oss.c
void *AUD_open (void *opaque, const char *name, int freq, int nchannels, audfmt_e fmt)

I fail to see how these can be incompatible even on PPC

Signature · 1 line
mailto:[email protected]