Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
- [fixed] Resolved compiler warnings related to constant definitions. (#15059)

# 11.13.0
- [fixed] Improved startup time by putting some initialization steps on a background. (#13675, #13232)

Expand Down
16 changes: 13 additions & 3 deletions Crashlytics/Crashlytics/Helpers/FIRCLSFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@

#include <unistd.h>

// uint64_t should only have max 19 chars in base 10, and less in base 16
static const size_t FIRCLSUInt64StringBufferLength = 21;
static const size_t FIRCLSStringBufferLength = 16;
const size_t FIRCLSWriteBufferLength = 1000;

/// Use an enum to define true compile-time integer constants. This prevents
/// compiler warnings when these constants are used to declare array sizes.
enum {
/// The buffer size needed to hold a 64-bit unsigned integer as a string.
/// The largest uint64_t value (18,446,744,073,709,551,615) has 20 digits.
/// An additional byte is required for the null terminator.
FIRCLSUInt64StringBufferLength = 21,

/// The size in bytes of a raw 128-bit UUID. This is used for buffers
/// holding the binary data, not a C-style string.
FIRCLSStringBufferLength = 16
};

static bool FIRCLSFileInit(
FIRCLSFile* file, const char* path, int fdm, bool appendMode, bool bufferWrites);

Expand Down
9 changes: 8 additions & 1 deletion Crashlytics/Shared/FIRCLSUUID.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@

#import "Crashlytics/Shared/FIRCLSByteUtility.h"

static NSInteger const FIRCLSUUIDStringLength = 33;
/// Use an enum to define a true compile-time integer constant. This prevents
/// warning below where the constant is used to declare the size of an array.
enum {
/// The buffer size needed to hold the hexadecimal string representation of a
/// 16-byte UUID. This accounts for 32 characters (2 for each byte) plus one
/// byte for the null terminator.
FIRCLSUUIDStringLength = (16 * 2) + 1
};

#pragma mark Public methods

Expand Down
Loading