Go Back   Rhinocerus > Newsgroup > Newsgroup comp.language.c++

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2009, 05:48 AM
ahso
Guest
 
Posts: n/a
Default DWORD and bool to binary

Hi
any ideas on what to change?

if (ddsd.ddpfPixelFormat.dwFourCC == FOURCC_DXT1)
{
etc.
I get: "invalid operands of types ‘DWORD’ and ‘bool’ to binary
‘operator|’"
Many thanks
Michael Sgier
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 11-26-2009, 10:03 AM
Fred Zwarts
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

ahso <ahso47@yahoo.com> typed
(in 8aa1e993-c34a-46bd-9664-e225b5539532...oglegroups.com)
> Hi
> any ideas on what to change?
>
> if (ddsd.ddpfPixelFormat.dwFourCC == FOURCC_DXT1)
> {
> etc.
> I get: "invalid operands of types ‘DWORD’ and ‘bool’ to binary
> ‘operator|’"
> Many thanks
> Michael Sgier


You did not supply enough information.
Please, reduce your problem to a minimal program that can be compiled,
so that we can help you.
How should we know what ddsd is? etc.
The error message suggest that a bool type and a DWORD type are involved.
The fact that FOURCC_DXT1 is all uppercase, suggests that it is a preprocessor macro.
Probably there is an error in this macro, or it is use incorrectly.
Reply With Quote
  #3 (permalink)  
Old 11-26-2009, 10:26 AM
ahso
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Hi Fred

// To avoid having to include DirectX headers in the FlyLegacy
development environment,
// the DDSURFACEDESC2 struct definition is copied here from ddraw.h
//
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2,
ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) < 8) | \
((DWORD)(BYTE)(ch2) < 16) | ((DWORD)(BYTE)(ch3) <
24 ))
#endif //defined(MAKEFOURCC)

/*
* FOURCC codes for DX compressed-texture pixel formats
*/
#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))

....
....
// Read surface descriptor and set relevant class data members
UINT8 factor = 0;
DDSURFACEDESC2 ddsd;
pread (&ddsd, sizeof(ddsd), 1, p);
mipCount = ddsd.dwMipMapCount;
width = ddsd.dwWidth;
height = ddsd.dwHeight;


switch (ddsd.ddpfPixelFormat.dwFourCC)
{
case FOURCC_DXT1:
if (ddsd.dwAlphaBitDepth > 0) {
format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
} else {
format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
}
factor = 2;
break;
case FOURCC_DXT3:
etc.

I reverted to the original switch and get that error now:

.../Utility/ImageDXT.cpp:220: error: duplicate case value
.../Utility/ImageDXT.cpp:212: error: previously used here

Line 212 is the above line with the first case command

Many thanks
Michael
Reply With Quote
  #4 (permalink)  
Old 11-26-2009, 10:36 AM
Balog Pal
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

"ahso" <ahso47@yahoo.com>
> // To avoid having to include DirectX headers in the FlyLegacy
> development environment,
> // the DDSURFACEDESC2 struct definition is copied here from ddraw.h
> //
> #ifndef MAKEFOURCC
> #define MAKEFOURCC(ch0, ch1, ch2,
> ch3) \
> ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) < 8) | \
> ((DWORD)(BYTE)(ch2) < 16) | ((DWORD)(BYTE)(ch3) <
> 24 ))
> #endif //defined(MAKEFOURCC)


this is nonsense, < should definitely be << and if this is wrong anything
else can be too. probably this is abandoned code never compiled with that
conditional.

Reply With Quote
  #5 (permalink)  
Old 11-26-2009, 10:46 AM
ahso
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Maybe I did something wrong below? I try to compile that on Linux so I
used typedef.

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;
Reply With Quote
  #6 (permalink)  
Old 11-26-2009, 10:50 AM
ahso
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Hi Balog
true I changed << to < as i got an error about not integer or so. It
compiles on Windows but I want to
compile it for Linux so I used:

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

Maybe there's something wrong. I didn't try such before.
Many thanks
Michael
Reply With Quote
  #7 (permalink)  
Old 11-26-2009, 11:03 AM
mikethebike
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Balog did u mark me as spam? I had to login as another user for
replying.

Yes I changed << to < as i got some integer error. And yes it compile
on Windows but i want to compile on Linux.
Maybe I made a fault with typedef? Never used that before

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

Many thanks
Michael
Reply With Quote
  #8 (permalink)  
Old 11-26-2009, 11:27 AM
mikethebike
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Balog did u mark me as spam? I had to login as another user for
replying.

Yes I changed << to < as i got some integer error. And yes it compile
on Windows but i want to compile on Linux.
Maybe I made a fault with typedef? Never used that before

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

Many thanks
Michael

Reply With Quote
  #9 (permalink)  
Old 11-26-2009, 11:30 AM
ahso
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

Balog did u mark me as spam? I had to login as another user for
replying.

Yes I changed << to < as i got some integer error. And yes it compile
on Windows but i want to compile on Linux.
Maybe I made a fault with typedef? Never used that before

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

Many thanks
Michael


Reply With Quote
  #10 (permalink)  
Old 11-26-2009, 02:21 PM
Richard Herring
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

In message
<4dde9616-b259-47f4-8c75-4530280d77e6@f16g2000yqm.googlegroups.com>,
mikethebike <michael.sgier@gmail.com> writes
>Balog did u mark me as spam? I had to login as another user for
>replying.
>
>Yes I changed << to < as i got some integer error. And yes it compile
>on Windows but i want to compile on Linux.
>Maybe I made a fault with typedef? Never used that before
>
>typedef int DWORD;
>typedef unsigned int WORD;
>typedef long int LONG;
>typedef int BYTE;
>typedef bool LPVOID;


Trying to make faulty code compile by a sequence of random changes is
not an effective strategy.

*Why* are you inserting random (and almost certainly incorrect - naively
I'd expect DWORD to be Double the length of WORD, and LPVOID to be some
kind of Pointer to VOID) typedefs named to look like macros?

The code was written for an environment which presumably already defines
these symbols, so what is preventing you from compiling it in that
environment? If you're trying to port Windows-specific (and
library-specific) code to a different platform without fully
understanding the differences between platforms, no amount of random
tinkering is likely to succeed.

--
Richard Herring
Reply With Quote
  #11 (permalink)  
Old 11-26-2009, 08:24 PM
Andy Champ
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

ahso wrote:
> Hi Balog
> true I changed << to < as i got an error about not integer or so. It
> compiles on Windows but I want to
> compile it for Linux so I used:
>
> typedef int DWORD;
> typedef unsigned int WORD;
> typedef long int LONG;
> typedef int BYTE;
> typedef bool LPVOID;
>
> Maybe there's something wrong. I didn't try such before.
> Many thanks
> Michael


Michael,

those constants are chosen for very good reasons. That FOURCC_DXT1
actually represents a four-byte value where the four bytes contain the
characters D X T 1 (ASCII) as defined at

http://www.fourcc.org/codecs.php

The byte order is significant.

Those values above: IIRC

DWORD is unsigned 32 bit
WORD is unsigned 16
LONG is signed 32
BYTE is unsigned 8
LPVOID is void* (might be 32 or 64 bit)

From the things you are asking you are embarking on a large project
involving doing things to video. That will not be a trivial exercise to
change between systems. Are you certain there isn't an existing Linux
version available?

Andy
Reply With Quote
  #12 (permalink)  
Old 11-26-2009, 09:39 PM
Richard
Guest
 
Posts: n/a
Default Re: DWORD and bool to binary

[Please do not mail me a copy of your followup]

ahso <ahso47@yahoo.com> spake the secret code
<3461e48e-41fb-4972-b213-009becd594ed@p35g2000yqh.googlegroups.com> thusly:

>typedef int DWORD;
>typedef unsigned int WORD;
>typedef long int LONG;
>typedef int BYTE;
>typedef bool LPVOID;


*none* of these typedefs are correct, however.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
Reply With Quote
 
Reply

Popular Tags in the Forum
binary, bool, dword

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NetReDir() Function Mario H. Sabado Newsgroup comp.lang.xharbour 6 09-05-2009 01:33 AM
Replacing macros in code eng Newsgroup comp.language.c++ 4 06-15-2009 09:37 AM



All times are GMT. The time now is 04:29 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.