diff options
author | 2016-10-22 13:13:17 +0200 | |
---|---|---|
committer | 2016-10-22 13:13:17 +0200 | |
commit | ddb290d5f615019c33c42b8d94e5a5254cabcf33 (patch) | |
tree | a70f688b0df3acd19da7b1151e5902e3c6af3fa5 /src/lib/formats/td0_dsk.cpp | |
parent | 333bff8de64dfaeb98134000412796b4fdef970b (diff) |
NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8
also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
Diffstat (limited to 'src/lib/formats/td0_dsk.cpp')
-rw-r--r-- | src/lib/formats/td0_dsk.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp index 51fa59488a6..375cf3cdb42 100644 --- a/src/lib/formats/td0_dsk.cpp +++ b/src/lib/formats/td0_dsk.cpp @@ -44,51 +44,51 @@ struct td0dsk_tag int heads; int tracks; int sector_size; - UINT64 track_offsets[84*2]; /* offset within data for each track */ - UINT8 *data; + uint64_t track_offsets[84*2]; /* offset within data for each track */ + uint8_t *data; }; struct tdlzhuf { - UINT16 r, + uint16_t r, bufcnt,bufndx,bufpos, // string buffer // the following to allow block reads from input in next_word() ibufcnt,ibufndx; // input buffer counters - UINT8 inbuf[BUFSZ]; // input buffer + uint8_t inbuf[BUFSZ]; // input buffer }; struct td0dsk_t { io_generic *floppy_file; - UINT64 floppy_file_offset; + uint64_t floppy_file_offset; struct tdlzhuf tdctl; - UINT8 text_buf[N + F - 1]; - UINT16 freq[T + 1]; /* cumulative freq table */ + uint8_t text_buf[N + F - 1]; + uint16_t freq[T + 1]; /* cumulative freq table */ /* * pointing parent nodes. * area [T..(T + N_CHAR - 1)] are pointers for leaves */ - INT16 prnt[T + N_CHAR]; + int16_t prnt[T + N_CHAR]; /* pointing children nodes (son[], son[] + 1)*/ - INT16 son[T]; + int16_t son[T]; - UINT16 getbuf; - UINT8 getlen; + uint16_t getbuf; + uint8_t getlen; - int data_read(UINT8 *buf, UINT16 size); + int data_read(uint8_t *buf, uint16_t size); int next_word(); int GetBit(); int GetByte(); void StartHuff(); void reconst(); void update(int c); - INT16 DecodeChar(); - INT16 DecodePosition(); + int16_t DecodeChar(); + int16_t DecodePosition(); void init_Decode(); - int Decode(UINT8 *buf, int len); + int Decode(uint8_t *buf, int len); }; //static td0dsk_t td0dsk; @@ -103,10 +103,10 @@ struct floppy_image_legacy /* loaded track stuff */ int loaded_track_head; int loaded_track_index; - UINT32 loaded_track_size; + uint32_t loaded_track_size; void *loaded_track_data; - UINT8 loaded_track_status; - UINT8 flags; + uint8_t loaded_track_status; + uint8_t flags; /* tagging system */ object_pool *tags; @@ -125,7 +125,7 @@ static struct td0dsk_tag *get_tag(floppy_image_legacy *floppy) FLOPPY_IDENTIFY( td0_dsk_identify ) { - UINT8 header[2]; + uint8_t header[2]; floppy_image_read(floppy, header, 0, 2); if (header[0]=='T' && header[1]=='D') { @@ -148,16 +148,16 @@ static int td0_get_tracks_per_disk(floppy_image_legacy *floppy) return get_tag(floppy)->tracks; } -static UINT64 td0_get_track_offset(floppy_image_legacy *floppy, int head, int track) +static uint64_t td0_get_track_offset(floppy_image_legacy *floppy, int head, int track) { return get_tag(floppy)->track_offsets[(track<<1) + head]; } -static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset) +static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset) { - UINT64 offs; - UINT8 *header; - UINT8 sectors_per_track; + uint64_t offs; + uint8_t *header; + uint8_t sectors_per_track; int i; if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks) @@ -202,16 +202,16 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in static floperr_t internal_td0_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) { - UINT64 offset; + uint64_t offset; floperr_t err; - UINT8 *header; + uint8_t *header; int size,realsize,i; int buff_pos; int data_pos; - UINT8 *data; - UINT8 *buf; + uint8_t *data; + uint8_t *buf; - buf = (UINT8*)buffer; + buf = (uint8_t*)buffer; // take sector offset err = get_offset(floppy, head, track, sector, sector_is_index, &offset); if (err) @@ -295,7 +295,7 @@ static floperr_t td0_read_indexed_sector(floppy_image_legacy *floppy, int head, return internal_td0_read_sector(floppy, head, track, sector, TRUE, buffer, buflen); } -static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length) +static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length) { floperr_t err; err = get_offset(floppy, head, track, sector, FALSE, nullptr); @@ -308,11 +308,11 @@ static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, in return FLOPPY_ERROR_SUCCESS; } -static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) +static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags) { floperr_t retVal; - UINT64 offset = 0; - UINT8 *sector_info; + uint64_t offset = 0; + uint8_t *sector_info; retVal = get_offset(floppy, head, track, sector_index, FALSE, &offset); sector_info = get_tag(floppy)->data + offset; @@ -334,9 +334,9 @@ static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int he return retVal; } -int td0dsk_t::data_read(UINT8 *buf, UINT16 size) +int td0dsk_t::data_read(uint8_t *buf, uint16_t size) { - UINT64 image_size = io_generic_size(floppy_file); + uint64_t image_size = io_generic_size(floppy_file); if (size > image_size - floppy_file_offset) { size = image_size - floppy_file_offset; } @@ -352,7 +352,7 @@ int td0dsk_t::data_read(UINT8 *buf, UINT16 size) */ /* decoder table */ -static const UINT8 d_code[256] = { +static const uint8_t d_code[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -387,7 +387,7 @@ static const UINT8 d_code[256] = { 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, }; -static const UINT8 d_len[256] = { +static const uint8_t d_len[256] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, @@ -441,7 +441,7 @@ int td0dsk_t::next_word() int td0dsk_t::GetBit() /* get one bit */ { - INT16 i; + int16_t i; if(next_word() < 0) return(-1); i = getbuf; @@ -455,7 +455,7 @@ int td0dsk_t::GetBit() /* get one bit */ int td0dsk_t::GetByte() /* get a byte */ { - UINT16 i; + uint16_t i; if(next_word() != 0) return(-1); i = getbuf; @@ -494,8 +494,8 @@ void td0dsk_t::StartHuff() void td0dsk_t::reconst() { - INT16 i, j, k; - UINT16 f, l; + int16_t i, j, k; + uint16_t f, l; /* halven cumulative freq for leaf nodes */ j = 0; @@ -572,10 +572,10 @@ void td0dsk_t::update(int c) } -INT16 td0dsk_t::DecodeChar() +int16_t td0dsk_t::DecodeChar() { int ret; - UINT16 c; + uint16_t c; c = son[R]; @@ -595,16 +595,16 @@ INT16 td0dsk_t::DecodeChar() return c; } -INT16 td0dsk_t::DecodePosition() +int16_t td0dsk_t::DecodePosition() { - INT16 bit; - UINT16 i, j, c; + int16_t bit; + uint16_t i, j, c; /* decode upper 6 bits from given table */ if((bit=GetByte()) < 0) return(-1); - i = (UINT16) bit; - c = (UINT16)d_code[i] << 6; + i = (uint16_t) bit; + c = (uint16_t)d_code[i] << 6; j = d_len[i]; /* input lower 6 bits directly */ @@ -637,9 +637,9 @@ void td0dsk_t::init_Decode() } -int td0dsk_t::Decode(UINT8 *buf, int len) /* Decoding/Uncompressing */ +int td0dsk_t::Decode(uint8_t *buf, int len) /* Decoding/Uncompressing */ { - INT16 c,pos; + int16_t c,pos; int count; // was an unsigned long, seems unnecessary for (count = 0; count < len; ) { if(tdctl.bufcnt == 0) { @@ -682,7 +682,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct ) td0dsk_t state; struct FloppyCallbacks *callbacks; struct td0dsk_tag *tag; - UINT8 *header; + uint8_t *header; int number_of_sectors; int position; int i; @@ -698,7 +698,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct ) if (!tag) return FLOPPY_ERROR_OUTOFMEMORY; - tag->data = (UINT8*)malloc(floppy_image_size(floppy)); + tag->data = (uint8_t*)malloc(floppy_image_size(floppy)); if (tag->data==nullptr) { return FLOPPY_ERROR_OUTOFMEMORY; } @@ -706,7 +706,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct ) header = tag->data; if (header[0]=='t') { - UINT8 obuf[BUFSZ]; + uint8_t obuf[BUFSZ]; int rd; int off = 12; int size = 0; @@ -719,7 +719,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct ) } while(rd == BUFSZ); memcpy(obuf,tag->data,12); free(tag->data); - tag->data = (UINT8*)malloc(size+12); + tag->data = (uint8_t*)malloc(size+12); if (tag->data==nullptr) { return FLOPPY_ERROR_OUTOFMEMORY; } @@ -819,9 +819,9 @@ const char *td0_format::extensions() const return "td0"; } -int td0_format::identify(io_generic *io, UINT32 form_factor) +int td0_format::identify(io_generic *io, uint32_t form_factor) { - UINT8 h[7]; + uint8_t h[7]; io_generic_read(io, h, 0, 7); if(((h[0] == 'T') && (h[1] == 'D')) || ((h[0] == 't') && (h[1] == 'd'))) @@ -831,15 +831,15 @@ int td0_format::identify(io_generic *io, UINT32 form_factor) return 0; } -bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) +bool td0_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) { int track_count = 0; int head_count = 0; int track_spt; int offset = 0; const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy - std::vector<UINT8> imagebuf(max_size); - UINT8 header[12]; + std::vector<uint8_t> imagebuf(max_size); + uint8_t header[12]; io_generic_read(io, header, 0, 12); head_count = header[9]; @@ -917,7 +917,7 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) while(track_spt != 255) { desc_pc_sector sects[256]; - UINT8 sect_data[65536]; + uint8_t sect_data[65536]; int sdatapos = 0; int track = imagebuf[offset + 1]; int head = imagebuf[offset + 2] & 1; @@ -925,8 +925,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) offset += 4; for(int i = 0; i < track_spt; i++) { - UINT8 *hs = &imagebuf[offset]; - UINT16 size; + uint8_t *hs = &imagebuf[offset]; + uint16_t size; offset += 6; sects[i].track = hs[0]; @@ -967,8 +967,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) k = 0; while(k < size) { - UINT16 len = imagebuf[offset]; - UINT16 rep = imagebuf[offset + 1]; + uint16_t len = imagebuf[offset]; + uint16_t rep = imagebuf[offset + 1]; offset += 2; if(!len) { |