[Mesa-dev] [PATCH V2 10/15] mesa: Implement KHR_debug ObjectLabel functions

Timothy Arceri t_arceri at yahoo.com.au
Tue Aug 27 22:29:02 PDT 2013




>> +   }
>> +
>> +   if (label) {
>> +      /* set new label string */
>> +
>> +      if (length >= 0) {
>> +         /* explicit length */
>> +         *labelPtr = (char *) malloc(length);
>> +         if (*labelPtr) {
>> +            memcpy(*labelPtr, label, length);
>> +         }
> The length given by the client is not required to include a terminating
> null-character.

Ok I see what you mean now. Fixed in V3 of the patch I just sent out.

>> +      }
>> +      else {
>> +         /* null-terminated string */
>> +         int len = strlen(label);
>> +         if (len >= MAX_LABEL_LENGTH) {
>> +            /* An INVALID_VALUE error is generated if the number of characters
>> +             * in <label>, excluding the null terminator when <length> is
>> +             * negative, is not less than the value of MAX_LABEL_LENGTH.
>> +             */
>> +            _mesa_error(ctx, GL_INVALID_VALUE,
>> +                        "%s(length=%d, which is not less than "
>> +                        "GL_MAX_LABEL_LENGTH=%d)", caller, length,
>> +                        MAX_LABEL_LENGTH);
> This error should also be generated when the client specifies an explicit
> length that exceeds MAX_LABEL_LENGTH.

Yes you are right. The wording in the spec was confusing me a little I had to read it a couple of times
before it made sense. Again fixed in V3 of the patch I just sent out.

> Fredrik
Thanks for reviewing Fredrik

Tim


More information about the mesa-dev mailing list