X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/c38e3ce98599a410a47dc10253faa4d5830f13b2..427c49bcad63d042b29ada2ac27e3dfc4845c779:/libsecurity_codesigning/lib/renum.cpp?ds=inline diff --git a/libsecurity_codesigning/lib/renum.cpp b/libsecurity_codesigning/lib/renum.cpp deleted file mode 100644 index a5b8e78f..00000000 --- a/libsecurity_codesigning/lib/renum.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -// -// renum - enumerator for code (usually bundle) resources -// -#include "renum.h" -#include -#include - -namespace Security { -namespace CodeSigning { - -using namespace UnixPlusPlus; - - -ResourceEnumerator::ResourceEnumerator(string path) - : mPath(path) -{ - assert(!mPath.empty()); - const char * paths[2] = { path.c_str(), NULL }; - mFTS = fts_open((char * const *)paths, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_NOCHDIR, NULL); - if (!mFTS) - UnixError::throwMe(); -} - -ResourceEnumerator::~ResourceEnumerator() -{ - checkError(fts_close(mFTS)); -} - - -FTSENT *ResourceEnumerator::next(string &path) -{ - while (FTSENT *ent = fts_read(mFTS)) { - switch (ent->fts_info) { - case FTS_F: - path = ent->fts_path + mPath.size() + 1; // skip prefix + "/" - return ent; - case FTS_D: - secdebug("rdirenum", "entering %s", ent->fts_path); - break; - case FTS_DP: - secdebug("rdirenum", "leaving %s", ent->fts_path); - break; - case FTS_SL: - secdebug("rdirenum", "symlink ignored: %s", ent->fts_path); - break; - default: - secdebug("rdirenum", "type %d (errno %d): %s", - ent->fts_info, ent->fts_errno, ent->fts_path); - break; - } - } - return NULL; -} - - -} // end namespace CodeSigning -} // end namespace Security