1
0

platform_file.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2014 The WebRTC Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef WEBRTC_BASE_PLATFORM_FILE_H_
  11. #define WEBRTC_BASE_PLATFORM_FILE_H_
  12. #include <stdio.h>
  13. #if defined(WEBRTC_WIN)
  14. #include <windows.h>
  15. #endif
  16. namespace rtc {
  17. #if defined(WEBRTC_WIN)
  18. typedef HANDLE PlatformFile;
  19. #elif defined(WEBRTC_POSIX)
  20. typedef int PlatformFile;
  21. #else
  22. #error Unsupported platform
  23. #endif
  24. extern const PlatformFile kInvalidPlatformFileValue;
  25. // Associates a standard FILE stream with an existing PlatformFile.
  26. // Note that after this function has returned a valid FILE stream,
  27. // the PlatformFile should no longer be used.
  28. FILE* FdopenPlatformFileForWriting(PlatformFile file);
  29. // Closes a PlatformFile.
  30. // Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile.
  31. // Use fclose instead.
  32. bool ClosePlatformFile(PlatformFile file);
  33. } // namespace rtc
  34. #endif // WEBRTC_BASE_PLATFORM_FILE_H_