From: Vinson Lee Date: Sun, 2 May 2010 08:03:59 +0000 (-0700) Subject: mesa: s/sprintf/_mesa_snprintf/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc1be4a99425d09103bba9e06026f31f2b0142d2;p=mesa.git mesa: s/sprintf/_mesa_snprintf/ --- diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 9bcfc1008a8..526145aeccf 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -315,7 +315,7 @@ write_texture_image(struct gl_texture_object *texObj, buffer, texObj, img); /* make filename */ - sprintf(s, "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); + _mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); printf(" Writing image level %u to %s\n", level, s); write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); @@ -357,7 +357,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb) format, type, &ctx->DefaultPacking, buffer); /* make filename */ - sprintf(s, "/tmp/renderbuffer%u.ppm", rb->Name); + _mesa_snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name); printf(" Writing renderbuffer image to %s\n", s); write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f869a585d6b..93594f0b58f 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -7725,7 +7725,7 @@ execute_list(GLcontext *ctx, GLuint list) default: { char msg[1000]; - sprintf(msg, "Error in execute_list: opcode=%d", + _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d", (int) opcode); _mesa_problem(ctx, msg); } diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 45f6a64356a..9d6ffcd9319 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -5279,7 +5279,7 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this is not re-entrant safe, no big deal here */ - sprintf(token_tmp, "0x%x", nr); + _mesa_snprintf(token_tmp, sizeof(token_tmp), "0x%x", nr); return token_tmp; } } diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index f382680b443..efb667dbf36 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -485,7 +485,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, checksum = _mesa_str_checksum(source); - sprintf(filename, "newshader_%d", checksum); + _mesa_snprintf(filename, sizeof(filename), "newshader_%d", checksum); newSource = _mesa_read_shader(filename); if (newSource) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index e0c5cf9c375..b36f686e6d2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1279,8 +1279,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (type != GL_UNSIGNED_SHORT_8_8_MESA && type != GL_UNSIGNED_SHORT_8_8_REV_MESA) { char message[100]; - sprintf(message, - "glTexImage%d(format/type YCBCR mismatch", dimensions); + _mesa_snprintf(message, sizeof(message), + "glTexImage%d(format/type YCBCR mismatch", dimensions); _mesa_error(ctx, GL_INVALID_ENUM, message); return GL_TRUE; /* error */ } @@ -1295,9 +1295,9 @@ texture_error_check( GLcontext *ctx, GLenum target, if (border != 0) { if (!isProxy) { char message[100]; - sprintf(message, - "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", - dimensions, border); + _mesa_snprintf(message, sizeof(message), + "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", + dimensions, border); _mesa_error(ctx, GL_INVALID_VALUE, message); } return GL_TRUE; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 2753b55c36a..de37e340393 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -416,7 +416,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, */ if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) { char s[100]; - sprintf(s, "base level = %d is invalid", baseLevel); + _mesa_snprintf(s, sizeof(s), "base level = %d is invalid", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return; @@ -425,7 +425,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; - sprintf(s, "Image[baseLevel=%d] == NULL", baseLevel); + _mesa_snprintf(s, sizeof(s), "Image[baseLevel=%d] == NULL", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return;