Fossil

Check-in [5a6634c4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Back out the changes of [0e2281fc8a757] since they were causing a segfault while trying to enter a new ticket. The ticket [6b498a792c0] should still be fixed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5a6634c453eccfcf08bf5572e164d387b0924eba
User & Date: drh 2010-02-24 22:39:35
Context
2010-02-25
12:58
If a file has been deleted from the filesystem, but not deleted by fossil, then make the "update" command restore that file. Ticket [7c3ca0eae8287] check-in: 63d5a4fe user: drh tags: trunk
2010-02-24
22:39
Back out the changes of [0e2281fc8a757] since they were causing a segfault while trying to enter a new ticket. The ticket [6b498a792c0] should still be fixed. check-in: 5a6634c4 user: drh tags: trunk
04:11
Updates to the file format documentation. check-in: f01ec9db user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/encode.c.

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256



257
258



259
260
261
262
263
264
265
266
267
268
269
270



271
272
273
274
275
276
277
**        nul      ->   \0
**        \        ->   \\
**
** The fossilize() routine does an encoding of its input and
** returns a pointer to the encoding in space obtained from
** malloc.
*/

#ifdef __MINGW32__
int isspace(int c)
{
	return (c==' ' || c=='\n' || c=='\t' || c=='\r' || c=='\f' || c=='\v' ) ;
}
#endif

char *fossilize(const char *zIn, int nIn){
  int n, i, j;
  char c;
  char *zOut;
  if( nIn<0 ) nIn = strlen(zIn);
  for(i=n=0; i<nIn; i++){
    c = zIn[i];

    if( c==0 || isspace(c) || c=='\\' ) n++;
  }
  n += nIn;
  zOut = malloc( n+1 );
  if( zOut ){
	  j = 0;
	  while (*zIn != '\0') {
		c = *zIn;



		if( c=='\\'  || isspace(c)) {
			zOut[j++] = '\\';



			switch( c ){
				case '\\':  c = '\\'; break;
				case '\n':  c = 'n'; break;
				case ' ':   c = 's'; break;
				case '\t':  c = 't'; break;
				case '\r':  c = 'r'; break;
				case '\v':  c = 'v'; break;
				case '\f':  c = 'f'; break;
			}
		}
		zOut[j++] = c;
	  ++zIn;



    }
    zOut[j] = 0;
  }
  return zOut;
}

/*







<
<
<
<
<
<
<
<

|
<




>
|




<
|
|
>
>
>
|
|
>
>
>
|
<
|
|
|
|
|
|
|
<
|
<
>
>
>







227
228
229
230
231
232
233








234
235

236
237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263

264

265
266
267
268
269
270
271
272
273
274
**        nul      ->   \0
**        \        ->   \\
**
** The fossilize() routine does an encoding of its input and
** returns a pointer to the encoding in space obtained from
** malloc.
*/








char *fossilize(const char *zIn, int nIn){
  int n, i, j, c;

  char *zOut;
  if( nIn<0 ) nIn = strlen(zIn);
  for(i=n=0; i<nIn; i++){
    c = zIn[i];
    if( c==0 || c==' ' || c=='\n' || c=='\t' || c=='\r' || c=='\f' || c=='\v'
             || c=='\\' ) n++;
  }
  n += nIn;
  zOut = malloc( n+1 );
  if( zOut ){

    for(i=j=0; i<nIn; i++){
      int c = zIn[i];
      if( c==0 ){
        zOut[j++] = '\\';
        zOut[j++] = '0';
      }else if( c=='\\' ){
        zOut[j++] = '\\';
        zOut[j++] = '\\';
      }else if( isspace(c) ){
        zOut[j++] = '\\';
        switch( c ){

          case '\n':  c = 'n'; break;
          case ' ':   c = 's'; break;
          case '\t':  c = 't'; break;
          case '\r':  c = 'r'; break;
          case '\v':  c = 'v'; break;
          case '\f':  c = 'f'; break;
        }

        zOut[j++] = c;

      }else{
        zOut[j++] = c;
      }
    }
    zOut[j] = 0;
  }
  return zOut;
}

/*