CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Function signature error

Threaded View

  1. #1
    Join Date
    Apr 2003
    Location
    kathmandu, nepal
    Posts
    1,570

    Function signature error

    Hello all,

    I have the following code:

    Code:
    class TiffStream {
    
    public:
        // ctor/dtor
        TiffStream();
        ~TiffStream();
    
    public:
        enum SeekDir {
    	    beg,
    	    cur,
    	    end,
        };
    
    public:
        // factory methods
        TIFF* makeFileStream(std::iostream* str);
        TIFF* makeFileStream(std::ifstream* str);
        TIFF* makeFileStream(std::ofstream* str);
    
    public:
        // tiff client methods
        static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
        static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
        static toff_t seek(thandle_t fd, toff_t offset, int origin);
        static toff_t size(thandle_t fd);
        static int close(thandle_t fd);
        static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
        static void unmap(thandle_t fd, tdata_t base, tsize_t size);
    
        ..................
        ..................
    };
    Code:
    TIFF*
    TiffStream::makeFileStream(ifstream* str)
    {
        m_inStream = str;
        m_outStream = NULL;
        m_ioStream = NULL;
        m_streamLength = getSize(m_this);
    
        m_tif =  TIFFClientOpen(m_name, 
                               "r",
    			   m_this,
    			   read,
    			   write,
    			   seek,
    			   close,
    			   size,
    			   map,
    			   unmap);
        return m_tif;
    }
    
    TIFF*
    TiffStream::makeFileStream(ofstream* str)
    {
    	m_inStream = NULL;
            m_outStream = str;
    	m_ioStream = NULL;
    	m_streamLength = getSize(m_this);
    
    	m_tif =  TIFFClientOpen(m_name, 
                               "w",
    			   m_this,
    			   read,
    			   write,
    			   seek,
    			   close,
    			   size,
    			   map,
    			   unmap);
        return m_tif;
    }
    
    TIFF*
    TiffStream::makeFileStream(iostream* str)
    {
        m_inStream = NULL;
        m_outStream = NULL;
        m_ioStream = str;
        m_streamLength = getSize(m_this);
    
        m_tif =  TIFFClientOpen(m_name, 
    	                       "r+w",
    	                       m_this,
    			       read,
    			       write,
    			       seek,
    			       close,
    			       size,
    			       map,
    			       unmap);
        return m_tif;
    }
    The error generated is as below:

    Code:
    1>i:\de5.5_sdk_21_may_2008(2)\de5.5_sdk\deplugins\plugins\2d\tiffstream.cpp(45) : error C2664: 'TIFFClientOpen' : cannot convert parameter 10 from 'void (__cdecl *)(thandle_t,tdata_t,tsize_t)' to 'TIFFUnmapFileProc'
    1>        None of the functions with this name in scope match the target type
    1>i:\de5.5_sdk_21_may_2008(2)\de5.5_sdk\deplugins\plugins\2d\tiffstream.cpp(66) : error C2664: 'TIFFClientOpen' : cannot convert parameter 10 from 'void (__cdecl *)(thandle_t,tdata_t,tsize_t)' to 'TIFFUnmapFileProc'
    1>        None of the functions with this name in scope match the target type
    1>i:\de5.5_sdk_21_may_2008(2)\de5.5_sdk\deplugins\plugins\2d\tiffstream.cpp(87) : error C2664: 'TIFFClientOpen' : cannot convert parameter 10 from 'void (__cdecl *)(thandle_t,tdata_t,tsize_t)' to 'TIFFUnmapFileProc'
    1>        None of the functions with this name in scope match the target type
    1>Build log was saved at "file://I:\DE5.5_SDK_21_May_2008(2)\DE5.5_SDK\DE42\Temp\Win32\vc80\Debug\2d\BuildLog.htm"
    1>2d - 3 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
    Code:
    #if defined(__cplusplus)
    extern "C" {
    #endif
    typedef	void (*TIFFErrorHandler)(const char*, const char*, va_list);
    typedef	tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
    typedef	toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
    typedef	int (*TIFFCloseProc)(thandle_t);
    typedef	toff_t (*TIFFSizeProc)(thandle_t);
    typedef	int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
    typedef	void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
    ................
    ................
    ................
    The following is the TIFFClientOpen function's signature
    Code:
    TIFF*
    TIFFClientOpen(
    	const char* name, const char* mode,
    	thandle_t clientdata,
    	TIFFReadWriteProc readproc,
    	TIFFReadWriteProc writeproc,
    	TIFFSeekProc seekproc,
    	TIFFCloseProc closeproc,
    	TIFFSizeProc sizeproc,
    	TIFFMapFileProc mapproc,
    	TIFFUnmapFileProc unmapproc
    )
    The error is generated for only the "unmap" function. Instead of a static class member function I used a free function. But still the error is there. Please help. I am stuck with this.
    Last edited by miteshpandey; May 28th, 2008 at 11:10 AM.
    If there is no love sun won't shine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)