change a few // comments back to /* */ for older compilers
This commit is contained in:
parent
dbca5e9d5a
commit
ec3d2bfe6c
@ -1,8 +1,13 @@
|
||||
#ifndef LIBOWFAT_ATTRIBUTES_H
|
||||
#define LIBOWFAT_ATTRIBUTES_H
|
||||
|
||||
|
||||
#if __GNUC__ && (__STDC_VERSION__ < 199901L)
|
||||
#define inline __inline__
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
// macro attribute declarations away if we don't have gcc or clang
|
||||
/* macro attribute declarations away if we don't have gcc or clang */
|
||||
#define __attribute__(x)
|
||||
#define __extension__
|
||||
#endif
|
||||
|
21
ent.c
21
ent.c
@ -1,3 +1,4 @@
|
||||
#define _BSD_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@ -26,7 +27,7 @@ struct entity {
|
||||
struct letter {
|
||||
unsigned char c;
|
||||
struct letters* weiter;
|
||||
uint32_t marshaled; // lower 8 bits: char. rest: ofs from start of marshaled blob
|
||||
uint32_t marshaled; /* lower 8 bits: char. rest: ofs from start of marshaled blob */
|
||||
};
|
||||
|
||||
struct letters {
|
||||
@ -98,19 +99,19 @@ void marshalhelper(struct letters* s) {
|
||||
if (!s) return;
|
||||
used+=s->n;
|
||||
assert(used<nodes+2);
|
||||
for (i=1; i!=0; ++i) { // start at 1, go to 256, then access modulo 256; effect: sort but put 0 last
|
||||
for (i=1; i!=0; ++i) { /* start at 1, go to 256, then access modulo 256; effect: sort but put 0 last */
|
||||
uint32_t x;
|
||||
i&=0xff;
|
||||
// printf("%c ",i);
|
||||
/* printf("%c ",i); */
|
||||
if (s->liste[i].c!=i) {
|
||||
if (i==0) return;
|
||||
continue;
|
||||
}
|
||||
// printf("marshalhelper: %c\n",i);
|
||||
/* printf("marshalhelper: %c\n",i); */
|
||||
x=(unsigned char)s->liste[i].c;
|
||||
if (!x) {
|
||||
size_t l=strlen((char*)s->liste[i].weiter)+1;
|
||||
// puts((char*)s->liste[i].weiter);
|
||||
/* puts((char*)s->liste[i].weiter); */
|
||||
x|=useddata<<8;
|
||||
assert(useddata+l<=datasize);
|
||||
memcpy(data+useddata,s->liste[i].weiter,l);
|
||||
@ -123,7 +124,7 @@ void marshalhelper(struct letters* s) {
|
||||
}
|
||||
marshaled[++myindex]=x;
|
||||
}
|
||||
// printf("return\n");
|
||||
/* printf("return\n"); */
|
||||
}
|
||||
|
||||
void marshal(struct letters* s) {
|
||||
@ -169,13 +170,13 @@ int main() {
|
||||
char* s,* entity;
|
||||
size_t ul;
|
||||
if (!isspace(buf[0])) continue;
|
||||
for (s=buf; *s && *s!='"'; ++s) ; // skip whitespace
|
||||
for (s=buf; *s && *s!='"'; ++s) ; /* skip whitespace */
|
||||
if (!(*s=='"')) continue;
|
||||
++s;
|
||||
entity=s;
|
||||
if (*entity!='&') continue;
|
||||
++entity; ++s;
|
||||
for (; *s && *s!='"'; ++s) ; // skip to end of entity
|
||||
for (; *s && *s!='"'; ++s) ; /* skip to end of entity */
|
||||
if (!(*s=='"')) continue;
|
||||
if (s[-1]!=';') continue;
|
||||
s[-1]=0; ++s;
|
||||
@ -217,7 +218,7 @@ int main() {
|
||||
addword(&d,(*cur)->entity,(*cur)->utf8);
|
||||
}
|
||||
fclose(f);
|
||||
// dump(d,0);
|
||||
/* dump(d,0); */
|
||||
marshal(d);
|
||||
{
|
||||
FILE* f=fopen("entities.h","w");
|
||||
@ -235,7 +236,7 @@ int main() {
|
||||
fprintf(f,"\n }\n};");
|
||||
fclose(f);
|
||||
}
|
||||
// puts(lookup(heap,1,"zwnj"));
|
||||
/* puts(lookup(heap,1,"zwnj")); */
|
||||
#if 0
|
||||
puts("};");
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@ simple:
|
||||
return 2;
|
||||
}
|
||||
if (ch>0xffff) {
|
||||
if (ch>0x10ffff) return 0; // highest representable unicode codepoint
|
||||
if (ch>0x10ffff) return 0; /* highest representable unicode codepoint */
|
||||
if (dest) {
|
||||
dest[0]='\\';
|
||||
dest[1]='u';
|
||||
|
@ -14,7 +14,7 @@ size_t fmt_httpdate(char* dest,time_t t) {
|
||||
#ifdef _WIN32
|
||||
struct tm tmp;
|
||||
struct tm* x=&tmp;
|
||||
gmtime_s(&tmp,&t); // can't recover from when this fails
|
||||
gmtime_s(&tmp,&t); /* can't recover from when this fails */
|
||||
#else
|
||||
struct tm* x=gmtime(&t);
|
||||
#endif
|
||||
|
@ -12,7 +12,7 @@ size_t fmt_iso8601(char* dest,time_t t) {
|
||||
#ifdef _WIN32
|
||||
struct tm tmp;
|
||||
struct tm* x=&tmp;
|
||||
gmtime_s(&tmp,&t); // can't recover from when this fails
|
||||
gmtime_s(&tmp,&t); /* can't recover from when this fails */
|
||||
#else
|
||||
struct tm* x=gmtime(&t);
|
||||
#endif
|
||||
|
@ -49,8 +49,7 @@ size_t scan_httpdate(const char *in,time_t *t) {
|
||||
goto done;
|
||||
}
|
||||
c+=scan_ulong(c,&tmp); x.tm_mday=(int)tmp;
|
||||
while (*c==' ') ++c; // work around crappy sqlite download httpd
|
||||
// ++c;
|
||||
while (*c==' ') ++c; /* work around crappy sqlite download httpd */
|
||||
for (i=0; i<12; ++i)
|
||||
if (case_equalb(c,3,months+i*3)) {
|
||||
x.tm_mon=i; break;
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Note: *dest will point inside the input buffer!
|
||||
*/
|
||||
size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) {
|
||||
// [len]":"[string]","
|
||||
// 3:foo,3:bar,4:fini,
|
||||
/* [len]":"[string]","
|
||||
3:foo,3:bar,4:fini, */
|
||||
unsigned long l;
|
||||
size_t n=scan_ulongn(in,len,&l);
|
||||
if (!n || /* did not start with a number */
|
||||
|
@ -5,11 +5,11 @@ size_t scan_varint(const char* in,size_t len, unsigned long long* n) {
|
||||
unsigned long long l;
|
||||
if (len==0) return 0;
|
||||
for (l=0, i=0; i<len; ++i) {
|
||||
if (i*7+7>sizeof(l)*8) // value too large to fit in destination integer!
|
||||
if (i*7+7>sizeof(l)*8) /* value too large to fit in destination integer! */
|
||||
return 0;
|
||||
l+=(unsigned long long)(in[i]&0x7f) << (i*7);
|
||||
if (!(in[i]&0x80)) {
|
||||
if (in[i]==0) return 0; // libowfat extension: reject non-minimal encoding
|
||||
if (in[i]==0) return 0; /* libowfat extension: reject non-minimal encoding */
|
||||
*n=l;
|
||||
return i+1;
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
#include "compiler.h"
|
||||
static inline int foo(int bar) { return bar+1; }
|
||||
|
4
uint32.h
4
uint32.h
@ -2,8 +2,8 @@
|
||||
#ifndef UINT32_H
|
||||
#define UINT32_H
|
||||
|
||||
#include <inttypes.h> // uint32_t, int32_t
|
||||
#include <stddef.h> // size_t
|
||||
#include <inttypes.h> /* uint32_t, int32_t */
|
||||
#include <stddef.h> /* size_t */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user