From 6550f4af67382e3d090462078001561868d71e28 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sun, 30 Dec 2018 12:04:29 -0400 Subject: [PATCH] update code style and fixed #endif error --- base/io.c | 19 +++++-------------- base/io_c.h | 19 +++++-------------- key/keypress.h | 2 ++ mouse/mouse.h | 8 +++++--- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/base/io.c b/base/io.c index bf86359..fbb2785 100644 --- a/base/io.c +++ b/base/io.c @@ -6,8 +6,7 @@ #include /* For strcmp() */ #include /* For tolower() */ -const char *getExtension(const char *fname, size_t len) -{ +const char *getExtension(const char *fname, size_t len){ if (fname == NULL || len <= 0) return NULL; while (--len > 0 && fname[len] != '.' && fname[len] != '\0') @@ -16,8 +15,7 @@ const char *getExtension(const char *fname, size_t len) return fname + len + 1; } -MMImageType imageTypeFromExtension(const char *extension) -{ +MMImageType imageTypeFromExtension(const char *extension){ char ext[4]; const size_t maxlen = sizeof(ext) / sizeof(ext[0]); size_t i; @@ -37,10 +35,7 @@ MMImageType imageTypeFromExtension(const char *extension) } } -MMBitmapRef newMMBitmapFromFile(const char *path, - MMImageType type, - MMIOError *err) -{ +MMBitmapRef newMMBitmapFromFile(const char *path, MMImageType type, MMIOError *err){ switch (type) { case kBMPImageType: return newMMBitmapFromBMP(path, err); @@ -52,10 +47,7 @@ MMBitmapRef newMMBitmapFromFile(const char *path, } } -int saveMMBitmapToFile(MMBitmapRef bitmap, - const char *path, - MMImageType type) -{ +int saveMMBitmapToFile(MMBitmapRef bitmap, const char *path, MMImageType type){ switch (type) { case kBMPImageType: return saveMMBitmapAsBMP(bitmap, path); @@ -66,8 +58,7 @@ int saveMMBitmapToFile(MMBitmapRef bitmap, } } -const char *MMIOErrorString(MMImageType type, MMIOError error) -{ +const char *MMIOErrorString(MMImageType type, MMIOError error){ switch (type) { case kBMPImageType: return MMBMPReadErrorString(error); diff --git a/base/io_c.h b/base/io_c.h index 52f694f..fed799a 100644 --- a/base/io_c.h +++ b/base/io_c.h @@ -6,8 +6,7 @@ #include /* For strcmp() */ #include /* For tolower() */ -const char *getExtension(const char *fname, size_t len) -{ +const char *getExtension(const char *fname, size_t len){ if (fname == NULL || len <= 0) return NULL; while (--len > 0 && fname[len] != '.' && fname[len] != '\0') @@ -16,8 +15,7 @@ const char *getExtension(const char *fname, size_t len) return fname + len + 1; } -MMImageType imageTypeFromExtension(const char *extension) -{ +MMImageType imageTypeFromExtension(const char *extension){ char ext[4]; const size_t maxlen = sizeof(ext) / sizeof(ext[0]); size_t i; @@ -37,10 +35,7 @@ MMImageType imageTypeFromExtension(const char *extension) } } -MMBitmapRef newMMBitmapFromFile(const char *path, - MMImageType type, - MMIOError *err) -{ +MMBitmapRef newMMBitmapFromFile(const char *path, MMImageType type, MMIOError *err){ switch (type) { case kBMPImageType: return newMMBitmapFromBMP(path, err); @@ -52,10 +47,7 @@ MMBitmapRef newMMBitmapFromFile(const char *path, } } -int saveMMBitmapToFile(MMBitmapRef bitmap, - const char *path, - MMImageType type) -{ +int saveMMBitmapToFile(MMBitmapRef bitmap, const char *path, MMImageType type){ switch (type) { case kBMPImageType: return saveMMBitmapAsBMP(bitmap, path); @@ -66,8 +58,7 @@ int saveMMBitmapToFile(MMBitmapRef bitmap, } } -const char *MMIOErrorString(MMImageType type, MMIOError error) -{ +const char *MMIOErrorString(MMImageType type, MMIOError error){ switch (type) { case kBMPImageType: return MMBMPReadErrorString(error); diff --git a/key/keypress.h b/key/keypress.h index a4aa6f8..20e84d6 100644 --- a/key/keypress.h +++ b/key/keypress.h @@ -10,10 +10,12 @@ #else #include #endif + #ifdef __cplusplus extern "C" { #endif + #if defined(IS_MACOSX) typedef enum { diff --git a/mouse/mouse.h b/mouse/mouse.h index 6f7d904..1b65916 100644 --- a/mouse/mouse.h +++ b/mouse/mouse.h @@ -10,11 +10,13 @@ #else #include #endif + #ifdef __cplusplus // #ifdefined(__cplusplus)||defined(c_plusplus) extern "C" { #endif + #if defined(IS_MACOSX) // #include @@ -96,9 +98,9 @@ void doubleClick(MMMouseButton button); * TODO: Add a smoothly scroll mouse next. */ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection); -#endif /* MOUSE_H */ - //#ifdefined(__cplusplus)||defined(c_plusplus) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif + +#endif /* MOUSE_H */ \ No newline at end of file