Fixed UTF and \t in COM_ParseLine

Fixed undefined structs error in ReHLDSK
This commit is contained in:
asmodai 2015-09-16 23:40:52 +03:00
parent c04b30a7fb
commit 0e4973de19
2 changed files with 21 additions and 7 deletions

View File

@ -1702,7 +1702,11 @@ inquotes:
/* <11495> ../engine/common.c:2049 */
char *COM_ParseLine(char *data)
{
#ifndef REHLDS_FIXES
unsigned int c;
#else
int c;
#endif
int len;
if (s_com_token_unget)
@ -1719,9 +1723,18 @@ char *COM_ParseLine(char *data)
return NULL;
}
c = *data; // TODO: data is signed, so will c, next check for >= ' ' will fail for upper ASCII
c = *data;
// parse a line out of the data
#ifndef REHLDS_FIXES
while ((c >= ' ' || c == '\t') && (len < COM_TOKEN_LEN - 1))
{
com_token[len] = c;
data++;
len++;
c = *data;
}
#else
do
{
com_token[len] = c; // TODO: Here c may be any ASCII, \n for example, but we are copy it in the token
@ -1729,6 +1742,7 @@ char *COM_ParseLine(char *data)
len++;
c = *data;
} while (c >= ' ' && (len < COM_TOKEN_LEN - 1)); // TODO: Will break on \t, may be it shouldn't?
#endif
com_token[len] = 0;
@ -1738,7 +1752,7 @@ char *COM_ParseLine(char *data)
}
// eat whitespace (LF,CR,etc.) at the end of this line
while ((c = *data) < ' ')
while ((c = *data) < ' ' && c != '\t')
{
if (c == 0)
{

View File

@ -118,12 +118,12 @@ typedef IVoidHookChain<model_t*, void*> IRehldsHook_Mod_LoadStudioModel;
typedef IVoidHookChainRegistry<model_t*, void*> IRehldsHookRegistry_Mod_LoadStudioModel;
//SV_EmitEvents hook
typedef IVoidHookChain<IGameClient *, packet_entities_t *, sizebuf_t *> IRehldsHook_SV_EmitEvents;
typedef IVoidHookChainRegistry<IGameClient *, packet_entities_t *, sizebuf_t *> IRehldsHookRegistry_SV_EmitEvents;
typedef IVoidHookChain<IGameClient *, struct packet_entities_s *, sizebuf_t *> IRehldsHook_SV_EmitEvents;
typedef IVoidHookChainRegistry<IGameClient *, struct packet_entities_s *, sizebuf_t *> IRehldsHookRegistry_SV_EmitEvents;
//EV_PlayReliableEvent hook
typedef IVoidHookChain<IGameClient *, int, short unsigned int, float, event_args_t *> IRehldsHook_EV_PlayReliableEvent;
typedef IVoidHookChainRegistry<IGameClient *, int, short unsigned int, float, event_args_t *> IRehldsHookRegistry_EV_PlayReliableEvent;
typedef IVoidHookChain<IGameClient *, int, short unsigned int, float, struct event_args_s *> IRehldsHook_EV_PlayReliableEvent;
typedef IVoidHookChainRegistry<IGameClient *, int, short unsigned int, float, struct event_args_s *> IRehldsHookRegistry_EV_PlayReliableEvent;
//SV_StartSound hook
typedef IVoidHookChain<int , edict_t *, int, const char *, int, float, int, int> IRehldsHook_SV_StartSound;
@ -197,7 +197,7 @@ struct RehldsFuncs_t {
cmd_source_t*(*GetCmdSource)();
void(*Log)(const char* prefix, const char* msg);
DLL_FUNCTIONS *(*GetEntityInterface)();
void(*EV_PlayReliableEvent)(IGameClient *cl, int entindex, short unsigned int eventindex, float delay, event_args_t *pargs);
void(*EV_PlayReliableEvent)(IGameClient *cl, int entindex, short unsigned int eventindex, float delay, struct event_args_s *pargs);
int(*SV_LookupSoundIndex)(const char *sample);
void(*MSG_StartBitWriting)(sizebuf_t *buf);
void(*MSG_WriteBits)(uint32 data, int numbits);