Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added fix for issue seen with merge; would fail due to file_copy() issue where files of renamed directories would not have the new directory created beforehand. Also added fix for issue seen after large merge; 'changes' command would fail due to WriteConsoleW() returning with error ERROR_NOT_ENOUGH_MEMORY; fix seems hacky but works. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | jeffrimko-fix-merge-changes |
| Files: | files | file ages | folders |
| SHA1: |
3f31dc65977d999833b85fbe485f1189 |
| User & Date: | jeffrimko 2013-02-25 01:02:46.387 |
| Original User & Date: | Jeff 2013-02-25 01:02:46.387 |
Context
|
2013-02-25
| ||
| 01:02 | Added fix for issue seen with merge; would fail due to file_copy() issue where files of renamed directories would not have the new directory created beforehand. Also added fix for issue seen after large merge; 'changes' command would fail due to WriteConsoleW() returning with error ERROR_NOT_ENOUGH_MEMORY; fix seems hacky but works. Closed-Leaf check-in: 3f31dc6597 user: jeffrimko tags: jeffrimko-fix-merge-changes | |
|
2013-02-23
| ||
| 14:10 | Added /json/status to changelog. check-in: 16642f9c18 user: stephan tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
const char *zTail = z;
while( z[0] ){
if( z[0]=='/' ) zTail = &z[1];
z++;
}
return zTail;
}
/*
** Copy the content of a file from one place to another.
*/
void file_copy(const char *zFrom, const char *zTo){
FILE *in, *out;
int got;
char zBuf[8192];
in = fossil_fopen(zFrom, "rb");
if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
out = fossil_fopen(zTo, "wb");
if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
fwrite(zBuf, 1, got, out);
}
fclose(in);
fclose(out);
| > > > > > > > > > > > > > > > > > > > > > | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
const char *zTail = z;
while( z[0] ){
if( z[0]=='/' ) zTail = &z[1];
z++;
}
return zTail;
}
/*
** Return the head of a file pathname. The head is everything leading up
** to the last component of the path. For example, the head of "/a/b/c.d" is "/a/b".
** The trailing slash is removed.
*/
void file_head(const char *z, char *h){
int i = file_tail(z)-z;
if( !i ){
memmove(h, z, strlen(z));
return;
}
if( '/' == z[i-1] ) i--;
memmove(h, z, i);
h[i] = '\0';
}
/*
** Copy the content of a file from one place to another.
*/
void file_copy(const char *zFrom, const char *zTo){
FILE *in, *out;
int got;
char zBuf[8192];
in = fossil_fopen(zFrom, "rb");
if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
file_head(zTo, zBuf);
if( !file_isdir(zBuf) )
{
file_mkdir(zBuf, 0);
}
out = fossil_fopen(zTo, "wb");
if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
fwrite(zBuf, 1, got, out);
}
fclose(in);
fclose(out);
|
| ︙ | ︙ |
Changes to src/utf8.c.
| ︙ | ︙ | |||
210 211 212 213 214 215 216 |
}
nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
if( nChar==0 ){
free(zUnicode);
return 0;
}
zUnicode[nChar] = '\0';
| | > > > | > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
}
nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
if( nChar==0 ){
free(zUnicode);
return 0;
}
zUnicode[nChar] = '\0';
if( 0==WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr),
zUnicode, nChar, &dummy, 0) ){
/** print UTF8 to console if all else fails */
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr),
zUtf8, nChar, &dummy, 0);
}
return nChar;
#else
return -1; /* No-op on unix */
#endif
}
|