diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 03:50:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 03:50:21 +0300 |
commit | d9de6fca6cda2a7ddeeb936692b529182a14dec9 (patch) | |
tree | 63b5384fe03297bdfb40205c280b36ec043d0ed1 /source/blender/readblenfile | |
parent | ea81c58429ecd51752e2abb7d756ef1d09514b84 (diff) |
2.5: Change blenloader module to use the Report system for reporting errors.
Diffstat (limited to 'source/blender/readblenfile')
-rw-r--r-- | source/blender/readblenfile/BLO_readblenfile.h | 10 | ||||
-rw-r--r-- | source/blender/readblenfile/intern/BLO_readblenfile.c | 13 |
2 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/readblenfile/BLO_readblenfile.h b/source/blender/readblenfile/BLO_readblenfile.h index 01de3c77f01..8d85956054f 100644 --- a/source/blender/readblenfile/BLO_readblenfile.h +++ b/source/blender/readblenfile/BLO_readblenfile.h @@ -35,21 +35,23 @@ extern "C" { #endif +struct ReportList; + BlendFileData * BLO_readblenfilename( char *fileName, - BlendReadError *error_r); + struct ReportList *reports); BlendFileData * BLO_readblenfilehandle( int fileHandle, - BlendReadError *error_r); + struct ReportList *reports); BlendFileData * BLO_readblenfilememory( char *fromBuffer, int fromBufferSize, - BlendReadError *error_r); + struct ReportList *reports); void @@ -68,7 +70,7 @@ blo_is_a_runtime( BlendFileData * blo_read_runtime( char *file, - BlendReadError *error_r); + struct ReportList *reports); #define BLO_RESERVEDSIZE 12 extern char *headerMagic; diff --git a/source/blender/readblenfile/intern/BLO_readblenfile.c b/source/blender/readblenfile/intern/BLO_readblenfile.c index ec71611b31d..a988b269725 100644 --- a/source/blender/readblenfile/intern/BLO_readblenfile.c +++ b/source/blender/readblenfile/intern/BLO_readblenfile.c @@ -51,6 +51,7 @@ #include "BLO_readblenfile.h" #include "BKE_blender.h" +#include "BKE_report.h" #include "BLI_blenlib.h" @@ -130,7 +131,7 @@ cleanup: BlendFileData * blo_read_runtime( char *path, - BlendReadError *error_r) + ReportList *reports) { BlendFileData *bfd= NULL; int fd, actualsize, datastart; @@ -138,7 +139,7 @@ blo_read_runtime( fd= open(path, O_BINARY|O_RDONLY, 0); if (fd==-1) { - *error_r= BRE_UNABLE_TO_OPEN; + BKE_report(reports, RPT_ERROR, "Unable to open"); goto cleanup; } @@ -148,18 +149,18 @@ blo_read_runtime( datastart= handle_read_msb_int(fd); if (datastart==-1) { - *error_r= BRE_UNABLE_TO_READ; + BKE_report(reports, RPT_ERROR, "Unable to read"); goto cleanup; } else if (read(fd, buf, 8)!=8) { - *error_r= BRE_UNABLE_TO_READ; + BKE_report(reports, RPT_ERROR, "Unable to read"); goto cleanup; } else if (memcmp(buf, "BRUNTIME", 8)!=0) { - *error_r= BRE_NOT_A_BLEND; + BKE_report(reports, RPT_ERROR, "File is not a Blender file"); goto cleanup; } else { //printf("starting to read runtime from %s at datastart %d\n", path, datastart); lseek(fd, datastart, SEEK_SET); - bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, error_r); + bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports); fd= -1; // file was closed in blo_read_blendafterruntime() } |