Fossil

Check-in [0e2281fc]
Login

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

Overview
Comment:fixed [6b498a792c]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0e2281fc8a757d9dac7adfa62382184675c87d4c
User & Date: ron 2010-02-16 20:02:20
References
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
2010-02-16
20:03 Fixed ticket [6b498a79]: Cyrillic symbols does not display correctly plus 2 other changes artifact: 7575bd66 user: ron
Context
2010-02-17
16:34
fix typo in isspace() check-in: ef43b995 user: rwilson tags: trunk
2010-02-16
20:02
fixed [6b498a792c] check-in: 0e2281fc user: ron tags: trunk
17:49
Remove surplus ":" from the user-home: line in windows builds. Ticket [eff2cbe5ae11c] check-in: 0ee44737 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
**        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 || isspace(c) || 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;
}

/*







>
>
>
>
>
>
>
>

|
>









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







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=='\r' || 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;
}

/*