typedef struct tag_outputstate output_state;
typedef void (*output_func)(tuple* this,output_state* out);
-typedef void (*read_col_func)(const char**f);
+typedef void (*read_col_func)(const uchar**f);
double *last_point=NULL;
/* External functions */
-extern void init_parser(const char *);
+extern void init_parser(const uchar *);
/* Prototypes */
tuple* alloc_tuple(output_func of,size_t size);
void alloc_counter(void);
void alloc_empty(void);
uchar* make_lwgeom(void);
-uchar strhex_readbyte(const char* in);
-uchar read_wkb_byte(const char** in);
-void read_wkb_bytes(const char** in,uchar* out, int cnt);
-int4 read_wkb_int(const char** in);
-double read_wbk_double(const char** in,int convert_from_int);
-void read_wkb_point(const char** b);
-void read_collection(const char** b,read_col_func f);
-void read_collection2(const char** b);
-void parse_wkb(const char** b);
-void alloc_wkb(const char* parser);
-uchar* parse_it(const char* geometry,allocator allocfunc,report_error errfunc);
-uchar* parse_lwg(const char* geometry,allocator allocfunc,report_error errfunc);
-uchar* parse_lwgi(const char* geometry,allocator allocfunc,report_error errfunc);
+uchar strhex_readbyte(const uchar* in);
+uchar read_wkb_byte(const uchar** in);
+void read_wkb_bytes(const uchar** in,uchar* out, int cnt);
+int4 read_wkb_int(const uchar** in);
+double read_wkb_double(const uchar** in,int convert_from_int);
+void read_wkb_point(const uchar** b);
+void read_collection(const uchar** b,read_col_func f);
+void read_collection2(const uchar** b);
+void parse_wkb(const uchar** b);
+void alloc_wkb(const uchar* parser);
+uchar* parse_it(const uchar* geometry,allocator allocfunc,report_error errfunc);
+uchar* parse_lwg(const uchar* geometry,allocator allocfunc,report_error errfunc);
+uchar* parse_lwgi(const uchar* geometry,allocator allocfunc,report_error errfunc);
void
set_srid(double d_srid)
255,255,255,255,255,255,255,255};
uchar
-strhex_readbyte(const char* in)
+strhex_readbyte(const uchar* in)
{
if ( *in == 0 ){
if ( ! ferror_occured){
}
uchar
-read_wkb_byte(const char** in)
+read_wkb_byte(const uchar** in)
{
uchar ret = strhex_readbyte(*in);
(*in)+=2;
int swap_order;
void
-read_wkb_bytes(const char** in,uchar* out, int cnt)
+read_wkb_bytes(const uchar** in,uchar* out, int cnt)
{
if ( ! swap_order ){
while(cnt--) *out++ = read_wkb_byte(in);
}
int4
-read_wkb_int(const char** in)
+read_wkb_int(const uchar** in)
{
- int4 ret;
+ int4 ret=0;
read_wkb_bytes(in,(uchar*)&ret,4);
return ret;
}
double
-read_wbk_double(const char** in,int convert_from_int)
+read_wkb_double(const uchar** in,int convert_from_int)
{
- double ret;
+ double ret=0;
if ( ! convert_from_int){
read_wkb_bytes(in,(uchar*)&ret,8);
}
void
-read_wkb_point(const char** b)
+read_wkb_point(const uchar** b)
{
int i;
tuple* p = NULL;
}
for(i=0;i<the_geom.ndims;i++){
- p->uu.points[i]=read_wbk_double(b,the_geom.from_lwgi);
+ p->uu.points[i]=read_wkb_double(b,the_geom.from_lwgi);
}
}
}
void
-read_collection(const char** b,read_col_func f)
+read_collection(const uchar** b,read_col_func f)
{
int4 cnt=read_wkb_int(b);
alloc_counter();
}
void
-read_collection2(const char** b)
+read_collection2(const uchar** b)
{
return read_collection(b,read_wkb_point);
}
void
-parse_wkb(const char** b)
+parse_wkb(const uchar** b)
{
int4 type;
uchar xdr = read_wkb_byte(b);
void
-alloc_wkb(const char* parser)
+alloc_wkb(const uchar* parser)
{
parse_wkb(&parser);
}
Parse a string and return a LW_GEOM
*/
uchar *
-parse_it(const char* geometry,allocator allocfunc,report_error errfunc)
+parse_it(const uchar* geometry,allocator allocfunc,report_error errfunc)
{
local_malloc = allocfunc;
}
uchar *
-parse_lwg(const char* geometry,allocator allocfunc,report_error errfunc)
+parse_lwg(const uchar* geometry,allocator allocfunc,report_error errfunc)
{
the_geom.lwgi=0;
return parse_it(geometry,allocfunc,errfunc);
}
uchar *
-parse_lwgi(const char* geometry,allocator allocfunc,report_error errfunc)
+parse_lwgi(const uchar* geometry,allocator allocfunc,report_error errfunc)
{
the_geom.lwgi=1;
return parse_it(geometry,allocfunc,errfunc);