Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | merge unicode branch |
|---|---|
| Timelines: | family | ancestors | descendants | both | eclipse-project |
| Files: | files | file ages | folders |
| SHA1: |
b4ea94b488dcf04760a22ec56f1af0a3 |
| User & Date: | jan.nijtmans 2012-08-24 14:50:16.691 |
Context
|
2012-08-26
| ||
| 18:20 | merge trunk into eclipse-project branch, and fix build on UNIX check-in: 64d8e09e20 user: jan.nijtmans tags: eclipse-project | |
|
2012-08-24
| ||
| 14:50 | merge unicode branch check-in: b4ea94b488 user: jan.nijtmans tags: eclipse-project | |
| 13:42 | add mkdir to the unicode-supported functions add chinese-named file and directory in test directory, demonstrating the fix [01a2f3a346] check-in: c780793749 user: jan.nijtmans tags: ticket-01a2f3a346 | |
| 08:16 | Merge in the mingw build enhancements check-in: abbc00fc5b user: jan.nijtmans tags: eclipse-project | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
420 421 422 423 424 425 426 |
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
| | | | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
wchar_t *zMbcs = fossil_utf8_to_unicode(zName);
rc = _wmkdir(zMbcs);
fossil_mbcs_free(zMbcs);
return rc;
#else
return mkdir(zName, 0755);
#endif
}
return 0;
|
| ︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
}
/*
** Translate Unicode to UTF8. Return a pointer to the translated text.
** Call fossil_mbcs_free() to deallocate any memory used to store the
** returned pointer when done.
*/
char *fossil_unicode_to_utf8(const void *zUnicode){
#ifdef _WIN32
int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
char *zUtf = sqlite3_malloc( nByte );
if( zUtf==0 ){
return 0;
}
| > | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
}
/*
** Translate Unicode to UTF8. Return a pointer to the translated text.
** Call fossil_mbcs_free() to deallocate any memory used to store the
** returned pointer when done.
*/
#undef fossil_unicode_to_utf8
char *fossil_unicode_to_utf8(const void *zUnicode){
#ifdef _WIN32
int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
char *zUtf = sqlite3_malloc( nByte );
if( zUtf==0 ){
return 0;
}
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! */ # include "json_detail.h" #endif #ifdef FOSSIL_ENABLE_TCL #include "tcl.h" #endif /* ** Number of elements in an array */ #define count(X) (sizeof(X)/sizeof(X[0])) /* ** Size of a UUID in characters | > > > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! */ # include "json_detail.h" #endif #ifdef FOSSIL_ENABLE_TCL #include "tcl.h" #endif #if !defined(_WIN32) # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 # define wchar_t char # define wmain main #endif /* ** Number of elements in an array */ #define count(X) (sizeof(X)/sizeof(X[0])) /* ** Size of a UUID in characters |
| ︙ | ︙ | |||
350 351 352 353 354 355 356 | char *z; /* General use string pointer */ char **newArgv; /* New expanded g.argv under construction */ char const * zFileName; /* input file name */ FILE * zInFile; /* input FILE */ g.argc = argc; g.argv = argv; | < < < < | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
char *z; /* General use string pointer */
char **newArgv; /* New expanded g.argv under construction */
char const * zFileName; /* input file name */
FILE * zInFile; /* input FILE */
g.argc = argc;
g.argv = argv;
for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
for(i=1; i<g.argc-1; i++){
z = g.argv[i];
if( z[0]!='-' ) continue;
z++;
if( z[0]=='-' ) z++;
if( z[0]==0 ) return; /* Stop searching at "--" */
if( fossil_strcmp(z, "args")==0 ) break;
|
| ︙ | ︙ | |||
412 413 414 415 416 417 418 | g.argc = j; g.argv = newArgv; } /* ** This procedure runs first. */ | < | < < < | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
g.argc = j;
g.argv = newArgv;
}
/*
** This procedure runs first.
*/
int wmain(int argc, wchar_t **argv)
{
const char *zCmdName = "unknown";
int idx;
int rc;
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
memset(&g, 0, sizeof(g));
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | */ #include "config.h" #include "rebuild.h" #include <assert.h> #include <dirent.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 | > > > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | */ #include "config.h" #include "rebuild.h" #include <assert.h> #include <dirent.h> #include <errno.h> #if !defined(_WIN32) # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 # define fossil_utf8_to_unicode fossil_utf8_to_mbcs # define wchar_t char # define _WDIR DIR # define _wdirent dirent # define _wopendir opendir # define _wreaddir readdir # define _wclosedir closedir #endif /* ** 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 |
| ︙ | ︙ | |||
816 817 818 819 820 821 822 |
}
/*
** 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){
| | | | | | | | | | | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
}
/*
** 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){
_WDIR *d;
struct _wdirent *pEntry;
Blob aContent; /* content of the just read artifact */
static int nFileRead = 0;
wchar_t *zMbcsPath;
char *zUtf8Name;
zMbcsPath = fossil_utf8_to_unicode(zPath);
d = _wopendir(zMbcsPath);
if( d ){
while( (pEntry=_wreaddir(d))!=0 ){
Blob path;
char *zSubpath;
if( pEntry->d_name[0]==L'.' ){
continue;
}
zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
fossil_mbcs_free(zUtf8Name);
if( file_isdir(zSubpath)==1 ){
recon_read_dir(zSubpath);
}
blob_init(&path, 0, 0);
blob_appendf(&path, "%s", zSubpath);
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
fossil_panic("some unknown error occurred while reading \"%s\"",
blob_str(&path));
}
content_put(&aContent);
blob_reset(&path);
blob_reset(&aContent);
free(zSubpath);
fossil_print("\r%d", ++nFileRead);
fflush(stdout);
}
_wclosedir(d);
}else {
fossil_panic("encountered error %d while trying to open \"%s\".",
errno, g.argv[3]);
}
fossil_mbcs_free(zMbcsPath);
}
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#include <sys/types.h>
#if defined(__DMC__)
#include "dirent.h"
#else
#include <dirent.h>
#endif
/*
** 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;
int rid;
| > > > > > > > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#include <sys/types.h>
#if defined(__DMC__)
#include "dirent.h"
#else
#include <dirent.h>
#endif
#if !defined(_WIN32)
# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
# define fossil_utf8_to_unicode fossil_utf8_to_mbcs
# define wchar_t char
# define _WDIR DIR
# define _wdirent dirent
# define _wopendir opendir
# define _wreaddir readdir
# define _wclosedir closedir
#endif
/*
** 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;
int rid;
|
| ︙ | ︙ | |||
379 380 381 382 383 384 385 |
** 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){
| | | | | | | | | | | | 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 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
** 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){
_WDIR *d;
int origSize;
const char *zDir;
struct _wdirent *pEntry;
int skipAll = 0;
static Stmt ins;
static int depth = 0;
wchar_t *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 = _wopendir(zMbcs);
if( d ){
while( (pEntry=_wreaddir(d))!=0 ){
char *zPath;
char *zUtf8;
if( pEntry->d_name[0]==L'.' ){
if( !allFlag ) continue;
if( pEntry->d_name[1]==0 ) continue;
if( pEntry->d_name[1]==L'.' && pEntry->d_name[2]==0 ) continue;
}
zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
blob_appendf(pPath, "/%s", zUtf8);
fossil_mbcs_free(zUtf8);
zPath = blob_str(pPath);
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
/* do nothing */
}else if( file_wd_isdir(zPath)==1 ){
if( !vfile_top_of_checkout(zPath) ){
vfile_scan(pPath, nPrefix, allFlag, pIgnore);
}
}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);
}
_wclosedir(d);
}
fossil_mbcs_free(zMbcs);
depth--;
if( depth==0 ){
db_finalize(&ins);
}
|
| ︙ | ︙ |
Added test/世界/界世.txt.
> | 1 | Just some text |