diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/drivers/Android/Fl_Android_System_Driver.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'src/drivers/Android/Fl_Android_System_Driver.cxx')
| -rw-r--r-- | src/drivers/Android/Fl_Android_System_Driver.cxx | 114 |
1 files changed, 54 insertions, 60 deletions
diff --git a/src/drivers/Android/Fl_Android_System_Driver.cxx b/src/drivers/Android/Fl_Android_System_Driver.cxx index 0c7185370..e6aa970e4 100644 --- a/src/drivers/Android/Fl_Android_System_Driver.cxx +++ b/src/drivers/Android/Fl_Android_System_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Android system driver. // // Copyright 2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #include "../../config_lib.h" @@ -95,12 +93,12 @@ extern "C" { Pseudo doxygen docs (static function intentionally not documented): - param[in] utf8 input string (UTF-8) - param[in,out] wbuf in: pointer to output string buffer - out: new string (the pointer may be changed) - param[in] lg optional: input string length (default = -1) + param[in] utf8 input string (UTF-8) + param[in,out] wbuf in: pointer to output string buffer + out: new string (the pointer may be changed) + param[in] lg optional: input string length (default = -1) - returns pointer to string buffer + returns pointer to string buffer */ static wchar_t *utf8_to_wchar(const char *utf8, wchar_t *&wbuf, int lg = -1) { unsigned len = (lg >= 0) ? (unsigned)lg : (unsigned)strlen(utf8); @@ -132,11 +130,11 @@ static wchar_t *utf8_to_wchar(const char *utf8, wchar_t *&wbuf, int lg = -1) { Pseudo doxygen docs (static function intentionally not documented): - param[in] wstr input string (wide character, UTF-16) - param[in,out] utf8 in: pointer to output string buffer - out: new string (pointer may be changed) + param[in] wstr input string (wide character, UTF-16) + param[in,out] utf8 in: pointer to output string buffer + out: new string (pointer may be changed) - returns pointer to string buffer + returns pointer to string buffer */ static char *wchar_to_utf8(const wchar_t *wstr, char *&utf8) { unsigned len = (unsigned)wcslen(wstr); @@ -152,7 +150,7 @@ static char *wchar_to_utf8(const wchar_t *wstr, char *&utf8) { /* Creates a driver that manages all system related calls. - + This function must be implemented once for every platform. */ Fl_System_Driver *Fl_System_Driver::newSystemDriver() @@ -237,7 +235,7 @@ int Fl_WinAPI_System_Driver::execvp(const char *file, char *const *argv) { # else wchar_t **ar; utf8_to_wchar(file, wbuf); - + int i = 0, n = 0; while (argv[i]) {i++; n++;} ar = (wchar_t **)malloc(sizeof(wchar_t *) * (n + 1)); @@ -252,14 +250,14 @@ int Fl_WinAPI_System_Driver::execvp(const char *file, char *const *argv) { i++; } ar[n] = NULL; - _wexecvp(wbuf, ar); // STR #3040 + _wexecvp(wbuf, ar); // STR #3040 i = 0; while (i < n) { free(ar[i]); i++; } free(ar); - return -1; // STR #3040 + return -1; // STR #3040 #endif } @@ -360,7 +358,7 @@ char *fl_locale_to_utf8(const char *s, int len, UINT codepage) } if (codepage < 1) codepage = fl_codepage; buf[l] = 0; - + l = MultiByteToWideChar(codepage, 0, s, len, (WCHAR*)wbufa, buf_len); if (l < 0) l = 0; wbufa[l] = 0; @@ -501,16 +499,16 @@ int Fl_WinAPI_System_Driver::filename_expand(char *to, int tolen, const char *fr char *start = temp; char *end = temp+strlen(temp); int ret = 0; - for (char *a=temp; a<end; ) { // for each slash component + for (char *a=temp; a<end; ) { // for each slash component char *e; for (e=a; e<end && !isdirsep(*e); e++) {/*empty*/} // find next slash const char *value = 0; // this will point at substitute value switch (*a) { - case '~': // a home directory name - if (e <= a+1) { // current user's directory + case '~': // a home directory name + if (e <= a+1) { // current user's directory value = getenv("HOME"); } break; - case '$': /* an environment variable */ + case '$': /* an environment variable */ {char t = *e; *(char *)e = 0; value = getenv(a+1); *(char *)e = t;} break; } @@ -537,16 +535,16 @@ int Fl_WinAPI_System_Driver::filename_expand(char *to, int tolen, const char *fr } int // O - 0 if no change, 1 if changed -Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename +Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename int tolen, // I - Size of "to" buffer const char *from, // I - Absolute filename const char *base) // I - Find path relative to this path { - char *newslash; // Directory separator - const char *slash; // Directory separator + char *newslash; // Directory separator + const char *slash; // Directory separator char *cwd = 0L, *cwd_buf = 0L; if (base) cwd = cwd_buf = strdup(base); - + // return if "from" is not an absolute path if (from[0] == '\0' || (!isdirsep(*from) && !isalpha(*from) && from[1] != ':' && @@ -555,7 +553,7 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename if (cwd_buf) free(cwd_buf); return 0; } - + // return if "cwd" is not an absolute path if (!cwd || cwd[0] == '\0' || (!isdirsep(*cwd) && !isalpha(*cwd) && cwd[1] != ':' && @@ -564,18 +562,18 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename if (cwd_buf) free(cwd_buf); return 0; } - + // convert all backslashes into forward slashes for (newslash = strchr(cwd, '\\'); newslash; newslash = strchr(newslash + 1, '\\')) *newslash = '/'; - + // test for the exact same string and return "." if so if (!strcasecmp(from, cwd)) { strlcpy(to, ".", tolen); free(cwd_buf); return (1); } - + // test for the same drive. Return the absolute path if not if (tolower(*from & 255) != tolower(*cwd & 255)) { // Not the same drive... @@ -583,44 +581,44 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename free(cwd_buf); return 0; } - + // compare the path name without the drive prefix from += 2; cwd += 2; - + // compare both path names until we find a difference for (slash = from, newslash = cwd; *slash != '\0' && *newslash != '\0'; slash ++, newslash ++) if (isdirsep(*slash) && isdirsep(*newslash)) continue; else if (tolower(*slash & 255) != tolower(*newslash & 255)) break; - + // skip over trailing slashes if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash) &&(newslash==cwd || !isdirsep(newslash[-1])) ) newslash--; - + // now go back to the first character of the first differing paths segment while (!isdirsep(*slash) && slash > from) slash --; if (isdirsep(*slash)) slash ++; - + // do the same for the current dir if (isdirsep(*newslash)) newslash --; if (*newslash != '\0') while (!isdirsep(*newslash) && newslash > cwd) newslash --; - + // prepare the destination buffer to[0] = '\0'; to[tolen - 1] = '\0'; - + // now add a "previous dir" sequence for every following slash in the cwd while (*newslash != '\0') { if (isdirsep(*newslash)) strlcat(to, "../", tolen); newslash ++; } - + // finally add the differing path from "from" strlcat(to, slash, tolen); - + free(cwd_buf); return 1; } @@ -666,9 +664,9 @@ int Fl_WinAPI_System_Driver::filename_absolute(char *to, int tolen, const char * int Fl_WinAPI_System_Driver::filename_isdir(const char *n) { - struct _stat s; - char fn[FL_PATH_MAX]; - int length; + struct _stat s; + char fn[FL_PATH_MAX]; + int length; length = (int) strlen(n); // This workaround brought to you by the fine folks at Microsoft! // (read lots of sarcasm in that...) @@ -709,7 +707,7 @@ const char *Fl_WinAPI_System_Driver::filename_ext(const char *buf) { int Fl_WinAPI_System_Driver::open_uri(const char *uri, char *msg, int msglen) { - if (msg) snprintf(msg, msglen, "open %s", uri); + if (msg) snprintf(msg, msglen, "open %s", uri); return (int)(ShellExecute(HWND_DESKTOP, "open", uri, NULL, NULL, SW_SHOW) > (void *)32); } @@ -732,7 +730,7 @@ int Fl_WinAPI_System_Driver::file_browser_load_filesystem(Fl_File_Browser *brows // // Normal Windows code uses drive bits... // - DWORD drives; // Drive available bits + DWORD drives; // Drive available bits drives = GetLogicalDrives(); for (int i = 'A'; i <= 'Z'; i ++, drives >>= 1) if (drives & 1) @@ -771,19 +769,19 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer) UUID ud; UUID *pu = &ud; int got_uuid = 0; - - if (!hMod) { // first time in? + + if (!hMod) { // first time in? hMod = LoadLibrary("Rpcrt4.dll"); } - - if (hMod) { // do we have a usable handle to Rpcrt4.dll? + + if (hMod) { // do we have a usable handle to Rpcrt4.dll? uuid_func uuid_crt = (uuid_func)GetProcAddress(hMod, "UuidCreate"); if (uuid_crt != NULL) { RPC_STATUS rpc_res = uuid_crt(pu); if ( // is the return status OK for our needs? - (rpc_res == RPC_S_OK) || // all is well + (rpc_res == RPC_S_OK) || // all is well (rpc_res == RPC_S_UUID_LOCAL_ONLY) || // only unique to this machine - (rpc_res == RPC_S_UUID_NO_ADDRESS) // probably only locally unique + (rpc_res == RPC_S_UUID_NO_ADDRESS) // probably only locally unique ) { got_uuid = -1; sprintf(uuidBuffer, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", @@ -793,14 +791,14 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer) } } } - if (got_uuid == 0) { // did not make a UUID - use fallback logic + if (got_uuid == 0) { // did not make a UUID - use fallback logic unsigned char b[16]; - time_t t = time(0); // first 4 byte + time_t t = time(0); // first 4 byte b[0] = (unsigned char)t; b[1] = (unsigned char)(t>>8); b[2] = (unsigned char)(t>>16); b[3] = (unsigned char)(t>>24); - int r = rand(); // four more bytes + int r = rand(); // four more bytes b[4] = (unsigned char)r; b[5] = (unsigned char)(r>>8); b[6] = (unsigned char)(r>>16); @@ -834,8 +832,8 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer) char *Fl_WinAPI_System_Driver::preference_rootnode(Fl_Preferences *prefs, Fl_Preferences::Root root, const char *vendor, const char *application) { -# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" -# define FLPREFS_RESOURCEW L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" +# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" +# define FLPREFS_RESOURCEW L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" static char filename[ FL_PATH_MAX ]; filename[0] = 0; size_t appDataLen = strlen(vendor) + strlen(application) + 8; @@ -941,7 +939,3 @@ void Fl_WinAPI_System_Driver::gettime(time_t *sec, int *usec) { } #endif - -// -// End of "$Id$". -// |
