Problem with "x" differs in levels of indirection from "y"

T

Tobias Erbsland

Hello

I have a problem with an error message. I created a new class (as
OpenSSL helper):

class DataBlock
{
public:
DataBlock();
DataBlock( unsigned int size );
DataBlock( const DataBlock& copy );
DataBlock( const unsigned char* copy, unsigned int copySize );
~DataBlock();
// .... methods and datas...
};

Then i use the class in this way:

void foo()
{
unsigned char* sessionKey[1];
sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
int sessionKeySize[1];
// (...) call the openssl functions

// problem:
DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );
}

I get the error message (vsc++.net):
error C2040: 'sessionKey' : 'DataBlock' differs in levels of indirection
from 'unsigned char *[1]'

I think i overlooked a fault, but i'd see it... (frustrating... *sigh*)

best regards
Tobias Erbsland
 
S

Sharad Kala

Tobias Erbsland said:
Hello

I have a problem with an error message. I created a new class (as
OpenSSL helper):

class DataBlock
{
public:
DataBlock();
DataBlock( unsigned int size );
DataBlock( const DataBlock& copy );
DataBlock( const unsigned char* copy, unsigned int copySize );
~DataBlock();
// .... methods and datas...
};

Then i use the class in this way:

void foo()
{
unsigned char* sessionKey[1];
sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
int sessionKeySize[1];
// (...) call the openssl functions

// problem:
DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );

sessionKey has already been defined in the code. If your intention is to create
a new object of type DataBlock then use some other variable name.

s(sessionKey[0], sessionKeySize[0] );
 
T

Tobias Erbsland

unsigned char* sessionKey[1];
sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
int sessionKeySize[1];
DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );
sessionKey has already been defined in the code. If your intention is to create
a new object of type DataBlock then use some other variable name.

Thank you very much! (such a stupid mistake ;-)

best regards
Tobias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top