diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-05-15 12:21:30 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-05-15 12:21:30 +0200 |
| commit | 3c2972f924857016bb454201c7e92f25de9105ee (patch) | |
| tree | dee91c4c200c2e97c83fd4c46588bf923f23852c /src/bin | |
| parent | 28d2eabca79d06378843d1e94fecfb4a5e22178d (diff) | |
Reformat: apply reformattin on .h files (#128)
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/common/color.h | 6 | ||||
| -rw-r--r-- | src/bin/common/format_defs.h | 6 | ||||
| -rw-r--r-- | src/bin/common/opj_getopt.h | 23 | ||||
| -rw-r--r-- | src/bin/common/opj_string.h | 44 | ||||
| -rw-r--r-- | src/bin/jp2/convert.h | 39 | ||||
| -rw-r--r-- | src/bin/jp2/index.h | 6 | ||||
| -rw-r--r-- | src/bin/jp2/windirent.h | 415 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/bin/jp3d/convert.h | 103 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/bin/jp3d/getopt.h | 28 | ||||
| -rw-r--r-- | src/bin/jp3d/windirent.h | 415 | ||||
| -rw-r--r-- | src/bin/jpwl/convert.h | 34 | ||||
| -rw-r--r-- | src/bin/jpwl/index.h | 6 | ||||
| -rw-r--r-- | src/bin/jpwl/windirent.h | 415 | ||||
| -rw-r--r-- | src/bin/mj2/meta_out.h | 3 | ||||
| -rw-r--r-- | src/bin/wx/OPJViewer/source/OPJViewer.h | 628 | ||||
| -rw-r--r-- | src/bin/wx/OPJViewer/source/about_htm.h | 94 | ||||
| -rw-r--r-- | src/bin/wx/OPJViewer/source/build.h | 2 | ||||
| -rw-r--r-- | src/bin/wx/OPJViewer/source/imagjpeg2000.h | 176 | ||||
| -rw-r--r-- | src/bin/wx/OPJViewer/source/imagmxf.h | 38 |
19 files changed, 1276 insertions, 1205 deletions
diff --git a/src/bin/common/color.h b/src/bin/common/color.h index 0cd78e89..24792544 100644 --- a/src/bin/common/color.h +++ b/src/bin/common/color.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -8,7 +8,7 @@ * Copyright (c) 2002-2014, Professor Benoit Macq * Copyright (c) 2001-2003, David Janssens * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2007, Francois-Olivier Devaux * Copyright (c) 2003-2014, Antonin Descampe * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. diff --git a/src/bin/common/format_defs.h b/src/bin/common/format_defs.h index 608d7b3a..1985b54f 100644 --- a/src/bin/common/format_defs.h +++ b/src/bin/common/format_defs.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -8,7 +8,7 @@ * Copyright (c) 2002-2014, Professor Benoit Macq * Copyright (c) 2001-2003, David Janssens * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2007, Francois-Olivier Devaux * Copyright (c) 2003-2014, Antonin Descampe * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. diff --git a/src/bin/common/opj_getopt.h b/src/bin/common/opj_getopt.h index f97e8b35..18ac24d4 100644 --- a/src/bin/common/opj_getopt.h +++ b/src/bin/common/opj_getopt.h @@ -3,17 +3,16 @@ #ifndef _GETOPT_H_ #define _GETOPT_H_ -typedef struct opj_option -{ - const char *name; - int has_arg; - int *flag; - int val; -}opj_option_t; +typedef struct opj_option { + const char *name; + int has_arg; + int *flag; + int val; +} opj_option_t; -#define NO_ARG 0 -#define REQ_ARG 1 -#define OPT_ARG 2 +#define NO_ARG 0 +#define REQ_ARG 1 +#define OPT_ARG 2 extern int opj_opterr; extern int opj_optind; @@ -23,7 +22,7 @@ extern char *opj_optarg; extern int opj_getopt(int nargc, char *const *nargv, const char *ostr); extern int opj_getopt_long(int argc, char * const argv[], const char *optstring, - const opj_option_t *longopts, int totlen); + const opj_option_t *longopts, int totlen); extern void opj_reset_options_reading(void); -#endif /* _GETOPT_H_ */ +#endif /* _GETOPT_H_ */ diff --git a/src/bin/common/opj_string.h b/src/bin/common/opj_string.h index 8829926a..f704a8c9 100644 --- a/src/bin/common/opj_string.h +++ b/src/bin/common/opj_string.h @@ -39,34 +39,34 @@ /* keep in mind there still is a buffer read overflow possible */ static size_t opj_strnlen_s(const char *src, size_t max_len) { - size_t len; - - if (src == NULL) { - return 0U; - } - for (len = 0U; (*src != '\0') && (len < max_len); src++, len++); - return len; + size_t len; + + if (src == NULL) { + return 0U; + } + for (len = 0U; (*src != '\0') && (len < max_len); src++, len++); + return len; } /* should be equivalent to C11 function except for the handler */ /* keep in mind there still is a buffer read overflow possible */ static int opj_strcpy_s(char* dst, size_t dst_size, const char* src) { - size_t src_len = 0U; - if ((dst == NULL) || (dst_size == 0U)) { - return EINVAL; - } - if (src == NULL) { - dst[0] = '\0'; - return EINVAL; - } - src_len = opj_strnlen_s(src, dst_size); - if (src_len >= dst_size) { - return ERANGE; - } - memcpy(dst, src, src_len); - dst[src_len] = '\0'; - return 0; + size_t src_len = 0U; + if ((dst == NULL) || (dst_size == 0U)) { + return EINVAL; + } + if (src == NULL) { + dst[0] = '\0'; + return EINVAL; + } + src_len = opj_strnlen_s(src, dst_size); + if (src_len >= dst_size) { + return ERANGE; + } + memcpy(dst, src, src_len); + dst[src_len] = '\0'; + return 0; } #endif /* OPJ_STRING_H */ diff --git a/src/bin/jp2/convert.h b/src/bin/jp2/convert.h index ab1d61a8..61439d49 100644 --- a/src/bin/jp2/convert.h +++ b/src/bin/jp2/convert.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -8,7 +8,7 @@ * Copyright (c) 2002-2014, Professor Benoit Macq * Copyright (c) 2001-2003, David Janssens * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2007, Francois-Olivier Devaux * Copyright (c) 2003-2014, Antonin Descampe * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. @@ -50,19 +50,19 @@ typedef struct raw_comp_cparameters { /**@name RAW image encoding parameters */ /*@{*/ typedef struct raw_cparameters { - /** width of the raw image */ - int rawWidth; - /** height of the raw image */ - int rawHeight; + /** width of the raw image */ + int rawWidth; + /** height of the raw image */ + int rawHeight; /** number of components of the raw image */ - int rawComp; + int rawComp; /** bit depth of the raw image */ int rawBitDepth; /** signed/unsigned raw image */ OPJ_BOOL rawSigned; /** raw components parameters */ raw_comp_cparameters_t *rawComps; - /*@}*/ + /*@}*/ } raw_cparameters_t; /* Component precision clipping */ @@ -71,14 +71,18 @@ void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision); void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision); /* planar / interleaved conversions */ -typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length); +typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, + OPJ_SIZE_T length); extern const convert_32s_CXPX convert_32s_CXPX_LUT[5]; -typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust); +typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, + OPJ_SIZE_T length, OPJ_INT32 adjust); extern const convert_32s_PXCX convert_32s_PXCX_LUT[5]; /* bit depth conversions */ -typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length); +typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, + OPJ_SIZE_T length); extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */ -typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length); +typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, + OPJ_SIZE_T length); extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */ @@ -108,12 +112,15 @@ int imagetopnm(opj_image_t *image, const char *outfile, int force_split); /* RAW conversion */ int imagetoraw(opj_image_t * image, const char *outfile); int imagetorawl(opj_image_t * image, const char *outfile); -opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp); -opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp); +opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, + raw_cparameters_t *raw_cp); +opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters, + raw_cparameters_t *raw_cp); /* PNG conversion*/ extern int imagetopng(opj_image_t *image, const char *write_idf); -extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters); +extern opj_image_t* pngtoimage(const char *filename, + opj_cparameters_t *parameters); #endif /* __J2K_CONVERT_H */ diff --git a/src/bin/jp2/index.h b/src/bin/jp2/index.h index d8b448d0..b461e91b 100644 --- a/src/bin/jp2/index.h +++ b/src/bin/jp2/index.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -40,7 +40,7 @@ extern "C" { /** Write a structured index to a file -@param cstr_info Codestream information +@param cstr_info Codestream information @param index Index filename @return Returns 0 if successful, returns 1 otherwise */ diff --git a/src/bin/jp2/windirent.h b/src/bin/jp2/windirent.h index bef28194..b7ed9a3c 100644 --- a/src/bin/jp2/windirent.h +++ b/src/bin/jp2/windirent.h @@ -1,9 +1,9 @@ /* * uce-dirent.h - operating system independent dirent implementation - * + * * Copyright (C) 1998-2002 Toni Ronkko - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * ``Software''), to deal in the Software without restriction, including @@ -11,10 +11,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -22,8 +22,8 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. - * - * + * + * * May 28 1998, Toni Ronkko <tronkko@messi.uku.fi> * * $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $ @@ -59,7 +59,7 @@ * Revision 1.1 1998/07/04 16:27:51 tr * Initial revision * - * + * * MSVC 1.0 scans automatic dependencies incorrectly when your project * contains this very header. The problem is that MSVC cannot handle * include directives inside #if..#endif block those are never entered. @@ -106,14 +106,14 @@ */ #if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H) # if defined(_MSC_VER) /* Microsoft C/C++ */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__MINGW32__) /* MinGW */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__BORLANDC__) /* Borland C/C++ */ # define HAVE_DIRENT_H # define VOID_CLOSEDIR # elif defined(__TURBOC__) /* Borland Turbo C */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__WATCOMC__) /* Watcom C/C++ */ # define HAVE_DIRECT_H # elif defined(__apollo) /* Apollo */ @@ -172,7 +172,7 @@ #elif defined(MSDOS) || defined(WIN32) - /* figure out type of underlaying directory interface to be used */ +/* figure out type of underlaying directory interface to be used */ # if defined(WIN32) # define DIRENT_WIN32_INTERFACE # elif defined(MSDOS) @@ -181,7 +181,7 @@ # error "missing native dirent interface" # endif - /*** WIN32 specifics ***/ +/*** WIN32 specifics ***/ # if defined(DIRENT_WIN32_INTERFACE) # include <windows.h> # if !defined(DIRENT_MAXNAMLEN) @@ -189,11 +189,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include <dos.h> - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -203,7 +203,7 @@ # define _find_t find_t # endif - /* Turbo C defines ffblk structure in dir.h */ +/* Turbo C defines ffblk structure in dir.h */ # elif defined(__TURBOC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -211,13 +211,13 @@ # endif # define DIRENT_USE_FFBLK - /* MSVC */ +/* MSVC */ # elif defined(_MSC_VER) # if !defined(DIRENT_MAXNAMLEN) # define DIRENT_MAXNAMLEN (12) # endif - /* Watcom */ +/* Watcom */ # elif defined(__WATCOMC__) # if !defined(DIRENT_MAXNAMLEN) # if defined(__OS2__) || defined(__NT__) @@ -230,7 +230,7 @@ # endif # endif - /*** generic MS-DOS and MS-Windows stuff ***/ +/*** generic MS-DOS and MS-Windows stuff ***/ # if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN) # define NAME_MAX DIRENT_MAXNAMLEN # endif @@ -239,16 +239,16 @@ # endif - /* - * Substitute for real dirent structure. Note that `d_name' field is a - * true character array although we have it copied in the implementation - * dependent data. We could save some memory if we had declared `d_name' - * as a pointer referring the name within implementation dependent data. - * We have not done that since some code may rely on sizeof(d_name) to be - * something other than four. Besides, directory entries are typically so - * small that it takes virtually no time to copy them from place to place. - */ - typedef struct dirent { +/* + * Substitute for real dirent structure. Note that `d_name' field is a + * true character array although we have it copied in the implementation + * dependent data. We could save some memory if we had declared `d_name' + * as a pointer referring the name within implementation dependent data. + * We have not done that since some code may rely on sizeof(d_name) to be + * something other than four. Besides, directory entries are typically so + * small that it takes virtually no time to copy them from place to place. + */ +typedef struct dirent { char d_name[NAME_MAX + 1]; /*** Operating system specific part ***/ @@ -261,31 +261,31 @@ struct _find_t data; # endif # endif - } dirent; +} dirent; - /* DIR substitute structure containing directory name. The name is - * essential for the operation of ``rewinndir'' function. */ - typedef struct DIR { +/* DIR substitute structure containing directory name. The name is + * essential for the operation of ``rewinndir'' function. */ +typedef struct DIR { char *dirname; /* directory being scanned */ dirent current; /* current entry */ int dirent_filled; /* is current un-processed? */ - /*** Operating system specific part ***/ + /*** Operating system specific part ***/ # if defined(DIRENT_WIN32_INTERFACE) HANDLE search_handle; # elif defined(DIRENT_MSDOS_INTERFACE) # endif - } DIR; +} DIR; # ifdef __cplusplus extern "C" { # endif /* supply prototypes for dirent functions */ -static DIR *opendir (const char *dirname); -static struct dirent *readdir (DIR *dirp); -static int closedir (DIR *dirp); -static void rewinddir (DIR *dirp); +static DIR *opendir(const char *dirname); +static struct dirent *readdir(DIR *dirp); +static int closedir(DIR *dirp); +static void rewinddir(DIR *dirp); /* * Implement dirent interface as static functions so that the user does not @@ -312,9 +312,9 @@ static void rewinddir (DIR *dirp); # define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags) #endif -static int _initdir (DIR *p); -static const char *_getdirname (const struct dirent *dp); -static void _setdirname (struct DIR *dirp); +static int _initdir(DIR *p); +static const char *_getdirname(const struct dirent *dp); +static void _setdirname(struct DIR *dirp); /* * <function name="opendir"> @@ -325,7 +325,7 @@ static void _setdirname (struct DIR *dirp); * internal working area that is used for retrieving individual directory * entries. The internal working area has no fields of your interest. * - * <ret>Returns a pointer to the internal working area or NULL in case the + * <ret>Returns a pointer to the internal working area or NULL in case the * directory stream could not be opened. Global `errno' variable will set * in case of error as follows: * @@ -344,46 +344,45 @@ static void _setdirname (struct DIR *dirp); */ static DIR *opendir(const char *dirname) { - DIR *dirp; - assert (dirname != NULL); - - dirp = (DIR*)malloc (sizeof (struct DIR)); - if (dirp != NULL) { - char *p; - - /* allocate room for directory name */ - dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*")); - if (dirp->dirname == NULL) { - /* failed to duplicate directory name. errno set by malloc() */ - free (dirp); - return NULL; - } - /* Copy directory name while appending directory separator and "*.*". - * Directory separator is not appended if the name already ends with - * drive or directory separator. Directory separator is assumed to be - * '/' or '\' and drive separator is assumed to be ':'. */ - strcpy (dirp->dirname, dirname); - p = strchr (dirp->dirname, '\0'); - if (dirp->dirname < p && - *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') - { - strcpy (p++, "\\"); - } + DIR *dirp; + assert(dirname != NULL); + + dirp = (DIR*)malloc(sizeof(struct DIR)); + if (dirp != NULL) { + char *p; + + /* allocate room for directory name */ + dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*")); + if (dirp->dirname == NULL) { + /* failed to duplicate directory name. errno set by malloc() */ + free(dirp); + return NULL; + } + /* Copy directory name while appending directory separator and "*.*". + * Directory separator is not appended if the name already ends with + * drive or directory separator. Directory separator is assumed to be + * '/' or '\' and drive separator is assumed to be ':'. */ + strcpy(dirp->dirname, dirname); + p = strchr(dirp->dirname, '\0'); + if (dirp->dirname < p && + *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') { + strcpy(p++, "\\"); + } # ifdef DIRENT_WIN32_INTERFACE - strcpy (p, "*"); /*scan files with and without extension in win32*/ + strcpy(p, "*"); /*scan files with and without extension in win32*/ # else - strcpy (p, "*.*"); /*scan files with and without extension in DOS*/ + strcpy(p, "*.*"); /*scan files with and without extension in DOS*/ # endif - /* open stream */ - if (_initdir (dirp) == 0) { - /* initialization failed */ - free (dirp->dirname); - free (dirp); - return NULL; + /* open stream */ + if (_initdir(dirp) == 0) { + /* initialization failed */ + free(dirp->dirname); + free(dirp); + return NULL; + } } - } - return dirp; + return dirp; } @@ -434,57 +433,57 @@ static DIR *opendir(const char *dirname) * </function> */ static struct dirent * -readdir (DIR *dirp) +readdir(DIR *dirp) { - assert(dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return NULL; - } + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return NULL; + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* directory stream was opened/rewound incorrectly or it ended normally */ - errno = EBADF; - return NULL; - } + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or it ended normally */ + errno = EBADF; + return NULL; + } #endif - if (dirp->dirent_filled != 0) { - /* - * Directory entry has already been retrieved and there is no need to - * retrieve a new one. Directory entry will be retrieved in advance - * when the user calls readdir function for the first time. This is so - * because real dirent has separate functions for opening and reading - * the stream whereas Win32 and DOS dirents open the stream - * automatically when we retrieve the first file. Therefore, we have to - * save the first file when opening the stream and later we have to - * return the saved entry when the user tries to read the first entry. - */ - dirp->dirent_filled = 0; - } else { - /* fill in entry and return that */ + if (dirp->dirent_filled != 0) { + /* + * Directory entry has already been retrieved and there is no need to + * retrieve a new one. Directory entry will be retrieved in advance + * when the user calls readdir function for the first time. This is so + * because real dirent has separate functions for opening and reading + * the stream whereas Win32 and DOS dirents open the stream + * automatically when we retrieve the first file. Therefore, we have to + * save the first file when opening the stream and later we have to + * return the saved entry when the user tries to read the first entry. + */ + dirp->dirent_filled = 0; + } else { + /* fill in entry and return that */ #if defined(DIRENT_WIN32_INTERFACE) - if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) { - /* Last file has been processed or an error occurred */ - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - errno = ENOENT; - return NULL; - } + if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) { + /* Last file has been processed or an error occurred */ + FindClose(dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + errno = ENOENT; + return NULL; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findnext (&dirp->current.data) != 0) { - /* _dos_findnext and findnext will set errno to ENOENT when no - * more entries could be retrieved. */ - return NULL; - } + if (_dos_findnext(&dirp->current.data) != 0) { + /* _dos_findnext and findnext will set errno to ENOENT when no + * more entries could be retrieved. */ + return NULL; + } # endif - _setdirname (dirp); - assert (dirp->dirent_filled == 0); - } - return &dirp->current; + _setdirname(dirp); + assert(dirp->dirent_filled == 0); + } + return &dirp->current; } @@ -508,38 +507,40 @@ readdir (DIR *dirp) * </function> */ static int -closedir (DIR *dirp) -{ - int retcode = 0; - - /* make sure that dirp points to legal structure */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return -1; - } - - /* free directory name and search handles */ - if (dirp->dirname != NULL) free (dirp->dirname); +closedir(DIR *dirp) +{ + int retcode = 0; + + /* make sure that dirp points to legal structure */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return -1; + } + + /* free directory name and search handles */ + if (dirp->dirname != NULL) { + free(dirp->dirname); + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - retcode = -1; - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + retcode = -1; + errno = EBADF; + } } - } -#endif +#endif - /* clear dirp structure to make sure that it cannot be used anymore*/ - memset (dirp, 0, sizeof (*dirp)); + /* clear dirp structure to make sure that it cannot be used anymore*/ + memset(dirp, 0, sizeof(*dirp)); # if defined(DIRENT_WIN32_INTERFACE) - dirp->search_handle = INVALID_HANDLE_VALUE; + dirp->search_handle = INVALID_HANDLE_VALUE; # endif - free (dirp); - return retcode; + free(dirp); + return retcode; } @@ -565,32 +566,32 @@ closedir (DIR *dirp) * notice it later when you try to retrieve the first directory entry. */ static void -rewinddir (DIR *dirp) -{ - /* make sure that dirp is legal */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return; - } - assert (dirp->dirname != NULL); - - /* close previous stream */ +rewinddir(DIR *dirp) +{ + /* make sure that dirp is legal */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return; + } + assert(dirp->dirname != NULL); + + /* close previous stream */ #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + errno = EBADF; + } } - } #endif - /* re-open previous stream */ - if (_initdir (dirp) == 0) { - /* initialization failed but we cannot deal with error. User will notice - * error later when she tries to retrieve first directory enty. */ - /*EMPTY*/; - } + /* re-open previous stream */ + if (_initdir(dirp) == 0) { + /* initialization failed but we cannot deal with error. User will notice + * error later when she tries to retrieve first directory enty. */ + /*EMPTY*/; + } } @@ -599,38 +600,37 @@ rewinddir (DIR *dirp) * Be sure to close previous stream before opening new one. */ static int -_initdir (DIR *dirp) -{ - assert (dirp != NULL); - assert (dirp->dirname != NULL); - dirp->dirent_filled = 0; +_initdir(DIR *dirp) +{ + assert(dirp != NULL); + assert(dirp->dirname != NULL); + dirp->dirent_filled = 0; # if defined(DIRENT_WIN32_INTERFACE) - /* Open stream and retrieve first file */ - dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data); - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* something went wrong but we don't know what. GetLastError() could - * give us more information about the error, but then we should map - * the error code into errno. */ - errno = ENOENT; - return 0; - } + /* Open stream and retrieve first file */ + dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* something went wrong but we don't know what. GetLastError() could + * give us more information about the error, but then we should map + * the error code into errno. */ + errno = ENOENT; + return 0; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findfirst (dirp->dirname, - _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, - &dirp->current.data) != 0) - { - /* _dos_findfirst and findfirst will set errno to ENOENT when no - * more entries could be retrieved. */ - return 0; - } + if (_dos_findfirst(dirp->dirname, + _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, + &dirp->current.data) != 0) { + /* _dos_findfirst and findfirst will set errno to ENOENT when no + * more entries could be retrieved. */ + return 0; + } # endif - /* initialize DIR and it's first entry */ - _setdirname (dirp); - dirp->dirent_filled = 1; - return 1; + /* initialize DIR and it's first entry */ + _setdirname(dirp); + dirp->dirent_filled = 1; + return 1; } @@ -638,17 +638,17 @@ _initdir (DIR *dirp) * Return implementation dependent name of the current directory entry. */ static const char * -_getdirname (const struct dirent *dp) +_getdirname(const struct dirent *dp) { #if defined(DIRENT_WIN32_INTERFACE) - return dp->data.cFileName; - + return dp->data.cFileName; + #elif defined(DIRENT_USE_FFBLK) - return dp->data.ff_name; - + return dp->data.ff_name; + #else - return dp->data.name; -#endif + return dp->data.name; +#endif } @@ -656,16 +656,17 @@ _getdirname (const struct dirent *dp) * Copy name of implementation dependent directory entry to the d_name field. */ static void -_setdirname (struct DIR *dirp) { - /* make sure that d_name is long enough */ - assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX); - - strncpy (dirp->current.d_name, - _getdirname (&dirp->current), - NAME_MAX); - dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ +_setdirname(struct DIR *dirp) +{ + /* make sure that d_name is long enough */ + assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX); + + strncpy(dirp->current.d_name, + _getdirname(&dirp->current), + NAME_MAX); + dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ } - + # ifdef __cplusplus } # endif diff --git a/src/bin/jp3d/convert.h b/src/bin/jp3d/convert.h index 85885561..1df170eb 100755..100644 --- a/src/bin/jp3d/convert.h +++ b/src/bin/jp3d/convert.h @@ -1,51 +1,52 @@ -/*
- * Copyright (c) 2001-2003, David Janssens
- * Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
- * Copyright (c) 2005, Herve Drolon, FreeImage Team
- * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
- * Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __JP3D_CONVERT_H
-#define __JP3D_CONVERT_H
-
-/**
-Load a single volume component encoded in PGX file format
-@param filename Name of the PGX file to load
-@param parameters *List ?*
-@return Returns a greyscale volume if successful, returns NULL otherwise
-*/
-opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters);
-
-int volumetopgx(opj_volume_t *volume, char *outfile);
-
-opj_volume_t* bintovolume(char *filename,char *fileimg, opj_cparameters_t *parameters);
-
-int volumetobin(opj_volume_t *volume, char *outfile);
-
-opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters);
-
-#endif /* __J2K_CONVERT_H */
-
+/* + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium + * Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __JP3D_CONVERT_H +#define __JP3D_CONVERT_H + +/** +Load a single volume component encoded in PGX file format +@param filename Name of the PGX file to load +@param parameters *List ?* +@return Returns a greyscale volume if successful, returns NULL otherwise +*/ +opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters); + +int volumetopgx(opj_volume_t *volume, char *outfile); + +opj_volume_t* bintovolume(char *filename, char *fileimg, + opj_cparameters_t *parameters); + +int volumetobin(opj_volume_t *volume, char *outfile); + +opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters); + +#endif /* __J2K_CONVERT_H */ + diff --git a/src/bin/jp3d/getopt.h b/src/bin/jp3d/getopt.h index 23299d1b..935171ba 100755..100644 --- a/src/bin/jp3d/getopt.h +++ b/src/bin/jp3d/getopt.h @@ -1,14 +1,14 @@ -/* last review : october 29th, 2002 */
-
-#ifndef _GETOPT_H_
-#define _GETOPT_H_
-
-extern int opterr;
-extern int optind;
-extern int optopt;
-extern int optreset;
-extern char *optarg;
-
-extern int getopt(int nargc, char *const *nargv, const char *ostr);
-
-#endif /* _GETOPT_H_ */
+/* last review : october 29th, 2002 */ + +#ifndef _GETOPT_H_ +#define _GETOPT_H_ + +extern int opterr; +extern int optind; +extern int optopt; +extern int optreset; +extern char *optarg; + +extern int getopt(int nargc, char *const *nargv, const char *ostr); + +#endif /* _GETOPT_H_ */ diff --git a/src/bin/jp3d/windirent.h b/src/bin/jp3d/windirent.h index 2494cd4e..4b1d9ff1 100644 --- a/src/bin/jp3d/windirent.h +++ b/src/bin/jp3d/windirent.h @@ -1,8 +1,8 @@ /* * uce-dirent.h - operating system independent dirent implementation - * + * * Copyright (C) 1998-2002 Toni Ronkko - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * ``Software''), to deal in the Software without restriction, including @@ -10,10 +10,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -21,8 +21,8 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. - * - * + * + * * May 28 1998, Toni Ronkko <tronkko@messi.uku.fi> * * $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $ @@ -58,7 +58,7 @@ * Revision 1.1 1998/07/04 16:27:51 tr * Initial revision * - * + * * MSVC 1.0 scans automatic dependencies incorrectly when your project * contains this very header. The problem is that MSVC cannot handle * include directives inside #if..#endif block those are never entered. @@ -105,14 +105,14 @@ */ #if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H) # if defined(_MSC_VER) /* Microsoft C/C++ */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__MINGW32__) /* MinGW */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__BORLANDC__) /* Borland C/C++ */ # define HAVE_DIRENT_H # define VOID_CLOSEDIR # elif defined(__TURBOC__) /* Borland Turbo C */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__WATCOMC__) /* Watcom C/C++ */ # define HAVE_DIRECT_H # elif defined(__apollo) /* Apollo */ @@ -171,7 +171,7 @@ #elif defined(MSDOS) || defined(WIN32) - /* figure out type of underlaying directory interface to be used */ +/* figure out type of underlaying directory interface to be used */ # if defined(WIN32) # define DIRENT_WIN32_INTERFACE # elif defined(MSDOS) @@ -180,7 +180,7 @@ # error "missing native dirent interface" # endif - /*** WIN32 specifics ***/ +/*** WIN32 specifics ***/ # if defined(DIRENT_WIN32_INTERFACE) # include <windows.h> # if !defined(DIRENT_MAXNAMLEN) @@ -188,11 +188,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include <dos.h> - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -202,7 +202,7 @@ # define _find_t find_t # endif - /* Turbo C defines ffblk structure in dir.h */ +/* Turbo C defines ffblk structure in dir.h */ # elif defined(__TURBOC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -210,13 +210,13 @@ # endif # define DIRENT_USE_FFBLK - /* MSVC */ +/* MSVC */ # elif defined(_MSC_VER) # if !defined(DIRENT_MAXNAMLEN) # define DIRENT_MAXNAMLEN (12) # endif - /* Watcom */ +/* Watcom */ # elif defined(__WATCOMC__) # if !defined(DIRENT_MAXNAMLEN) # if defined(__OS2__) || defined(__NT__) @@ -229,7 +229,7 @@ # endif # endif - /*** generic MS-DOS and MS-Windows stuff ***/ +/*** generic MS-DOS and MS-Windows stuff ***/ # if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN) # define NAME_MAX DIRENT_MAXNAMLEN # endif @@ -238,16 +238,16 @@ # endif - /* - * Substitute for real dirent structure. Note that `d_name' field is a - * true character array although we have it copied in the implementation - * dependent data. We could save some memory if we had declared `d_name' - * as a pointer referring the name within implementation dependent data. - * We have not done that since some code may rely on sizeof(d_name) to be - * something other than four. Besides, directory entries are typically so - * small that it takes virtually no time to copy them from place to place. - */ - typedef struct dirent { +/* + * Substitute for real dirent structure. Note that `d_name' field is a + * true character array although we have it copied in the implementation + * dependent data. We could save some memory if we had declared `d_name' + * as a pointer referring the name within implementation dependent data. + * We have not done that since some code may rely on sizeof(d_name) to be + * something other than four. Besides, directory entries are typically so + * small that it takes virtually no time to copy them from place to place. + */ +typedef struct dirent { char d_name[NAME_MAX + 1]; /*** Operating system specific part ***/ @@ -260,31 +260,31 @@ struct _find_t data; # endif # endif - } dirent; +} dirent; - /* DIR substitute structure containing directory name. The name is - * essential for the operation of ``rewinndir'' function. */ - typedef struct DIR { +/* DIR substitute structure containing directory name. The name is + * essential for the operation of ``rewinndir'' function. */ +typedef struct DIR { char *dirname; /* directory being scanned */ dirent current; /* current entry */ int dirent_filled; /* is current un-processed? */ - /*** Operating system specific part ***/ + /*** Operating system specific part ***/ # if defined(DIRENT_WIN32_INTERFACE) HANDLE search_handle; # elif defined(DIRENT_MSDOS_INTERFACE) # endif - } DIR; +} DIR; # ifdef __cplusplus extern "C" { # endif /* supply prototypes for dirent functions */ -static DIR *opendir (const char *dirname); -static struct dirent *readdir (DIR *dirp); -static int closedir (DIR *dirp); -static void rewinddir (DIR *dirp); +static DIR *opendir(const char *dirname); +static struct dirent *readdir(DIR *dirp); +static int closedir(DIR *dirp); +static void rewinddir(DIR *dirp); /* * Implement dirent interface as static functions so that the user does not @@ -311,9 +311,9 @@ static void rewinddir (DIR *dirp); # define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags) #endif -static int _initdir (DIR *p); -static const char *_getdirname (const struct dirent *dp); -static void _setdirname (struct DIR *dirp); +static int _initdir(DIR *p); +static const char *_getdirname(const struct dirent *dp); +static void _setdirname(struct DIR *dirp); /* * <function name="opendir"> @@ -324,7 +324,7 @@ static void _setdirname (struct DIR *dirp); * internal working area that is used for retrieving individual directory * entries. The internal working area has no fields of your interest. * - * <ret>Returns a pointer to the internal working area or NULL in case the + * <ret>Returns a pointer to the internal working area or NULL in case the * directory stream could not be opened. Global `errno' variable will set * in case of error as follows: * @@ -343,46 +343,45 @@ static void _setdirname (struct DIR *dirp); */ static DIR *opendir(const char *dirname) { - DIR *dirp; - assert (dirname != NULL); - - dirp = (DIR*)malloc (sizeof (struct DIR)); - if (dirp != NULL) { - char *p; - - /* allocate room for directory name */ - dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*")); - if (dirp->dirname == NULL) { - /* failed to duplicate directory name. errno set by malloc() */ - free (dirp); - return NULL; - } - /* Copy directory name while appending directory separator and "*.*". - * Directory separator is not appended if the name already ends with - * drive or directory separator. Directory separator is assumed to be - * '/' or '\' and drive separator is assumed to be ':'. */ - strcpy (dirp->dirname, dirname); - p = strchr (dirp->dirname, '\0'); - if (dirp->dirname < p && - *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') - { - strcpy (p++, "\\"); - } + DIR *dirp; + assert(dirname != NULL); + + dirp = (DIR*)malloc(sizeof(struct DIR)); + if (dirp != NULL) { + char *p; + + /* allocate room for directory name */ + dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*")); + if (dirp->dirname == NULL) { + /* failed to duplicate directory name. errno set by malloc() */ + free(dirp); + return NULL; + } + /* Copy directory name while appending directory separator and "*.*". + * Directory separator is not appended if the name already ends with + * drive or directory separator. Directory separator is assumed to be + * '/' or '\' and drive separator is assumed to be ':'. */ + strcpy(dirp->dirname, dirname); + p = strchr(dirp->dirname, '\0'); + if (dirp->dirname < p && + *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') { + strcpy(p++, "\\"); + } # ifdef DIRENT_WIN32_INTERFACE - strcpy (p, "*"); /*scan files with and without extension in win32*/ + strcpy(p, "*"); /*scan files with and without extension in win32*/ # else - strcpy (p, "*.*"); /*scan files with and without extension in DOS*/ + strcpy(p, "*.*"); /*scan files with and without extension in DOS*/ # endif - /* open stream */ - if (_initdir (dirp) == 0) { - /* initialization failed */ - free (dirp->dirname); - free (dirp); - return NULL; + /* open stream */ + if (_initdir(dirp) == 0) { + /* initialization failed */ + free(dirp->dirname); + free(dirp); + return NULL; + } } - } - return dirp; + return dirp; } @@ -433,57 +432,57 @@ static DIR *opendir(const char *dirname) * </function> */ static struct dirent * -readdir (DIR *dirp) +readdir(DIR *dirp) { - assert(dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return NULL; - } + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return NULL; + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* directory stream was opened/rewound incorrectly or it ended normally */ - errno = EBADF; - return NULL; - } + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or it ended normally */ + errno = EBADF; + return NULL; + } #endif - if (dirp->dirent_filled != 0) { - /* - * Directory entry has already been retrieved and there is no need to - * retrieve a new one. Directory entry will be retrieved in advance - * when the user calls readdir function for the first time. This is so - * because real dirent has separate functions for opening and reading - * the stream whereas Win32 and DOS dirents open the stream - * automatically when we retrieve the first file. Therefore, we have to - * save the first file when opening the stream and later we have to - * return the saved entry when the user tries to read the first entry. - */ - dirp->dirent_filled = 0; - } else { - /* fill in entry and return that */ + if (dirp->dirent_filled != 0) { + /* + * Directory entry has already been retrieved and there is no need to + * retrieve a new one. Directory entry will be retrieved in advance + * when the user calls readdir function for the first time. This is so + * because real dirent has separate functions for opening and reading + * the stream whereas Win32 and DOS dirents open the stream + * automatically when we retrieve the first file. Therefore, we have to + * save the first file when opening the stream and later we have to + * return the saved entry when the user tries to read the first entry. + */ + dirp->dirent_filled = 0; + } else { + /* fill in entry and return that */ #if defined(DIRENT_WIN32_INTERFACE) - if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) { - /* Last file has been processed or an error occurred */ - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - errno = ENOENT; - return NULL; - } + if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) { + /* Last file has been processed or an error occurred */ + FindClose(dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + errno = ENOENT; + return NULL; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findnext (&dirp->current.data) != 0) { - /* _dos_findnext and findnext will set errno to ENOENT when no - * more entries could be retrieved. */ - return NULL; - } + if (_dos_findnext(&dirp->current.data) != 0) { + /* _dos_findnext and findnext will set errno to ENOENT when no + * more entries could be retrieved. */ + return NULL; + } # endif - _setdirname (dirp); - assert (dirp->dirent_filled == 0); - } - return &dirp->current; + _setdirname(dirp); + assert(dirp->dirent_filled == 0); + } + return &dirp->current; } @@ -507,38 +506,40 @@ readdir (DIR *dirp) * </function> */ static int -closedir (DIR *dirp) -{ - int retcode = 0; - - /* make sure that dirp points to legal structure */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return -1; - } - - /* free directory name and search handles */ - if (dirp->dirname != NULL) free (dirp->dirname); +closedir(DIR *dirp) +{ + int retcode = 0; + + /* make sure that dirp points to legal structure */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return -1; + } + + /* free directory name and search handles */ + if (dirp->dirname != NULL) { + free(dirp->dirname); + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - retcode = -1; - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + retcode = -1; + errno = EBADF; + } } - } -#endif +#endif - /* clear dirp structure to make sure that it cannot be used anymore*/ - memset (dirp, 0, sizeof (*dirp)); + /* clear dirp structure to make sure that it cannot be used anymore*/ + memset(dirp, 0, sizeof(*dirp)); # if defined(DIRENT_WIN32_INTERFACE) - dirp->search_handle = INVALID_HANDLE_VALUE; + dirp->search_handle = INVALID_HANDLE_VALUE; # endif - free (dirp); - return retcode; + free(dirp); + return retcode; } @@ -564,32 +565,32 @@ closedir (DIR *dirp) * notice it later when you try to retrieve the first directory entry. */ static void -rewinddir (DIR *dirp) -{ - /* make sure that dirp is legal */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return; - } - assert (dirp->dirname != NULL); - - /* close previous stream */ +rewinddir(DIR *dirp) +{ + /* make sure that dirp is legal */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return; + } + assert(dirp->dirname != NULL); + + /* close previous stream */ #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + errno = EBADF; + } } - } #endif - /* re-open previous stream */ - if (_initdir (dirp) == 0) { - /* initialization failed but we cannot deal with error. User will notice - * error later when she tries to retrieve first directory enty. */ - /*EMPTY*/; - } + /* re-open previous stream */ + if (_initdir(dirp) == 0) { + /* initialization failed but we cannot deal with error. User will notice + * error later when she tries to retrieve first directory enty. */ + /*EMPTY*/; + } } @@ -598,38 +599,37 @@ rewinddir (DIR *dirp) * Be sure to close previous stream before opening new one. */ static int -_initdir (DIR *dirp) -{ - assert (dirp != NULL); - assert (dirp->dirname != NULL); - dirp->dirent_filled = 0; +_initdir(DIR *dirp) +{ + assert(dirp != NULL); + assert(dirp->dirname != NULL); + dirp->dirent_filled = 0; # if defined(DIRENT_WIN32_INTERFACE) - /* Open stream and retrieve first file */ - dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data); - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* something went wrong but we don't know what. GetLastError() could - * give us more information about the error, but then we should map - * the error code into errno. */ - errno = ENOENT; - return 0; - } + /* Open stream and retrieve first file */ + dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* something went wrong but we don't know what. GetLastError() could + * give us more information about the error, but then we should map + * the error code into errno. */ + errno = ENOENT; + return 0; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findfirst (dirp->dirname, - _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, - &dirp->current.data) != 0) - { - /* _dos_findfirst and findfirst will set errno to ENOENT when no - * more entries could be retrieved. */ - return 0; - } + if (_dos_findfirst(dirp->dirname, + _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, + &dirp->current.data) != 0) { + /* _dos_findfirst and findfirst will set errno to ENOENT when no + * more entries could be retrieved. */ + return 0; + } # endif - /* initialize DIR and it's first entry */ - _setdirname (dirp); - dirp->dirent_filled = 1; - return 1; + /* initialize DIR and it's first entry */ + _setdirname(dirp); + dirp->dirent_filled = 1; + return 1; } @@ -637,17 +637,17 @@ _initdir (DIR *dirp) * Return implementation dependent name of the current directory entry. */ static const char * -_getdirname (const struct dirent *dp) +_getdirname(const struct dirent *dp) { #if defined(DIRENT_WIN32_INTERFACE) - return dp->data.cFileName; - + return dp->data.cFileName; + #elif defined(DIRENT_USE_FFBLK) - return dp->data.ff_name; - + return dp->data.ff_name; + #else - return dp->data.name; -#endif + return dp->data.name; +#endif } @@ -655,16 +655,17 @@ _getdirname (const struct dirent *dp) * Copy name of implementation dependent directory entry to the d_name field. */ static void -_setdirname (struct DIR *dirp) { - /* make sure that d_name is long enough */ - assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX); - - strncpy (dirp->current.d_name, - _getdirname (&dirp->current), - NAME_MAX); - dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ +_setdirname(struct DIR *dirp) +{ + /* make sure that d_name is long enough */ + assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX); + + strncpy(dirp->current.d_name, + _getdirname(&dirp->current), + NAME_MAX); + dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ } - + # ifdef __cplusplus } # endif diff --git a/src/bin/jpwl/convert.h b/src/bin/jpwl/convert.h index 591bde61..7f1a5bc8 100644 --- a/src/bin/jpwl/convert.h +++ b/src/bin/jpwl/convert.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -8,7 +8,7 @@ * Copyright (c) 2002-2014, Professor Benoit Macq * Copyright (c) 2001-2003, David Janssens * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2007, Francois-Olivier Devaux * Copyright (c) 2003-2014, Antonin Descampe * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. @@ -40,17 +40,17 @@ /**@name RAW image encoding parameters */ /*@{*/ typedef struct raw_cparameters { - /** width of the raw image */ - int rawWidth; - /** height of the raw image */ - int rawHeight; - /** components of the raw image */ - int rawComp; - /** bit depth of the raw image */ - int rawBitDepth; - /** signed/unsigned raw image */ - opj_bool rawSigned; - /*@}*/ + /** width of the raw image */ + int rawWidth; + /** height of the raw image */ + int rawHeight; + /** components of the raw image */ + int rawComp; + /** bit depth of the raw image */ + int rawBitDepth; + /** signed/unsigned raw image */ + opj_bool rawSigned; + /*@}*/ } raw_cparameters_t; /* TGA conversion */ @@ -78,11 +78,13 @@ int imagetopnm(opj_image_t *image, const char *outfile); /* RAW conversion */ int imagetoraw(opj_image_t * image, const char *outfile); -opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp); +opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, + raw_cparameters_t *raw_cp); /* PNG conversion*/ extern int imagetopng(opj_image_t *image, const char *write_idf); -extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters); +extern opj_image_t* pngtoimage(const char *filename, + opj_cparameters_t *parameters); #endif /* __J2K_CONVERT_H */ diff --git a/src/bin/jpwl/index.h b/src/bin/jpwl/index.h index d8b448d0..b461e91b 100644 --- a/src/bin/jpwl/index.h +++ b/src/bin/jpwl/index.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -40,7 +40,7 @@ extern "C" { /** Write a structured index to a file -@param cstr_info Codestream information +@param cstr_info Codestream information @param index Index filename @return Returns 0 if successful, returns 1 otherwise */ diff --git a/src/bin/jpwl/windirent.h b/src/bin/jpwl/windirent.h index bef28194..b7ed9a3c 100644 --- a/src/bin/jpwl/windirent.h +++ b/src/bin/jpwl/windirent.h @@ -1,9 +1,9 @@ /* * uce-dirent.h - operating system independent dirent implementation - * + * * Copyright (C) 1998-2002 Toni Ronkko - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * ``Software''), to deal in the Software without restriction, including @@ -11,10 +11,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -22,8 +22,8 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. - * - * + * + * * May 28 1998, Toni Ronkko <tronkko@messi.uku.fi> * * $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $ @@ -59,7 +59,7 @@ * Revision 1.1 1998/07/04 16:27:51 tr * Initial revision * - * + * * MSVC 1.0 scans automatic dependencies incorrectly when your project * contains this very header. The problem is that MSVC cannot handle * include directives inside #if..#endif block those are never entered. @@ -106,14 +106,14 @@ */ #if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H) # if defined(_MSC_VER) /* Microsoft C/C++ */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__MINGW32__) /* MinGW */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__BORLANDC__) /* Borland C/C++ */ # define HAVE_DIRENT_H # define VOID_CLOSEDIR # elif defined(__TURBOC__) /* Borland Turbo C */ - /* no dirent.h */ +/* no dirent.h */ # elif defined(__WATCOMC__) /* Watcom C/C++ */ # define HAVE_DIRECT_H # elif defined(__apollo) /* Apollo */ @@ -172,7 +172,7 @@ #elif defined(MSDOS) || defined(WIN32) - /* figure out type of underlaying directory interface to be used */ +/* figure out type of underlaying directory interface to be used */ # if defined(WIN32) # define DIRENT_WIN32_INTERFACE # elif defined(MSDOS) @@ -181,7 +181,7 @@ # error "missing native dirent interface" # endif - /*** WIN32 specifics ***/ +/*** WIN32 specifics ***/ # if defined(DIRENT_WIN32_INTERFACE) # include <windows.h> # if !defined(DIRENT_MAXNAMLEN) @@ -189,11 +189,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include <dos.h> - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -203,7 +203,7 @@ # define _find_t find_t # endif - /* Turbo C defines ffblk structure in dir.h */ +/* Turbo C defines ffblk structure in dir.h */ # elif defined(__TURBOC__) # include <dir.h> # if !defined(DIRENT_MAXNAMLEN) @@ -211,13 +211,13 @@ # endif # define DIRENT_USE_FFBLK - /* MSVC */ +/* MSVC */ # elif defined(_MSC_VER) # if !defined(DIRENT_MAXNAMLEN) # define DIRENT_MAXNAMLEN (12) # endif - /* Watcom */ +/* Watcom */ # elif defined(__WATCOMC__) # if !defined(DIRENT_MAXNAMLEN) # if defined(__OS2__) || defined(__NT__) @@ -230,7 +230,7 @@ # endif # endif - /*** generic MS-DOS and MS-Windows stuff ***/ +/*** generic MS-DOS and MS-Windows stuff ***/ # if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN) # define NAME_MAX DIRENT_MAXNAMLEN # endif @@ -239,16 +239,16 @@ # endif - /* - * Substitute for real dirent structure. Note that `d_name' field is a - * true character array although we have it copied in the implementation - * dependent data. We could save some memory if we had declared `d_name' - * as a pointer referring the name within implementation dependent data. - * We have not done that since some code may rely on sizeof(d_name) to be - * something other than four. Besides, directory entries are typically so - * small that it takes virtually no time to copy them from place to place. - */ - typedef struct dirent { +/* + * Substitute for real dirent structure. Note that `d_name' field is a + * true character array although we have it copied in the implementation + * dependent data. We could save some memory if we had declared `d_name' + * as a pointer referring the name within implementation dependent data. + * We have not done that since some code may rely on sizeof(d_name) to be + * something other than four. Besides, directory entries are typically so + * small that it takes virtually no time to copy them from place to place. + */ +typedef struct dirent { char d_name[NAME_MAX + 1]; /*** Operating system specific part ***/ @@ -261,31 +261,31 @@ struct _find_t data; # endif # endif - } dirent; +} dirent; - /* DIR substitute structure containing directory name. The name is - * essential for the operation of ``rewinndir'' function. */ - typedef struct DIR { +/* DIR substitute structure containing directory name. The name is + * essential for the operation of ``rewinndir'' function. */ +typedef struct DIR { char *dirname; /* directory being scanned */ dirent current; /* current entry */ int dirent_filled; /* is current un-processed? */ - /*** Operating system specific part ***/ + /*** Operating system specific part ***/ # if defined(DIRENT_WIN32_INTERFACE) HANDLE search_handle; # elif defined(DIRENT_MSDOS_INTERFACE) # endif - } DIR; +} DIR; # ifdef __cplusplus extern "C" { # endif /* supply prototypes for dirent functions */ -static DIR *opendir (const char *dirname); -static struct dirent *readdir (DIR *dirp); -static int closedir (DIR *dirp); -static void rewinddir (DIR *dirp); +static DIR *opendir(const char *dirname); +static struct dirent *readdir(DIR *dirp); +static int closedir(DIR *dirp); +static void rewinddir(DIR *dirp); /* * Implement dirent interface as static functions so that the user does not @@ -312,9 +312,9 @@ static void rewinddir (DIR *dirp); # define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags) #endif -static int _initdir (DIR *p); -static const char *_getdirname (const struct dirent *dp); -static void _setdirname (struct DIR *dirp); +static int _initdir(DIR *p); +static const char *_getdirname(const struct dirent *dp); +static void _setdirname(struct DIR *dirp); /* * <function name="opendir"> @@ -325,7 +325,7 @@ static void _setdirname (struct DIR *dirp); * internal working area that is used for retrieving individual directory * entries. The internal working area has no fields of your interest. * - * <ret>Returns a pointer to the internal working area or NULL in case the + * <ret>Returns a pointer to the internal working area or NULL in case the * directory stream could not be opened. Global `errno' variable will set * in case of error as follows: * @@ -344,46 +344,45 @@ static void _setdirname (struct DIR *dirp); */ static DIR *opendir(const char *dirname) { - DIR *dirp; - assert (dirname != NULL); - - dirp = (DIR*)malloc (sizeof (struct DIR)); - if (dirp != NULL) { - char *p; - - /* allocate room for directory name */ - dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*")); - if (dirp->dirname == NULL) { - /* failed to duplicate directory name. errno set by malloc() */ - free (dirp); - return NULL; - } - /* Copy directory name while appending directory separator and "*.*". - * Directory separator is not appended if the name already ends with - * drive or directory separator. Directory separator is assumed to be - * '/' or '\' and drive separator is assumed to be ':'. */ - strcpy (dirp->dirname, dirname); - p = strchr (dirp->dirname, '\0'); - if (dirp->dirname < p && - *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') - { - strcpy (p++, "\\"); - } + DIR *dirp; + assert(dirname != NULL); + + dirp = (DIR*)malloc(sizeof(struct DIR)); + if (dirp != NULL) { + char *p; + + /* allocate room for directory name */ + dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*")); + if (dirp->dirname == NULL) { + /* failed to duplicate directory name. errno set by malloc() */ + free(dirp); + return NULL; + } + /* Copy directory name while appending directory separator and "*.*". + * Directory separator is not appended if the name already ends with + * drive or directory separator. Directory separator is assumed to be + * '/' or '\' and drive separator is assumed to be ':'. */ + strcpy(dirp->dirname, dirname); + p = strchr(dirp->dirname, '\0'); + if (dirp->dirname < p && + *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') { + strcpy(p++, "\\"); + } # ifdef DIRENT_WIN32_INTERFACE - strcpy (p, "*"); /*scan files with and without extension in win32*/ + strcpy(p, "*"); /*scan files with and without extension in win32*/ # else - strcpy (p, "*.*"); /*scan files with and without extension in DOS*/ + strcpy(p, "*.*"); /*scan files with and without extension in DOS*/ # endif - /* open stream */ - if (_initdir (dirp) == 0) { - /* initialization failed */ - free (dirp->dirname); - free (dirp); - return NULL; + /* open stream */ + if (_initdir(dirp) == 0) { + /* initialization failed */ + free(dirp->dirname); + free(dirp); + return NULL; + } } - } - return dirp; + return dirp; } @@ -434,57 +433,57 @@ static DIR *opendir(const char *dirname) * </function> */ static struct dirent * -readdir (DIR *dirp) +readdir(DIR *dirp) { - assert(dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return NULL; - } + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return NULL; + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* directory stream was opened/rewound incorrectly or it ended normally */ - errno = EBADF; - return NULL; - } + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or it ended normally */ + errno = EBADF; + return NULL; + } #endif - if (dirp->dirent_filled != 0) { - /* - * Directory entry has already been retrieved and there is no need to - * retrieve a new one. Directory entry will be retrieved in advance - * when the user calls readdir function for the first time. This is so - * because real dirent has separate functions for opening and reading - * the stream whereas Win32 and DOS dirents open the stream - * automatically when we retrieve the first file. Therefore, we have to - * save the first file when opening the stream and later we have to - * return the saved entry when the user tries to read the first entry. - */ - dirp->dirent_filled = 0; - } else { - /* fill in entry and return that */ + if (dirp->dirent_filled != 0) { + /* + * Directory entry has already been retrieved and there is no need to + * retrieve a new one. Directory entry will be retrieved in advance + * when the user calls readdir function for the first time. This is so + * because real dirent has separate functions for opening and reading + * the stream whereas Win32 and DOS dirents open the stream + * automatically when we retrieve the first file. Therefore, we have to + * save the first file when opening the stream and later we have to + * return the saved entry when the user tries to read the first entry. + */ + dirp->dirent_filled = 0; + } else { + /* fill in entry and return that */ #if defined(DIRENT_WIN32_INTERFACE) - if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) { - /* Last file has been processed or an error occurred */ - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - errno = ENOENT; - return NULL; - } + if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) { + /* Last file has been processed or an error occurred */ + FindClose(dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + errno = ENOENT; + return NULL; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findnext (&dirp->current.data) != 0) { - /* _dos_findnext and findnext will set errno to ENOENT when no - * more entries could be retrieved. */ - return NULL; - } + if (_dos_findnext(&dirp->current.data) != 0) { + /* _dos_findnext and findnext will set errno to ENOENT when no + * more entries could be retrieved. */ + return NULL; + } # endif - _setdirname (dirp); - assert (dirp->dirent_filled == 0); - } - return &dirp->current; + _setdirname(dirp); + assert(dirp->dirent_filled == 0); + } + return &dirp->current; } @@ -508,38 +507,40 @@ readdir (DIR *dirp) * </function> */ static int -closedir (DIR *dirp) -{ - int retcode = 0; - - /* make sure that dirp points to legal structure */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return -1; - } - - /* free directory name and search handles */ - if (dirp->dirname != NULL) free (dirp->dirname); +closedir(DIR *dirp) +{ + int retcode = 0; + + /* make sure that dirp points to legal structure */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return -1; + } + + /* free directory name and search handles */ + if (dirp->dirname != NULL) { + free(dirp->dirname); + } #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - retcode = -1; - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + retcode = -1; + errno = EBADF; + } } - } -#endif +#endif - /* clear dirp structure to make sure that it cannot be used anymore*/ - memset (dirp, 0, sizeof (*dirp)); + /* clear dirp structure to make sure that it cannot be used anymore*/ + memset(dirp, 0, sizeof(*dirp)); # if defined(DIRENT_WIN32_INTERFACE) - dirp->search_handle = INVALID_HANDLE_VALUE; + dirp->search_handle = INVALID_HANDLE_VALUE; # endif - free (dirp); - return retcode; + free(dirp); + return retcode; } @@ -565,32 +566,32 @@ closedir (DIR *dirp) * notice it later when you try to retrieve the first directory entry. */ static void -rewinddir (DIR *dirp) -{ - /* make sure that dirp is legal */ - assert (dirp != NULL); - if (dirp == NULL) { - errno = EBADF; - return; - } - assert (dirp->dirname != NULL); - - /* close previous stream */ +rewinddir(DIR *dirp) +{ + /* make sure that dirp is legal */ + assert(dirp != NULL); + if (dirp == NULL) { + errno = EBADF; + return; + } + assert(dirp->dirname != NULL); + + /* close previous stream */ #if defined(DIRENT_WIN32_INTERFACE) - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - if (FindClose (dirp->search_handle) == FALSE) { - /* Unknown error */ - errno = EBADF; + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + if (FindClose(dirp->search_handle) == FALSE) { + /* Unknown error */ + errno = EBADF; + } } - } #endif - /* re-open previous stream */ - if (_initdir (dirp) == 0) { - /* initialization failed but we cannot deal with error. User will notice - * error later when she tries to retrieve first directory enty. */ - /*EMPTY*/; - } + /* re-open previous stream */ + if (_initdir(dirp) == 0) { + /* initialization failed but we cannot deal with error. User will notice + * error later when she tries to retrieve first directory enty. */ + /*EMPTY*/; + } } @@ -599,38 +600,37 @@ rewinddir (DIR *dirp) * Be sure to close previous stream before opening new one. */ static int -_initdir (DIR *dirp) -{ - assert (dirp != NULL); - assert (dirp->dirname != NULL); - dirp->dirent_filled = 0; +_initdir(DIR *dirp) +{ + assert(dirp != NULL); + assert(dirp->dirname != NULL); + dirp->dirent_filled = 0; # if defined(DIRENT_WIN32_INTERFACE) - /* Open stream and retrieve first file */ - dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data); - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* something went wrong but we don't know what. GetLastError() could - * give us more information about the error, but then we should map - * the error code into errno. */ - errno = ENOENT; - return 0; - } + /* Open stream and retrieve first file */ + dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* something went wrong but we don't know what. GetLastError() could + * give us more information about the error, but then we should map + * the error code into errno. */ + errno = ENOENT; + return 0; + } # elif defined(DIRENT_MSDOS_INTERFACE) - if (_dos_findfirst (dirp->dirname, - _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, - &dirp->current.data) != 0) - { - /* _dos_findfirst and findfirst will set errno to ENOENT when no - * more entries could be retrieved. */ - return 0; - } + if (_dos_findfirst(dirp->dirname, + _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN, + &dirp->current.data) != 0) { + /* _dos_findfirst and findfirst will set errno to ENOENT when no + * more entries could be retrieved. */ + return 0; + } # endif - /* initialize DIR and it's first entry */ - _setdirname (dirp); - dirp->dirent_filled = 1; - return 1; + /* initialize DIR and it's first entry */ + _setdirname(dirp); + dirp->dirent_filled = 1; + return 1; } @@ -638,17 +638,17 @@ _initdir (DIR *dirp) * Return implementation dependent name of the current directory entry. */ static const char * -_getdirname (const struct dirent *dp) +_getdirname(const struct dirent *dp) { #if defined(DIRENT_WIN32_INTERFACE) - return dp->data.cFileName; - + return dp->data.cFileName; + #elif defined(DIRENT_USE_FFBLK) - return dp->data.ff_name; - + return dp->data.ff_name; + #else - return dp->data.name; -#endif + return dp->data.name; +#endif } @@ -656,16 +656,17 @@ _getdirname (const struct dirent *dp) * Copy name of implementation dependent directory entry to the d_name field. */ static void -_setdirname (struct DIR *dirp) { - /* make sure that d_name is long enough */ - assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX); - - strncpy (dirp->current.d_name, - _getdirname (&dirp->current), - NAME_MAX); - dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ +_setdirname(struct DIR *dirp) +{ + /* make sure that d_name is long enough */ + assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX); + + strncpy(dirp->current.d_name, + _getdirname(&dirp->current), + NAME_MAX); + dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/ } - + # ifdef __cplusplus } # endif diff --git a/src/bin/mj2/meta_out.h b/src/bin/mj2/meta_out.h index 293316d1..769ff391 100644 --- a/src/bin/mj2/meta_out.h +++ b/src/bin/mj2/meta_out.h @@ -9,5 +9,6 @@ void xml_write_init(BOOL n, BOOL t, BOOL r, BOOL d); -int xml_write_struct(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr); +int xml_write_struct(FILE *file, FILE *xmlout, opj_mj2_t * movie, + unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr); diff --git a/src/bin/wx/OPJViewer/source/OPJViewer.h b/src/bin/wx/OPJViewer/source/OPJViewer.h index 0d49468a..b60e0d14 100644 --- a/src/bin/wx/OPJViewer/source/OPJViewer.h +++ b/src/bin/wx/OPJViewer/source/OPJViewer.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -136,10 +136,10 @@ typedef unsigned long long int8byte; #endif #define OPJ_APPLICATION wxT("OPJViewer") -#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer") -#define OPJ_APPLICATION_VERSION wxT("0.4 beta") -#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION -#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa") +#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer") +#define OPJ_APPLICATION_VERSION wxT("0.4 beta") +#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION +#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa") #define OPJ_APPLICATION_VENDOR wxT("OpenJPEG") #ifdef __WXMSW__ @@ -180,73 +180,86 @@ class OPJChildFrame; ////////////////////////////////// class OPJViewerApp: public wxApp { - // public methods and variables - public: - - // class constructor - OPJViewerApp() { m_showImages = true; m_showButtons = false; } + // public methods and variables +public: - // other methods - bool OnInit(void); - int OnExit(void); - void SetShowImages(bool show) { m_showImages = show; } - bool ShowImages() const { return m_showImages; } - void ShowCmdLine(const wxCmdLineParser& parser); + // class constructor + OPJViewerApp() + { + m_showImages = true; + m_showButtons = false; + } + + // other methods + bool OnInit(void); + int OnExit(void); + void SetShowImages(bool show) + { + m_showImages = show; + } + bool ShowImages() const + { + return m_showImages; + } + void ShowCmdLine(const wxCmdLineParser& parser); - // all the threads currently alive - as soon as the thread terminates, it's - // removed from the array - wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads; + // all the threads currently alive - as soon as the thread terminates, it's + // removed from the array + wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads; - // crit section protects access to all of the arrays below - wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect; + // crit section protects access to all of the arrays below + wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect; - // semaphore used to wait for the threads to exit, see OPJFrame::OnQuit() - wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone; + // semaphore used to wait for the threads to exit, see OPJFrame::OnQuit() + wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone; - // the last exiting thread should post to m_semAllDone if this is true - // (protected by the same m_critsect) - bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone, m_enco_waitingUntilAllDone; + // the last exiting thread should post to m_semAllDone if this is true + // (protected by the same m_critsect) + bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone, + m_enco_waitingUntilAllDone; - // the list of all filenames written in the command line - wxArrayString m_filelist; + // the list of all filenames written in the command line + wxArrayString m_filelist; - // displaying engine parameters - int m_resizemethod; + // displaying engine parameters + int m_resizemethod; - // decoding engine parameters - bool m_enabledeco, m_enableparse; - int m_reducefactor, m_qualitylayers, m_components, m_framenum; + // decoding engine parameters + bool m_enabledeco, m_enableparse; + int m_reducefactor, m_qualitylayers, m_components, m_framenum; #ifdef USE_JPWL - bool m_enablejpwl, m_enablejpwle; - int m_expcomps, m_maxtiles; + bool m_enablejpwl, m_enablejpwle; + int m_expcomps, m_maxtiles; #endif // USE_JPWL - int m_framewidth, m_frameheight; - - // encoding engine parameters - wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality; - wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc; - bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph; - bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm; - bool m_enablesegmark, m_enablepoc; - bool m_enablequality; - int m_resolutions, m_progression; + int m_framewidth, m_frameheight; + + // encoding engine parameters + wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality; + wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc; + bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, + m_enableeph; + bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, + m_enableerterm; + bool m_enablesegmark, m_enablepoc; + bool m_enablequality; + int m_resolutions, m_progression; #ifdef USE_JPWL - int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS]; - int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS], - m_ppackval[MYJPWL_MAX_NO_TILESPECS]; - int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS]; + int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS]; + int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS], + m_ppackval[MYJPWL_MAX_NO_TILESPECS]; + int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS]; #endif // USE_JPWL - // some layout settings - bool m_showtoolbar, m_showbrowser, m_showpeeker; - int m_browserwidth, m_peekerheight; + // some layout settings + bool m_showtoolbar, m_showbrowser, m_showpeeker; + int m_browserwidth, m_peekerheight; - // application configuration - wxConfig *OPJconfig; + // application configuration + wxConfig *OPJconfig; - // private methods and variables - private: - bool m_showImages, m_showButtons; + // private methods and variables +private: + bool m_showImages, m_showButtons; }; @@ -257,37 +270,39 @@ DECLARE_APP(OPJViewerApp) /////////////////////////////////////////// class OPJCanvas: public wxScrolledWindow { - // public methods and variables - public: + // public methods and variables +public: - // class constructor - OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size); + // class constructor + OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, + const wxSize& size); - virtual void OnDraw(wxDC& dc); - void OnEvent(wxMouseEvent& event); - void WriteText(const wxString& text) { -#ifndef __WXGTK__ - wxMutexGuiEnter(); + virtual void OnDraw(wxDC& dc); + void OnEvent(wxMouseEvent& event); + void WriteText(const wxString& text) + { +#ifndef __WXGTK__ + wxMutexGuiEnter(); #endif //__WXGTK__ - wxLogMessage(text); -#ifndef __WXGTK__ - wxMutexGuiLeave(); + wxLogMessage(text); +#ifndef __WXGTK__ + wxMutexGuiLeave(); #endif //__WXGTK__ - } + } - void OnThreadSignal(wxCommandEvent& event); + void OnThreadSignal(wxCommandEvent& event); - OPJDecoThread *CreateDecoThread(void); - OPJEncoThread *CreateEncoThread(void); + OPJDecoThread *CreateDecoThread(void); + OPJEncoThread *CreateEncoThread(void); - OPJChildFrame *m_childframe; + OPJChildFrame *m_childframe; - wxBitmap m_image, m_image100; - wxFileName m_fname, m_savename; - long m_zooml; + wxBitmap m_image, m_image100; + wxFileName m_fname, m_savename; + long m_zooml; - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; /////////////////////////////////////////////////// @@ -295,29 +310,40 @@ class OPJCanvas: public wxScrolledWindow /////////////////////////////////////////////////// class OPJMarkerData : public wxTreeItemData { - // public methods and variables - public: + // public methods and variables +public: - // class constructor - OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; } + // class constructor + OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), + wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), + m_filestring(fname) + { + m_start = start; + m_length = length; + } - void ShowInfo(wxTreeCtrl *tree); - const wxChar *GetDesc1() const { return m_desc.c_str(); } - const wxChar *GetDesc2() const { return m_filestring.c_str(); } - wxFileOffset m_start, m_length; - wxString m_desc; + void ShowInfo(wxTreeCtrl *tree); + const wxChar *GetDesc1() const + { + return m_desc.c_str(); + } + const wxChar *GetDesc2() const + { + return m_filestring.c_str(); + } + wxFileOffset m_start, m_length; + wxString m_desc; - // private methods and variables - private: - wxString m_filestring; + // private methods and variables +private: + wxString m_filestring; }; class OPJMarkerTree : public wxTreeCtrl { public: - enum - { + enum { TreeCtrlIcon_File, TreeCtrlIcon_FileSelected, TreeCtrlIcon_Folder, @@ -326,16 +352,23 @@ public: }; OPJMarkerTree() { }; - OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style); - virtual ~OPJMarkerTree(){}; - OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL); - void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); } + OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, + wxString name, const wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style); + virtual ~OPJMarkerTree() {}; + OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, + OPJChildFrame *subframe = NULL); + void WriteText(const wxString& text) + { + wxMutexGuiEnter(); + wxLogMessage(text); + wxMutexGuiLeave(); + } - wxFileName m_fname; - wxTextCtrl *m_peektextCtrl; - OPJChildFrame *m_childframe; + wxFileName m_fname; + wxTextCtrl *m_peektextCtrl; + OPJChildFrame *m_childframe; /*void OnBeginDrag(wxTreeEvent& event); void OnBeginRDrag(wxTreeEvent& event); @@ -372,9 +405,15 @@ public: /*void DoToggleIcon(const wxTreeItemId& item);*/ /*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/ - int ImageSize(void) const { return m_imageSize; } + int ImageSize(void) const + { + return m_imageSize; + } - void SetLastItem(wxTreeItemId id) { m_lastItem = id; } + void SetLastItem(wxTreeItemId id) + { + m_lastItem = id; + } protected: /*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/ @@ -408,20 +447,23 @@ private: }; // this hash map stores all the trees of currently opened images, with an integer key -WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash); +WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, + OPJMarkerTreeHash); // this hash map stores all the children of currently opened images, with an integer key -WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash); +WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, + OPJChildFrameHash); // Define a new frame class OPJFrame: public wxMDIParentFrame { - public: +public: - OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); + OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, const long style); ~OPJFrame(void); - void OnSize(wxSizeEvent& WXUNUSED(event)); + void OnSize(wxSizeEvent& WXUNUSED(event)); void OnAbout(wxCommandEvent& WXUNUSED(event)); void OnFileOpen(wxCommandEvent& WXUNUSED(event)); void OnFileSaveAs(wxCommandEvent& WXUNUSED(event)); @@ -429,43 +471,43 @@ class OPJFrame: public wxMDIParentFrame void OnQuit(wxCommandEvent& WXUNUSED(event)); void OnClose(wxCommandEvent& WXUNUSED(event)); void OnZoom(wxCommandEvent& WXUNUSED(event)); - void OnFit(wxCommandEvent& event); - void OnToggleBrowser(wxCommandEvent& WXUNUSED(event)); - void OnTogglePeeker(wxCommandEvent& WXUNUSED(event)); - void OnToggleToolbar(wxCommandEvent& WXUNUSED(event)); - void OnReload(wxCommandEvent& event); - void OnPrevFrame(wxCommandEvent& event); - void OnHomeFrame(wxCommandEvent& event); - void OnNextFrame(wxCommandEvent& event); - void OnLessLayers(wxCommandEvent& event); - void OnAllLayers(wxCommandEvent& event); - void OnMoreLayers(wxCommandEvent& event); - void OnLessRes(wxCommandEvent& event); - void OnFullRes(wxCommandEvent& event); - void OnMoreRes(wxCommandEvent& event); - void OnPrevComp(wxCommandEvent& event); - void OnAllComps(wxCommandEvent& event); - void OnNextComp(wxCommandEvent& event); - void OnSetsEnco(wxCommandEvent& event); - void OnSetsDeco(wxCommandEvent& event); - void OnSashDrag(wxSashEvent& event); - void OpenFiles(wxArrayString paths, wxArrayString filenames); - void SaveFile(wxArrayString paths, wxArrayString filenames); - void OnNotebook(wxNotebookEvent& event); - void Rescale(int scale, OPJChildFrame *child); - void OnThreadLogmsg(wxCommandEvent& event); - - OPJMarkerTreeHash m_treehash; - OPJChildFrameHash m_childhash; + void OnFit(wxCommandEvent& event); + void OnToggleBrowser(wxCommandEvent& WXUNUSED(event)); + void OnTogglePeeker(wxCommandEvent& WXUNUSED(event)); + void OnToggleToolbar(wxCommandEvent& WXUNUSED(event)); + void OnReload(wxCommandEvent& event); + void OnPrevFrame(wxCommandEvent& event); + void OnHomeFrame(wxCommandEvent& event); + void OnNextFrame(wxCommandEvent& event); + void OnLessLayers(wxCommandEvent& event); + void OnAllLayers(wxCommandEvent& event); + void OnMoreLayers(wxCommandEvent& event); + void OnLessRes(wxCommandEvent& event); + void OnFullRes(wxCommandEvent& event); + void OnMoreRes(wxCommandEvent& event); + void OnPrevComp(wxCommandEvent& event); + void OnAllComps(wxCommandEvent& event); + void OnNextComp(wxCommandEvent& event); + void OnSetsEnco(wxCommandEvent& event); + void OnSetsDeco(wxCommandEvent& event); + void OnSashDrag(wxSashEvent& event); + void OpenFiles(wxArrayString paths, wxArrayString filenames); + void SaveFile(wxArrayString paths, wxArrayString filenames); + void OnNotebook(wxNotebookEvent& event); + void Rescale(int scale, OPJChildFrame *child); + void OnThreadLogmsg(wxCommandEvent& event); + + OPJMarkerTreeHash m_treehash; + OPJChildFrameHash m_childhash; wxSashLayoutWindow* markerTreeWindow; wxSashLayoutWindow* loggingWindow; - wxToolBar* tool_bar; + wxToolBar* tool_bar; void Resize(int number); - wxNotebook *m_bookCtrl; - wxNotebook *m_bookCtrlbottom; + wxNotebook *m_bookCtrl; + wxNotebook *m_bookCtrlbottom; wxTextCtrl *m_textCtrlbrowse; - private: +private: void TogStyle(int id, long flag); void DoSort(bool reverse = false); @@ -479,70 +521,71 @@ protected: wxSashLayoutWindow* m_topWindow; wxSashLayoutWindow* m_leftWindow2; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; class OPJChildFrame: public wxMDIChildFrame { - public: +public: OPJCanvas *m_canvas; - OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); + OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, + const wxString& title, const wxPoint& pos, const wxSize& size, + const long style); ~OPJChildFrame(void); void OnActivate(wxActivateEvent& event); - /*void OnQuit(wxCommandEvent& WXUNUSED(event));*/ - void OnClose(wxCloseEvent& event); - void OnGotFocus(wxFocusEvent& event); - void OnLostFocus(wxFocusEvent& event); + /*void OnQuit(wxCommandEvent& WXUNUSED(event));*/ + void OnClose(wxCloseEvent& event); + void OnGotFocus(wxFocusEvent& event); + void OnLostFocus(wxFocusEvent& event); OPJFrame *m_frame; - wxFileName m_fname; - int m_winnumber; + wxFileName m_fname; + int m_winnumber; - unsigned long m_twidth, m_theight, m_tx, m_ty; + unsigned long m_twidth, m_theight, m_tx, m_ty; - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; // frame and main menu ids enum { - OPJFRAME_FILEEXIT = wxID_EXIT, - OPJFRAME_HELPABOUT = wxID_ABOUT, - OPJFRAME_FILEOPEN, - OPJFRAME_MEMORYOPEN, - OPJFRAME_FILESAVEAS, - OPJFRAME_FILETOGGLEB, - OPJFRAME_FILETOGGLEP, - OPJFRAME_FILETOGGLET, - OPJFRAME_VIEWZOOM, - OPJFRAME_VIEWFIT, - OPJFRAME_VIEWRELOAD, - OPJFRAME_VIEWPREVFRAME, - OPJFRAME_VIEWHOMEFRAME, - OPJFRAME_VIEWNEXTFRAME, - OPJFRAME_VIEWLESSLAYERS, - OPJFRAME_VIEWALLLAYERS, - OPJFRAME_VIEWMORELAYERS, - OPJFRAME_VIEWLESSRES, - OPJFRAME_VIEWFULLRES, - OPJFRAME_VIEWMORERES, - OPJFRAME_VIEWPREVCOMP, - OPJFRAME_VIEWALLCOMPS, - OPJFRAME_VIEWNEXTCOMP, - OPJFRAME_FILECLOSE, - OPJFRAME_SETSENCO, - OPJFRAME_SETSDECO, - - OPJFRAME_BROWSEWIN = 10000, - OPJFRAME_LOGWIN, - OPJFRAME_TOOLBAR, - - OPJFRAME_THREADLOGMSG, - OPJCANVAS_THREADSIGNAL + OPJFRAME_FILEEXIT = wxID_EXIT, + OPJFRAME_HELPABOUT = wxID_ABOUT, + OPJFRAME_FILEOPEN, + OPJFRAME_MEMORYOPEN, + OPJFRAME_FILESAVEAS, + OPJFRAME_FILETOGGLEB, + OPJFRAME_FILETOGGLEP, + OPJFRAME_FILETOGGLET, + OPJFRAME_VIEWZOOM, + OPJFRAME_VIEWFIT, + OPJFRAME_VIEWRELOAD, + OPJFRAME_VIEWPREVFRAME, + OPJFRAME_VIEWHOMEFRAME, + OPJFRAME_VIEWNEXTFRAME, + OPJFRAME_VIEWLESSLAYERS, + OPJFRAME_VIEWALLLAYERS, + OPJFRAME_VIEWMORELAYERS, + OPJFRAME_VIEWLESSRES, + OPJFRAME_VIEWFULLRES, + OPJFRAME_VIEWMORERES, + OPJFRAME_VIEWPREVCOMP, + OPJFRAME_VIEWALLCOMPS, + OPJFRAME_VIEWNEXTCOMP, + OPJFRAME_FILECLOSE, + OPJFRAME_SETSENCO, + OPJFRAME_SETSDECO, + + OPJFRAME_BROWSEWIN = 10000, + OPJFRAME_LOGWIN, + OPJFRAME_TOOLBAR, + + OPJFRAME_THREADLOGMSG, + OPJCANVAS_THREADSIGNAL }; // menu and control ids -enum -{ +enum { TreeTest_Quit = wxID_EXIT, TreeTest_About = wxID_ABOUT, TreeTest_TogButtons = wxID_HIGHEST, @@ -587,8 +630,8 @@ enum TreeTest_Unselect, TreeTest_SelectRoot, TreeTest_Ctrl = 1000, - BOTTOM_NOTEBOOK_ID, - LEFT_NOTEBOOK_ID + BOTTOM_NOTEBOOK_ID, + LEFT_NOTEBOOK_ID }; class OPJEncoThread : public wxThread @@ -645,19 +688,23 @@ public: // write something to the text control void WriteText(const wxString& text); - void LoadFile(wxFileName fname); - void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid); - void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid); + void LoadFile(wxFileName fname); + void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, + wxTreeItemId parentid); + void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, + wxFileOffset filelimit, wxTreeItemId parentid); unsigned m_count; OPJMarkerTree *m_tree; - wxTreeItemId m_parentid; + wxTreeItemId m_parentid; private: - int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); - int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); + int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, + wxFileOffset filelimit, + wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); + int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, + wxFileOffset filelimit, + wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); }; @@ -666,7 +713,10 @@ private: class OPJDnDFile: public wxFileDropTarget { public: - OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; } + OPJDnDFile(OPJFrame *pOwner) + { + m_pOwner = pOwner; + } virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); private: @@ -678,137 +728,139 @@ private: // Property sheet dialog: encoder class OPJEncoderDialog: public wxPropertySheetDialog { -DECLARE_CLASS(OPJEncoderDialog) + DECLARE_CLASS(OPJEncoderDialog) public: OPJEncoderDialog(wxWindow* parent, int dialogType); ~OPJEncoderDialog(); - wxBookCtrlBase* m_settingsNotebook; + wxBookCtrlBase* m_settingsNotebook; wxPanel* CreateMainSettingsPage(wxWindow* parent); wxPanel* CreatePart1_1SettingsPage(wxWindow* parent); wxPanel* CreatePart1_2SettingsPage(wxWindow* parent); -/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/ - void OnEnableComm(wxCommandEvent& event); - void OnEnableIdx(wxCommandEvent& event); - void OnEnablePoc(wxCommandEvent& event); - void OnRadioQualityRate(wxCommandEvent& event); + /* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/ + void OnEnableComm(wxCommandEvent& event); + void OnEnableIdx(wxCommandEvent& event); + void OnEnablePoc(wxCommandEvent& event); + void OnRadioQualityRate(wxCommandEvent& event); #ifdef USE_JPWL - void OnEnableJPWL(wxCommandEvent& event); - wxPanel* CreatePart11SettingsPage(wxWindow* parent); - /*wxCheckBox *m_enablejpwlCheck;*/ - wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS]; - void OnHprotSelect(wxCommandEvent& event); - void OnPprotSelect(wxCommandEvent& event); - void OnSensiSelect(wxCommandEvent& event); + void OnEnableJPWL(wxCommandEvent& event); + wxPanel* CreatePart11SettingsPage(wxWindow* parent); + /*wxCheckBox *m_enablejpwlCheck;*/ + wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS]; + wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS]; + wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS]; + wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS]; + wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS]; + wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS]; + wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS]; + void OnHprotSelect(wxCommandEvent& event); + void OnPprotSelect(wxCommandEvent& event); + void OnSensiSelect(wxCommandEvent& event); #endif // USE_JPWL - wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl; - wxRadioButton *m_rateRadio, *m_qualityRadio; - wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, *m_pocCtrl; - wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl; - wxRadioBox *progressionBox; - wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck; - wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck, - *m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck; - wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck; - wxSpinCtrl *m_resolutionsCtrl; + wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl; + wxRadioButton *m_rateRadio, *m_qualityRadio; + wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, + *m_pocCtrl; + wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl; + wxRadioBox *progressionBox; + wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck; + wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck, + *m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, + *m_enablesegmarkCheck; + wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck; + wxSpinCtrl *m_resolutionsCtrl; protected: enum { - OPJENCO_ENABLEJPWL = 100, - OPJENCO_RATEFACTOR, - OPJENCO_RATERADIO, - OPJENCO_QUALITYFACTOR, - OPJENCO_QUALITYRADIO, - OPJENCO_RESNUMBER, - OPJENCO_CODEBLOCKSIZE, - OPJENCO_PRECINCTSIZE, - OPJENCO_TILESIZE, - OPJENCO_PROGRESSION, - OPJENCO_SUBSAMPLING, - OPJENCO_ENABLESOP, - OPJENCO_ENABLEEPH, - OPJENCO_ENABLEBYPASS, - OPJENCO_ENABLERESET, - OPJENCO_ENABLERESTART, - OPJENCO_ENABLEVSC, - OPJENCO_ENABLEERTERM, - OPJENCO_ENABLESEGMARK, - OPJENCO_ENABLEPOC, - OPJENCO_ROICOMP, - OPJENCO_ROISHIFT, - OPJENCO_IMORIG, - OPJENCO_TILORIG, - OPJENCO_ENABLEMCT, - OPJENCO_ENABLEIRREV, - OPJENCO_ENABLEINDEX, - OPJENCO_INDEXNAME, - OPJENCO_POCSPEC, - OPJENCO_ENABLECOMM, - OPJENCO_COMMENTTEXT, - OPJENCO_HPROT, - OPJENCO_HTILE, - OPJENCO_PPROT, - OPJENCO_PTILE, - OPJENCO_PPACK, - OPJENCO_SENSI, - OPJENCO_STILE + OPJENCO_ENABLEJPWL = 100, + OPJENCO_RATEFACTOR, + OPJENCO_RATERADIO, + OPJENCO_QUALITYFACTOR, + OPJENCO_QUALITYRADIO, + OPJENCO_RESNUMBER, + OPJENCO_CODEBLOCKSIZE, + OPJENCO_PRECINCTSIZE, + OPJENCO_TILESIZE, + OPJENCO_PROGRESSION, + OPJENCO_SUBSAMPLING, + OPJENCO_ENABLESOP, + OPJENCO_ENABLEEPH, + OPJENCO_ENABLEBYPASS, + OPJENCO_ENABLERESET, + OPJENCO_ENABLERESTART, + OPJENCO_ENABLEVSC, + OPJENCO_ENABLEERTERM, + OPJENCO_ENABLESEGMARK, + OPJENCO_ENABLEPOC, + OPJENCO_ROICOMP, + OPJENCO_ROISHIFT, + OPJENCO_IMORIG, + OPJENCO_TILORIG, + OPJENCO_ENABLEMCT, + OPJENCO_ENABLEIRREV, + OPJENCO_ENABLEINDEX, + OPJENCO_INDEXNAME, + OPJENCO_POCSPEC, + OPJENCO_ENABLECOMM, + OPJENCO_COMMENTTEXT, + OPJENCO_HPROT, + OPJENCO_HTILE, + OPJENCO_PPROT, + OPJENCO_PTILE, + OPJENCO_PPACK, + OPJENCO_SENSI, + OPJENCO_STILE }; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; // Property sheet dialog: decoder class OPJDecoderDialog: public wxPropertySheetDialog { -DECLARE_CLASS(OPJDecoderDialog) + DECLARE_CLASS(OPJDecoderDialog) public: OPJDecoderDialog(wxWindow* parent, int dialogType); ~OPJDecoderDialog(); - wxBookCtrlBase* m_settingsNotebook; - wxCheckBox *m_enabledecoCheck, *m_enableparseCheck; - wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl; - wxRadioBox* m_resizeBox; + wxBookCtrlBase* m_settingsNotebook; + wxCheckBox *m_enabledecoCheck, *m_enableparseCheck; + wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl; + wxRadioBox* m_resizeBox; - void OnEnableDeco(wxCommandEvent& event); + void OnEnableDeco(wxCommandEvent& event); wxPanel* CreateMainSettingsPage(wxWindow* parent); wxPanel* CreatePart1SettingsPage(wxWindow* parent); wxPanel* CreatePart3SettingsPage(wxWindow* parent); #ifdef USE_JPWL - void OnEnableJPWL(wxCommandEvent& event); + void OnEnableJPWL(wxCommandEvent& event); wxPanel* CreatePart11SettingsPage(wxWindow* parent); - wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl; - wxCheckBox *m_enablejpwlCheck; + wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl; + wxCheckBox *m_enablejpwlCheck; #endif // USE_JPWL - wxSpinCtrl *m_framenumCtrl; + wxSpinCtrl *m_framenumCtrl; protected: enum { - OPJDECO_RESMETHOD = 100, - OPJDECO_REDUCEFACTOR, - OPJDECO_QUALITYLAYERS, - OPJDECO_NUMCOMPS, - OPJDECO_ENABLEDECO, - OPJDECO_ENABLEPARSE, - OPJDECO_ENABLEJPWL, - OPJDECO_EXPCOMPS, - OPJDECO_MAXTILES, - OPJDECO_FRAMENUM + OPJDECO_RESMETHOD = 100, + OPJDECO_REDUCEFACTOR, + OPJDECO_QUALITYLAYERS, + OPJDECO_NUMCOMPS, + OPJDECO_ENABLEDECO, + OPJDECO_ENABLEPARSE, + OPJDECO_ENABLEJPWL, + OPJDECO_EXPCOMPS, + OPJDECO_MAXTILES, + OPJDECO_FRAMENUM }; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; #endif //__OPJ_VIEWER_H__ diff --git a/src/bin/wx/OPJViewer/source/about_htm.h b/src/bin/wx/OPJViewer/source/about_htm.h index 79a859d8..2d5dec27 100644 --- a/src/bin/wx/OPJViewer/source/about_htm.h +++ b/src/bin/wx/OPJViewer/source/about_htm.h @@ -1,54 +1,56 @@ wxString htmlaboutpage = wxT( -"<html>" -"<body bgcolor=#FFFFFF>" -"<table cellspacing=7 cellpadding=1 border=0 width=100%>" -"<tr>" -"<td rowspan=3 valign=top align=center width=70>" -"<img src=\"memory:opj_logo.xpm\"><br><br>" -"</td>" -"<td align=center>" -"<font size=+0 color=#000000><b>" -OPJ_APPLICATION " " OPJ_APPLICATION_VERSION -"</b></font><br>" -"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>" -"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>" -"</td>" -"</tr>" -"<tr height=3 valign=center>" -"<td valign=center bgcolor=#cc3300></td>" -"</tr>" -"<tr>" -"<td align=justify>" -"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>" -"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. " -"In addition to the basic codec, various other features are under development.</font></p><br>" -"<font size=-2 color=red>* Build: ") + "<html>" + "<body bgcolor=#FFFFFF>" + "<table cellspacing=7 cellpadding=1 border=0 width=100%>" + "<tr>" + "<td rowspan=3 valign=top align=center width=70>" + "<img src=\"memory:opj_logo.xpm\"><br><br>" + "</td>" + "<td align=center>" + "<font size=+0 color=#000000><b>" + OPJ_APPLICATION " " OPJ_APPLICATION_VERSION + "</b></font><br>" + "<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>" + "<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>" + "</td>" + "</tr>" + "<tr height=3 valign=center>" + "<td valign=center bgcolor=#cc3300></td>" + "</tr>" + "<tr>" + "<td align=justify>" + "<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>" + "<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. " + "In addition to the basic codec, various other features are under development.</font></p><br>" + "<font size=-2 color=red>* Build: ") #include "build.h" -wxT(", " __DATE__ ", " __TIME__ "</font><br>") -wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>") -wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (") + wxT(", " __DATE__ ", " __TIME__ "</font><br>") + wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>") + wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (") #ifdef USE_JPWL -wxT("<font size=-2 color=green>JPWL</font> ") + wxT("<font size=-2 color=green>JPWL</font> ") #endif // USE_JPWL #ifdef USE_JPSEC -wxT("<font size=-2 color=green>JPSEC</font> ") + wxT("<font size=-2 color=green>JPSEC</font> ") #endif // USE_JPSEC -wxT(")</font><br>") + wxT(")</font><br>") #ifdef USE_MXF -wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>") + wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." + MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD + ")</font><br>") #endif // USE_MXF -wxT("</td>" -"</tr>" -"<tr>" -"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>" -"</tr>" -"<tr>" -"<td colspan=2>" -"<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>" -"<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>" -"</td>" -"</tr>" -"</table>" -"</body>" -"</html>" -); + wxT("</td>" + "</tr>" + "<tr>" + "<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>" + "</tr>" + "<tr>" + "<td colspan=2>" + "<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>" + "<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>" + "</td>" + "</tr>" + "</table>" + "</body>" + "</html>" + ); diff --git a/src/bin/wx/OPJViewer/source/build.h b/src/bin/wx/OPJViewer/source/build.h index f0f072c8..d49d58b6 100644 --- a/src/bin/wx/OPJViewer/source/build.h +++ b/src/bin/wx/OPJViewer/source/build.h @@ -1 +1 @@ -wxT("491") +wxT("491") diff --git a/src/bin/wx/OPJViewer/source/imagjpeg2000.h b/src/bin/wx/OPJViewer/source/imagjpeg2000.h index 945bba5a..ca7f7f29 100644 --- a/src/bin/wx/OPJViewer/source/imagjpeg2000.h +++ b/src/bin/wx/OPJViewer/source/imagjpeg2000.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -52,7 +52,7 @@ #include "openjp2/openjpeg.h" #include "jp2/index.h" -#define wxBITMAP_TYPE_JPEG2000 50 +#define wxBITMAP_TYPE_JPEG2000 50 class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler { @@ -64,115 +64,117 @@ public: m_type = wxBITMAP_TYPE_JPEG2000; m_mime = wxT("image/mj2"); - /* decoding */ - m_reducefactor = 0; - m_qualitylayers = 0; - m_components = 0; + /* decoding */ + m_reducefactor = 0; + m_qualitylayers = 0; + m_components = 0; #ifdef USE_JPWL - m_enablejpwl = true; - m_expcomps = JPWL_EXPECTED_COMPONENTS; - m_maxtiles = JPWL_MAXIMUM_TILES; + m_enablejpwl = true; + m_expcomps = JPWL_EXPECTED_COMPONENTS; + m_maxtiles = JPWL_MAXIMUM_TILES; #endif // USE_JPWL - /* encoding */ - m_subsampling = wxT("1,1"); - m_origin = wxT("0,0"); - m_rates = wxT("20,10,5"); - m_quality = wxT("30,35,40"); - m_enablequality = false; - m_multicomp = false; - m_irreversible = false; - m_resolutions = 6; - m_progression = 0; - m_cbsize = wxT("32,32"); - m_prsize = wxT("[128,128],[128,128]"); - m_tsize = wxT(""); - m_torigin = wxT("0,0"); - /*m_progression - m_resilience*/ - m_enablesop = false; - m_enableeph = false; - m_enablereset = false; - m_enablesegmark = false; - m_enablevsc = false; - m_enablerestart = false; - m_enableerterm = false; - m_enablebypass = false; - /*m_roicompo - m_roiup - m_indexfname*/ - m_enableidx = false; - m_index = wxT("index.txt"); - m_enablepoc = false; - m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL"); - m_enablecomm = true; + /* encoding */ + m_subsampling = wxT("1,1"); + m_origin = wxT("0,0"); + m_rates = wxT("20,10,5"); + m_quality = wxT("30,35,40"); + m_enablequality = false; + m_multicomp = false; + m_irreversible = false; + m_resolutions = 6; + m_progression = 0; + m_cbsize = wxT("32,32"); + m_prsize = wxT("[128,128],[128,128]"); + m_tsize = wxT(""); + m_torigin = wxT("0,0"); + /*m_progression + m_resilience*/ + m_enablesop = false; + m_enableeph = false; + m_enablereset = false; + m_enablesegmark = false; + m_enablevsc = false; + m_enablerestart = false; + m_enableerterm = false; + m_enablebypass = false; + /*m_roicompo + m_roiup + m_indexfname*/ + m_enableidx = false; + m_index = wxT("index.txt"); + m_enablepoc = false; + m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL"); + m_enablecomm = true; #if defined __WXMSW__ - m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version "); + m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version "); #elif defined __WXGTK__ - m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version "); + m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version "); #else - m_comment = wxT("Created by OPJViewer - OpenJPEG version "); + m_comment = wxT("Created by OPJViewer - OpenJPEG version "); #endif #ifdef USE_JPWL - m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version()); + m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version()); #else - m_comment += wxString::Format(wxT("%s"), (char *) opj_version()); + m_comment += wxString::Format(wxT("%s"), (char *) opj_version()); #endif } - // decoding engine parameters - int m_reducefactor, m_qualitylayers, m_components, m_framenum; + // decoding engine parameters + int m_reducefactor, m_qualitylayers, m_components, m_framenum; #ifdef USE_JPWL - bool m_enablejpwl; - int m_expcomps, m_maxtiles; + bool m_enablejpwl; + int m_expcomps, m_maxtiles; #endif // USE_JPWL - // encoding engine parameters - wxString m_subsampling; - wxString m_origin; - wxString m_rates; - wxString m_quality; - bool m_enablequality; - bool m_multicomp; - bool m_irreversible; - int m_resolutions; - int m_progression; - wxString m_cbsize; - wxString m_prsize; - wxString m_tsize; - wxString m_torigin; - /*m_progression - m_resilience*/ - bool m_enablesop; - bool m_enableeph; - bool m_enablebypass; - bool m_enableerterm; - bool m_enablerestart; - bool m_enablereset; - bool m_enablesegmark; - bool m_enablevsc; - /*m_roicompo - m_roiup - m_indexfname*/ - bool m_enableidx; - wxString m_index; - bool m_enablecomm; - wxString m_comment; - bool m_enablepoc; - wxString m_poc; + // encoding engine parameters + wxString m_subsampling; + wxString m_origin; + wxString m_rates; + wxString m_quality; + bool m_enablequality; + bool m_multicomp; + bool m_irreversible; + int m_resolutions; + int m_progression; + wxString m_cbsize; + wxString m_prsize; + wxString m_tsize; + wxString m_torigin; + /*m_progression + m_resilience*/ + bool m_enablesop; + bool m_enableeph; + bool m_enablebypass; + bool m_enableerterm; + bool m_enablerestart; + bool m_enablereset; + bool m_enablesegmark; + bool m_enablevsc; + /*m_roicompo + m_roiup + m_indexfname*/ + bool m_enableidx; + wxString m_index; + bool m_enablecomm; + wxString m_comment; + bool m_enablepoc; + wxString m_poc; #if wxUSE_STREAMS - virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); - virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + virtual bool LoadFile(wxImage *image, wxInputStream& stream, + bool verbose = true, int index = -1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, + bool verbose = true); protected: virtual bool DoCanRead(wxInputStream& stream); #endif private: - OPJ_PROG_ORDER give_progression(char progression[4]); + OPJ_PROG_ORDER give_progression(char progression[4]); DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler) }; diff --git a/src/bin/wx/OPJViewer/source/imagmxf.h b/src/bin/wx/OPJViewer/source/imagmxf.h index e4cb35df..099aa1cc 100644 --- a/src/bin/wx/OPJViewer/source/imagmxf.h +++ b/src/bin/wx/OPJViewer/source/imagmxf.h @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -54,7 +54,7 @@ #include "wx/image.h" #include "libopenjpeg/openjpeg.h" -#define wxBITMAP_TYPE_MXF 51 +#define wxBITMAP_TYPE_MXF 51 class WXDLLEXPORT wxMXFHandler: public wxImageHandler { @@ -66,30 +66,32 @@ public: m_type = wxBITMAP_TYPE_MXF; m_mime = wxT("image/mxf"); - m_reducefactor = 0; - m_qualitylayers = 0; - m_components = 0; - m_filename = wxT(""); + m_reducefactor = 0; + m_qualitylayers = 0; + m_components = 0; + m_filename = wxT(""); #ifdef USE_JPWL - m_enablejpwl = true; - m_expcomps = JPWL_EXPECTED_COMPONENTS; - m_maxtiles = JPWL_MAXIMUM_TILES; + m_enablejpwl = true; + m_expcomps = JPWL_EXPECTED_COMPONENTS; + m_maxtiles = JPWL_MAXIMUM_TILES; #endif // USE_JPWL } - // decoding engine parameters - int m_reducefactor, m_qualitylayers, m_components, m_framenum; - wxFileName m_filename; + // decoding engine parameters + int m_reducefactor, m_qualitylayers, m_components, m_framenum; + wxFileName m_filename; #ifdef USE_JPWL - bool m_enablejpwl; - int m_expcomps, m_maxtiles; + bool m_enablejpwl; + int m_expcomps, m_maxtiles; #endif // USE_JPWL #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile(wxImage *image, wxInputStream& stream, + bool verbose = true, int index = -1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, + bool verbose = true); protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead(wxInputStream& stream); #endif private: |
