diff options
author | Björn-Egil Dahlberg <[email protected]> | 2011-09-19 09:42:28 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2011-09-19 09:42:28 +0200 |
commit | 2d13b9580f405541e46491743702eaaedf3f6e91 (patch) | |
tree | 41582dd49f44ee1f2ab92a207bd48e40533ba773 /lib/gs/contribs/bonk/sounder.erl | |
parent | 9d1b6de75122c940333fe86b931771cc6f2d67e2 (diff) | |
parent | 2c79dee4b4f2a0a692cdf28399fc069eca18f07a (diff) | |
download | otp-2d13b9580f405541e46491743702eaaedf3f6e91.tar.gz otp-2d13b9580f405541e46491743702eaaedf3f6e91.tar.bz2 otp-2d13b9580f405541e46491743702eaaedf3f6e91.zip |
Merge branch 'egil/fix-compiler-warning/OTP-9542' into dev
* egil/fix-compiler-warning/OTP-9542:
gs: Update to modern type guards in examples
os_mon: Check results from fgets in cpu_sup
erts: Remove compiler warning in sys.c
Diffstat (limited to 'lib/gs/contribs/bonk/sounder.erl')
-rw-r--r-- | lib/gs/contribs/bonk/sounder.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/gs/contribs/bonk/sounder.erl b/lib/gs/contribs/bonk/sounder.erl index 11ab03d167..899f20d4e0 100644 --- a/lib/gs/contribs/bonk/sounder.erl +++ b/lib/gs/contribs/bonk/sounder.erl @@ -72,13 +72,13 @@ stop() -> sounder ! {stop}, ok end. -new(File) when list(File) -> new(list_to_atom(File)); -new(File) when atom(File) -> +new(File) when is_list(File) -> new(list_to_atom(File)); +new(File) when is_atom(File) -> catch begin check(), sounder ! {new,File,self()}, wait_for_ack(sounder) end. -play(No) when integer(No) -> +play(No) when is_integer(No) -> catch begin check(), sounder ! {play, No, self()}, wait_for_ack(sounder) end. @@ -94,14 +94,14 @@ go() -> loop(Port) -> receive - {new, File, From} when atom(File) -> + {new, File, From} when is_atom(File) -> Port ! {self(),{command,lists:append([0],atom_to_list(File))}}, From ! {sounder,wait_for_ack(Port)}, loop(Port); {play,silent,From} -> From ! {sounder,false}, loop(Port); - {play,No,From} when integer(No) -> + {play,No,From} when is_integer(No) -> Port ! {self(),{command,[No]}}, From ! {sounder,wait_for_ack(Port)}, loop(Port); @@ -118,13 +118,13 @@ loop(Port) -> nosound() -> receive - {new,File,From} when atom(File) -> + {new,File,From} when is_atom(File) -> From ! {sounder,{ok,silent}}, nosound(); {play,silent,From} -> From ! {sounder,true}, nosound(); - {play,No,From} when integer(No) -> + {play,No,From} when is_integer(No) -> From ! {sounder,{error,no_audio_cap}}, nosound(); {stop} -> @@ -135,7 +135,7 @@ nosound() -> wait_for_ack(sounder) -> receive {sounder,Res} -> Res end; -wait_for_ack(Port) when port(Port) -> +wait_for_ack(Port) when is_port(Port) -> receive {Port,{data,"ok"}} -> ok; @@ -149,7 +149,7 @@ wait_for_ack(Port) when port(Port) -> check() -> case whereis(sounder) of - Pid when pid(Pid) -> + Pid when is_pid(Pid) -> ok; undefined -> throw({error,sounder_not_started}) |