diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-05-09 15:44:46 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-05-09 20:46:20 +0200 |
| commit | 563bd8499e63db976ca8358216138647593354bc (patch) | |
| tree | 003599ed2b0cffd932d2122c3f72c142070efafd /src/lib/openjpip/boxheader_manager.c | |
| parent | d4e54e9f35d532062533f1d369c159810b01d224 (diff) | |
Reformat whole codebase with astyle.options (#128)
Diffstat (limited to 'src/lib/openjpip/boxheader_manager.c')
| -rw-r--r-- | src/lib/openjpip/boxheader_manager.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/lib/openjpip/boxheader_manager.c b/src/lib/openjpip/boxheader_manager.c index 3b97c6df..f5958f64 100644 --- a/src/lib/openjpip/boxheader_manager.c +++ b/src/lib/openjpip/boxheader_manager.c @@ -45,40 +45,41 @@ #endif /*SERVER*/ -boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset) +boxheader_param_t * gene_boxheader(int fd, OPJ_OFF_T offset) { - Byte8_t boxlen; - Byte_t headlen; - char *boxtype; - boxheader_param_t *boxheader; + Byte8_t boxlen; + Byte_t headlen; + char *boxtype; + boxheader_param_t *boxheader; - boxlen = fetch_4bytebigendian( fd, offset); - boxtype = (char *)fetch_bytes( fd, offset+4, 4); - headlen = 8; - - if( boxlen == 1){ /* read XLBox */ - boxlen = fetch_8bytebigendian( fd, offset+8); - headlen = 16; - } + boxlen = fetch_4bytebigendian(fd, offset); + boxtype = (char *)fetch_bytes(fd, offset + 4, 4); + headlen = 8; - boxheader = (boxheader_param_t *)malloc( sizeof( boxheader_param_t)); - boxheader->headlen = headlen; - boxheader->length = boxlen; - strncpy( boxheader->type, boxtype, 4); - boxheader->next = NULL; - - free( boxtype); - return boxheader; + if (boxlen == 1) { /* read XLBox */ + boxlen = fetch_8bytebigendian(fd, offset + 8); + headlen = 16; + } + + boxheader = (boxheader_param_t *)malloc(sizeof(boxheader_param_t)); + boxheader->headlen = headlen; + boxheader->length = boxlen; + strncpy(boxheader->type, boxtype, 4); + boxheader->next = NULL; + + free(boxtype); + return boxheader; } -boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset) +boxheader_param_t * gene_childboxheader(box_param_t *superbox, OPJ_OFF_T offset) { - return gene_boxheader( superbox->fd, get_DBoxoff(superbox)+offset); + return gene_boxheader(superbox->fd, get_DBoxoff(superbox) + offset); } -void print_boxheader( boxheader_param_t *boxheader) +void print_boxheader(boxheader_param_t *boxheader) { - fprintf( logstream, "boxheader info:\n" - "\t type: %.4s\n" - "\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, boxheader->length); + fprintf(logstream, "boxheader info:\n" + "\t type: %.4s\n" + "\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, + boxheader->length); } |
