~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/jpegerrormanager.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// vim: set tabstop=4 shiftwidth=4 noexpandtab
 
1
// vim: set tabstop=4 shiftwidth=4 expandtab
2
2
/*
3
3
Gwenview: an image viewer
4
4
Copyright 2007 Aurélien Gâteau <agateau@kde.org>
29
29
#undef const
30
30
}
31
31
 
32
 
namespace Gwenview {
 
32
namespace Gwenview
 
33
{
33
34
 
34
35
/**
35
36
 * A simple error manager which overrides jpeg_error_mgr.error_exit to avoid
40
41
 * then call setjmp(errorManager.jmp_buffer)
41
42
 */
42
43
struct JPEGErrorManager : public jpeg_error_mgr {
43
 
        JPEGErrorManager() : jpeg_error_mgr() {
44
 
                jpeg_std_error(this);
45
 
                error_exit=errorExitCallBack;
46
 
        }
47
 
 
48
 
        jmp_buf jmp_buffer;
49
 
 
50
 
        static void errorExitCallBack (j_common_ptr cinfo) {
51
 
                JPEGErrorManager* myerr = static_cast<JPEGErrorManager*>(cinfo->err);
52
 
                char buffer[JMSG_LENGTH_MAX];
53
 
                (*cinfo->err->format_message)(cinfo, buffer);
54
 
                kWarning() << buffer ;
55
 
                longjmp(myerr->jmp_buffer, 1);
56
 
        }
 
44
    JPEGErrorManager() : jpeg_error_mgr() {
 
45
        jpeg_std_error(this);
 
46
        error_exit = errorExitCallBack;
 
47
    }
 
48
 
 
49
    jmp_buf jmp_buffer;
 
50
 
 
51
    static void errorExitCallBack(j_common_ptr cinfo) {
 
52
        JPEGErrorManager* myerr = static_cast<JPEGErrorManager*>(cinfo->err);
 
53
        char buffer[JMSG_LENGTH_MAX];
 
54
        (*cinfo->err->format_message)(cinfo, buffer);
 
55
        kWarning() << buffer ;
 
56
        longjmp(myerr->jmp_buffer, 1);
 
57
    }
57
58
};
58
59
 
59
60
} // namespace