[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32923] trunk/blender/source/blender/ blenlib: remove BLI_bfile, has been in blenders source for quite some time but remains unused.

Campbell Barton ideasman42 at gmail.com
Sun Nov 7 17:02:17 CET 2010


Revision: 32923
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32923
Author:   campbellbarton
Date:     2010-11-07 17:02:17 +0100 (Sun, 07 Nov 2010)

Log Message:
-----------
remove BLI_bfile, has been in blenders source for quite some time but remains unused.
can add back in if its ready to be used ofcourse.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/SConscript

Removed Paths:
-------------
    trunk/blender/source/blender/blenlib/BLI_bfile.h
    trunk/blender/source/blender/blenlib/intern/BLI_bfile.c

Deleted: trunk/blender/source/blender/blenlib/BLI_bfile.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_bfile.h	2010-11-07 16:00:47 UTC (rev 32922)
+++ trunk/blender/source/blender/blenlib/BLI_bfile.h	2010-11-07 16:02:17 UTC (rev 32923)
@@ -1,143 +0,0 @@
-/* -*- indent-tabs-mode:t; tab-width:4; -*-
- *
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 by Stichting Blender Foundation.
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- * BFILE* based abstraction of file access.
- */
-
-#ifndef BLI_BFILE_H
-#define BLI_BFILE_H
-
-/* For fopen's FILE */
-#include <stdio.h>
-
-/**
- Defines for the bflags param.
- */
-/* Special handling, pick one of: */
-/* For "symmetry" of flags */
-#define BFILE_NORMAL (0)
-/* No supervision, just translate // if needed, RISKY */
-#define BFILE_RAW    (1<<0)
-/* Path is for current session temp files */
-#define BFILE_TEMP   (1<<1)
-/* Path is based in env vars of matching name */
-#define BFILE_CONFIG_BASE      (1<<2)
-#define BFILE_CONFIG_DATAFILES (1<<3)
-#define BFILE_CONFIG_PYTHON    (1<<4)
-#define BFILE_CONFIG_PLUGINS   (1<<5)
-
-/* Config handling, special cases: */
-#define BFILE_USERONLY (1<<6)
-#define BFILE_SYSONLY  (1<<7)
-
-/* Compression to apply on close: */
-#define BFILE_GZIP (1<<8)
-#define BFILE_LZMA (1<<9)
-
-/**
- File descriptor for Blender abstracted file access.
- */
-typedef struct {
-	FILE *stream;
-	int fd;
-
-	/* Anything below should not be touched directly */
-	int uflags;       /* Special options requested by upper level, copy of bflags */
-	char *fpath;      /* Final/requested path name */
-	char *tpath;      /* Temp path name if applicable */
-	int classf;       /* Own flags, common classification of open and fopen */
-	int error;        /* An op caused an error, unsafe to replace older files */
-} BFILE;
-
-/**
- Open a BFILE* with fopen()-like syntax.
- */
-BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags, const char *relpath);
-
-/**
- Open a BFILE* with open()-like syntax.
- */
-BFILE *BLI_bfile_open(const char *pathname, int flags, int bflags, const char *relpath);
-
-/**
- Get the FILE* associated with the BFILE*.
- */
-FILE *BLI_bfile_file_from_bfile(BFILE *bfile);
-
-/**
- Get the fd associated with the BFILE*.
- */
-int BLI_bfile_fd_from_bfile(BFILE *bfile);
-
-/**
- write()-like using BFILE*.
- */
-ssize_t BLI_bfile_write(BFILE *f, const void *buf, size_t count);
-
-/**
- read()-like using BFILE*.
- */
-ssize_t BLI_bfile_read(BFILE *f, void *buf, size_t count);
-
-/**
- fwrite()-like using BFILE*.
- */
-size_t BLI_bfile_fwrite(const void *ptr, size_t size, size_t nmemb, BFILE *f);
-
-/**
- fread()-like using BFILE*.
- */
-size_t BLI_bfile_fread(void *ptr, size_t size, size_t nmemb, BFILE *f);
-
-/**
- Close a BFILE, to match close() and fclose().
- */
-void BLI_bfile_close(BFILE *bfile);
-
-/**
- Clear error status.
- Call it only if the error has been really handled.
- */
-void BLI_bfile_clear_error(BFILE *bfile);
-
-/**
- Set the error status.
- Call it to mark writing by a 3rd party failed (libjpeg reported error, ie).
- */
-void BLI_bfile_set_error(BFILE *bfile, int error);
-
-/*
-TODO
-Maybe also provide more OS/libc things like:
-fflush
-fprintf and related
-fscanf
-fgetc/fputc and related
-fseek and related
-
-Probably good to do:
-readdir (compacted list showing all files for a "directory" (user versions on top of system's))
-*/
-
-#endif /* ifndef BLI_BFILE_H */

Modified: trunk/blender/source/blender/blenlib/SConscript
===================================================================
--- trunk/blender/source/blender/blenlib/SConscript	2010-11-07 16:00:47 UTC (rev 32922)
+++ trunk/blender/source/blender/blenlib/SConscript	2010-11-07 16:02:17 UTC (rev 32923)
@@ -3,11 +3,6 @@
 
 sources = env.Glob('intern/*.c')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
-    sources.remove('intern\\BLI_bfile.c')
-else:
-    sources.remove('intern/BLI_bfile.c')
-
 cflags=''
 incs = '. ../makesdna ../blenkernel #/intern/guardedalloc #/intern/ghost ../editors/include ../gpu'
 incs += ' ' + env['BF_FREETYPE_INC']

Deleted: trunk/blender/source/blender/blenlib/intern/BLI_bfile.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_bfile.c	2010-11-07 16:00:47 UTC (rev 32922)
+++ trunk/blender/source/blender/blenlib/intern/BLI_bfile.c	2010-11-07 16:02:17 UTC (rev 32923)
@@ -1,372 +0,0 @@
-/* -*- indent-tabs-mode:t; tab-width:4; -*-
- *
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 by Stichting Blender Foundation.
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- * BFILE* based abstraction for file access.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#ifndef WIN32
- #include <libgen.h>
- #include <unistd.h>
- #include <sys/param.h>
-#else
- #include <io.h>
- #include "BLI_winstuff.h"
- static char* find_in_pathlist(char* filename, char* pathlist);
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
-#include "BKE_blender.h"
-#include "BLI_path_util.h"
-#include "BLI_fileops.h"
-#include "BLI_storage.h"
-#include "BLI_bfile.h"
-
-/* Internal bfile classification flags */
-#define BCF_OPEN     (0)
-#define BCF_FOPEN    (1<<0)
-#define BCF_READ     (1<<1)
-#define BCF_WRITE    (1<<2)
-#define BCF_AT_END   (1<<3)
-#define BCF_DISCARD  (1<<4)
-
-/* Standard files names */
-#define LAST_SESSION_FILE "last-session"
-#define ENVIRONMENT_FILE "environment"
-
-
-/* Declaration of internal functions */
-static void fill_paths(BFILE *bfile, const char *path, const char *relpath);
-static void free_paths(BFILE* bfile);
-
-
-/*** Exported functions ***/
-
-BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags,
-                       const char *relpath)
-{
-	BFILE *bfile;
-
-	bfile = MEM_mallocN(sizeof(BFILE), "bfile-fopen");
-	bfile->classf = BCF_FOPEN;
-	bfile->uflags = bflags;
-
-	/* From fopen() doc, we can guess some logic:
-	r  BCF_READ
-	r+ BCF_READ | BCF_WRITE
-	w  BCF_DISCARD | BCF_WRITE
-	w+ BCF_DISCARD | BCF_WRITE | BCF_READ
-	a  BCF_AT_END | BCF_WRITE
-	a+ BCF_AT_END | BCF_WRITE | BCF_READ
-	*/
-	if (strchr(mode, 'r'))
-		bfile->classf |= BCF_READ;
-	if (strchr(mode, 'w'))
-		bfile->classf |= (BCF_DISCARD | BCF_WRITE);
-	if (strchr(mode, 'a'))
-		bfile->classf |= (BCF_AT_END | BCF_WRITE);
-	if (strchr(mode, '+'))
-		bfile->classf |= (BCF_READ | BCF_WRITE);
-
-	fill_paths(bfile, path, relpath);
-
-	bfile->stream = fopen(bfile->tpath, mode);
-	if (!(bfile->stream)) {
-		free_paths(bfile);
-		MEM_freeN(bfile);
-		return NULL;
-	}
-
-	bfile->fd = fileno(bfile->stream);
-
-	return bfile;
-}
-
-
-BFILE *BLI_bfile_open(const char *pathname, int flags, int bflags,
-                      const char *relpath)
-{
-	BFILE *bfile;
-	char fopen_mode[3];
-
-	bfile = MEM_mallocN(sizeof(BFILE), "bfile-open");
-	bfile->classf = BCF_OPEN;
-	bfile->uflags = bflags;
-
-	/* Easy mapping for open() */
-	if (flags & O_RDONLY)
-		bfile->classf |= BCF_READ;
-	if (flags & O_WRONLY)
-		bfile->classf |= BCF_WRITE;
-	if (flags & O_RDWR)
-		bfile->classf |= (BCF_READ | BCF_WRITE);
-	if (flags & O_APPEND)
-		bfile->classf |= BCF_AT_END;
-	if (flags & O_TRUNC)
-		bfile->classf |= BCF_DISCARD;
-
-	fill_paths(bfile, pathname, relpath);
-
-	bfile->fd = open(bfile->tpath, flags);
-	if (bfile->fd == -1) {
-		free_paths(bfile);
-		MEM_freeN(bfile);
-		return NULL;
-	}
-
-	fopen_mode[0] = 'r';
-	fopen_mode[1] = '\0';
-	fopen_mode[2] = '\0';
-	if (bfile->classf & BCF_DISCARD) {
-		fopen_mode[0] = 'w';
-		if (bfile->classf & BCF_READ) {
-			fopen_mode[1] = '+';
-		}
-	} else if (bfile->classf & BCF_AT_END) {
-		fopen_mode[0] = 'a';
-		if (bfile->classf & BCF_READ) {
-			fopen_mode[1] = '+';
-		}
-	} else if (bfile->classf & BCF_WRITE) {
-		fopen_mode[1] = '+';
-	}
-
-	bfile->stream = fdopen(bfile->fd, fopen_mode); /* MSWindows _fdopen? */
-	if (!(bfile->stream)) {
-		free_paths(bfile);
-		MEM_freeN(bfile);
-		return NULL;
-	}
-
-	return bfile;
-}
-
-
-FILE *BLI_bfile_file_from_bfile(BFILE *bfile) {
-	return bfile->stream;
-}
-
-
-int BLI_bfile_fd_from_bfile(BFILE *bfile) {
-	return bfile->fd;
-}
-
-
-ssize_t BLI_bfile_write(BFILE *f, const void *buf, size_t count) {
-	ssize_t ret;
-
-	ret = write((f->fd), buf, count);
-	if (ret == -1) {
-		f->error = 1;
-	}
-
-	return ret;
-}
-
-
-ssize_t BLI_bfile_read(BFILE *f, void *buf, size_t count) {
-	ssize_t ret;
-
-	ret = read((f->fd), buf, count);
-	if (ret == -1) {
-		f->error = 1;
-	}
-
-	return ret;
-}
-
-
-size_t BLI_bfile_fwrite(const void *ptr, size_t size, size_t nmemb,
-                        BFILE *f)
-{
-	size_t ret;
-
-	if (f == NULL)
-		return 0;
-
-	ret = fwrite(ptr, size, nmemb, f->stream);
-	if (ret <= 0) {
-		f->error = 1;
-	}
-
-	return ret;
-}
-
-
-size_t BLI_bfile_fread(void *ptr, size_t size, size_t nmemb, BFILE *f) {
-	size_t ret;
-
-	if (f == NULL)
-		return 0;
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list