SDL  2.0
SDL_rwops.h File Reference
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_rwops.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDL_RWops
 

Macros

#define SDL_RWOPS_UNKNOWN   0U /* Unknown stream type */
 
#define SDL_RWOPS_WINFILE   1U /* Win32 file */
 
#define SDL_RWOPS_STDFILE   2U /* Stdio file */
 
#define SDL_RWOPS_JNIFILE   3U /* Android asset */
 
#define SDL_RWOPS_MEMORY   4U /* Memory stream */
 
#define SDL_RWOPS_MEMORY_RO   5U /* Read-Only memory stream */
 
#define RW_SEEK_SET   0
 
#define RW_SEEK_CUR   1
 
#define RW_SEEK_END   2
 
Read/write macros

Macros to easily read and write from an SDL_RWops structure.

#define SDL_RWsize(ctx)   (ctx)->size(ctx)
 
#define SDL_RWseek(ctx, offset, whence)   (ctx)->seek(ctx, offset, whence)
 
#define SDL_RWtell(ctx)   (ctx)->seek(ctx, 0, RW_SEEK_CUR)
 
#define SDL_RWread(ctx, ptr, size, n)   (ctx)->read(ctx, ptr, size, n)
 
#define SDL_RWwrite(ctx, ptr, size, n)   (ctx)->write(ctx, ptr, size, n)
 
#define SDL_RWclose(ctx)   (ctx)->close(ctx)
 

Functions

SDL_RWopsSDL_AllocRW (void)
 
void SDL_FreeRW (SDL_RWops *area)
 
RWFrom functions

Functions to create SDL_RWops structures from various data streams.

SDL_RWopsSDL_RWFromFile (const char *file, const char *mode)
 
SDL_RWopsSDL_RWFromFP (FILE *fp, SDL_bool autoclose)
 
SDL_RWopsSDL_RWFromMem (void *mem, int size)
 
SDL_RWopsSDL_RWFromConstMem (const void *mem, int size)
 
Read endian functions

Read an item of the specified endianness and return in native format.

Uint8 SDL_ReadU8 (SDL_RWops *src)
 
Uint16 SDL_ReadLE16 (SDL_RWops *src)
 
Uint16 SDL_ReadBE16 (SDL_RWops *src)
 
Uint32 SDL_ReadLE32 (SDL_RWops *src)
 
Uint32 SDL_ReadBE32 (SDL_RWops *src)
 
Uint64 SDL_ReadLE64 (SDL_RWops *src)
 
Uint64 SDL_ReadBE64 (SDL_RWops *src)
 
Write endian functions

Write an item of native format to the specified endianness.

size_t SDL_WriteU8 (SDL_RWops *dst, Uint8 value)
 
size_t SDL_WriteLE16 (SDL_RWops *dst, Uint16 value)
 
size_t SDL_WriteBE16 (SDL_RWops *dst, Uint16 value)
 
size_t SDL_WriteLE32 (SDL_RWops *dst, Uint32 value)
 
size_t SDL_WriteBE32 (SDL_RWops *dst, Uint32 value)
 
size_t SDL_WriteLE64 (SDL_RWops *dst, Uint64 value)
 
size_t SDL_WriteBE64 (SDL_RWops *dst, Uint64 value)
 

Detailed Description

This file provides a general interface for SDL to read and write data streams. It can easily be extended to files, memory, etc.

Definition in file SDL_rwops.h.

Macro Definition Documentation

◆ RW_SEEK_CUR

#define RW_SEEK_CUR   1

Seek relative to current read point

Definition at line 175 of file SDL_rwops.h.

Referenced by _testGenericRWopsValidations(), main(), mem_seek(), SDL_LoadBMP_RW(), and SDL_LoadWAV_RW().

◆ RW_SEEK_END

#define RW_SEEK_END   2

Seek relative to the end of data

Definition at line 176 of file SDL_rwops.h.

Referenced by _testGenericRWopsValidations(), main(), and mem_seek().

◆ RW_SEEK_SET

#define RW_SEEK_SET   0

Seek from the beginning of data

Definition at line 174 of file SDL_rwops.h.

Referenced by _testGenericRWopsValidations(), main(), mem_seek(), rwops_testFileWriteReadEndian(), SDL_LoadBMP_RW(), and SDL_SaveBMP_RW().

◆ SDL_RWclose

◆ SDL_RWOPS_JNIFILE

#define SDL_RWOPS_JNIFILE   3U /* Android asset */

Definition at line 45 of file SDL_rwops.h.

Referenced by rwops_testFileRead(), rwops_testFileWrite(), and SDL_RWFromFile().

◆ SDL_RWOPS_MEMORY

#define SDL_RWOPS_MEMORY   4U /* Memory stream */

Definition at line 46 of file SDL_rwops.h.

Referenced by rwops_testMem(), and SDL_RWFromMem().

◆ SDL_RWOPS_MEMORY_RO

#define SDL_RWOPS_MEMORY_RO   5U /* Read-Only memory stream */

Definition at line 47 of file SDL_rwops.h.

Referenced by rwops_testConstMem(), and SDL_RWFromConstMem().

◆ SDL_RWOPS_STDFILE

#define SDL_RWOPS_STDFILE   2U /* Stdio file */

◆ SDL_RWOPS_UNKNOWN

#define SDL_RWOPS_UNKNOWN   0U /* Unknown stream type */

Definition at line 42 of file SDL_rwops.h.

Referenced by rwops_testAllocFree(), and SDL_AllocRW().

◆ SDL_RWOPS_WINFILE

#define SDL_RWOPS_WINFILE   1U /* Win32 file */

Definition at line 43 of file SDL_rwops.h.

Referenced by rwops_testFileRead(), rwops_testFileWrite(), and SDL_RWFromFile().

◆ SDL_RWread

◆ SDL_RWseek

#define SDL_RWseek (   ctx,
  offset,
  whence 
)    (ctx)->seek(ctx, offset, whence)

◆ SDL_RWsize

#define SDL_RWsize (   ctx)    (ctx)->size(ctx)

Definition at line 184 of file SDL_rwops.h.

Referenced by SDL_GameControllerAddMappingsFromRW().

◆ SDL_RWtell

#define SDL_RWtell (   ctx)    (ctx)->seek(ctx, 0, RW_SEEK_CUR)

Definition at line 186 of file SDL_rwops.h.

Referenced by SDL_LoadBMP_RW(), and SDL_SaveBMP_RW().

◆ SDL_RWwrite

#define SDL_RWwrite (   ctx,
  ptr,
  size,
  n 
)    (ctx)->write(ctx, ptr, size, n)

Function Documentation

◆ SDL_AllocRW()

SDL_RWops* SDL_AllocRW ( void  )

Definition at line 637 of file SDL_rwops.c.

References NULL, SDL_malloc, SDL_OutOfMemory, SDL_RWOPS_UNKNOWN, and SDL_RWops::type.

Referenced by SDL_RWFromConstMem(), SDL_RWFromFile(), and SDL_RWFromMem().

638 {
639  SDL_RWops *area;
640 
641  area = (SDL_RWops *) SDL_malloc(sizeof *area);
642  if (area == NULL) {
643  SDL_OutOfMemory();
644  } else {
645  area->type = SDL_RWOPS_UNKNOWN;
646  }
647  return area;
648 }
#define SDL_RWOPS_UNKNOWN
Definition: SDL_rwops.h:42
Uint32 type
Definition: SDL_rwops.h:93
#define NULL
Definition: begin_code.h:143
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
#define SDL_malloc

◆ SDL_FreeRW()

void SDL_FreeRW ( SDL_RWops area)

Definition at line 651 of file SDL_rwops.c.

References SDL_free().

Referenced by mem_close(), and SDL_RWFromFile().

652 {
653  SDL_free(area);
654 }
void SDL_free(void *mem)

◆ SDL_ReadBE16()

Uint16 SDL_ReadBE16 ( SDL_RWops src)

Definition at line 677 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE16.

678 {
679  Uint16 value = 0;
680 
681  SDL_RWread(src, &value, sizeof (value), 1);
682  return SDL_SwapBE16(value);
683 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
#define SDL_SwapBE16(X)
Definition: SDL_endian.h:215
GLsizei const GLfloat * value
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

◆ SDL_ReadBE32()

Uint32 SDL_ReadBE32 ( SDL_RWops src)

Definition at line 695 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE32.

696 {
697  Uint32 value = 0;
698 
699  SDL_RWread(src, &value, sizeof (value), 1);
700  return SDL_SwapBE32(value);
701 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
#define SDL_SwapBE32(X)
Definition: SDL_endian.h:216
GLsizei const GLfloat * value

◆ SDL_ReadBE64()

Uint64 SDL_ReadBE64 ( SDL_RWops src)

Definition at line 713 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE64.

714 {
715  Uint64 value = 0;
716 
717  SDL_RWread(src, &value, sizeof (value), 1);
718  return SDL_SwapBE64(value);
719 }
#define SDL_SwapBE64(X)
Definition: SDL_endian.h:217
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:168
GLsizei const GLfloat * value

◆ SDL_ReadLE16()

Uint16 SDL_ReadLE16 ( SDL_RWops src)

Definition at line 668 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE16.

669 {
670  Uint16 value = 0;
671 
672  SDL_RWread(src, &value, sizeof (value), 1);
673  return SDL_SwapLE16(value);
674 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
GLsizei const GLfloat * value
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
#define SDL_SwapLE16(X)
Definition: SDL_endian.h:211

◆ SDL_ReadLE32()

Uint32 SDL_ReadLE32 ( SDL_RWops src)

Definition at line 686 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE32.

687 {
688  Uint32 value = 0;
689 
690  SDL_RWread(src, &value, sizeof (value), 1);
691  return SDL_SwapLE32(value);
692 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLsizei const GLfloat * value
#define SDL_SwapLE32(X)
Definition: SDL_endian.h:212

◆ SDL_ReadLE64()

Uint64 SDL_ReadLE64 ( SDL_RWops src)

Definition at line 704 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE64.

705 {
706  Uint64 value = 0;
707 
708  SDL_RWread(src, &value, sizeof (value), 1);
709  return SDL_SwapLE64(value);
710 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:168
#define SDL_SwapLE64(X)
Definition: SDL_endian.h:213
GLsizei const GLfloat * value

◆ SDL_ReadU8()

Uint8 SDL_ReadU8 ( SDL_RWops src)

Definition at line 659 of file SDL_rwops.c.

References SDL_RWread.

660 {
661  Uint8 value = 0;
662 
663  SDL_RWread(src, &value, sizeof (value), 1);
664  return value;
665 }
#define SDL_RWread(ctx, ptr, size, n)
Definition: SDL_rwops.h:187
GLsizei const GLfloat * value
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143

◆ SDL_RWFromConstMem()

SDL_RWops* SDL_RWFromConstMem ( const void mem,
int  size 
)

Definition at line 609 of file SDL_rwops.c.

References SDL_RWops::close, SDL_RWops::hidden, SDL_RWops::mem, mem_close(), mem_read(), mem_seek(), mem_size(), mem_writeconst(), NULL, SDL_RWops::read, SDL_AllocRW(), SDL_InvalidParamError, SDL_RWOPS_MEMORY_RO, SDL_RWops::seek, SDL_RWops::size, SDL_RWops::type, and SDL_RWops::write.

610 {
611  SDL_RWops *rwops = NULL;
612  if (!mem) {
613  SDL_InvalidParamError("mem");
614  return rwops;
615  }
616  if (!size) {
617  SDL_InvalidParamError("size");
618  return rwops;
619  }
620 
621  rwops = SDL_AllocRW();
622  if (rwops != NULL) {
623  rwops->size = mem_size;
624  rwops->seek = mem_seek;
625  rwops->read = mem_read;
626  rwops->write = mem_writeconst;
627  rwops->close = mem_close;
628  rwops->hidden.mem.base = (Uint8 *) mem;
629  rwops->hidden.mem.here = rwops->hidden.mem.base;
630  rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
631  rwops->type = SDL_RWOPS_MEMORY_RO;
632  }
633  return rwops;
634 }
size_t(* write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num)
Definition: SDL_rwops.h:83
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
static size_t mem_writeconst(SDL_RWops *context, const void *ptr, size_t size, size_t num)
Definition: SDL_rwops.c:447
GLsizeiptr size
static Sint64 mem_size(SDL_RWops *context)
Definition: SDL_rwops.c:379
Uint32 type
Definition: SDL_rwops.h:93
struct SDL_RWops::@10::@13 mem
Sint64(* seek)(struct SDL_RWops *context, Sint64 offset, int whence)
Definition: SDL_rwops.h:65
SDL_RWops * SDL_AllocRW(void)
Definition: SDL_rwops.c:637
static int mem_close(SDL_RWops *context)
Definition: SDL_rwops.c:454
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
int(* close)(struct SDL_RWops *context)
Definition: SDL_rwops.h:91
static Sint64 mem_seek(SDL_RWops *context, Sint64 offset, int whence)
Definition: SDL_rwops.c:385
Sint64(* size)(struct SDL_RWops *context)
Definition: SDL_rwops.h:57
#define NULL
Definition: begin_code.h:143
union SDL_RWops::@10 hidden
#define SDL_RWOPS_MEMORY_RO
Definition: SDL_rwops.h:47
size_t(* read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
Definition: SDL_rwops.h:74
static size_t mem_read(SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
Definition: SDL_rwops.c:413

◆ SDL_RWFromFile()

SDL_RWops* SDL_RWFromFile ( const char *  file,
const char *  mode 
)

Definition at line 466 of file SDL_rwops.c.

References Android_JNI_FileClose(), Android_JNI_FileOpen(), Android_JNI_FileRead(), Android_JNI_FileSeek(), Android_JNI_FileSize(), Android_JNI_FileWrite(), SDL_RWops::close, SDL_RWops::hidden, NULL, SDL_RWops::read, SDL_AllocRW(), SDL_AndroidGetInternalStoragePath, SDL_FreeRW(), SDL_RWFromFP(), SDL_RWOPS_JNIFILE, SDL_RWOPS_STDFILE, SDL_RWOPS_WINFILE, SDL_SetError, SDL_snprintf, SDL_stack_alloc, SDL_stack_free, SDL_RWops::seek, SDL_RWops::size, SDL_RWops::stdio, SDL_RWops::type, and SDL_RWops::write.

467 {
468  SDL_RWops *rwops = NULL;
469  if (!file || !*file || !mode || !*mode) {
470  SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
471  return NULL;
472  }
473 #if defined(__ANDROID__)
474 #ifdef HAVE_STDIO_H
475  /* Try to open the file on the filesystem first */
476  if (*file == '/') {
477  FILE *fp = fopen(file, mode);
478  if (fp) {
479  return SDL_RWFromFP(fp, 1);
480  }
481  } else {
482  /* Try opening it from internal storage if it's a relative path */
483  char *path;
484  FILE *fp;
485 
486  path = SDL_stack_alloc(char, PATH_MAX);
487  if (path) {
488  SDL_snprintf(path, PATH_MAX, "%s/%s",
490  fp = fopen(path, mode);
491  SDL_stack_free(path);
492  if (fp) {
493  return SDL_RWFromFP(fp, 1);
494  }
495  }
496  }
497 #endif /* HAVE_STDIO_H */
498 
499  /* Try to open the file from the asset system */
500  rwops = SDL_AllocRW();
501  if (!rwops)
502  return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
503  if (Android_JNI_FileOpen(rwops, file, mode) < 0) {
504  SDL_FreeRW(rwops);
505  return NULL;
506  }
507  rwops->size = Android_JNI_FileSize;
508  rwops->seek = Android_JNI_FileSeek;
509  rwops->read = Android_JNI_FileRead;
510  rwops->write = Android_JNI_FileWrite;
511  rwops->close = Android_JNI_FileClose;
512  rwops->type = SDL_RWOPS_JNIFILE;
513 
514 #elif defined(__WIN32__)
515  rwops = SDL_AllocRW();
516  if (!rwops)
517  return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
518  if (windows_file_open(rwops, file, mode) < 0) {
519  SDL_FreeRW(rwops);
520  return NULL;
521  }
522  rwops->size = windows_file_size;
523  rwops->seek = windows_file_seek;
524  rwops->read = windows_file_read;
525  rwops->write = windows_file_write;
526  rwops->close = windows_file_close;
527  rwops->type = SDL_RWOPS_WINFILE;
528 
529 #elif HAVE_STDIO_H
530  {
531  #ifdef __APPLE__
532  FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
533  #elif __WINRT__
534  FILE *fp = NULL;
535  fopen_s(&fp, file, mode);
536  #else
537  FILE *fp = fopen(file, mode);
538  #endif
539  if (fp == NULL) {
540  SDL_SetError("Couldn't open %s", file);
541  } else {
542  rwops = SDL_RWFromFP(fp, 1);
543  }
544  }
545 #else
546  SDL_SetError("SDL not compiled with stdio support");
547 #endif /* !HAVE_STDIO_H */
548 
549  return rwops;
550 }
int Android_JNI_FileClose(SDL_RWops *ctx)
void SDL_FreeRW(SDL_RWops *area)
Definition: SDL_rwops.c:651
#define SDL_RWOPS_WINFILE
Definition: SDL_rwops.h:43
size_t(* write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num)
Definition: SDL_rwops.h:83
int Android_JNI_FileOpen(SDL_RWops *ctx, const char *fileName, const char *mode)
Uint32 type
Definition: SDL_rwops.h:93
Sint64(* seek)(struct SDL_RWops *context, Sint64 offset, int whence)
Definition: SDL_rwops.h:65
SDL_RWops * SDL_AllocRW(void)
Definition: SDL_rwops.c:637
#define SDL_stack_alloc(type, count)
Definition: SDL_stdinc.h:328
int(* close)(struct SDL_RWops *context)
Definition: SDL_rwops.h:91
SDL_RWops * SDL_RWFromFP(void *fp, SDL_bool autoclose)
Definition: SDL_rwops.c:573
size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size, size_t num)
GLenum mode
Sint64(* size)(struct SDL_RWops *context)
Definition: SDL_rwops.h:57
#define NULL
Definition: begin_code.h:143
#define SDL_SetError
size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size, size_t maxnum)
size_t(* read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
Definition: SDL_rwops.h:74
#define SDL_snprintf
GLsizei const GLchar *const * path
#define SDL_stack_free(data)
Definition: SDL_stdinc.h:329
#define SDL_AndroidGetInternalStoragePath
Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence)
Sint64 Android_JNI_FileSize(SDL_RWops *ctx)
#define SDL_RWOPS_JNIFILE
Definition: SDL_rwops.h:45

◆ SDL_RWFromFP()

SDL_RWops* SDL_RWFromFP ( FILE *  fp,
SDL_bool  autoclose 
)

◆ SDL_RWFromMem()

SDL_RWops* SDL_RWFromMem ( void mem,
int  size 
)

Definition at line 581 of file SDL_rwops.c.

References SDL_RWops::close, SDL_RWops::hidden, SDL_RWops::mem, mem_close(), mem_read(), mem_seek(), mem_size(), mem_write(), NULL, SDL_RWops::read, SDL_AllocRW(), SDL_InvalidParamError, SDL_RWOPS_MEMORY, SDL_RWops::seek, SDL_RWops::size, SDL_RWops::type, and SDL_RWops::write.

582 {
583  SDL_RWops *rwops = NULL;
584  if (!mem) {
585  SDL_InvalidParamError("mem");
586  return rwops;
587  }
588  if (!size) {
589  SDL_InvalidParamError("size");
590  return rwops;
591  }
592 
593  rwops = SDL_AllocRW();
594  if (rwops != NULL) {
595  rwops->size = mem_size;
596  rwops->seek = mem_seek;
597  rwops->read = mem_read;
598  rwops->write = mem_write;
599  rwops->close = mem_close;
600  rwops->hidden.mem.base = (Uint8 *) mem;
601  rwops->hidden.mem.here = rwops->hidden.mem.base;
602  rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
603  rwops->type = SDL_RWOPS_MEMORY;
604  }
605  return rwops;
606 }
size_t(* write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num)
Definition: SDL_rwops.h:83
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
GLsizeiptr size
static Sint64 mem_size(SDL_RWops *context)
Definition: SDL_rwops.c:379
Uint32 type
Definition: SDL_rwops.h:93
struct SDL_RWops::@10::@13 mem
Sint64(* seek)(struct SDL_RWops *context, Sint64 offset, int whence)
Definition: SDL_rwops.h:65
static size_t mem_write(SDL_RWops *context, const void *ptr, size_t size, size_t num)
Definition: SDL_rwops.c:436
SDL_RWops * SDL_AllocRW(void)
Definition: SDL_rwops.c:637
static int mem_close(SDL_RWops *context)
Definition: SDL_rwops.c:454
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
int(* close)(struct SDL_RWops *context)
Definition: SDL_rwops.h:91
static Sint64 mem_seek(SDL_RWops *context, Sint64 offset, int whence)
Definition: SDL_rwops.c:385
Sint64(* size)(struct SDL_RWops *context)
Definition: SDL_rwops.h:57
#define NULL
Definition: begin_code.h:143
#define SDL_RWOPS_MEMORY
Definition: SDL_rwops.h:46
union SDL_RWops::@10 hidden
size_t(* read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
Definition: SDL_rwops.h:74
static size_t mem_read(SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
Definition: SDL_rwops.c:413

◆ SDL_WriteBE16()

size_t SDL_WriteBE16 ( SDL_RWops dst,
Uint16  value 
)

Definition at line 735 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE16.

736 {
737  const Uint16 swapped = SDL_SwapBE16(value);
738  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
739 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
#define SDL_SwapBE16(X)
Definition: SDL_endian.h:215
GLsizei const GLfloat * value
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

◆ SDL_WriteBE32()

size_t SDL_WriteBE32 ( SDL_RWops dst,
Uint32  value 
)

Definition at line 749 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE32.

750 {
751  const Uint32 swapped = SDL_SwapBE32(value);
752  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
753 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
#define SDL_SwapBE32(X)
Definition: SDL_endian.h:216
GLsizei const GLfloat * value

◆ SDL_WriteBE64()

size_t SDL_WriteBE64 ( SDL_RWops dst,
Uint64  value 
)

Definition at line 763 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE64.

764 {
765  const Uint64 swapped = SDL_SwapBE64(value);
766  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
767 }
#define SDL_SwapBE64(X)
Definition: SDL_endian.h:217
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:168
GLsizei const GLfloat * value

◆ SDL_WriteLE16()

size_t SDL_WriteLE16 ( SDL_RWops dst,
Uint16  value 
)

Definition at line 728 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE16.

729 {
730  const Uint16 swapped = SDL_SwapLE16(value);
731  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
732 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
GLsizei const GLfloat * value
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
#define SDL_SwapLE16(X)
Definition: SDL_endian.h:211

◆ SDL_WriteLE32()

size_t SDL_WriteLE32 ( SDL_RWops dst,
Uint32  value 
)

Definition at line 742 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE32.

743 {
744  const Uint32 swapped = SDL_SwapLE32(value);
745  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
746 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLsizei const GLfloat * value
#define SDL_SwapLE32(X)
Definition: SDL_endian.h:212

◆ SDL_WriteLE64()

size_t SDL_WriteLE64 ( SDL_RWops dst,
Uint64  value 
)

Definition at line 756 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE64.

757 {
758  const Uint64 swapped = SDL_SwapLE64(value);
759  return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
760 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:168
#define SDL_SwapLE64(X)
Definition: SDL_endian.h:213
GLsizei const GLfloat * value

◆ SDL_WriteU8()

size_t SDL_WriteU8 ( SDL_RWops dst,
Uint8  value 
)

Definition at line 722 of file SDL_rwops.c.

References SDL_RWwrite.

723 {
724  return SDL_RWwrite(dst, &value, sizeof (value), 1);
725 }
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
GLsizei const GLfloat * value