OLD | NEW |
1 /* | 1 /* |
2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
5 * are granted under this license. | 5 * are granted under this license. |
6 * | 6 * |
7 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s
.fr> | 7 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s
.fr> |
8 * All rights reserved. | 8 * All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return; | 62 return; |
63 } | 63 } |
64 /* initialization */ | 64 /* initialization */ |
65 if (p_list->m_procedures) | 65 if (p_list->m_procedures) |
66 { | 66 { |
67 opj_free(p_list->m_procedures); | 67 opj_free(p_list->m_procedures); |
68 } | 68 } |
69 opj_free(p_list); | 69 opj_free(p_list); |
70 } | 70 } |
71 | 71 |
72 OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_l
ist, opj_procedure p_procedure) | 72 OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_l
ist, opj_procedure p_procedure, opj_event_mgr_t* p_manager ) |
73 { | 73 { |
| 74 |
| 75 assert(p_manager != NULL); |
| 76 |
74 if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_pr
ocedures) | 77 if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_pr
ocedures) |
75 { | 78 { |
76 opj_procedure * new_procedures; | 79 opj_procedure * new_procedures; |
77 | 80 |
78 p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE; | 81 p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE; |
79 new_procedures = (opj_procedure*)opj_realloc( | 82 new_procedures = (opj_procedure*)opj_realloc( |
80 p_validation_list->m_procedures, | 83 p_validation_list->m_procedures, |
81 p_validation_list->m_nb_max_procedures * sizeof(opj_proc
edure)); | 84 p_validation_list->m_nb_max_procedures * sizeof(opj_proc
edure)); |
82 if (! new_procedures) | 85 if (! new_procedures) |
83 { | 86 { |
84 opj_free(p_validation_list->m_procedures); | 87 opj_free(p_validation_list->m_procedures); |
85 p_validation_list->m_nb_max_procedures = 0; | 88 p_validation_list->m_nb_max_procedures = 0; |
86 p_validation_list->m_nb_procedures = 0; | 89 p_validation_list->m_nb_procedures = 0; |
87 /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memor
y to add a new validation procedure\n"); */ | 90 opj_event_msg(p_manager, EVT_ERROR, "Not enough memory t
o add a new validation procedure\n"); |
88 fprintf(stderr, "Not enough memory to add a new validati
on procedure\n"); | |
89 | |
90 return OPJ_FALSE; | 91 return OPJ_FALSE; |
91 } | 92 } |
92 else | 93 else |
93 { | 94 { |
94 p_validation_list->m_procedures = new_procedures; | 95 p_validation_list->m_procedures = new_procedures; |
95 } | 96 } |
96 } | 97 } |
97 p_validation_list->m_procedures[p_validation_list->m_nb_procedures] = p_
procedure; | 98 p_validation_list->m_procedures[p_validation_list->m_nb_procedures] = p_
procedure; |
98 ++p_validation_list->m_nb_procedures; | 99 ++p_validation_list->m_nb_procedures; |
99 | 100 |
100 return OPJ_TRUE; | 101 return OPJ_TRUE; |
101 } | 102 } |
102 | 103 |
103 OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_valida
tion_list) | 104 OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_valida
tion_list) |
104 { | 105 { |
105 return p_validation_list->m_nb_procedures; | 106 return p_validation_list->m_nb_procedures; |
106 } | 107 } |
107 | 108 |
108 opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_
validation_list) | 109 opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_
validation_list) |
109 { | 110 { |
110 return p_validation_list->m_procedures; | 111 return p_validation_list->m_procedures; |
111 } | 112 } |
112 | 113 |
113 void opj_procedure_list_clear (opj_procedure_list_t * p_validation_list) | 114 void opj_procedure_list_clear (opj_procedure_list_t * p_validation_list) |
114 { | 115 { |
115 p_validation_list->m_nb_procedures = 0; | 116 p_validation_list->m_nb_procedures = 0; |
116 } | 117 } |
OLD | NEW |