Fossil SCM

merge trunk <p>Fix continuation-byte check for UTF-8 chars > 2 bytes.

jan.nijtmans 2012-11-07 12:10 improve_commit_warning merge
Commit 3920fa67bdae08fe6873ef84aac04128881968b1
3 files changed +10 +1 -1 +1 -1
+10
--- src/add.c
+++ src/add.c
@@ -500,10 +500,20 @@
500500
** Rename a single file.
501501
**
502502
** The original name of the file is zOrig. The new filename is zNew.
503503
*/
504504
static void mv_one_file(int vid, const char *zOrig, const char *zNew){
505
+ int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q", zNew);
506
+ if( x>=0 ){
507
+ if( x==0 ){
508
+ fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'"
509
+ " is currently under management", zOrig, zNew, zNew);
510
+ }else{
511
+ fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has "
512
+ "not yet been committed", zOrig, zNew, zNew);
513
+ }
514
+ }
505515
fossil_print("RENAME %s %s\n", zOrig, zNew);
506516
db_multi_exec(
507517
"UPDATE vfile SET pathname='%q' WHERE pathname='%q' AND vid=%d",
508518
zNew, zOrig, vid
509519
);
510520
--- src/add.c
+++ src/add.c
@@ -500,10 +500,20 @@
500 ** Rename a single file.
501 **
502 ** The original name of the file is zOrig. The new filename is zNew.
503 */
504 static void mv_one_file(int vid, const char *zOrig, const char *zNew){
 
 
 
 
 
 
 
 
 
 
505 fossil_print("RENAME %s %s\n", zOrig, zNew);
506 db_multi_exec(
507 "UPDATE vfile SET pathname='%q' WHERE pathname='%q' AND vid=%d",
508 zNew, zOrig, vid
509 );
510
--- src/add.c
+++ src/add.c
@@ -500,10 +500,20 @@
500 ** Rename a single file.
501 **
502 ** The original name of the file is zOrig. The new filename is zNew.
503 */
504 static void mv_one_file(int vid, const char *zOrig, const char *zNew){
505 int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q", zNew);
506 if( x>=0 ){
507 if( x==0 ){
508 fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'"
509 " is currently under management", zOrig, zNew, zNew);
510 }else{
511 fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has "
512 "not yet been committed", zOrig, zNew, zNew);
513 }
514 }
515 fossil_print("RENAME %s %s\n", zOrig, zNew);
516 db_multi_exec(
517 "UPDATE vfile SET pathname='%q' WHERE pathname='%q' AND vid=%d",
518 zNew, zOrig, vid
519 );
520
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190190
if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191191
result |= 4; /* Invalid continuation byte, continue */ \
192192
break; \
193193
}else{ \
194194
/* prepare for checking remaining continuation bytes */ \
195
- c<<=2; --n; ++j; ++z; \
195
+ c<<=1; --n; ++j; ++z; \
196196
} \
197197
}while( c>=0xC0 );
198198
199199
/*
200200
** This function attempts to scan each logical line within the blob to
201201
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190 if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191 result |= 4; /* Invalid continuation byte, continue */ \
192 break; \
193 }else{ \
194 /* prepare for checking remaining continuation bytes */ \
195 c<<=2; --n; ++j; ++z; \
196 } \
197 }while( c>=0xC0 );
198
199 /*
200 ** This function attempts to scan each logical line within the blob to
201
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190 if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191 result |= 4; /* Invalid continuation byte, continue */ \
192 break; \
193 }else{ \
194 /* prepare for checking remaining continuation bytes */ \
195 c<<=1; --n; ++j; ++z; \
196 } \
197 }while( c>=0xC0 );
198
199 /*
200 ** This function attempts to scan each logical line within the blob to
201
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190190
if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191191
result |= 4; /* Invalid continuation byte, continue */ \
192192
break; \
193193
}else{ \
194194
/* prepare for checking remaining continuation bytes */ \
195
- c<<=2; --n; ++j; ++z; \
195
+ c<<=1; --n; ++j; ++z; \
196196
} \
197197
}while( c>=0xC0 );
198198
199199
/*
200200
** This function attempts to scan each logical line within the blob to
201201
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190 if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191 result |= 4; /* Invalid continuation byte, continue */ \
192 break; \
193 }else{ \
194 /* prepare for checking remaining continuation bytes */ \
195 c<<=2; --n; ++j; ++z; \
196 } \
197 }while( c>=0xC0 );
198
199 /*
200 ** This function attempts to scan each logical line within the blob to
201
--- src/diff.c
+++ src/diff.c
@@ -190,11 +190,11 @@
190 if( n<2 || ((z[1]&0xC0)!=0x80) ){ \
191 result |= 4; /* Invalid continuation byte, continue */ \
192 break; \
193 }else{ \
194 /* prepare for checking remaining continuation bytes */ \
195 c<<=1; --n; ++j; ++z; \
196 } \
197 }while( c>=0xC0 );
198
199 /*
200 ** This function attempts to scan each logical line within the blob to
201

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button