@@ -374,43 +374,41 @@ std::string CResource::CalculateACLRequestFingerprint()
374374{
375375 std::string strPath;
376376 if (!GetFilePath (" meta.xml" , strPath))
377- return " " ;
377+ return {} ;
378378
379- CXMLFile* pMetaFile = g_pServerInterface->GetXML ()->CreateXML (strPath.c_str ());
380- if (!pMetaFile || !pMetaFile ->Parse ())
379+ std::unique_ptr< CXMLFile> metaFile ( g_pServerInterface->GetXML ()->CreateXML (strPath.c_str () ));
380+ if (!metaFile || !metaFile ->Parse ())
381381 {
382- delete pMetaFile;
383382 return " " ;
384383 }
385384
386- CXMLNode* pRoot = pMetaFile ->GetRootNode ();
387- if (!pRoot )
385+ CXMLNode* root = metaFile ->GetRootNode ();
386+ if (!root )
388387 {
389- delete pMetaFile;
390388 return " " ;
391389 }
392390
391+ std::ostringstream oss;
393392 std::string strFingerprint;
394- CXMLNode* pNodeAclRequest = pRoot ->FindSubNode (" aclrequest" , 0 );
393+ CXMLNode* nodeAclRequest = root ->FindSubNode (" aclrequest" , 0 );
395394
396- if (pNodeAclRequest )
395+ if (nodeAclRequest )
397396 {
398- for (uint uiIndex = 0 ; true ; uiIndex++)
397+ for (std:: uint8_t uiIndex = 0 ; true ; uiIndex++)
399398 {
400- CXMLNode* pNodeRight = pNodeAclRequest ->FindSubNode (" right" , uiIndex);
401- if (!pNodeRight )
399+ CXMLNode* nodeRight = nodeAclRequest ->FindSubNode (" right" , uiIndex);
400+ if (!nodeRight )
402401 break ;
403402
404- std::string strName = pNodeRight ->GetAttributeValue (" name" );
405- std::string strAccess = pNodeRight ->GetAttributeValue (" access" );
406-
407- if (!strFingerprint.empty ())
403+ std::string strName = nodeRight ->GetAttributeValue (" name" );
404+ std::string strAccess = nodeRight ->GetAttributeValue (" access" );
405+
406+ if (uiIndex > 0 && !strFingerprint.empty ())
408407 strFingerprint += " ;" ;
409408 strFingerprint += strName + " :" + strAccess;
410409 }
411410 }
412411
413- delete pMetaFile;
414412 return strFingerprint;
415413}
416414
0 commit comments