]> git.sesse.net Git - mlt/commitdiff
Merge pull request #6 from mcfrisk/coverity
authorDan Dennedy <dan@dennedy.org>
Mon, 30 Jul 2012 03:36:14 +0000 (20:36 -0700)
committerDan Dennedy <dan@dennedy.org>
Mon, 30 Jul 2012 03:36:14 +0000 (20:36 -0700)
Coverity fixes

34 files changed:
src/framework/mlt_field.c
src/framework/mlt_filter.c
src/framework/mlt_frame.c
src/framework/mlt_multitrack.c
src/framework/mlt_playlist.c
src/framework/mlt_producer.c
src/framework/mlt_properties.c
src/framework/mlt_property.c
src/framework/mlt_repository.c
src/framework/mlt_service.c
src/framework/mlt_tractor.c
src/modules/core/filter_audioconvert.c
src/modules/core/filter_crop.c
src/modules/core/filter_imageconvert.c
src/modules/core/filter_panner.c
src/modules/core/filter_resize.c
src/modules/core/producer_ppm.c
src/modules/core/transition_composite.c
src/modules/core/transition_mix.c
src/modules/dv/producer_libdv.c
src/modules/gtk2/producer_pango.c
src/modules/gtk2/producer_pixbuf.c
src/modules/kino/producer_kino.c
src/modules/linsys/consumer_SDIstream.c
src/modules/normalize/filter_volume.c
src/modules/qimage/producer_kdenlivetitle.c
src/modules/qimage/producer_qimage.c
src/modules/rtaudio/RtAudio.cpp
src/modules/sdl/consumer_sdl.c
src/modules/sdl/consumer_sdl_audio.c
src/modules/sdl/consumer_sdl_preview.c
src/modules/sdl/consumer_sdl_still.c
src/modules/xml/consumer_xml.c
src/modules/xml/producer_xml.c

index 6dc822808d8d98d02d791a7125e452f803e798c5..95c92b96575205dd441ed627f65e5afbcbac75f4 100644 (file)
@@ -57,7 +57,7 @@ struct mlt_field_s
 mlt_field mlt_field_init( )
 {
        // Initialise the field
-       mlt_field self = calloc( sizeof( struct mlt_field_s ), 1 );
+       mlt_field self = calloc( 1, sizeof( struct mlt_field_s ) );
 
        // Initialise it
        if ( self != NULL )
@@ -90,7 +90,7 @@ mlt_field mlt_field_init( )
 mlt_field mlt_field_new( mlt_multitrack multitrack, mlt_tractor tractor )
 {
        // Initialise the field
-       mlt_field self = calloc( sizeof( struct mlt_field_s ), 1 );
+       mlt_field self = calloc( 1, sizeof( struct mlt_field_s ) );
 
        // Initialise it
        if ( self != NULL )
index 19f6f25fd9aa04597aec0a319691d9fdd2d745fb..ed4d9192c32c43e8fe96f26ae053d699a9bcffb9 100644 (file)
@@ -74,9 +74,15 @@ int mlt_filter_init( mlt_filter self, void *child )
 mlt_filter mlt_filter_new( )
 {
        mlt_filter self = calloc( 1, sizeof( struct mlt_filter_s ) );
-       if ( self != NULL )
-               mlt_filter_init( self, NULL );
-       return self;
+       if ( self != NULL && mlt_filter_init( self, NULL ) == 0 )
+       {
+               return self;
+       }
+       else
+       {
+               free(self);
+               return NULL;
+       }
 }
 
 /** Get the service class interface.
@@ -253,8 +259,8 @@ mlt_position mlt_filter_get_position( mlt_filter self, mlt_frame frame )
        char name[20];
 
        // Make the properties key from unique id
-       strcpy( name, "pos." );
-       strcat( name, unique_id );
+       snprintf( name, 20, "pos.%s", unique_id );
+       name[20 - 1] = '\0';
 
        return mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ) - in;
 }
@@ -298,8 +304,8 @@ mlt_frame mlt_filter_process( mlt_filter self, mlt_frame frame )
        char name[20];
 
        // Make the properties key from unique id
-       strcpy( name, "pos." );
-       strcat( name, unique_id );
+       snprintf( name, 20, "pos.%s", unique_id );
+       name[20 -1] = '\0';
 
        // Save the position on the frame
        mlt_properties_set_position( MLT_FRAME_PROPERTIES( frame ), name, position );
index 893be3d08c0493ec0fb7cc62eb6af6cf7143ad2b..c05aebb18ab81c938858b8648b1caf45fc3fb7e5 100644 (file)
@@ -41,7 +41,7 @@
 mlt_frame mlt_frame_init( mlt_service service )
 {
        // Allocate a frame
-       mlt_frame self = calloc( sizeof( struct mlt_frame_s ), 1 );
+       mlt_frame self = calloc( 1, sizeof( struct mlt_frame_s ) );
 
        if ( self != NULL )
        {
@@ -801,6 +801,8 @@ unsigned char *mlt_frame_get_waveform( mlt_frame self, int w, int h )
        unsigned char *bitmap = ( unsigned char* )mlt_pool_alloc( size );
        if ( bitmap != NULL )
                memset( bitmap, 0, size );
+       else
+               return NULL;
        mlt_properties_set_data( properties, "waveform", bitmap, size, ( mlt_destructor )mlt_pool_release, NULL );
 
        // Render vertical lines
index 8fcef9b9a89174be7fe960d24723a766edd38cb5..463090729b2fb845ed78e4e31e55631118c76b86 100644 (file)
@@ -43,7 +43,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 mlt_multitrack mlt_multitrack_init( )
 {
        // Allocate the multitrack object
-       mlt_multitrack self = calloc( sizeof( struct mlt_multitrack_s ), 1 );
+       mlt_multitrack self = calloc( 1, sizeof( struct mlt_multitrack_s ) );
 
        if ( self != NULL )
        {
index ee81b20a7b3ce6108361625af230832926119a10..79fbd8bf65a82af2bceea710ccdd44abe0bbc7af 100644 (file)
@@ -64,13 +64,13 @@ static int mlt_playlist_resize_mix( mlt_playlist self, int clip, int in, int out
 
 mlt_playlist mlt_playlist_init( )
 {
-       mlt_playlist self = calloc( sizeof( struct mlt_playlist_s ), 1 );
+       mlt_playlist self = calloc( 1, sizeof( struct mlt_playlist_s ) );
        if ( self != NULL )
        {
                mlt_producer producer = &self->parent;
 
                // Construct the producer
-               mlt_producer_init( producer, self );
+               if ( mlt_producer_init( producer, self ) != 0 ) goto error1;
 
                // Override the producer get_frame
                producer->get_frame = producer_get_frame;
@@ -80,7 +80,7 @@ mlt_playlist mlt_playlist_init( )
                producer->close_object = self;
 
                // Initialise blank
-               mlt_producer_init( &self->blank, NULL );
+               if ( mlt_producer_init( &self->blank, NULL ) != 0 ) goto error1;
                mlt_properties_set( MLT_PRODUCER_PROPERTIES( &self->blank ), "mlt_service", "blank" );
                mlt_properties_set( MLT_PRODUCER_PROPERTIES( &self->blank ), "resource", "blank" );
 
@@ -96,10 +96,17 @@ mlt_playlist mlt_playlist_init( )
                mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( self ), "length", 0 );
 
                self->size = 10;
-               self->list = malloc( self->size * sizeof( playlist_entry * ) );
+               self->list = calloc( self->size, sizeof( playlist_entry * ) );
+               if ( self->list == NULL ) goto error2;
+               
        }
 
        return self;
+error2:
+       free( self->list );
+error1:
+       free( self );
+       return NULL;
 }
 
 /** Construct a playlist with a profile.
@@ -329,7 +336,7 @@ static int mlt_playlist_virtual_append( mlt_playlist self, mlt_producer source,
        }
 
        // Create the entry
-       self->list[ self->count ] = calloc( sizeof( playlist_entry ), 1 );
+       self->list[ self->count ] = calloc( 1, sizeof( playlist_entry ) );
        if ( self->list[ self->count ] != NULL )
        {
                self->list[ self->count ]->producer = producer;
index b37958197855d193f72c085ee1216de267297fa8..6e33edf32deb22b4bb0b2797c1466bcfe0c1ef1e 100644 (file)
@@ -156,6 +156,11 @@ mlt_producer mlt_producer_new( mlt_profile profile )
                        mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( self ), "_profile", profile, 0, NULL, NULL );
                        mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( self ), "aspect_ratio", mlt_profile_sar( profile ) );
                }
+               else
+               {
+                       free( self );
+                       return NULL;
+               }
        }
        return self;
 }
@@ -312,7 +317,7 @@ int mlt_producer_seek( mlt_producer self, mlt_position position )
                mlt_producer_set_speed( self, 0 );
                position = mlt_producer_get_playtime( self ) - 1;
        }
-       else if ( use_points && !strcmp( eof, "loop" ) && position >= mlt_producer_get_playtime( self ) )
+       else if ( use_points && eof && !strcmp( eof, "loop" ) && position >= mlt_producer_get_playtime( self ) )
        {
                position = (int)position % (int)mlt_producer_get_playtime( self );
        }
index 6982ccafcbaeedc630c880d2f40accb11abcc9fc..6d8ef08bb92f491dfe9898603e82280e9403e5d4 100644 (file)
@@ -91,7 +91,7 @@ int mlt_properties_init( mlt_properties self, void *child )
                self->child = child;
 
                // Allocate the local structure
-               self->local = calloc( sizeof( property_list ), 1 );
+               self->local = calloc( 1, sizeof( property_list ) );
 
                // Increment the ref count
                ( ( property_list * )self->local )->ref_count = 1;
@@ -113,7 +113,7 @@ int mlt_properties_init( mlt_properties self, void *child )
 mlt_properties mlt_properties_new( )
 {
        // Construct a standalone properties object
-       mlt_properties self = calloc( sizeof( struct mlt_properties_s ), 1 );
+       mlt_properties self = calloc( 1, sizeof( struct mlt_properties_s ) );
 
        // Initialise self
        mlt_properties_init( self, NULL );
index 7a518ff443598d2977e02e7a05ee1a48f78b1d0b..4d5f57c7c53ed84c1c7acadc77e90e6c0beaf796 100644 (file)
@@ -864,6 +864,11 @@ char *mlt_property_get_time( mlt_property self, mlt_time_format format, double f
                // Set the new locale
                setlocale( LC_NUMERIC, localename );
        }
+       else
+       {
+               // Make sure we have a lock before accessing self->types
+               pthread_mutex_lock( &self->mutex );
+       }
 
        // Convert number to string
        if ( self->types & mlt_prop_int )
@@ -910,6 +915,11 @@ char *mlt_property_get_time( mlt_property self, mlt_time_format format, double f
                free( orig_localename );
                pthread_mutex_unlock( &self->mutex );
        }
+       else
+       {
+               // Make sure we have a lock before accessing self->types
+               pthread_mutex_unlock( &self->mutex );
+       }
 
        // Return the string (may be NULL)
        return self->prop_string;
index acda89cc6272e4e007f75f44c5c9a590951e1ef8..e5e5e79388458f3d31fd46f22edafb8d9fcf51a6 100644 (file)
@@ -70,7 +70,7 @@ mlt_repository mlt_repository_init( const char *directory )
                return NULL;
 
        // Construct the repository
-       mlt_repository self = calloc( sizeof( struct mlt_repository_s ), 1 );
+       mlt_repository self = calloc( 1, sizeof( struct mlt_repository_s ));
        mlt_properties_init( &self->parent, self );
        self->consumers = mlt_properties_new();
        self->filters = mlt_properties_new();
index bfcc91349870699a4cc030ac88e25862f60c8c44..7e66451e58fde039d7149c1d4fc896a6568127a0 100644 (file)
@@ -87,7 +87,7 @@ int mlt_service_init( mlt_service self, void *child )
        self->child = child;
 
        // Generate local space
-       self->local = calloc( sizeof( mlt_service_base ), 1 );
+       self->local = calloc( 1, sizeof( mlt_service_base ) );
 
        // Associate the methods
        self->get_frame = service_get_frame;
index acd49ed867a2edce2b3efccd94a75bc048733ecd..b39b194937b18b0a63f31d7d95e9625da5fc2c2c 100644 (file)
@@ -49,7 +49,7 @@ static void mlt_tractor_listener( mlt_multitrack tracks, mlt_tractor self );
 
 mlt_tractor mlt_tractor_init( )
 {
-       mlt_tractor self = calloc( sizeof( struct mlt_tractor_s ), 1 );
+       mlt_tractor self = calloc( 1, sizeof( struct mlt_tractor_s ) );
        if ( self != NULL )
        {
                mlt_producer producer = &self->parent;
@@ -88,7 +88,7 @@ mlt_tractor mlt_tractor_init( )
 
 mlt_tractor mlt_tractor_new( )
 {
-       mlt_tractor self = calloc( sizeof( struct mlt_tractor_s ), 1 );
+       mlt_tractor self = calloc( 1, sizeof( struct mlt_tractor_s ) );
        if ( self != NULL )
        {
                mlt_producer producer = &self->parent;
index d1f7cb33bb416cfc4dbe5d903230b9ca366dca69..67b78ea61ef6d0f2b082906eea16b3aa703c3e5f 100644 (file)
@@ -419,7 +419,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 
 mlt_filter filter_audioconvert_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter this = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( mlt_filter_init( this, this ) == 0 )
                this->process = filter_process;
        return this;
index f8ba65ed2ae4aee82ae14e8e65e5dfad15483cc5..1969fdb18c479978814dd5f5f4d80368d26670e0 100644 (file)
@@ -225,7 +225,7 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
 
 mlt_filter filter_crop_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter filter = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter filter = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( mlt_filter_init( filter, filter ) == 0 )
        {
                filter->process = filter_process;
index 001618575328ad389f7cbf0f0758837e4db34031..f651f172a067b67955effd116690c0c90e42e59e 100644 (file)
@@ -381,7 +381,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 
 mlt_filter filter_imageconvert_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter this = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( mlt_filter_init( this, this ) == 0 )
        {
                this->process = filter_process;
index 6ce55d9c984b1f4d278f8adbf78f189e21a9b6ba..88009b20a2010c00539e9ea3fecad23eb9e3afa8 100644 (file)
@@ -292,7 +292,7 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
 
 mlt_filter filter_panner_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter filter = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter filter = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( filter != NULL && mlt_filter_init( filter, NULL ) == 0 )
        {
                filter->process = filter_process;
index 17a6aa389d186b8e60ec7246033b92a4ea17ff4c..d3e4ca344632738e9bdfe7cf8e3838bb7d75ef30 100644 (file)
@@ -286,7 +286,7 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
 
 mlt_filter filter_resize_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter filter = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter filter = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( mlt_filter_init( filter, filter ) == 0 )
        {
                filter->process = filter_process;
index 929d663369ec0c038337a91f98c70bdd00fc6d1d..cda58c046541247b208beed091b8484fdfb0c3f1 100644 (file)
@@ -40,7 +40,7 @@ static void producer_close( mlt_producer parent );
 
 mlt_producer producer_ppm_init( mlt_profile profile, mlt_service_type type, const char *id, char *command )
 {
-       producer_ppm this = calloc( sizeof( struct producer_ppm_s ), 1 );
+       producer_ppm this = calloc( 1, sizeof( struct producer_ppm_s ) );
        if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
        {
                mlt_producer producer = &this->parent;
index 8aa8a6163abc93d6be2ed3078179a4b62e1534f1..49d01f5d9c49181002e8c1ea5689628536ed23d1 100644 (file)
@@ -1327,7 +1327,7 @@ static mlt_frame composite_process( mlt_transition self, mlt_frame a_frame, mlt_
 
 mlt_transition transition_composite_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_transition self = calloc( sizeof( struct mlt_transition_s ), 1 );
+       mlt_transition self = calloc( 1, sizeof( struct mlt_transition_s ) );
        if ( self != NULL && mlt_transition_init( self, NULL ) == 0 )
        {
                mlt_properties properties = MLT_TRANSITION_PROPERTIES( self );
index e265366303e69b27f37d554ad8e698b96a401a7e..d40a5041b3dfced7d636147ad38cf4cab7772bfe 100644 (file)
@@ -295,7 +295,7 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt
 
 mlt_transition transition_mix_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_transition this = calloc( sizeof( struct mlt_transition_s ), 1 );
+       mlt_transition this = calloc( 1, sizeof( struct mlt_transition_s ) );
        if ( this != NULL && mlt_transition_init( this, NULL ) == 0 )
        {
                this->process = transition_process;
index cef5ef3c6d4735b4a62664e6c22696ed1cb5f743..f3f1ce4b72d5717071f2b397350ab2585a4a8627 100644 (file)
@@ -138,7 +138,7 @@ static int producer_collect_info( producer_libdv this, mlt_profile profile );
 
 mlt_producer producer_libdv_init( mlt_profile profile, mlt_service_type type, const char *id, char *filename )
 {
-       producer_libdv this = calloc( sizeof( struct producer_libdv_s ), 1 );
+       producer_libdv this = calloc( 1, sizeof( struct producer_libdv_s ) );
 
        if ( filename != NULL && this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
        {
index 483990696184b301cf21fcf2f51c9e1590a0abe2..3322dd5b636041c4b2334cbf3844b4bd6eedce7d 100644 (file)
@@ -123,7 +123,7 @@ static PangoFT2FontMap *fontmap = NULL;
 
 mlt_producer producer_pango_init( const char *filename )
 {
-       producer_pango this = calloc( sizeof( struct producer_pango_s ), 1 );
+       producer_pango this = calloc( 1, sizeof( struct producer_pango_s ) );
        if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
        {
                mlt_producer producer = &this->parent;
index 48d2032e607c023f4217b6df63bbe5c8da0f9023..d1e15eaf2b562e74e4526e58ba2f80b60149e638 100644 (file)
@@ -73,7 +73,7 @@ static void producer_close( mlt_producer parent );
 
 mlt_producer producer_pixbuf_init( char *filename )
 {
-       producer_pixbuf self = calloc( sizeof( struct producer_pixbuf_s ), 1 );
+       producer_pixbuf self = calloc( 1, sizeof( struct producer_pixbuf_s ) );
        if ( self != NULL && mlt_producer_init( &self->parent, self ) == 0 )
        {
                mlt_producer producer = &self->parent;
index 7f94a9e78f149e350c2d0bda90128a6a8ca02930..6e0ef767d50a038bd702c1b974fb132cf060822c 100644 (file)
@@ -47,7 +47,7 @@ mlt_producer producer_kino_init( mlt_profile profile, mlt_service_type type, con
 
        if ( kino_wrapper_open( wrapper, filename ) )
        {
-               producer_kino this = calloc( sizeof( struct producer_kino_s ), 1 );
+               producer_kino this = calloc( 1, sizeof( struct producer_kino_s ) );
 
                if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
                {
index ef4ac37ff07c454551cc723f1fd5c6b4964bd0b1..fa77155d83923d9a9d68ad14fdc41074ede92829 100644 (file)
@@ -211,7 +211,7 @@ int convertYCBCRtoRGB(int y1, int cb, int cr, int y2, uint8_t * target_rgb);
 mlt_consumer consumer_SDIstream_init(mlt_profile profile, mlt_service_type type, const char *id, char *arg) {
 
        // Create the consumer object
-       consumer_SDIstream this = calloc(sizeof(struct consumer_SDIstream_s), 1);
+       consumer_SDIstream this = calloc( 1, sizeof(struct consumer_SDIstream_s) );
 
        // If malloc and consumer init ok
        if (this != NULL && mlt_consumer_init(&this->parent, this, profile) == 0) {
index 2b294cbe19adf432408c051ca42ad2c04265f7c7..8b0ccd6059dde0db3ca81ad380eb30af33474441 100644 (file)
@@ -445,7 +445,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 
 mlt_filter filter_volume_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter this = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( this != NULL && mlt_filter_init( this, NULL ) == 0 )
        {
                mlt_properties properties = MLT_FILTER_PROPERTIES( this );
index 5c37d3a348f4d9994ef5d8b46b0fdf27998129b6..693538be0b921f390a57edcbca4fe64421d8016e 100644 (file)
@@ -147,7 +147,7 @@ mlt_producer producer_kdenlivetitle_init( mlt_profile profile, mlt_service_type
        /* fprintf(stderr, ":::::::::::: CREATE TITLE\n"); */
        /* Create a new producer object */
        
-       producer_ktitle this = calloc( sizeof( struct producer_ktitle_s ), 1 );
+       producer_ktitle this = calloc( 1, sizeof( struct producer_ktitle_s ) );
        if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
        {
                mlt_producer producer = &this->parent;
index 3896d118f448d66e4c0fdb0ad5e540a41cd8ff3f..76b96893ef42169df58098709a2ae2a5bdcf3590 100644 (file)
@@ -40,7 +40,7 @@ static void producer_close( mlt_producer parent );
 
 mlt_producer producer_qimage_init( mlt_profile profile, mlt_service_type type, const char *id, char *filename )
 {
-       producer_qimage self = calloc( sizeof( struct producer_qimage_s ), 1 );
+       producer_qimage self = calloc( 1, sizeof( struct producer_qimage_s ) );
        if ( self != NULL && mlt_producer_init( &self->parent, self ) == 0 )
        {
                mlt_producer producer = &self->parent;
index 2bdd89b9884bbc22d590d35fea9ab9e3f3eb17f2..249fa2567fb7a28ca9aae48871115d4485e14f27 100644 (file)
@@ -1193,7 +1193,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
   // Allocate necessary internal buffers.\r
   unsigned long bufferBytes;\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  //  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  //  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   stream_.userBuffer[mode] = (char *) malloc( bufferBytes * sizeof(char) );\r
   memset( stream_.userBuffer[mode], 0, bufferBytes * sizeof(char) );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
@@ -1218,7 +1218,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiCore::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
@@ -2124,7 +2124,7 @@ bool RtApiJack :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
   // Allocate necessary internal buffers.\r
   unsigned long bufferBytes;\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
     errorText_ = "RtApiJack::probeDeviceOpen: error allocating user buffer memory.";\r
     goto error;\r
@@ -2146,7 +2146,7 @@ bool RtApiJack :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiJack::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
@@ -2999,7 +2999,7 @@ bool RtApiAsio :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
   // Allocate necessary internal buffers\r
   unsigned long bufferBytes;\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
     errorText_ = "RtApiAsio::probeDeviceOpen: error allocating user buffer memory.";\r
     goto error;\r
@@ -3019,7 +3019,7 @@ bool RtApiAsio :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiAsio::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
@@ -4216,7 +4216,7 @@ bool RtApiDs :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
 \r
   // Allocate necessary internal buffers\r
   long bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
     errorText_ = "RtApiDs::probeDeviceOpen: error allocating user buffer memory.";\r
     goto error;\r
@@ -4236,7 +4236,7 @@ bool RtApiDs :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiDs::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
@@ -5848,7 +5848,7 @@ bool RtApiAlsa :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
   // Allocate necessary internal buffers.\r
   unsigned long bufferBytes;\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
     errorText_ = "RtApiAlsa::probeDeviceOpen: error allocating user buffer memory.";\r
     goto error;\r
@@ -5868,7 +5868,7 @@ bool RtApiAlsa :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiAlsa::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
@@ -6858,7 +6858,7 @@ bool RtApiOss :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
   // Allocate necessary internal buffers.\r
   unsigned long bufferBytes;\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
-  stream_.userBuffer[mode] = (char *) calloc( bufferBytes, 1 );\r
+  stream_.userBuffer[mode] = (char *) calloc( 1, bufferBytes );\r
   if ( stream_.userBuffer[mode] == NULL ) {\r
     errorText_ = "RtApiOss::probeDeviceOpen: error allocating user buffer memory.";\r
     goto error;\r
@@ -6878,7 +6878,7 @@ bool RtApiOss :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
     if ( makeBuffer ) {\r
       bufferBytes *= *bufferSize;\r
       if ( stream_.deviceBuffer ) free( stream_.deviceBuffer );\r
-      stream_.deviceBuffer = (char *) calloc( bufferBytes, 1 );\r
+      stream_.deviceBuffer = (char *) calloc( 1, bufferBytes );\r
       if ( stream_.deviceBuffer == NULL ) {\r
         errorText_ = "RtApiOss::probeDeviceOpen: error allocating device buffer memory.";\r
         goto error;\r
index 1f8b9ce4e9f2b86936cf70647fdbd8bf4bd6d77a..4c9489cb6ba2ec71bd932bfd0af7cd6406c9c159 100644 (file)
@@ -87,7 +87,7 @@ static void consumer_sdl_event( mlt_listener listener, mlt_properties owner, mlt
 mlt_consumer consumer_sdl_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        // Create the consumer object
-       consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 );
+       consumer_sdl this = calloc( 1, sizeof( struct consumer_sdl_s ) );
 
        // If no malloc'd and consumer init ok
        if ( this != NULL && mlt_consumer_init( &this->parent, this, profile ) == 0 )
index 266580e3d7ee1f3b493b301f5a6ba6c704b34eb2..8db5fe2c66c521481306ab6133740fb3af4aa6f0 100644 (file)
@@ -76,7 +76,7 @@ static void consumer_refresh_cb( mlt_consumer sdl, mlt_consumer self, char *name
 mlt_consumer consumer_sdl_audio_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        // Create the consumer object
-       consumer_sdl self = calloc( sizeof( struct consumer_sdl_s ), 1 );
+       consumer_sdl self = calloc( 1, sizeof( struct consumer_sdl_s ) );
 
        // If no malloc'd and consumer init ok
        if ( self != NULL && mlt_consumer_init( &self->parent, self, profile ) == 0 )
index bd5fe3661473a8ab2cafc24ad795b6f4974bdc9a..7a9b44fbd1045ee4ae1e8f384c6437683742ad36 100644 (file)
@@ -67,7 +67,7 @@ static void consumer_refresh_cb( mlt_consumer sdl, mlt_consumer this, char *name
 
 mlt_consumer consumer_sdl_preview_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 );
+       consumer_sdl this = calloc( 1, sizeof( struct consumer_sdl_s ) );
        if ( this != NULL && mlt_consumer_init( &this->parent, this, profile ) == 0 )
        {
                // Get the parent consumer object
index 1ef82b8766556e53e71b8e1bb4ccfdd2bb9da2e9..2b5ee6a6206bbcbb74c024d8fac7f43805d4ce8e 100644 (file)
@@ -78,7 +78,7 @@ static void consumer_sdl_event( mlt_listener listener, mlt_properties owner, mlt
 mlt_consumer consumer_sdl_still_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        // Create the consumer object
-       consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 );
+       consumer_sdl this = calloc( 1, sizeof( struct consumer_sdl_s ) );
 
        // If no malloc'd and consumer init ok
        if ( this != NULL && mlt_consumer_init( &this->parent, this, profile ) == 0 )
index 8ed27204d293cb5a4d25c5958b4bbab0788e93f8..883ee7de32f49f39147fc882f15748b188fa2fd9 100644 (file)
@@ -186,7 +186,7 @@ static char *xml_get_id( serialise_context context, mlt_service service, xml_typ
 mlt_consumer consumer_xml_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        // Create the consumer object
-       mlt_consumer this = calloc( sizeof( struct mlt_consumer_s ), 1 );
+       mlt_consumer this = calloc( 1, sizeof( struct mlt_consumer_s ) );
 
        // If no malloc'd and consumer init ok
        if ( this != NULL && mlt_consumer_init( this, NULL, profile ) == 0 )
index c2d41b2cb69c0c4596f30e6326bd9d18364785ab..646d6a2c01a546b4e81c4f9176e1a9a90bda75c6 100644 (file)
@@ -1301,7 +1301,7 @@ static void on_characters( void *ctx, const xmlChar *ch, int len )
 {
        struct _xmlParserCtxt *xmlcontext = ( struct _xmlParserCtxt* )ctx;
        deserialise_context context = ( deserialise_context )( xmlcontext->_private );
-       char *value = calloc( len + 1, 1 );
+       char *value = calloc( 1, len + 1 );
        enum service_type type;
        mlt_service service = context_pop_service( context, &type );
        mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
@@ -1324,7 +1324,7 @@ static void on_characters( void *ctx, const xmlChar *ch, int len )
                if ( s != NULL )
                {
                        // Append new text to existing content
-                       char *new = calloc( strlen( s ) + len + 1, 1 );
+                       char *new = calloc( 1, strlen( s ) + len + 1 );
                        strcat( new, s );
                        strcat( new, value );
                        mlt_properties_set( properties, context->property, new );