@@ -109,15 +109,17 @@ char *cloudsync_uuid_v7_stringify (uint8_t uuid[UUID_LEN], char value[UUID_STR_M
109109
110110char * cloudsync_uuid_v7_string (char value [UUID_STR_MAXLEN ], bool dash_format ) {
111111 uint8_t uuid [UUID_LEN ];
112- if (cloudsync_uuid_v7 (uuid ) != 0 ) return NULL ;
113112
113+ if (cloudsync_uuid_v7 (uuid ) != 0 ) return NULL ;
114114 return cloudsync_uuid_v7_stringify (uuid , value , dash_format );
115115}
116116
117117int cloudsync_uuid_v7_compare (uint8_t value1 [UUID_LEN ], uint8_t value2 [UUID_LEN ]) {
118118 // reconstruct the timestamp by reversing the bit shifts and combining the bytes
119- uint64_t t1 = ((uint64_t )value1 [0 ] << 40 ) | ((uint64_t )value1 [1 ] << 32 ) | ((uint64_t )value1 [2 ] << 24 ) | ((uint64_t )value1 [3 ] << 16 ) | ((uint64_t )value1 [4 ] << 8 ) | ((uint64_t )value1 [5 ]);
120- uint64_t t2 = ((uint64_t )value2 [0 ] << 40 ) | ((uint64_t )value2 [1 ] << 32 ) | ((uint64_t )value2 [2 ] << 24 ) | ((uint64_t )value2 [3 ] << 16 ) | ((uint64_t )value2 [4 ] << 8 ) | ((uint64_t )value2 [5 ]);
119+ uint64_t t1 = ((uint64_t )value1 [0 ] << 40 ) | ((uint64_t )value1 [1 ] << 32 ) | ((uint64_t )value1 [2 ] << 24 ) |
120+ ((uint64_t )value1 [3 ] << 16 ) | ((uint64_t )value1 [4 ] << 8 ) | ((uint64_t )value1 [5 ]);
121+ uint64_t t2 = ((uint64_t )value2 [0 ] << 40 ) | ((uint64_t )value2 [1 ] << 32 ) | ((uint64_t )value2 [2 ] << 24 ) |
122+ ((uint64_t )value2 [3 ] << 16 ) | ((uint64_t )value2 [4 ] << 8 ) | ((uint64_t )value2 [5 ]);
121123
122124 if (t1 == t2 ) return memcmp (value1 , value2 , UUID_LEN );
123125 return (t1 > t2 ) ? 1 : -1 ;
@@ -154,10 +156,8 @@ char *cloudsync_string_dup (const char *str, bool lowercase) {
154156}
155157
156158int cloudsync_blob_compare (const char * blob1 , size_t size1 , const char * blob2 , size_t size2 ) {
157- if (size1 != size2 ) {
158- return (int )(size1 - size2 ); // Blobs are different if sizes are different
159- }
160- return memcmp (blob1 , blob2 , size1 ); // Use memcmp for byte-by-byte comparison
159+ if (size1 != size2 ) return (int )(size1 - size2 ); // blobs are different if sizes are different
160+ return memcmp (blob1 , blob2 , size1 ); // use memcmp for byte-by-byte comparison
161161}
162162
163163void cloudsync_rowid_decode (db_int64 rowid , db_int64 * db_version , db_int64 * seq ) {
@@ -184,13 +184,13 @@ char *cloudsync_string_replace_prefix(const char *input, char *prefix, char *rep
184184 size_t replacement_len = strlen (replacement );
185185
186186 if (strncmp (input , prefix , prefix_len ) == 0 ) {
187- // Allocate memory for new string
187+ // allocate memory for new string
188188 size_t input_len = strlen (input );
189189 size_t new_len = input_len - prefix_len + replacement_len ;
190190 char * result = cloudsync_memory_alloc (new_len + 1 ); // +1 for null terminator
191191 if (!result ) return NULL ;
192192
193- // Copy replacement and the rest of the input string
193+ // copy replacement and the rest of the input string
194194 strcpy (result , replacement );
195195 strcpy (result + replacement_len , input + prefix_len );
196196 return result ;
@@ -201,7 +201,7 @@ char *cloudsync_string_replace_prefix(const char *input, char *prefix, char *rep
201201}
202202
203203/*
204- Compute a normalized hash of a SQLite CREATE TABLE statement.
204+ Compute a normalized hash of a CREATE TABLE statement.
205205
206206 * Normalization:
207207 * - Skips comments (-- and / * )
0 commit comments