Преглед на файлове

[obj2c] Explicitly initialize "empty" arrays with 0s

rexim преди 1 година
родител
ревизия
3e568c3550
променени са 10 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      tools/obj2c.c
  2. BIN
      wasm/cup3d.wasm
  3. BIN
      wasm/dots3d.wasm
  4. BIN
      wasm/penger3d.wasm
  5. BIN
      wasm/squish.wasm
  6. BIN
      wasm/teapot3d.wasm
  7. BIN
      wasm/triangle.wasm
  8. BIN
      wasm/triangle3d.wasm
  9. BIN
      wasm/triangle3dTex.wasm
  10. BIN
      wasm/triangleTex.wasm

+ 4 - 4
tools/obj2c.c

@@ -202,7 +202,7 @@ void generate_code(FILE *out, Vertices vertices, TexCoords texcoords, Normals no
     fprintf(out, "#define OBJ_H_\n");
     fprintf(out, "#define vertices_count %zu\n", vertices.count);
     if (vertices.count == 0) {
-        fprintf(out, "static const float vertices[1][3];\n");
+        fprintf(out, "static const float vertices[1][3] = {0};\n");
     } else {
         fprintf(out, "static const float vertices[][3] = {\n");
         for (size_t i = 0; i < vertices.count; ++i) {
@@ -214,7 +214,7 @@ void generate_code(FILE *out, Vertices vertices, TexCoords texcoords, Normals no
 
     fprintf(out, "#define texcoords_count %zu\n", texcoords.count);
     if (texcoords.count == 0) {
-        fprintf(out, "static const float texcoords[1][3];\n");
+        fprintf(out, "static const float texcoords[1][3] = {0};\n");
     } else {
         fprintf(out, "static const float texcoords[][3] = {\n");
         for (size_t i = 0; i < texcoords.count; ++i) {
@@ -226,7 +226,7 @@ void generate_code(FILE *out, Vertices vertices, TexCoords texcoords, Normals no
 
     fprintf(out, "#define normals_count %zu\n", normals.count);
     if (normals.count == 0) {
-        fprintf(out, "static const float normals[1][3];\n");
+        fprintf(out, "static const float normals[1][3] = {0};\n");
     } else {
         fprintf(out, "static const float normals[][3] = {\n");
         for (size_t i = 0; i < normals.count; ++i) {
@@ -245,7 +245,7 @@ void generate_code(FILE *out, Vertices vertices, TexCoords texcoords, Normals no
 
     fprintf(out, "#define faces_count %zu\n", visible_faces_count);
     if (visible_faces_count == 0) {
-        fprintf(out, "static const int faces[1][9];\n");
+        fprintf(out, "static const int faces[1][9] = {0};\n");
     } else {
         fprintf(out, "static const int faces[%zu][9] = {\n", visible_faces_count);
         for (size_t i = 0; i < faces.count; ++i) {

BIN
wasm/cup3d.wasm


BIN
wasm/dots3d.wasm


BIN
wasm/penger3d.wasm


BIN
wasm/squish.wasm


BIN
wasm/teapot3d.wasm


BIN
wasm/triangle.wasm


BIN
wasm/triangle3d.wasm


BIN
wasm/triangle3dTex.wasm


BIN
wasm/triangleTex.wasm