forked from len0rd/rockbox
removed read_file_into_buffer()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@444 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b48a4fa80a
commit
5a833679dc
2 changed files with 0 additions and 36 deletions
|
|
@ -23,40 +23,6 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
|
||||||
void read_file_into_buffer( char **buf, const char *filename )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FILE *fp;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
/*DEBUG( "read_file_into_buffer( %s, %s )\n", *buf, filename ); */
|
|
||||||
|
|
||||||
fp = fopen( filename, "r" );
|
|
||||||
|
|
||||||
if( fp == NULL )
|
|
||||||
{
|
|
||||||
panicf( "failed to open file: %s\n", filename );
|
|
||||||
}
|
|
||||||
|
|
||||||
while( ( i = getc( fp ) ) != EOF )
|
|
||||||
{
|
|
||||||
/*printf( "%d-'%c'\n", count, i ); */
|
|
||||||
count++;
|
|
||||||
*buf = (char *)realloc( *buf, count * sizeof( char ) );
|
|
||||||
/*printf( "%d='%s'\n", *buf, *buf ); */
|
|
||||||
(*(buf))[count - 1] = (char)i;
|
|
||||||
/*printf( "%d='%s'\n", *buf, *buf );*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add null terminator */
|
|
||||||
|
|
||||||
*buf = (char *)realloc( *buf, count * sizeof( char ) );
|
|
||||||
(*(buf))[ count ] = '\0';
|
|
||||||
|
|
||||||
/* count -2 because of 0 start and \0 terminator
|
|
||||||
printf( "read %d bytes: '%s'\n", count - 2, *buf ); */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stub versions of pre-fat sector storage functions
|
* stub versions of pre-fat sector storage functions
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@
|
||||||
#ifndef __DISK_H__
|
#ifndef __DISK_H__
|
||||||
#define __DISK_H__
|
#define __DISK_H__
|
||||||
|
|
||||||
void read_file_into_buffer( char **buf, const char *filename );
|
|
||||||
|
|
||||||
int persist_volume_setting( void );
|
int persist_volume_setting( void );
|
||||||
int persist_balance_setting( void );
|
int persist_balance_setting( void );
|
||||||
int persist_bass_setting( void );
|
int persist_bass_setting( void );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue