Главная страница | назад





Article #26068: Resolving DFM corruption issues with CVS.

Many developers have complained of problems using source control with their Builder/Delphi projects. After checking their form files out of source control systems such as CVS and attempting to open the form in Builder or Delphi, the IDE reports an error "Invalid stream format." and refuses to display the form. After some research, it was found that CVS was adding bytes to the form's DFM file, inserting a line-feed (integer value of 10) character before each carriage return character (integer value of 13).

The cause is CVS opening and closing this file as if it were a text file. In Builder/Delphi 4, DFM files were stored as binary files, reason being that a binary DFM could be rendered to a form in the Builder/Delphi IDE faster than a text file could. Through the IDE, a developer could view and edit the DFM as a text file, but it was still stored in binary format.

Version 5 of Builder and Delphi now store DFM files as plain text by default, giving you the option of storing DFMs in binary format. Projects convered from version 4 to version 5 continue to store their DFMs in binary format until set differently.

To prevent your forms from being corrupted by CVS, you should either store your DFMs as text or let CVS know that your DFMs are binary files (consult the CVS documentation for these settings).

If your DFM files have already been corrupted, it might be possible to fix them using this tool: FIXDFM.EXE. This tool is unsupported by Borland so don't send any email if you have problems with it. What it does is search your corrupted binary DFM file for the byte pattern 10 13 (linefeed, carriage return) and removes the 10. Keep in mind the possibility that the program will modify cr/lf combos that were in the DFM originally and not added by CVS.

Last Modified: 13-MAR-02