mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
clang-format
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <unistd.h>
|
||||
#include <array>
|
||||
#include <cerrno>
|
||||
#include <cstdint>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "internal/platform/byte_array.h"
|
||||
#include "internal/platform/exception.h"
|
||||
@@ -25,8 +25,7 @@ namespace nearby {
|
||||
namespace linux {
|
||||
|
||||
ExceptionOr<ByteArray> InputStream::Read(std::int64_t size) {
|
||||
if (!fd_.has_value())
|
||||
return Exception::kIo;
|
||||
if (!fd_.has_value()) return Exception::kIo;
|
||||
|
||||
char *data = new char[size];
|
||||
ssize_t ret = read(fd_->get(), data, size);
|
||||
@@ -42,8 +41,7 @@ ExceptionOr<ByteArray> InputStream::Read(std::int64_t size) {
|
||||
}
|
||||
|
||||
Exception InputStream::Close() {
|
||||
if (!fd_.has_value())
|
||||
return Exception{Exception::kIo};
|
||||
if (!fd_.has_value()) return Exception{Exception::kIo};
|
||||
|
||||
auto ret = close(fd_->get()) < 0 ? Exception{Exception::kIo}
|
||||
: Exception{Exception::kSuccess};
|
||||
@@ -52,8 +50,7 @@ Exception InputStream::Close() {
|
||||
}
|
||||
|
||||
Exception OutputStream::Write(const ByteArray &data) {
|
||||
if (!fd_.has_value())
|
||||
return Exception{Exception::kIo};
|
||||
if (!fd_.has_value()) return Exception{Exception::kIo};
|
||||
|
||||
size_t written = 0;
|
||||
while (written < data.size()) {
|
||||
@@ -69,8 +66,7 @@ Exception OutputStream::Write(const ByteArray &data) {
|
||||
Exception OutputStream::Flush() { return Exception{Exception::kSuccess}; }
|
||||
|
||||
Exception OutputStream::Close() {
|
||||
if (!fd_.has_value())
|
||||
return Exception{Exception::kIo};
|
||||
if (!fd_.has_value()) return Exception{Exception::kIo};
|
||||
|
||||
auto ret = close(fd_->get()) < 0 ? Exception{Exception::kIo}
|
||||
: Exception{Exception::kSuccess};
|
||||
@@ -85,5 +81,5 @@ Exception BluetoothSocket::Close() {
|
||||
return Exception{Exception::kSuccess};
|
||||
}
|
||||
|
||||
} // namespace linux
|
||||
} // namespace nearby
|
||||
} // namespace linux
|
||||
} // namespace nearby
|
||||
|
||||
Reference in New Issue
Block a user