File diff r23022:731ae1300799 → r23023:7b8669afd1db
src/fileio.cpp
Show inline comments
 
@@ -344,13 +344,13 @@ char *FioGetFullPath(char *buf, const ch
 
	seprintf(buf, last, "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename);
 
	return buf;
 
}
 

	
 
/**
 
 * Find a path to the filename in one of the search directories.
 
 * @param buf [out] Destination buffer for the path.
 
 * @param[out] buf Destination buffer for the path.
 
 * @param last End of the destination buffer.
 
 * @param subdir Subdirectory to try.
 
 * @param filename Filename to look for.
 
 * @return \a buf containing the path if the path was found, else \c NULL.
 
 */
 
char *FioFindFullPath(char *buf, const char *last, Subdirectory subdir, const char *filename)
 
@@ -435,13 +435,13 @@ static FILE *FioFOpenFileSp(const char *
 
	return f;
 
}
 

	
 
/**
 
 * Opens a file from inside a tar archive.
 
 * @param entry The entry to open.
 
 * @param filesize [out] If not \c NULL, size of the opened file.
 
 * @param[out] filesize If not \c NULL, size of the opened file.
 
 * @return File handle of the opened file, or \c NULL if the file is not available.
 
 * @note The file is read from within the tar file, and may not return \c EOF after reading the whole file.
 
 */
 
FILE *FioFOpenFileTar(TarFileListEntry *entry, size_t *filesize)
 
{
 
	FILE *f = fopen(entry->tar_filename, "rb");
 
@@ -457,13 +457,12 @@ FILE *FioFOpenFileTar(TarFileListEntry *
 
}
 

	
 
/**
 
 * Opens a OpenTTD file somewhere in a personal or global directory.
 
 * @param filename Name of the file to open.
 
 * @param subdir Subdirectory to open.
 
 * @param filename Name of the file to open.
 
 * @return File handle of the opened file, or \c NULL if the file is not available.
 
 */
 
FILE *FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir, size_t *filesize)
 
{
 
	FILE *f = NULL;
 
	Searchpath sp;
 
@@ -629,13 +628,13 @@ static void SimplifyFileName(char *name)
 
	for (char *n = name; *n != '\0'; n++) if (*n == '/') *n = PATHSEPCHAR;
 
#endif
 
}
 

	
 
/**
 
 * Perform the scanning of a particular subdirectory.
 
 * @param subdir The subdirectory to scan.
 
 * @param sd The subdirectory to scan.
 
 * @return The number of found tar files.
 
 */
 
uint TarScanner::DoScan(Subdirectory sd)
 
{
 
	_tar_filelist[sd].clear();
 
	_tar_list[sd].clear();
 
@@ -1300,13 +1299,13 @@ void SanitizeFilename(char *filename)
 
	}
 
}
 

	
 
/**
 
 * Load a file into memory.
 
 * @param filename Name of the file to load.
 
 * @param lenp [out] Length of loaded data.
 
 * @param[out] lenp Length of loaded data.
 
 * @param maxsize Maximum size to load.
 
 * @return Pointer to new memory containing the loaded data, or \c NULL if loading failed.
 
 * @note If \a maxsize less than the length of the file, loading fails.
 
 */
 
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
 
{