From 998b355e300ad4afaf4d6d8b2f18172f8cf49e04 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 31 Oct 2021 12:35:49 -0700 Subject: [PATCH] Make some private functions static; --- src/lib/noise1234/noise1234.c | 8 ++++---- src/modules/audio/spatializer_simple.c | 16 ++++++++-------- src/modules/data/modelData_stl.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/noise1234/noise1234.c b/src/lib/noise1234/noise1234.c index 127f2c35..9382c583 100644 --- a/src/lib/noise1234/noise1234.c +++ b/src/lib/noise1234/noise1234.c @@ -102,28 +102,28 @@ unsigned char perm[] = {151,160,137,91,90,15, * float SLnoise = (noise3(x,y,z) + 1.0) * 0.5; */ -float grad1( int hash, float x ) { +static float grad1( int hash, float x ) { int h = hash & 15; float grad = 1.0 + (h & 7); // Gradient value 1.0, 2.0, ..., 8.0 if (h&8) grad = -grad; // and a random sign for the gradient return ( grad * x ); // Multiply the gradient with the distance } -float grad2( int hash, float x, float y ) { +static float grad2( int hash, float x, float y ) { int h = hash & 7; // Convert low 3 bits of hash code float u = h<4 ? x : y; // into 8 simple gradient directions, float v = h<4 ? y : x; // and compute the dot product with (x,y). return ((h&1)? -u : u) + ((h&2)? -2.0*v : 2.0*v); } -float grad3( int hash, float x, float y , float z ) { +static float grad3( int hash, float x, float y , float z ) { int h = hash & 15; // Convert low 4 bits of hash code into 12 simple float u = h<8 ? x : y; // gradient directions, and compute dot product. float v = h<4 ? y : h==12||h==14 ? x : z; // Fix repeats at h = 12 to 15 return ((h&1)? -u : u) + ((h&2)? -v : v); } -float grad4( int hash, float x, float y, float z, float t ) { +static float grad4( int hash, float x, float y, float z, float t ) { int h = hash & 31; // Convert low 5 bits of hash code into 32 simple float u = h<24 ? x : y; // gradient directions, and compute dot product. float v = h<16 ? y : z; diff --git a/src/modules/audio/spatializer_simple.c b/src/modules/audio/spatializer_simple.c index 42190062..59ab81dc 100644 --- a/src/modules/audio/spatializer_simple.c +++ b/src/modules/audio/spatializer_simple.c @@ -8,16 +8,16 @@ static struct { float gain[MAX_SOURCES][2]; } state; -bool simple_init(void) { +static bool simple_init(void) { mat4_identity(state.listener); return true; } -void simple_destroy(void) { +static void simple_destroy(void) { // } -uint32_t simple_apply(Source* source, const float* input, float* output, uint32_t frames, uint32_t _frames) { +static uint32_t simple_apply(Source* source, const float* input, float* output, uint32_t frames, uint32_t _frames) { float sourcePos[4], sourceOrientation[4]; lovrSourceGetPose(source, sourcePos, sourceOrientation); @@ -82,27 +82,27 @@ uint32_t simple_apply(Source* source, const float* input, float* output, uint32_ return frames; } -uint32_t simple_tail(float* scratch, float* output, uint32_t frames) { +static uint32_t simple_tail(float* scratch, float* output, uint32_t frames) { return 0; } -void simple_setListenerPose(float position[4], float orientation[4]) { +static void simple_setListenerPose(float position[4], float orientation[4]) { mat4_identity(state.listener); mat4_translate(state.listener, position[0], position[1], position[2]); mat4_rotateQuat(state.listener, orientation); } -bool simple_setGeometry(float* vertices, uint32_t* indices, uint32_t vertexCount, uint32_t indexCount, AudioMaterial material) { +static bool simple_setGeometry(float* vertices, uint32_t* indices, uint32_t vertexCount, uint32_t indexCount, AudioMaterial material) { return false; } -void simple_sourceCreate(Source* source) { +static void simple_sourceCreate(Source* source) { uint32_t index = lovrSourceGetIndex(source); state.gain[index][0] = 0.f; state.gain[index][1] = 0.f; } -void simple_sourceDestroy(Source* source) { +static void simple_sourceDestroy(Source* source) { // } diff --git a/src/modules/data/modelData_stl.c b/src/modules/data/modelData_stl.c index adb166bd..9b613de4 100644 --- a/src/modules/data/modelData_stl.c +++ b/src/modules/data/modelData_stl.c @@ -12,7 +12,7 @@ static ModelData* lovrModelDataInitStlAscii(ModelData* model, Blob* source, Mode // The binary format has an 80 byte header, followed by a u32 triangle count, followed by 50 byte // triangles. Each triangle has a vec3 normal, 3 vec3 vertices, and 2 bytes of padding. -extern ModelData* lovrModelDataInitStlBinary(ModelData* model, Blob* source, ModelDataIO* io, uint32_t triangleCount) { +static ModelData* lovrModelDataInitStlBinary(ModelData* model, Blob* source, ModelDataIO* io, uint32_t triangleCount) { char* data = (char*) source->data + 84; uint32_t vertexCount = triangleCount * 3;