Changeset d5070ef in mainline for uspace/app/bithenge/blob.c
- Timestamp:
- 2012-06-22T05:32:30Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- da0fef6
- Parents:
- 8b36bf2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/blob.c
r8b36bf2 rd5070ef 297 297 } 298 298 299 /** Check whether the contents of two blobs are equal. 300 * @memberof bithenge_blob_t 301 * @param a, b Blobs to compare. 302 * @return Whether the blobs are equal. If an error occurs, returns false. 303 */ 304 bool bithenge_blob_equal(bithenge_blob_t *a, bithenge_blob_t *b) 305 { 306 assert(a); 307 assert(a->base.blob_ops); 308 assert(b); 309 assert(b->base.blob_ops); 310 int rc; 311 char buffer_a[4096], buffer_b[4096]; 312 aoff64_t offset = 0, size_a = sizeof(buffer_a), size_b = sizeof(buffer_b); 313 do { 314 rc = bithenge_blob_read(a, offset, buffer_a, &size_a); 315 if (rc != EOK) 316 return false; 317 rc = bithenge_blob_read(b, offset, buffer_b, &size_b); 318 if (rc != EOK) 319 return false; 320 if (size_a != size_b || bcmp(buffer_a, buffer_b, size_a)) 321 return false; 322 offset += size_a; 323 } while (size_a == sizeof(buffer_a)); 324 return true; 325 } 326 299 327 /** @} 300 328 */
Note:
See TracChangeset
for help on using the changeset viewer.