diff options
| author | germeier <germeier> | 2006-01-21 18:33:19 +0000 | 
|---|---|---|
| committer | germeier <germeier> | 2006-01-21 18:33:19 +0000 | 
| commit | 3f961675d28fa73735348646e0091049338e0ae3 (patch) | |
| tree | 4f5c9b4d98a9b8aa53fbf92fa7627dbe1a7c5d20 /libmpio | |
| parent | 7625aa85ab27dcde6003a8e47065c9b2e3c9bb31 (diff) | |
| download | mpiosh-3f961675d28fa73735348646e0091049338e0ae3.tar.gz mpiosh-3f961675d28fa73735348646e0091049338e0ae3.tar.bz2 mpiosh-3f961675d28fa73735348646e0091049338e0ae3.zip  | |
       * changed version to 0.7.1-pre3
       * (hopefully) fixed signedness hell,
          should fix problems with 64 bit machines
Diffstat (limited to 'libmpio')
| -rw-r--r-- | libmpio/defs.h | 49 | ||||
| -rw-r--r-- | libmpio/mpio.h | 24 | ||||
| -rw-r--r-- | libmpio/src/cis.h | 4 | ||||
| -rw-r--r-- | libmpio/src/directory.c | 78 | ||||
| -rw-r--r-- | libmpio/src/directory.h | 22 | ||||
| -rw-r--r-- | libmpio/src/ecc.c | 34 | ||||
| -rw-r--r-- | libmpio/src/ecc.h | 6 | ||||
| -rw-r--r-- | libmpio/src/fat.c | 34 | ||||
| -rw-r--r-- | libmpio/src/id3.c | 34 | ||||
| -rw-r--r-- | libmpio/src/id3.h | 4 | ||||
| -rw-r--r-- | libmpio/src/io.c | 57 | ||||
| -rw-r--r-- | libmpio/src/io.h | 16 | ||||
| -rw-r--r-- | libmpio/src/mmc.c | 21 | ||||
| -rw-r--r-- | libmpio/src/mpio.c | 50 | ||||
| -rw-r--r-- | libmpio/src/smartmedia.c | 6 | ||||
| -rw-r--r-- | libmpio/src/smartmedia.h | 4 | 
16 files changed, 228 insertions, 215 deletions
diff --git a/libmpio/defs.h b/libmpio/defs.h index 645a16c..f534a4e 100644 --- a/libmpio/defs.h +++ b/libmpio/defs.h @@ -1,5 +1,5 @@  /* - * $Id: defs.h,v 1.35 2004/05/30 16:28:51 germeier Exp $ + * $Id: defs.h,v 1.36 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -35,6 +35,7 @@ extern "C" {  #include "usb.h"  typedef unsigned char  BYTE; +typedef char CHAR;  typedef unsigned short WORD;  typedef unsigned int   DWORD; @@ -110,7 +111,7 @@ typedef DWORD mpio_zonetable_t[MPIO_ZONE_MAX][MPIO_ZONE_PBLOCKS];  /* filenames */  #define MPIO_FILENAME_LEN    129 -typedef BYTE mpio_filename_t[MPIO_FILENAME_LEN]; +typedef CHAR mpio_filename_t[MPIO_FILENAME_LEN];  #ifndef NULL  #define NULL             0 @@ -179,26 +180,26 @@ typedef struct {  /* get formatted information, about the MPIO player */  typedef struct { -  BYTE firmware_id[INFO_LINE];   -  BYTE firmware_version[INFO_LINE]; -  BYTE firmware_date[INFO_LINE]; +  CHAR firmware_id[INFO_LINE];   +  CHAR firmware_version[INFO_LINE]; +  CHAR firmware_date[INFO_LINE]; -  BYTE model[INFO_LINE]; +  CHAR model[INFO_LINE]; -  BYTE mem_internal[INFO_LINE]; -  BYTE mem_external[INFO_LINE]; +  CHAR mem_internal[INFO_LINE]; +  CHAR mem_external[INFO_LINE];  } mpio_info_t;  /* view of the MPIO firmware */  typedef struct {    /* everything we get from GET_VERSION */ -  BYTE id[12]; -  BYTE major[3]; -  BYTE minor[3]; -  BYTE year[5]; -  BYTE month[3]; -  BYTE day[3];   +  CHAR id[12]; +  CHAR major[3]; +  CHAR minor[3]; +  CHAR year[5]; +  CHAR month[3]; +  CHAR day[3];    } mpio_firmware_t;  /* */ @@ -212,7 +213,7 @@ typedef struct {  /* */  struct mpio_directory_tx { -  BYTE name[INFO_LINE]; +  CHAR name[INFO_LINE];    BYTE dir[MEGABLOCK_SIZE];    BYTE *dentry; @@ -294,7 +295,7 @@ typedef struct {  /* view of the MPIO-* */  typedef struct { -  BYTE version[CMD_SIZE]; +  CHAR version[CMD_SIZE];    int fd;    int use_libusb; @@ -303,11 +304,11 @@ typedef struct {    struct usb_dev_handle *usb_handle;    int usb_out_ep;    int usb_in_ep; -  BYTE *charset;                   /* charset used for filename conversion */ +  CHAR *charset;                   /* charset used for filename conversion */    BYTE id3;                        /* enable/disable ID3 rewriting support */ -  BYTE id3_format[INFO_LINE]; -  BYTE id3_temp[INFO_LINE]; +  CHAR id3_format[INFO_LINE]; +  CHAR id3_temp[INFO_LINE];    mpio_firmware_t firmware;   @@ -342,8 +343,8 @@ typedef struct {   */  typedef struct  { // Short 8.3 names  -  unsigned char name[8];          // file name  -  unsigned char ext[3];           // file extension  +  char name[8];          // file name  +  char ext[3];           // file extension     unsigned char attr;             // attribute byte     unsigned char lcase;		  // Case for base and extension    unsigned char ctime_ms;         // Creation time, milliseconds @@ -359,13 +360,13 @@ typedef struct  { // Short 8.3 names  typedef struct  { // Up to 13 characters of a long name     unsigned char id;               // sequence number for slot  -  unsigned char name0_4[10];      // first 5 characters in name  +  char name0_4[10];      // first 5 characters in name     unsigned char attr;             // attribute byte    unsigned char reserved;         // always 0     unsigned char alias_checksum;   // checksum for 8.3 alias  -  unsigned char name5_10[12];     // 6 more characters in name +  char name5_10[12];     // 6 more characters in name    unsigned char start[2];         // starting cluster number -  unsigned char name11_12[4];     // last 2 characters in name +  char name11_12[4];     // last 2 characters in name  } mpio_dir_slot_t;  #ifdef __cplusplus diff --git a/libmpio/mpio.h b/libmpio/mpio.h index cb342c7..8c20c86 100644 --- a/libmpio/mpio.h +++ b/libmpio/mpio.h @@ -1,5 +1,5 @@  /* - * $Id: mpio.h,v 1.23 2003/10/19 21:06:34 germeier Exp $ + * $Id: mpio.h,v 1.24 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -59,7 +59,7 @@ void	mpio_get_info(mpio_t *, mpio_info_t *);  /* get model */  mpio_model_t	mpio_get_model(mpio_t *);  /* retrieves free memory in bytes */ -int	mpio_memory_free(mpio_t *, mpio_mem_t, int *free); +int	mpio_memory_free(mpio_t *, mpio_mem_t, DWORD *free);  /* report sectors in block for this memory */  int     mpio_block_get_sectors(mpio_t *, mpio_mem_t); @@ -69,8 +69,8 @@ int     mpio_block_get_blocksize(mpio_t *, mpio_mem_t);  /*   * charset for filename encoding/converting   */ -BYTE  *mpio_charset_get(mpio_t *); -BYTE   mpio_charset_set(mpio_t *, BYTE *); +CHAR  *mpio_charset_get(mpio_t *); +BYTE   mpio_charset_set(mpio_t *, CHAR *);  /*    * directory operations  @@ -79,15 +79,15 @@ BYTE   mpio_charset_set(mpio_t *, BYTE *);  /* context, memory bank */  BYTE*	mpio_directory_open(mpio_t *, mpio_mem_t);  /* context, memory bank, directory name */ -int     mpio_directory_make(mpio_t *, mpio_mem_t, BYTE *); +int     mpio_directory_make(mpio_t *, mpio_mem_t, CHAR *);  /* context, memory bank, directory name */ -int     mpio_directory_cd(mpio_t *, mpio_mem_t, BYTE *); +int     mpio_directory_cd(mpio_t *, mpio_mem_t, CHAR *);  /* context, memory bank, directory name buffer space */ -void    mpio_directory_pwd(mpio_t *, mpio_mem_t, BYTE pwd[INFO_LINE]);   +void    mpio_directory_pwd(mpio_t *, mpio_mem_t, CHAR pwd[INFO_LINE]);    /* context, dir context */  BYTE*	mpio_dentry_next(mpio_t *, mpio_mem_t, BYTE *);  /* context, dir context */ -int	mpio_dentry_get(mpio_t *, mpio_mem_t, BYTE *, BYTE *, int,WORD *, +int	mpio_dentry_get(mpio_t *, mpio_mem_t, BYTE *, CHAR *, int,WORD *,  			BYTE *, BYTE *, BYTE *, BYTE *, DWORD *, BYTE *);  /*  @@ -121,13 +121,13 @@ int	mpio_file_del(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_callback_t);  /* via the "BYTE **"                                               */  int	mpio_file_get_to_memory(mpio_t *, mpio_mem_t, mpio_filename_t,  -				mpio_callback_t, BYTE **);  +				mpio_callback_t, CHAR **);   /* context, memory bank, filename, filetype, callback ... */  /* ... memory pointer, size of file                       */  int	mpio_file_put_from_memory(mpio_t *, mpio_mem_t, mpio_filename_t,   				  mpio_filetype_t, mpio_callback_t, -				  BYTE *, int); +				  CHAR *, int);  /* check if file exists on selected memory */  /* return pointer to file dentry if file exists */ @@ -179,9 +179,9 @@ BYTE   mpio_id3_set(mpio_t *, BYTE);  BYTE   mpio_id3_get(mpio_t *);  /* set format string for rewriting*/ -void   mpio_id3_format_set(mpio_t *, BYTE *); +void   mpio_id3_format_set(mpio_t *, CHAR *);  /* get format string for rewriting*/ -void   mpio_id3_format_get(mpio_t *, BYTE *); +void   mpio_id3_format_get(mpio_t *, CHAR *);  /*   * "special" functions diff --git a/libmpio/src/cis.h b/libmpio/src/cis.h index 655270a..1429e4c 100644 --- a/libmpio/src/cis.h +++ b/libmpio/src/cis.h @@ -1,5 +1,5 @@  /* - * $Id: cis.h,v 1.3 2003/04/27 12:08:21 germeier Exp $ + * $Id: cis.h,v 1.4 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -23,6 +23,8 @@  #ifndef _MPIO_CIS_H_  #define _MPIO_CIS_H_ +#include "string.h" +  #include "defs.h"  #ifdef __cplusplus diff --git a/libmpio/src/directory.c b/libmpio/src/directory.c index 4827ae3..1500a8e 100644 --- a/libmpio/src/directory.c +++ b/libmpio/src/directory.c @@ -1,5 +1,5 @@  /* - * $Id: directory.c,v 1.13 2004/04/23 19:21:07 germeier Exp $ + * $Id: directory.c,v 1.14 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -69,14 +69,14 @@ int date_dos2unix(unsigned short time,unsigned short date)  /*   * charset for filename encoding/converting   */ -BYTE * +CHAR *  mpio_charset_get(mpio_t *m)  {    return strdup(m->charset);  }  BYTE    -mpio_charset_set(mpio_t *m, BYTE *charset) +mpio_charset_set(mpio_t *m, CHAR *charset)  {    iconv_t ic;    int     r = 1; @@ -131,7 +131,7 @@ mpio_directory_init(mpio_t *m, mpio_mem_t mem, mpio_directory_t *dir,    dentry->start[1] = parent / 0x100;    dentry->attr = 0x10; -  hexdumpn(2, dir->dir, 64); +  hexdumpn(2, (CHAR *)dir->dir, 64);    return 0;  } @@ -152,7 +152,7 @@ mpio_directory_read(mpio_t *m, mpio_mem_t mem, mpio_directory_t *dir)    mpio_io_block_read(m, mem, f, dir->dir); -  hexdumpn(5, dir->dir, DIR_SIZE);	 +  hexdumpn(5, (CHAR *)dir->dir, DIR_SIZE);	    return 0;  } @@ -176,7 +176,7 @@ mpio_directory_is_empty(mpio_t *m, mpio_mem_t mem, mpio_directory_t *dir)    /* check for a single recursive entry */    p = dir->dir + 0x40;    size = mpio_dentry_get_size(m, mem, p); -  hexdumpn(2, p, size); +  hexdumpn(2, (CHAR *)p, size);    if ((p[size-0x20+0x0b] == 0x1a) &&        (p[size] == 0x00))      return MPIO_OK; @@ -210,7 +210,7 @@ mpio_directory_write(mpio_t *m, mpio_mem_t mem, mpio_directory_t *dir)        /* set type to directory */        f->i_fat[0x06] = FTYPE_ENTRY; -      hexdumpn(2, f->i_fat, 16); +      hexdumpn(2, (CHAR *)f->i_fat, 16);      }    mpio_io_block_delete(m, mem, f); @@ -248,7 +248,7 @@ mpio_directory_open(mpio_t *m, mpio_mem_t mem)  }  int      -mpio_directory_make(mpio_t *m, mpio_mem_t mem, BYTE *dir) +mpio_directory_make(mpio_t *m, mpio_mem_t mem, CHAR *dir)  {    mpio_smartmedia_t *sm;    mpio_directory_t *new; @@ -302,7 +302,7 @@ mpio_directory_make(mpio_t *m, mpio_mem_t mem, BYTE *dir)        /* only one block needed for directory */        f->i_fat[0x02]=0;        f->i_fat[0x03]=1; -      hexdumpn(2, f->i_fat, 16); +      hexdumpn(2, (CHAR *)f->i_fat, 16);      }    if (sm->cdir == sm->root)  @@ -350,7 +350,7 @@ mpio_directory_make(mpio_t *m, mpio_mem_t mem, BYTE *dir)  }  int      -mpio_directory_cd(mpio_t *m, mpio_mem_t mem, BYTE *dir) +mpio_directory_cd(mpio_t *m, mpio_mem_t mem, CHAR *dir)  {    mpio_smartmedia_t *sm;    mpio_fatentry_t *f1; @@ -358,11 +358,11 @@ mpio_directory_cd(mpio_t *m, mpio_mem_t mem, BYTE *dir)    BYTE *p;    BYTE ret;    BYTE month, day, hour, minute, type; -  BYTE fname[100]; +  CHAR fname[100];    WORD year;      DWORD fsize;    int size; -  BYTE pwd[INFO_LINE]; +  CHAR pwd[INFO_LINE];    mpio_directory_t *old, *new;    if (strcmp(dir, ".")==0) @@ -451,7 +451,7 @@ mpio_directory_cd(mpio_t *m, mpio_mem_t mem, BYTE *dir)  void     -mpio_directory_pwd(mpio_t *m, mpio_mem_t mem, BYTE pwd[INFO_LINE]) +mpio_directory_pwd(mpio_t *m, mpio_mem_t mem, CHAR pwd[INFO_LINE])  {    mpio_smartmedia_t *sm;      mpio_directory_t  *d; @@ -478,17 +478,17 @@ mpio_directory_pwd(mpio_t *m, mpio_mem_t mem, BYTE pwd[INFO_LINE])  mpio_dir_entry_t *  mpio_dentry_filename_write(mpio_t *m, mpio_mem_t mem, BYTE *p,  -			   BYTE *filename, int filename_size) +			   CHAR *filename, int filename_size)  { -  BYTE *unicode = 0; -  BYTE *back, *fback; -  BYTE *fname = 0; +  CHAR *unicode = 0; +  CHAR *back, *fback; +  CHAR *fname = 0;    iconv_t ic;    int in = 0, out = 0; -  int fin = 0, fout = 0; +  size_t fin = 0, fout = 0;    int count = 0;    BYTE index; -  BYTE f_8_3[13]; +  CHAR f_8_3[13];    BYTE alias_check;    mpio_dir_slot_t  *slot;    mpio_dir_entry_t *dentry; @@ -697,7 +697,7 @@ mpio_dentry_get_raw(mpio_t *m, mpio_mem_t mem, BYTE *dentry,  }  void -mpio_dentry_copy_from_slot(BYTE *buffer, mpio_dir_slot_t *slot) +mpio_dentry_copy_from_slot(CHAR *buffer, mpio_dir_slot_t *slot)  {    memcpy(buffer, slot->name0_4, 10);    memcpy(buffer + 10, slot->name5_10, 12); @@ -705,7 +705,7 @@ mpio_dentry_copy_from_slot(BYTE *buffer, mpio_dir_slot_t *slot)  }  void -mpio_dentry_copy_to_slot(BYTE *buffer, mpio_dir_slot_t *slot) +mpio_dentry_copy_to_slot(CHAR *buffer, mpio_dir_slot_t *slot)  {    memcpy(slot->name0_4, buffer, 10);    memcpy(slot->name5_10, buffer + 10, 12); @@ -714,11 +714,11 @@ mpio_dentry_copy_to_slot(BYTE *buffer, mpio_dir_slot_t *slot)  int  mpio_dentry_get(mpio_t *m, mpio_mem_t mem, BYTE *buffer,                    -		BYTE *filename, int filename_size, +		CHAR *filename, int filename_size,  		WORD *year, BYTE *month, BYTE *day,  		BYTE *hour, BYTE *minute, DWORD *fsize, BYTE *type)  { -  BYTE filename_8_3[13]; +  CHAR filename_8_3[13];    return mpio_dentry_get_real(m, mem, buffer, filename, filename_size,   			      filename_8_3, @@ -728,8 +728,8 @@ mpio_dentry_get(mpio_t *m, mpio_mem_t mem, BYTE *buffer,  /* TODO: please clean me up !!! */  int  mpio_dentry_get_real(mpio_t *m, mpio_mem_t mem, BYTE *buffer,                    -		     BYTE *filename, int filename_size, -		     BYTE *filename_8_3, +		     CHAR *filename, int filename_size, +		     CHAR *filename_8_3,  		     WORD *year, BYTE *month, BYTE *day,  		     BYTE *hour, BYTE *minute, DWORD *fsize,  		     BYTE *type) @@ -738,13 +738,13 @@ mpio_dentry_get_real(mpio_t *m, mpio_mem_t mem, BYTE *buffer,    int vfat = 0;      int num_slots = 0;      int slots = 0; -  int in = 0, out = 0, iconv_return; +  size_t in = 0, out = 0, iconv_return;    mpio_dir_entry_t *dentry;    mpio_fatentry_t  *f;    mpio_dir_slot_t  *slot; -  BYTE *unicode = 0; -  BYTE *uc; -  BYTE *fname = 0; +  CHAR *unicode = 0; +  CHAR *uc; +  CHAR *fname = 0;    iconv_t ic;    int dsize, i; @@ -760,7 +760,7 @@ mpio_dentry_get_real(mpio_t *m, mpio_mem_t mem, BYTE *buffer,      {        dsize = mpio_dentry_get_size(m, mem, buffer);        debugn(3, "dentry size is: 0x%02x\n", dsize); -      hexdump(buffer, dsize); +      hexdump((CHAR *)buffer, dsize);        num_slots = (dsize / 0x20) - 1;        slots = num_slots - 1;        dentry++; @@ -876,7 +876,7 @@ mpio_rootdir_read (mpio_t *m, mpio_mem_t mem)  {    mpio_smartmedia_t *sm;      mpio_fatentry_t   *f; -  BYTE recvbuff[SECTOR_SIZE]; +  CHAR recvbuff[SECTOR_SIZE];    int i;    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal; @@ -1060,7 +1060,7 @@ mpio_dentry_get_startcluster(mpio_t *m, mpio_mem_t mem, BYTE *p)  int  mpio_dentry_put(mpio_t *m, mpio_mem_t mem, -		BYTE *filename, int filename_size, +		CHAR *filename, int filename_size,  		time_t date, DWORD fsize, WORD ssector, BYTE attr)  {    BYTE *p; @@ -1121,13 +1121,13 @@ mpio_dentry_put(mpio_t *m, mpio_mem_t mem,  }  BYTE * -mpio_dentry_find_name_8_3(mpio_t *m, BYTE mem, BYTE *filename) +mpio_dentry_find_name_8_3(mpio_t *m, BYTE mem, CHAR *filename)  {    BYTE *p;    BYTE bdummy;    WORD wdummy; -  BYTE fname[129]; -  BYTE fname_8_3[13]; +  CHAR fname[129]; +  CHAR fname_8_3[13];    DWORD ddummy;    BYTE *found = 0; @@ -1151,12 +1151,12 @@ mpio_dentry_find_name_8_3(mpio_t *m, BYTE mem, BYTE *filename)  }  BYTE * -mpio_dentry_find_name(mpio_t *m, BYTE mem, BYTE *filename) +mpio_dentry_find_name(mpio_t *m, BYTE mem, CHAR *filename)  {    BYTE *p;    BYTE bdummy;    WORD wdummy; -  BYTE fname[129]; +  CHAR fname[129];    DWORD ddummy;    BYTE *found = 0; @@ -1179,7 +1179,7 @@ mpio_dentry_find_name(mpio_t *m, BYTE mem, BYTE *filename)  int	 -mpio_dentry_delete(mpio_t *m, BYTE mem, BYTE *filename) +mpio_dentry_delete(mpio_t *m, BYTE mem, CHAR *filename)  {    mpio_smartmedia_t *sm;    BYTE *start; @@ -1367,7 +1367,7 @@ mpio_dentry_switch(mpio_t *m, mpio_mem_t mem, BYTE *file1, BYTE *file2)  }  void     -mpio_dentry_rename(mpio_t *m, mpio_mem_t mem, BYTE *p, BYTE *newfilename) +mpio_dentry_rename(mpio_t *m, mpio_mem_t mem, BYTE *p, CHAR *newfilename)  {    mpio_smartmedia_t *sm;    BYTE *current; diff --git a/libmpio/src/directory.h b/libmpio/src/directory.h index fd46bd6..1f69c19 100644 --- a/libmpio/src/directory.h +++ b/libmpio/src/directory.h @@ -1,5 +1,5 @@  /* - * $Id: directory.h,v 1.4 2003/10/19 21:06:35 germeier Exp $ + * $Id: directory.h,v 1.5 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -45,11 +45,11 @@ BYTE    mpio_directory_is_empty(mpio_t *, mpio_mem_t, mpio_directory_t *);  /* operations on a single directory entry */  int	mpio_dentry_get_size(mpio_t *, mpio_mem_t, BYTE *);  int	mpio_dentry_get_raw(mpio_t *, mpio_mem_t, BYTE *, BYTE *, int); -int	mpio_dentry_put(mpio_t *, mpio_mem_t, BYTE *, int, +int	mpio_dentry_put(mpio_t *, mpio_mem_t, CHAR *, int,  			time_t, DWORD, WORD, BYTE); -BYTE *	mpio_dentry_find_name_8_3(mpio_t *, BYTE, BYTE *); -BYTE *	mpio_dentry_find_name(mpio_t *, BYTE, BYTE *); -int	mpio_dentry_delete(mpio_t *, BYTE, BYTE *); +BYTE *	mpio_dentry_find_name_8_3(mpio_t *, BYTE, CHAR *); +BYTE *	mpio_dentry_find_name(mpio_t *, BYTE, CHAR *); +int	mpio_dentry_delete(mpio_t *, BYTE, CHAR *);  int     mpio_dentry_get_filesize(mpio_t *, mpio_mem_t, BYTE *);  BYTE    mpio_dentry_get_attrib(mpio_t *, mpio_mem_t, BYTE *);  long    mpio_dentry_get_time(mpio_t *, mpio_mem_t, BYTE *); @@ -60,7 +60,7 @@ BYTE    mpio_dentry_is_dir(mpio_t *, mpio_mem_t, BYTE *);  void    mpio_dentry_switch(mpio_t *, mpio_mem_t, BYTE *, BYTE *);  /* rename a dentry */ -void    mpio_dentry_rename(mpio_t *, mpio_mem_t, BYTE *, BYTE *); +void    mpio_dentry_rename(mpio_t *, mpio_mem_t, BYTE *, CHAR *);  /* Move a given file to a new position in the file     list	relative to another file.	 @@ -68,14 +68,14 @@ void    mpio_dentry_rename(mpio_t *, mpio_mem_t, BYTE *, BYTE *);  void	mpio_dentry_move(mpio_t *,mpio_mem_t, BYTE *, BYTE *);  /* helper functions */ -void    mpio_dentry_copy_from_slot(BYTE *, mpio_dir_slot_t *); -void    mpio_dentry_copy_to_slot(BYTE *, mpio_dir_slot_t *); -int	mpio_dentry_get_real(mpio_t *, mpio_mem_t, BYTE *, BYTE *,  -			     int, BYTE[12], +void    mpio_dentry_copy_from_slot(CHAR *, mpio_dir_slot_t *); +void    mpio_dentry_copy_to_slot(CHAR *, mpio_dir_slot_t *); +int	mpio_dentry_get_real(mpio_t *, mpio_mem_t, BYTE *, CHAR *,  +			     int, CHAR[12],  			     WORD *, BYTE *, BYTE *, BYTE *, BYTE *, DWORD *,  			     BYTE *);  mpio_dir_entry_t * -  mpio_dentry_filename_write(mpio_t *, mpio_mem_t, BYTE *, BYTE *, int); +  mpio_dentry_filename_write(mpio_t *, mpio_mem_t, BYTE *, CHAR *, int);  #ifdef __cplusplus  } diff --git a/libmpio/src/ecc.c b/libmpio/src/ecc.c index 0b315b4..aeee8ff 100644 --- a/libmpio/src/ecc.c +++ b/libmpio/src/ecc.c @@ -1,5 +1,5 @@  /* - * $Id: ecc.c,v 1.6 2003/06/12 08:32:33 germeier Exp $ + * $Id: ecc.c,v 1.7 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -31,21 +31,21 @@  #define ADD_BITS(c, d1, d2, v) if ((c)) d1 ^= (v); else d2 ^= (v)  int  -mpio_ecc_256_gen(BYTE *data, BYTE *ecc) +mpio_ecc_256_gen(CHAR *data, CHAR *ecc)  { -  BYTE p1, p1_; -  BYTE p2, p2_; -  BYTE p4, p4_; +  CHAR p1, p1_; +  CHAR p2, p2_; +  CHAR p4, p4_; -  BYTE p08, p08_; -  BYTE p16, p16_; -  BYTE p32, p32_; -  BYTE p64, p64_; +  CHAR p08, p08_; +  CHAR p16, p16_; +  CHAR p32, p32_; +  CHAR p64, p64_; -  BYTE p0128, p0128_; -  BYTE p0256, p0256_; -  BYTE p0512, p0512_; -  BYTE p1024, p1024_; +  CHAR p0128, p0128_; +  CHAR p0256, p0256_; +  CHAR p0512, p0512_; +  CHAR p1024, p1024_;    int i, j; @@ -128,11 +128,11 @@ mpio_ecc_256_gen(BYTE *data, BYTE *ecc)  int -mpio_ecc_256_check(BYTE *data, BYTE *ecc) +mpio_ecc_256_check(CHAR *data, CHAR *ecc)  { -  BYTE own_ecc[3]; -  BYTE check[3]; -  BYTE line, col; +  CHAR own_ecc[3]; +  CHAR check[3]; +  CHAR line, col;    int v, i; diff --git a/libmpio/src/ecc.h b/libmpio/src/ecc.h index 89e342e..7f1d2c3 100644 --- a/libmpio/src/ecc.h +++ b/libmpio/src/ecc.h @@ -1,5 +1,5 @@  /* - * $Id: ecc.h,v 1.2 2003/04/27 12:08:21 germeier Exp $ + * $Id: ecc.h,v 1.3 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -30,9 +30,9 @@ extern "C" {  #endif  /* 256 Bytes Data, 3 Byte ECC to generate */ -int	mpio_ecc_256_gen(BYTE *, BYTE *); +int	mpio_ecc_256_gen(CHAR *, CHAR *);  /* 256 Bytes Data, 3 Bytes ECC to check and possibly correct */ -int	mpio_ecc_256_check(BYTE *, BYTE*); +int	mpio_ecc_256_check(CHAR *, CHAR*);  #ifdef __cplusplus  } diff --git a/libmpio/src/fat.c b/libmpio/src/fat.c index aab6b83..b024d78 100644 --- a/libmpio/src/fat.c +++ b/libmpio/src/fat.c @@ -1,5 +1,5 @@  /* - * $Id: fat.c,v 1.6 2004/05/30 16:28:52 germeier Exp $ + * $Id: fat.c,v 1.7 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -146,9 +146,9 @@ mpio_pbr_gen(BYTE size)    /* FAT id */    if (size >=128) { -    strcpy(p+0x36, "FAT16"); +    strcpy((CHAR *)(p+0x36), "FAT16");    } else { -    strcpy(p+0x36, "FAT12"); +    strcpy((CHAR *)(p+0x36), "FAT12");    }    return p; @@ -195,7 +195,7 @@ mpio_pbr_eval(mpio_smartmedia_t *sm)        return 1;      } -  if (strncmp((sm->pbr+0x36),"FAT", 3) != 0)  +  if (strncmp((CHAR *)(sm->pbr+0x36),"FAT", 3) != 0)       {        debug("Did not find an FAT signature, *not* good!\n");        return 2; @@ -322,7 +322,7 @@ mpio_bootblocks_read (mpio_t *m, mpio_mem_t mem)    /* TODO: check a few things more, just to be sure */    /* read CIS (just in case it might me usefull) */ -  if (mpio_io_sector_read(m, mem, MPIO_BLOCK_CIS, sm->cis))  +  if (mpio_io_sector_read(m, mem, MPIO_BLOCK_CIS, (CHAR *)sm->cis))       {        debug("error reading CIS\n");            return 1; @@ -330,7 +330,7 @@ mpio_bootblocks_read (mpio_t *m, mpio_mem_t mem)    /* read MBR */    /* the MBR is always located @ logical block 0, sector 0! */ -  if (mpio_io_sector_read(m, mem, 0, sm->mbr))  +  if (mpio_io_sector_read(m, mem, 0, (CHAR *)sm->mbr))       {        debug("error reading MBR\n");            return 1; @@ -344,7 +344,7 @@ mpio_bootblocks_read (mpio_t *m, mpio_mem_t mem)      }    /* read PBR */ -  if (mpio_io_sector_read(m, mem, sm->pbr_offset, sm->pbr)) +  if (mpio_io_sector_read(m, mem, sm->pbr_offset, (CHAR *)sm->pbr))      {        debug("error reading PBR\n");            return 1; @@ -428,13 +428,13 @@ mpio_fat_read (mpio_t *m, mpio_mem_t mem,  	       mpio_callback_init_t progress_callback)  {    mpio_smartmedia_t *sm; -  BYTE recvbuff[SECTOR_SIZE]; +  CHAR recvbuff[SECTOR_SIZE];    DWORD i;    if (mem == MPIO_INTERNAL_MEM)       {            sm = &m->internal; -      if (mpio_io_spare_read(m, mem, 0, sm->size, 0, sm->fat, +      if (mpio_io_spare_read(m, mem, 0, sm->size, 0, (CHAR *)sm->fat,  			     (sm->fat_size * SECTOR_SIZE), progress_callback))  	return 1;        return 0; @@ -843,10 +843,10 @@ mpio_fat_write(mpio_t *m, mpio_mem_t mem)  	      if (i<DIR_NUM)   		{  		  mpio_io_sector_write(m, mem, i,  -				       (sm->root->dir + SECTOR_SIZE * i)); +				       (CHAR *)(sm->root->dir + SECTOR_SIZE * i));  		} else {  		  /* fill the rest of the block with zeros */ -		  mpio_io_sector_write(m, mem, i, dummy); +		mpio_io_sector_write(m, mem, i, (CHAR *)dummy);  		}	  	    }      	} @@ -882,21 +882,21 @@ mpio_fat_write(mpio_t *m, mpio_mem_t mem)  	/* remeber: logical sector 0 is the MBR! */  	if (i == 0) -	  mpio_io_sector_write(m, mem, 0, sm->mbr); +	  mpio_io_sector_write(m, mem, 0, (CHAR *)sm->mbr);  	if ((i > 0) && (i < sm->pbr_offset)) -	  mpio_io_sector_write(m, mem, i, dummy); +	  mpio_io_sector_write(m, mem, i, (CHAR *)dummy);  	if (i == sm->pbr_offset) -	  mpio_io_sector_write(m, mem, sm->pbr_offset, sm->pbr); +	  mpio_io_sector_write(m, mem, sm->pbr_offset, (CHAR *)sm->pbr);  	if ((i >= sm->fat_offset) && (i < (sm->fat_offset + (2*sm->fat_size))))   	  mpio_io_sector_write(m, mem, i,  -			       (sm->fat + SECTOR_SIZE * +			       (CHAR *)(sm->fat + SECTOR_SIZE *  				((i - sm->fat_offset) % sm->fat_size)));  	if (i>=sm->dir_offset)  	  mpio_io_sector_write(m, mem, i,  -			       (sm->root->dir +  +			       (CHAR *)(sm->root->dir +   				(i - sm->dir_offset) * SECTOR_SIZE));        } @@ -982,7 +982,7 @@ mpio_fatentry_is_defect(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f)  	     (sm->fat[e+0x00] != 0xee))  	{  	  debug("defective block encountered, abort reading! (wrong file state marker)\n"); -	  hexdumpn(0, (sm->fat+e), 0x10); +	  hexdumpn(0, (CHAR *)(sm->fat+e), 0x10);  	  return 1;  	}              if (m->model >= MPIO_MODEL_FD100) {       diff --git a/libmpio/src/id3.c b/libmpio/src/id3.c index d523709..88f86c4 100644 --- a/libmpio/src/id3.c +++ b/libmpio/src/id3.c @@ -1,5 +1,5 @@  /* - * $Id: id3.c,v 1.4 2003/06/12 08:32:33 germeier Exp $ + * $Id: id3.c,v 1.5 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2003 Markus Germeier @@ -33,14 +33,14 @@  #ifdef MPLIB  /* local declarations */ -void mpio_id3_get_content(id3_tag *, id3_tag *, int, BYTE[INFO_LINE]); -void mpio_id3_copy_tag(BYTE *, BYTE *, int *); +void mpio_id3_get_content(id3_tag *, id3_tag *, int, CHAR[INFO_LINE]); +void mpio_id3_copy_tag(CHAR *, CHAR *, int *);  BYTE mpio_id3_get(mpio_t *);  BYTE mpio_id3_set(mpio_t *, BYTE);  void  mpio_id3_get_content(id3_tag *tag, id3_tag *tag2, int field,  -		       BYTE out[INFO_LINE]) +		       CHAR out[INFO_LINE])  {    id3_content  *content;    id3_text_content  *text_content; @@ -60,7 +60,7 @@ mpio_id3_get_content(id3_tag *tag, id3_tag *tag2, int field,  }  void -mpio_id3_copy_tag(BYTE *src, BYTE *dest, int *offset) +mpio_id3_copy_tag(CHAR *src, CHAR *dest, int *offset)  {    int i=0;    int last=0; @@ -103,7 +103,7 @@ mpio_id3_get(mpio_t *m)  /* ID3 rewriting: do the work */  /* context, src filename, uniq filename template */  int     -mpio_id3_do(mpio_t *m, BYTE *src, BYTE *tmp) +mpio_id3_do(mpio_t *m, CHAR *src, CHAR *tmp)  {  #ifdef MPLIB    int fd, in; @@ -115,19 +115,19 @@ mpio_id3_do(mpio_t *m, BYTE *src, BYTE *tmp)    id3_tag_list  new_tag_list;    id3_content    new_content;    id3v2_tag *v2_tag;   -  BYTE data_artist[INFO_LINE]; -  BYTE data_title[INFO_LINE]; -  BYTE data_album[INFO_LINE]; -  BYTE data_year[INFO_LINE]; -  BYTE data_genre[INFO_LINE]; -  BYTE data_comment[INFO_LINE]; -  BYTE data_track[INFO_LINE]; +  CHAR data_artist[INFO_LINE]; +  CHAR data_title[INFO_LINE]; +  CHAR data_album[INFO_LINE]; +  CHAR data_year[INFO_LINE]; +  CHAR data_genre[INFO_LINE]; +  CHAR data_comment[INFO_LINE]; +  CHAR data_track[INFO_LINE]; -  BYTE mpio_tag[INFO_LINE]; +  CHAR mpio_tag[INFO_LINE];    char   *mpio_tag_unicode;     iconv_t ic; -  int fin, fout; +  size_t fin, fout;    char *fback, *back;    if (!m->id3) @@ -285,14 +285,14 @@ mpio_id3_end(mpio_t *m)  }  void    -mpio_id3_format_set(mpio_t *m, BYTE *format) +mpio_id3_format_set(mpio_t *m, CHAR *format)  {    strncpy(m->id3_format, format, INFO_LINE);  }  /* get format string for rewriting*/  void -mpio_id3_format_get(mpio_t *m, BYTE *format) +mpio_id3_format_get(mpio_t *m, CHAR *format)  {    strncpy(format, m->id3_format, INFO_LINE);  } diff --git a/libmpio/src/id3.h b/libmpio/src/id3.h index 6fe1465..9ed1080 100644 --- a/libmpio/src/id3.h +++ b/libmpio/src/id3.h @@ -1,5 +1,5 @@  /* - * $Id: id3.h,v 1.2 2003/04/27 12:08:21 germeier Exp $ + * $Id: id3.h,v 1.3 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2003 Markus Germeier @@ -31,7 +31,7 @@ extern "C" {  /* ID3 rewriting: do the work */  /* context, src filename, uniq filename template */ -int    mpio_id3_do(mpio_t *, BYTE *, BYTE *);   +int    mpio_id3_do(mpio_t *, CHAR *, CHAR *);    /* ID3: clean up temp file */  int    mpio_id3_end(mpio_t *); diff --git a/libmpio/src/io.c b/libmpio/src/io.c index 61ddd4f..5684f6d 100644 --- a/libmpio/src/io.c +++ b/libmpio/src/io.c @@ -1,5 +1,5 @@  /* - * $Id: io.c,v 1.12 2004/04/24 16:09:58 germeier Exp $ + * $Id: io.c,v 1.13 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002-2004 Markus Germeier @@ -134,7 +134,7 @@ blockaddress_decode(BYTE *entry)        (entry[7] != entry[12]))      {	          debug("error: different block addresses found:\n"); -      hexdumpn(1, entry, 0x10); +      hexdumpn(1, (CHAR *)entry, 0x10);        return MPIO_BLOCK_DEFECT;      }  @@ -177,8 +177,8 @@ fatentry2hw(mpio_fatentry_t *f, BYTE *chip, DWORD *address)    if (f->mem == MPIO_INTERNAL_MEM)       {        sm       = &f->m->internal; -      /*       hexdump((char *)&f->entry, 4); */ -      /*       hexdump((char *)&f->hw_address, 4); */ +      /*       hexdump((CHAR *)&f->entry, 4); */ +      /*       hexdump((CHAR *)&f->hw_address, 4); */        *chip    = f->hw_address / 0x1000000;            *address = f->hw_address & 0x0ffffff;      } @@ -219,7 +219,7 @@ mpio_zone_init(mpio_t *m, mpio_cmd_t mem)        sm->zonetable[zone][block]=blockaddress_decode(sm->spare+e); -      hexdumpn(4, sm->spare+e, 0x10); +      hexdumpn(4, (CHAR *)sm->spare+e, 0x10);        debugn(2, "decoded: %04x\n", sm->zonetable[zone][block]);      }    return MPIO_OK; @@ -636,7 +636,7 @@ mpio_device_close(mpio_t *m) {  int  mpio_io_set_cmdpacket(mpio_t *m, mpio_cmd_t cmd, mpio_mem_t mem, DWORD index, -		      WORD size, BYTE wsize, BYTE *buffer)  +		      WORD size, BYTE wsize, CHAR *buffer)   {    BYTE memory; @@ -680,9 +680,9 @@ mpio_io_set_cmdpacket(mpio_t *m, mpio_cmd_t cmd, mpio_mem_t mem, DWORD index,   *   */  int -mpio_io_bulk_write(int fd, BYTE *block, int num_bytes) +mpio_io_bulk_write(int fd, CHAR *block, int num_bytes)  { -  BYTE *p; +  CHAR *p;    int count, bytes_left, bytes_written;    bytes_left = num_bytes; @@ -704,7 +704,7 @@ mpio_io_bulk_write(int fd, BYTE *block, int num_bytes)  }  int -mpio_io_write(mpio_t *m, BYTE *block, int num_bytes) +mpio_io_write(mpio_t *m, CHAR *block, int num_bytes)  {    if (m->use_libusb) {      int r;   @@ -732,10 +732,10 @@ mpio_io_write(mpio_t *m, BYTE *block, int num_bytes)   *   */  int -mpio_io_bulk_read (int fd, BYTE *block, int num_bytes) +mpio_io_bulk_read (int fd, CHAR *block, int num_bytes)  {    int total_read, count, bytes_left; -  BYTE *p; +  CHAR *p;    total_read = 0;    bytes_left = num_bytes; @@ -757,7 +757,7 @@ mpio_io_bulk_read (int fd, BYTE *block, int num_bytes)  }  int -mpio_io_read (mpio_t *m, BYTE *block, int num_bytes) +mpio_io_read (mpio_t *m, CHAR *block, int num_bytes)  {    if (m->use_libusb) {      int r; @@ -788,10 +788,10 @@ mpio_io_read (mpio_t *m, BYTE *block, int num_bytes)   *   */  int -mpio_io_version_read(mpio_t *m, BYTE *buffer) +mpio_io_version_read(mpio_t *m, CHAR *buffer)  {    int nwrite, nread; -  BYTE cmdpacket[CMD_SIZE], status[CMD_SIZE]; +  CHAR cmdpacket[CMD_SIZE], status[CMD_SIZE];    /*  Send command packet to MPIO  */    mpio_io_set_cmdpacket (m, GET_VERSION, 0, 0, 0xff, 0, cmdpacket); @@ -843,12 +843,12 @@ mpio_io_version_read(mpio_t *m, BYTE *buffer)   */  int -mpio_io_sector_read(mpio_t *m, BYTE mem, DWORD index, BYTE *output) +mpio_io_sector_read(mpio_t *m, BYTE mem, DWORD index, CHAR *output)  {    mpio_smartmedia_t *sm=0;    DWORD sector;    int nwrite, nread; -  BYTE cmdpacket[CMD_SIZE], recvbuff[SECTOR_TRANS]; +  CHAR cmdpacket[CMD_SIZE], recvbuff[SECTOR_TRANS];    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal;    if (mem == MPIO_EXTERNAL_MEM) sm = &m->external; @@ -944,13 +944,13 @@ mpio_io_sector_read(mpio_t *m, BYTE mem, DWORD index, BYTE *output)   */  int   -mpio_io_sector_write(mpio_t *m, BYTE mem, DWORD index, BYTE *input) +mpio_io_sector_write(mpio_t *m, BYTE mem, DWORD index, CHAR *input)  {    int nwrite;    mpio_smartmedia_t *sm;    DWORD pvalue;    DWORD block_address, ba; -  BYTE cmdpacket[CMD_SIZE], sendbuff[SECTOR_TRANS]; +  CHAR cmdpacket[CMD_SIZE], sendbuff[SECTOR_TRANS];    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal;    if (mem == MPIO_EXTERNAL_MEM) sm = &m->external; @@ -1096,7 +1096,7 @@ mpio_io_megablock_read(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *outp    mpio_smartmedia_t *sm;    BYTE  chip;    DWORD address; -  BYTE cmdpacket[CMD_SIZE], recvbuff[BLOCK_TRANS]; +  CHAR cmdpacket[CMD_SIZE], recvbuff[BLOCK_TRANS];    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal;    if (mem == MPIO_EXTERNAL_MEM) sm = &m->external; @@ -1155,7 +1155,7 @@ mpio_io_block_read(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *output)    mpio_smartmedia_t *sm;    BYTE  chip;    DWORD address; -  BYTE cmdpacket[CMD_SIZE], recvbuff[BLOCK_TRANS]; +  CHAR cmdpacket[CMD_SIZE], recvbuff[BLOCK_TRANS];    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal;    if (mem == MPIO_EXTERNAL_MEM) sm = &m->external; @@ -1226,7 +1226,7 @@ mpio_io_block_read(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *output)  int  mpio_io_spare_read(mpio_t *m, BYTE mem, DWORD index, WORD size, -		   BYTE wsize, BYTE *output, int toread, +		   BYTE wsize, CHAR *output, int toread,  		   mpio_callback_init_t progress_callback)  {    mpio_smartmedia_t *sm; @@ -1234,7 +1234,7 @@ mpio_io_spare_read(mpio_t *m, BYTE mem, DWORD index, WORD size,    int nwrite, nread;    int chip = 0;    int chips = 0; -  BYTE cmdpacket[CMD_SIZE]; +  CHAR cmdpacket[CMD_SIZE];    if (mem == MPIO_INTERNAL_MEM) sm = &m->internal;      if (mem == MPIO_EXTERNAL_MEM) sm = &m->external; @@ -1317,7 +1317,8 @@ mpio_io_block_delete_phys(mpio_t *m, BYTE chip, DWORD address)  {    mpio_smartmedia_t *sm;    int nwrite, nread; -  BYTE cmdpacket[CMD_SIZE], status[CMD_SIZE]; +  CHAR cmdpacket[CMD_SIZE]; +  BYTE status[CMD_SIZE];    BYTE CMD_OK, CMD_ERROR;    /*  Send command packet to MPIO  */ @@ -1346,7 +1347,7 @@ mpio_io_block_delete_phys(mpio_t *m, BYTE chip, DWORD address)    mpio_io_set_cmdpacket(m, DEL_BLOCK, chip, address, sm->size, 0, cmdpacket);    debugn  (5, ">>> MPIO\n"); -  hexdump (cmdpacket, sizeof(cmdpacket)); +  hexdump ((CHAR *)cmdpacket, sizeof(cmdpacket));    nwrite = mpio_io_write(m, cmdpacket, 0x40); @@ -1368,7 +1369,7 @@ mpio_io_block_delete_phys(mpio_t *m, BYTE chip, DWORD address)      }    debugn(5, "<<< MPIO\n"); -  hexdump(status, CMD_SIZE); +  hexdump((CHAR *)status, CMD_SIZE);    if (status[0] != CMD_OK)       { @@ -1398,7 +1399,7 @@ mpio_io_megablock_write(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *dat    int nwrite;    int i, j, k;    DWORD block_address, ba; -  BYTE cmdpacket[CMD_SIZE], sendbuff[MEGABLOCK_TRANS_WRITE]; +  CHAR cmdpacket[CMD_SIZE], sendbuff[MEGABLOCK_TRANS_WRITE];    BYTE  chip=0;    DWORD address; @@ -1420,7 +1421,7 @@ mpio_io_megablock_write(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *dat    debugn(5, "\n>>> MPIO\n");    hexdump(cmdpacket, sizeof(cmdpacket)); -  hexdump(f->i_fat, 0x10); +  hexdump((CHAR *)f->i_fat, 0x10);    nwrite = mpio_io_write(m, cmdpacket, CMD_SIZE); @@ -1471,7 +1472,7 @@ mpio_io_block_write(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f, BYTE *data)    int nwrite;    int i;    DWORD block_address, ba; -  BYTE cmdpacket[CMD_SIZE], sendbuff[BLOCK_TRANS]; +  CHAR cmdpacket[CMD_SIZE], sendbuff[BLOCK_TRANS];    BYTE  chip=0;    DWORD address; diff --git a/libmpio/src/io.h b/libmpio/src/io.h index 0275506..d414e6d 100644 --- a/libmpio/src/io.h +++ b/libmpio/src/io.h @@ -1,5 +1,5 @@  /* - * $Id: io.h,v 1.4 2003/10/19 21:06:35 germeier Exp $ + * $Id: io.h,v 1.5 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -67,17 +67,17 @@ void mpio_zone_block_set(mpio_t *, mpio_cmd_t, DWORD);  /* real I/O */  int	mpio_io_set_cmdpacket(mpio_t *, mpio_cmd_t, mpio_mem_t,  -			      DWORD, WORD, BYTE, BYTE *); +			      DWORD, WORD, BYTE, CHAR *); -int	mpio_io_bulk_read (int, BYTE *, int); -int	mpio_io_bulk_write(int, BYTE *, int); +int	mpio_io_bulk_read (int, CHAR *, int); +int	mpio_io_bulk_write(int, CHAR *, int);  /* read version block into memory */ -int	mpio_io_version_read(mpio_t *, BYTE *); +int	mpio_io_version_read(mpio_t *, CHAR *);  /* */ -int	mpio_io_sector_read (mpio_t *, BYTE, DWORD, BYTE *); -int	mpio_io_sector_write(mpio_t *, BYTE, DWORD, BYTE *); +int	mpio_io_sector_read (mpio_t *, BYTE, DWORD, CHAR *); +int	mpio_io_sector_write(mpio_t *, BYTE, DWORD, CHAR *);  /* */  int	mpio_io_block_read  (mpio_t *, mpio_mem_t, mpio_fatentry_t *, BYTE *); @@ -92,7 +92,7 @@ int	mpio_io_megablock_read  (mpio_t *, mpio_mem_t, mpio_fatentry_t *, BYTE *);  int	mpio_io_megablock_write (mpio_t *, mpio_mem_t, mpio_fatentry_t *, BYTE *);  /* */ -int	mpio_io_spare_read  (mpio_t *, BYTE, DWORD, WORD, BYTE, BYTE *, int, +int	mpio_io_spare_read  (mpio_t *, BYTE, DWORD, WORD, BYTE, CHAR *, int,  			     mpio_callback_init_t);  #ifdef __cplusplus diff --git a/libmpio/src/mmc.c b/libmpio/src/mmc.c index 10907d7..f499604 100644 --- a/libmpio/src/mmc.c +++ b/libmpio/src/mmc.c @@ -1,5 +1,5 @@  /* - * $Id: mmc.c,v 1.1 2004/05/30 16:28:52 germeier Exp $ + * $Id: mmc.c,v 1.2 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2004 Robert Kellington, Markus Germeier @@ -50,13 +50,22 @@ BYTE mpio_mmc_detect_memory(mpio_t *m, mpio_mem_t mem)    /*looking for likely markers*/    /* -    if((m->version[0x28] == 0x32) && (m->version[0x3a] == 0x01) && (m->version[0x3b] == 0x01) &&  -    (m->version[0x30] == 0xff) && (m->version[0x31] == 0xcf)) +    if(((BYTE)(m->version[0x28]) == 0x32) &&  +    ((BYTE)(m->version[0x3a]) == 0x01) &&  +    ((BYTE)(m->version[0x3b]) == 0x01) &&  +    ((BYTE)(m->version[0x30]) == 0xff) &&  +    ((BYTE)(m->version[0x31]) == 0xcf))    */    -  if((m->version[0x39] == 0x01) && (m->version[0x3b] == 0x01) && (m->version[0x20] == 0xff) && (m->version[0x21] == 0xff) && -     (m->version[0x22] == 0xff) && (m->version[0x23] == 0xff) && (m->version[0x24] == 0xff) && (m->version[0x25] == 0xff)) +  if(((BYTE)(m->version[0x39]) == 0x01) &&  +     ((BYTE)(m->version[0x3b]) == 0x01) &&  +     ((BYTE)(m->version[0x20]) == 0xff) &&  +     ((BYTE)(m->version[0x21]) == 0xff) && +     ((BYTE)(m->version[0x22]) == 0xff) &&  +     ((BYTE)(m->version[0x23]) == 0xff) &&  +     ((BYTE)(m->version[0x24]) == 0xff) &&  +     ((BYTE)(m->version[0x25]) == 0xff))      { -      switch(m->version[0x26]) +      switch((BYTE)m->version[0x26])  	{  	case 0x0e:    /* 16 Mb */  	  /*NOTE: This size needs formating to be added and testing*/ diff --git a/libmpio/src/mpio.c b/libmpio/src/mpio.c index 9484ed2..b17fbd4 100644 --- a/libmpio/src/mpio.c +++ b/libmpio/src/mpio.c @@ -1,5 +1,5 @@  /* - * $Id: mpio.c,v 1.17 2004/05/31 09:28:50 germeier Exp $ + * $Id: mpio.c,v 1.18 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002-2004 Markus Germeier @@ -48,12 +48,12 @@ void mpio_init_external(mpio_t *);  int  mpio_check_filename(mpio_filename_t);  int mpio_file_get_real(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_filename_t, -		       mpio_callback_t, BYTE **);  +		       mpio_callback_t, CHAR **);   int mpio_file_put_real(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_filename_t, -		       mpio_filetype_t, mpio_callback_t, BYTE *, int); +		       mpio_filetype_t, mpio_callback_t, CHAR *, int); -static BYTE *mpio_model_name[] = { +static CHAR *mpio_model_name[] = {    "MPIO-DME",    "MPIO-DMG",    "MPIO-DMG+", @@ -141,7 +141,7 @@ mpio_bail_out(void){  int  mpio_check_filename(mpio_filename_t filename)  { -  BYTE *p=filename; +  CHAR *p=filename;    while (p < (filename + MPIO_FILENAME_LEN))      { @@ -452,7 +452,7 @@ mpio_init(mpio_callback_init_t progress_callback)      {              sm = &new_mpio->external;          mpio_io_spare_read(new_mpio, MPIO_EXTERNAL_MEM, 0, -			 sm->size, 0, sm->spare, +			 sm->size, 0, (CHAR *)sm->spare,  			 (sm->max_blocks * 0x10), progress_callback);        mpio_zone_init(new_mpio, MPIO_EXTERNAL_MEM); @@ -483,7 +483,7 @@ mpio_init(mpio_callback_init_t progress_callback)   *   */  int -mpio_memory_free(mpio_t *m, mpio_mem_t mem, int *free) +mpio_memory_free(mpio_t *m, mpio_mem_t mem, DWORD *free)  {    if (mem==MPIO_INTERNAL_MEM) {          if (!m->internal.size) { @@ -605,7 +605,7 @@ mpio_file_get(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,  int  mpio_file_get_to_memory(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,  -			mpio_callback_t progress_callback, BYTE **memory) +			mpio_callback_t progress_callback, CHAR **memory)  {    return mpio_file_get_real(m, mem, filename, NULL, progress_callback, memory);  } @@ -613,7 +613,7 @@ mpio_file_get_to_memory(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,  int  mpio_file_get_real(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,  		   mpio_filename_t as, mpio_callback_t progress_callback, -		   BYTE **memory) +		   CHAR **memory)  {    mpio_smartmedia_t *sm;    BYTE block[MEGABLOCK_SIZE]; @@ -740,7 +740,7 @@ int  mpio_file_put_from_memory(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,   			  mpio_filetype_t filetype,  			  mpio_callback_t progress_callback, -			  BYTE *memory, int memory_size) +			  CHAR *memory, int memory_size)  {    return mpio_file_put_real(m, mem, filename,  NULL, filetype,  			    progress_callback, memory, memory_size); @@ -750,13 +750,13 @@ int  mpio_file_put_real(mpio_t *m, mpio_mem_t mem, mpio_filename_t i_filename,  		   mpio_filename_t o_filename, mpio_filetype_t filetype,  		   mpio_callback_t progress_callback, -		   BYTE *memory, int memory_size) +		   CHAR *memory, int memory_size)  {    mpio_smartmedia_t *sm;    mpio_fatentry_t   *f, current, firstblock, backup;     WORD start;    BYTE block[MEGABLOCK_SIZE]; -  BYTE use_filename[INFO_LINE]; +  CHAR use_filename[INFO_LINE];    int fd, toread;    struct stat file_stat;    struct tm tt; @@ -1080,7 +1080,7 @@ mpio_memory_format(mpio_t *m, mpio_mem_t mem,    DWORD clusters;    BYTE abort = 0;    BYTE *cis, *mbr, *pbr; -  BYTE defect[SECTOR_SIZE]; +  CHAR defect[SECTOR_SIZE];    int i;    if (mem == MPIO_INTERNAL_MEM)  @@ -1165,14 +1165,14 @@ mpio_memory_format(mpio_t *m, mpio_mem_t mem,      f = mpio_fatentry_new(m, mem, MPIO_BLOCK_CIS, FTYPE_MUSIC);      /*     mpio_io_block_delete(m, mem, f); */      free(f); -    cis = (BYTE *)mpio_cis_gen(); /* hmm, why this cast? */ -    mpio_io_sector_write(m, mem, MPIO_BLOCK_CIS,   cis); -    mpio_io_sector_write(m, mem, MPIO_BLOCK_CIS+1, cis);     +    cis = mpio_cis_gen();  +    mpio_io_sector_write(m, mem, MPIO_BLOCK_CIS,   (CHAR *)cis); +    mpio_io_sector_write(m, mem, MPIO_BLOCK_CIS+1, (CHAR *)cis);          free(cis);      /* generate boot blocks ... */ -    mbr = (BYTE *)mpio_mbr_gen(m->external.size); -    pbr = (BYTE *)mpio_pbr_gen(m->external.size); +    mbr = mpio_mbr_gen(m->external.size); +    pbr = mpio_pbr_gen(m->external.size);      /* ... copy the blocks to internal memory structurs ... */      memcpy(sm->cis, cis, SECTOR_SIZE);      memcpy(sm->mbr, mbr, SECTOR_SIZE); @@ -1411,8 +1411,8 @@ mpio_memory_dump(mpio_t *m, mpio_mem_t mem)        if (!m->internal.size)  	return 0; -      hexdump(m->internal.fat, m->internal.max_blocks*0x10); -      hexdump(m->internal.root->dir, DIR_SIZE); +      hexdump((CHAR *)m->internal.fat, m->internal.max_blocks*0x10); +      hexdump((CHAR *)m->internal.root->dir, DIR_SIZE);        if (m->internal.version) {  	/* new chip */  	f = mpio_fatentry_new(m, mem, 0x00, FTYPE_MUSIC);   @@ -1425,7 +1425,7 @@ mpio_memory_dump(mpio_t *m, mpio_mem_t mem)        } else {	  	/* old chip */           for (i = 0 ; i<=0x100 ; i++)  -	  mpio_io_sector_read(m, mem, i, block); +	  mpio_io_sector_read(m, mem, i, (CHAR *)block);        }            } @@ -1435,11 +1435,11 @@ mpio_memory_dump(mpio_t *m, mpio_mem_t mem)        if (!m->external.size)  	return 0; -      hexdump(m->external.spare, m->external.max_blocks*0x10); -      hexdump(m->external.fat,   m->external.fat_size*SECTOR_SIZE); -      hexdump(m->external.root->dir, DIR_SIZE); +      hexdump((CHAR *)m->external.spare, m->external.max_blocks*0x10); +      hexdump((CHAR *)m->external.fat,   m->external.fat_size*SECTOR_SIZE); +      hexdump((CHAR *)m->external.root->dir, DIR_SIZE);        for (i = 0 ; i<=0x100 ; i++)  -	mpio_io_sector_read(m, mem, i, block); +	mpio_io_sector_read(m, mem, i, (CHAR *)block);      }    return 0;   diff --git a/libmpio/src/smartmedia.c b/libmpio/src/smartmedia.c index ac3478a..cff33b9 100644 --- a/libmpio/src/smartmedia.c +++ b/libmpio/src/smartmedia.c @@ -1,5 +1,5 @@  /* - * $Id: smartmedia.c,v 1.9 2004/04/19 12:19:26 germeier Exp $ + * $Id: smartmedia.c,v 1.10 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002-2004 Markus Germeier @@ -86,10 +86,10 @@ mpio_id2mem(BYTE id)    return i;  }       -BYTE * +CHAR *  mpio_id2manufacturer(BYTE id)  { -  BYTE *m; +  CHAR *m;    switch(id)       {      case 0xec: diff --git a/libmpio/src/smartmedia.h b/libmpio/src/smartmedia.h index 2f48aaf..4ba6e0d 100644 --- a/libmpio/src/smartmedia.h +++ b/libmpio/src/smartmedia.h @@ -1,5 +1,5 @@  /* - * $Id: smartmedia.h,v 1.3 2003/07/24 16:17:30 germeier Exp $ + * $Id: smartmedia.h,v 1.4 2006/01/21 18:33:20 germeier Exp $   *   *  libmpio - a library for accessing Digit@lways MPIO players   *  Copyright (C) 2002, 2003 Markus Germeier @@ -31,7 +31,7 @@ extern "C" {  /* get our configuration for SmartMedia cards right */  int	mpio_id2mem (BYTE); -BYTE *	mpio_id2manufacturer(BYTE); +CHAR *	mpio_id2manufacturer(BYTE);  void	mpio_id2geo(BYTE, mpio_disk_phy_t *);  BYTE	mpio_id_valid(BYTE);  BYTE    mpio_id2version(BYTE);    | 
