mirror of
				https://github.com/imgproxy/imgproxy.git
				synced 2025-10-30 23:08:02 +02:00 
			
		
		
		
	Use clang-format style in C files
This commit is contained in:
		
							
								
								
									
										16
									
								
								.clang-format
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.clang-format
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| BasedOnStyle: GNU | ||||
| AccessModifierOffset: -2 | ||||
| AlignAfterOpenBracket: DontAlign | ||||
| AlignEscapedNewlines: DontAlign | ||||
| AlignOperands: DontAlign | ||||
| AllowAllArgumentsOnNextLine: false | ||||
| AllowAllParametersOfDeclarationOnNextLine: false | ||||
| BreakBeforeBinaryOperators: None | ||||
| BreakBeforeBraces: Stroustrup | ||||
| IndentWidth: 2 | ||||
| SortIncludes: Never | ||||
| SpaceAfterCStyleCast: true | ||||
| SpaceBeforeParens: ControlStatements | ||||
| TabWidth: 2 | ||||
| UseTab: Never | ||||
| ColumnLimit: 0 | ||||
| @@ -1,21 +1,23 @@ | ||||
| #include "gliblog.h" | ||||
|  | ||||
| static GLogLevelFlags all_levels = | ||||
|   G_LOG_FLAG_RECURSION | | ||||
|   G_LOG_FLAG_FATAL | | ||||
|   G_LOG_LEVEL_ERROR | | ||||
|   G_LOG_LEVEL_CRITICAL | | ||||
|   G_LOG_LEVEL_WARNING; | ||||
|     G_LOG_FLAG_RECURSION | | ||||
|     G_LOG_FLAG_FATAL | | ||||
|     G_LOG_LEVEL_ERROR | | ||||
|     G_LOG_LEVEL_CRITICAL | | ||||
|     G_LOG_LEVEL_WARNING; | ||||
|  | ||||
| void | ||||
| log_handler(const gchar *log_domain, GLogLevelFlags log_level, | ||||
|   const gchar *message, gpointer user_data) { | ||||
|     const gchar *message, gpointer user_data) | ||||
| { | ||||
|  | ||||
|   logGLib((char *)log_domain, log_level, (char *)message); | ||||
|   logGLib((char *) log_domain, log_level, (char *) message); | ||||
| } | ||||
|  | ||||
| void | ||||
| glib_log_configure() { | ||||
|   g_log_set_handler (NULL, all_levels, log_handler, NULL); | ||||
|   g_log_set_handler ("VIPS",  all_levels, log_handler, NULL); | ||||
| glib_log_configure() | ||||
| { | ||||
|   g_log_set_handler(NULL, all_levels, log_handler, NULL); | ||||
|   g_log_set_handler("VIPS", all_levels, log_handler, NULL); | ||||
| } | ||||
|   | ||||
| @@ -3,4 +3,4 @@ | ||||
| void glib_log_configure(); | ||||
|  | ||||
| // from Go | ||||
| void logGLib (char *domain, GLogLevelFlags log_level, char *message); | ||||
| void logGLib(char *domain, GLogLevelFlags log_level, char *message); | ||||
|   | ||||
							
								
								
									
										25
									
								
								vips/vips.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								vips/vips.c
									
									
									
									
									
								
							| @@ -70,7 +70,8 @@ vips_health() { | ||||
| int | ||||
| vips_jpegload_go(void *buf, size_t len, int shrink, VipsImage **out) { | ||||
|   if (shrink > 1) | ||||
|     return vips_jpegload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, "shrink", shrink, NULL); | ||||
|     return vips_jpegload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, "shrink", shrink, | ||||
|       NULL); | ||||
|  | ||||
|   return vips_jpegload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL); | ||||
| } | ||||
| @@ -228,15 +229,15 @@ vips_fix_BW_float_tiff(VipsImage *in, VipsImage **out) { | ||||
| int | ||||
| vips_fix_float_tiff(VipsImage *in, VipsImage **out) { | ||||
|   /* Vips loads linear alpha in the 0.0-1.0 range but uses the 0.0-255.0 range. | ||||
|   * https://github.com/libvips/libvips/pull/3627 fixes this behavior | ||||
|   */ | ||||
|    * https://github.com/libvips/libvips/pull/3627 fixes this behavior | ||||
|    */ | ||||
|   if (in->Type == VIPS_INTERPRETATION_scRGB && in->Bands > 3) | ||||
|     return vips_fix_scRGB_alpha_tiff(in, out); | ||||
|  | ||||
|   /* Vips loads linear BW TIFFs as VIPS_INTERPRETATION_B_W or VIPS_INTERPRETATION_GREY16 | ||||
|   * but these colourspaces are not linear. We should properly convert them to | ||||
|   * VIPS_INTERPRETATION_GREY16 | ||||
|   */ | ||||
|    * but these colourspaces are not linear. We should properly convert them to | ||||
|    * VIPS_INTERPRETATION_GREY16 | ||||
|    */ | ||||
|   if ( | ||||
|     (in->Type == VIPS_INTERPRETATION_B_W || in->Type == VIPS_INTERPRETATION_GREY16) && | ||||
|     (in->BandFmt == VIPS_FORMAT_FLOAT || in->BandFmt == VIPS_FORMAT_DOUBLE) | ||||
| @@ -354,20 +355,16 @@ vips_icc_is_srgb_iec61966(VipsImage *in) { | ||||
|   // 2.1 | ||||
|   static char version[] = { 2, 16, 0, 0 }; | ||||
|  | ||||
|   // The image had no profile and built-in CMYK was imported. | ||||
|   // Vips gives us an invalid data pointer when the built-in profile was imported, | ||||
|   // so we check this mark before receiving an actual profile. | ||||
|   // if (vips_image_get_typeof(in, "icc-cmyk-no-profile")) | ||||
|   //   return FALSE; | ||||
|  | ||||
|   if (vips_image_get_blob(in, VIPS_META_ICC_NAME, &data, &data_len)) | ||||
|     return FALSE; | ||||
|  | ||||
|   // Less than header size | ||||
|   /* Less than header size | ||||
|    */ | ||||
|   if (data_len < 128) | ||||
|     return FALSE; | ||||
|  | ||||
|   // Predict it is sRGB IEC61966 2.1 by checking some header fields | ||||
|   /* Predict it is sRGB IEC61966 2.1 by checking some header fields | ||||
|    */ | ||||
|   return ((memcmp(data + 48, "IEC ",  4) == 0) && // Device manufacturer | ||||
|           (memcmp(data + 52, "sRGB",  4) == 0) && // Device model | ||||
|           (memcmp(data + 80, "HP  ",  4) == 0) && // Profile creator | ||||
|   | ||||
							
								
								
									
										19
									
								
								vips/vips.h
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								vips/vips.h
									
									
									
									
									
								
							| @@ -32,9 +32,9 @@ void vips_strip_meta(VipsImage *image); | ||||
|  | ||||
| VipsBandFormat vips_band_format(VipsImage *in); | ||||
|  | ||||
| void vips_remove_bits_per_sample(VipsImage * image); | ||||
| void vips_remove_bits_per_sample(VipsImage *image); | ||||
|  | ||||
| gboolean vips_is_animated(VipsImage * in); | ||||
| gboolean vips_is_animated(VipsImage *in); | ||||
|  | ||||
| int vips_image_get_array_int_go(VipsImage *image, const char *name, int **out, int *n); | ||||
| void vips_image_set_array_int_go(VipsImage *image, const char *name, const int *array, int n); | ||||
| @@ -62,26 +62,27 @@ int vips_flip_horizontal_go(VipsImage *in, VipsImage **out); | ||||
|  | ||||
| int vips_extract_area_go(VipsImage *in, VipsImage **out, int left, int top, int width, int height); | ||||
| int vips_smartcrop_go(VipsImage *in, VipsImage **out, int width, int height); | ||||
| int vips_trim(VipsImage *in, VipsImage **out, double threshold, | ||||
|               gboolean smart, double r, double g, double b, | ||||
|               gboolean equal_hor, gboolean equal_ver); | ||||
| int vips_trim(VipsImage *in, VipsImage **out, double threshold, gboolean smart, double r, double g, | ||||
|     double b, gboolean equal_hor, gboolean equal_ver); | ||||
|  | ||||
| int vips_apply_filters(VipsImage *in, VipsImage **out, double blur_sigma, double sharp_sigma, int pixelate_pixels); | ||||
| int vips_apply_filters(VipsImage *in, VipsImage **out, double blur_sigma, double sharp_sigma, | ||||
|     int pixelate_pixels); | ||||
|  | ||||
| int vips_flatten_go(VipsImage *in, VipsImage **out, double r, double g, double b); | ||||
|  | ||||
| int vips_replicate_go(VipsImage *in, VipsImage **out, int across, int down); | ||||
| int vips_embed_go(VipsImage *in, VipsImage **out, int x, int y, int width, int height); | ||||
|  | ||||
| int vips_apply_watermark(VipsImage *in, VipsImage *watermark, VipsImage **out, | ||||
|                          int left, int top, double opacity); | ||||
| int vips_apply_watermark(VipsImage *in, VipsImage *watermark, VipsImage **out, int left, int top, | ||||
|     double opacity); | ||||
|  | ||||
| int vips_arrayjoin_go(VipsImage **in, VipsImage **out, int n); | ||||
|  | ||||
| int vips_strip(VipsImage *in, VipsImage **out, int keep_exif_copyright); | ||||
|  | ||||
| int vips_jpegsave_go(VipsImage *in, void **buf, size_t *len, int quality, int interlace); | ||||
| int vips_pngsave_go(VipsImage *in, void **buf, size_t *len, int interlace, int quantize, int colors); | ||||
| int vips_pngsave_go(VipsImage *in, void **buf, size_t *len, int interlace, int quantize, | ||||
|     int colors); | ||||
| int vips_webpsave_go(VipsImage *in, void **buf, size_t *len, int quality); | ||||
| int vips_gifsave_go(VipsImage *in, void **buf, size_t *len); | ||||
| int vips_avifsave_go(VipsImage *in, void **buf, size_t *len, int quality, int speed); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user