X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fhelper%2Ffileio.c;h=84e1f846e4ba3bdd563de17defa2c103907c4b39;hp=bb10dbd1331f6c9d3b5400d40c50c208fd39f84f;hb=68c598e88d5e09728ea845a81ab279c615bbaf0f;hpb=219b7f30b99c8af9f94fa1b10537bb0e2dc6209f diff --git a/src/helper/fileio.c b/src/helper/fileio.c index bb10dbd133..84e1f846e4 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -2,6 +2,12 @@ * Copyright (C) 2007 by Dominic Rath * * Dominic.Rath@gmx.de * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * + * Copyright (C) 2008 by Spencer Oliver * + * spen@spen-soft.co.uk * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -62,7 +68,7 @@ int fileio_open_local(fileio_t *fileio) strcpy(access, "a+"); break; default: - ERROR("BUG: access neither read, write nor readwrite"); + LOG_ERROR("BUG: access neither read, write nor readwrite"); return ERROR_INVALID_ARGUMENTS; } @@ -76,7 +82,7 @@ int fileio_open_local(fileio_t *fileio) if (!(fileio->file = open_file_from_path (fileio->url, access))) { - ERROR("couldn't open %s", fileio->url); + LOG_ERROR("couldn't open %s", fileio->url); return ERROR_FILEIO_OPERATION_FAILED; } @@ -127,11 +133,11 @@ int fileio_close_local(fileio_t *fileio) { if (retval == EBADF) { - ERROR("BUG: fileio_local->file not a valid file descriptor"); + LOG_ERROR("BUG: fileio_local->file not a valid file descriptor"); } else { - ERROR("couldn't close %s: %s", fileio->url, strerror(errno)); + LOG_ERROR("couldn't close %s: %s", fileio->url, strerror(errno)); } return ERROR_FILEIO_OPERATION_FAILED; @@ -157,7 +163,7 @@ int fileio_seek(fileio_t *fileio, u32 position) int retval; if ((retval = fseek(fileio->file, position, SEEK_SET)) != 0) { - ERROR("couldn't seek file %s: %s", fileio->url, strerror(errno)); + LOG_ERROR("couldn't seek file %s: %s", fileio->url, strerror(errno)); return ERROR_FILEIO_OPERATION_FAILED; } @@ -189,7 +195,7 @@ int fileio_read_u32(fileio_t *fileio, u32 *data) return ERROR_OK; } -int fileio_local_fgets(fileio_t *fileio, u32 size, u8 *buffer) +int fileio_local_fgets(fileio_t *fileio, u32 size, char *buffer) { if( fgets(buffer, size, fileio->file) == NULL) return ERROR_FILEIO_OPERATION_FAILED; @@ -197,7 +203,7 @@ int fileio_local_fgets(fileio_t *fileio, u32 size, u8 *buffer) return ERROR_OK; } -int fileio_fgets(fileio_t *fileio, u32 size, u8 *buffer) +int fileio_fgets(fileio_t *fileio, u32 size, char *buffer) { return fileio_local_fgets(fileio, size, buffer); }