porting over some minor changes to LLT
This commit is contained in:
parent
b7f08e854f
commit
8d7576250d
|
@ -10,7 +10,7 @@ static char hexdig[] = "0123456789abcdef";
|
|||
display a given number of bytes from a buffer, with the first
|
||||
address label being startoffs
|
||||
*/
|
||||
void hexdump(ios_t *dest, char *buffer, size_t len, size_t startoffs)
|
||||
void hexdump(ios_t *dest, const char *buffer, size_t len, size_t startoffs)
|
||||
{
|
||||
size_t offs=0;
|
||||
size_t i, pos;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include "ieee754.h"
|
||||
#include "dtypes.h"
|
||||
|
@ -62,7 +61,7 @@ u_int32_t int64to32hash(u_int64_t key)
|
|||
|
||||
#include "lookup3.c"
|
||||
|
||||
u_int64_t memhash(char* buf, size_t n)
|
||||
u_int64_t memhash(const char* buf, size_t n)
|
||||
{
|
||||
u_int32_t c=0xcafe8881, b=0x4d6a087c;
|
||||
|
||||
|
@ -70,7 +69,7 @@ u_int64_t memhash(char* buf, size_t n)
|
|||
return (u_int64_t)c | (((u_int64_t)b)<<32);
|
||||
}
|
||||
|
||||
u_int32_t memhash32(char* buf, size_t n)
|
||||
u_int32_t memhash32(const char* buf, size_t n)
|
||||
{
|
||||
u_int32_t c=0xcafe8881, b=0x4d6a087c;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ u_int32_t int64to32hash(u_int64_t key);
|
|||
#else
|
||||
#define inthash int32hash
|
||||
#endif
|
||||
u_int64_t memhash(char* buf, size_t n);
|
||||
u_int32_t memhash32(char* buf, size_t n);
|
||||
u_int64_t memhash(const char* buf, size_t n);
|
||||
u_int32_t memhash32(const char* buf, size_t n);
|
||||
|
||||
#endif
|
||||
|
|
16
llt/ios.c
16
llt/ios.c
|
@ -371,7 +371,7 @@ size_t ios_write(ios_t *s, char *data, size_t n)
|
|||
wrote = _write_grow(s, data, n);
|
||||
}
|
||||
else if (s->bm == bm_none) {
|
||||
int result = _os_write_all(s->fd, data, n, &wrote);
|
||||
_os_write_all(s->fd, data, n, &wrote);
|
||||
return wrote;
|
||||
}
|
||||
else if (n <= space) {
|
||||
|
@ -395,7 +395,7 @@ size_t ios_write(ios_t *s, char *data, size_t n)
|
|||
s->state = bst_wr;
|
||||
ios_flush(s);
|
||||
if (n > MOST_OF(s->maxsize)) {
|
||||
int result = _os_write_all(s->fd, data, n, &wrote);
|
||||
_os_write_all(s->fd, data, n, &wrote);
|
||||
return wrote;
|
||||
}
|
||||
return ios_write(s, data, n);
|
||||
|
@ -414,17 +414,22 @@ off_t ios_seek(ios_t *s, off_t pos)
|
|||
return s->bpos;
|
||||
}
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t ios_seek_end(ios_t *s)
|
||||
{
|
||||
s->_eof = 1;
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t ios_skip(ios_t *s, off_t offs)
|
||||
{
|
||||
if (offs < 0)
|
||||
s->_eof = 0;
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t ios_pos(ios_t *s)
|
||||
|
@ -879,7 +884,6 @@ int ios_peekutf8(ios_t *s, uint32_t *pwc)
|
|||
int c;
|
||||
size_t sz;
|
||||
char c0;
|
||||
char buf[8];
|
||||
|
||||
c = ios_peekc(s);
|
||||
if (c == IOS_EOF)
|
||||
|
@ -913,7 +917,9 @@ void ios_purge(ios_t *s)
|
|||
}
|
||||
}
|
||||
|
||||
int ios_vprintf(ios_t *s, char *format, va_list args)
|
||||
int vasprintf(char **strp, const char *fmt, va_list ap);
|
||||
|
||||
int ios_vprintf(ios_t *s, const char *format, va_list args)
|
||||
{
|
||||
char *str=NULL;
|
||||
int c;
|
||||
|
@ -944,7 +950,7 @@ int ios_vprintf(ios_t *s, char *format, va_list args)
|
|||
return c;
|
||||
}
|
||||
|
||||
int ios_printf(ios_t *s, char *format, ...)
|
||||
int ios_printf(ios_t *s, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int c;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __IOS_H_
|
||||
#define __IOS_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
// this flag controls when data actually moves out to the underlying I/O
|
||||
// channel. memory streams are a special case of this where the data
|
||||
// never moves out.
|
||||
|
@ -103,10 +105,10 @@ int ios_putnum(ios_t *s, char *data, uint32_t type);
|
|||
int ios_putint(ios_t *s, int n);
|
||||
int ios_pututf8(ios_t *s, uint32_t wc);
|
||||
int ios_putstringz(ios_t *s, char *str, bool_t do_write_nulterm);
|
||||
int ios_printf(ios_t *s, char *format, ...);
|
||||
int ios_vprintf(ios_t *s, char *format, va_list args);
|
||||
int ios_printf(ios_t *s, const char *format, ...);
|
||||
int ios_vprintf(ios_t *s, const char *format, va_list args);
|
||||
|
||||
void hexdump(ios_t *dest, char *buffer, size_t len, size_t startoffs);
|
||||
void hexdump(ios_t *dest, const char *buffer, size_t len, size_t startoffs);
|
||||
|
||||
/* high-level stream functions - input */
|
||||
int ios_getnum(ios_t *s, char *data, uint32_t type);
|
||||
|
|
|
@ -108,7 +108,7 @@ void timestring(double seconds, char *buffer, size_t len)
|
|||
|
||||
#if defined(LINUX) || defined(MACOSX)
|
||||
extern char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
double parsetime(char *str)
|
||||
double parsetime(const char *str)
|
||||
{
|
||||
char *fmt = "%c"; /* needed to suppress GCC warning */
|
||||
char *res;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
u_int64_t i64time();
|
||||
double clock_now();
|
||||
void timestring(double seconds, char *buffer, size_t len);
|
||||
double parsetime(char *str);
|
||||
double parsetime(const char *str);
|
||||
void sleep_ms(int ms);
|
||||
void timeparts(int32_t *buf, double t);
|
||||
|
||||
|
|
|
@ -240,6 +240,8 @@ size_t u8_strlen(const char *s)
|
|||
return count;
|
||||
}
|
||||
|
||||
int wcwidth(wchar_t c);
|
||||
|
||||
size_t u8_strwidth(const char *s)
|
||||
{
|
||||
u_int32_t ch;
|
||||
|
|
Loading…
Reference in New Issue