Refactoring Patch

Ralf Engels <[email protected]>
Newsgroups gmane.comp.audio.zinf.devel
Message-ID <[email protected]>
Hi,
I looked around for some things to do, e.g. this soft-volume I talked about.

Problem is that I just can't understand the code. Not commenting the 
code is not a solution!

So I did some refactoring like removing overloaded functions that only 
call the super-function. Waste of space this...

Hey you, returning parameters via &ret is very bad. From the calling 
side you can't see what's going on. * ret is much better in this case.

Ok,
anyway, here is the patch.



diff -ur zinf-compiled/io/http/httpinput.cpp zinf/io/http/httpinput.cpp
--- zinf-compiled/io/http/httpinput.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/http/httpinput.cpp	2003-08-10 00:01:30.000000000 +0200
@@ -1384,11 +1384,6 @@
  };


-Error HttpInput::Seek(int32_t & rtn, int32_t offset, int32_t origin){
-    return kError_FileSeekNotSupported;
-}
-
-
  vector < string > *HttpInput::GetProtocols(void)
  {
     vector < string > *protoList = new vector < string >;
diff -ur zinf-compiled/io/http/httpinput.h zinf/io/http/httpinput.h
--- zinf-compiled/io/http/httpinput.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/http/httpinput.h	2003-08-10 00:01:47.000000000 +0200
@@ -84,7 +84,6 @@

     void            WorkerThread(void);
     virtual Error GetLength(size_t &iSize);
-   virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin);
     virtual vector<string> *GetProtocols(void);

  protected:
Binärdateien zinf-compiled/io/http/httpinput.lo and 
zinf/io/http/httpinput.lo sind verschieden.
Binärdateien zinf-compiled/io/http/httpinput.o and 
zinf/io/http/httpinput.o sind verschieden.
diff -ur zinf-compiled/io/include/pmi.h zinf/io/include/pmi.h
--- zinf-compiled/io/include/pmi.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/include/pmi.h	2003-08-10 00:02:20.000000000 +0200
@@ -63,10 +63,21 @@
      virtual std::string Url(void) const = 0;
      virtual Error Prepare(PullBuffer *&pBuffer) = 0;

-    virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin)
+    /** Moves the current position in the file.
+     *  @param offset The pos to move to
+     *  @param whence Added to offest or special constants. See fseek
+     *  @return can return kError_FileSeekNotSupported or kError_SeekFailed
+     */
+    virtual Error Seek(int32_t offset, int32_t whence)
                    { return kError_FileSeekNotSupported; };
-    virtual Error Tell(int32_t & rtn)
+
+    /** Return the current position in the stream.
+     *  @param pos The current pos in the stream
+     *  @return can return kError_FileSeekNotSupported or kError_SeekFailed
+     */
+    virtual Error Tell(int32_t* pos)
                    { return kError_FileSeekNotSupported; };
+
      virtual bool  CanHandle(const char *szUrl, char *szTitle)
  	               {return false;}
      virtual Error GetLength(size_t &iSize)
diff -ur zinf-compiled/io/local/localfileinput.cpp 
zinf/io/local/localfileinput.cpp
--- zinf-compiled/io/local/localfileinput.cpp	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/io/local/localfileinput.cpp	2003-08-10 00:07:10.000000000 +0200
@@ -187,33 +187,27 @@
      return kError_NoErr;
  };

-Error LocalFileInput::Tell(int32_t &iRet)
+
+Error LocalFileInput::Tell(int32_t *iRet)
  {
-    iRet = ftell(m_fpFile);
-    if (iRet < 0)
+    *iRet = ftell(m_fpFile);
+    if (*iRet < 0)
         return kError_SeekFailed;

-    iRet -= m_pOutputBuffer->GetNumBytesInBuffer();
+    *iRet -= m_pOutputBuffer->GetNumBytesInBuffer();

      return kError_NoErr;
  }

-Error LocalFileInput::Seek(int32_t &iRet, int32_t iPos, int32_t iFrom)
+Error LocalFileInput::Seek(int32_t iPos, int32_t iFrom)
  {
      Error eRet = kError_NoErr;

-    if (iPos == 0 && iFrom == SEEK_CUR)
-       return Tell(iRet);
+    if( iPos == 0 && iFrom == SEEK_CUR)
+      return eRet; // nothing to do

-    iRet = fseek(m_fpFile, iPos, iFrom);
-    if (iRet < 0)
-    {
-       eRet = kError_SeekFailed;
-    }
-    else
-    {
-       eRet = Tell(iRet);
-    }
+    if( fseek(m_fpFile, iPos, iFrom) )
+      eRet = kError_SeekFailed;

      m_pOutputBuffer->Clear();

diff -ur zinf-compiled/io/local/localfileinput.h 
zinf/io/local/localfileinput.h
--- zinf-compiled/io/local/localfileinput.h	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/io/local/localfileinput.h	2003-08-09 23:58:50.000000000 +0200
@@ -48,8 +48,8 @@
  	virtual bool  CanHandle(const char *szUrl, char *szTitle);
  	virtual bool  IsStreaming(void)
  	              { return false; };
-   virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin);
-   virtual Error Tell(int32_t & rtn);
+   virtual Error Seek(int32_t offset, int32_t origin);
+   virtual Error Tell(int32_t* pos);
     virtual Error GetLength(size_t &iSize);

     virtual Error Prepare(PullBuffer *&pBuffer);
diff -ur zinf-compiled/io/wavout/include/wavoutpmo.h 
zinf/io/wavout/include/wavoutpmo.h
--- zinf-compiled/io/wavout/include/wavoutpmo.h	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/io/wavout/include/wavoutpmo.h	2003-08-10 22:47:00.000000000 +0200
@@ -52,8 +52,6 @@

    virtual Error   Init(OutputInfo* info);

-  void            Pause(void);
-  void            Resume(void);
    void            Quit(void);

    virtual void    GetVolume(int32_t &, int32_t &);
diff -ur zinf-compiled/io/wavout/src/wavoutpmo.cpp 
zinf/io/wavout/src/wavoutpmo.cpp
--- zinf-compiled/io/wavout/src/wavoutpmo.cpp	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/io/wavout/src/wavoutpmo.cpp	2003-08-10 22:45:51.000000000 +0200
@@ -150,19 +150,6 @@
     return kError_NoErr;
  }

-void
-WavOutPMO::
-Pause()
-{
-   PhysicalMediaOutput::Pause();
-}
-
-void
-WavOutPMO::
-Resume()
-{
-   PhysicalMediaOutput::Resume();
-}

  Error
  WavOutPMO::
diff -ur zinf-compiled/lmc/vorbis/include/vorbislmc.h 
zinf/lmc/vorbis/include/vorbislmc.h
--- zinf-compiled/lmc/vorbis/include/vorbislmc.h	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/lmc/vorbis/include/vorbislmc.h	2003-08-10 02:16:40.000000000 +0200
@@ -59,8 +59,6 @@
     virtual void  Clear();
     virtual Error ExtractMediaInfo();

-   virtual void  SetPMI(PhysicalMediaInput *pmi) { m_pPmi = pmi; };
-   virtual void  SetPMO(PhysicalMediaOutput *pmo) { m_pPmo = pmo; };
     virtual Error Prepare(PullBuffer *pInputBuffer, PullBuffer 
*&pOutBuffer);
     virtual Error InitDecoder();

@@ -86,9 +84,6 @@
     static void          DecodeWorkerThreadFunc(void *);
     void                 DecodeWork();

-   PhysicalMediaInput  *m_pPmi;
-   PhysicalMediaOutput *m_pPmo;
-
     Thread              *m_decoderThread;

     char                *m_szUrl;
diff -ur zinf-compiled/lmc/vorbis/src/vorbislmc.cpp 
zinf/lmc/vorbis/src/vorbislmc.cpp
--- zinf-compiled/lmc/vorbis/src/vorbislmc.cpp	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/lmc/vorbis/src/vorbislmc.cpp	2003-08-10 00:00:09.000000000 +0200
@@ -65,7 +65,7 @@
  const char *szCannotDecode = N_("Skipped corrupted file.");

  VorbisLMC::VorbisLMC(FAContext *context) :
-         LogicalMediaConverter(context),m_pPmi(NULL),m_pPmo(NULL),
+         LogicalMediaConverter(context),m_pmi(NULL),m_pmo(NULL),
  	 m_decoderThread(NULL),m_szUrl(NULL),m_szError(NULL)
  {
     m_pContext = context;
@@ -149,7 +149,7 @@
     Error            result;
     int              iNewSize;

-   if (!m_pTarget || !m_pPmi || !m_pPmo || !m_pInputBuffer || 
!m_pOutputBuffer)
+   if (!m_pTarget || !m_pmi || !m_pmo || !m_pInputBuffer || 
!m_pOutputBuffer)
     {
        return kError_PluginNotInitialized;
     }
@@ -217,7 +217,7 @@
     totalSeconds = ov_time_total(&m_vf, 0);

     vi = ov_info(&m_vf, -1);
-   pMIE = new MediaInfoEvent(m_pPmi->Url().c_str(), totalSeconds);
+   pMIE = new MediaInfoEvent(m_pmi->Url().c_str(), totalSeconds);
     if (!pMIE)
        return kError_OutOfMemory;

@@ -288,11 +288,11 @@
     uint32_t         bytesCopied, bytesPerFrame;
     int            bitrateLoops = 0;

-   assert(m_pPmi);
-   assert(m_pPmo);
+   assert(m_pmi);
+   assert(m_pmo);

     m_pSleepSem->Wait();
-   m_pPmi->Wake();
+   m_pmi->Wake();

     Err = CanDecode();
     if (Err == kError_Interrupt)
@@ -519,13 +519,10 @@

  int VorbisLMC::Seek(long offset, int whence)
  {
-   int32_t ret = -1;
+   if( m_pmi->Seek(offset, whence) != kError_NoErr )
+     return -1;

-   if (m_pPmi->IsStreaming())
-      return -1;
-
-   m_pPmi->Seek(ret, offset, whence);
-   return ret;
+   return 0;
  }

  long VorbisLMC::TellWrapper(void *stream)
@@ -535,12 +532,11 @@

  long VorbisLMC::Tell(void)
  {
-   int32_t ret = -1;
+   int32_t ret;

-   if (m_pPmi->IsStreaming())
-      return -1;
+   if( m_pmi->Tell(&ret) != kError_NoErr )
+     return -1;

-   m_pPmi->Tell(ret);
     return ret;
  }

@@ -568,7 +564,7 @@
             if (m_bExit)
  	   	break;

-           m_pPmi->Wake();
+           m_pmi->Wake();

             if (Sleep())
                break;
diff -ur zinf-compiled/lmc/wav/src/wavlmc.cpp zinf/lmc/wav/src/wavlmc.cpp
--- zinf-compiled/lmc/wav/src/wavlmc.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/lmc/wav/src/wavlmc.cpp	2003-08-10 00:03:19.000000000 +0200
@@ -748,17 +748,13 @@

  Error WavLMC::ChangePosition(int32_t position)
  {
-   int32_t   dummy;
-   uint32_t  lSeekTo;

     assert(position >= 0 && position < m_iTotalFrames);

     m_frameCounter = position;

-   lSeekTo = m_ulWaveHeaderSize + (position * m_frameBytes);
-
-   m_pPmi->Seek(dummy, lSeekTo, SEEK_FROM_START);
+   uint32_t lSeekTo = m_ulWaveHeaderSize + (position * m_frameBytes);

-   return kError_NoErr;
+   return m_pPmi->Seek( lSeekTo, SEEK_FROM_START );
  }

diff -ur zinf-compiled/lmc/xingmp3/src/xinglmc.cpp 
zinf/lmc/xingmp3/src/xinglmc.cpp
--- zinf-compiled/lmc/xingmp3/src/xinglmc.cpp	2003-08-09 
19:48:43.000000000 +0200
+++ zinf/lmc/xingmp3/src/xinglmc.cpp	2003-08-10 00:04:46.000000000 +0200
@@ -1019,12 +1019,11 @@

  Error XingLMC::ChangePosition(int32_t position)
  {
-   int32_t   dummy;
-   uint32_t  lSeekTo;
-
     assert(position >= 0 && position < m_iTotalFrames);

     m_frameCounter = position;
+
+   uint32_t  lSeekTo;
     if (m_pXingHeader)
        lSeekTo = SeekPoint(m_pXingHeader->toc, m_lFileSize,
                                     (float)position * 100/
@@ -1032,8 +1031,6 @@
     else
        lSeekTo = position * m_frameBytes;

-   m_pPmi->Seek(dummy, lSeekTo, SEEK_FROM_START);
-
-   return kError_NoErr;
+   return m_pPmi->Seek( lSeekTo, SEEK_FROM_START );
  }
zinf-refactoring1.diff (text/plain, 9.6 KB)
diff -ur zinf-compiled/io/http/httpinput.cpp zinf/io/http/httpinput.cpp
--- zinf-compiled/io/http/httpinput.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/http/httpinput.cpp	2003-08-10 00:01:30.000000000 +0200
@@ -1384,11 +1384,6 @@
 };
 
 
-Error HttpInput::Seek(int32_t & rtn, int32_t offset, int32_t origin){
-    return kError_FileSeekNotSupported; 
-}
-
-
 vector < string > *HttpInput::GetProtocols(void)
 {
    vector < string > *protoList = new vector < string >;
diff -ur zinf-compiled/io/http/httpinput.h zinf/io/http/httpinput.h
--- zinf-compiled/io/http/httpinput.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/http/httpinput.h	2003-08-10 00:01:47.000000000 +0200
@@ -84,7 +84,6 @@
 
    void            WorkerThread(void); 
    virtual Error GetLength(size_t &iSize);
-   virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin);
    virtual vector<string> *GetProtocols(void);
 
 protected:
Binärdateien zinf-compiled/io/http/httpinput.lo and zinf/io/http/httpinput.lo sind verschieden.
Binärdateien zinf-compiled/io/http/httpinput.o and zinf/io/http/httpinput.o sind verschieden.
diff -ur zinf-compiled/io/include/pmi.h zinf/io/include/pmi.h
--- zinf-compiled/io/include/pmi.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/include/pmi.h	2003-08-10 00:02:20.000000000 +0200
@@ -63,10 +63,21 @@
     virtual std::string Url(void) const = 0;
     virtual Error Prepare(PullBuffer *&pBuffer) = 0;
 
-    virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin)
+    /** Moves the current position in the file.
+     *  @param offset The pos to move to
+     *  @param whence Added to offest or special constants. See fseek
+     *  @return can return kError_FileSeekNotSupported or kError_SeekFailed
+     */
+    virtual Error Seek(int32_t offset, int32_t whence)
                   { return kError_FileSeekNotSupported; };
-    virtual Error Tell(int32_t & rtn)
+
+    /** Return the current position in the stream.
+     *  @param pos The current pos in the stream
+     *  @return can return kError_FileSeekNotSupported or kError_SeekFailed
+     */
+    virtual Error Tell(int32_t* pos)
                   { return kError_FileSeekNotSupported; };
+
     virtual bool  CanHandle(const char *szUrl, char *szTitle)
 	               {return false;}
     virtual Error GetLength(size_t &iSize)
diff -ur zinf-compiled/io/local/localfileinput.cpp zinf/io/local/localfileinput.cpp
--- zinf-compiled/io/local/localfileinput.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/local/localfileinput.cpp	2003-08-10 00:07:10.000000000 +0200
@@ -187,33 +187,27 @@
     return kError_NoErr;
 }; 
 
-Error LocalFileInput::Tell(int32_t &iRet) 
+
+Error LocalFileInput::Tell(int32_t *iRet) 
 {
-    iRet = ftell(m_fpFile);
-    if (iRet < 0)
+    *iRet = ftell(m_fpFile);
+    if (*iRet < 0)
        return kError_SeekFailed;
 
-    iRet -= m_pOutputBuffer->GetNumBytesInBuffer();
+    *iRet -= m_pOutputBuffer->GetNumBytesInBuffer();
        
     return kError_NoErr;
 }
 
-Error LocalFileInput::Seek(int32_t &iRet, int32_t iPos, int32_t iFrom) 
+Error LocalFileInput::Seek(int32_t iPos, int32_t iFrom) 
 { 
     Error eRet = kError_NoErr;
 
-    if (iPos == 0 && iFrom == SEEK_CUR)
-       return Tell(iRet);
+    if( iPos == 0 && iFrom == SEEK_CUR)
+      return eRet; // nothing to do
 
-    iRet = fseek(m_fpFile, iPos, iFrom);
-    if (iRet < 0)
-    {
-       eRet = kError_SeekFailed;
-    }
-    else
-    {
-       eRet = Tell(iRet);
-    }
+    if( fseek(m_fpFile, iPos, iFrom) )
+      eRet = kError_SeekFailed;
 
     m_pOutputBuffer->Clear();
 
diff -ur zinf-compiled/io/local/localfileinput.h zinf/io/local/localfileinput.h
--- zinf-compiled/io/local/localfileinput.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/local/localfileinput.h	2003-08-09 23:58:50.000000000 +0200
@@ -48,8 +48,8 @@
 	virtual bool  CanHandle(const char *szUrl, char *szTitle);
 	virtual bool  IsStreaming(void)
 	              { return false; };
-   virtual Error Seek(int32_t & rtn, int32_t offset, int32_t origin);
-   virtual Error Tell(int32_t & rtn);
+   virtual Error Seek(int32_t offset, int32_t origin);
+   virtual Error Tell(int32_t* pos);
    virtual Error GetLength(size_t &iSize);
 
    virtual Error Prepare(PullBuffer *&pBuffer);
diff -ur zinf-compiled/io/wavout/include/wavoutpmo.h zinf/io/wavout/include/wavoutpmo.h
--- zinf-compiled/io/wavout/include/wavoutpmo.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/wavout/include/wavoutpmo.h	2003-08-10 22:47:00.000000000 +0200
@@ -52,8 +52,6 @@
 
   virtual Error   Init(OutputInfo* info);
 
-  void            Pause(void);
-  void            Resume(void);
   void            Quit(void);
 
   virtual void    GetVolume(int32_t &, int32_t &);
diff -ur zinf-compiled/io/wavout/src/wavoutpmo.cpp zinf/io/wavout/src/wavoutpmo.cpp
--- zinf-compiled/io/wavout/src/wavoutpmo.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/io/wavout/src/wavoutpmo.cpp	2003-08-10 22:45:51.000000000 +0200
@@ -150,19 +150,6 @@
    return kError_NoErr;
 }
 
-void 
-WavOutPMO::
-Pause()
-{
-   PhysicalMediaOutput::Pause();
-}
-
-void
-WavOutPMO::
-Resume()
-{
-   PhysicalMediaOutput::Resume();
-}
 
 Error
 WavOutPMO::
diff -ur zinf-compiled/lmc/vorbis/include/vorbislmc.h zinf/lmc/vorbis/include/vorbislmc.h
--- zinf-compiled/lmc/vorbis/include/vorbislmc.h	2003-08-09 19:48:43.000000000 +0200
+++ zinf/lmc/vorbis/include/vorbislmc.h	2003-08-10 02:16:40.000000000 +0200
@@ -59,8 +59,6 @@
    virtual void  Clear();
    virtual Error ExtractMediaInfo();
 
-   virtual void  SetPMI(PhysicalMediaInput *pmi) { m_pPmi = pmi; };
-   virtual void  SetPMO(PhysicalMediaOutput *pmo) { m_pPmo = pmo; };
    virtual Error Prepare(PullBuffer *pInputBuffer, PullBuffer *&pOutBuffer);
    virtual Error InitDecoder();
 
@@ -86,9 +84,6 @@
    static void          DecodeWorkerThreadFunc(void *);
    void                 DecodeWork();
 
-   PhysicalMediaInput  *m_pPmi;
-   PhysicalMediaOutput *m_pPmo;
-
    Thread              *m_decoderThread;
 
    char                *m_szUrl;
diff -ur zinf-compiled/lmc/vorbis/src/vorbislmc.cpp zinf/lmc/vorbis/src/vorbislmc.cpp
--- zinf-compiled/lmc/vorbis/src/vorbislmc.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/lmc/vorbis/src/vorbislmc.cpp	2003-08-10 00:00:09.000000000 +0200
@@ -65,7 +65,7 @@
 const char *szCannotDecode = N_("Skipped corrupted file.");
 
 VorbisLMC::VorbisLMC(FAContext *context) :
-         LogicalMediaConverter(context),m_pPmi(NULL),m_pPmo(NULL),
+         LogicalMediaConverter(context),m_pmi(NULL),m_pmo(NULL),
 	 m_decoderThread(NULL),m_szUrl(NULL),m_szError(NULL)
 {
    m_pContext = context;
@@ -149,7 +149,7 @@
    Error            result;
    int              iNewSize;
 
-   if (!m_pTarget || !m_pPmi || !m_pPmo || !m_pInputBuffer || !m_pOutputBuffer)
+   if (!m_pTarget || !m_pmi || !m_pmo || !m_pInputBuffer || !m_pOutputBuffer)
    {
       return kError_PluginNotInitialized;
    }
@@ -217,7 +217,7 @@
    totalSeconds = ov_time_total(&m_vf, 0);
 
    vi = ov_info(&m_vf, -1);
-   pMIE = new MediaInfoEvent(m_pPmi->Url().c_str(), totalSeconds);
+   pMIE = new MediaInfoEvent(m_pmi->Url().c_str(), totalSeconds);
    if (!pMIE)
       return kError_OutOfMemory;
 
@@ -288,11 +288,11 @@
    uint32_t         bytesCopied, bytesPerFrame;
    int            bitrateLoops = 0;
 
-   assert(m_pPmi);
-   assert(m_pPmo);
+   assert(m_pmi);
+   assert(m_pmo);
 
    m_pSleepSem->Wait();
-   m_pPmi->Wake();
+   m_pmi->Wake();
 
    Err = CanDecode();
    if (Err == kError_Interrupt)
@@ -519,13 +519,10 @@
 
 int VorbisLMC::Seek(long offset, int whence)
 {
-   int32_t ret = -1;
+   if( m_pmi->Seek(offset, whence) != kError_NoErr )
+     return -1;
 
-   if (m_pPmi->IsStreaming())
-      return -1;
-
-   m_pPmi->Seek(ret, offset, whence);   
-   return ret;
+   return 0;
 }
 
 long VorbisLMC::TellWrapper(void *stream)
@@ -535,12 +532,11 @@
 
 long VorbisLMC::Tell(void)
 {
-   int32_t ret = -1;
+   int32_t ret;
 
-   if (m_pPmi->IsStreaming())
-      return -1;
+   if( m_pmi->Tell(&ret) != kError_NoErr )
+     return -1;
 
-   m_pPmi->Tell(ret);   
    return ret;
 }
 
@@ -568,7 +564,7 @@
            if (m_bExit)
 	   	break;
 
-           m_pPmi->Wake();
+           m_pmi->Wake();
 
            if (Sleep())
               break;
diff -ur zinf-compiled/lmc/wav/src/wavlmc.cpp zinf/lmc/wav/src/wavlmc.cpp
--- zinf-compiled/lmc/wav/src/wavlmc.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/lmc/wav/src/wavlmc.cpp	2003-08-10 00:03:19.000000000 +0200
@@ -748,17 +748,13 @@
 
 Error WavLMC::ChangePosition(int32_t position)
 {
-   int32_t   dummy;
-   uint32_t  lSeekTo;
 
    assert(position >= 0 && position < m_iTotalFrames);
 
    m_frameCounter = position;
 
-   lSeekTo = m_ulWaveHeaderSize + (position * m_frameBytes);
-      
-   m_pPmi->Seek(dummy, lSeekTo, SEEK_FROM_START);
+   uint32_t lSeekTo = m_ulWaveHeaderSize + (position * m_frameBytes);
 
-   return kError_NoErr;
+   return m_pPmi->Seek( lSeekTo, SEEK_FROM_START );
 }
 
diff -ur zinf-compiled/lmc/xingmp3/src/xinglmc.cpp zinf/lmc/xingmp3/src/xinglmc.cpp
--- zinf-compiled/lmc/xingmp3/src/xinglmc.cpp	2003-08-09 19:48:43.000000000 +0200
+++ zinf/lmc/xingmp3/src/xinglmc.cpp	2003-08-10 00:04:46.000000000 +0200
@@ -1019,12 +1019,11 @@
 
 Error XingLMC::ChangePosition(int32_t position)
 {
-   int32_t   dummy;
-   uint32_t  lSeekTo;
-
    assert(position >= 0 && position < m_iTotalFrames);
 
    m_frameCounter = position;
+
+   uint32_t  lSeekTo;
    if (m_pXingHeader)
       lSeekTo = SeekPoint(m_pXingHeader->toc, m_lFileSize, 
                                    (float)position * 100/
@@ -1032,8 +1031,6 @@
    else
       lSeekTo = position * m_frameBytes;
       
-   m_pPmi->Seek(dummy, lSeekTo, SEEK_FROM_START);
-
-   return kError_NoErr;
+   return m_pPmi->Seek( lSeekTo, SEEK_FROM_START );
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.