Skip to content

Commit aac2ee9

Browse files
committed
Fix default locale for Windows, VC project files, and ippeveprinter issues.
1 parent ed3354b commit aac2ee9

File tree

7 files changed

+41
-13
lines changed

7 files changed

+41
-13
lines changed

cups/langprintf.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,26 @@ cups_lang_default(void)
370370

371371
// See if the locale has been set; if it is still "C" or "POSIX", use the
372372
// environment to get the default...
373-
# ifdef LC_MESSAGES
373+
# ifdef _WIN32
374+
WCHAR wlocname[32]; // Locale name as wide chars
375+
char locname[32]; // Locale name
376+
377+
if (GetUserDefaultLocaleName(wlocname, sizeof(wlocname)) > 0)
378+
{
379+
size_t i; // Looping var
380+
381+
for (i = 0; i < (sizeof(locname) / sizeof(locname[0]) - 1); i ++)
382+
locname[i] = (char)wlocname[i];
383+
384+
locname[i] = '\0';
385+
lang = locname;
386+
}
387+
else
388+
{
389+
lang = "en";
390+
}
391+
392+
# elif defined(LC_MESSAGES)
374393
lang = setlocale(LC_MESSAGES, NULL);
375394
# else
376395
lang = setlocale(LC_ALL, NULL);

tools/ippeveprinter.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3849,6 +3849,7 @@ ippfile_attr_cb(
38493849
"job-settable-attributes-supported",
38503850
"job-sheets-default",
38513851
"job-sheets-supported",
3852+
"max-page-ranges-supported",
38523853
"media-col-supported",
38533854
"multiple-document-handling-supported",
38543855
"multiple-document-jobs-supported",
@@ -3863,6 +3864,8 @@ ippfile_attr_cb(
38633864
"notify-max-events-supported",
38643865
"notify-pull-method-supported",
38653866
"operations-supported",
3867+
"overrides-supported",
3868+
"page-ranges-supported",
38663869
"pdl-override-supported",
38673870
"preferred-attributes-supported",
38683871
"printer-alert",
@@ -4344,6 +4347,10 @@ load_legacy_attributes(
43444347
// finishings-supported
43454348
ippAddInteger(attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM, "finishings-supported", IPP_FINISHINGS_NONE);
43464349

4350+
// max-page-ranges-supported
4351+
if (!ippFindAttribute(attrs, "max-page-ranges-supported", IPP_TAG_ZERO) && cupsArrayFind(docformats, (void *)"application/pdf"))
4352+
ippAddInteger(attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "max-page-ranges-supported", 1);
4353+
43474354
// media-bottom-margin-supported
43484355
if (ppm_color > 0)
43494356
ippAddIntegers(attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "media-bottom-margin-supported", (int)(sizeof(media_bottom_margin_supported) / sizeof(media_bottom_margin_supported[0])), media_bottom_margin_supported);
@@ -6208,15 +6215,23 @@ register_printer(
62086215
if (!cupsDNSSDServiceAdd(printer->services, "_http._tcp,_printer", /*domain*/NULL, printer->hostname, (uint16_t)printer->port, num_txt, txt))
62096216
goto error;
62106217

6218+
// Commit it...
6219+
if (!cupsDNSSDServicePublish(printer->services))
6220+
goto error;
6221+
6222+
fprintf(stderr, "Registered printer '%s' for discovery using DNS-SD.\n", printer->dnssd_name);
6223+
62116224
cupsFreeOptions(num_txt, txt);
62126225

6213-
// Commit it...
6214-
return (cupsDNSSDServicePublish(printer->services));
6226+
return (true);
62156227

62166228
// If we get here there was a problem...
62176229
error:
62186230

6231+
fprintf(stderr, "Unable to register printer '%s' for discovery using DNS-SD: %s\n", printer->dnssd_name, cupsGetErrorString());
6232+
62196233
cupsFreeOptions(num_txt, txt);
6234+
62206235
return (false);
62216236
}
62226237

vcnet/ippeveprinter.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@
107107
<ClCompile Include="..\tools\ippeveprinter.c" />
108108
</ItemGroup>
109109
<ItemGroup>
110-
<ProjectReference Include="dnssdstub.vcxproj">
111-
<Project>{c0899b3a-43e7-4bc3-a785-659e1fd2ea83}</Project>
112-
</ProjectReference>
113110
<ProjectReference Include="libcups3.vcxproj">
114111
<Project>{cb4aa6f2-3e84-45be-b505-95cd375e8be3}</Project>
115112
</ProjectReference>

vcnet/ippeveprinter.vcxproj.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<LocalDebuggerEnvironment>CUPS_DEBUG_LOG=-;CUPS_DEBUG_LEVEL=9;CUPS_DEBUG_FILTER=sspi</LocalDebuggerEnvironment>
77
</PropertyGroup>
88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
9-
<LocalDebuggerCommandArguments>-vvv -p 8631 -n localhost Test</LocalDebuggerCommandArguments>
9+
<LocalDebuggerCommandArguments>-vvv -p 8631 Test</LocalDebuggerCommandArguments>
1010
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
1111
</PropertyGroup>
1212
</Project>

vcnet/ippfind.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@
105105
<ClCompile Include="..\tools\ippfind.c" />
106106
</ItemGroup>
107107
<ItemGroup>
108-
<ProjectReference Include="dnssdstub.vcxproj">
109-
<Project>{c0899b3a-43e7-4bc3-a785-659e1fd2ea83}</Project>
110-
</ProjectReference>
111108
<ProjectReference Include="libcups3.vcxproj">
112109
<Project>{cb4aa6f2-3e84-45be-b505-95cd375e8be3}</Project>
113110
</ProjectReference>

vcnet/libcups3.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
7272
</ClCompile>
7373
<Link>
74-
<AdditionalDependencies>bcrypt.lib;ws2_32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
74+
<AdditionalDependencies>bcrypt.lib;ws2_32.lib;advapi32.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
7575
<OutputFile>$(OutDir)libcups3.dll</OutputFile>
7676
<ModuleDefinitionFile>..\cups\libcups3.def</ModuleDefinitionFile>
7777
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -95,7 +95,7 @@
9595
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
9696
</ClCompile>
9797
<Link>
98-
<AdditionalDependencies>bcrypt.lib;ws2_32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
98+
<AdditionalDependencies>bcrypt.lib;ws2_32.lib;advapi32.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
9999
<OutputFile>$(OutDir)libcups3.dll</OutputFile>
100100
<ModuleDefinitionFile>..\cups\libcups3.def</ModuleDefinitionFile>
101101
<GenerateDebugInformation>true</GenerateDebugInformation>

0 commit comments

Comments
 (0)