Thread overview
Converting from winstl::a2w to 'const unsigned short *' on MSVC++8
Mar 29, 2007
Adi Shavit
Mar 29, 2007
Matthew Wilson
Mar 29, 2007
Matthew Wilson
Mar 30, 2007
Adi Shavit
Mar 30, 2007
Matthew Wilson
Mar 30, 2007
Adi Shavit
March 29, 2007
Don't know how parse text/html message
March 29, 2007
The problem is not with multibyte2wide.

It's that your write() method takes 'unsigned char const*', whereas winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the same (because wchar_t is a typedef); on VC8 these are different because wchar_t is a full-fledged type.

:-)
  "Adi Shavit" <adish@gentech.co.il> wrote in message news:euh6qd$4mi$1@digitalmars.com...
  Hi,

    I'm getting this compilation error on MSVC++ 2005:


    h:\adish\dev\audiostream\audiostream\audiostream\audiostream.hpp(56) : error C2664: 'std::streamsize audiostream::audio_sink<SinkType>::write(const unsigned short *,std::streamsize)' : cannot convert parameter 1 from 'stlsoft::winstl_project::multibyte2wide<CCH>' to 'const unsigned short *'
            with
            [
                SinkType=boost::iostreams::sink
            ]
            and
            [
                CCH=256
            ]
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called


  See context here.
  Essentially I try to pass a winstl::a2w() to a method expecting const unsigned short* s.
  It works fine on MSVC++6.

  Any thoughts?
  Thanks,
  Adi


March 29, 2007
The question is, I think, why the wide string write() is not 'wchar_t const*'?

If it has to be for some reason, then you're going to need to do some casting. Included is a modified form of your audiostream.hpp that fixes it (and compiles with VC8).

If it doesn't, then it's a real simple fix.
  "Matthew Wilson" <matthew@hat.stlsoft.dot.org> wrote in message news:euha08$84t$1@digitalmars.com...
  The problem is not with multibyte2wide.

  It's that your write() method takes 'unsigned char const*', whereas winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the same (because wchar_t is a typedef); on VC8 these are different because wchar_t is a full-fledged type.

  :-)
    "Adi Shavit" <adish@gentech.co.il> wrote in message news:euh6qd$4mi$1@digitalmars.com...
    Hi,

      I'm getting this compilation error on MSVC++ 2005:


      h:\adish\dev\audiostream\audiostream\audiostream\audiostream.hpp(56) : error C2664: 'std::streamsize audiostream::audio_sink<SinkType>::write(const unsigned short *,std::streamsize)' : cannot convert parameter 1 from 'stlsoft::winstl_project::multibyte2wide<CCH>' to 'const unsigned short *'
              with
              [
                  SinkType=boost::iostreams::sink
              ]
              and
              [
                  CCH=256
              ]
              No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called


    See context here.
    Essentially I try to pass a winstl::a2w() to a method expecting const unsigned short* s.
    It works fine on MSVC++6.

    Any thoughts?
    Thanks,
    Adi


March 30, 2007
> The problem is not with multibyte2wide.
I never, for a moment, thought it was. :-)
> It's that your write() method takes 'unsigned char const*', whereas winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the same (because wchar_t is a typedef); on VC8 these are different because wchar_t is a full-fledged type.
Ah right! I thought it might be something like that. Thanks a lot. It was my oversight integrating with Boost Iostreams.

Thanks,
Adi
March 30, 2007
Hi,
> The question is, I think, why the wide string write() is not 'wchar_t const*'?
The answer is, my oversight.
In fact, once I changed it to wchar_t it works on both VS6 and VS2005.
> If it has to be for some reason, then you're going to need to do some casting. Included is a modified form of your audiostream.hpp that fixes it (and compiles with VC8).
>  If it doesn't, then it's a real simple fix.
Thanks for the fix, but the real simple fix did the trick.
Adi

March 30, 2007
Cool. I suspected it might. :-)

"Adi Shavit" <adish@gentech.co.il> wrote in message news:eujqtc$4kn$1@digitalmars.com...
> Hi,
> > The question is, I think, why the wide string write() is not 'wchar_t
> > const*'?
> The answer is, my oversight.
> In fact, once I changed it to wchar_t it works on both VS6 and VS2005.
> > If it has to be for some reason, then you're going to need to do some casting. Included is a modified form of your audiostream.hpp that fixes it (and compiles with VC8).
> >
> > If it doesn't, then it's a real simple fix.
> Thanks for the fix, but the real simple fix did the trick. Adi
>