// position = file->tag.get_property((char*)"POSITION", position);
//printf("KeyFrame::load 1\n");
- int len = file->read_data_until((char*)"/KEYFRAME", data, MESSAGESIZE-1);
+ int len = file->read_data_until((char*)"/KEYFRAME", data, MESSAGESIZE-1, 1);
data[len] = 0;
//printf("KeyFrame::load 2 data=\n%s\nend of data\n", data);
}
}
void KeyFrame::update_parameter(BC_Hash *params,
- const char *text,
- char *extra)
+ const char *text, const char *extra)
{
FileXML output;
FileXML input;
void KeyFrame::get_diff(KeyFrame *src,
- BC_Hash **params,
- char **text,
- char **extra)
+ BC_Hash **params, char **text, char **extra)
{
- const int debug = 0;
- FileXML input;
- input.set_shared_input(data, strlen(data));
- BC_Hash this_params;
- char *this_text = 0;
- char *this_extra = 0;
- BC_Hash src_parameters;
- char *src_text = 0;
- char *src_extra = 0;
+ BC_Hash this_params; char *this_text = 0, *this_extra = 0;
+ BC_Hash src_params; char *src_text = 0, *src_extra = 0;
get_contents(&this_params, &this_text, &this_extra);
- src->get_contents(&src_parameters, &src_text, &src_extra);
-
-if(debug) printf("KeyFrame::get_diff %d %d %d\n",
-__LINE__,
-this_params.size(),
-src_parameters.size());
+ src->get_contents(&src_params, &src_text, &src_extra);
// Capture changed parameters
char this_value[BCTEXTLEN];
- for(int i = 0; i < MIN(this_params.size(), src_parameters.size()); i++)
- {
- const char *src_key = src_parameters.get_key(i);
- const char *src_value = src_parameters.get_value(i);
+ int m = MIN(this_params.size(), src_params.size());
+ for( int i=0; i<m; ++i ) {
+ const char *src_key = src_params.get_key(i);
+ const char *src_value = src_params.get_value(i);
this_value[0] = 0;
this_params.get(src_key, this_value);
-if(debug) printf("KeyFrame::get_diff %d %s %s %s\n",
-__LINE__,
-src_key,
-src_value,
-this_value);
// Capture values which differ
- if(strcmp(src_value, this_value))
- {
+ if( strcmp(src_value, this_value) ) {
if(!(*params)) (*params) = new BC_Hash;
(*params)->update(src_key, src_value);
}
// Capture text which differs
- if( !this_text || strcmp(this_text, src_text))
+ if( !this_text || strcmp(this_text, src_text) )
(*text) = cstrdup(src_text);
- if( !this_extra || strcmp(this_extra, src_extra))
+ if( !this_extra || strcmp(this_extra, src_extra) )
(*extra) = cstrdup(src_extra);
-
delete [] this_text;
delete [] this_extra;
delete [] src_text;