Mercurial > hg > octave-nkf
comparison scripts/image/imformats.m @ 16907:04f4f067eb33
imformats: fix typos and silence some statements.
* imformats: replace some varargin by varargout (typos) and add
missing semi-colon to silence some statements.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 06 Jul 2013 04:08:17 +0100 |
parents | bfad37d33435 |
children | d0558ee259ad |
comparison
equal
deleted
inserted
replaced
16906:bfad37d33435 | 16907:04f4f067eb33 |
---|---|
84 if (! isstruct (arg2)) | 84 if (! isstruct (arg2)) |
85 error ("imformats: FORMAT to %s must be a structure.", arg1); | 85 error ("imformats: FORMAT to %s must be a structure.", arg1); |
86 endif | 86 endif |
87 arrayfun (@is_valid_format, arg2); | 87 arrayfun (@is_valid_format, arg2); |
88 formats(end + numel (b)) = arg2; | 88 formats(end + numel (b)) = arg2; |
89 varargin{1} = formats; | 89 varargout{1} = formats; |
90 | 90 |
91 case {"remove", "update"}, | 91 case {"remove", "update"}, |
92 if (! ischar (arg2)) | 92 if (! ischar (arg2)) |
93 error ("imformats: EXT to %s must be a string.", arg1); | 93 error ("imformats: EXT to %s must be a string.", arg1); |
94 endif | 94 endif |
95 ## FIXME: suppose a format with multiple extensions. If one of | 95 ## FIXME: suppose a format with multiple extensions. If one of |
96 ## them is requested to be removed, should we remove the | 96 ## them is requested to be removed, should we remove the |
97 ## whole format, or just that extension from the format? | 97 ## whole format, or just that extension from the format? |
98 match = find_ext_idx (formats, arg2) | 98 match = find_ext_idx (formats, arg2); |
99 if (! any (match)) | 99 if (! any (match)) |
100 error ("imformats: no EXT `%s' found.", arg2); | 100 error ("imformats: no EXT `%s' found.", arg2); |
101 endif | 101 endif |
102 if (strcmpi (arg1, "remove")) | 102 if (strcmpi (arg1, "remove")) |
103 formats(match) = []; | 103 formats(match) = []; |
107 error ("imformats: FORMAT to update must be a structure."); | 107 error ("imformats: FORMAT to update must be a structure."); |
108 endif | 108 endif |
109 is_valid_format (arg3); | 109 is_valid_format (arg3); |
110 formats(match) = arg3; | 110 formats(match) = arg3; |
111 endif | 111 endif |
112 varargin{1} = formats; | 112 varargout{1} = formats; |
113 | 113 |
114 case "factory", | 114 case "factory", |
115 formats = default_formats (); | 115 formats = default_formats (); |
116 otherwise | 116 otherwise |
117 ## then we look for a format with that extension. | 117 ## then we look for a format with that extension. |
118 match = find_ext_idx (formats, arg1) | 118 match = find_ext_idx (formats, arg1); |
119 ## For matlab compatibility, if we don't find any format we must | 119 ## For matlab compatibility, if we don't find any format we must |
120 ## return an empty struct with NO fields. We can't use match as mask | 120 ## return an empty struct with NO fields. We can't use match as mask |
121 if (any (match)) | 121 if (any (match)) |
122 varargin{1} = formats(match); | 122 varargout{1} = formats(match); |
123 else | 123 else |
124 varargin{1} = struct (); | 124 varargout{1} = struct (); |
125 endif | 125 endif |
126 endswitch | 126 endswitch |
127 else | 127 else |
128 error ("imformats: first argument must be either a structure or string."); | 128 error ("imformats: first argument must be either a structure or string."); |
129 endif | 129 endif |