Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | An attempt to factor out the opendir() family of routines and provide portable alternatives, fossil_opendir(). This simplistic first attempt works on non-windows platforms, but the build fails on windows. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | msvc-broken |
| Files: | files | file ages | folders |
| SHA1: |
8d8e529aa9a6295ee138cf510b94b487 |
| User & Date: | drh 2012-08-29 16:51:45.713 |
Context
|
2012-08-29
| ||
| 20:27 | make it link on msvc. Doesn't run yet. check-in: bd43f1c249 user: jan.nijtmans tags: msvc-broken | |
| 16:51 | An attempt to factor out the opendir() family of routines and provide portable alternatives, fossil_opendir(). This simplistic first attempt works on non-windows platforms, but the build fails on windows. check-in: 8d8e529aa9 user: drh tags: msvc-broken | |
| 13:57 | Allow UTF-8 characters in sources. translate.exe will translate it to ASCII check-in: 9f6abc5968 user: jan.nijtmans tags: msvc-broken | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 |
}else{
blob_read_from_file(&onDisk, zName);
}
rc = blob_compare(&onDisk, pContent);
blob_reset(&onDisk);
return rc==0;
}
/**************************************************************************
** The following routines translate between MBCS and UTF8 on windows.
** Since everything is always UTF8 on unix, these routines are no-ops
** there.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 |
}else{
blob_read_from_file(&onDisk, zName);
}
rc = blob_compare(&onDisk, pContent);
blob_reset(&onDisk);
return rc==0;
}
/*
** Portable unicode implementation of opendir()
*/
#if INTERFACE
#if defined(_WIN32)
# include <wdirent.h>
# define FOSSIL_DIR WDIR
# define fossil_dirent wdirent
# define fossil_opendir wopendir
# define fossil_readdir wreaddir
# define fossil_closedir wclosedir
#else
# include <dirent.h>
# define FOSSIL_DIR DIR
# define fossil_dirent dirent
# define fossil_opendir opendir
# define fossil_readdir readdir
# define fossil_closedir closedir
#endif
#endif /* INTERFACE */
/**************************************************************************
** The following routines translate between MBCS and UTF8 on windows.
** Since everything is always UTF8 on unix, these routines are no-ops
** there.
*/
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
16 17 18 19 20 21 22 | ******************************************************************************* ** ** This file contains code used to rebuild the database. */ #include "config.h" #include "rebuild.h" #include <assert.h> | < < < < < < < < < < | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ******************************************************************************* ** ** This file contains code used to rebuild the database. */ #include "config.h" #include "rebuild.h" #include <assert.h> #include <errno.h> /* ** Make changes to the stable part of the schema (the part that is not ** simply deleted and reconstructed on a rebuild) to bring the schema ** up to the latest. */ static const char zSchemaUpdates1[] = @ -- Index on the delta table |
| ︙ | ︙ | |||
825 826 827 828 829 830 831 |
}
/*
** Recursively read all files from the directory zPath and install
** every file read as a new artifact in the repository.
*/
void recon_read_dir(char *zPath){
| | | | | | | | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
}
/*
** Recursively read all files from the directory zPath and install
** every file read as a new artifact in the repository.
*/
void recon_read_dir(char *zPath){
FOSSIL_DIR *d;
struct fossil_dirent *pEntry;
Blob aContent; /* content of the just read artifact */
static int nFileRead = 0;
void *zUnicodePath;
char *zUtf8Name;
zUnicodePath = fossil_utf8_to_unicode(zPath);
d = fossil_opendir(zUnicodePath);
if( d ){
while( (pEntry=fossil_readdir(d))!=0 ){
Blob path;
char *zSubpath;
if( pEntry->d_name[0]=='.' ){
continue;
}
zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
|
| ︙ | ︙ | |||
861 862 863 864 865 866 867 |
content_put(&aContent);
blob_reset(&path);
blob_reset(&aContent);
free(zSubpath);
fossil_print("\r%d", ++nFileRead);
fflush(stdout);
}
| | | | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 |
content_put(&aContent);
blob_reset(&path);
blob_reset(&aContent);
free(zSubpath);
fossil_print("\r%d", ++nFileRead);
fflush(stdout);
}
fossil_closedir(d);
}else {
fossil_panic("encountered error %d while trying to open \"%s\".",
errno, g.argv[3]);
}
fossil_mbcs_free(zUnicodePath);
}
/*
** COMMAND: reconstruct*
**
** Usage: %fossil reconstruct FILENAME DIRECTORY
**
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** Procedures for managing the VFILE table. */ #include "config.h" #include "vfile.h" #include <assert.h> #include <sys/types.h> | < < < < < < < < < < < < < < | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
**
** Procedures for managing the VFILE table.
*/
#include "config.h"
#include "vfile.h"
#include <assert.h>
#include <sys/types.h>
/*
** The input is guaranteed to be a 40-character well-formed UUID.
** Find its rid.
*/
int fast_uuid_to_rid(const char *zUuid){
static Stmt q;
|
| ︙ | ︙ | |||
388 389 390 391 392 393 394 |
** Files whose names begin with "." are omitted unless allFlag is true.
**
** Any files or directories that match the glob pattern pIgnore are
** excluded from the scan. Name matching occurs after the first
** nPrefix characters are elided from the filename.
*/
void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){
| | | | | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
** Files whose names begin with "." are omitted unless allFlag is true.
**
** Any files or directories that match the glob pattern pIgnore are
** excluded from the scan. Name matching occurs after the first
** nPrefix characters are elided from the filename.
*/
void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){
FOSSIL_DIR *d;
int origSize;
const char *zDir;
struct fossil_dirent *pEntry;
int skipAll = 0;
static Stmt ins;
static int depth = 0;
void *zMbcs;
origSize = blob_size(pPath);
if( pIgnore ){
blob_appendf(pPath, "/");
if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
blob_resize(pPath, origSize);
}
if( skipAll ) return;
if( depth==0 ){
db_prepare(&ins,
"INSERT OR IGNORE INTO sfile(x) SELECT :file"
" WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
);
}
depth++;
zDir = blob_str(pPath);
zMbcs = fossil_utf8_to_unicode(zDir);
d = fossil_opendir(zMbcs);
if( d ){
while( (pEntry=fossil_readdir(d))!=0 ){
char *zPath;
char *zUtf8;
if( pEntry->d_name[0]=='.' ){
if( !allFlag ) continue;
if( pEntry->d_name[1]==0 ) continue;
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
}
|
| ︙ | ︙ | |||
442 443 444 445 446 447 448 |
}else if( file_wd_isfile_or_link(zPath) ){
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
db_step(&ins);
db_reset(&ins);
}
blob_resize(pPath, origSize);
}
| | | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
}else if( file_wd_isfile_or_link(zPath) ){
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
db_step(&ins);
db_reset(&ins);
}
blob_resize(pPath, origSize);
}
fossil_closedir(d);
}
fossil_mbcs_free(zMbcs);
depth--;
if( depth==0 ){
db_finalize(&ins);
}
|
| ︙ | ︙ |