diff --git a/src/dm_arg.f90 b/src/dm_arg.f90 index 2f648bc..cc8f54b 100644 --- a/src/dm_arg.f90 +++ b/src/dm_arg.f90 @@ -326,24 +326,15 @@ integer function dm_arg_read(args, app, major, minor, patch, version) result(rc) case (E_ARG_TYPE) select case (args(i)%type) - case (ARG_TYPE_INTEGER) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not an integer') - case (ARG_TYPE_REAL) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a number') - case (ARG_TYPE_CHAR) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a single character') - case (ARG_TYPE_ID) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid id') - case (ARG_TYPE_UUID) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid UUID') - case (ARG_TYPE_TIME) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not in ISO 8601 format') - case (ARG_TYPE_LEVEL) - call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid log level') - case (ARG_TYPE_FILE) - call dm_error_out(rc, 'file ' // trim(args(i)%value) // ' not found') - case (ARG_TYPE_DATABASE) - call dm_error_out(rc, 'database ' // trim(args(i)%value) // ' not found') + case (ARG_TYPE_INTEGER); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not an integer') + case (ARG_TYPE_REAL); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a number') + case (ARG_TYPE_CHAR); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a single character') + case (ARG_TYPE_ID); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid id') + case (ARG_TYPE_UUID); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid UUID') + case (ARG_TYPE_TIME); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not in ISO 8601 format') + case (ARG_TYPE_LEVEL); call dm_error_out(rc, 'argument --' // trim(args(i)%name) // ' is not a valid log level') + case (ARG_TYPE_FILE); call dm_error_out(rc, 'file ' // trim(args(i)%value) // ' not found') + case (ARG_TYPE_DATABASE); call dm_error_out(rc, 'database ' // trim(args(i)%value) // ' not found') end select exit validate_loop diff --git a/src/dm_error.f90 b/src/dm_error.f90 index ece059e..68d3c2d 100644 --- a/src/dm_error.f90 +++ b/src/dm_error.f90 @@ -239,7 +239,7 @@ pure function dm_error_message(error) result(message) case (E_ZLIB); message = 'zlib error' case (E_ZSTD); message = 'zstd error' case (E_XMPP); message = 'XMPP error' - ! Default. + ! Unknown. case default; message = 'unknown error' end select end function dm_error_message diff --git a/src/dm_file.f90 b/src/dm_file.f90 index 3536f89..8ecefc2 100644 --- a/src/dm_file.f90 +++ b/src/dm_file.f90 @@ -119,22 +119,14 @@ integer function dm_file_status(path, status) result(rc) file_type = int(iand(status%mode, int(S_IFMT, kind=i8))) select case (file_type) - case (S_IFBLK) - status%type = FILE_TYPE_BLOCK - case (S_IFCHR) - status%type = FILE_TYPE_CHAR - case (S_IFDIR) - status%type = FILE_TYPE_DIR - case (S_IFIFO) - status%type = FILE_TYPE_FIFO - case (S_IFLNK) - status%type = FILE_TYPE_LINK - case (S_IFREG) - status%type = FILE_TYPE_FILE - case (S_IFSOCK) - status%type = FILE_TYPE_SOCKET - case default - status%type = FILE_TYPE_NONE + case (S_IFBLK); status%type = FILE_TYPE_BLOCK + case (S_IFCHR); status%type = FILE_TYPE_CHAR + case (S_IFDIR); status%type = FILE_TYPE_DIR + case (S_IFIFO); status%type = FILE_TYPE_FIFO + case (S_IFLNK); status%type = FILE_TYPE_LINK + case (S_IFREG); status%type = FILE_TYPE_FILE + case (S_IFSOCK); status%type = FILE_TYPE_SOCKET + case default; status%type = FILE_TYPE_NONE end select status%a_time = fs%st_atim%tv_sec ! Last access time. diff --git a/src/dm_geocom_error.f90 b/src/dm_geocom_error.f90 index 32ea42a..ff0fcab 100644 --- a/src/dm_geocom_error.f90 +++ b/src/dm_geocom_error.f90 @@ -568,7 +568,7 @@ pure function dm_geocom_error_message(grc) result(message) case (GRC_FTR_NOTENOUGHSPACE); message = 'not enough space on device to proceed uploading' case (GRC_FTR_INVALIDINPUT); message = 'rename of file failed' case (GRC_FTR_MISSINGSETUP); message = 'invalid parameter as input' - ! Default + ! unknown case default; message = 'unknown GeoCOM code (' // dm_itoa(grc) // ')' end select end function dm_geocom_error_message diff --git a/src/dm_hdf5.f90 b/src/dm_hdf5.f90 index 51cfac8..4b34968 100644 --- a/src/dm_hdf5.f90 +++ b/src/dm_hdf5.f90 @@ -246,16 +246,11 @@ logical function dm_hdf5_has_filter(filter, error) result(available) hdf5_block: block rc = E_INVALID select case (filter) - case (HDF5_FILTER_DEFLATE) - f = H5Z_FILTER_DEFLATE_F - case (HDF5_FILTER_SHUFFLE) - f = H5Z_FILTER_SHUFFLE_F - case (HDF5_FILTER_FLETCHER32) - f = H5Z_FILTER_FLETCHER32_F - case (HDF5_FILTER_SZIP) - f = H5Z_FILTER_SZIP_F - case default - exit hdf5_block + case (HDF5_FILTER_DEFLATE); f = H5Z_FILTER_DEFLATE_F + case (HDF5_FILTER_SHUFFLE); f = H5Z_FILTER_SHUFFLE_F + case (HDF5_FILTER_FLETCHER32); f = H5Z_FILTER_FLETCHER32_F + case (HDF5_FILTER_SZIP); f = H5Z_FILTER_SZIP_F + case default; exit hdf5_block end select rc = E_HDF5 @@ -923,14 +918,11 @@ integer function hdf5_open_file(file, path, mode, create) result(rc) mode_ = HDF5_RDWR if (present(mode)) mode_ = mode + rc = E_INVALID select case (mode_) - case (HDF5_RDONLY) - flags = H5F_ACC_RDONLY_F - case (HDF5_RDWR) - flags = H5F_ACC_RDWR_F - case default - rc = E_INVALID - return + case (HDF5_RDONLY); flags = H5F_ACC_RDONLY_F + case (HDF5_RDWR); flags = H5F_ACC_RDWR_F + case default; return end select rc = E_NOT_FOUND diff --git a/src/dm_http.f90 b/src/dm_http.f90 index 5e97a32..1de03ed 100644 --- a/src/dm_http.f90 +++ b/src/dm_http.f90 @@ -41,57 +41,32 @@ pure function dm_http_status_string(http_status) result(str) select case (http_status) ! 20X - case (HTTP_OK) - str = 'OK' - case (HTTP_CREATED) - str = 'Created' - case (HTTP_ACCEPTED) - str = 'Accepted' - case (HTTP_NO_CONTENT) - str = 'No Content' - case (HTTP_RESET_CONTENT) - str = 'Reset Content' - + case (HTTP_OK); str = 'OK' + case (HTTP_CREATED); str = 'Created' + case (HTTP_ACCEPTED); str = 'Accepted' + case (HTTP_NO_CONTENT); str = 'No Content' + case (HTTP_RESET_CONTENT); str = 'Reset Content' ! 4XX - case (HTTP_BAD_REQUEST) - str = 'Bad Request' - case (HTTP_UNAUTHORIZED) - str = 'Unauthorized' - case (HTTP_PAYMENT_REQUIRED) - str = 'Payment Required' - case (HTTP_FORBIDDEN) - str = 'Forbidden' - case (HTTP_NOT_FOUND) - str = 'Not Found' - case (HTTP_METHOD_NOT_ALLOWED) - str = 'Method Not Allowed' - case (HTTP_NOT_ACCEPTABLE) - str = 'Not Acceptable' - case (HTTP_PROXY_AUTHENTICATION_REQUIRED) - str = 'Proxy Authentication Required' - case (HTTP_REQUEST_TIMEOUT) - str = 'Request Timeout' - case (HTTP_CONFLICT) - str = 'Conflict' - case (HTTP_GONE) - str = 'Gone' - case (HTTP_LENGTH_REQUIRED) - str = 'Length Required' - case (HTTP_UNSUPPORTED_MEDIA_TYPE) - str = 'Unsupported Media Type' - + case (HTTP_BAD_REQUEST); str = 'Bad Request' + case (HTTP_UNAUTHORIZED); str = 'Unauthorized' + case (HTTP_PAYMENT_REQUIRED); str = 'Payment Required' + case (HTTP_FORBIDDEN); str = 'Forbidden' + case (HTTP_NOT_FOUND); str = 'Not Found' + case (HTTP_METHOD_NOT_ALLOWED); str = 'Method Not Allowed' + case (HTTP_NOT_ACCEPTABLE); str = 'Not Acceptable' + case (HTTP_PROXY_AUTHENTICATION_REQUIRED); str = 'Proxy Authentication Required' + case (HTTP_REQUEST_TIMEOUT); str = 'Request Timeout' + case (HTTP_CONFLICT); str = 'Conflict' + case (HTTP_GONE); str = 'Gone' + case (HTTP_LENGTH_REQUIRED); str = 'Length Required' + case (HTTP_UNSUPPORTED_MEDIA_TYPE); str = 'Unsupported Media Type' ! 50X - case (HTTP_INTERNAL_SERVER_ERROR) - str = 'Internal Server Error' - case (HTTP_NOT_IMPLEMENTED) - str = 'Not Implemented' - case (HTTP_BAD_GATEWAY) - str = 'Bad Gateway' - case (HTTP_SERVICE_UNAVAILABLE) - str = 'Service Unavailable' - - case default - str = '' + case (HTTP_INTERNAL_SERVER_ERROR); str = 'Internal Server Error' + case (HTTP_NOT_IMPLEMENTED); str = 'Not Implemented' + case (HTTP_BAD_GATEWAY); str = 'Bad Gateway' + case (HTTP_SERVICE_UNAVAILABLE); str = 'Service Unavailable' + ! NIY + case default; str = '' end select end function dm_http_status_string end module dm_http diff --git a/src/dm_log.f90 b/src/dm_log.f90 index 30f9667..abee0b5 100644 --- a/src/dm_log.f90 +++ b/src/dm_log.f90 @@ -125,7 +125,7 @@ pure elemental logical function dm_log_is_valid(log) result(valid) valid = .false. - if (.not. dm_log_level_is_valid(log%level)) return + if (.not. dm_log_level_is_valid(log%level)) return if (.not. dm_error_is_valid(log%error)) return if (log%id == UUID_DEFAULT) return if (.not. dm_uuid4_is_valid(log%id)) return diff --git a/src/dm_lua.f90 b/src/dm_lua.f90 index 1249f72..722591d 100644 --- a/src/dm_lua.f90 +++ b/src/dm_lua.f90 @@ -196,22 +196,14 @@ integer function dm_lua_error(lua_error) result(rc) integer, intent(in) :: lua_error !! Lua error code. select case (lua_error) - case (LUA_OK) - rc = E_NONE - case (LUA_YIELD) - rc = E_LUA_YIELD - case (LUA_ERRRUN) - rc = E_LUA_RUNTIME - case (LUA_ERRSYNTAX) - rc = E_LUA_SYNTAX - case (LUA_ERRMEM) - rc = E_LUA_MEM - case (LUA_ERRERR) - rc = E_LUA_ERROR - case (LUA_ERRFILE) - rc = E_LUA_FILE - case default - rc = E_LUA + case (LUA_OK); rc = E_NONE + case (LUA_YIELD); rc = E_LUA_YIELD + case (LUA_ERRRUN); rc = E_LUA_RUNTIME + case (LUA_ERRSYNTAX); rc = E_LUA_SYNTAX + case (LUA_ERRMEM); rc = E_LUA_MEM + case (LUA_ERRERR); rc = E_LUA_ERROR + case (LUA_ERRFILE); rc = E_LUA_FILE + case default; rc = E_LUA end select end function dm_lua_error @@ -548,16 +540,11 @@ subroutine dm_lua_dump_stack(lua, unit) write (unit_, '(tr1, i0, tr1, a, tr1)', advance='no') i, lua_typename(lua%ctx, type) select case (type) - case (LUA_TNIL) - write (unit_, '("nil")') - case (LUA_TBOOLEAN) - write (unit_, '(l1)') lua_toboolean(lua%ctx, i) - case (LUA_TNUMBER) - write (unit_, '(f0.1)') lua_tonumber(lua%ctx, i) - case (LUA_TSTRING) - write (unit_, '(a)') lua_tostring(lua%ctx, i) - case default - write (unit_, *) + case (LUA_TNIL); write (unit_, '("nil")') + case (LUA_TBOOLEAN); write (unit_, '(l1)') lua_toboolean(lua%ctx, i) + case (LUA_TNUMBER); write (unit_, '(f0.1)') lua_tonumber(lua%ctx, i) + case (LUA_TSTRING); write (unit_, '(a)') lua_tostring(lua%ctx, i) + case default; write (unit_, *) end select end do end subroutine dm_lua_dump_stack diff --git a/src/dm_mqueue.f90 b/src/dm_mqueue.f90 index d5a7a38..74863f5 100644 --- a/src/dm_mqueue.f90 +++ b/src/dm_mqueue.f90 @@ -173,12 +173,9 @@ integer function mqueue_open_raw(mqueue, name, max_msg, msg_size, access, mode, if (present(access)) then select case (access) - case (MQUEUE_RDONLY) - flag = O_RDONLY - case (MQUEUE_WRONLY) - flag = O_WRONLY - case (MQUEUE_RDWR) - flag = O_RDWR + case (MQUEUE_RDONLY); flag = O_RDONLY + case (MQUEUE_WRONLY); flag = O_WRONLY + case (MQUEUE_RDWR); flag = O_RDWR end select end if diff --git a/src/dm_path.f90 b/src/dm_path.f90 index b013b64..dae3340 100644 --- a/src/dm_path.f90 +++ b/src/dm_path.f90 @@ -52,20 +52,13 @@ function dm_path_parsed(path) result(parsed) end if select case (a) - case ('D') - parsed = parsed // date(7:8) - case ('M') - parsed = parsed // date(5:6) - case ('Y') - parsed = parsed // date(3:4) - case ('h') - parsed = parsed // time(1:2) - case ('m') - parsed = parsed // time(3:4) - case ('s') - parsed = parsed // time(5:6) - case default - parsed = parsed // '%' // a + case ('D'); parsed = parsed // date(7:8) + case ('M'); parsed = parsed // date(5:6) + case ('Y'); parsed = parsed // date(3:4) + case ('h'); parsed = parsed // time(1:2) + case ('m'); parsed = parsed // time(3:4) + case ('s'); parsed = parsed // time(5:6) + case default; parsed = parsed // '%' // a end select flag = .false. diff --git a/src/dm_pipe.f90 b/src/dm_pipe.f90 index 518a61f..1afc04b 100644 --- a/src/dm_pipe.f90 +++ b/src/dm_pipe.f90 @@ -57,12 +57,9 @@ integer function dm_pipe_open(pipe, command, access) result(rc) rc = E_INVALID select case (access) - case (PIPE_RDONLY) - a = 'r' // c_null_char - case (PIPE_WRONLY) - a = 'w' // c_null_char - case default - return + case (PIPE_RDONLY); a = 'r' // c_null_char + case (PIPE_WRONLY); a = 'w' // c_null_char + case default; return end select rc = E_SYSTEM diff --git a/src/dm_response.f90 b/src/dm_response.f90 index 2aa0949..b434dbe 100644 --- a/src/dm_response.f90 +++ b/src/dm_response.f90 @@ -79,9 +79,9 @@ pure elemental logical function dm_response_is_valid(response) result(valid) type(response_type), intent(in) :: response !! Response type. valid = .false. - if (.not. dm_id_is_valid(response%name)) return + if (.not. dm_id_is_valid(response%name)) return if (.not. dm_response_type_is_valid(response%type)) return - if (.not. dm_error_is_valid(response%error)) return + if (.not. dm_error_is_valid(response%error)) return valid = .true. end function dm_response_is_valid @@ -89,9 +89,7 @@ pure elemental logical function dm_response_type_is_valid(type) result(valid) !! Returns `.true.` if the given response value type is valid. integer, intent(in) :: type !! Response value type. - valid = .false. - if (type < RESPONSE_TYPE_REAL64 .or. type > RESPONSE_TYPE_LAST) return - valid = .true. + valid = (type >= RESPONSE_TYPE_REAL64 .and. type <= RESPONSE_TYPE_LAST) end function dm_response_type_is_valid pure function dm_response_type_to_name(type) result(str) diff --git a/src/dm_signal.f90 b/src/dm_signal.f90 index acdb864..442e7ba 100644 --- a/src/dm_signal.f90 +++ b/src/dm_signal.f90 @@ -29,66 +29,36 @@ function dm_signal_name(signum) result(name) character(len=:), allocatable :: name !! Signal name. select case (signum) - case (SIGHUP) - name = 'SIGHUP' - case (SIGINT) - name = 'SIGINT' - case (SIGQUIT) - name = 'SIGQUIT' - case (SIGILL) - name = 'SIGILL' - case (SIGTRAP) - name = 'SIGTRAP' - case (SIGABRT) ! SIGIOT - name = 'SIGABRT' - case (SIGBUS) - name = 'SIGBUS' - case (SIGFPE) - name = 'SIGFPE' - case (SIGKILL) - name = 'SIGKILL' - case (SIGUSR1) - name = 'SIGUSR1' - case (SIGSEGV) - name = 'SIGSEGV' - case (SIGUSR2) - name = 'SIGUSR2' - case (SIGPIPE) - name = 'SIGPIPE' - case (SIGALRM) - name = 'SIGALRM' - case (SIGTERM) - name = 'SIGTERM' - case (SIGCHLD) - name = 'SIGCHLD' - case (SIGCONT) - name = 'SIGCONT' - case (SIGSTOP) - name = 'SIGSTOP' - case (SIGTSTP) - name = 'SIGTSTP' - case (SIGTTIN) - name = 'SIGTTIN' - case (SIGTTOU) - name = 'SIGTTOU' - case (SIGURG) - name = 'SIGURG' - case (SIGXCPU) - name = 'SIGXCPU' - case (SIGXFSZ) - name = 'SIGXFSZ' - case (SIGVTALRM) - name = 'SIGVTALRM' - case (SIGPROF) - name = 'SIGPROF' - case (SIGWINCH) - name = 'SIGWINCH' - case (SIGIO) - name = 'SIGIO' - case (SIGSYS) - name = 'SIGSYS' - case default - name = dm_itoa(signum) + case (SIGHUP); name = 'SIGHUP' + case (SIGINT); name = 'SIGINT' + case (SIGQUIT); name = 'SIGQUIT' + case (SIGILL); name = 'SIGILL' + case (SIGTRAP); name = 'SIGTRAP' + case (SIGABRT); name = 'SIGABRT' ! SIGIOT + case (SIGBUS); name = 'SIGBUS' + case (SIGFPE); name = 'SIGFPE' + case (SIGKILL); name = 'SIGKILL' + case (SIGUSR1); name = 'SIGUSR1' + case (SIGSEGV); name = 'SIGSEGV' + case (SIGUSR2); name = 'SIGUSR2' + case (SIGPIPE); name = 'SIGPIPE' + case (SIGALRM); name = 'SIGALRM' + case (SIGTERM); name = 'SIGTERM' + case (SIGCHLD); name = 'SIGCHLD' + case (SIGCONT); name = 'SIGCONT' + case (SIGSTOP); name = 'SIGSTOP' + case (SIGTSTP); name = 'SIGTSTP' + case (SIGTTIN); name = 'SIGTTIN' + case (SIGTTOU); name = 'SIGTTOU' + case (SIGURG); name = 'SIGURG' + case (SIGXCPU); name = 'SIGXCPU' + case (SIGXFSZ); name = 'SIGXFSZ' + case (SIGVTALRM); name = 'SIGVTALRM' + case (SIGPROF); name = 'SIGPROF' + case (SIGWINCH); name = 'SIGWINCH' + case (SIGIO); name = 'SIGIO' + case (SIGSYS); name = 'SIGSYS' + case default; name = dm_itoa(signum) end select end function dm_signal_name diff --git a/src/dm_tty.f90 b/src/dm_tty.f90 index d20c54a..f7e664a 100644 --- a/src/dm_tty.f90 +++ b/src/dm_tty.f90 @@ -142,16 +142,11 @@ integer function dm_tty_byte_size_from_value(value, error) result(byte_size) if (present(error)) error = E_INVALID select case (value) - case (5) - byte_size = TTY_BYTE_SIZE5 - case (6) - byte_size = TTY_BYTE_SIZE6 - case (7) - byte_size = TTY_BYTE_SIZE7 - case (8) - byte_size = TTY_BYTE_SIZE8 - case default - return + case (5); byte_size = TTY_BYTE_SIZE5 + case (6); byte_size = TTY_BYTE_SIZE6 + case (7); byte_size = TTY_BYTE_SIZE7 + case (8); byte_size = TTY_BYTE_SIZE8 + case default; return end select if (present(error)) error = E_NONE @@ -339,14 +334,10 @@ integer function dm_tty_open(tty, path, baud_rate, byte_size, parity, stop_bits) flags = ior(flags, O_NDELAY) select case (tty%access) - case (TTY_RDONLY) - flags = ior(flags, O_RDONLY) - case (TTY_WRONLY) - flags = ior(flags, O_WRONLY) - case (TTY_RDWR) - flags = ior(flags, O_RDWR) - case default - return + case (TTY_RDONLY); flags = ior(flags, O_RDONLY) + case (TTY_WRONLY); flags = ior(flags, O_WRONLY) + case (TTY_RDWR); flags = ior(flags, O_RDWR) + case default; return end select ! Open TTY. @@ -373,14 +364,10 @@ integer function dm_tty_parity_from_name(name, error) result(parity) if (present(error)) error = E_INVALID select case (dm_to_lower(name)) - case ('none') - parity = TTY_PARITY_NONE - case ('odd') - parity = TTY_PARITY_ODD - case ('even') - parity = TTY_PARITY_EVEN - case default - return + case ('none'); parity = TTY_PARITY_NONE + case ('odd'); parity = TTY_PARITY_ODD + case ('even'); parity = TTY_PARITY_EVEN + case default; return end select if (present(error)) error = E_NONE @@ -692,8 +679,8 @@ integer function dm_tty_stop_bits_from_value(value, error) result(stop_bits) if (present(error)) error = E_INVALID select case (value) - case (1); stop_bits = TTY_STOP_BITS1 - case (2); stop_bits = TTY_STOP_BITS2 + case (1); stop_bits = TTY_STOP_BITS1 + case (2); stop_bits = TTY_STOP_BITS2 case default; return end select diff --git a/src/dm_unit.f90 b/src/dm_unit.f90 index 51cec1e..5cf172d 100644 --- a/src/dm_unit.f90 +++ b/src/dm_unit.f90 @@ -38,14 +38,10 @@ pure elemental function dm_unit_to_deg(a) result(b) b%type = UNIT_DEG select case (a%type) - case (UNIT_RAD) - b%value = dm_rad_to_deg(a%value) - case (UNIT_GON) - b%value = dm_gon_to_deg(a%value) - case (UNIT_DEG) - b%value = a%value - case default - b%error = E_TYPE + case (UNIT_RAD); b%value = dm_rad_to_deg(a%value) + case (UNIT_GON); b%value = dm_gon_to_deg(a%value) + case (UNIT_DEG); b%value = a%value + case default; b%error = E_TYPE end select end function dm_unit_to_deg @@ -57,14 +53,10 @@ pure elemental function dm_unit_to_gon(a) result(b) b%type = UNIT_GON select case (a%type) - case (UNIT_RAD) - b%value = dm_rad_to_gon(a%value) - case (UNIT_GON) - b%value = a%value - case (UNIT_DEG) - b%value = dm_deg_to_gon(a%value) - case default - b%error = E_TYPE + case (UNIT_RAD); b%value = dm_rad_to_gon(a%value) + case (UNIT_GON); b%value = a%value + case (UNIT_DEG); b%value = dm_deg_to_gon(a%value) + case default; b%error = E_TYPE end select end function dm_unit_to_gon @@ -76,14 +68,10 @@ pure elemental function dm_unit_to_rad(a) result(b) b%type = UNIT_RAD select case (a%type) - case (UNIT_RAD) - b%value = a%value - case (UNIT_GON) - b%value = dm_gon_to_rad(a%value) - case (UNIT_DEG) - b%value = dm_deg_to_rad(a%value) - case default - b%error = E_TYPE + case (UNIT_RAD); b%value = a%value + case (UNIT_GON); b%value = dm_gon_to_rad(a%value) + case (UNIT_DEG); b%value = dm_deg_to_rad(a%value) + case default; b%error = E_TYPE end select end function dm_unit_to_rad diff --git a/src/dm_uuid.f90 b/src/dm_uuid.f90 index 25168ce..b2e41ac 100644 --- a/src/dm_uuid.f90 +++ b/src/dm_uuid.f90 @@ -6,8 +6,8 @@ module dm_uuid implicit none (type, external) private - integer, parameter, public :: UUID_LEN = 32 !! Hex UUIDv4 length. - integer, parameter, public :: UUID_FULL_LEN = 36 !! Full UUIDv4 length (with hyphens). + integer, parameter, public :: UUID_LEN = 32 !! Hex UUIDv4 length. + integer, parameter, public :: UUID_FULL_LEN = 36 !! Full UUIDv4 length (with hyphens). character(len=*), parameter, public :: UUID_DEFAULT = repeat('0', UUID_LEN) !! Default ID (hex). character(len=*), parameter :: UUID_SET = '0123456789abcdef' @@ -80,17 +80,13 @@ pure elemental logical function dm_uuid4_is_valid(uuid) result(valid) if (a /= '4') return case (17) select case (a) - case ('8', '9', 'a', 'b') - continue - case default - return + case ('8', '9', 'a', 'b'); continue + case default; return end select case default select case (a) - case ('0':'9', 'a':'f') - continue - case default - return + case ('0':'9', 'a':'f'); continue + case default; return end select end select end do