+/* Bug 2878: Currently only support left and right truncation. Specific check for this */
+static int checkForTruncation(int flag, Z_AttributeList *attributes)
+{
+ int j;
+ for (j = 0; j < attributes->num_attributes; j++)
+ {
+ Z_AttributeElement *ae = attributes->attributes[j];
+ if (*ae->attributeType == 5) /* truncation attribute */
+ {
+ if (ae->which == Z_AttributeValue_numeric)
+ {
+ int truncation = *(ae->value.numeric);
+ /* This logic only works for Left, right and both. eg. 1,2,3 */
+ if (truncation <= 3)
+ return (int) (truncation & flag);
+ }
+ /* Complex: Shouldn't happen */
+ }
+ }
+ /* No truncation or unsupported */
+ return 0;
+};
+
+static int checkForLeftTruncation(Z_AttributeList *attributes) {
+ return checkForTruncation(1, attributes);
+}
+
+static int checkForRightTruncation(Z_AttributeList *attributes) {
+ return checkForTruncation(2, attributes);
+};
+