Update comments for code review

pull/4831/head
Fahrzin Hemmati 2017-07-31 06:25:21 -07:00 committed by Fahrzin Hemmati
parent e5ef69a925
commit 199d108063
1 changed files with 2 additions and 1 deletions

View File

@ -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] = ':';