boolean_t fli_read_frame_header(char *refany, struct fli_frame_header *frame_hdr, unsigned short *offset, boolean_t *lsb) { struct fli_frame_header *fh; unsigned short magic; int i; for(i=0; i<6; i++){ bcopy(refany+sizeof(int)+i, (char*) &magic, sizeof(unsigned short)); if((magic == FLI_FRAME_HEADER_MAGIC) || (magic == FLI_FRAME_HEADER_MAGIC_V26976)) { *lsb = FALSE; *offset = i; bcopy(refany+i,(char*)frame_hdr,sizeof(struct fli_frame_header)); return TRUE; } else if ((swap_bytes(magic) == FLI_FRAME_HEADER_MAGIC) || (swap_bytes(magic) == FLI_FRAME_HEADER_MAGIC_V26976)) { *lsb = TRUE; *offset = i; bcopy(refany+i,(char*)frame_hdr,sizeof(struct fli_frame_header)); return TRUE; } else { printf("fli_read_frame_header() magic %x != %x\n",magic,FLI_FRAME_HEADER_MAGIC); } } return FALSE; }
int RawGetNext(CRaw * I, int *size, int *version) { PyMOLGlobals *G = I->G; int result = cRaw_EOF; switch (I->mode) { case cRaw_file_stream: if(I->f) { if(!feof(I->f)) { if(fread((char *) I->header, cRaw_header_size, 1, I->f) != 1) { PRINTFD(G, FB_Raw) " RawGetNextType-Debug: Couldn't read header.\n" ENDFD; } else { if(I->swap) { swap_bytes(I->header); swap_bytes(I->header + 1); swap_bytes(I->header + 2); swap_bytes(I->header + 3); } fseek(I->f, -cRaw_header_size, SEEK_CUR); *size = I->header[0]; result = I->header[1]; *version = I->header[2]; } } } } return (result); }
int RawReadSkip(CRaw * I) { PyMOLGlobals *G = I->G; int result = false; switch (I->mode) { case cRaw_file_stream: if(I->f) { if(!feof(I->f)) { if(fread((char *) I->header, cRaw_header_size, 1, I->f) != 1) { PRINTFB(G, FB_Raw, FB_Errors) "Error-Raw: Error reading header.\n" ENDFB(G); } else { if(I->swap) { swap_bytes(I->header); swap_bytes(I->header + 1); swap_bytes(I->header + 2); swap_bytes(I->header + 3); } fseek(I->f, I->header[0], SEEK_CUR); result = true; } } } break; } return (result); }
int RC4_stream(struct RC4_ctx *context, unsigned char *input, unsigned char *output, unsigned int size_bytes){ // PRGA: pseudo-random generation algorithm int x; unsigned char y; // memset(context, '\0', sizeof(struct RC4_ctx)); // no comment for (x = 0; x < 256; x++) { // upgrade context->i++; context->j += context->s[context->i]; swap_bytes(&context->s[context->i], &context->s[context->j]); } for (x = 0; x < size_bytes; x++) { context->i++; context->j += context->s[context->i]; swap_bytes(&context->s[context->i], &context->s[context->j]); /* Encrypt/decrypt next byte */ y = context->s[context->i] + context->s[context->j]; output[x] = input[x] ^ context->s[y]; } }
/* * Calculate H(i+1) = Hash(Hi,Mi) * Where H and M are 32 bytes long */ static int hash_step(gost_ctx * c, byte * H, const byte * M) { byte U[32], W[32], V[32], S[32], Key[32]; int i; /* Compute first key */ xor_blocks(W, H, M, 32); swap_bytes(W, Key); /* Encrypt first 8 bytes of H with first key */ gost_enc_with_key(c, Key, H, S); /* Compute second key */ circle_xor8(H, U); circle_xor8(M, V); circle_xor8(V, V); xor_blocks(W, U, V, 32); swap_bytes(W, Key); /* encrypt second 8 bytes of H with second key */ gost_enc_with_key(c, Key, H + 8, S + 8); /* compute third key */ circle_xor8(U, U); U[31] = ~U[31]; U[29] = ~U[29]; U[28] = ~U[28]; U[24] = ~U[24]; U[23] = ~U[23]; U[20] = ~U[20]; U[18] = ~U[18]; U[17] = ~U[17]; U[14] = ~U[14]; U[12] = ~U[12]; U[10] = ~U[10]; U[8] = ~U[8]; U[7] = ~U[7]; U[5] = ~U[5]; U[3] = ~U[3]; U[1] = ~U[1]; circle_xor8(V, V); circle_xor8(V, V); xor_blocks(W, U, V, 32); swap_bytes(W, Key); /* encrypt third 8 bytes of H with third key */ gost_enc_with_key(c, Key, H + 16, S + 16); /* Compute fourth key */ circle_xor8(U, U); circle_xor8(V, V); circle_xor8(V, V); xor_blocks(W, U, V, 32); swap_bytes(W, Key); /* Encrypt last 8 bytes with fourth key */ gost_enc_with_key(c, Key, H + 24, S + 24); for (i = 0; i < 12; i++) transform_3(S); xor_blocks(S, S, M, 32); transform_3(S); xor_blocks(S, S, H, 32); for (i = 0; i < 61; i++) transform_3(S); memcpy(H, S, 32); return 1; }
static void blowfish_decrypt(u_char *src, u_char *dst, int len, void *state) { struct blowfish_state *dstate; dstate = (struct blowfish_state *)state; swap_bytes(src, dst, len); BF_cbc_encrypt((void *)dst, dst, len, &dstate->key, dstate->iv, BF_DECRYPT); swap_bytes(dst, dst, len); }
static int bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len) { int ret; swap_bytes(in, out, len); ret = (*orig_bf)(ctx, out, out, len); swap_bytes(out, out, len); return (ret); }
void blowfish_encrypt(u_char *src, u_char *dst, int len, void *state) { struct blowfish_state *estate; estate = (struct blowfish_state *)state; swap_bytes(src, dst, len); BF_cbc_encrypt((void *)dst, dst, len, &estate->key, estate->iv, BF_ENCRYPT); swap_bytes(dst, dst, len); }
/** * reverse_inplace_quad * * Reverses a block of memory in-place, 4 bytes at a time. This function * requires the uint32_t type, which is 32 bits wide. * * Parameters: * * src - the memory block to reverse * size - the size (in bytes) of the memory block * * Returns: nothing */ static void reverse_inplace_quad(unsigned char *src, int size) { uint32_t *nsrc = (uint32_t *)src; /* first quad */ uint32_t *ndst = (uint32_t *)(src + size - 4); /* last quad */ register uint32_t tmp; while (nsrc < ndst) { tmp = swap_bytes(*ndst); *ndst-- = swap_bytes(*nsrc); *nsrc++ = tmp; } }
int hist_prep(void *data_in, map_reduce_args_t *args) { hist_data_t *data = (hist_data_t *)data_in; struct stat finfo; char topdata[READ_AHEAD]; if(data->fname == NULL) { printf("Must specify filename.\n"); return(-1); } // Read in the file CHECK_ERROR((data->fd = open(data->fname, O_RDONLY)) < 0); // Get the file info (for file length) CHECK_ERROR(fstat(data->fd, &finfo) < 0); if(read(data->fd, topdata, READ_AHEAD) != READ_AHEAD) { return(-1); } if ((topdata[0] != 'B') || (topdata[1] != 'M')) { printf("File is not a valid bitmap file.\n"); return(-1); } int swap; test_endianess(&swap); // will set the variable "swap" unsigned short *bitsperpixel = (unsigned short *)(&(topdata[BITS_PER_PIXEL_POS])); if (swap) { swap_bytes((char *)(bitsperpixel), sizeof(*bitsperpixel)); } if (*bitsperpixel != 24) { // ensure its 3 bytes per pixel printf("Error: Invalid bitmap format - "); printf("This application only accepts 24-bit pictures.\n"); return(-1); } unsigned short data_offset = *(unsigned short *)(&(topdata[IMG_DATA_OFFSET_POS])); if (swap) { swap_bytes((char *)(&data_offset), sizeof(data_offset)); } data->data_bytes = (int)finfo.st_size - (int)data_offset; args->data_size = data->data_bytes; printf("This file has %d bytes of image data, %d pixels\n", data->data_bytes, data->data_bytes / 3); // Seek the FD to the beginning of the data lseek(data->fd, data_offset, SEEK_SET); data->offset = 0; return(0); }
void cipher_decrypt(CipherContext *context, unsigned char *dest, const unsigned char *src, unsigned int len) { if ((len & 7) != 0) fatal("cipher_decrypt: bad ciphertext length %d", len); switch (context->type) { case SSH_CIPHER_NONE: memcpy(dest, src, len); break; case SSH_CIPHER_3DES: SSH_3CBC_DECRYPT(context->u.des3.key1, context->u.des3.key2, &context->u.des3.iv2, context->u.des3.key3, &context->u.des3.iv3, dest, (unsigned char *) src, len); break; case SSH_CIPHER_BLOWFISH: swap_bytes(src, dest, len); BF_cbc_encrypt((void *) dest, dest, len, &context->u.bf.key, context->u.bf.iv, BF_DECRYPT); swap_bytes(dest, dest, len); break; case SSH_CIPHER_BLOWFISH_CBC: BF_cbc_encrypt((void *) src, dest, len, &context->u.bf.key, context->u.bf.iv, BF_DECRYPT); break; case SSH_CIPHER_3DES_CBC: des_ede3_cbc_encrypt(src, dest, len, context->u.des3.key1, context->u.des3.key2, context->u.des3.key3, &context->u.des3.iv3, DES_DECRYPT); break; case SSH_CIPHER_ARCFOUR: RC4(&context->u.rc4, len, (unsigned char *)src, dest); break; case SSH_CIPHER_CAST128_CBC: CAST_cbc_encrypt(src, dest, len, &context->u.cast.key, context->u.cast.iv, CAST_DECRYPT); break; default: fatal("cipher_decrypt: unknown cipher: %s", cipher_name(context->type)); } }
unsigned int Elf::GetProgramHeader(int i, void **data, unsigned int *vaddr, unsigned int *memsize, unsigned int *filesize) { if (i < 0 || (unsigned int)i >= GetNumProgramHeaders()) return false; Elf32_Phdr *p = &m_pProgramHeader[i]; *data = (void *)&((char *)m_pElf)[swap_bytes(p->p_offset, m_littleEndian)]; *vaddr = swap_bytes(p->p_vaddr, m_littleEndian); *memsize= swap_bytes(p->p_memsz, m_littleEndian); *filesize = swap_bytes(p->p_filesz, m_littleEndian); return swap_bytes(p->p_type, m_littleEndian); }
void unpackDataChunk_32bit(unsigned char* raw, float* outdata, int nbits, int nchans, unsigned int nsamps, enum endianness end, char isSigned, char isChannelInterleaved, int nsampStart, int nsampEnd, char swapChannels) { int i, channel, sample; int in, out, outchan; char swapem = 0; float* farr = (float*) raw; if(end!=INDEPENDANT){ swapem = endian() != end; } if (!isChannelInterleaved) { for (channel = 0; channel < nchans; channel++) { if (swapChannels) { outchan = nchans - channel - 1; } else { outchan = channel; } in = channel*nsamps; out = outchan*nsamps; for (sample = nsampStart; sample < nsampEnd; sample++) { outdata[out + sample] = farr[in + sample]; swap_bytes((unsigned int*) (&outdata[out + sample]), swapem); } } } else { farr += nsampStart * nchans; for (sample = nsampStart; sample < nsampEnd; sample++) { for (channel = 0; channel < nchans; channel++) { if (swapChannels) { out = (nchans - channel - 1) * nsamps + sample; outdata[out] = *farr; } else { out = (channel) * nsamps + sample; outdata[out] = *farr; } swap_bytes((unsigned int*) (&outdata[out]), swapem); farr++; } } } }
/** * Write speech data in little endian. * * @param buf [in] speech data * @param unitbyte [in] unit size in bytes * @param unitnum [in] number of units to be written * @param fp [in] file pointer * * @return TRUE on success (specified number of data has been written), FALSE on failure. */ static boolean mywrite(void *buf, size_t unitbyte, int unitnum, FILE *fp) { int tmp; #ifdef WORDS_BIGENDIAN if (unitbyte > 1) swap_bytes(buf, unitbyte, unitnum); #endif if ((tmp = myfwrite(buf, unitbyte, unitnum, fp)) < unitnum) { return(FALSE); } #ifdef WORDS_BIGENDIAN if (unitbyte > 1) swap_bytes(buf, unitbyte, unitnum); #endif return(TRUE); }
static void player_process(MSFilter *f){ PlayerData *d=(PlayerData*)f->data; int bytes=2*(f->ticker->interval*d->rate*d->nchannels)/1000; ms_filter_lock(f); if (d->state==STARTED){ int err; mblk_t *om=allocb(bytes,0); if (d->pause_time>0){ err=bytes; memset(om->b_wptr,0,bytes); d->pause_time-=f->ticker->interval; }else{ err=read(d->fd,om->b_wptr,bytes); if (d->swap) swap_bytes(om->b_wptr,bytes); } if (err>=0){ if (err!=0){ om->b_wptr+=bytes; ms_queue_put(f->outputs[0],om); }else freemsg(om); if (err<bytes){ ms_filter_notify_no_arg(f,MS_FILE_PLAYER_EOF); if (d->loop_after>=0){ lseek(d->fd,d->hsize,SEEK_SET); d->pause_time=d->loop_after; }else d->state=STOPPED; } }else{ ms_warning("Fail to read %i bytes: %s",bytes,strerror(errno)); } } ms_filter_unlock(f); }
/* * Encrypt some data using the supplied RC4 state buffer. * The input and output buffers may be the same buffer. * Since RC4 is a stream cypher, this function is used * for both encryption and decryption. */ void rc4_crypt( rc4_state* const state, const uint8_t *inbuf, uint8_t *outbuf, int buflen ) { int i; uint8_t j; for (i = 0; i < buflen; i++) { /* Update modification indicies */ state->index1++; state->index2 += state->perm[state->index1]; /* Modify permutation */ swap_bytes(&state->perm[state->index1], &state->perm[state->index2]); /* Encrypt/decrypt next byte */ j = state->perm[state->index1] + state->perm[state->index2]; outbuf[i] = inbuf[i] ^ state->perm[j]; } }
/** * Binary write function, with byte swapping if needed. * * @param fp [in] file pointer * @param buf [in] data buffer to write * @param unitbyte [in] unit size in bytes * @param unitnum [in] number of unit to write */ static boolean wrtfunc(FILE *fp, void *buf, size_t unitbyte, size_t unitnum) { if (need_swap == TRUE && unitbyte != 1) { swap_bytes((char *)buf, unitbyte, unitnum); } if (myfwrite(buf, unitbyte, unitnum, fp) < unitnum) { jlog("Error: write_ngram_bin: failed to write %d bytes", unitbyte*unitnum); return FALSE; } if (need_swap == TRUE && unitbyte != 1) { swap_bytes((char *)buf, unitbyte, unitnum); } count += unitbyte * unitnum; return TRUE; }
int RC4_init(unsigned char *key, unsigned char key_size, struct RC4_ctx *context){ if(DEBUG_MODE) printf("key: %s key_size: %d context: %d\n",key,key_size,context); // these two are needed for KSA unsigned char y; int x; context->i = 0; context->j = 0; // KSA: key-scheduling algorithm // Initialization for (x = 0; x < 256; x++) context->s[x] = (unsigned char) x; // Scrambling for (x = y = 0; x < 256; x++){ y += context->s[x] + key[x % key_size]; swap_bytes(&context->s[x],&context->s[y]); } return 0; }
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized GL520 uses a high-byte first convention, which is exactly opposite to the usual practice. */ int gl520_read_value(struct i2c_client *client, u8 reg) { if ((reg >= 0x07) && (reg <= 0x0c)) return swap_bytes(i2c_smbus_read_word_data(client, reg)); else return i2c_smbus_read_byte_data(client, reg); }
void OS::FRead_swap(void* buffer, int32 size, FILE* stream) { FRead(buffer, size, stream); int32* end = (int32*)((char*)buffer + size); for (int32* p = (int32*)buffer; p < end; p++) if (Memory->is_snapshot_other_endian) swap_bytes(p); }
/** * Send a file to be written at config.memory_address */ int send_file(void) { FILE* fd = NULL; /* Open the file */ if ((fd = fopen(config.filename, "r")) == NULL) { fprintf(stderr, "Error opening file %s.\n", config.filename); goto error_fopen; } if (config.verbose) fprintf(stderr, "File %s has been opened.\n", config.filename); /* Retreive file size */ get_file_size(&(config.data_size), fd); if (config.verbose) fprintf(stderr, "File size is: %d\n", config.data_size); /* Copy the file in memory */ if ((config.data = calloc(1, config.data_size + sizeof (edcl_header_t))) == NULL) { fprintf(stderr, "Error allocating memory.\n"); goto error_malloc; } fread(config.data, 1, config.data_size, fd); if (config.verbose) fprintf(stderr, "File has been copied in memory.\n"); /* Swap the file bytes if necessary */ if (config.big_endian) swap_bytes(config.data, config.data_size / 4); /* Send the file over the socket */ if (send_fragmented() != 0) goto error_send; if (config.verbose) fprintf(stderr, "File has been sent to the ethernet IP.\n"); /* Release ressources */ free(config.data); fclose(fd); return (0); error_send: fprintf(stderr, "Error when sending the file.\n"); free(config.data); error_malloc: fprintf(stderr, "Unable to allocate a packet.\n"); fclose(fd); error_fopen: return (errno); }
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized GL520 uses a high-byte first convention, which is exactly opposite to the usual practice. */ int gl520_write_value(struct i2c_client *client, u8 reg, u16 value) { if ((reg >= 0x07) && (reg <= 0x0c)) return i2c_smbus_write_word_data(client, reg, swap_bytes(value)); else return i2c_smbus_write_byte_data(client, reg, value); }
void vm_convert_to_host_endianness(char *value, size_t length) { int val; char *valp; val = 1; valp = (char *) &val; if (valp[0] == 0) { /* Host is big endian */ if (!is_big_endian) swap_bytes(value, length); } else { /* Host is little endian */ if (is_big_endian) swap_bytes(value, length); } }
static int write_header(int fd_dest, header_t *header, t_parser *parser) { int magic; int prog_size; magic = COREWAR_EXEC_MAGIC; swap_bytes((char *)&magic, sizeof(magic)); header->magic = magic; prog_size = parser->current_address; swap_bytes((char *)&prog_size, sizeof(int)); header->prog_size = prog_size; if (write(fd_dest, header, sizeof(*header)) == -1) { my_putstr_err("Cannot write in the file", 2); return (1); } return (0); }
void validate_patch(char *rom_name,char *patch_name) { u8 cpuf[51]; int z64_endianess; long destsize; if ((IO_GetcSingle(patch_file) != 1) || (IO_GetcSingle(patch_file) != 0)) return;//error_exit(ERROR_NO_APS,patch_name); IO_ReadSingle(cpuf,1,50,patch_file); cpuf[50] = 0; printf("- Info : %s\n",cpuf); z64_endianess = IO_GetcSingle(patch_file); *cpuf = IO_GetcSingle(rom_file); if ((z64_endianess && (*cpuf != 0x80)) || (!z64_endianess && (*cpuf != 0x37))) return;//error_exit(ERROR_WRONG_ENDIANESS,rom_name); IO_ReadSingle(cpuf,1,11,patch_file); IO_SeekSingle(0x3C,IO_SEEK_SET,rom_file); // Cart-ID+country-code IO_ReadSingle(cpuf+20,1,3,rom_file); if (!z64_endianess) cpuf[22] = IO_GetcSingle(rom_file); IO_SeekSingle(0x10,IO_SEEK_SET,rom_file); // CRCs IO_ReadSingle(cpuf+23,1,8,rom_file); if (!z64_endianess) { swap_bytes(&cpuf[20],2); swap_bytes(&cpuf[23],8); } if (memcmp(cpuf,cpuf+20,11)) return;//error_exit(ERROR_NOT_RIGHT_ROM,rom_name); IO_SeekSingle(74,IO_SEEK_SET,patch_file); // Skip future-expansion IO_ReadSingle(&destsize,4,1,patch_file); if (destsize != fsize(rom_file)) return;//error_exit(ERROR_NOT_RIGHT_ROM,rom_name); IO_SeekSingle(0,IO_SEEK_SET,rom_file); }
static void player_process(MSFilter *f){ PlayerData *d=(PlayerData*)f->data; int nsamples=(f->ticker->interval*d->rate*d->nchannels)/1000; int bytes; /*send an even number of samples each tick. At 22050Hz the number of samples per 10 ms chunk is odd. Odd size buffer of samples cause troubles to alsa. Fixing in alsa is difficult, so workaround here. */ if (nsamples & 0x1 ) { //odd number of samples if (d->count & 0x1 ) nsamples++; else nsamples--; } bytes=2*nsamples; d->count++; ms_filter_lock(f); if (d->state==STARTED){ int err; mblk_t *om=allocb(bytes,0); if (d->pause_time>0){ err=bytes; memset(om->b_wptr,0,bytes); d->pause_time-=f->ticker->interval; }else{ err=read(d->fd,om->b_wptr,bytes); if (d->swap) swap_bytes(om->b_wptr,bytes); } if (err>=0){ if (err!=0){ if (err<bytes) memset(om->b_wptr+err,0,bytes-err); om->b_wptr+=bytes; ms_queue_put(f->outputs[0],om); }else freemsg(om); if (err<bytes){ ms_filter_notify_no_arg(f,MS_FILE_PLAYER_EOF); lseek(d->fd,d->hsize,SEEK_SET); /* special value for playing file only once */ if (d->loop_after==-2) { d->state=STOPPED; ms_filter_unlock(f); return; } if (d->loop_after>=0){ d->pause_time=d->loop_after; } } }else{ ms_warning("Fail to read %i bytes: %s",bytes,strerror(errno)); } } ms_filter_unlock(f); }
void *Elf::FindSection(const char *name, unsigned int *length, unsigned int *vaddr) { if (!m_initialised) return 0; for (unsigned int count = 0; count < m_pHeader->e_shnum; count++) if (strcmp(name, &m_pSectionStrings[swap_bytes(m_pSectionHeader[count].sh_name, m_littleEndian)]) == 0) { if (length) *length = swap_bytes(m_pSectionHeader[count].sh_size, m_littleEndian); if (vaddr) *vaddr = swap_bytes(m_pSectionHeader[count].sh_addr, m_littleEndian); return (void *)&((char *)m_pElf)[swap_bytes(m_pSectionHeader[count].sh_offset, m_littleEndian)]; } return 0; }
// read a uint32_t from the transport uint32_t transport_read_uint32_t( Transport *tpt ) { union uint32_t_bytes ub; struct exception e; TRANSPORT_VERIFY_OPEN; transport_read_buffer ( tpt, ub.b, 4 ); if( tpt->net_little != tpt->loc_little ) swap_bytes( ( uint8_t * )ub.b, 4 ); return ub.i; }
// write a uint32_t to the transport void transport_write_uint32_t( Transport *tpt, uint32_t x ) { union uint32_t_bytes ub; struct exception e; TRANSPORT_VERIFY_OPEN; ub.i = ( uint32_t )x; if( tpt->net_little != tpt->loc_little ) swap_bytes( ( uint8_t * )ub.b, 4 ); transport_write_buffer( tpt, ub.b, 4 ); }
void fli_display_frame(struct fli_frame_header *fh, video_t dpy, unsigned short height, unsigned short width, char *buff, boolean_t lsb) { struct fli_chunk_header *ch; char *chunk_buff; int i; #if __alpha int size; #endif __alpha unsigned short chunks; chunks = fh->chunks; ch = (struct fli_chunk_header *)buff; while (chunks--) { unsigned short type; if(lsb) type = swap_bytes(ch->type); else type = ch->type; chunk_buff = (char *)((long)ch + (long)FLI_CHUNK_HEADER_SIZE); switch (type) { case FLI_CHUNK_4: fli_clr(dpy,0x8,chunk_buff,lsb); break; case FLI_CLR: fli_clr(dpy,0x6,chunk_buff,lsb); break; case FLI_LC: fli_lc(dpy, chunk_buff,lsb); break; case FLI_BLK: printf("fli_blk not implemented\n"); /* bzero(screen_buff,width * height);*/ break; case FLI_BRUN: fli_brun(dpy, height, width, chunk_buff,lsb); break; case FLI_CPY: printf("fli_cpy not implemented\n"); /* bcopy(chunk_buff,screen_buff, (* fli_image_size = *) fli_image_width * fli_image_height); */ break; case FLI_MINI: printf("fli_mini not implemented\n"); break; default: printf("Bad chunk with type = %d\n",type); } (long)ch += fli_size((char*)ch,FLI_CHUNK_HEADER_SIZE_OFFSET,lsb); } }