Skip to content

Commit 96abef7

Browse files
committed
Update layout.
1 parent c274e7c commit 96abef7

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

analytics/generate_windows_stubs.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,20 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
152152
f.write("\n\n")
153153
f.write("\n".join(macro_definitions))
154154
f.write("\n// clang-format on\n")
155-
f.write("\n\n// --- Dynamic Loader Declaration for Windows ---\n")
155+
f.write("\n// --- Dynamic Loader Declaration for Windows ---\n")
156156
f.write("#if defined(_WIN32)\n")
157-
f.write('#include <windows.h> // For HMODULE\n')
157+
f.write('#include <windows.h>\n')
158158
f.write(f'\n// Google Analytics Windows DLL SHA256 hash, to be verified on load.')
159159
f.write(f'\nextern const unsigned char FirebaseAnalytics_WindowsDllHash[{len(dll_hash)}];\n');
160160

161161
f.write(f'\n// Number of Google Analytics functions expected to be loaded from the DLL.')
162162
f.write(f'\n#define FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT {len(function_details_for_loader)}\n\n')
163-
f.write('// Load Google Analytics functions from the given DLL handle into function pointers.\n')
164-
f.write(f'// Returns the number of functions successfully loaded (out of FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT).\n')
163+
f.write('// Load Analytics functions from the given DLL handle into function pointers.\n')
164+
f.write(f'// Returns the number of functions successfully loaded (out of\nFIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT).\n')
165165
f.write("int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle);\n\n")
166166
f.write('// Reset all function pointers back to stubs.\n')
167167
f.write("void FirebaseAnalytics_UnloadDynamicFunctions(void);\n\n")
168-
f.write("#endif // defined(_WIN32)\n")
168+
f.write("#endif // defined(_WIN32)\n")
169169
f.write("\n#ifdef __cplusplus\n")
170170
f.write("}\n")
171171
f.write("#endif\n\n")
@@ -177,14 +177,14 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
177177
with open(output_c_path, 'w', encoding='utf-8') as f:
178178
f.write(f"{COPYRIGHT_NOTICE}")
179179
f.write(f"// Generated from {os.path.basename(header_file_path)} by {os.path.basename(sys.argv[0])}\n\n")
180-
f.write(f'#include "{INCLUDE_PREFIX}{os.path.basename(output_h_path)}"\n')
180+
f.write(f'#include "{INCLUDE_PREFIX}{os.path.basename(output_h_path)}"\n\n')
181181
f.write('#include <stddef.h>\n\n')
182-
f.write('// Google Analytics Windows DLL SHA256 hash, to be verified on load.\n')
183-
f.write('const unsigned char FirebaseAnalytics_WindowsDllHash[] = {')
184-
f.write(','.join(["0x%02x" % s for s in dll_hash]))
185-
f.write('};\n\n')
186-
f.write("// clang-format off\n\n")
187182
f.write("static void* g_stub_memory = NULL;\n\n")
183+
f.write("// clang-format off\n\n")
184+
f.write('// Google Analytics Windows DLL SHA256 hash, to be verified on load.\n')
185+
f.write('const unsigned char FirebaseAnalytics_WindowsDllHash[] = {\n ')
186+
f.write(', '.join(["0x%02x" % s for s in dll_hash]))
187+
f.write('\n};\n\n')
188188
f.write("// --- Stub Function Definitions ---\n")
189189
f.write("\n\n".join(stub_functions))
190190
f.write("\n\n\n// --- Function Pointer Initializations ---\n")

analytics/src/analytics_desktop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace analytics {
3737
#define ANALYTICS_DLL_FILENAME L"analytics_win.dll"
3838

3939
static HMODULE g_analytics_module = 0;
40-
#endif // defined(_WIN32)
40+
#endif // defined(_WIN32)
4141

4242
// Future data for analytics.
4343
// This is initialized in `Initialize()` and cleaned up in `Terminate()`.

analytics/src/analytics_desktop_dynamic.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@
1515
// Generated from analytics.h by generate_windows_stubs.py
1616

1717
#include "analytics/src/analytics_desktop_dynamic.h"
18+
1819
#include <stddef.h>
1920

20-
// Google Analytics Windows DLL SHA256 hash, to be verified on load.
21-
const unsigned char FirebaseAnalytics_WindowsDllHash[] = {0xc1,0xb9,0xff,0x6e,0x91,0x19,0xc3,0x0b,0xbe,0xb7,0x47,0x23,0x26,0xdc,0xde,0x41,0x8f,0x45,0x68,0x2e,0x6b,0x82,0x2e,0x25,0xee,0xd9,0x22,0xfe,0x6e,0x3c,0xc6,0x98};
21+
static void* g_stub_memory = NULL;
2222

2323
// clang-format off
2424

25-
static void* g_stub_memory = NULL;
25+
// Google Analytics Windows DLL SHA256 hash, to be verified on load.
26+
const unsigned char FirebaseAnalytics_WindowsDllHash[] = {
27+
0xc1, 0xb9, 0xff, 0x6e, 0x91, 0x19, 0xc3, 0x0b, 0xbe, 0xb7, 0x47, 0x23, 0x26, 0xdc, 0xde, 0x41, 0x8f, 0x45, 0x68, 0x2e, 0x6b, 0x82, 0x2e, 0x25, 0xee, 0xd9, 0x22, 0xfe, 0x6e, 0x3c, 0xc6, 0x98
28+
};
2629

2730
// --- Stub Function Definitions ---
2831
// Stub for GoogleAnalytics_Item_Create

analytics/src/analytics_desktop_dynamic.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,25 @@ extern void (*ptr_GoogleAnalytics_SetAnalyticsCollectionEnabled)(bool enabled);
112112
#define GoogleAnalytics_SetAnalyticsCollectionEnabled ptr_GoogleAnalytics_SetAnalyticsCollectionEnabled
113113
// clang-format on
114114

115-
116115
// --- Dynamic Loader Declaration for Windows ---
117116
#if defined(_WIN32)
118-
#include <windows.h> // For HMODULE
117+
#include <windows.h>
119118

120119
// Google Analytics Windows DLL SHA256 hash, to be verified on load.
121120
extern const unsigned char FirebaseAnalytics_WindowsDllHash[32];
122121

123122
// Number of Google Analytics functions expected to be loaded from the DLL.
124123
#define FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT 19
125124

126-
// Load Google Analytics functions from the given DLL handle into function pointers.
127-
// Returns the number of functions successfully loaded (out of FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT).
125+
// Load Analytics functions from the given DLL handle into function pointers.
126+
// Returns the number of functions successfully loaded (out of
127+
FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT).
128128
int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle);
129129

130130
// Reset all function pointers back to stubs.
131131
void FirebaseAnalytics_UnloadDynamicFunctions(void);
132132

133-
#endif // defined(_WIN32)
133+
#endif // defined(_WIN32)
134134

135135
#ifdef __cplusplus
136136
}

0 commit comments

Comments
 (0)