mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 03:03:37 +00:00
* Create a branch for USB experiments.
svn path=/branches/usb-experiments/; revision=72629
This commit is contained in:
parent
28d8ba0d3e
commit
0ee830d7a4
23049 changed files with 0 additions and 1313991 deletions
62
sdk/tools/rsym/rsym_common.c
Normal file
62
sdk/tools/rsym/rsym_common.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* rsym_common.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "rsym.h"
|
||||
|
||||
char*
|
||||
convert_path ( const char* origpath )
|
||||
{
|
||||
char* newpath;
|
||||
int i;
|
||||
|
||||
newpath = strdup(origpath);
|
||||
|
||||
i = 0;
|
||||
while (newpath[i] != 0)
|
||||
{
|
||||
#ifdef UNIX_PATHS
|
||||
if (newpath[i] == '\\')
|
||||
{
|
||||
newpath[i] = '/';
|
||||
}
|
||||
#else
|
||||
#ifdef DOS_PATHS
|
||||
if (newpath[i] == '/')
|
||||
{
|
||||
newpath[i] = '\\';
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
return(newpath);
|
||||
}
|
||||
|
||||
void*
|
||||
load_file ( const char* file_name, size_t* file_size )
|
||||
{
|
||||
FILE* f;
|
||||
void* FileData = NULL;
|
||||
|
||||
f = fopen ( file_name, "rb" );
|
||||
if (f != NULL)
|
||||
{
|
||||
fseek(f, 0L, SEEK_END);
|
||||
*file_size = ftell(f);
|
||||
fseek(f, 0L, SEEK_SET);
|
||||
FileData = malloc(*file_size);
|
||||
if (FileData != NULL)
|
||||
{
|
||||
if ( *file_size != fread(FileData, 1, *file_size, f) )
|
||||
{
|
||||
free(FileData);
|
||||
FileData = NULL;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
return FileData;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue