(file) Return to tvfs.c CVS log (file) (dir) Up to [RizwankCVS] / group3 / wine / dlls / cabinet / tests

Diff for /group3/wine/dlls/cabinet/tests/tvfs.c between version 1.6 and 1.7

version 1.6, 2005/02/26 04:24:52 version 1.7, 2005/02/27 05:21:08
Line 18 
Line 18 
 #define TVFS_MAIN #define TVFS_MAIN
 */ */
 #include <fcntl.h> #include <fcntl.h>
 #include <stdlib.h>         /* For _MAX_PATH definition */  #include <stdlib.h>
 #include <stdio.h> #include <stdio.h>
 #include <malloc.h> #include <malloc.h>
   /*
 #define DEBUG #define DEBUG
   */
   
 #define SEEK_SET 0 #define SEEK_SET 0
 #define SEEK_CUR 1 #define SEEK_CUR 1
 #define SEEK_END 2 #define SEEK_END 2
Line 140 
Line 139 
         printf("tvfs_free\n");         printf("tvfs_free\n");
         #endif         #endif
  
           nfiles=0;
           nhandles=0;
   
     for (inode=0; inode<nfiles; inode++) {     for (inode=0; inode<nfiles; inode++) {
                         if (!files[inode])                         if (!files[inode])
                                 continue;                                 continue;
Line 150 
Line 152 
 /* Compare given file with given contents, return 0 on equal, else nonzero */ /* Compare given file with given contents, return 0 on equal, else nonzero */
 int tvfs_compare(const char *fname, const char *buf, int len){ int tvfs_compare(const char *fname, const char *buf, int len){
  
     char filebuf[MAXFLEN];          int inode;
   
           #ifdef DEBUG
           printf("tvfs_compare called with %s, %d, %d\n", fname, buf, len);
           #endif
  
       for (inode=0; inode<nfiles; inode++) {       for (inode=0; inode<nfiles; inode++) {
                if (!files[inode])                if (!files[inode])
                        continue;                        continue;
                if (!strcmp(files[inode]->fname, fname))                if (!strcmp(files[inode]->fname, fname))
                                                 break;       }                                                 break;       }
       if (inode == nfiles) {
                  /* File did not exist */
         #ifdef DEBUG         #ifdef DEBUG
         printf("tvfs_compare called with %s, %d, %d\n", fname, buf, len);                  printf("tvfs_compare returning -1 (FAILURE)\n");
         #endif         #endif
           return -1;
       }
  
         return (memcmp(fname,buf,len));          return (memcmp(files[inode]->buf,buf,len));
         /* doesnt check for out of bound */         /* doesnt check for out of bound */
 } }
  
Line 293 
Line 301 
                 printf("File read check failed!\n");                 printf("File read check failed!\n");
  
         printf("Testing direct file compare and lseek of %s\n", name_test_txt);         printf("Testing direct file compare and lseek of %s\n", name_test_txt);
         printf("Seeking to 0 - ");          printf("Seeking to 0 (not needed) - ");
         tvfs_lseek( active_handler, SEEK_SET, 0);         tvfs_lseek( active_handler, SEEK_SET, 0);
         printf("Reading and comparing file\n");          printf("Comparing file\n");
         result = tvfs_read(active_handler, filebuf, size_test_txt);          result = tvfs_compare( name_test_txt , file_test_txt, size_test_txt);
         result = tvfs_compare( filebuf , file_test_txt, size_test_txt);  
         if (result)         if (result)
                 printf ("File compare failed!\n");                 printf ("File compare failed!\n");
  


Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

Rizwan Kassim
Powered by
ViewCVS 0.9.2