Browse Source

- fixed variable type, uint16 instead int should be used

development
Andreas Romeyke 2 years ago
parent
commit
e59cfb3cdf
4 changed files with 9 additions and 10 deletions
  1. +6
    -7
      src/helper/check_tiffparse.c
  2. +1
    -1
      src/ifdrules/check_all_offsets_are_word_aligned.c
  3. +1
    -1
      src/ifdrules/check_all_offsets_greater_zero.c
  4. +1
    -1
      src/ifdrules/check_tagorder.c

+ 6
- 7
src/helper/check_tiffparse.c View File

@ -129,11 +129,11 @@ int TIFFGetRawTagListIndex(ctiff_t * ctif, tag_t tag) { /* find n-th entry in IF
case unknown_tag_order:
{
ctif->tagorder=has_sorted_tags;
int count = get_ifd0_count( ctif);
uint16 count = get_ifd0_count( ctif);
if (0 == count) { return -1; }
tag_t last = TIFFGetRawTagListEntry(ctif, 0);
ctif->tag_cache[last] = 0;
for (int i= 1; i < get_ifd0_count( ctif ); i++) {
for (uint i= 1; i < count; i++) {
tag_t current = TIFFGetRawTagListEntry( ctif, i );
if (last >= current) {
ctif->tagorder=has_unsorted_tags;
@ -337,8 +337,7 @@ ret_t get_first_IFD(ctiff_t * ctif, uint32 * ifd) {
/* scans first IDF and returns the n-th tag */
tag_t TIFFGetRawTagListEntry( ctiff_t * ctif, int tagidx ) {
int byteswapped = is_byteswapped(ctif);
int count = get_ifd0_count( ctif);
assert( count > 0);
uint16 count = get_ifd0_count( ctif);
/* ct_read count of tags (2 Bytes) */
uint32 adress = ctif->ifd0pos+2+tagidx*12;
if (ct_seek(ctif, adress , SEEK_SET) != adress) { /* IFD0 plus 2byte to get IFD-entries, then nth tag */
@ -504,7 +503,7 @@ ret_t read_offsetdata(ctiff_t * ctif, const uint32 address, const uint32 count,
/* scans first IDF and returns the type of the n-th tag */
ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ) {
int tagcount = get_ifd0_count( ctif);
uint16 tagcount = get_ifd0_count( ctif);
assert( tagcount > 0);
int byteswapped = is_byteswapped(ctif);
#ifdef DEBUG
@ -637,7 +636,7 @@ ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ) {
/* TODO */
ifd_entry_t TIFFGetRawIFDEntry( ctiff_t * ctif, tag_t tag) {
int tagidx = -1;
for (int i= 0; i < get_ifd0_count( ctif ); i++) {
for (uint16 i= 0; i < get_ifd0_count( ctif ); i++) {
if (tag > 253 && tag == TIFFGetRawTagListEntry( ctif, i )) {
tagidx= i;
break;
@ -675,7 +674,7 @@ if (tagidx >= 0) {
*/
TIFFDataType TIFFGetRawTagType(ctiff_t * ctif, tag_t tag) {
int tagidx = -1;
for (int i= 0; i < get_ifd0_count( ctif ); i++) {
for (uint16 i= 0; i < get_ifd0_count( ctif ); i++) {
if (tag > 253 && tag == TIFFGetRawTagListEntry( ctif, i )) {
tagidx= i;
break;


+ 1
- 1
src/ifdrules/check_all_offsets_are_word_aligned.c View File

@ -15,7 +15,7 @@
ret_t check_all_offsets_are_word_aligned(ctiff_t * ctif) {
GET_EMPTY_RET(ret)
tifp_check( ctif);
int count = get_ifd0_count( ctif);
uint16 count = get_ifd0_count( ctif);
int tagidx;
for (tagidx = 0; tagidx< count; tagidx++) {
ifd_entry_t ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx );


+ 1
- 1
src/ifdrules/check_all_offsets_greater_zero.c View File

@ -15,7 +15,7 @@
ret_t check_all_offsets_are_greater_zero(ctiff_t * ctif) {
GET_EMPTY_RET(ret)
tifp_check( ctif);
int count = get_ifd0_count( ctif);
uint16 count = get_ifd0_count( ctif);
int tagidx;
for (tagidx = 0; tagidx< count; tagidx++) {
ifd_entry_t ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx );


+ 1
- 1
src/ifdrules/check_tagorder.c View File

@ -16,7 +16,7 @@ ret_t check_tagorder(ctiff_t * ctif) {
tifp_check( ctif);
if (has_sorted_tags != ctif->tagorder) {
uint32 offset = get_ifd0_pos(ctif);
int count = get_ifd0_count(ctif);
uint16 count = get_ifd0_count(ctif);
/* read count of tags (2 Bytes) */
/* replace i/o operatrions with in-memory-operations */


Loading…
Cancel
Save