From 0e74051aa807d4db3a79a893e69f033c73a3d392 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Fri, 11 Nov 2016 16:53:47 +0000 Subject: [PATCH] Fix various reported SVACE errors Change-Id: I53d180d04995a78a1728bdf5fd740c048a7cac02 --- .../dali-test-suite-utils/test-gl-abstraction.h | 7 ++++--- dali/devel-api/animation/animation-data.h | 3 ++- dali/devel-api/images/distance-field.cpp | 4 ++-- dali/internal/event/actors/actor-impl.cpp | 4 ++++ dali/internal/event/animation/animation-impl.cpp | 3 ++- .../internal/event/common/object-registry-impl.cpp | 3 ++- dali/internal/event/common/stage-impl.cpp | 1 + .../events/long-press-gesture-detector-impl.cpp | 3 ++- .../event/events/pan-gesture-detector-impl.cpp | 3 ++- .../event/events/pinch-gesture-detector-impl.cpp | 3 ++- .../event/events/tap-gesture-detector-impl.cpp | 3 ++- dali/internal/event/images/bitmap-packed-pixel.h | 5 +---- .../event/render-tasks/render-task-impl.cpp | 1 + dali/internal/event/resources/resource-client.h | 6 +++++- dali/internal/render/shaders/program.h | 9 ++++----- .../common/scene-graph-property-notification.cpp | 5 +++-- .../update/gestures/scene-graph-pan-gesture.h | 22 ++++++++++++++-------- dali/public-api/events/gesture.cpp | 11 +++++++---- dali/public-api/events/long-press-gesture.cpp | 13 ++++++++----- dali/public-api/events/pan-gesture.cpp | 21 ++++++++++++--------- dali/public-api/events/pinch-gesture.cpp | 15 +++++++++------ dali/public-api/events/tap-gesture.cpp | 15 +++++++++------ dali/public-api/object/property-value.cpp | 1 + 23 files changed, 99 insertions(+), 62 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h index 10c3264..9bed832 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h @@ -956,10 +956,11 @@ public: inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { const std::string shaderSource = mShaderSources[shader]; - if( static_cast(shaderSource.length()) < bufsize ) + const int shaderSourceLength = static_cast(shaderSource.length()); + if( shaderSourceLength < bufsize ) { - strcpy(source, shaderSource.c_str()); - *length = shaderSource.length(); + strncpy( source, shaderSource.c_str(), shaderSourceLength ); + *length = shaderSourceLength; } else { diff --git a/dali/devel-api/animation/animation-data.h b/dali/devel-api/animation/animation-data.h index c429149..ebdad5a 100644 --- a/dali/devel-api/animation/animation-data.h +++ b/dali/devel-api/animation/animation-data.h @@ -2,7 +2,7 @@ #define __DALI_ANIMATION_DATA_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ public: /** * @brief Adds one AnimationDataElement to the list to describe one animation. * @param[in] animationDataElement A pre-populated struct to add + * @note This class takes ownership of animationDataElement */ void Add( AnimationDataElement* animationDataElement ); diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp index 134f9c4..bb4224a 100644 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ void DistanceTransform( float *source, float* dest, unsigned int length ) { ++rightmost; } - dest[i] = SQUARE( i - parabolas[rightmost] ) + source[parabolas[rightmost]]; + dest[i] = SQUARE( static_cast< int >( i ) - parabolas[rightmost] ) + source[parabolas[rightmost]]; } } diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 485ec51..86eab6c 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1386,6 +1386,8 @@ void Actor::SetRelayoutEnabled( bool relayoutEnabled ) { EnsureRelayoutData(); + DALI_ASSERT_DEBUG( mRelayoutData && "mRelayoutData not created" ); + mRelayoutData->relayoutEnabled = relayoutEnabled; } } @@ -1917,6 +1919,8 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra bool connected( true ); Actor* actor = dynamic_cast< Actor* >( object ); + DALI_ASSERT_DEBUG( actor && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert + if( 0 == signalName.compare( SIGNAL_TOUCHED ) ) { actor->TouchedSignal().Connect( tracker, functor ); diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index ec49265..4694691 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -792,6 +792,7 @@ bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* { bool connected( true ); Animation* animation = dynamic_cast(object); + DALI_ASSERT_DEBUG( animation && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if( 0 == signalName.compare( SIGNAL_FINISHED ) ) { diff --git a/dali/internal/event/common/object-registry-impl.cpp b/dali/internal/event/common/object-registry-impl.cpp index 76c2cbe..c056d1a 100644 --- a/dali/internal/event/common/object-registry-impl.cpp +++ b/dali/internal/event/common/object-registry-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ bool ObjectRegistry::DoConnectSignal( BaseObject* object, ConnectionTrackerInter { bool connected( true ); ObjectRegistry* objectRegistry = dynamic_cast( object ); + DALI_ASSERT_DEBUG( objectRegistry && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if( 0 == strcmp( signalName.c_str(), SIGNAL_OBJECT_CREATED ) ) { diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index bbdf7b0..eb139c6 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -521,6 +521,7 @@ bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra { bool connected( true ); Stage* stage = dynamic_cast(object); + DALI_ASSERT_DEBUG( stage && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) ) { diff --git a/dali/internal/event/events/long-press-gesture-detector-impl.cpp b/dali/internal/event/events/long-press-gesture-detector-impl.cpp index 441ba62..0a2866a 100644 --- a/dali/internal/event/events/long-press-gesture-detector-impl.cpp +++ b/dali/internal/event/events/long-press-gesture-detector-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,6 +144,7 @@ bool LongPressGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTr { bool connected( true ); LongPressGestureDetector* gesture = dynamic_cast(object); + DALI_ASSERT_DEBUG( gesture && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if ( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESS_DETECTED ) ) { diff --git a/dali/internal/event/events/pan-gesture-detector-impl.cpp b/dali/internal/event/events/pan-gesture-detector-impl.cpp index c819a82..9ebb759 100644 --- a/dali/internal/event/events/pan-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pan-gesture-detector-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -292,6 +292,7 @@ bool PanGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerI { bool connected( true ); PanGestureDetector* gesture = dynamic_cast(object); + DALI_ASSERT_DEBUG( gesture && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if ( 0 == strcmp( signalName.c_str(), SIGNAL_PAN_DETECTED ) ) { diff --git a/dali/internal/event/events/pinch-gesture-detector-impl.cpp b/dali/internal/event/events/pinch-gesture-detector-impl.cpp index aa717aa..0324cb0 100644 --- a/dali/internal/event/events/pinch-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pinch-gesture-detector-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,6 +78,7 @@ bool PinchGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTracke { bool connected( true ); PinchGestureDetector* gesture = dynamic_cast(object); + DALI_ASSERT_DEBUG( gesture && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if ( 0 == strcmp( signalName.c_str(), SIGNAL_PINCH_DETECTED ) ) { diff --git a/dali/internal/event/events/tap-gesture-detector-impl.cpp b/dali/internal/event/events/tap-gesture-detector-impl.cpp index 7df665b..7817560 100644 --- a/dali/internal/event/events/tap-gesture-detector-impl.cpp +++ b/dali/internal/event/events/tap-gesture-detector-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -149,6 +149,7 @@ bool TapGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerI { bool connected( true ); TapGestureDetector* gesture = dynamic_cast(object); + DALI_ASSERT_DEBUG( gesture && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if ( 0 == strcmp( signalName.c_str(), SIGNAL_TAP_DETECTED ) ) { diff --git a/dali/internal/event/images/bitmap-packed-pixel.h b/dali/internal/event/images/bitmap-packed-pixel.h index 5708a87..c6ca538 100644 --- a/dali/internal/event/images/bitmap-packed-pixel.h +++ b/dali/internal/event/images/bitmap-packed-pixel.h @@ -116,7 +116,7 @@ public: // unsigned int GetBufferSize() const virtual size_t GetBufferSize() const { - return mBufferWidth*mBytesPerPixel*mBufferHeight; + return static_cast< size_t >( mBufferWidth ) * mBytesPerPixel * mBufferHeight; // need to cast to size_t to avoid possibility of overflow } /** @@ -124,9 +124,6 @@ public: * @return The buffer stride (in bytes). */ virtual unsigned int GetBufferStride() const; - //{ - // return mBufferWidth*mBytesPerPixel; - //} /** * Get the pixel format diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 09514c9..9e1dc90 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -790,6 +790,7 @@ bool RenderTask::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface { bool connected( true ); RenderTask* renderTask = dynamic_cast(object); + DALI_ASSERT_DEBUG( renderTask && "object is not the correct type" ); // TypeRegistry should guarantee that this is correct, but confirm with just a debug assert if ( 0 == strcmp( signalName.c_str(), SIGNAL_FINISHED ) ) { diff --git a/dali/internal/event/resources/resource-client.h b/dali/internal/event/resources/resource-client.h index 1de28df..7c10b7e 100644 --- a/dali/internal/event/resources/resource-client.h +++ b/dali/internal/event/resources/resource-client.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_RESOURCE_CLIENT_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -265,6 +265,10 @@ public: // Message methods void UpdateImageTicket( ResourceId id, const ImageAttributes& imageAttributes ); ///!< Issue #AHC01 private: + + ResourceClient( const ResourceClient& ); ///< Undefined + ResourceClient& operator=( const ResourceClient& ); ///< Undefined + ResourceManager& mResourceManager; ///< The resource manager EventThreadServices& mEventThreadServices; ///< Interface to send messages through diff --git a/dali/internal/render/shaders/program.h b/dali/internal/render/shaders/program.h index b818508..cd55e66 100644 --- a/dali/internal/render/shaders/program.h +++ b/dali/internal/render/shaders/program.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_PROGRAM_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -324,10 +324,9 @@ public: private: - // default constructor, not defined - Program(); - // assignment operator, not defined - Program& operator=( const Program& ); + Program(); ///> default constructor, not defined + Program( const Program& ); ///< copy constructor, not defined + Program& operator=( const Program& ); ///< assignment operator, not defined /** * Load the shader, from a precompiled binary if available, else from source code diff --git a/dali/internal/update/common/scene-graph-property-notification.cpp b/dali/internal/update/common/scene-graph-property-notification.cpp index 012b537..82464fc 100644 --- a/dali/internal/update/common/scene-graph-property-notification.cpp +++ b/dali/internal/update/common/scene-graph-property-notification.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,8 @@ PropertyNotification::PropertyNotification(Object& object, mConditionType(condition), mArguments(arguments), mValid(false), - mNotifyMode( Dali::PropertyNotification::Disabled ) + mNotifyMode( Dali::PropertyNotification::Disabled ), + mConditionFunction(NULL) { SetNotifyMode(notifyMode); diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.h b/dali/internal/update/gestures/scene-graph-pan-gesture.h index 0185f72..c511f7c 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.h +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_PAN_GESTURE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,9 +93,12 @@ public: */ Info& operator=( const Info& rhs ) { - velocity = rhs.velocity; - displacement = rhs.displacement; - position = rhs.position; + if( this != &rhs ) + { + velocity = rhs.velocity; + displacement = rhs.displacement; + position = rhs.position; + } return *this; } @@ -134,10 +137,13 @@ public: */ PanInfo& operator=( const PanInfo& rhs ) { - time = rhs.time; - state = rhs.state; - local = rhs.local; - screen = rhs.screen; + if( this != &rhs ) + { + time = rhs.time; + state = rhs.state; + local = rhs.local; + screen = rhs.screen; + } return *this; } diff --git a/dali/public-api/events/gesture.cpp b/dali/public-api/events/gesture.cpp index 31c3b25..0ceaadf 100644 --- a/dali/public-api/events/gesture.cpp +++ b/dali/public-api/events/gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +30,12 @@ Gesture::Gesture( const Gesture& rhs ) Gesture& Gesture::operator=( const Gesture& rhs ) { - type = rhs.type; - state = rhs.state; - time = rhs.time; + if( this != &rhs ) + { + type = rhs.type; + state = rhs.state; + time = rhs.time; + } return *this; } diff --git a/dali/public-api/events/long-press-gesture.cpp b/dali/public-api/events/long-press-gesture.cpp index b9dd141..e329c82 100644 --- a/dali/public-api/events/long-press-gesture.cpp +++ b/dali/public-api/events/long-press-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,10 +37,13 @@ LongPressGesture::LongPressGesture( const LongPressGesture& rhs ) LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs ) { - Gesture::operator=(rhs); - numberOfTouches = rhs.numberOfTouches; - screenPoint = rhs.screenPoint; - localPoint = rhs.localPoint; + if( this != &rhs ) + { + Gesture::operator=(rhs); + numberOfTouches = rhs.numberOfTouches; + screenPoint = rhs.screenPoint; + localPoint = rhs.localPoint; + } return *this; } diff --git a/dali/public-api/events/pan-gesture.cpp b/dali/public-api/events/pan-gesture.cpp index f6011ad..a2a8f44 100644 --- a/dali/public-api/events/pan-gesture.cpp +++ b/dali/public-api/events/pan-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,14 +50,17 @@ PanGesture::PanGesture( const PanGesture& rhs ) PanGesture& PanGesture::operator=( const PanGesture& rhs ) { - Gesture::operator=(rhs); - velocity = rhs.velocity; - displacement = rhs.displacement; - position = rhs.position; - screenVelocity = rhs.screenVelocity; - screenDisplacement = rhs.screenDisplacement; - screenPosition = rhs.screenPosition; - numberOfTouches = rhs.numberOfTouches; + if( this != &rhs ) + { + Gesture::operator=(rhs); + velocity = rhs.velocity; + displacement = rhs.displacement; + position = rhs.position; + screenVelocity = rhs.screenVelocity; + screenDisplacement = rhs.screenDisplacement; + screenPosition = rhs.screenPosition; + numberOfTouches = rhs.numberOfTouches; + } return *this; } diff --git a/dali/public-api/events/pinch-gesture.cpp b/dali/public-api/events/pinch-gesture.cpp index d074efe..9c72c25 100644 --- a/dali/public-api/events/pinch-gesture.cpp +++ b/dali/public-api/events/pinch-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,11 +42,14 @@ PinchGesture::PinchGesture( const PinchGesture& rhs ) PinchGesture& PinchGesture::operator=( const PinchGesture& rhs ) { - Gesture::operator=(rhs); - scale = rhs.scale; - speed = rhs.speed; - screenCenterPoint = rhs.screenCenterPoint; - localCenterPoint = rhs.localCenterPoint; + if( this != &rhs ) + { + Gesture::operator=(rhs); + scale = rhs.scale; + speed = rhs.speed; + screenCenterPoint = rhs.screenCenterPoint; + localCenterPoint = rhs.localCenterPoint; + } return *this; } diff --git a/dali/public-api/events/tap-gesture.cpp b/dali/public-api/events/tap-gesture.cpp index 3d9fed6..d20afc4 100644 --- a/dali/public-api/events/tap-gesture.cpp +++ b/dali/public-api/events/tap-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,11 +39,14 @@ TapGesture::TapGesture( const TapGesture& rhs ) TapGesture& TapGesture::operator=( const TapGesture& rhs ) { - Gesture::operator=(rhs); - numberOfTaps = rhs.numberOfTaps; - numberOfTouches = rhs.numberOfTouches; - screenPoint = rhs.screenPoint; - localPoint = rhs.localPoint; + if( this != &rhs ) + { + Gesture::operator=(rhs); + numberOfTaps = rhs.numberOfTaps; + numberOfTouches = rhs.numberOfTouches; + screenPoint = rhs.screenPoint; + localPoint = rhs.localPoint; + } return *this; } diff --git a/dali/public-api/object/property-value.cpp b/dali/public-api/object/property-value.cpp index ffd0f70..fd4058e 100644 --- a/dali/public-api/object/property-value.cpp +++ b/dali/public-api/object/property-value.cpp @@ -313,6 +313,7 @@ Property::Value::Value( Property::Map& mapValue ) } Property::Value::Value( Type type ) +: mImpl( NULL ) { switch (type) { -- 2.7.4