Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 27th June 2005, 14:17   #1
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
NSIS source error ANSI C++ forbids implicit conversion

Hi all helpfull programmers:

Compiling on Solaris SunOS5.8 stumbled accross the following compiler error"

++ -Wall -O3 -DCOMPRESS_MF_BT -c mmap.cpp -o ../Build/mmap.o
mmap.cpp: In method `void MMapFile::release()':
mmap.cpp:300: ANSI C++ forbids implicit conversion from `void *' in argument passing
mmap.cpp: In method `void MMapFile::release(void *, int)':
mmap.cpp:313: ANSI C++ forbids implicit conversion from `void *' in argument passing
mmap.cpp: In method `void MMapFile::flush(int)':
mmap.cpp:323: ANSI C++ forbids implicit conversion from `void *' in argument passing
make: *** [../Build/mmap.o] Error 1

How to fix the source, I'm not (yet) a C++ guro, help appriciated.

"Just do it"
onad is offline   Reply With Quote
Old 27th June 2005, 14:38   #2
ElvenProgrammer
Junior Member
 
ElvenProgrammer's Avatar
 
Join Date: Jun 2005
Location: Italy
Posts: 31
Maybe it also depend on what compiler version you're using...
ElvenProgrammer is offline   Reply With Quote
Old 27th June 2005, 14:40   #3
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
FYI: I'm using:

gcc version 2.95.3 20010315 (release)
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/specs

and the code that gives problems
----------------------------------------
void MMapFile::release()
{
if (!m_pView)
return;

#ifdef _WIN32
UnmapViewOfFile(m_pView);
#else
munmap(m_pView, m_iMappedSize);
#endif
m_pView = NULL;
}
----------------------------------------

and I read somwhere:

So it's warning you that ansi c++ won't convert your void* to the required char*. You can cast your stuff variable to a char* instead of a void* to get rid of the warning. I think the key thing to realize is that Solaris shared memory is getting you an array of bytes, while your program is using a structure.
void* is a generic pointer (an address without a type associated with it). They use it in the documentation because they don't know what kind of pointer you'll be using. You can assign any pointer to void*, but you have to cast it when you assign the void* to another pointer.
a void * is a pointer to a memory area. You can treat it as a buffer that is castable to whatever type you'd like. In the linux implementation it's a char *, but a void * is more general.

Anyone can implement this, since C++ on Solaris is not my thing (yet...)

"Just do it"
onad is offline   Reply With Quote
Old 27th June 2005, 15:21   #4
ElvenProgrammer
Junior Member
 
ElvenProgrammer's Avatar
 
Join Date: Jun 2005
Location: Italy
Posts: 31
I guess explicit cast doesn't fix it...
ElvenProgrammer is offline   Reply With Quote
Old 27th June 2005, 15:51   #5
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
Maybe, if you would be so kind as to make the small Cast adjustment as it could be, I'll re-test compile i on Solaris.

Thanks!
onad is offline   Reply With Quote
Old 27th June 2005, 16:23   #6
ElvenProgrammer
Junior Member
 
ElvenProgrammer's Avatar
 
Join Date: Jun 2005
Location: Italy
Posts: 31
I'd try this way and if it works for the error on line 300 then go for it on the other lines as well.

code:

munmap((char *)m_pView, m_iMappedSize);

ElvenProgrammer is offline   Reply With Quote
Old 27th June 2005, 16:47   #7
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
Yes, great "mmap.o" created (Changed all three lines), THANKS! now I must go on to the next steps, got some other errors...

Will post my progress / problems here.

ElvenProgrammer, you tha man of the day!

"Just do it"
onad is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump