[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cvsgui] can we commit word files in WinCVS with japanese cha racter

From: Jim.Hyslop
Subject: RE: [cvsgui] can we commit word files in WinCVS with japanese cha racter names???
Date: Thu, 20 Nov 2003 11:18:26 -0500

I'd just like to correct a common misunderstanding that's surfacing here:

> This is due
> to the reason that CVS is not made for binary files and puts the
> complete file as a diff,

That is not true, except in the worst-case scenario.

CVS always stores a line-by-line diff of the file, whether it's binary or
not. A line is defined as anything up to the LF character (0x0a). CVS makes
no attempts to interpret the contents of that line, and easily handles
binary "lines".

You can test this yourself. Compile and run this program:
#include <stdio.h>

int main()
  FILE *fp = fopen("test.bin", "wb");
  for (int count=0; count < 65536; ++count )
    if ( ( count & 0x00f ) == 0x00f )
        int ten=0x0a;
        fwrite( &ten, 1, 1, fp );
    } else {
        fwrite( &count, 1, 1, fp );

(Note: this program takes advantage of the little-endian storage for Intel;
if you're on a big-endian system, you will have to modify the program

It will generate a 64K file with a LF character every 16 bytes (and, of
course, an extra one whenever count%255 == 10). Check in the resulting file
with the -kb option, and look at the resulting repository file. In my case,
test.bin,v was 65983 bytes. Now, modify the first byte of the file and check
it in. The file will grow only very slightly - in my case, it grew to 66123
bytes, a difference of only 140 bytes.

In the worst-case scenario, a binary file will contain no 0x0a characters,
or it will consist of effectively random characters, so that a diff is
meaningless, in which case the delta will be quite large. But in a
more-or-less predictable file like an MS Word document, the diffs should not
be as noticeable.

Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. (
Columnist, C/C++ Users Journal (

reply via email to

[Prev in Thread] Current Thread [Next in Thread]