当前位置: 首页>>代码示例>>C++>>正文


C++ nsTHashtable::RemoveEntry方法代码示例

本文整理汇总了C++中nsTHashtable::RemoveEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ nsTHashtable::RemoveEntry方法的具体用法?C++ nsTHashtable::RemoveEntry怎么用?C++ nsTHashtable::RemoveEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nsTHashtable的用法示例。


在下文中一共展示了nsTHashtable::RemoveEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: curName

// recursively check a directory tree for files not in the list of
// verified files we found in the manifest. For each file we find
// Check it against the files found in the manifest. If the file wasn't
// in the manifest then it's unsigned and we can stop looking. Otherwise
// remove it from the collection so we can check leftovers later.
//
// @param aDir   Directory to check
// @param aPath  Relative path to that directory (to check against aItems)
// @param aItems All the files found
// @param *Filename  signature files that won't be in the manifest
nsresult
CheckDirForUnsignedFiles(nsIFile* aDir,
                         const nsString& aPath,
                         /* in/out */ nsTHashtable<nsStringHashKey>& aItems,
                         const nsAString& sigFilename,
                         const nsAString& sfFilename,
                         const nsAString& mfFilename)
{
  nsCOMPtr<nsISimpleEnumerator> entries;
  nsresult rv = aDir->GetDirectoryEntries(getter_AddRefs(entries));
  nsCOMPtr<nsIDirectoryEnumerator> files = do_QueryInterface(entries);
  if (NS_FAILED(rv) || !files) {
    return NS_ERROR_SIGNED_JAR_ENTRY_MISSING;
  }

  bool inMeta = StringBeginsWith(aPath, NS_LITERAL_STRING(JAR_META_DIR));

  while (NS_SUCCEEDED(rv)) {
    nsCOMPtr<nsIFile> file;
    rv = files->GetNextFile(getter_AddRefs(file));
    if (NS_FAILED(rv) || !file) {
      break;
    }

    nsAutoString leafname;
    rv = file->GetLeafName(leafname);
    if (NS_FAILED(rv)) {
      return rv;
    }

    nsAutoString curName(aPath + leafname);

    bool isDir;
    rv = file->IsDirectory(&isDir);
    if (NS_FAILED(rv)) {
      return rv;
    }

    // if it's a directory we need to recurse
    if (isDir) {
      curName.Append(NS_LITERAL_STRING("/"));
      rv = CheckDirForUnsignedFiles(file, curName, aItems,
                                    sigFilename, sfFilename, mfFilename);
    } else {
      // The files that comprise the signature mechanism are not covered by the
      // signature.
      //
      // XXX: This is OK for a single signature, but doesn't work for
      // multiple signatures because the metadata for the other signatures
      // is not signed either.
      if (inMeta && ( leafname == sigFilename ||
                      leafname == sfFilename ||
                      leafname == mfFilename )) {
        continue;
      }

      // make sure the current file was found in the manifest
      nsStringHashKey* item = aItems.GetEntry(curName);
      if (!item) {
        return NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY;
      }

      // Remove the item so we can check for leftover items later
      aItems.RemoveEntry(item);
    }
  }
  files->Close();
  return rv;
}
开发者ID:leplatrem,项目名称:gecko-dev,代码行数:79,代码来源:AppSignatureVerification.cpp


注:本文中的nsTHashtable::RemoveEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。