Add const modifier to the segment data array in setSegments