@@ -48,12 +48,15 @@ struct cb_data {
4848 S3Status status ;
4949};
5050
51- static S3Status response_props_cb (const S3ResponseProperties * properties , void * data )
51+ static S3Status response_props_cb (const S3ResponseProperties * properties ,
52+ void * data )
5253{
5354 return S3StatusOK ;
5455}
5556
56- static void response_complete_cb (S3Status status , const S3ErrorDetails * error , void * data )
57+ static void response_complete_cb (S3Status status ,
58+ const S3ErrorDetails * error ,
59+ void * data )
5760{
5861 struct cb_data * ctx = data ;
5962 ctx -> status = status ;
@@ -65,7 +68,8 @@ static void response_complete_cb (S3Status status, const S3ErrorDetails *error,
6568static int put_object_cb (int buff_size , char * buff , void * data )
6669{
6770 struct cb_data * ctx = data ;
68- int size = (buff_size < ctx -> size - ctx -> count ? buff_size : ctx -> size - ctx -> count );
71+ int size = (buff_size < ctx -> size - ctx -> count ? buff_size
72+ : ctx -> size - ctx -> count );
6973
7074 memcpy (buff , ctx -> data + ctx -> count , size );
7175 ctx -> count += size ;
@@ -145,17 +149,20 @@ int s3_bucket_create (struct s3_config *cfg, const char **errstr)
145149 S3_create_bucket (protocol ,
146150 cfg -> access_key ,
147151 cfg -> secret_key ,
148- NULL , // hostName (NULL to use the same hostName passed to S3_initialize())
152+ NULL , // hostName (NULL=use hostName passed
153+ // to S3_initialize())
149154 cfg -> bucket ,
150155 S3CannedAclPrivate ,
151156 NULL , // locationContstraint
152- NULL , // requestContext (NULL for synchronous operation)
157+ NULL , // requestContext (NULL for synchronous
158+ // operation)
153159 & resp_hndl ,
154160 & ctx );
155161 retries -- ;
156162 } while (S3_status_is_retryable (ctx .status ) && retries > 0 );
157163
158- if (ctx .status != S3StatusOK && ctx .status != S3StatusErrorBucketAlreadyOwnedByYou ) {
164+ if (ctx .status != S3StatusOK
165+ && ctx .status != S3StatusErrorBucketAlreadyOwnedByYou ) {
159166 errno = EREMOTEIO ;
160167 if (errstr )
161168 * errstr = S3_get_status_name (status );
@@ -166,7 +173,11 @@ int s3_bucket_create (struct s3_config *cfg, const char **errstr)
166173 return 0 ;
167174}
168175
169- int s3_put (struct s3_config * cfg , const char * key , const void * data , size_t size , const char * * errstr )
176+ int s3_put (struct s3_config * cfg ,
177+ const char * key ,
178+ const void * data ,
179+ size_t size ,
180+ const char * * errstr )
170181{
171182 int retries = cfg -> retries ;
172183 S3Status status = S3StatusOK ;
@@ -190,7 +201,10 @@ int s3_put (struct s3_config *cfg, const char *key, const void *data, size_t siz
190201 .putObjectDataCallback = & put_object_cb
191202 };
192203
193- if (strlen (key ) == 0 || strchr (key , '/' ) || !strcmp (key , ".." ) || !strcmp (key , "." )) {
204+ if (strlen (key ) == 0
205+ || strchr (key , '/' )
206+ || !strcmp (key , ".." )
207+ || !strcmp (key , "." )) {
194208 errno = EINVAL ;
195209 if (errstr )
196210 * errstr = "invalid key" ;
@@ -227,7 +241,11 @@ int s3_put (struct s3_config *cfg, const char *key, const void *data, size_t siz
227241 return 0 ;
228242}
229243
230- int s3_get (struct s3_config * cfg , const char * key , void * * datap , size_t * sizep , const char * * errstr )
244+ int s3_get (struct s3_config * cfg ,
245+ const char * key ,
246+ void * * datap ,
247+ size_t * sizep ,
248+ const char * * errstr )
231249{
232250 int retries = cfg -> retries ;
233251 size_t size = 0 ;
@@ -260,7 +278,10 @@ int s3_get (struct s3_config *cfg, const char *key, void **datap, size_t *sizep,
260278 .status = status
261279 };
262280
263- if (strlen (key ) == 0 || strchr (key , '/' ) || !strcmp (key , ".." ) || !strcmp (key , "." )) {
281+ if (strlen (key ) == 0
282+ || strchr (key , '/' )
283+ || !strcmp (key , ".." )
284+ || !strcmp (key , "." )) {
264285 errno = EINVAL ;
265286 if (errstr )
266287 * errstr = "invalid key" ;
@@ -273,14 +294,15 @@ int s3_get (struct s3_config *cfg, const char *key, void **datap, size_t *sizep,
273294 key ,
274295 NULL , // getConditions (NULL for none)
275296 0 , // startByte
276- 0 , // byteCount (0 indicates the entire object should be read)
297+ 0 , // byteCount (0 indicates the entire object
298+ // should be read)
277299 NULL , // requestContext (NULL for synchronous operation)
278300 & get_obj_hndl , & ctx );
279301 retries -- ;
280302 } while (S3_status_is_retryable (ctx .status ) && retries > 0 );
281303
282304 if (ctx .status != S3StatusOK ) {
283- free (ctx .data );
305+ free (ctx .data );
284306 if (ctx .status == S3StatusErrorNoSuchKey )
285307 errno = ENOENT ;
286308 else
0 commit comments