mirror of
https://github.com/fadden/nulib2.git
synced 2024-11-18 23:05:04 +00:00
Switch to case-insensitive filename comparisons. This only affects the
comparison between an existing record and a new record being added.
This commit is contained in:
parent
fde7b9b18c
commit
fa1222be3d
@ -1,6 +1,7 @@
|
||||
2003/02/18 fadden
|
||||
- Added "original pathname" fields to NuFileDetails and NuErrorStatus.
|
||||
- Changed callback setters to return NuCallback instead of NuError.
|
||||
- Switched to case-sensitive filename comparisons.
|
||||
|
||||
2003/02/08 fadden
|
||||
- Upped version to v2.0.0.
|
||||
|
@ -651,7 +651,11 @@ Nu_CreatePathIFN(NuArchive* pArchive, const char* pathname, char fssep)
|
||||
if (pathEnd - pathStart < 0)
|
||||
goto bail;
|
||||
|
||||
/* (on some filesystems, strncasecmp would be appropriate here) */
|
||||
/*
|
||||
* On some filesystems, strncasecmp would be appropriate here. However,
|
||||
* this is meant solely as an optimization to avoid extra stat() calls,
|
||||
* so we want to use the most restrictive case.
|
||||
*/
|
||||
if (pArchive->lastDirCreated &&
|
||||
strncmp(pathStart, pArchive->lastDirCreated, pathEnd - pathStart +1) == 0)
|
||||
{
|
||||
|
@ -617,7 +617,8 @@ Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet, NuThreadIdx threadIdx,
|
||||
|
||||
|
||||
/*
|
||||
* Compare two filenames pulled out of a record.
|
||||
* Compare two record filenames. This comes into play when looking for
|
||||
* conflicts while adding records to an archive.
|
||||
*
|
||||
* Interesting issues:
|
||||
* - some filesystems are case-sensitive, some aren't
|
||||
@ -626,7 +627,7 @@ Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet, NuThreadIdx threadIdx,
|
||||
* the same thing
|
||||
*
|
||||
* Some of these are out of our control. For now, I'm just doing a
|
||||
* case-sensitive comparison, since the most interesting case for us is
|
||||
* case-insensitive comparison, since the most interesting case for us is
|
||||
* when the person is adding a data fork and a resource fork from the
|
||||
* same file during the same operation.
|
||||
*
|
||||
@ -640,7 +641,11 @@ Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet, NuThreadIdx threadIdx,
|
||||
static int
|
||||
Nu_CompareRecordNames(const char* name1, const char* name2)
|
||||
{
|
||||
#ifdef NU_CASE_SENSITIVE
|
||||
return strcmp(name1, name2);
|
||||
#else
|
||||
return strcasecmp(name1, name2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#define kNumEntries 3 /* how many records are we going to add? */
|
||||
#define kTestEntryBytes "bytes"
|
||||
#define kTestEntryBytesUPPER "BYTES"
|
||||
#define kTestEntryEnglish "English"
|
||||
#define kTestEntryLong "three|is a fairly long filename, complete with" \
|
||||
"punctuation and other nifty/bad stuff"
|
||||
@ -540,7 +541,7 @@ Test_Extract(NuArchive* pArchive)
|
||||
/*
|
||||
* Extract "bytes".
|
||||
*/
|
||||
err = NuGetRecordIdxByName(pArchive, kTestEntryBytes, &recordIdx);
|
||||
err = NuGetRecordIdxByName(pArchive, kTestEntryBytesUPPER, &recordIdx);
|
||||
if (err != kNuErrNone) {
|
||||
fprintf(stderr, "ERROR: couldn't find '%s' (err=%d)\n", kTestEntryBytes,
|
||||
err);
|
||||
|
Loading…
Reference in New Issue
Block a user