sansapatcher: move sectorbuf pointer into sansa_t structure.

Similar as the ipod_t structure for ipodpatcher the sansa_t structure holds all
relevant information for sansapatcher. Put the global sansa_sectorbuf pointer
into it as well.

Change-Id: Iad08ef6aafc49609c3d0d556914246f230ee0179
This commit is contained in:
Dominik Riebeling 2012-12-23 23:36:00 +01:00
parent 24e37ddf57
commit 9c1ed84d28
9 changed files with 77 additions and 97 deletions

View file

@ -113,10 +113,10 @@ int sansa_close(struct sansa_t* sansa)
return 0;
}
int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize)
int sansa_alloc_buffer(struct sansa_t *sansa, int bufsize)
{
*sectorbuf=malloc(bufsize);
if (*sectorbuf == NULL) {
sansa->sectorbuf=malloc(bufsize);
if (sansa->sectorbuf == NULL) {
return -1;
}
return 0;
@ -139,9 +139,9 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes)
return read(sansa->dh, buf, nbytes);
}
int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes)
int sansa_write(struct sansa_t* sansa, int nbytes)
{
return write(sansa->dh, buf, nbytes);
return write(sansa->dh, sansa->sectorbuf, nbytes);
}
#endif