~townsend/compiz/fix-auto-vp-switch-0.9.10

« back to all changes in this revision

Viewing changes to plugins/imgjpeg/src/imgjpeg.h

img* plugins code cleanup:

Always bail out of function ASAP, do not calculate stuff you might not need.
Declare variables outside of loops so they won't be re-declared in each loop.
Use prefix instead of postfix increments.
Declaration and assignment of variables in one line.
Merged if condition checks.
Added and removed brackets.
Added and removed newlines, if appropriate.
Minor code structure improvements, declare variables when you need them, not
much earlier.
Fixed indentation.

Approved by PS Jenkins bot, Sam Spilsbury.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include "imgjpeg_options.h"
39
39
 
40
40
 
41
 
 
42
41
struct jpegErrorMgr
43
42
{
44
43
    struct  jpeg_error_mgr pub; /* "public" fields */
51
50
    public ImgjpegOptions
52
51
{
53
52
    public:
 
53
 
54
54
        JpegScreen (CompScreen *screen);
55
55
 
56
 
        bool fileToImage (CompString &path, CompSize &size,
57
 
                          int &stride, void *&data);
58
 
        bool imageToFile (CompString &path, CompString &format,
59
 
                          CompSize &size, int stride, void *data);
 
56
        bool fileToImage (CompString &path,
 
57
                          CompSize   &size,
 
58
                          int        &stride,
 
59
                          void       *&data);
 
60
 
 
61
        bool imageToFile (CompString &path,
 
62
                          CompString &format,
 
63
                          CompSize   &size,
 
64
                          int        stride,
 
65
                          void       *data);
60
66
 
61
67
    private:
 
68
 
62
69
        CompString fileNameWithExtension (CompString &path);
63
70
 
64
 
        bool readJPEG (FILE *file, CompSize &size, void *&data);
65
 
        bool writeJPEG (unsigned char *buffer, FILE *file,
66
 
                        CompSize &size, int stride);
 
71
        bool readJPEG (FILE     *file,
 
72
                       CompSize &size,
 
73
                       void     *&data);
 
74
 
 
75
        bool writeJPEG (unsigned char *buffer,
 
76
                        FILE          *file,
 
77
                        CompSize      &size,
 
78
                        int           stride);
67
79
};
68
80
 
69
81
class JpegPluginVTable :
70
82
    public CompPlugin::VTableForScreen<JpegScreen>
71
83
{
72
84
    public:
 
85
 
73
86
        bool init ();
74
87
};
75