~ubuntu-branches/ubuntu/feisty/digikam/feisty

« back to all changes in this revision

Viewing changes to digikam/utilities/cameragui/jinclude.h

  • Committer: Bazaar Package Importer
  • Author(s): Achim Bohnet
  • Date: 2005-03-10 02:39:02 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050310023902-023nymfst5mg696c
Tags: 0.7.2-2
* debian/TODO: clean
* digikam manpage: better --detect-camera description

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * Copyright (C) 1991-1994, Thomas G. Lane.
 
4
 * This file is part of the Independent JPEG Group's software.
 
5
 * For conditions of distribution and use, see the accompanying README file.
 
6
 *
 
7
 * This file exists to provide a single place to fix any problems with
 
8
 * including the wrong system include files.  (Common problems are taken
 
9
 * care of by the standard jconfig symbols, but on really weird systems
 
10
 * you may have to edit this file.)
 
11
 *
 
12
 * NOTE: this file is NOT intended to be included by applications using the
 
13
 * JPEG library.  Most applications need only include jpeglib.h.
 
14
 */
 
15
 
 
16
 
 
17
/* Include auto-config file to find out which system include files we need. */
 
18
 
 
19
#include "jconfig.h"            /* auto configuration options */
 
20
#define JCONFIG_INCLUDED        /* so that jpeglib.h doesn't do it again */
 
21
 
 
22
/*
 
23
 * We need the NULL macro and size_t typedef.
 
24
 * On an ANSI-conforming system it is sufficient to include <stddef.h>.
 
25
 * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
 
26
 * pull in <sys/types.h> as well.
 
27
 * Note that the core JPEG library does not require <stdio.h>;
 
28
 * only the default error handler and data source/destination modules do.
 
29
 * But we must pull it in because of the references to FILE in jpeglib.h.
 
30
 * You can remove those references if you want to compile without <stdio.h>.
 
31
 */
 
32
 
 
33
#ifdef HAVE_STDDEF_H
 
34
#include <stddef.h>
 
35
#endif
 
36
 
 
37
#ifdef HAVE_STDLIB_H
 
38
#include <stdlib.h>
 
39
#endif
 
40
 
 
41
#ifdef NEED_SYS_TYPES_H
 
42
#include <sys/types.h>
 
43
#endif
 
44
 
 
45
#include <stdio.h>
 
46
 
 
47
/*
 
48
 * We need memory copying and zeroing functions, plus strncpy().
 
49
 * ANSI and System V implementations declare these in <string.h>.
 
50
 * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
 
51
 * Some systems may declare memset and memcpy in <memory.h>.
 
52
 *
 
53
 * NOTE: we assume the size parameters to these functions are of type size_t.
 
54
 * Change the casts in these macros if not!
 
55
 */
 
56
 
 
57
#ifdef NEED_BSD_STRINGS
 
58
 
 
59
#include <strings.h>
 
60
#define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
 
61
#define MEMCOPY(dest,src,size)  bcopy((const void *)(src), (void *)(dest), (size_t)(size))
 
62
 
 
63
#else /* not BSD, assume ANSI/SysV string lib */
 
64
 
 
65
#include <string.h>
 
66
#define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
 
67
#define MEMCOPY(dest,src,size)  memcpy((void *)(dest), (const void *)(src), (size_t)(size))
 
68
 
 
69
#endif
 
70
 
 
71
/*
 
72
 * In ANSI C, and indeed any rational implementation, size_t is also the
 
73
 * type returned by sizeof().  However, it seems there are some irrational
 
74
 * implementations out there, in which sizeof() returns an int even though
 
75
 * size_t is defined as long or unsigned long.  To ensure consistent results
 
76
 * we always use this SIZEOF() macro in place of using sizeof() directly.
 
77
 */
 
78
 
 
79
#define SIZEOF(object)  ((size_t) sizeof(object))
 
80
 
 
81
/*
 
82
 * The modules that use fread() and fwrite() always invoke them through
 
83
 * these macros.  On some systems you may need to twiddle the argument casts.
 
84
 * CAUTION: argument order is different from underlying functions!
 
85
 */
 
86
 
 
87
#define JFREAD(file,buf,sizeofbuf)  \
 
88
  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
 
89
#define JFWRITE(file,buf,sizeofbuf)  \
 
90
  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))