Mercurial > hg > audiodb
comparison audioDB.cpp @ 202:7c9feaceeab5
Fix test 0034
Include the key's trailing null character in the string comparison.
author | mas01cr |
---|---|
date | Tue, 27 Nov 2007 18:14:19 +0000 |
parents | 72a037f2b1e4 |
children | 2ea1908707c7 7562a833a951 |
comparison
equal
deleted
inserted
replaced
201:b5087d00b062 | 202:7c9feaceeab5 |
---|---|
625 if(!key) | 625 if(!key) |
626 key=inFile; | 626 key=inFile; |
627 // Linear scan of filenames check for pre-existing feature | 627 // Linear scan of filenames check for pre-existing feature |
628 unsigned alreadyInserted=0; | 628 unsigned alreadyInserted=0; |
629 for(unsigned k=0; k<dbH->numFiles; k++) | 629 for(unsigned k=0; k<dbH->numFiles; k++) |
630 if(strncmp(fileTable + k*O2_FILETABLESIZE, key, strlen(key))==0){ | 630 if(strncmp(fileTable + k*O2_FILETABLESIZE, key, strlen(key)+1)==0){ |
631 alreadyInserted=1; | 631 alreadyInserted=1; |
632 break; | 632 break; |
633 } | 633 } |
634 | 634 |
635 if(alreadyInserted){ | 635 if(alreadyInserted){ |
821 | 821 |
822 // Linear scan of filenames check for pre-existing feature | 822 // Linear scan of filenames check for pre-existing feature |
823 unsigned alreadyInserted=0; | 823 unsigned alreadyInserted=0; |
824 | 824 |
825 for(unsigned k=0; k<dbH->numFiles; k++) | 825 for(unsigned k=0; k<dbH->numFiles; k++) |
826 if(strncmp(fileTable + k*O2_FILETABLESIZE, thisKey, strlen(thisKey))==0){ | 826 if(strncmp(fileTable + k*O2_FILETABLESIZE, thisKey, strlen(thisKey)+1)==0){ |
827 alreadyInserted=1; | 827 alreadyInserted=1; |
828 break; | 828 break; |
829 } | 829 } |
830 | 830 |
831 if(alreadyInserted){ | 831 if(alreadyInserted){ |