OSDN Git Service

(LibGoblin)
authorKoine Yuusuke(koinec) <koinec@users.osdn.me>
Sun, 2 Jun 2019 20:57:14 +0000 (05:57 +0900)
committerKoine Yuusuke(koinec) <koinec@users.osdn.me>
Sun, 2 Jun 2019 20:57:14 +0000 (05:57 +0900)
  * WorkBackup

libgoblin/drd64_libgoblin_srcfile.c
libgoblin/drd64_libgoblin_type.h
libgoblin/test_libgoblin_srcfile.c

index 7184c79..b6742a8 100644 (file)
@@ -144,24 +144,31 @@ LIBGOBLIN_SRCFILE_EXTERN
 LibGoblin_SrcFile      *
        SrcFile_SearchSrcFile(
                        LibGoblin_BinaryFile    *p_bfile,
-                       char    *pstr_filename )
+                       char    *pstr_filepath )
 {
        int             i_cnt;
        int             i_result;
        DWord   dw_hash;
+       char    str_temp[DRD64_MAX_PATH + 1];
+       char    *pstr_filename;
+       char    *pstr_pathname;
        LibGoblin_SrcFile       *p_srcfile;
 
        assert( NULL != p_bfile );
-       assert( NULL != pstr_filename);
+       assert( NULL != pstr_filepath );
 
+       strncpy( str_temp, pstr_filepath, DRD64_MAX_PATH );
+       pstr_filename   = basename( str_temp );
        dw_hash = Common_CalcDJBhash( pstr_filename );
 
+       pstr_pathname   = dirname( str_temp );
+
        for( i_cnt = 0; i_cnt < p_bfile->srcfile.i_max; i_cnt++ )       {
                p_srcfile       = SRCFILE( p_bfile, i_cnt );
 
                if( -0x01 == p_srcfile->i_id )  { continue; }
 
-               if( dw_hash != p_srcfile->dw_hash )     { continue; }
+               if( dw_hash != p_srcfile->dw_hash_filename )    { continue; }
 
                i_result        = strncmp( pstr_filename, p_srcfile->str_filename, DRD64_MAX_PATH );
                if( 0x00 != i_result )  { continue; }
@@ -197,7 +204,7 @@ LibGoblin_SrcFile   *
        assert( NULL != p_srcfile );
 
        strncpy( p_srcfile->str_filename, pstr_filename, DRD64_MAX_PATH );
-       p_srcfile->dw_hash      = Common_CalcDJBhash( pstr_filename );
+       p_srcfile->dw_hash_filename     = Common_CalcDJBhash( pstr_filename );
                                
        return  p_srcfile;
 }
index 5ed19e6..2c0a4ba 100644 (file)
@@ -233,7 +233,8 @@ typedef struct      {
 /*=====================================================================*/
 typedef struct {
        int             i_id;
-       DWord   dw_hash;
+       DWord   dw_hash_filename;
+       DWord   dw_hash_localpath;
        char    str_filename[DRD64_MAX_PATH];
        char    str_localpath[DRD64_MAX_PATH];
        char    str_remotepath[DRD64_MAX_PATH];
index 0b54b22..1a513be 100644 (file)
@@ -104,7 +104,7 @@ void Test_SrcFile_DispenseFree_test00_003( void )
                p_srcfile       = SrcFile_GetSrcFile( p_bfile, i_cnt );
                CU_ASSERT( NULL != p_srcfile );
                CU_ASSERT( i_cnt == p_srcfile->i_id );
-               CU_ASSERT( p_now->dw_hash == p_srcfile->dw_hash );
+               CU_ASSERT( p_now->dw_hash == p_srcfile->dw_hash_filename );
        }
 
        for( i_cnt = 500; i_cnt > 0; i_cnt-- )  {