mesa: s/sprintf/_mesa_snprintf/
authorVinson Lee <vlee@vmware.com>
Sun, 2 May 2010 08:03:59 +0000 (01:03 -0700)
committerVinson Lee <vlee@vmware.com>
Sun, 2 May 2010 08:03:59 +0000 (01:03 -0700)
src/mesa/main/debug.c
src/mesa/main/dlist.c
src/mesa/main/enums.c
src/mesa/main/shaders.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c

index 9bcfc1008a8852f402733053645ceecfdd279c35..526145aeccfe90f82fe04cb8b155d28f3b97f867 100644 (file)
@@ -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);
index f869a585d6bc979ebcf532240611270dcb7e6666..93594f0b58f99374f5985f6fade2e3142e19aa7c 100644 (file)
@@ -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);
             }
index 45f6a64356aff2e6e1e7809f92d56140211501bd..9d6ffcd931936cc33b826997deea763d3c045148 100644 (file)
@@ -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;
    }
 }
index f382680b4435aab9e269e92f6285eac6bf54885f..efb667dbf369858e3fb5319cd90b817eb073cde2 100644 (file)
@@ -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) {
index e0c5cf9c375c1efd0ec3fec17a06493e52a512f1..b36f686e6d238f2a79ede1d4cb76aa6dbe1e1cb8 100644 (file)
@@ -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;
index 2753b55c36aeb868fe7762f78c116ad13d24167d..de37e340393b172bf98011f97c6c9a4635ec92eb 100644 (file)
@@ -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;