rwops: Make read and write work like POSIX, not stdio.
This simplifies some things, clarifies some things, and also allows for the possibility of RWops that offer non-blocking i/o (although none of the current built-in ones do, intentionally, we could add this later if we choose, or people could provide things like network socket RWops implementations now, etc. Fixes #6729.
This commit is contained in:
@@ -145,7 +145,7 @@ static int unifont_init(const char *fontname)
|
||||
Uint8 glyphWidth;
|
||||
Uint32 codepoint;
|
||||
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer, 1, 9);
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer, 9);
|
||||
if (numGlyphs > 0 && bytesRead == 0) {
|
||||
break; /* EOF */
|
||||
}
|
||||
@@ -181,7 +181,7 @@ static int unifont_init(const char *fontname)
|
||||
if (codepointHexSize < 8) {
|
||||
SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread);
|
||||
}
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 1, 33 - bytesOverread);
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 33 - bytesOverread);
|
||||
if (bytesRead < (33 - bytesOverread)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
|
||||
return -1;
|
||||
@@ -190,7 +190,7 @@ static int unifont_init(const char *fontname)
|
||||
glyphWidth = 8;
|
||||
} else {
|
||||
glyphWidth = 16;
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 1, 32);
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 32);
|
||||
if (bytesRead < 32) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user