Fossil SCM
Enhance the blob_eq() macro to help ensure that its second argument is a string literal, not a pointer.
Commit
d6477def971855f2230a32c5ad9fcd45272cd5fba7baa664296c4b116b84c749
Parent
22005dfcf13df25…
1 file changed
+1
-1
+1
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -474,11 +474,11 @@ | ||
| 474 | 474 | ** operator on the string constant twice, so it really does need to be a |
| 475 | 475 | ** string literal or character array - not a character pointer. |
| 476 | 476 | */ |
| 477 | 477 | #if INTERFACE |
| 478 | 478 | # define blob_eq(B,S) \ |
| 479 | - ((B)->nUsed==sizeof(S)-1 && memcmp((B)->aData,S,sizeof(S)-1)==0) | |
| 479 | + ((B)->nUsed==sizeof(S"")-1 && memcmp((B)->aData,S,sizeof(S)-1)==0) | |
| 480 | 480 | #endif |
| 481 | 481 | |
| 482 | 482 | |
| 483 | 483 | /* |
| 484 | 484 | ** Attempt to resize a blob so that its internal buffer is |
| 485 | 485 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -474,11 +474,11 @@ | |
| 474 | ** operator on the string constant twice, so it really does need to be a |
| 475 | ** string literal or character array - not a character pointer. |
| 476 | */ |
| 477 | #if INTERFACE |
| 478 | # define blob_eq(B,S) \ |
| 479 | ((B)->nUsed==sizeof(S)-1 && memcmp((B)->aData,S,sizeof(S)-1)==0) |
| 480 | #endif |
| 481 | |
| 482 | |
| 483 | /* |
| 484 | ** Attempt to resize a blob so that its internal buffer is |
| 485 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -474,11 +474,11 @@ | |
| 474 | ** operator on the string constant twice, so it really does need to be a |
| 475 | ** string literal or character array - not a character pointer. |
| 476 | */ |
| 477 | #if INTERFACE |
| 478 | # define blob_eq(B,S) \ |
| 479 | ((B)->nUsed==sizeof(S"")-1 && memcmp((B)->aData,S,sizeof(S)-1)==0) |
| 480 | #endif |
| 481 | |
| 482 | |
| 483 | /* |
| 484 | ** Attempt to resize a blob so that its internal buffer is |
| 485 |