Changeset 34 for trunk/src/sh_files.c
- Timestamp:
- May 19, 2006, 8:09:51 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r27 r34 200 200 201 201 dirstack_t * ptr; 202 char * base;202 char * dir; 203 203 char * file; 204 204 … … 215 215 if (ptr->checked == S_FALSE) 216 216 { 217 base = sh_util_basename (ptr->name);218 file = sh_util_ filename (ptr->name);217 dir = sh_util_dirname (ptr->name); 218 file = sh_util_basename (ptr->name); 219 219 #if defined(WITH_TPT) 220 220 tmp = sh_util_safe_name (ptr->name); … … 231 231 232 232 BREAKEXIT(sh_files_filecheck); 233 status = sh_files_filecheck (ptr->class, base, file,233 status = sh_files_filecheck (ptr->class, dir, file, 234 234 (int *) &(ptr->reported), 0); 235 235 … … 348 348 } 349 349 SH_FREE(file); 350 SH_FREE( base);350 SH_FREE(dir); 351 351 352 352 ptr->checked = S_TRUE; … … 729 729 #endif 730 730 731 int sh_files_push_file_int (int class, const char * str_s, int len)731 int sh_files_push_file_int (int class, const char * str_s, size_t len) 732 732 { 733 733 dirstack_t * new_item_ptr; … … 777 777 static int sh_files_pushfile (int class, const char * str_s) 778 778 { 779 intlen;779 size_t len; 780 780 char * tmp; 781 781 char * p; … … 1132 1132 } 1133 1133 1134 int sh_files_push_dir_int (int class, char * tail, int len, int rdepth)1134 int sh_files_push_dir_int (int class, char * tail, size_t len, int rdepth) 1135 1135 { 1136 1136 zAVLTree * tree; … … 1194 1194 { 1195 1195 char * tmp; 1196 intlen;1196 size_t len; 1197 1197 int rdepth = 0; 1198 1198 char * tail = NULL; … … 1326 1326 SH_FREE(p); 1327 1327 SL_RETURN((0), _("sh_files_pushdir")); 1328 } 1328 } 1329 1329 1330 1330 struct sh_dirent { … … 1354 1354 { 1355 1355 struct sh_dirent * this; 1356 int i;1356 size_t len; 1357 1357 1358 1358 if (thisEntry == NULL) 1359 1359 return dirlist; 1360 1360 1361 i= sl_strlen(thisEntry->d_name);1362 if ( i== 0)1361 len = sl_strlen(thisEntry->d_name); 1362 if (len == 0) 1363 1363 return dirlist; 1364 ++ i;1364 ++len; 1365 1365 1366 1366 this = SH_ALLOC(sizeof(struct sh_dirent)); … … 1368 1368 return dirlist; 1369 1369 1370 this->sh_d_name = SH_ALLOC( i);1371 sl_strlcpy(this->sh_d_name, thisEntry->d_name, i);1370 this->sh_d_name = SH_ALLOC(len); 1371 sl_strlcpy(this->sh_d_name, thisEntry->d_name, len); 1372 1372 1373 1373 this->next = dirlist; … … 1492 1492 1493 1493 int hardlink_num = 0; 1494 1494 #if !defined(HOST_IS_DARWIN) 1495 size_t len; 1496 #endif 1495 1497 1496 1498 SL_ENTER(_("sh_files_checkdir")); … … 1866 1868 if (0 != sh_files_hle_test(hardlink_num-theDir.NumDirs, iname)) 1867 1869 { 1868 tmpcat = SH_ALLOC(strlen(tmpname) + 256); 1869 sl_snprintf(tmpcat, strlen(tmpname) + 256, 1870 len = strlen(tmpname); 1871 if (sl_ok_adds(len, 256)) 1872 len += 256; 1873 tmpcat = SH_ALLOC(len); 1874 sl_snprintf(tmpcat, len, 1870 1875 _("%s: subdirectory count (%d) != hardlinks (%d)"), 1871 1876 tmpname, theDir.NumDirs, hardlink_num); … … 1886 1891 1887 1892 static ShFileType sh_files_filecheck (int class, char * dirName, 1888 char * fileName,1893 char * infileName, 1889 1894 int * reported, 1890 1895 int rsrcflag) … … 1898 1903 char * tmpdir; 1899 1904 char * tmpname; 1905 char * fileName; 1900 1906 struct utimbuf utime_buf; 1901 1907 … … 1905 1911 if (0 == (rand() % 2)) 1906 1912 (void) sh_derr(); 1913 1914 if (dirName && infileName && (dirName[0] == '/') && (dirName[1] == '\0') 1915 && (infileName[0] == '/') && (infileName[1] == '\0')) 1916 { 1917 fileName = NULL; 1918 } 1919 else 1920 { 1921 fileName = infileName; 1922 } 1907 1923 1908 1924 /* fileName may be NULL if this is a directory
Note:
See TracChangeset
for help on using the changeset viewer.