nsISupportsImpl.cpp 790 B

123456789101112131415161718192021222324252627
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupportsImpl.h"
  6. nsresult NS_FASTCALL
  7. NS_TableDrivenQI(void* aThis, REFNSIID aIID, void** aInstancePtr,
  8. const QITableEntry* aEntries)
  9. {
  10. do {
  11. if (aIID.Equals(*aEntries->iid)) {
  12. nsISupports* r = reinterpret_cast<nsISupports*>(
  13. reinterpret_cast<char*>(aThis) + aEntries->offset);
  14. NS_ADDREF(r);
  15. *aInstancePtr = r;
  16. return NS_OK;
  17. }
  18. ++aEntries;
  19. } while (aEntries->iid);
  20. *aInstancePtr = nullptr;
  21. return NS_ERROR_NO_INTERFACE;
  22. }