Commit 8e7b79aa32faa45e8a231c7b3e413d7ad1783acf

Authored by Francisco Santos
2 parents f239ed30 a4fde166

[dali_1.3.4] Merge branch 'devel/master'

Change-Id: I43ee70a927b0f5dd3431be8fd2d30057ffe9cd04
examples/image-view-url/image-view-url-example.cpp
@@ -58,7 +58,8 @@ class ImageViewUrlApp : public ConnectionTracker @@ -58,7 +58,8 @@ class ImageViewUrlApp : public ConnectionTracker
58 { 58 {
59 public: 59 public:
60 ImageViewUrlApp( Application& application ) 60 ImageViewUrlApp( Application& application )
61 - : mApplication( application ) 61 + : mApplication( application ),
  62 + mDeltaPropertyIndex( Property::INVALID_INDEX )
62 { 63 {
63 // Connect to the Application's Init signal 64 // Connect to the Application's Init signal
64 mApplication.InitSignal().Connect( this, &ImageViewUrlApp::Create ); 65 mApplication.InitSignal().Connect( this, &ImageViewUrlApp::Create );
examples/ray-marching/ray-marching-example.cpp
@@ -41,20 +41,30 @@ bool LoadShaderCode( const char* path, const char* filename, std::vector<char>& @@ -41,20 +41,30 @@ bool LoadShaderCode( const char* path, const char* filename, std::vector<char>&
41 { 41 {
42 std::string fullpath( path ); 42 std::string fullpath( path );
43 fullpath += filename; 43 fullpath += filename;
44 - FILE* f = fopen( fullpath.c_str(), "rb" );  
45 - if( !f ) 44 + FILE* file = fopen( fullpath.c_str(), "rb" );
  45 + if( ! file )
46 { 46 {
47 return false; 47 return false;
48 } 48 }
49 - fseek( f, 0, SEEK_END );  
50 - size_t size = ftell( f );  
51 - fseek( f, 0, SEEK_SET );  
52 - output.resize( size + 1 );  
53 - std::fill( output.begin(), output.end(), 0 );  
54 - ssize_t result = fread( output.data(), size, 1, f );  
55 - fclose( f );  
56 -  
57 - return ( result >= 0 ); 49 +
  50 + bool retValue = false;
  51 + if( ! fseek( file, 0, SEEK_END ) )
  52 + {
  53 + long int size = ftell( file );
  54 +
  55 + if( ( size != -1L ) &&
  56 + ( ! fseek( file, 0, SEEK_SET ) ) )
  57 + {
  58 + output.resize( size + 1 );
  59 + std::fill( output.begin(), output.end(), 0 );
  60 + ssize_t result = fread( output.data(), size, 1, file );
  61 +
  62 + retValue = ( result >= 0 );
  63 + }
  64 + }
  65 +
  66 + fclose( file );
  67 + return retValue;
58 } 68 }
59 69
60 /** 70 /**
@@ -69,9 +79,13 @@ Shader LoadShaders( const std::string& shaderName ) @@ -69,9 +79,13 @@ Shader LoadShaders( const std::string& shaderName )
69 std::string shaderFSH( shaderName ); 79 std::string shaderFSH( shaderName );
70 shaderVSH += ".vsh"; 80 shaderVSH += ".vsh";
71 shaderFSH += ".fsh"; 81 shaderFSH += ".fsh";
72 - LoadShaderCode( DEMO_SHADER_DIR, shaderVSH.c_str(), bufV );  
73 - LoadShaderCode( DEMO_SHADER_DIR, shaderFSH.c_str(), bufF );  
74 - Shader shader = Shader::New( bufV.data(), bufF.data() ); 82 +
  83 + Shader shader;
  84 + if( LoadShaderCode( DEMO_SHADER_DIR, shaderVSH.c_str(), bufV ) &&
  85 + LoadShaderCode( DEMO_SHADER_DIR, shaderFSH.c_str(), bufF ) )
  86 + {
  87 + shader = Shader::New( bufV.data(), bufF.data() );
  88 + }
75 return shader; 89 return shader;
76 } 90 }
77 91
examples/rendering-basic-pbr/ktx-loader.cpp
@@ -104,6 +104,7 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata ) @@ -104,6 +104,7 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata )
104 int result = fread(&header,1,sizeof(KtxFileHeader),fp); 104 int result = fread(&header,1,sizeof(KtxFileHeader),fp);
105 if( 0 == result ) 105 if( 0 == result )
106 { 106 {
  107 + fclose( fp );
107 return false; 108 return false;
108 } 109 }
109 110
@@ -112,14 +113,27 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata ) @@ -112,14 +113,27 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata )
112 // Skip the key-values: 113 // Skip the key-values:
113 const long int imageSizeOffset = sizeof(KtxFileHeader) + header.bytesOfKeyValueData; 114 const long int imageSizeOffset = sizeof(KtxFileHeader) + header.bytesOfKeyValueData;
114 115
115 - fseek(fp, imageSizeOffset, SEEK_END); 116 + if( fseek(fp, imageSizeOffset, SEEK_END) )
  117 + {
  118 + fclose( fp );
  119 + return false;
  120 + }
  121 +
116 lSize = ftell(fp); 122 lSize = ftell(fp);
  123 + if( lSize == -1L )
  124 + {
  125 + fclose( fp );
  126 + return false;
  127 + }
  128 +
117 rewind(fp); 129 rewind(fp);
118 130
119 - if(fseek(fp, imageSizeOffset, SEEK_SET)) 131 + if( fseek(fp, imageSizeOffset, SEEK_SET) )
120 { 132 {
  133 + fclose( fp );
121 return false; 134 return false;
122 } 135 }
  136 +
123 cubedata.img.resize(header.numberOfFaces); 137 cubedata.img.resize(header.numberOfFaces);
124 138
125 for(unsigned int face=0; face < header.numberOfFaces; ++face) //array_element must be 0 or 1 139 for(unsigned int face=0; face < header.numberOfFaces; ++face) //array_element must be 0 or 1
@@ -133,13 +147,15 @@ bool LoadCubeMapFromKtxFile( const std::string&amp; path, CubeData&amp; cubedata ) @@ -133,13 +147,15 @@ bool LoadCubeMapFromKtxFile( const std::string&amp; path, CubeData&amp; cubedata )
133 unsigned int imgSize[6]; 147 unsigned int imgSize[6];
134 unsigned char* imgPointer = buffer; 148 unsigned char* imgPointer = buffer;
135 result = fread(buffer,1,lSize,fp); 149 result = fread(buffer,1,lSize,fp);
  150 +
  151 + fclose(fp);
  152 +
136 if( 0 == result ) 153 if( 0 == result )
137 { 154 {
  155 + free( buffer );
138 return false; 156 return false;
139 } 157 }
140 158
141 - fclose(fp);  
142 -  
143 if( 0 == header.numberOfMipmapLevels ) 159 if( 0 == header.numberOfMipmapLevels )
144 { 160 {
145 header.numberOfMipmapLevels = 1u; 161 header.numberOfMipmapLevels = 1u;
examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp
@@ -390,21 +390,29 @@ public: @@ -390,21 +390,29 @@ public:
390 */ 390 */
391 bool LoadShaderCode( const std::string& fullpath, std::vector<char>& output ) 391 bool LoadShaderCode( const std::string& fullpath, std::vector<char>& output )
392 { 392 {
393 - FILE* f = fopen( fullpath.c_str(), "rb" );  
394 -  
395 - if( NULL == f ) 393 + FILE* file = fopen( fullpath.c_str(), "rb" );
  394 + if( NULL == file )
396 { 395 {
397 return false; 396 return false;
398 } 397 }
399 398
400 - fseek( f, 0, SEEK_END );  
401 - size_t size = ftell( f );  
402 - fseek( f, 0, SEEK_SET );  
403 - output.resize( size + 1 );  
404 - std::fill( output.begin(), output.end(), 0 );  
405 - ssize_t result = fread( output.data(), size, 1, f );  
406 - fclose( f );  
407 - return ( result >= 0 ); 399 + bool retValue = false;
  400 + if( ! fseek( file, 0, SEEK_END ) )
  401 + {
  402 + long int size = ftell( file );
  403 +
  404 + if( ( size != -1L ) &&
  405 + ( ! fseek( file, 0, SEEK_SET ) ) )
  406 + {
  407 + output.resize( size + 1 );
  408 + std::fill( output.begin(), output.end(), 0 );
  409 + ssize_t result = fread( output.data(), size, 1, file );
  410 +
  411 + retValue = ( result >= 0 );
  412 + }
  413 + }
  414 + fclose( file );
  415 + return retValue;
408 } 416 }
409 417
410 /** 418 /**
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.3.3 5 +Version: 1.3.4
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0