eolib 0.5.0
A core C library for writing applications related to Endless Online
Loading...
Searching...
No Matches
result.h File Reference

Go to the source code of this file.

Typedefs

typedef enum EoResult EoResult

Enumerations

enum  EoResult {
  EO_SUCCESS = 0 , EO_NULL_PTR = 1 , EO_OVERFLOW = 2 , EO_ALLOC_FAILED = 3 ,
  EO_NUMBER_TOO_LARGE = 4 , EO_BUFFER_UNDERRUN = 5 , EO_CHUNKED_MODE_DISABLED = 6 , EO_INVALID_SEQUENCE_RANGE = 7 ,
  EO_SEQUENCE_OUT_OF_RANGE = 8 , EO_INVALID_DATA = 9 , EO_STR_OUT_OF_RANGE = 10 , EO_STR_TOO_SHORT = 11 ,
  EO_INVALID_CHAR = 12 , EO_INVALID_SHORT = 13 , EO_INVALID_THREE = 14 , EO_INVALID_INT = 15
}

Functions

const char * eo_result_string (EoResult result)

Typedef Documentation

◆ EoResult

typedef enum EoResult EoResult

Return codes for eolib operations.

All functions that can fail return an EoResult. A return value of EO_SUCCESS (0) indicates the operation completed without error. Any other value describes what went wrong.

Enumeration Type Documentation

◆ EoResult

enum EoResult

Return codes for eolib operations.

All functions that can fail return an EoResult. A return value of EO_SUCCESS (0) indicates the operation completed without error. Any other value describes what went wrong.

Enumerator
EO_SUCCESS 

The operation completed successfully.

EO_NULL_PTR 

A required pointer argument was NULL.

Returned when a caller passes NULL for a mandatory parameter such as a writer, reader, sequencer, or output buffer pointer.

EO_OVERFLOW 

An internal size calculation would overflow.

Returned when growing a writer's buffer would exceed the addressable memory limit (SIZE_MAX).

EO_ALLOC_FAILED 

A memory allocation failed.

Returned when malloc or realloc returns NULL, indicating the system could not satisfy the requested allocation.

EO_NUMBER_TOO_LARGE 

A numeric value exceeds the EO encoding range.

Returned when a number passed to an EO encoding function is too large to be represented in the EO integer format (must be less than EO_INT_MAX).

EO_BUFFER_UNDERRUN 

The reader does not contain enough bytes for the requested read.

Returned when a reader function tries to consume more bytes than are available in the current read window.

EO_CHUNKED_MODE_DISABLED 

The reader is not in chunked reading mode.

Returned when eo_reader_next_chunk is called but chunked reading mode has not been enabled on the reader.

EO_INVALID_SEQUENCE_RANGE 

The calculated sequence range is invalid (max < min).

Returned by sequence_init_bytes when the derived seq1 bounds produce an empty range, indicating the start value is out of the representable sequence space.

EO_SEQUENCE_OUT_OF_RANGE 

A calculated sequence value falls outside [0, EO_CHAR_MAX - 1].

Returned by sequence_init_bytes or sequence_ping_bytes when the derived seq2 value cannot be encoded as a single EO byte.

EO_INVALID_DATA 

The data being deserialized is structurally invalid.

Returned during protocol deserialization when a required sentinel value does not match, a file magic string is wrong, or a required field contains an unexpected value.

EO_STR_OUT_OF_RANGE 10 

A string operation would exceed the allowed length.

Returned when a string operation, such as adding a fixed-length string, would result in a string that is too long for the allocated buffer.

EO_STR_TOO_SHORT 11 

A string is shorter than the expected length.

Returned when a fixed-length string added to a writer is shorter than the specified length, and padding is not enabled to fill the remaining space.

EO_INVALID_CHAR 12 

A character value is outside the valid range (0 to EO_CHAR_MAX).

Returned when attempting to encode a character that cannot be represented in the EO encoding format.

EO_INVALID_SHORT 13 

A short integer value is outside the valid range (0 to EO_SHORT_MAX).

Returned when attempting to encode a short integer that cannot be represented in the EO encoding format.

EO_INVALID_THREE 14 

A three-byte integer value is outside the valid range (0 to EO_THREE_MAX).

Returned when attempting to encode a three-byte integer that cannot be represented in the EO encoding format.

EO_INVALID_INT 15 

An integer value is outside the representable 4-byte EO range.

Returned when attempting to encode an integer whose 32-bit bit pattern cannot be represented in the EO integer format.

Definition at line 11 of file result.h.

Function Documentation

◆ eo_result_string()

const char * eo_result_string ( EoResult result)

Returns a human-readable string describing an EoResult value.

Parameters
resultThe result code to describe.
Returns
A static string describing the result. Never returns NULL.

Definition at line 175 of file data.c.