557
558
559
560
561
562
563
|
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
sqlite3_randomness(15, &zBuf[j]);
for(i=0; i<15; i++, j++){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
}while( access(zBuf,0)==0 );
}
/*
** Return true if a file named zName exists and has identical content
** to the blob pContent. If zName does not exist or if the content is
** different in any way, then return false.
*/
int file_is_the_same(Blob *pContent, const char *zName){
i64 iSize;
int rc;
Blob onDisk;
iSize = file_size(zName);
if( iSize<0 ) return 0;
if( iSize!=blob_size(pContent) ) return 0;
blob_read_from_file(&onDisk, zName);
rc = blob_compare(&onDisk, pContent);
blob_reset(&onDisk);
return rc==0;
}
|