Skip to content

Commit

Permalink
Removed __PHYSFS_convertToDependent(), as dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 15, 2012
1 parent 466f538 commit aaf8868
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 97 deletions.
71 changes: 0 additions & 71 deletions src/physfs.c
Expand Up @@ -1680,77 +1680,6 @@ int PHYSFS_symbolicLinksPermitted(void)
} /* PHYSFS_symbolicLinksPermitted */


/* string manipulation in C makes my ass itch. */
char *__PHYSFS_convertToDependent(const char *prepend,
const char *dirName,
const char *append)
{
const char *dirsep = __PHYSFS_platformDirSeparator;
size_t sepsize = strlen(dirsep);
char *str;
char *i1;
char *i2;
size_t allocSize;

while (*dirName == '/') /* !!! FIXME: pass through sanitize function. */
dirName++;

allocSize = strlen(dirName) + 1;
if (prepend != NULL)
allocSize += strlen(prepend) + sepsize;
if (append != NULL)
allocSize += strlen(append) + sepsize;

/* make sure there's enough space if the dir separator is bigger. */
if (sepsize > 1)
{
str = (char *) dirName;
do
{
str = strchr(str, '/');
if (str != NULL)
{
allocSize += (sepsize - 1);
str++;
} /* if */
} while (str != NULL);
} /* if */

str = (char *) allocator.Malloc(allocSize);
BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, NULL);

if (prepend == NULL)
*str = '\0';
else
{
strcpy(str, prepend);
strcat(str, dirsep);
} /* else */

for (i1 = (char *) dirName, i2 = str + strlen(str); *i1; i1++, i2++)
{
if (*i1 == '/')
{
strcpy(i2, dirsep);
i2 += sepsize;
} /* if */
else
{
*i2 = *i1;
} /* else */
} /* for */
*i2 = '\0';

if (append)
{
strcat(str, dirsep);
strcat(str, append);
} /* if */

return str;
} /* __PHYSFS_convertToDependent */


/*
* Verify that (fname) (in platform-independent notation), in relation
* to (h) is secure. That means that each element of fname is checked
Expand Down
26 changes: 0 additions & 26 deletions src/physfs_internal.h
Expand Up @@ -849,24 +849,6 @@ typedef struct
void __PHYSFS_setError(const char *err);


/*
* Convert (dirName) to platform-dependent notation, then prepend (prepend)
* and append (append) to the converted string.
*
* So, on Win32, calling:
* __PHYSFS_convertToDependent("C:\", "my/files", NULL);
* ...will return the string "C:\my\files".
*
* This is a convenience function; you might want to hack something out that
* is less generic (and therefore more efficient).
*
* Be sure to allocator.Free() the return value when done with it.
*/
char *__PHYSFS_convertToDependent(const char *prepend,
const char *dirName,
const char *append);


/* This byteorder stuff was lifted from SDL. http://www.libsdl.org/ */
#define PHYSFS_LIL_ENDIAN 1234
#define PHYSFS_BIG_ENDIAN 4321
Expand Down Expand Up @@ -1265,14 +1247,6 @@ void *__PHYSFS_platformGetThreadID(void);
* __PHYSFS_platformCvtToDependent("C:\", "my/files", NULL);
* ...will return the string "C:\my\files".
*
* This can be implemented in a platform-specific manner, so you can get
* get a speed boost that the default implementation can't, since
* you can make assumptions about the size of strings, etc..
*
* Platforms that choose not to implement this may just call
* __PHYSFS_convertToDependent() as a passthrough, which may fit the bill
* already.
*
* Be sure to allocator.Free() the return value when done with it.
*/
char *__PHYSFS_platformCvtToDependent(const char *prepend,
Expand Down

0 comments on commit aaf8868

Please sign in to comment.