Changeset a42d7d8 in mainline for uspace/lib/bithenge/blob.c


Ignore:
Timestamp:
2012-08-19T05:28:24Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fae4d30
Parents:
1c79996
Message:

Bithenge: add fake system call errors to test error handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/bithenge/blob.c

    r1c79996 ra42d7d8  
    461461/** Check whether the contents of two blobs are equal.
    462462 * @memberof bithenge_blob_t
     463 * @param[out] out Holds whether the blobs are equal.
    463464 * @param a, b Blobs to compare.
    464  * @return Whether the blobs are equal. If an error occurs, returns false.
    465  */
    466 bool bithenge_blob_equal(bithenge_blob_t *a, bithenge_blob_t *b)
     465 * @return EOK on success, or an error code from errno.h.
     466 */
     467int bithenge_blob_equal(bool *out, bithenge_blob_t *a, bithenge_blob_t *b)
    467468{
    468469        assert(a);
     
    476477                rc = bithenge_blob_read(a, offset, buffer_a, &size_a);
    477478                if (rc != EOK)
    478                         return false;
     479                        return rc;
    479480                rc = bithenge_blob_read(b, offset, buffer_b, &size_b);
    480481                if (rc != EOK)
    481                         return false;
    482                 if (size_a != size_b || bcmp(buffer_a, buffer_b, size_a))
    483                         return false;
     482                        return rc;
     483                if (size_a != size_b || bcmp(buffer_a, buffer_b, size_a)) {
     484                        *out = false;
     485                        return EOK;
     486                }
    484487                offset += size_a;
    485488        } while (size_a == sizeof(buffer_a));
    486         return true;
     489        *out = true;
     490        return EOK;
    487491}
    488492
Note: See TracChangeset for help on using the changeset viewer.