clang-format

This commit is contained in:
Vibhav Pant
2023-08-30 13:21:30 +05:30
parent cb83656eab
commit c742bd3a37
83 changed files with 983 additions and 986 deletions
@@ -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