Compare commits

...

4 Commits

View File

@ -217,7 +217,7 @@ static signed int gds_convert_signed_int(const char *data)
int ret; int ret;
if (!data) { if (!data) {
GDS_ERROR("This should not happen"); GDS_ERROR("Conversion from GDS data to signed int failed.");
return 0; return 0;
} }
@ -248,7 +248,7 @@ static int16_t gds_convert_signed_int16(const char *data)
* @param data Buffer containing the uint16 * @param data Buffer containing the uint16
* @return result * @return result
*/ */
static uint16_t gds_convert_unsigend_int16(const char *data) static uint16_t gds_convert_unsigned_int16(const char *data)
{ {
if (!data) { if (!data) {
GDS_ERROR("This should not happen"); GDS_ERROR("This should not happen");
@ -283,13 +283,13 @@ static GList *append_library(GList *curr_list, struct gds_library **library_ptr)
} }
/** /**
* @brief Append graphics to list * @brief Prepend graphics to list
* @param curr_list List containing gds_graphics elements. May be NULL * @param curr_list List containing gds_graphics elements. May be NULL
* @param type Type of graphics * @param type Type of graphics
* @param graphics_ptr newly created graphic is written here * @param graphics_ptr newly created graphic is written here
* @return new list pointer * @return new list pointer
*/ */
static GList *append_graphics(GList *curr_list, enum graphics_type type, static __attribute__((warn_unused_result)) GList *prepend_graphics(GList *curr_list, enum graphics_type type,
struct gds_graphics **graphics_ptr) struct gds_graphics **graphics_ptr)
{ {
struct gds_graphics *gfx; struct gds_graphics *gfx;
@ -308,7 +308,7 @@ static GList *append_graphics(GList *curr_list, enum graphics_type type,
if (graphics_ptr) if (graphics_ptr)
*graphics_ptr = gfx; *graphics_ptr = gfx;
return g_list_append(curr_list, gfx); return g_list_prepend(curr_list, gfx);
} }
/** /**
@ -541,17 +541,17 @@ static void gds_parse_date(const char *buffer, int length, struct gds_time_field
} }
for (temp_date = mod_date; 1; temp_date = access_date) { for (temp_date = mod_date; 1; temp_date = access_date) {
temp_date->year = gds_convert_unsigend_int16(buffer); temp_date->year = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
temp_date->month = gds_convert_unsigend_int16(buffer); temp_date->month = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
temp_date->day = gds_convert_unsigend_int16(buffer); temp_date->day = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
temp_date->hour = gds_convert_unsigend_int16(buffer); temp_date->hour = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
temp_date->minute = gds_convert_unsigend_int16(buffer); temp_date->minute = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
temp_date->second = gds_convert_unsigend_int16(buffer); temp_date->second = gds_convert_unsigned_int16(buffer);
buffer += 2; buffer += 2;
if (temp_date == access_date) if (temp_date == access_date)
@ -666,7 +666,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
break; break;
} }
rec_data_length = gds_convert_unsigend_int16(workbuff); rec_data_length = gds_convert_unsigned_int16(workbuff);
if (rec_data_length < 4) { if (rec_data_length < 4) {
/* Possible Zero-Padding: */ /* Possible Zero-Padding: */
@ -689,7 +689,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
GDS_ERROR("Unexpected end of file"); GDS_ERROR("Unexpected end of file");
break; break;
} }
rec_type = gds_convert_unsigend_int16(workbuff); rec_type = gds_convert_unsigned_int16(workbuff);
/* if begin: Allocate structures */ /* if begin: Allocate structures */
@ -759,8 +759,10 @@ int parse_gds_from_file(const char *filename, GList **library_list)
run = -3; run = -3;
break; break;
} }
current_cell->graphic_objs = append_graphics(current_cell->graphic_objs, current_cell->graphic_objs = prepend_graphics(current_cell->graphic_objs,
(rec_type == BOUNDARY ? GRAPHIC_POLYGON : GRAPHIC_BOX), (rec_type == BOUNDARY
? GRAPHIC_POLYGON
: GRAPHIC_BOX),
&current_graphics); &current_graphics);
if (current_cell->graphic_objs == NULL) { if (current_cell->graphic_objs == NULL) {
GDS_ERROR("Memory allocation failed"); GDS_ERROR("Memory allocation failed");
@ -791,7 +793,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
run = -3; run = -3;
break; break;
} }
current_cell->graphic_objs = append_graphics(current_cell->graphic_objs, current_cell->graphic_objs = prepend_graphics(current_cell->graphic_objs,
GRAPHIC_PATH, &current_graphics); GRAPHIC_PATH, &current_graphics);
if (current_cell->graphic_objs == NULL) { if (current_cell->graphic_objs == NULL) {
GDS_ERROR("Memory allocation failed"); GDS_ERROR("Memory allocation failed");