From: Brian Paul Date: Sat, 14 Sep 2013 15:52:58 +0000 (-0600) Subject: mesa: asst. clean-ups in copy_label() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ecd155a428ff441071ace8d789e4b89740dd1b58;p=mesa.git mesa: asst. clean-ups in copy_label() This incorporates Vinson's change to check for a null src pointer as detected by coverity. Also, rename the function params to be src/dst, const-qualify src, and use GL types to match the calling functions. And add some more comments. Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index 90d9e09f57d..d9e42cfe4a6 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -86,21 +86,38 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, /** * Helper for _mesa_GetObjectLabel() and _mesa_GetObjectPtrLabel(). + * \param src the src label (may be null) + * \param dst pointer to dest buffer (may be null) + * \param length returns length of label (may be null) + * \param bufsize size of dst buffer */ static void -copy_label(char **labelPtr, char *label, int *length, int bufSize) +copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize) { int labelLen = 0; - if (*labelPtr) - labelLen = strlen(*labelPtr); + /* From http://www.opengl.org/registry/specs/KHR/debug.txt: + * "If is NULL, no length is returned. The maximum number of + * characters that may be written into