]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/at45db/BlockStorageP.nc
turn on safe compilation for some modules
[tinyos-2.x.git] / tos / chips / at45db / BlockStorageP.nc
index 063040c0eb857cbd12282aa688780db1576b31fb..8266d4c2c89f05deadd3c1149ccbf70d820bd846 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "Storage.h"
 
-module BlockStorageP {
+module BlockStorageP @safe() {
   provides {
     interface BlockWrite[uint8_t blockId];
     interface BlockRead[uint8_t blockId];
@@ -236,7 +236,7 @@ implementation
     storage_addr_t remaining = s[client].len - currentOffset, addr;
     at45page_t page;
     at45pageoffset_t pageOffset, count;
-    uint8_t *buf = s[client].buf + currentOffset;
+    uint8_t *buf = s[client].buf;
 
     if (remaining == 0)
       {
@@ -254,10 +254,10 @@ implementation
     switch (s[client].request)
       {
       case R_WRITE:
-       call At45db.write(page, pageOffset, buf, count);
+       call At45db.write(page, pageOffset, buf + currentOffset, count);
        break;
       case R_READ:
-       call At45db.read(page, pageOffset, buf, count);
+       call At45db.read(page, pageOffset, buf + currentOffset, count);
        break;
       case R_CRC:
        call At45db.computeCrc(page, pageOffset, count, crc);