bool BackupRestore::map_in_frm(char *new_data, const char *data, uint data_len, uint *new_data_len) { const char *end_data= data + data_len; const char *end_part_data; const char *part_data; char *extra_ptr; uint start_key_definition_len = uint2korr(data + 6); uint key_definition_len = uint4korr(data + 47); uint part_info_len; DBUG_ENTER("map_in_frm"); if (data_len < 4096) goto error; extra_ptr = (char*)data + start_key_definition_len + key_definition_len; if ((int)data_len < ((extra_ptr - data) + 2)) goto error; extra_ptr = extra_ptr + 2 + uint2korr(extra_ptr); if ((int)data_len < ((extra_ptr - data) + 2)) goto error; extra_ptr = extra_ptr + 2 + uint2korr(extra_ptr); if ((int)data_len < ((extra_ptr - data) + 4)) goto error; part_info_len = uint4korr(extra_ptr); part_data = extra_ptr + 4; if ((int)data_len < ((part_data + part_info_len) - data)) goto error; do { copy_byte(&data, &new_data, new_data_len); } while (data < part_data); end_part_data = part_data + part_info_len; do { if (search_replace((char*)" NODEGROUP = ", &new_data, &data, end_part_data, new_data_len)) goto error; } while (data != end_part_data); do { copy_byte(&data, &new_data, new_data_len); } while (data < end_data); DBUG_RETURN(FALSE); error: DBUG_RETURN(TRUE); }
/*! \brief Formats C code by adding whitespace. * \param in The string containing the C source code. * \returns A formatted version of the C code. */ inline std::string format_code(std::string in) { return search_replace(in,";",";\n"); }