mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-19 09:25:12 -04:00
v1.1.4 (#150)
* closes #49 * closes #60 * closes #64 * should address #59 * set default doe ISOs with bot bootmgr and isolinux to syslinux * other improvements
This commit is contained in:
parent
a9c47a4922
commit
7ee5b35551
11 changed files with 233 additions and 149 deletions
|
@ -56,11 +56,43 @@
|
|||
#define CDIO_FSEEK fseek
|
||||
#endif
|
||||
|
||||
/* Windows'd fopen is not UTF-8 compliant - make it so */
|
||||
#if !defined(_WIN32)
|
||||
#define CDIO_FOPEN fopen
|
||||
#else
|
||||
#define CDIO_FOPEN fopenU
|
||||
extern wchar_t* cdio_utf8_to_wchar(const char* str);
|
||||
static inline FILE* fopenU(const char* filename, const char* mode)
|
||||
{
|
||||
FILE* ret = NULL;
|
||||
wchar_t* wfilename = cdio_utf8_to_wchar(filename);
|
||||
wchar_t* wmode = cdio_utf8_to_wchar(mode);
|
||||
ret = _wfopen(wfilename, wmode);
|
||||
free(wfilename);
|
||||
free(wmode);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Use _stati64 if needed, on platforms that don't have transparent LFS support */
|
||||
#if defined(HAVE__STATI64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||
#define CDIO_STAT _stati64
|
||||
#define CDIO_STAT_STRUCT _stati64
|
||||
#if !defined(_WIN32)
|
||||
#define CDIO_STAT_CALL _stati64
|
||||
#else
|
||||
#define CDIO_STAT stat
|
||||
#define CDIO_STAT_CALL _stati64U
|
||||
/* Once more, we have to provide an UTF-8 compliant version on Windows */
|
||||
static inline int _stati64U(const char *path, struct _stati64 *buffer) {
|
||||
int ret;
|
||||
wchar_t* wpath = cdio_utf8_to_wchar(path);
|
||||
ret = _wstati64(wpath, buffer);
|
||||
free(wpath);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define CDIO_STAT_STRUCT stat
|
||||
#define CDIO_STAT_CALL stat
|
||||
#endif
|
||||
|
||||
#define _STRINGIFY(a) #a
|
||||
|
@ -81,8 +113,8 @@ static int
|
|||
_stdio_open (void *user_data)
|
||||
{
|
||||
_UserData *const ud = user_data;
|
||||
|
||||
if ((ud->fd = fopen (ud->pathname, "rb")))
|
||||
|
||||
if ((ud->fd = CDIO_FOPEN (ud->pathname, "rb")))
|
||||
{
|
||||
ud->fd_buf = calloc (1, CDIO_STDIO_BUFSIZE);
|
||||
setvbuf (ud->fd, ud->fd_buf, _IOFBF, CDIO_STDIO_BUFSIZE);
|
||||
|
@ -225,25 +257,18 @@ cdio_stdio_new(const char pathname[])
|
|||
CdioDataSource_t *new_obj = NULL;
|
||||
cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
_UserData *ud = NULL;
|
||||
struct CDIO_STAT statbuf;
|
||||
struct CDIO_STAT_STRUCT statbuf;
|
||||
char* pathdup;
|
||||
|
||||
if (pathname == NULL)
|
||||
return NULL;
|
||||
|
||||
pathdup = strdup(pathname);
|
||||
/* MinGW may require a translated path */
|
||||
pathdup = _cdio_strdup_fixpath(pathname);
|
||||
if (pathdup == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* _stati64 requires using native Windows paths => convert "/c/..." to "c:/..." */
|
||||
if ((strlen(pathdup) > 3) && (pathdup[0] == '/') && (pathdup[2] == '/') && (isalpha(pathdup[1])))
|
||||
{
|
||||
pathdup[0] = pathdup[1];
|
||||
pathdup[1] = ':';
|
||||
}
|
||||
#endif
|
||||
if (CDIO_STAT (pathdup, &statbuf) == -1)
|
||||
if (CDIO_STAT_CALL (pathdup, &statbuf) == -1)
|
||||
{
|
||||
cdio_warn ("could not retrieve file info for `%s': %s",
|
||||
pathdup, strerror (errno));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue