46
46
inline bool is_system_table_name(const char *name, uint length);
48
static ulong get_form_pos(File file, uchar *head);
48
50
/**************************************************************************
49
51
Object_creation_ctx implementation.
50
52
**************************************************************************/
696
if (!(pos=get_form_pos(file,head,(TYPELIB*) 0)))
698
/* Position of the form in the form file. */
699
if (!(pos= get_form_pos(file, head)))
697
700
goto err; /* purecov: inspected */
699
702
share->frm_version= head[2];
2050
/* Find where a form starts */
2051
/* if formname is NullS then only formnames is read */
2053
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
2054
Find where a form starts.
2056
@param head The start of the form file.
2058
@remark If formname is NULL then only formnames is read.
2060
@retval The form position.
2063
static ulong get_form_pos(File file, uchar *head)
2055
uint a_length,names,length;
2057
2067
ulong ret_value=0;
2058
2068
DBUG_ENTER("get_form_pos");
2060
names=uint2korr(head+8);
2061
a_length=(names+2)*sizeof(char *); /* Room for two extra */
2066
save_names->type_names=0; /* Clear if error */
2070
length=uint2korr(head+4);
2071
VOID(my_seek(file,64L,MY_SEEK_SET,MYF(0)));
2072
if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4,
2074
my_read(file, buf+a_length, (size_t) (length+names*4),
2076
{ /* purecov: inspected */
2077
x_free((uchar*) buf); /* purecov: inspected */
2078
DBUG_RETURN(0L); /* purecov: inspected */
2080
pos= buf+a_length+length;
2081
ret_value=uint4korr(pos);
2086
my_free((uchar*) buf,MYF(0));
2089
bzero((char*) save_names,sizeof(save_names));
2093
str=(char *) (buf+a_length);
2094
fix_type_pointers((const char ***) &buf,save_names,1,&str);
2070
names= uint2korr(head+8);
2072
if (!(names= uint2korr(head+8)))
2075
length= uint2korr(head+4);
2077
my_seek(file, 64L, MY_SEEK_SET, MYF(0));
2079
if (!(buf= (uchar*) my_malloc(length+names*4, MYF(MY_WME))))
2082
if (my_read(file, buf, length+names*4, MYF(MY_NABP)))
2089
ret_value= uint4korr(pos);
2091
my_free(buf, MYF(0));
2096
2093
DBUG_RETURN(ret_value);