X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_property.c;h=1a458d86df47399769a3d63116551185619f17fd;hb=519393231e6ab626f19bd01d4622d1c3759fcc93;hp=0a475299d34855770d8a8fdb32eac6fd127a5dba;hpb=7c518e80321a87a22d2e48835442c9f5b70dcd17;p=melted diff --git a/src/framework/mlt_property.c b/src/framework/mlt_property.c index 0a47529..1a458d8 100644 --- a/src/framework/mlt_property.c +++ b/src/framework/mlt_property.c @@ -31,13 +31,27 @@ mlt_property mlt_property_init( ) { - return calloc( sizeof( struct mlt_property_s ), 1 ); + mlt_property this = malloc( sizeof( struct mlt_property_s ) ); + if ( this != NULL ) + { + this->types = 0; + this->prop_int = 0; + this->prop_position = 0; + this->prop_double = 0; + this->prop_int64 = 0; + this->prop_string = NULL; + this->data = NULL; + this->length = 0; + this->destructor = NULL; + this->serialiser = NULL; + } + return this; } /** Clear a property. */ -void mlt_property_clear( mlt_property this ) +static inline void mlt_property_clear( mlt_property this ) { // Special case data handling if ( this->types & mlt_prop_data && this->destructor != NULL ) @@ -47,8 +61,17 @@ void mlt_property_clear( mlt_property this ) if ( this->types & mlt_prop_string ) free( this->prop_string ); - // We can wipe it now. - memset( this, 0, sizeof( struct mlt_property_s ) ); + // Wipe stuff + this->types = 0; + this->prop_int = 0; + this->prop_position = 0; + this->prop_double = 0; + this->prop_int64 = 0; + this->prop_string = NULL; + this->data = NULL; + this->length = 0; + this->destructor = NULL; + this->serialiser = NULL; } /** Set an int on this property. @@ -93,7 +116,7 @@ int mlt_property_set_string( mlt_property this, char *value ) this->types = mlt_prop_string; if ( value != NULL ) this->prop_string = strdup( value ); - return this->prop_string != NULL; + return this->prop_string == NULL; } /** Set an int64 on this property. @@ -219,7 +242,7 @@ char *mlt_property_get_string( mlt_property this ) { this->types |= mlt_prop_string; this->prop_string = malloc( 32 ); - sprintf( this->prop_string, "%lld", this->prop_position ); + sprintf( this->prop_string, "%d", this->prop_position ); } else if ( this->types & mlt_prop_int64 ) {