Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Images/JpegErrorManager.cpp @ 5544:dce22a789a2b
Multitenant DICOM plugin: added support for locales
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 Mar 2024 18:56:46 +0100 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
rev | line source |
---|---|
1604 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1604 | 4 * Department, University Hospital of Liege, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1604 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
1604 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
1604 | 17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
1604 | 21 **/ |
22 | |
23 | |
24 #include "../PrecompiledHeaders.h" | |
25 #include "JpegErrorManager.h" | |
26 | |
27 namespace Orthanc | |
28 { | |
29 namespace Internals | |
30 { | |
31 void JpegErrorManager::OutputMessage(j_common_ptr cinfo) | |
32 { | |
33 char message[JMSG_LENGTH_MAX]; | |
34 (*cinfo->err->format_message) (cinfo, message); | |
35 | |
36 JpegErrorManager* that = reinterpret_cast<JpegErrorManager*>(cinfo->err); | |
37 that->message = std::string(message); | |
38 } | |
39 | |
40 | |
41 void JpegErrorManager::ErrorExit(j_common_ptr cinfo) | |
42 { | |
43 (*cinfo->err->output_message) (cinfo); | |
44 | |
45 JpegErrorManager* that = reinterpret_cast<JpegErrorManager*>(cinfo->err); | |
46 longjmp(that->setjmp_buffer, 1); | |
47 } | |
48 | |
49 | |
50 JpegErrorManager::JpegErrorManager() | |
51 { | |
52 memset(&pub, 0, sizeof(struct jpeg_error_mgr)); | |
53 memset(&setjmp_buffer, 0, sizeof(jmp_buf)); | |
54 | |
55 jpeg_std_error(&pub); | |
56 pub.error_exit = ErrorExit; | |
57 pub.output_message = OutputMessage; | |
58 } | |
59 } | |
60 } |