pike.git / src / modules / Image / encodings / wbf.c

version» Context lines:

pike.git/src/modules/Image/encodings/wbf.c:1:   #include "global.h"      #include <math.h>   #include <stdio.h>   #include <ctype.h>      #include "stralloc.h" - RCSID("$Id: wbf.c,v 1.4 2000/02/03 19:01:29 grubba Exp $"); + RCSID("$Id: wbf.c,v 1.5 2000/07/28 07:13:06 hubbe Exp $");   #include "pike_macros.h"   #include "object.h"   #include "mapping.h"   #include "constants.h"   #include "interpret.h"   #include "operators.h"   #include "svalue.h"   #include "threads.h"   #include "array.h"   #include "error.h"   #include "builtin_functions.h"   #include "program.h"         #include "image.h"   #include "builtin_functions.h"   #include "module_support.h"    -  + /* MUST BE INCLUDED LAST */ + #include "module_magic.h" +  +    extern struct program *image_program;      /*   **! module Image   **! submodule WBF   **! WAP WBF format   */      struct buffer   {
pike.git/src/modules/Image/encodings/wbf.c:73:    if(from->len)    {    res = from->str[0];    from->str++;    from->len--;    } else    error("Invalid data format\n");    return res;   }    - static int read_int( struct buffer *from ) + static int wbf_read_int( struct buffer *from )   {    int res = 0;    while( 1 )    {    int i = read_uchar( from );    res <<= 7;    res |= i&0x7f;    if( !(i & 0x80 ) )    break;    }
pike.git/src/modules/Image/encodings/wbf.c:100:    push_string( make_shared_binary_string( eh->name, eh->name_len ) );    push_constant_text( "value" );    push_string( make_shared_binary_string( eh->value, eh->value_len ) );    f_aggregate_mapping( 4 );   }      static struct wbf_header decode_header( struct buffer *data )   {    struct wbf_header res;    MEMSET( &res, 0, sizeof(res) ); -  res.type = read_int( data ); +  res.type = wbf_read_int( data );    res.fix_header_field = read_uchar( data );    if( res.fix_header_field & 0x80 )    {    switch( (res.fix_header_field>>5) & 0x3 )    {    case 0: /* Single varint extra header */ -  res.ext_header_field = read_int( data ); +  res.ext_header_field = wbf_read_int( data );    break;    case 1: /* reserved */    case 2: /* reserved */    case 3: /* Array of parameter/value */    {    int q = 0x80;       while( q & 0x80 )    {    struct ext_header *eh;
pike.git/src/modules/Image/encodings/wbf.c:131:    eh->name_len = ((q>>4) & 0x7) + 1;    eh->value_len = (q & 0xf) + 1;    read_string( data, eh->name_len, eh->name );    read_string( data, eh->value_len, eh->value );    eh->next = res.first_ext_header;    res.first_ext_header = eh->next;    }    }    }    } -  res.width = read_int( data ); -  res.height = read_int( data ); +  res.width = wbf_read_int( data ); +  res.height = wbf_read_int( data );    return res;   }      static void free_wbf_header_contents( struct wbf_header *wh )   {    while( wh->first_ext_header )    {    struct ext_header *eh = wh->first_ext_header;    wh->first_ext_header = eh->next;    free( eh );