ImplAAFFile::Save()

John Emmas
2005-07-27
2013-04-29
  • John Emmas
    John Emmas
    2005-07-27

    This morning I finally got around to rebuilding my module tests (ComModAAF.exe) after doing a full CVS update a couple of months ago. AAFFile is failing (as are a couple of others  although I havent investigated the others yet). The test fails in ReadAAFFile(aafWChar * pFileName) at the line:-

    checkExpression( // YYYY-MM-DD should not be 0000-00-00
        !( ts.date.year == 0 && ts.date.month == 0 && ts.date.day == 0),
        AAFRESULT_TEST_FAILED);

    ...which has just retrieved the files last modified date. As far as I can tell, the last modified date is supposed to be saved in ImplAAFFile::Save() which, in turn, calls ImplAAFHeader::SetModified() to update the actual date & time.

    However the call to ImplAAFHeader::SetModified() isnt made until AFTER the file has been saved  the sequence of events being (from ImplAAFFile::Save() )

        if (IsWriteable ()) {

          //  a load of stuff

          hr = pLatestIdent->GetGenerationID (&latestGen);
          if (AAFRESULT_FAILED (hr)) return hr;
          _file->saveFile(&latestGen);

          dictSP->SetEnableDefRegistration (regWasEnabled);

        } else {
          return AAFRESULT_WRONG_OPENMODE;
        }

        // Record the fact that this file was modified
        _head->SetModified();

    In other words, _head->SetModified() is called AFTER the save has just been done. Unless the file is saved a second time, doesnt this mean that it will always have a NUL date & time for last modified?

     
    • Bug 1191791 appears to be indentical to the bug you have described where SetModified() was incorrectly called after the file was saved rather than just before.  This bug was fixed in revision 1.144 of ref-impl/src/impl/ImplAAFFile.cpp on 2005/04/28.  See http://sourceforge.net/tracker/index.php?func=detail&aid=1191791&group_id=24405&atid=381387

      Moments later an additional test was committed for CAAFFileTest.cpp (revision 1.44) to prevent the bug happening again.  It looks like you have a version of CAAFFileTest.cpp which is more recent than ImplAAFFile.cpp.

       
    • John Emmas
      John Emmas
      2005-07-27

      Yes, I followed your link Stuart and it does seem to be the same bug - but here's the odd thing....

      I updated my copy of ImplAAFFile.cpp only this morning and I've even run it through my differ but the call to _head->SetModified();  is still appearing AFTER the save???

      Is it possible that I'm updating from the wrong place? If it's any help, the first line in the file seems to indicate that my current copy is Version 1.143 dated 08:15:10 17/03/2005.

       
      • Version 1.143 of ImplAAFFile.cpp is out of date.  It should be 1.144 dated 2005/04/28.  See http://cvs.sourceforge.net/viewcvs.py/aaf/AAF/ref-impl/src/impl/ImplAAFFile.cpp?only_with_tag=MAIN

        Try removing any sticky tags or branch tags with "cvs update -A".  Such tags are stored in the CVS/Entries file.

         
        • John Emmas
          John Emmas
          2005-07-27

          I'm glad you thought of that Stuart. It would never have occured to me!! Anyway, it seems to have done the trick.

          I guess my other problems will turn out to be something similar. Thanks for the help.