Mercurial > octave-libtiff
comparison libinterp/corefcn/__tiff__.cc @ 31217:c09f6a3597e6 default tip gsoc-libtiff
__tiff__.cc: handled unused parameter warning when Tiff is not enabled
* libtinerp/corefcn/__tiff__.cc: added appropriate hadnling for unused
parameters for cases when Octave is compiled without Tiff support to
suppress compiler warnings in that case.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Wed, 07 Sep 2022 18:39:10 +0200 |
parents | fe776b0e904d |
children |
comparison
equal
deleted
inserted
replaced
31216:fe776b0e904d | 31217:c09f6a3597e6 |
---|---|
2603 set_field_data (tif, fip, args(2)); | 2603 set_field_data (tif, fip, args(2)); |
2604 } | 2604 } |
2605 | 2605 |
2606 return octave_value_list (); | 2606 return octave_value_list (); |
2607 #else | 2607 #else |
2608 octave_unused_parameter (args); | |
2608 err_disabled_feature ("setTag", "Tiff"); | 2609 err_disabled_feature ("setTag", "Tiff"); |
2609 #endif | 2610 #endif |
2610 } | 2611 } |
2611 | 2612 |
2612 DEFUN (__tiff_read__, args, nargout, | 2613 DEFUN (__tiff_read__, args, nargout, |
2664 error ("Unsupported sample format"); | 2665 error ("Unsupported sample format"); |
2665 } | 2666 } |
2666 | 2667 |
2667 return retval; | 2668 return retval; |
2668 #else | 2669 #else |
2670 octave_unused_parameter (args); | |
2671 octave_unused_parameter (nargout); | |
2669 err_disabled_feature ("read", "Tiff"); | 2672 err_disabled_feature ("read", "Tiff"); |
2670 #endif | 2673 #endif |
2671 } | 2674 } |
2672 | 2675 |
2673 DEFUN (__tiff_read_encoded_strip__, args, nargout, | 2676 DEFUN (__tiff_read_encoded_strip__, args, nargout, |
2712 // Convert from Octave's 1-based indexing to zero-based indexing | 2715 // Convert from Octave's 1-based indexing to zero-based indexing |
2713 strip_no--; | 2716 strip_no--; |
2714 | 2717 |
2715 return octave_value_list (handle_read_strip_or_tile (tif, strip_no)); | 2718 return octave_value_list (handle_read_strip_or_tile (tif, strip_no)); |
2716 #else | 2719 #else |
2720 octave_unused_parameter (args); | |
2721 octave_unused_parameter (nargout); | |
2717 err_disabled_feature ("readEncodedStrip", "Tiff"); | 2722 err_disabled_feature ("readEncodedStrip", "Tiff"); |
2718 #endif | 2723 #endif |
2719 } | 2724 } |
2720 | 2725 |
2721 DEFUN (__tiff_read_encoded_tile__, args, nargout, | 2726 DEFUN (__tiff_read_encoded_tile__, args, nargout, |
2760 // Convert from Octave's 1-based indexing to zero-based indexing | 2765 // Convert from Octave's 1-based indexing to zero-based indexing |
2761 tile_no--; | 2766 tile_no--; |
2762 | 2767 |
2763 return octave_value_list (handle_read_strip_or_tile (tif, tile_no)); | 2768 return octave_value_list (handle_read_strip_or_tile (tif, tile_no)); |
2764 #else | 2769 #else |
2770 octave_unused_parameter (args); | |
2771 octave_unused_parameter (nargout); | |
2765 err_disabled_feature ("readEncodedTile", "Tiff"); | 2772 err_disabled_feature ("readEncodedTile", "Tiff"); |
2766 #endif | 2773 #endif |
2767 } | 2774 } |
2768 | 2775 |
2769 DEFUN (__tiff_read_rgba_image__, args, , | 2776 DEFUN (__tiff_read_rgba_image__, args, , |
2853 img = img.permute (perm); | 2860 img = img.permute (perm); |
2854 | 2861 |
2855 // Slice the data into RGB and alpha | 2862 // Slice the data into RGB and alpha |
2856 return slice_rgba (img); | 2863 return slice_rgba (img); |
2857 #else | 2864 #else |
2865 octave_unused_parameter (args); | |
2858 err_disabled_feature ("readRGBAImage", "Tiff"); | 2866 err_disabled_feature ("readRGBAImage", "Tiff"); |
2859 #endif | 2867 #endif |
2860 } | 2868 } |
2861 | 2869 |
2862 DEFUN (__tiff_read_rgba_strip__, args, , | 2870 DEFUN (__tiff_read_rgba_strip__, args, , |
2972 strip_data = strip_data.permute (perm); | 2980 strip_data = strip_data.permute (perm); |
2973 | 2981 |
2974 // Slice the data into RGB and alpha | 2982 // Slice the data into RGB and alpha |
2975 return slice_rgba (strip_data); | 2983 return slice_rgba (strip_data); |
2976 #else | 2984 #else |
2985 octave_unused_parameter (args); | |
2977 err_disabled_feature ("readRGBAStrip", "Tiff"); | 2986 err_disabled_feature ("readRGBAStrip", "Tiff"); |
2978 #endif | 2987 #endif |
2979 } | 2988 } |
2980 | 2989 |
2981 DEFUN (__tiff_read_rgba_tile__, args, , | 2990 DEFUN (__tiff_read_rgba_tile__, args, , |
3100 tile_data = tile_data.permute (perm); | 3109 tile_data = tile_data.permute (perm); |
3101 | 3110 |
3102 // Slice the data into RGB and alpha | 3111 // Slice the data into RGB and alpha |
3103 return slice_rgba (tile_data); | 3112 return slice_rgba (tile_data); |
3104 #else | 3113 #else |
3114 octave_unused_parameter (args); | |
3105 err_disabled_feature ("readRGBATile", "Tiff"); | 3115 err_disabled_feature ("readRGBATile", "Tiff"); |
3106 #endif | 3116 #endif |
3107 } | 3117 } |
3108 | 3118 |
3109 DEFUN (__tiff_write__, args, , | 3119 DEFUN (__tiff_write__, args, , |
3158 error ("Unsupported sample format"); | 3168 error ("Unsupported sample format"); |
3159 } | 3169 } |
3160 | 3170 |
3161 return octave_value_list (); | 3171 return octave_value_list (); |
3162 #else | 3172 #else |
3173 octave_unused_parameter (args); | |
3163 err_disabled_feature ("write", "Tiff"); | 3174 err_disabled_feature ("write", "Tiff"); |
3164 #endif | 3175 #endif |
3165 } | 3176 } |
3166 | 3177 |
3167 DEFUN (__tiff_write_encoded_strip__, args, , | 3178 DEFUN (__tiff_write_encoded_strip__, args, , |
3205 | 3216 |
3206 handle_write_strip_or_tile (tif, strip_no, args(2), &image_data); | 3217 handle_write_strip_or_tile (tif, strip_no, args(2), &image_data); |
3207 | 3218 |
3208 return octave_value_list (); | 3219 return octave_value_list (); |
3209 #else | 3220 #else |
3221 octave_unused_parameter (args); | |
3210 err_disabled_feature ("writeEncodedStrip", "Tiff"); | 3222 err_disabled_feature ("writeEncodedStrip", "Tiff"); |
3211 #endif | 3223 #endif |
3212 } | 3224 } |
3213 | 3225 |
3214 DEFUN (__tiff_write_encoded_tile__, args, , | 3226 DEFUN (__tiff_write_encoded_tile__, args, , |
3252 | 3264 |
3253 handle_write_strip_or_tile (tif, tile_no, args(2), &image_data); | 3265 handle_write_strip_or_tile (tif, tile_no, args(2), &image_data); |
3254 | 3266 |
3255 return octave_value_list (); | 3267 return octave_value_list (); |
3256 #else | 3268 #else |
3269 octave_unused_parameter (args); | |
3257 err_disabled_feature ("writeEncodedTile", "Tiff"); | 3270 err_disabled_feature ("writeEncodedTile", "Tiff"); |
3258 #endif | 3271 #endif |
3259 } | 3272 } |
3260 | 3273 |
3261 DEFUN (__tiff_is_tiled__, args, , | 3274 DEFUN (__tiff_is_tiled__, args, , |
3283 TIFF *tif = tiff_handle->get_file (); | 3296 TIFF *tif = tiff_handle->get_file (); |
3284 | 3297 |
3285 bool is_tiled = static_cast<bool> (TIFFIsTiled (tif)); | 3298 bool is_tiled = static_cast<bool> (TIFFIsTiled (tif)); |
3286 return ovl (is_tiled); | 3299 return ovl (is_tiled); |
3287 #else | 3300 #else |
3301 octave_unused_parameter (args); | |
3288 err_disabled_feature ("isTiled", "Tiff"); | 3302 err_disabled_feature ("isTiled", "Tiff"); |
3289 #endif | 3303 #endif |
3290 } | 3304 } |
3291 | 3305 |
3292 DEFUN (__tiff_number_of_strips__, args, , | 3306 DEFUN (__tiff_number_of_strips__, args, , |
3317 error ("The image is tiled not stripped"); | 3331 error ("The image is tiled not stripped"); |
3318 | 3332 |
3319 double strip_count = static_cast<double> (TIFFNumberOfStrips (tif)); | 3333 double strip_count = static_cast<double> (TIFFNumberOfStrips (tif)); |
3320 return ovl (strip_count); | 3334 return ovl (strip_count); |
3321 #else | 3335 #else |
3336 octave_unused_parameter (args); | |
3322 err_disabled_feature ("numberOfStrips", "Tiff"); | 3337 err_disabled_feature ("numberOfStrips", "Tiff"); |
3323 #endif | 3338 #endif |
3324 } | 3339 } |
3325 | 3340 |
3326 DEFUN (__tiff_number_of_tiles__, args, , | 3341 DEFUN (__tiff_number_of_tiles__, args, , |
3351 error ("The image is stripped not tiled"); | 3366 error ("The image is stripped not tiled"); |
3352 | 3367 |
3353 double tile_count = static_cast<double> (TIFFNumberOfTiles (tif)); | 3368 double tile_count = static_cast<double> (TIFFNumberOfTiles (tif)); |
3354 return ovl (tile_count); | 3369 return ovl (tile_count); |
3355 #else | 3370 #else |
3371 octave_unused_parameter (args); | |
3356 err_disabled_feature ("numberOfTiles", "Tiff"); | 3372 err_disabled_feature ("numberOfTiles", "Tiff"); |
3357 #endif | 3373 #endif |
3358 } | 3374 } |
3359 | 3375 |
3360 DEFUN (__tiff_number_of_directories__, args, , | 3376 DEFUN (__tiff_number_of_directories__, args, , |
3382 TIFF *tif = tiff_handle->get_file (); | 3398 TIFF *tif = tiff_handle->get_file (); |
3383 | 3399 |
3384 double dir_count = static_cast<double> (TIFFNumberOfDirectories (tif)); | 3400 double dir_count = static_cast<double> (TIFFNumberOfDirectories (tif)); |
3385 return ovl (dir_count); | 3401 return ovl (dir_count); |
3386 #else | 3402 #else |
3403 octave_unused_parameter (args); | |
3387 err_disabled_feature ("numberOfDirectories", "Tiff"); | 3404 err_disabled_feature ("numberOfDirectories", "Tiff"); |
3388 #endif | 3405 #endif |
3389 } | 3406 } |
3390 | 3407 |
3391 DEFUN (__tiff_compute_strip__, args, , | 3408 DEFUN (__tiff_compute_strip__, args, , |
3452 double strip_number = TIFFComputeStrip (tif, row, plane) + 1; | 3469 double strip_number = TIFFComputeStrip (tif, row, plane) + 1; |
3453 if (strip_number > TIFFNumberOfStrips (tif)) | 3470 if (strip_number > TIFFNumberOfStrips (tif)) |
3454 strip_number = TIFFNumberOfStrips (tif); | 3471 strip_number = TIFFNumberOfStrips (tif); |
3455 return ovl (strip_number); | 3472 return ovl (strip_number); |
3456 #else | 3473 #else |
3474 octave_unused_parameter (args); | |
3457 err_disabled_feature ("computeStrip", "Tiff"); | 3475 err_disabled_feature ("computeStrip", "Tiff"); |
3458 #endif | 3476 #endif |
3459 } | 3477 } |
3460 | 3478 |
3461 DEFUN (__tiff_compute_tile__, args, , | 3479 DEFUN (__tiff_compute_tile__, args, , |
3531 double tile_number = TIFFComputeTile (tif, col, row, 0, plane) + 1; | 3549 double tile_number = TIFFComputeTile (tif, col, row, 0, plane) + 1; |
3532 if (tile_number > TIFFNumberOfTiles (tif)) | 3550 if (tile_number > TIFFNumberOfTiles (tif)) |
3533 tile_number = TIFFNumberOfTiles (tif); | 3551 tile_number = TIFFNumberOfTiles (tif); |
3534 return ovl (tile_number); | 3552 return ovl (tile_number); |
3535 #else | 3553 #else |
3554 octave_unused_parameter (args); | |
3536 err_disabled_feature ("computeTile", "Tiff"); | 3555 err_disabled_feature ("computeTile", "Tiff"); |
3537 #endif | 3556 #endif |
3538 } | 3557 } |
3539 | 3558 |
3540 DEFUN (__tiff_default_strip_length__, args, , | 3559 DEFUN (__tiff_default_strip_length__, args, , |
3565 error ("getDefaultStripLength: the image is tiled not stripped"); | 3584 error ("getDefaultStripLength: the image is tiled not stripped"); |
3566 | 3585 |
3567 double strip_len = static_cast<double> (TIFFDefaultStripSize (tif, 0)); | 3586 double strip_len = static_cast<double> (TIFFDefaultStripSize (tif, 0)); |
3568 return ovl (strip_len); | 3587 return ovl (strip_len); |
3569 #else | 3588 #else |
3589 octave_unused_parameter (args); | |
3570 err_disabled_feature ("getDefaultStripLength", "Tiff"); | 3590 err_disabled_feature ("getDefaultStripLength", "Tiff"); |
3571 #endif | 3591 #endif |
3572 } | 3592 } |
3573 | 3593 |
3574 DEFUN (__tiff_is_big_endian__, args, , | 3594 DEFUN (__tiff_is_big_endian__, args, , |
3597 | 3617 |
3598 bool is_big_endian = TIFFIsBigEndian (tif); | 3618 bool is_big_endian = TIFFIsBigEndian (tif); |
3599 | 3619 |
3600 return ovl (is_big_endian); | 3620 return ovl (is_big_endian); |
3601 #else | 3621 #else |
3622 octave_unused_parameter (args); | |
3602 err_disabled_feature ("isBigEndian", "Tiff"); | 3623 err_disabled_feature ("isBigEndian", "Tiff"); |
3603 #endif | 3624 #endif |
3604 } | 3625 } |
3605 | 3626 |
3606 DEFUN (__tiff_current_directory__, args, , | 3627 DEFUN (__tiff_current_directory__, args, , |
3630 uint16_t dir = TIFFCurrentDirectory (tif); | 3651 uint16_t dir = TIFFCurrentDirectory (tif); |
3631 dir++; | 3652 dir++; |
3632 | 3653 |
3633 return ovl (static_cast<double> (dir)); | 3654 return ovl (static_cast<double> (dir)); |
3634 #else | 3655 #else |
3656 octave_unused_parameter (args); | |
3635 err_disabled_feature ("currentDirectory", "Tiff"); | 3657 err_disabled_feature ("currentDirectory", "Tiff"); |
3636 #endif | 3658 #endif |
3637 } | 3659 } |
3638 | 3660 |
3639 DEFUN (__tiff_last_directory__, args, , | 3661 DEFUN (__tiff_last_directory__, args, , |
3662 | 3684 |
3663 bool is_last = TIFFLastDirectory (tif); | 3685 bool is_last = TIFFLastDirectory (tif); |
3664 | 3686 |
3665 return ovl (is_last); | 3687 return ovl (is_last); |
3666 #else | 3688 #else |
3689 octave_unused_parameter (args); | |
3667 err_disabled_feature ("lastDirectory", "Tiff"); | 3690 err_disabled_feature ("lastDirectory", "Tiff"); |
3668 #endif | 3691 #endif |
3669 } | 3692 } |
3670 | 3693 |
3671 DEFUN (__tiff_next_directory__, args, , | 3694 DEFUN (__tiff_next_directory__, args, , |
3699 if (! TIFFReadDirectory (tif)) | 3722 if (! TIFFReadDirectory (tif)) |
3700 error ("Failed to read the next directory"); | 3723 error ("Failed to read the next directory"); |
3701 | 3724 |
3702 return octave_value_list (); | 3725 return octave_value_list (); |
3703 #else | 3726 #else |
3727 octave_unused_parameter (args); | |
3704 err_disabled_feature ("nextDirectory", "Tiff"); | 3728 err_disabled_feature ("nextDirectory", "Tiff"); |
3705 #endif | 3729 #endif |
3706 } | 3730 } |
3707 | 3731 |
3708 DEFUN (__tiff_set_directory__, args, , | 3732 DEFUN (__tiff_set_directory__, args, , |
3738 if (! TIFFSetDirectory(tif, dir)) | 3762 if (! TIFFSetDirectory(tif, dir)) |
3739 error ("Failed to read directory"); | 3763 error ("Failed to read directory"); |
3740 | 3764 |
3741 return octave_value_list (); | 3765 return octave_value_list (); |
3742 #else | 3766 #else |
3767 octave_unused_parameter (args); | |
3743 err_disabled_feature ("setDirectory", "Tiff"); | 3768 err_disabled_feature ("setDirectory", "Tiff"); |
3744 #endif | 3769 #endif |
3745 } | 3770 } |
3746 | 3771 |
3747 DEFUN (__tiff_write_directory__, args, , | 3772 DEFUN (__tiff_write_directory__, args, , |
3769 if (! TIFFWriteDirectory(tif)) | 3794 if (! TIFFWriteDirectory(tif)) |
3770 error ("Failed to write directory"); | 3795 error ("Failed to write directory"); |
3771 | 3796 |
3772 return octave_value_list (); | 3797 return octave_value_list (); |
3773 #else | 3798 #else |
3799 octave_unused_parameter (args); | |
3774 err_disabled_feature ("writeDirectory", "Tiff"); | 3800 err_disabled_feature ("writeDirectory", "Tiff"); |
3775 #endif | 3801 #endif |
3776 } | 3802 } |
3777 | 3803 |
3778 DEFUN (__tiff_rewrite_directory__, args, , | 3804 DEFUN (__tiff_rewrite_directory__, args, , |
3802 if (! TIFFRewriteDirectory(tif)) | 3828 if (! TIFFRewriteDirectory(tif)) |
3803 error ("Failed to rewrite directory"); | 3829 error ("Failed to rewrite directory"); |
3804 | 3830 |
3805 return octave_value_list (); | 3831 return octave_value_list (); |
3806 #else | 3832 #else |
3833 octave_unused_parameter (args); | |
3807 err_disabled_feature ("rewriteDirectory", "Tiff"); | 3834 err_disabled_feature ("rewriteDirectory", "Tiff"); |
3808 #endif | 3835 #endif |
3809 } | 3836 } |
3810 | 3837 |
3811 DEFUN (__tiff_set_sub_directory__, args, , | 3838 DEFUN (__tiff_set_sub_directory__, args, , |
3857 if (! TIFFSetSubDirectory (tif, offset)) | 3884 if (! TIFFSetSubDirectory (tif, offset)) |
3858 error ("Failed to switch to the sub directory"); | 3885 error ("Failed to switch to the sub directory"); |
3859 | 3886 |
3860 return octave_value_list (); | 3887 return octave_value_list (); |
3861 #else | 3888 #else |
3889 octave_unused_parameter (args); | |
3862 err_disabled_feature ("setSubDirectory", "Tiff"); | 3890 err_disabled_feature ("setSubDirectory", "Tiff"); |
3863 #endif | 3891 #endif |
3864 } | 3892 } |
3865 | 3893 |
3866 DEFUN (__tiff_get_directory_offset__, args, , | 3894 DEFUN (__tiff_get_directory_offset__, args, , |
3889 | 3917 |
3890 uint64_t offset = TIFFCurrentDirOffset (tif); | 3918 uint64_t offset = TIFFCurrentDirOffset (tif); |
3891 | 3919 |
3892 return ovl (offset); | 3920 return ovl (offset); |
3893 #else | 3921 #else |
3922 octave_unused_parameter (args); | |
3894 err_disabled_feature ("getDirectoryOffset", "Tiff"); | 3923 err_disabled_feature ("getDirectoryOffset", "Tiff"); |
3895 #endif | 3924 #endif |
3896 } | 3925 } |
3897 | 3926 |
3898 DEFUN (__tiff_version__, , , | 3927 DEFUN (__tiff_version__, , , |
3933 handlers_set = args(0).bool_value (); | 3962 handlers_set = args(0).bool_value (); |
3934 set_internal_handlers (); | 3963 set_internal_handlers (); |
3935 | 3964 |
3936 return octave_value_list (); | 3965 return octave_value_list (); |
3937 #else | 3966 #else |
3967 octave_unused_parameter (args); | |
3938 err_disabled_feature ("setErrorEnabled", "Tiff"); | 3968 err_disabled_feature ("setErrorEnabled", "Tiff"); |
3939 #endif | 3969 #endif |
3940 } | 3970 } |
3941 | 3971 |
3942 DEFUN (__tiff_make_tagid__, , , | 3972 DEFUN (__tiff_make_tagid__, , , |