@@ -19,7 +19,7 @@ using namespace aresbc;
1919 abort (); \
2020 }
2121
22- ClassReader::ClassReader (unsigned int offset) :
22+ ClassReader::ClassReader (const unsigned int offset) :
2323 _offset(offset) {
2424}
2525
@@ -64,7 +64,7 @@ void ClassReader::read_class_version(ClassFile& class_file) {
6464
6565 class_file.class_version = ClassFile::UNDEFINED;
6666 if (class_file.major_version >= ClassFile::VERSION_1_1 && class_file.major_version <= ClassFile::VERSION_15) {
67- class_file.class_version = ClassFile::ClassVersion (class_file.major_version );
67+ class_file.class_version = static_cast < ClassFile::ClassVersion> (class_file.major_version );
6868 }
6969}
7070
@@ -88,7 +88,7 @@ void ClassReader::visit_classpool_info(ClassFile& class_file, ConstantPoolInfo&
8888 CHECKED_READ (u8 , infoTag, " Couldn't read the tag." )
8989
9090 if (infoTag >= ConstantPoolInfo::UTF_8 && infoTag <= ConstantPoolInfo::PACKAGE && infoTag != 13 && infoTag != 14 ) {
91- info.tag = ConstantPoolInfo::ConstantTag (infoTag);
91+ info.tag = static_cast < ConstantPoolInfo::ConstantTag> (infoTag);
9292 } else {
9393 info.tag = ConstantPoolInfo::UNDEFINED;
9494 }
@@ -149,55 +149,55 @@ void ClassReader::visit_classpool_info(ClassFile& class_file, ConstantPoolInfo&
149149 }
150150}
151151
152- void ClassReader::read_class_info (ClassFile& class_file, ConstantInfo::ClassInfo& info) {
152+ void ClassReader::read_class_info (const ClassFile& class_file, ConstantInfo::ClassInfo& info) {
153153 CHECKED_READ (u16 , info.name_index , " Couldn't read the name index." )
154154}
155155
156- void ClassReader::read_utf8_info (ClassFile& class_file, ConstantInfo::UTF8Info& info) {
156+ void ClassReader::read_utf8_info (const ClassFile& class_file, ConstantInfo::UTF8Info& info) {
157157 CHECKED_READ (u16 , info.length , " Couldn't read the length." )
158158
159159 info.bytes = new uint8_t [info.length ];
160160 CHECKED_ARRAY_READ (u8 , info.bytes , info.length , " Couldn't read the bytes." )
161161}
162162
163- void ClassReader::read_field_method_info (ClassFile& class_file, ConstantInfo::FieldMethodInfo& info) {
163+ void ClassReader::read_field_method_info (const ClassFile& class_file, ConstantInfo::FieldMethodInfo& info) {
164164 CHECKED_READ (u16 , info.class_index , " Couldn't read the class index." )
165165 CHECKED_READ (u16 , info.name_and_type_index , " Couldn't read the name and type index." )
166166}
167167
168- void ClassReader::read_name_and_type (ClassFile& class_file, ConstantInfo::NameAndTypeInfo& info) {
168+ void ClassReader::read_name_and_type (const ClassFile& class_file, ConstantInfo::NameAndTypeInfo& info) {
169169 CHECKED_READ (u16 , info.name_index , " Couldn't read the name index." )
170170 CHECKED_READ (u16 , info.descriptor_index , " Couldn't read the descriptor index." )
171171}
172172
173- void ClassReader::read_string_info (ClassFile& class_file, ConstantInfo::StringInfo& info) {
173+ void ClassReader::read_string_info (const ClassFile& class_file, ConstantInfo::StringInfo& info) {
174174 CHECKED_READ (u16 , info.string_index , " Couldn't read the string index." )
175175}
176176
177- void ClassReader::read_double_long (ClassFile& class_file, ConstantInfo::DoubleLongInfo& info) {
177+ void ClassReader::read_double_long (const ClassFile& class_file, ConstantInfo::DoubleLongInfo& info) {
178178 CHECKED_READ (u32 , info.high_bytes , " Couldn't read the high bytes." )
179179 CHECKED_READ (u32 , info.low_bytes , " Couldn't read the low bytes." )
180180}
181181
182- void ClassReader::read_float_integer (ClassFile& class_file, ConstantInfo::FloatIntegerInfo& info) {
182+ void ClassReader::read_float_integer (const ClassFile& class_file, ConstantInfo::FloatIntegerInfo& info) {
183183 CHECKED_READ (u32 , info.bytes , " Couldn't read the bytes." )
184184}
185185
186- void ClassReader::read_method_type (ClassFile& class_file, ConstantInfo::MethodTypeInfo& info) {
186+ void ClassReader::read_method_type (const ClassFile& class_file, ConstantInfo::MethodTypeInfo& info) {
187187 CHECKED_READ (u16 , info.descriptor_index , " Couldn't read the descriptor index." )
188188}
189189
190- void ClassReader::read_method_handle (ClassFile& class_file, ConstantInfo::MethodHandleInfo& info) {
190+ void ClassReader::read_method_handle (const ClassFile& class_file, ConstantInfo::MethodHandleInfo& info) {
191191 CHECKED_READ (u8 , info.reference_kind , " Couldn't read the reference kind." )
192192 CHECKED_READ (u16 , info.reference_index , " Couldn't read the reference index." )
193193}
194194
195- void ClassReader::read_dynamic (ClassFile& class_file, ConstantInfo::DynamicInfo& info) {
195+ void ClassReader::read_dynamic (const ClassFile& class_file, ConstantInfo::DynamicInfo& info) {
196196 CHECKED_READ (u16 , info.boostrap_method_attr_index , " Couldn't read the bootstrap method attribute index." )
197197 CHECKED_READ (u16 , info.name_and_type_index , " Couldn't read the name and type index." )
198198}
199199
200- void ClassReader::read_module_package (ClassFile& class_file, ConstantInfo::ModulePackageInfo& info) {
200+ void ClassReader::read_module_package (const ClassFile& class_file, ConstantInfo::ModulePackageInfo& info) {
201201 CHECKED_READ (u16 , info.name_index , " Couldn't read the name index." )
202202}
203203
@@ -294,7 +294,7 @@ auto ClassReader::offset() const -> unsigned int {
294294 return _offset;
295295}
296296
297- auto ClassReader::read_u8 (uint8_t & data, ClassFile& class_file) -> bool {
297+ auto ClassReader::read_u8 (uint8_t & data, const ClassFile& class_file) -> bool {
298298 if (_offset + 1 > class_file.byte_code .size ()) {
299299 std::cerr << " Couldn't read u8 because it is out of bounds." << std::endl;
300300 return false ;
@@ -306,7 +306,7 @@ auto ClassReader::read_u8(uint8_t& data, ClassFile& class_file) -> bool {
306306 return true ;
307307}
308308
309- auto ClassReader::read_u16 (uint16_t & data, ClassFile& class_file) -> bool {
309+ auto ClassReader::read_u16 (uint16_t & data, const ClassFile& class_file) -> bool {
310310 if (_offset + 2 > class_file.byte_code .size ()) {
311311 std::cerr << " Couldn't read u16 because it is out of bounds." << std::endl;
312312 return false ;
@@ -319,7 +319,7 @@ auto ClassReader::read_u16(uint16_t& data, ClassFile& class_file) -> bool {
319319 return true ;
320320}
321321
322- auto ClassReader::read_u32 (uint32_t & data, ClassFile& class_file) -> bool {
322+ auto ClassReader::read_u32 (uint32_t & data, const ClassFile& class_file) -> bool {
323323 if (_offset + 4 > class_file.byte_code .size ()) {
324324 std::cerr << " Couldn't read u32 because it is out of bounds." << std::endl;
325325 return false ;
@@ -334,7 +334,7 @@ auto ClassReader::read_u32(uint32_t& data, ClassFile& class_file) -> bool {
334334 return true ;
335335}
336336
337- auto ClassReader::read_u8_array (uint8_t * data, unsigned int length, ClassFile& class_file) -> bool {
337+ auto ClassReader::read_u8_array (uint8_t * data, const unsigned int length, const ClassFile& class_file) -> bool {
338338 if ((_offset + length) > class_file.byte_code .size ()) {
339339 std::cerr << " Couldn't read the u8 array because it is out of bounds." << std::endl;
340340 return false ;
0 commit comments