Skip to content

Commit

Permalink
content-length api: unsigned long to lws_filepos_t
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Jun 7, 2017
1 parent 393b38a commit 37053b3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 deletions lib/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
}

int lws_add_http_header_content_length(struct lws *wsi,
unsigned long content_length,
lws_filepos_t content_length,
unsigned char **p, unsigned char *end)
{
char b[24];
int n;

n = sprintf(b, "%lu", content_length);
n = sprintf(b, "%llu", (unsigned long long)content_length);
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH,
(unsigned char *)b, n, p, end))
return 1;
Expand Down
55 changes: 28 additions & 27 deletions lib/libwebsockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,33 @@ typedef int lws_filefd_type;
#define LWS_POLLOUT (POLLOUT)
#endif


#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
/* ... */
#if !defined(ssize_t)
typedef SSIZE_T ssize_t;
#endif
#endif

#if defined(LWS_HAVE_STDINT_H)
#include <stdint.h>
#else
#if defined(WIN32) || defined(_WIN32)
/* !!! >:-[ */
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
#else
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
#endif
#endif

typedef size_t lws_filepos_t;
typedef ssize_t lws_fileofs_t;
typedef uint32_t lws_fop_flags_t;

/** struct lws_pollargs - argument structure for all external poll related calls
* passed in via 'in' */
struct lws_pollargs {
Expand Down Expand Up @@ -3171,7 +3198,7 @@ lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
*/
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_add_http_header_content_length(struct lws *wsi,
unsigned long content_length,
lws_filepos_t content_length,
unsigned char **p, unsigned char *end);
/**
* lws_finalize_http_header() - terminate header block
Expand Down Expand Up @@ -4535,32 +4562,6 @@ lws_cgi_kill(struct lws *wsi);

struct lws_plat_file_ops;

#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
/* ... */
#if !defined(ssize_t)
typedef SSIZE_T ssize_t;
#endif
#endif

#if defined(LWS_HAVE_STDINT_H)
#include <stdint.h>
#else
#if defined(WIN32) || defined(_WIN32)
/* !!! >:-[ */
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
#else
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
#endif
#endif

typedef size_t lws_filepos_t;
typedef ssize_t lws_fileofs_t;
typedef uint32_t lws_fop_flags_t;

struct lws_fop_fd {
lws_filefd_type fd;
/**< real file descriptor related to the file... */
Expand Down

0 comments on commit 37053b3

Please sign in to comment.