Mercurial > octave
comparison scripts/image/imformats.m @ 19278:6ca096827123
Use tempname() rather than tmpnam() in core Octave.
* scripts/miscellaneous/tempname.m: Removed m-file as function is now C++.
* scripts/miscellaneous/tmpnam.m: New m-file is an alias that calls tempname.
* scripts/miscellaneous/module.mk: Add tmpnam.m to build system.
* io.txi: Place tempname, tempdir, P_tmpdir docstrings in section on temporary
files.
* system.txi: Remove tempname, tempdir, P_tmpdir docstrings from generic
system functions section of manual.
* dirfns.cc, dlmread.cc, md5sum.cc, ov-fcn-handle.cc: Replace instances
of tmpnam with tempname in BIST code.
* file-io.cc (Ftempname): Change DEFUNX for tmpnam to DEFUN for tempname.
Remove seealso links to tmpnam.
* ftp.m, playaudio.m, wavwrite.m, imformats.m, imread.m, imwrite.m, imageIO.m,
csvwrite.m, dlmwrite.m, fileread.m, importdata.m, textread.m, textscan.m,
genvarname.m, unpack.m, install.m, legend.m, __gnuplot_drawnow__.m,
copyobj.m, hgsave.m, print.m, __ghostscript__.m, __gnuplot_get_var__.m,
__gnuplot_ginput__.m, __gnuplot_print__.m: Replace tmpnam with tempname in
core code.
* build-sparse-tests.sh, io.tst, prefer.tst, system.tst: Replace tmpnam with
tempname in test code.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 22 Oct 2014 10:41:15 -0700 |
parents | 15db54c4a572 |
children | b95aab49b6be |
comparison
equal
deleted
inserted
replaced
19277:18a3eaf7bdf0 | 19278:6ca096827123 |
---|---|
284 ## function defined by imformats will never be called. Because | 284 ## function defined by imformats will never be called. Because |
285 ## of this, we must create a file for the tests to work. | 285 ## of this, we must create a file for the tests to work. |
286 | 286 |
287 ## changing the function that does the reading | 287 ## changing the function that does the reading |
288 %!testif HAVE_MAGICK | 288 %!testif HAVE_MAGICK |
289 %! fname = [tmpnam() ".jpg"]; | 289 %! fname = [tempname() ".jpg"]; |
290 %! def_fmt = imformats (); | 290 %! def_fmt = imformats (); |
291 %! fid = fopen (fname, "w"); | 291 %! fid = fopen (fname, "w"); |
292 %! unwind_protect | 292 %! unwind_protect |
293 %! fmt = imformats ("jpg"); | 293 %! fmt = imformats ("jpg"); |
294 %! fmt.read = @numel; | 294 %! fmt.read = @numel; |
300 %! imformats (def_fmt); | 300 %! imformats (def_fmt); |
301 %! end_unwind_protect | 301 %! end_unwind_protect |
302 | 302 |
303 ## adding a new format | 303 ## adding a new format |
304 %!testif HAVE_MAGICK | 304 %!testif HAVE_MAGICK |
305 %! fname = [tmpnam() ".new_fmt"]; | 305 %! fname = [tempname() ".new_fmt"]; |
306 %! def_fmt = imformats (); | 306 %! def_fmt = imformats (); |
307 %! fid = fopen (fname, "w"); | 307 %! fid = fopen (fname, "w"); |
308 %! unwind_protect | 308 %! unwind_protect |
309 %! fmt = imformats ("jpg"); # take jpg as template | 309 %! fmt = imformats ("jpg"); # take jpg as template |
310 %! fmt.ext = "new_fmt"; | 310 %! fmt.ext = "new_fmt"; |
317 %! imformats (def_fmt); | 317 %! imformats (def_fmt); |
318 %! end_unwind_protect | 318 %! end_unwind_protect |
319 | 319 |
320 ## adding multiple formats at the same time | 320 ## adding multiple formats at the same time |
321 %!testif HAVE_MAGICK | 321 %!testif HAVE_MAGICK |
322 %! fname1 = [tmpnam() ".new_fmt1"]; | 322 %! fname1 = [tempname() ".new_fmt1"]; |
323 %! fid1 = fopen (fname1, "w"); | 323 %! fid1 = fopen (fname1, "w"); |
324 %! fname2 = [tmpnam() ".new_fmt2"]; | 324 %! fname2 = [tempname() ".new_fmt2"]; |
325 %! fid2 = fopen (fname2, "w"); | 325 %! fid2 = fopen (fname2, "w"); |
326 %! def_fmt = imformats (); | 326 %! def_fmt = imformats (); |
327 %! unwind_protect | 327 %! unwind_protect |
328 %! fmt = imformats ("jpg"); # take jpg as template | 328 %! fmt = imformats ("jpg"); # take jpg as template |
329 %! fmt.ext = "new_fmt1"; | 329 %! fmt.ext = "new_fmt1"; |