jpegoptim.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* jpegoptim.h
  2. *
  3. * JPEGoptim headers
  4. *
  5. * SPDX-License-Identifier: GPL-3.0-or-later
  6. *
  7. * This file is part of JPEGoptim.
  8. *
  9. * JPEGoptim is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * JPEGoptim is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with JPEGoptim. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. #ifndef JPEGOPTIM_H
  23. #define JPEGOPTIM_H 1
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #ifdef WIN32
  28. #include "win32_compat.h"
  29. #define DIR_SEPARATOR_C '\\'
  30. #define DIR_SEPARATOR_S "\\"
  31. #else
  32. #include <sys/param.h>
  33. #include <utime.h>
  34. #define DIR_SEPARATOR_C '/'
  35. #define DIR_SEPARATOR_S "/"
  36. #define set_filemode_binary(file) {}
  37. #endif
  38. #include <sys/types.h>
  39. #include <sys/stat.h>
  40. #include <jpeglib.h>
  41. #ifdef BROKEN_METHODDEF
  42. #undef METHODDEF
  43. #define METHODDEF(x) static x
  44. #endif
  45. #ifndef HAVE_LABS
  46. #define labs abs
  47. #endif
  48. #ifndef MAXPATHLEN
  49. #define MAXPATHLEN 1024
  50. #endif
  51. #define PROGRAMNAME "jpegoptim"
  52. extern int verbose_mode;
  53. extern int quiet_mode;
  54. /* misc.c */
  55. int delete_file(const char *name);
  56. long file_size(FILE *fp);
  57. int is_directory(const char *path);
  58. int is_file(const char *filename, struct stat *st);
  59. int file_exists(const char *pathname);
  60. int rename_file(const char *old_path, const char *new_path);
  61. int copy_file(const char *srcname, const char *dstname);
  62. char *fgetstr(char *s, size_t size, FILE *stream);
  63. char *splitdir(const char *pathname, char *buf, size_t size);
  64. char *splitname(const char *pathname, char *buf, size_t size);
  65. char *strncopy(char *dst, const char *src, size_t size);
  66. char *strncatenate(char *dst, const char *src, size_t size);
  67. char *str_add_list(char *dst, size_t size, const char *src, const char *delim);
  68. void fatal(const char *format, ...);
  69. void warn(const char *format, ...);
  70. /* jpegdest.c */
  71. void jpeg_memory_dest (j_compress_ptr cinfo, unsigned char **bufptr,
  72. size_t *bufsizeptr, size_t incsize);
  73. /* jpegsrc.c */
  74. void jpeg_custom_src(j_decompress_ptr dinfo, FILE *infile,
  75. unsigned char **bufptr, size_t *bufsizeptr, size_t *bufusedptr, size_t incsize);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* JPEGOPTIM_H */