From 3aa45435dffb39a6c529606845ea86a713a58aeb Mon Sep 17 00:00:00 2001 From: James Devine Date: Mon, 10 Oct 2016 12:35:40 +0100 Subject: [PATCH] microbit-dal: removed open from MicroBitFile After recent additions such as "flush" to the file API, an open call no longer makes sense. This commit removes open. --- inc/drivers/MicroBitFile.h | 16 +--------------- source/drivers/MicroBitFile.cpp | 29 +---------------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/inc/drivers/MicroBitFile.h b/inc/drivers/MicroBitFile.h index f9e96b9..b1e037e 100644 --- a/inc/drivers/MicroBitFile.h +++ b/inc/drivers/MicroBitFile.h @@ -146,20 +146,6 @@ class MicroBitFile */ int getHandle(); - /** - * Opens this MicroBitFile instance if the file has previously been closed. - * - * @param mode One of: READ, WRITE, READ_AND_WRITE. Defaults to READ_AND_WRITE. - * - * @return MICROBIT_OK on success, MICROBIT_NOT_SUPPORTED if the file is already open, - * MICROBIT_INVALID_PARAMETER if the filename is too large, MICROBIT_NO_RESOURCES - * if the file system is full, or memory could not be allocated.. - * - * @note MicroBitFiles are opened at construction and are implicitly closed at - * destruction. They can be closed explicitly using the close() member function. - */ - int open(int mode = READ_AND_WRITE); - /** * Closes this MicroBitFile instance * @@ -172,7 +158,7 @@ class MicroBitFile int close(); /** - * Writes back all state associated with the given file to FLASH memory, + * Writes back all state associated with the given file to FLASH memory, * leaving the file open. * * @return MICROBIT_OK on success, MICROBIT_NOT_SUPPORTED if the file system has not diff --git a/source/drivers/MicroBitFile.cpp b/source/drivers/MicroBitFile.cpp index 5ec5f05..d0741a2 100644 --- a/source/drivers/MicroBitFile.cpp +++ b/source/drivers/MicroBitFile.cpp @@ -231,33 +231,6 @@ int MicroBitFile::getHandle() return fileHandle; } -/** - * Opens this MicroBitFile instance if the file has previously been closed. - * - * @param mode One of: READ, WRITE, READ_AND_WRITE. Defaults to READ_AND_WRITE. - * - * @return MICROBIT_OK on success, MICROBIT_NOT_SUPPORTED if the file is already open, - * MICROBIT_INVALID_PARAMETER if the filename is too large, MICROBIT_NO_RESOURCES - * if the file system is full, or memory could not be allocated.. - * - * @note MicroBitFiles are opened at construction and are implicitly closed at - * destruction. They can be closed explicitly using the close() member function. - */ -int MicroBitFile::open(int mode) -{ - if(fileHandle >= 0) - return MICROBIT_NOT_SUPPORTED; - - int ret = MicroBitFileSystem::defaultFileSystem->open(fileName.toCharArray(), mode | CREATE); - - if(ret < 0) - return ret; - - fileHandle = ret; - - return MICROBIT_OK; -} - /** * Closes this MicroBitFile instance * @@ -283,7 +256,7 @@ int MicroBitFile::close() } /** - * Writes back all state associated with the given file to FLASH memory, + * Writes back all state associated with the given file to FLASH memory, * leaving the file open. * * @return MICROBIT_OK on success, MICROBIT_NOT_SUPPORTED if the file system has not