mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Don't use old String methods; use NSString methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1953 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
20cc0bb160
commit
630e258c7a
1 changed files with 12 additions and 9 deletions
|
@ -21,10 +21,10 @@
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gnustep/base/ostream.h"
|
#include <gnustep/base/ostream.h>
|
||||||
#include "gnustep/base/MemoryStream.h"
|
#include <gnustep/base/MemoryStream.h>
|
||||||
#include "gnustep/base/StdioStream.h"
|
#include <gnustep/base/StdioStream.h>
|
||||||
#include "gnustep/base/String.h"
|
#include <Foundation/NSString.h>
|
||||||
|
|
||||||
#define OSTREAM_EOF EOF
|
#define OSTREAM_EOF EOF
|
||||||
|
|
||||||
|
@ -151,11 +151,12 @@ ostream_printf (ostream *s, const char *format, ...)
|
||||||
void
|
void
|
||||||
ostream_vprintf (ostream *s, const char *format, va_list argList)
|
ostream_vprintf (ostream *s, const char *format, va_list argList)
|
||||||
{
|
{
|
||||||
id str = [String stringWithCString: format];
|
id str = [[NSString alloc] initWithCString: format];
|
||||||
if (s->flags & OSTREAM_WRITEFLAG)
|
if (s->flags & OSTREAM_WRITEFLAG)
|
||||||
[(id <Streaming>)s->stream_obj writeFormat: str arguments: argList];
|
[(id <Streaming>)s->stream_obj writeFormat: str arguments: argList];
|
||||||
else
|
else
|
||||||
_ostream_error("Tried to write to non-writable stream");
|
_ostream_error("Tried to write to non-writable stream");
|
||||||
|
[str release];
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -172,11 +173,12 @@ ostream_scanf (ostream *s, const char *format, ...)
|
||||||
int
|
int
|
||||||
ostream_vscanf (ostream *s, const char *format, va_list argList)
|
ostream_vscanf (ostream *s, const char *format, va_list argList)
|
||||||
{
|
{
|
||||||
id str = [String stringWithCString: format];
|
id str = [[NSString alloc] stringWithCString: format];
|
||||||
if (s->flags & OSTREAM_READFLAG)
|
if (s->flags & OSTREAM_READFLAG)
|
||||||
return [(id <Streaming>)s->stream_obj readFormat: str
|
return [(id <Streaming>)s->stream_obj readFormat: str
|
||||||
arguments: argList];
|
arguments: argList];
|
||||||
_ostream_error("Tried to read from non-readable stream");
|
_ostream_error("Tried to read from non-readable stream");
|
||||||
|
[str release];
|
||||||
return OSTREAM_EOF;
|
return OSTREAM_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +262,7 @@ ostream *
|
||||||
ostream_map_file (const char *name, int mode)
|
ostream_map_file (const char *name, int mode)
|
||||||
{
|
{
|
||||||
char* fmode;
|
char* fmode;
|
||||||
String* str = [String stringWithCString: name];
|
NSString* str = [NSString stringWithCString: name];
|
||||||
ostream* stream = _ostream_new_stream_struct(mode, &fmode);
|
ostream* stream = _ostream_new_stream_struct(mode, &fmode);
|
||||||
stream->stream_obj = [[StdioStream alloc] initWithFilename: str
|
stream->stream_obj = [[StdioStream alloc] initWithFilename: str
|
||||||
fmode: fmode];
|
fmode: fmode];
|
||||||
|
@ -286,8 +288,9 @@ ostream_save_to_file (ostream *s, const char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = [[StdioStream alloc] initWithFilename:
|
output = [[StdioStream alloc]
|
||||||
[NSString stringWithCString: name] fmode: "w"];
|
initWithFilename: [NSString stringWithCString: name]
|
||||||
|
fmode: "w"];
|
||||||
if (!output)
|
if (!output)
|
||||||
{
|
{
|
||||||
_ostream_error("Unable to open save file");
|
_ostream_error("Unable to open save file");
|
||||||
|
|
Loading…
Reference in a new issue