mirror of https://github.com/ARMmbed/mbed-os.git
Update comments for code review
parent
e5ef69a925
commit
199d108063
|
@ -228,7 +228,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
||||||
|
|
||||||
FileHandle *res = NULL;
|
FileHandle *res = NULL;
|
||||||
|
|
||||||
/* FILENAME: ":0x12345678" describes a FileHandle* */
|
/* FILENAME: ":(pointer)" describes a FileHandle* */
|
||||||
if (name[0] == ':') {
|
if (name[0] == ':') {
|
||||||
void *p;
|
void *p;
|
||||||
memcpy(&p, name + 1, sizeof(p));
|
memcpy(&p, name + 1, sizeof(p));
|
||||||
|
@ -826,6 +826,7 @@ void mbed_set_unbuffered_stream(std::FILE *_file) {
|
||||||
*/
|
*/
|
||||||
std::FILE *mbed_fdopen(FileHandle *fh, const char *mode)
|
std::FILE *mbed_fdopen(FileHandle *fh, const char *mode)
|
||||||
{
|
{
|
||||||
|
// This is to avoid scanf(buf, ":%.4s", fh) and the bloat it brings.
|
||||||
char buf[2 + sizeof(fh) + 1]; /* :(pointer) + null byte */
|
char buf[2 + sizeof(fh) + 1]; /* :(pointer) + null byte */
|
||||||
static_assert(sizeof(buf) == 7, "Pointers should be 4 bytes.");
|
static_assert(sizeof(buf) == 7, "Pointers should be 4 bytes.");
|
||||||
buf[0] = ':';
|
buf[0] = ':';
|
||||||
|
|
Loading…
Reference in New Issue